/* Layout: fixed left rail of tools, a working canvas on the right; collapses to a top tab strip on phones.
   Palette and layout shared with Federation 360. */
:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef2f3;
  --line: #d9e0e3;
  --fg: #142026;
  --muted: #56666e;
  --accent: #0b6e69;
  --accent-ink: #ffffff;
  --accent-soft: #dcefed;
  --ok: #1d7a3e;
  --ok-soft: #e1f3e7;
  --info: #31608f;
  --info-soft: #e3edf7;
  --warn: #9a6200;
  --warn-soft: #fbf0d9;
  --crit: #b3261e;
  --crit-soft: #fbe3e1;
  --code-bg: #f0f3f4;
  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", Menlo, monospace;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1619; --surface: #162024; --surface-2: #1c292e; --line: #2b3a40; --fg: #e3eaec; --muted: #9aabb2;
    --accent: #3fb8ae; --accent-ink: #062321; --accent-soft: #163a38;
    
    --ok: #5cc985; --ok-soft: #173225; --info: #8ab8e6; --info-soft: #182a3b; --warn: #e8b454; --warn-soft: #362a12; --crit: #f08a82; --crit-soft: #3d1c1a;
    --code-bg: #111b1e; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1619; --surface: #162024; --surface-2: #1c292e; --line: #2b3a40; --fg: #e3eaec; --muted: #9aabb2;
  --accent: #3fb8ae; --accent-ink: #062321; --accent-soft: #163a38;
  
  --ok: #5cc985; --ok-soft: #173225; --info: #8ab8e6; --info-soft: #182a3b; --warn: #e8b454; --warn-soft: #362a12; --crit: #f08a82; --crit-soft: #3d1c1a;
  --code-bg: #111b1e; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font-body); }

h1, h2, h3, h4 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.25; }
h1 { font-size: 1.6rem; font-weight: 600; }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
code, pre, .mono { font-family: var(--font-mono); font-size: 0.86em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding-left: max(12px, env(safe-area-inset-left, 0px)); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 0.68rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); padding: 0 10px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--fg); text-decoration: none; font-weight: 500; border: 0; background: none; text-align: left; cursor: pointer; }
.nav-item:hover { background: var(--surface-2); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: 0.85; }
.rail-foot { margin-top: auto; font-size: 0.75rem; color: var(--muted); padding: 0 10px; display: flex; flex-direction: column; gap: 6px; }

.main { padding-block: 28px 64px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-width: 0; }
.page { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head p { color: var(--muted); max-width: 68ch; margin-top: 4px; }

/* Surfaces (shared with Federation 360) */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head .sub { color: var(--muted); font-size: 0.85rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 960px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; border-radius: 6px; cursor: pointer; font-weight: 500; text-decoration: none; color: var(--fg); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.sm { padding: 4px 9px; font-size: 0.82rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 0.74rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; letter-spacing: 0.01em; }
.chip.ok { color: var(--ok); background: var(--ok-soft); } .chip.warn { color: var(--warn); background: var(--warn-soft); }
.chip.bad { color: var(--crit); background: var(--crit-soft); } .chip.unknown { color: var(--muted); background: var(--surface-2); }
.chip.info { color: var(--info); background: var(--info-soft); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
td.nowrap { white-space: nowrap; }
tbody tr.link { cursor: pointer; } tbody tr.link:hover { background: var(--surface-2); }
.kv { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 6px 14px; font-size: 0.88rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.code { background: var(--code-bg); border: 1px solid var(--line); border-radius: 6px; padding: 12px; overflow-x: auto; font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.55; white-space: pre; margin: 0; }
.statline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.statline > div { padding: 14px 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.statline > div:last-child { border-right: 0; }
.statline .n { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.statline .l { font-size: 0.8rem; color: var(--muted); }
@media (max-width: 680px) { .statline { grid-template-columns: repeat(2, minmax(0, 1fr)); } .statline > div:nth-child(2) { border-right: 0; } .statline > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }
.callout { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 9px 12px; border-radius: 0 6px 6px 0; font-size: 0.9rem; }
.callout.warn { border-color: var(--warn); background: var(--warn-soft); }
.callout.bad { border-color: var(--crit); background: var(--crit-soft); }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; background: var(--surface); }
.verdict { display: flex; gap: 14px; align-items: center; }
.verdict .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--crit); } .dot.unknown { background: var(--muted); }
.area { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.area:last-child { border-bottom: 0; }
.area .bar { width: 10px; height: 100%; min-height: 34px; border-radius: 3px; }
.bar.ok { background: var(--ok); } .bar.warn { background: var(--warn); } .bar.bad { background: var(--crit); } .bar.unknown { background: var(--line); }
details > summary { cursor: pointer; color: var(--accent); font-weight: 500; margin: 8px 0; }
ol.steps-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 14px; }
ol.steps-list li::marker { font-weight: 600; color: var(--accent); }
.toast { position: fixed; bottom: max(16px, env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 6px; z-index: 60; font-size: 0.88rem; }
.rail-foot .who { font-weight: 600; color: var(--fg); overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; height: auto; flex-direction: row; align-items: center; padding: 8px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); gap: 10px; }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
  .brand-sub, .nav-label, .rail-foot { display: none; }
  .nav-group { flex-direction: row; gap: 2px; }
  .nav-item { white-space: nowrap; padding: 6px 9px; }
  .nav-item svg { display: none; }
  .main { padding-block: 18px 48px; }
}
.panel h3 { margin: 18px 0 8px; }
pre.code { white-space: pre-wrap; overflow-wrap: anywhere; }

.option { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; }
.option > span { display: flex; flex-direction: column; gap: 2px; }
.option:has(.num-input) { grid-template-columns: minmax(0, 1fr) auto; }
.num-input { width: 80px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: inherit; font: inherit; }
.incidents { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.incidents li { border-left: 3px solid var(--line); padding-left: 10px; }
