/* =========================================================================
   Network Operations demo · professional ABCDEFG skin (v4)
   the brand site look: navy utility bar, blue hero gradient (teal tint at the left
   edge) behind header + board, deep-blue cards, navy footer.
   One sans-serif family (system stack), no webfonts.
   Lime is a brand accent only: never a status color, never a flood.
   Status colors are separate from brand colors and always paired with a
   word or shape: down = red, attention = amber, ok = teal-blue.
   ========================================================================= */

:root {
  /* brand (the brand site, sampled) */
  --navy: #041F4D;
  --blue: #00539D;
  --blue-2: #01478A;
  --blue-3: #023974;
  --teal-tint: #367772;
  --lime: #C3D600;
  --pale: #E6EEF5;
  --white: #FFFFFF;

  /* surfaces + text on the blue hero */
  --hero: linear-gradient(100deg, #2F6E73 0%, #0D4F88 16%, #01478A 40%, #014C91 68%, #023974 100%);
  --bg: #01478A;        /* fallback under the hero gradient */
  --surface: rgba(255, 255, 255, 0.07);  /* cards: lighter panels over the hero, like the brand site */
  --surface-2: rgba(255, 255, 255, 0.10); /* insets, tags, hover */
  --surface-solid: #0A3F7D;              /* opaque: detail panel, search results */
  --canvas: #0A3F7D;    /* topology background */
  --edge: rgba(255, 255, 255, 0.16); /* soft card borders */
  --heading: #FFFFFF;
  --accent: #8CC6FF;    /* brand blue, lifted for text/numbers on blue */
  --ink: #E6EEF7;
  --muted: #B3C4DB;
  --dim: #8299B8;
  --line: #22508F;
  --line-2: #3062A6;
  --slate: #8FA3C0;     /* muted slate-blue on navy */

  /* status (not brand colors), tuned for dark backgrounds */
  --down: #FF5C6A;
  --attn: #F5A623;      /* fills */
  --attn-t: #FFC05C;    /* text */
  --ok: #3CC4D8;
  --good: #43D17F;      /* VPN up / link up */

  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --gutter: 16px;
  --detail-w: 400px;
  --chrome-h: 120px;    /* utility + main bar, measured by app.js */
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  overflow-x: hidden;
  background: var(--hero);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; }
b { font-weight: 700; }
h2, h3 { margin: 0; }

.wrap {
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.muted { color: var(--muted); }
.red-t, .st-down { color: var(--down); }
.amber-t, .st-attention { color: var(--attn-t); }
.st-ok { color: var(--ok); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* A changed number is set to its true value at once; only this highlight moves. */
.flash { animation: flash .8s ease-out 1; }
@keyframes flash { from { background-color: rgba(90, 169, 242, 0.24); } to { background-color: transparent; } }

/* ---------- badges ---------- */
.badge {
  display: inline-block;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.6;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-demo { background: rgba(255, 210, 122, 0.08); color: #FFD27A; border: 1px solid #FFD27A; }
.utility .badge-demo, .badge-on-navy { background: transparent; color: #FFD27A; border-color: #FFD27A; }

/* ---------- utility bar ---------- */
.utility { background: var(--navy); color: #fff; font-size: 12.5px; }
.utility-in {
  display: flex; align-items: center; gap: 6px 18px; flex-wrap: wrap;
  min-height: 34px; padding-top: max(5px, env(safe-area-inset-top)); padding-bottom: 5px;
}
.u-item { color: #DCE6F2; white-space: nowrap; }
.u-nc { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-weight: 600; }
.dot-nc { width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--slate); display: inline-block; }
.u-clock { margin-left: auto; color: #DCE6F2; white-space: nowrap; }
.utility .hdr-stats { order: 9; flex-basis: 100%; }
.u-clock time { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.u-ro, .u-fict { display: none; }

/* ---------- main bar: the brand site-style header on the blue hero ---------- */
.mainbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--hero);
  background-attachment: fixed;
  transition: background-color .2s;
}
.mainbar-in { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 28px; padding-top: 10px; }
.brand { display: flex; flex-direction: column; min-width: 0; padding-bottom: 4px; }
.wordmark {
  font-weight: 800;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0.12em;
  color: #fff;
  white-space: nowrap;
}
.brand-sub { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #DCE6F2; white-space: nowrap; }
.mainbar.scrolled { background: var(--blue); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); }

/* stats (in the navy utility bar) */
.hdr-stats { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0; min-width: 0; }
.stat { display: flex; gap: 6px; align-items: baseline; white-space: nowrap; }
.stat dt { font-size: 12px; color: #B9C8DD; }
.stat dd { margin: 0; font-size: 14px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.stat-down dd { color: var(--down); }
.stat-attn dd { color: var(--attn-t); }
.stat-sel dd { max-width: 18ch; overflow: hidden; text-overflow: ellipsis; color: var(--accent); }

/* ---------- app area ---------- */
.app { padding: 12px 0 16px; }
.app-in { display: flex; flex-direction: column; gap: 10px; min-height: 0; }

/* ---------- nebula tabs = the site nav: bold white labels, lime underline on the active one ---------- */
.tabs {
  display: flex; align-items: center; gap: 10px;
  flex: 1 1 100%;
  min-width: 0;
}
.tab-list {
  display: flex; gap: 2px; flex: 1 1 auto; min-width: 0;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tab-list::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  position: relative;
  display: flex; align-items: center; gap: 7px;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 10px 10px 13px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}
.tab::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 0; height: 4px; background: transparent; }
.tab:hover::after { background: rgba(255, 255, 255, 0.25); }
.tab[aria-selected="true"]::after { background: var(--lime); }
.tab-n {
  min-width: 22px; text-align: center;
  font-size: 11.5px; font-weight: 800;
  padding: 0 6px; border-radius: 999px; line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
.tab-n.st-down { background: var(--down); color: #2A0006; }
.tab-n.st-attention { background: var(--attn); color: var(--navy); }
.tab-n.st-ok { background: var(--ok); color: #001A20; }
/* auto-cycle progress: a thin white bar riding on the lime underline */
.tab .tab-prog { position: absolute; left: 6px; right: 6px; bottom: 4px; height: 2px; transform-origin: left; transform: scaleX(0); background: rgba(255, 255, 255, 0.7); border-radius: 2px; }
.tab[aria-selected="true"].cycling .tab-prog { animation: tabprog 4s linear forwards; }
@keyframes tabprog { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.auto-toggle {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 7px;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 13px; font-weight: 700;
  color: #fff;
  cursor: pointer;
}
.auto-dot { width: 8px; height: 8px; border-radius: 50%; border: 2px solid currentColor; display: inline-block; }
.auto-toggle[aria-pressed="true"] { border-color: var(--lime); }
.auto-toggle[aria-pressed="true"] .auto-dot { background: var(--lime); border-color: var(--lime); }

/* ---------- command row: search + most urgent ---------- */
.cmd-row { display: flex; flex-direction: column; gap: 10px; flex: 0 0 auto; }
.prompt {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 0 8px 0 16px;
  height: 46px;
  box-shadow: var(--shadow);
}
.prompt:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.prompt-icon { color: var(--accent); display: flex; cursor: text; }
.prompt-field { flex: 1 1 auto; min-width: 0; height: 100%; }
.prompt input {
  width: 100%; height: 100%;
  background: transparent; border: 0; border-radius: 0; outline: none;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px; /* >=16px: no iOS zoom on focus */
  padding: 0;
  -webkit-appearance: none; appearance: none;
}
.prompt input::-webkit-search-cancel-button,
.prompt input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.prompt input::placeholder { color: var(--dim); opacity: 1; }
.prompt-clear {
  background: var(--surface); border: 2px solid var(--accent); border-radius: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--accent); padding: 3px 10px; cursor: pointer;
}
.results {
  position: absolute; left: -2px; right: -2px; top: calc(100% + 6px);
  z-index: 45;
  max-height: min(56vh, 460px);
  overflow-y: auto;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.results-hd { padding: 9px 14px; font-size: 12.5px; font-weight: 700; color: var(--heading); border-bottom: 1px solid var(--line); }
.results-note { padding: 7px 14px; color: var(--muted); font-size: 12.5px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.result {
  display: grid; grid-template-columns: 1fr auto; gap: 1px 10px;
  width: 100%; text-align: left;
  background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  padding: 9px 14px; cursor: pointer;
}
.result:hover, .result.active { background: var(--surface-2); }
.result .r-name { color: var(--heading); font-weight: 700; }
.result .r-st { text-align: right; font-size: 12.5px; font-weight: 700; }
.result .r-path { grid-column: 1 / -1; color: var(--accent); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .r-meta { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results-empty { padding: 12px 14px; color: var(--muted); }

.urgent {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-width: 0;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-left: 5px solid var(--down);
  border-radius: 14px;
  padding: 8px 12px;
  cursor: pointer; text-align: left;
  white-space: nowrap; overflow: hidden;
  box-shadow: var(--shadow);
}
.urgent.st-attention { border-left-color: var(--attn); }
.urgent.st-ok { border-left-color: var(--ok); }
.urgent .urgent-k { flex: 0 0 auto; font-size: 12px; font-weight: 800; color: var(--down); text-transform: uppercase; letter-spacing: .06em; }
.urgent.st-attention .urgent-k { color: var(--attn-t); }
.urgent .urgent-name { flex: 0 0 auto; color: var(--heading); font-weight: 800; }
.urgent .urgent-meta { min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.urgent .urgent-go { margin-left: auto; flex: 0 0 auto; color: var(--accent); font-size: 22px; font-weight: 700; line-height: 1; }
.urgent:hover { border-color: var(--line-2); }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
  display: flex; flex-direction: column;
}
.card-hd {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 16px 6px;
  min-width: 0;
}
.card-title { font-size: 15px; font-weight: 800; color: var(--heading); letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-note { font-weight: 600; color: var(--muted); font-size: 13px; }
.scope-tag, .kind-tag {
  flex: 0 0 auto;
  font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--surface-2); border: 1px solid var(--edge); border-radius: 999px; padding: 2px 10px;
  white-space: nowrap; max-width: 60%; overflow: hidden; text-overflow: ellipsis;
}
.kind-tag.kind-queue { color: var(--down); background: rgba(255, 92, 106, 0.14); }
.kind-tag.kind-work { color: var(--attn-t); background: rgba(245, 166, 35, 0.14); }
.card-bd { padding: 6px 16px 14px; min-width: 0; }

/* ---------- topology ---------- */
.graph-panel { overflow: hidden; }
.graph-hd { flex-wrap: wrap; row-gap: 2px; }
.graph-counts { font-size: 13px; color: var(--muted); white-space: nowrap; }
.graph-counts b { color: var(--accent); }
.crumb { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.graph-wrap {
  position: relative;
  height: 52svh; min-height: 300px;
  margin: 4px 10px 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--canvas);
  border: 1px solid var(--edge);
}
#topology {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#topology:active { cursor: grabbing; }
.graph-ctrls { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; z-index: 5; }
.ctl {
  min-width: 36px; height: 36px;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-size: 18px; font-weight: 700; line-height: 1;
  cursor: pointer;
  padding: 0 10px;
}
.ctl-wide { font-size: 13px; }
.ctl:hover { background: var(--surface-2); }
.ctl.is-home { border-color: var(--line-2); color: var(--muted); }
.graph-legend {
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  padding: 8px 16px 0;
  font-size: 13px; color: var(--ink);
}
.graph-legend span { display: flex; align-items: center; gap: 5px; }
.lg { width: 9px; height: 9px; display: inline-block; }
.lg-ok { background: var(--ok); border-radius: 50%; }
.lg-attn { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid var(--attn); }
.lg-down { background: var(--down); transform: rotate(45deg) scale(.85); }
.lg-h { width: 12px; height: 12px; border-radius: 50%; background: var(--canvas); box-shadow: inset 0 0 0 4px #4A97E6; }

.status-line {
  padding: 4px 16px 12px;
  font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-height: 36px;
}
.status-line b { color: var(--heading); }

/* ---------- panel grid (phone: stacked) ---------- */
.main { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.panel-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
.p-big { order: 1; } .p-board { order: 2; } .p-overview { order: 3; } .p-insp { order: 4; }
.p-run { order: 5; } .p-doc { order: 6; } .p-log { order: 7; }

/* overview */
.ov-title { font-size: 20px; font-weight: 800; color: var(--accent); line-height: 1.2; overflow-wrap: anywhere; }
.ov-desc { color: var(--muted); margin: 2px 0 10px; }
.mini-kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
.mini-kv div { background: var(--surface-2); border-radius: 10px; padding: 6px 10px; min-width: 0; }
.mini-kv dt { font-size: 12px; font-weight: 600; color: var(--muted); }
.mini-kv dd { margin: 0; font-size: 20px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.mini-kv dd.red-t { color: var(--down); }
.mini-kv dd.amber-t { color: var(--attn-t); }

/* needs action */
.big {
  font-size: clamp(44px, 13vw, 60px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.big-sub { margin-top: 6px; color: var(--muted); }
.big-sub b { color: var(--heading); font-variant-numeric: tabular-nums; }
.big-sub .red-t b { color: var(--down); }
.big-sub .amber-t b { color: var(--attn-t); }
.sbar { display: flex; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.sbar > i { display: block; height: 100%; width: 0; }
.sbar .sb-down { background: var(--down); }
.sbar .sb-attn { background: var(--attn); }

/* attention board */
.att-board { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ab-row {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-left: 4px solid currentColor;
  border-radius: 12px;
  padding: 7px 10px;
  cursor: pointer; text-align: left;
}
.ab-row:hover { background: var(--surface-2); }
.ab-row.sel { border-color: var(--accent); border-left-color: currentColor; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--accent); }
.ab-top { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.ab-name { color: var(--heading); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-st { flex: 0 0 auto; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ab-bar { position: relative; height: 5px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.ab-bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: currentColor; border-radius: 999px; }
.ab-row.st-attention .ab-bar > i { background: var(--attn); }
.ab-row.st-attention { border-left-color: var(--attn); }
.ab-row.st-ok .ab-bar > i { opacity: .5; }
.ab-meta { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-more { padding: 8px 4px 0; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); margin-top: 2px; }

/* key/value lists */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; }
.kv dt { font-size: 13px; font-weight: 600; color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); }
.insp-empty { color: var(--muted); margin: 0 0 8px; }

/* status word chip (color + word, never color alone) */
.st-chip { display: inline-block; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 0 9px; line-height: 1.7; }
.st-chip.st-down { background: var(--down); color: #2A0006; }
.st-chip.st-attention { background: var(--attn); color: var(--navy); }
.st-chip.st-ok { background: var(--ok); color: #001A20; }

/* per-device health + port matrix (read-only) */
.health { margin-top: 4px; }
.health-hd { font-size: 13px; font-weight: 800; color: var(--heading); margin-bottom: 4px; }
.health-hd span { font-weight: 600; color: var(--muted); }
.h-good { color: var(--good); font-weight: 700; }
.h-bad { color: var(--down); font-weight: 700; }
.h-warn { color: var(--attn-t); font-weight: 700; }
.h-na { color: var(--dim); }
.pill { display: inline-block; border: 2px solid currentColor; border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 800; line-height: 1.5; }
.ports { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; table-layout: fixed; }
.ports th { text-align: left; font-weight: 700; font-size: 12px; color: var(--muted); padding: 3px 6px 3px 0; border-bottom: 2px solid var(--line); }
.ports td { padding: 3px 6px 3px 0; border-bottom: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ports th:first-child, .ports td:first-child { width: 32%; }
/* port squares (Portweaver-style matrix): one square per interface, read-only */
.pm { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.pm i { width: 16px; height: 16px; border-radius: 3px; border: 1.5px solid transparent; display: inline-block; }
.pm .pm-up { background: var(--good); }
.pm .pm-warn { background: var(--attn); }
.pm .pm-down { background: var(--down); }
.pm .pm-unv { border-color: var(--attn); background: transparent; }
.note { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
/* device data: status + health tiles first */
.dev-hd { display: flex; flex-direction: column; margin-bottom: 6px; min-width: 0; }
.dev-hd b { color: var(--heading); font-size: 16px; }
.dev-hd span { color: var(--accent); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health > .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.tile { background: var(--surface-2); border: 1px solid var(--edge); border-radius: 10px; padding: 5px 9px; min-width: 0; display: flex; flex-direction: column; }
.tile > span { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.tile > b { font-size: 14px; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-w { grid-column: 1 / -1; }
.id-kv { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13.5px; }

/* run metrics */
.run-line { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13.5px; }
.run-line + .run-line { margin-top: 5px; }
.run-line b { color: var(--accent); font-variant-numeric: tabular-nums; }
.run-line .red-t b { color: var(--down); }
.run-line .amber-t b { color: var(--attn-t); }

/* activity log: a plain-language audit trail */
.log { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow-y: auto; font-size: 13px; display: flex; flex-direction: column; }
.log li { display: flex; gap: 10px; padding: 2px 0; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log li > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.log .t { flex: 0 0 auto; color: var(--dim); font-variant-numeric: tabular-nums; }

/* detail record */
.doc { font-size: 13.5px; }
.doc-sec + .doc-sec { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.doc-sec h3 { font-size: 12.5px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.doc .health { margin-top: 0; border-top: 0; padding-top: 0; }
.doc-note { color: var(--muted); font-size: 12.5px; margin: 0 0 8px; }
.doc-actions { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
.btn-sm {
  background: var(--surface); border: 2px solid var(--accent); border-radius: 8px;
  color: var(--accent); font-weight: 700; font-size: 13px;
  padding: 2px 10px; cursor: pointer; white-space: nowrap;
}
.btn-sm:hover { background: var(--surface-2); }

/* ---------- detail (phone: bottom sheet) ---------- */
.detail {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 50;
  max-height: 62dvh;
  display: flex; flex-direction: column;
  background: var(--surface-solid);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
  border-top: 1px solid var(--line-2);
  transform: translateY(105%);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  visibility: hidden;
}
.detail.open { transform: translateY(0); visibility: visible; }
.detail-grip { padding: 8px 0 0; cursor: grab; touch-action: none; }
.grip { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 0 auto; }
.detail-hd { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.detail-k { font-size: 13px; font-weight: 700; color: var(--muted); }
.detail-bd { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
.d-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.d-name { font-size: 22px; font-weight: 800; color: var(--heading); line-height: 1.2; overflow-wrap: anywhere; }
.d-status { flex: 0 0 auto; }
.d-cat { color: var(--accent); font-size: 13px; font-weight: 600; margin-top: 2px; }
.d-detail { margin: 8px 0 12px; }
.d-ctx { margin-top: 14px; }
.d-ctx-hd { font-size: 13px; font-weight: 800; color: var(--heading); margin-bottom: 6px; }
.d-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.d-counts div { background: var(--surface-2); border-radius: 10px; padding: 6px 10px; display: flex; flex-direction: column; min-width: 0; }
.d-counts span { font-size: 12px; color: var(--muted); font-weight: 600; }
.d-counts b { font-size: 18px; color: var(--accent); font-variant-numeric: tabular-nums; }
.d-counts b.red-t { color: var(--down); }
.d-counts b.amber-t { color: var(--attn-t); }
.d-foot { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- footer ---------- */
.site-foot { background: var(--navy); color: #fff; padding: 36px 0 28px; position: relative; overflow: hidden; border-top: 1px solid var(--line); }
/* track motif: parallel thin lines forming a large rounded corner (muted slate-blue on navy) */
.site-foot::before {
  content: ""; position: absolute; right: -120px; top: -120px; width: 360px; height: 360px;
  border-radius: 0 0 0 220px;
  box-shadow: inset 6px -6px 0 -4px rgba(143, 163, 192, 0.28);
  border-left: 2px solid rgba(143, 163, 192, 0.18);
  border-bottom: 2px solid rgba(143, 163, 192, 0.18);
  pointer-events: none;
}
.foot-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; position: relative; }
.foot-brand { display: flex; flex-direction: column; gap: 2px; }
.wordmark-lg { color: #fff; font-size: 40px; letter-spacing: 0.22em; }
.foot-sub { font-size: 18px; color: #DCE6F2; }
.lime-rule { border: 0; height: 2px; background: var(--lime); margin: 22px 0 16px; }
.foot-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.foot-line { margin: 0; font-size: 17px; line-height: 1.6; color: #fff; }
.foot-line b { color: #FFD27A; }
.foot-copy { margin: 0 0 0 auto; font-size: 13px; color: var(--slate); }

.noscript { padding: 20px; color: var(--down); }

/* =========================================================================
   Wider phones / tablets
   ========================================================================= */
@media (min-width: 600px) {
  .u-ro { display: inline; }
  .cmd-row { flex-direction: row; align-items: stretch; }
  .cmd-row .prompt { flex: 0 0 44%; }
  .cmd-row .urgent { flex: 1 1 auto; }
}

/* =========================================================================
   Desktop (>= 900px): the board fills the first screen exactly (no scroll
   needed to reach any panel); the footer sits below it.
   ========================================================================= */
@media (min-width: 900px) {
  :root { --gutter: 24px; }
  .u-fict { display: none; }
  .mainbar-in { flex-wrap: nowrap; justify-content: space-between; padding-top: 12px; }
  .tabs { flex: 0 1 auto; }
  .tab { font-size: 15.5px; padding: 12px 12px 16px; }
  .wordmark { font-size: 28px; }
  .utility .hdr-stats { order: 0; flex-basis: auto; margin-left: auto; gap: 2px 22px; }
  .utility .u-clock { margin-left: 0; padding-left: 18px; border-left: 1px solid rgba(255, 255, 255, 0.2); }
  .stat dd { font-size: 15px; }

  .app { height: calc(100vh - var(--chrome-h)); height: calc(100dvh - var(--chrome-h)); padding: 12px 0 14px; }
  .app-in { height: 100%; }

  .main {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 14px;
  }
  .graph-panel { min-height: 0; }
  .graph-wrap { flex: 1 1 auto; height: auto; min-height: 0; }
  .panel-grid {
    min-height: 0;
    height: 100%;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto minmax(0, 1.3fr) minmax(0, 1fr) auto;
    grid-template-areas:
      "big   ov"
      "board insp"
      "board doc"
      "run   log";
  }
  .p-overview { grid-area: ov; } .p-big { grid-area: big; } .p-board { grid-area: board; }
  .p-insp { grid-area: insp; } .p-run { grid-area: run; } .p-log { grid-area: log; } .p-doc { grid-area: doc; }
  .card { min-height: 0; }
  .card-hd { padding: 10px 14px 4px; }
  .card-bd { padding: 4px 14px 10px; }
  .card-title { flex: 0 0 auto; }
  .scope-tag, .kind-tag { flex: 0 1 auto; min-width: 0; max-width: none; }
  .scroll-bd { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .p-log .scroll-bd { overflow: hidden; }
  .log { max-height: 64px; }
  /* compact top + bottom rows so the board, inspector and record get the height */
  .big { font-size: 42px; }
  .big-sub { margin-top: 2px; }
  .sbar { margin-top: 6px; height: 8px; }
  .ov-title { font-size: 17px; }
  .ov-desc { margin: 0 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
  .mini-kv { gap: 6px; }
  .mini-kv div { padding: 3px 8px; }
  .mini-kv dd { font-size: 17px; }
  .run-line { font-size: 13px; gap: 2px 12px; }
  .run-line + .run-line { margin-top: 3px; }

  /* detail docks at the right and pushes everything left: it never covers board rows */
  body.detail-open .utility, body.detail-open .mainbar, body.detail-open .app, body.detail-open .site-foot {
    padding-right: var(--detail-w);
  }
  .detail {
    left: auto; right: 0; top: 0; bottom: 0;
    width: var(--detail-w);
    max-height: none;
    border-radius: 0;
    border-left: 1px solid var(--line);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
    border-top: 0;
    transform: translateX(105%);
  }
  .detail.open { transform: translateX(0); }
  .detail-grip { display: none; }
  .detail-hd { padding-top: 14px; }
}

@media (min-width: 1500px) {
  .u-fict { display: inline; }
}

@media (min-width: 900px) and (max-height: 720px) {
  /* very short desktop windows: let the page scroll rather than crush panels */
  .app { height: auto; }
  .main { height: 860px; }
}

@media (max-width: 380px) {
  .wordmark { letter-spacing: .16em; }
  .stat dt { font-size: 11.5px; }
  .graph-legend { gap: 6px; font-size: 11px; }
  .graph-counts { font-size: 12px; }
}

/* =========================================================================
   Reduced motion: static frame, instant numbers, no transitions.
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
