/* Matrix Ops signal console — production surface, not a presentation mockup. */
:root {
  --home-black: #cfc9be;
  --home-rail: #171d1c;
  --home-panel: #ddd8ce;
  --home-panel-2: #d6d0c5;
  --home-panel-3: #cbc5ba;
  --home-paper: #ebe7de;
  --home-paper-2: #e2ddd3;
  --home-sheet: #f4f1e9;
  --home-ink: #222724;
  --home-muted: #666a65;
  --home-dim: #898b84;
  --home-line: rgba(39, 45, 41, .15);
  --home-dark-line: rgba(255, 255, 255, .105);
  --critical: #b43d35;
  --critical-deep: #9f332d;
  --warning: #9b691c;
  --unknown: #68757b;
  --healthy: #34795c;
  --focus: #2f6f96;
  --home-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --home-sans: "Avenir Next", Avenir, "PingFang SC", "Microsoft YaHei", ui-sans-serif, sans-serif;
}

html:has(.home-app) { background: var(--home-black); }
body.home-app {
  display: block;
  min-width: 320px;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--home-black);
  color: var(--home-ink);
  font-family: var(--home-sans);
  font-size: 14px;
  line-height: 1.45;
}
.home-app *, .home-app *::before, .home-app *::after { box-sizing: border-box; }
.home-app button, .home-app input { font: inherit; }
.home-app button, .home-app a { -webkit-tap-highlight-color: transparent; }
.home-app a { color: inherit; }
.home-app [hidden] { display: none !important; }
.home-app svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.home-app :focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.home-app .sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; z-index: 1000; top: 8px; left: 72px; padding: 9px 13px;
  background: #fff; color: #111; transform: translateY(-160%); transition: transform .16s ease;
}
.skip-link:focus { transform: translateY(0); }

.console-shell {
  display: grid;
  grid-template-columns: 64px 296px minmax(560px, 1fr) 328px;
  height: 100dvh;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
}

/* Rail */
.global-rail {
  position: relative;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  padding: 14px 8px 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), transparent 45%),
    var(--home-rail);
  color: #d8dce1;
  border-right: 1px solid rgba(255,255,255,.08);
}
.rail-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: 0 auto 22px;
  border: 1px solid rgba(255,255,255,.3);
  background: linear-gradient(145deg, #232b35, #11161d);
  color: #fff !important;
  text-decoration: none;
  font-family: var(--home-mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.08em;
  box-shadow: inset 0 1px rgba(255,255,255,.12), 0 8px 20px rgba(0,0,0,.3);
}
.rail-links { display: flex; flex: 1; flex-direction: column; gap: 5px; }
.rail-foot { padding-top: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.rail-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  border: 0;
  border-radius: 2px;
  color: #858d98 !important;
  text-decoration: none;
  font-size: 9px;
  letter-spacing: .08em;
  cursor: pointer;
}
.rail-link svg { width: 20px; height: 20px; }
.rail-link::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 11px;
  bottom: 11px;
  width: 2px;
  background: transparent;
}
.rail-link:hover { background: rgba(255,255,255,.045); color: #d8dce1 !important; }
.rail-link.is-active { background: rgba(255,255,255,.07); color: #fff !important; }
.rail-link.is-active::before { background: #df665c; box-shadow: 0 0 12px rgba(223,102,92,.48); }
.rail-button { width: 100%; background: none; }

/* Signal inbox */
.signal-pane {
  position: relative;
  z-index: 20;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 0, rgba(255,255,255,.56), transparent 31%),
    linear-gradient(180deg, rgba(255,255,255,.14), transparent 42%),
    var(--home-panel);
  color: var(--home-ink);
  border-right: 1px solid rgba(39,45,41,.2);
  box-shadow: 10px 0 28px rgba(46,43,37,.07);
}
.pane-brand {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-height: 92px;
  padding: 22px 20px 15px;
  border-bottom: 1px solid var(--home-line);
}
.eyebrow {
  margin: 0 0 5px;
  color: #777b75;
  font-family: var(--home-mono);
  font-size: 9px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: .16em;
}
.pane-brand h1 {
  margin: 0;
  color: var(--home-ink);
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: -.03em;
}
.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  color: #747b77;
  font-family: var(--home-mono);
  font-size: 9px;
  letter-spacing: .04em;
}
.live-indicator span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.live-indicator[data-state="ok"] { color: var(--healthy); }
.live-indicator[data-state="bad"] { color: var(--critical); }
.live-indicator[data-state="ok"] span { box-shadow: 0 0 0 4px rgba(52,121,92,.1); }
.signal-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--home-line);
}
.signal-summary > div { min-width: 0; padding: 14px 9px 12px; text-align: center; border-right: 1px solid var(--home-line); }
.signal-summary > div:last-child { border-right: 0; }
.signal-summary strong { display: block; color: #282d29; font-family: var(--home-mono); font-size: 17px; line-height: 1.1; }
.signal-summary span { display: block; margin-top: 4px; color: #777b75; font-size: 9px; white-space: nowrap; }
.signal-tools { padding: 13px 14px 11px; border-bottom: 1px solid var(--home-line); }
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  background: rgba(255,255,255,.36);
  border: 1px solid rgba(49,55,51,.17);
  color: #747a75;
}
.search-box:focus-within { border-color: #71827e; box-shadow: 0 0 0 2px rgba(47,111,150,.1); }
.search-box svg { flex: 0 0 auto; width: 17px; height: 17px; }
.search-box input {
  width: 100%; min-width: 0; height: 36px; padding: 0; border: 0; outline: 0;
  background: transparent; color: var(--home-ink); font-size: 12px;
}
.search-box input::placeholder { color: #8b8e87; }
.filter-row { display: flex; gap: 5px; margin-top: 10px; }
.filter-chip {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #6e736e;
  font-size: 10px;
  cursor: pointer;
}
.filter-chip:hover { color: #252a27; }
.filter-chip.is-active { border-color: rgba(43,49,45,.18); background: rgba(255,255,255,.44); color: #252a27; }
.signal-list-wrap { position: relative; flex: 1; min-height: 0; }
.signal-list {
  height: 100%;
  margin: 0;
  padding: 6px 0 24px;
  list-style: none;
  overflow: auto;
  scrollbar-color: #b5b0a6 transparent;
  scrollbar-width: thin;
}
.signal-row { margin: 0; padding: 0; }
.signal-card {
  position: relative;
  display: grid;
  grid-template-columns: 45px minmax(0, 1fr) 16px;
  align-items: start;
  width: 100%;
  min-height: 91px;
  padding: 15px 12px 14px 15px;
  border: 0;
  border-left: 2px solid transparent;
  border-bottom: 1px solid var(--home-line);
  background: transparent;
  color: var(--home-ink);
  text-align: left;
  cursor: pointer;
}
.signal-severity { grid-column: 1; grid-row: 1 / span 2; }
.signal-body { grid-column: 2; grid-row: 1; }
.signal-arrow { grid-column: 3; grid-row: 1 / span 2; }
.signal-card:hover { background: rgba(255,255,255,.31); }
.signal-card[aria-current="true"] {
  border-left-color: var(--state-color, var(--unknown));
  background: linear-gradient(90deg, color-mix(in srgb, var(--state-color, var(--unknown)) 10%, transparent), rgba(255,255,255,.38));
}
.signal-row[data-state="critical"] { --state-color: var(--critical-deep); }
.signal-row[data-state="warning"] { --state-color: var(--warning); }
.signal-row[data-state="unknown"] { --state-color: var(--unknown); }
.signal-row[data-state="ok"] { --state-color: var(--healthy); }
.signal-severity { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; color: var(--state-color); }
.signal-severity i { display: block; width: 9px; height: 9px; margin-top: 3px; border: 2px solid currentColor; border-radius: 50%; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 12%, transparent); }
.signal-severity b { color: currentColor; font-family: var(--home-mono); font-size: 9px; line-height: 1.2; letter-spacing: .04em; text-transform: uppercase; }
.signal-body { display: block; min-width: 0; }
.signal-body > strong { display: block; overflow: hidden; color: #252a27; font-size: 12px; font-weight: 650; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.signal-body > small { display: -webkit-box; overflow: hidden; min-height: 31px; margin-top: 4px; color: #6f746f; font-size: 10px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.signal-meta { display: flex; gap: 7px; align-items: center; margin-top: 6px; color: #6f746f; font-family: var(--home-mono); font-size: 9px; }
.signal-meta em { overflow: hidden; max-width: 104px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.signal-meta time { margin-left: auto; white-space: nowrap; }
.signal-arrow { align-self: center; width: 14px; height: 14px; color: #8b8f89; }
.signal-response {
  display: flex;
  grid-column: 2;
  grid-row: 2;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin-top: 7px;
  color: #4d5852;
  font-size: 9px;
}
.signal-response[hidden] { display: none; }
.signal-response b { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.signal-response time { margin-left: auto; color: #767b76; font-family: var(--home-mono); white-space: nowrap; }
.signal-quick-open {
  display: flex;
  grid-column: 2;
  grid-row: 2;
  align-items: center;
  margin-top: 7px;
}
.signal-quick-open[hidden] { display: none; }
.quick-open-btn {
  padding: 2px 8px;
  border: 1px solid var(--critical-deep, #b23a3a);
  border-radius: 3px;
  background: transparent;
  color: var(--critical-deep, #b23a3a);
  font-size: 9px;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.quick-open-btn:hover {
  background: var(--critical-deep, #b23a3a);
  color: #fff;
}
.signal-loading { padding: 18px; border-bottom: 1px solid var(--home-line); }
.signal-loading span { display: block; height: 8px; margin-bottom: 9px; background: linear-gradient(90deg, #d0cbc1, #e7e2d8, #d0cbc1); background-size: 220% 100%; animation: shimmer 1.4s linear infinite; }
.signal-loading span:nth-child(1) { width: 30%; }
.signal-loading span:nth-child(2) { width: 77%; }
.signal-loading span:nth-child(3) { width: 52%; margin-bottom: 0; }
@keyframes shimmer { to { background-position: -220% 0; } }
.pane-empty { position: absolute; inset: 0; display: grid; place-content: center; padding: 24px; color: #747974; text-align: center; }
.pane-empty[hidden] { display: none; }
.pane-empty .empty-glyph { color: #8a908b; font-size: 28px; }
.pane-empty strong { margin-top: 8px; color: #404642; font-size: 12px; }
.pane-empty p { max-width: 180px; margin: 5px auto 0; font-size: 10px; }
.pane-sync {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--home-line);
  color: #7b7e78;
  font-size: 9px;
}
.pane-sync time { color: #555c57; font-family: var(--home-mono); }

/* Central evidence workspace */
.workspace {
  position: relative;
  z-index: 10;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(rgba(39,45,41,.027) 1px, transparent 1px),
    var(--home-paper);
  background-size: 100% 40px;
  box-shadow: inset 12px 0 26px rgba(65,58,49,.025), inset -12px 0 26px rgba(65,58,49,.025);
}
.workspace-bar {
  display: flex;
  flex: 0 0 52px;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  border-bottom: 1px solid var(--home-line);
  background: rgba(239,235,226,.9);
  backdrop-filter: blur(16px);
}
.source-alert {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  padding: 9px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--critical) 35%, var(--home-line));
  background: color-mix(in srgb, var(--critical) 6%, var(--home-sheet));
  color: #5b312e;
  font-size: 10px;
}
.source-alert[hidden] { display: none; }
.source-alert strong { margin-right: 8px; color: var(--critical-deep); }
.source-alert button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--critical) 40%, transparent);
  background: rgba(255,255,255,.35);
  color: var(--critical-deep);
  cursor: pointer;
}
.workspace-path { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--home-muted); font-size: 11px; }
.workspace-path i { color: #b0ada6; font-style: normal; }
.workspace-path strong { overflow: hidden; color: var(--home-ink); font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.data-health {
  margin-left: auto;
  padding: 4px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: var(--unknown);
  font-family: var(--home-mono);
  font-size: 8px;
  letter-spacing: .03em;
  white-space: nowrap;
}
.data-health[data-state="ok"] { color: var(--healthy); }
.data-health[data-state="bad"] { color: var(--critical-deep); }
.icon-button, .back-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--home-line);
  background: rgba(255,255,255,.33);
  color: #52575d;
  cursor: pointer;
}
.icon-button:hover, .back-button:hover { border-color: #92958e; background: var(--home-sheet); color: var(--home-ink); }
.icon-button svg, .back-button svg { width: 17px; height: 17px; }
.icon-button.is-spinning svg { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.back-button, .context-button { display: none; }
.workspace-scroll { min-height: 0; overflow: auto; scrollbar-color: #c4c0b8 transparent; scrollbar-width: thin; }
.truth-hero {
  --state-color: var(--unknown);
  margin: 30px 30px 0;
  padding: 0 0 21px;
  border-bottom: 1px solid var(--home-line);
}
.truth-hero[data-state="critical"] { --state-color: var(--critical-deep); }
.truth-hero[data-state="warning"] { --state-color: var(--warning); }
.truth-hero[data-state="unknown"] { --state-color: #677586; }
.truth-hero[data-state="ok"] { --state-color: var(--healthy); }
.truth-kicker { display: flex; align-items: center; gap: 8px; color: var(--state-color); font-family: var(--home-mono); font-size: 9px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.state-mark { display: inline-block; width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 50%; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 12%, transparent); }
.truth-copy { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 28px; align-items: end; margin-top: 17px; }
.truth-source { margin: 0 0 7px; color: var(--home-muted); font-family: var(--home-mono); font-size: 9px; letter-spacing: .08em; }
.truth-copy h2 { max-width: 760px; margin: 0; color: var(--home-ink); font-size: clamp(24px, 2.2vw, 35px); font-weight: 690; line-height: 1.13; letter-spacing: -.045em; text-wrap: balance; }
.truth-copy > div > p:last-child { max-width: 720px; margin: 10px 0 0; color: #666a6d; font-size: 12px; line-height: 1.65; }
.truth-age { min-width: 116px; padding: 0 0 4px 16px; border-left: 1px solid var(--home-line); text-align: right; }
.truth-age span { display: block; color: #858681; font-size: 9px; }
.truth-age strong { display: block; margin-top: 5px; color: var(--state-color); font-family: var(--home-mono); font-size: 19px; }
.truth-age time { display: block; margin-top: 2px; color: #989994; font-family: var(--home-mono); font-size: 8px; }
.truth-facts { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); margin: 22px 0 0; border: 1px solid var(--home-line); background: rgba(255,255,255,.24); }
.truth-facts > div { min-width: 0; padding: 12px 14px; border-right: 1px solid var(--home-line); }
.truth-facts > div:last-child { border-right: 0; }
.truth-facts dt { color: #8b8b86; font-size: 9px; }
.truth-facts dd { overflow: hidden; margin: 5px 0 0; color: #272a2d; font-family: var(--home-mono); font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.workspace-tabs {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  gap: 25px;
  margin: 0 30px;
  border-bottom: 1px solid var(--home-line);
  background: color-mix(in srgb, var(--home-paper) 92%, transparent);
  backdrop-filter: blur(14px);
}
.workspace-tab {
  position: relative;
  min-height: 49px;
  padding: 3px 0 0;
  border: 0;
  background: transparent;
  color: #777a7d;
  font-size: 11px;
  cursor: pointer;
}
.workspace-tab::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: transparent; }
.workspace-tab:hover { color: #26292c; }
.workspace-tab.is-active { color: #151719; font-weight: 650; }
.workspace-tab.is-active::after { background: #151719; }
.workspace-tab span:not(:empty) { margin-left: 3px; padding: 1px 5px; border-radius: 99px; background: #dedbd3; color: #5c5e60; font-family: var(--home-mono); font-size: 8px; }
.tab-panels { min-height: 380px; padding: 27px 30px 60px; }
.tab-panel[hidden] { display: none; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.section-heading h3 { margin: 0; color: #202326; font-size: 15px; line-height: 1.2; letter-spacing: -.015em; }
.section-heading .eyebrow { color: #898983; }
.section-heading-spaced { margin-top: 34px; }
.section-note { color: #858681; font-size: 9px; }
.text-link { color: #565b60 !important; font-size: 10px; text-underline-offset: 3px; }
.evidence-strength { padding: 5px 8px; border: 1px solid currentColor; color: #687687; font-family: var(--home-mono); font-size: 8px; }
.evidence-strength[data-state="ok"] { color: var(--healthy); }
.evidence-strength[data-state="warning"] { color: #9a6700; }
.evidence-strength[data-state="critical"] { color: var(--critical-deep); }
.evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); margin-top: 14px; border-top: 1px solid rgba(39,45,41,.72); }
.evidence-item { min-width: 0; padding: 17px 15px 16px 0; border-bottom: 1px solid var(--home-line); }
.evidence-item:nth-child(odd) { border-right: 1px solid var(--home-line); }
.evidence-item:nth-child(even) { padding-left: 18px; }
.evidence-item small { display: block; color: #8a8a85; font-size: 9px; }
.evidence-item strong { display: block; overflow-wrap: anywhere; margin-top: 6px; color: #202326; font-family: var(--home-mono); font-size: 12px; line-height: 1.55; }
.evidence-item p { margin: 4px 0 0; color: #777976; font-size: 10px; }
.empty-evidence { padding: 24px 0; color: #747670; font-size: 11px; border-bottom: 1px solid var(--home-line); }
.change-strip { margin-top: 14px; }
.change-record {
  display: grid;
  grid-template-columns: 96px minmax(90px,.5fr) minmax(0,1.5fr);
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--home-line);
  color: #464a4d;
  font-size: 10px;
}
.change-record time, .change-record code { font-family: var(--home-mono); font-size: 9px; }
.change-record strong { color: #24272a; font-weight: 650; }

/* Capacity */
.quota-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1px; margin-top: 16px; background: var(--home-line); border: 1px solid var(--home-line); }
.quota-item { --state-color: var(--unknown); min-width: 0; padding: 18px; background: var(--home-sheet); }
.quota-item[data-state="critical"] { --state-color: var(--critical-deep); }
.quota-item[data-state="warning"] { --state-color: var(--warning); }
.quota-item[data-state="ok"] { --state-color: var(--healthy); }
.quota-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.quota-item-head strong { color: #24272a; font-size: 12px; }
.quota-item-head span { color: var(--state-color); font-family: var(--home-mono); font-size: 8px; text-transform: uppercase; }
.quota-number { margin-top: 16px; color: #1a1d20; font-family: var(--home-mono); font-size: 21px; font-weight: 650; }
.quota-number small { color: #878883; font-size: 9px; font-weight: 400; }
.quota-track { height: 4px; margin-top: 10px; overflow: hidden; background: #e0ded7; }
.quota-track span { display: block; width: 0; height: 100%; background: var(--state-color); }
.quota-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; color: #848580; font-size: 9px; }
.quota-trend { margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--home-line); }
.quota-trend-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #656966; font-size: 9px; }
.quota-trend-head small { color: #999a95; font-family: var(--home-mono); font-size: 8px; }
.quota-trend-svg { display: block; width: 100%; height: 42px; margin-top: 8px; overflow: visible; color: var(--state-color); }
.quota-trend-svg .quota-trend-base { stroke: #d9d7d0; stroke-width: 1; }
.quota-trend-svg .quota-trend-line { fill: none; stroke: currentColor; stroke-width: 2; vector-effect: non-scaling-stroke; }
.quota-trend-svg .quota-trend-dot { fill: var(--home-sheet); stroke: currentColor; stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.quota-trend-empty { display: grid; height: 42px; margin: 8px 0 0; place-items: center; color: #999a95; font-size: 9px; background: linear-gradient(180deg, transparent, rgba(22,25,29,.018)); }
.quota-trend-summary { margin: 5px 0 0; color: #777a76; font-family: var(--home-mono); font-size: 8px; line-height: 1.45; }
.quota-projection { margin: 10px 0 0; color: var(--state-color); font-family: var(--home-mono); font-size: 9px; line-height: 1.5; }
.quota-action { margin: 12px 0 0; padding-top: 11px; border-top: 1px solid var(--home-line); color: #5e6263; font-size: 10px; line-height: 1.55; }

/* Changes and coverage */
.records-list { margin-top: 14px; border-top: 1px solid #35383b; }
.record-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 15px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--home-line); }
.record-row time { color: #80817d; font-family: var(--home-mono); font-size: 8px; }
.record-main { min-width: 0; }
.record-main strong { display: block; color: #222528; font-size: 11px; }
.record-main small { display: block; overflow: hidden; margin-top: 4px; color: #757773; font-family: var(--home-mono); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.record-state { padding: 4px 7px; border: 1px solid currentColor; color: #6b7785; font-family: var(--home-mono); font-size: 8px; white-space: nowrap; }
.record-state[data-state="critical"] { color: var(--critical-deep); }
.record-state[data-state="warning"] { color: var(--warning); }
.record-state[data-state="ok"] { color: var(--healthy); }
.timeline-list { position: relative; margin: 16px 0 0 5px; padding: 0 0 0 22px; list-style: none; }
.timeline-list::before { content: ""; position: absolute; top: 8px; bottom: 8px; left: 4px; width: 1px; background: #c9c6be; }
.timeline-list li { position: relative; display: grid; grid-template-columns: 110px minmax(0,1fr); gap: 15px; padding: 0 0 17px; }
.timeline-list li::before { content: ""; position: absolute; top: 5px; left: -22px; width: 7px; height: 7px; border: 2px solid var(--home-paper); border-radius: 50%; background: #767d84; box-shadow: 0 0 0 1px #8d9399; }
.timeline-list time { color: #858681; font-family: var(--home-mono); font-size: 8px; }
.timeline-list p { margin: 0; color: #4c5052; font-size: 10px; }
.timeline-list strong { color: #25282b; }
.coverage-board { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-top: 16px; }
.coverage-group { padding: 16px; border: 1px solid var(--home-line); background: rgba(255,255,255,.24); }
.coverage-group header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 11px; border-bottom: 1px solid var(--home-line); }
.coverage-group header strong { font-size: 11px; }
.coverage-group header span { color: #7c7f7b; font-family: var(--home-mono); font-size: 8px; }
.coverage-group ul { margin: 10px 0 0; padding: 0; list-style: none; }
.coverage-group li { display: grid; grid-template-columns: 8px minmax(0,1fr) auto; gap: 8px; align-items: center; padding: 6px 0; color: #55595b; font-size: 9px; }
.coverage-group li i { width: 6px; height: 6px; border-radius: 50%; background: var(--unknown); }
.coverage-group li[data-state="critical"] i { background: var(--critical-deep); }
.coverage-group li[data-state="warning"] i { background: var(--warning); }
.coverage-group li[data-state="ok"] i { background: var(--healthy); }
.coverage-group li time { color: #898a86; font-family: var(--home-mono); font-size: 8px; }

/* Incident command workspace */
.response-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 1px;
  margin-top: 15px;
  border: 1px solid var(--home-line);
  background: var(--home-line);
}
.response-card { min-width: 0; padding: 17px; background: rgba(255,255,255,.3); }
.response-card small { display: block; color: #686e69; font-size: 10px; }
.response-card strong { display: block; margin-top: 5px; color: #242925; font-size: 12px; overflow-wrap: anywhere; }
.response-card p { margin: 6px 0 0; color: #5d645f; font-size: 11px; line-height: 1.55; }
.incident-timeline { margin-top: 15px; }
.model-task-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-top: 15px; }
.model-task-card { min-width: 0; padding: 14px; border: 1px solid var(--home-line); background: rgba(255,255,255,.26); }
.model-task-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.model-task-card strong { color: #282d29; font-size: 11px; }
.model-task-card span { color: var(--unknown); font-family: var(--home-mono); font-size: 8px; }
.model-task-card[data-state="succeeded"] span { color: var(--healthy); }
.model-task-card[data-state="failed"] span, .model-task-card[data-state="blocked"] span { color: var(--critical-deep); }
.model-task-card p { margin: 9px 0 0; color: #606762; font-size: 10px; line-height: 1.6; }
.review-preview { margin-top: 15px; padding: 16px; border: 1px solid var(--home-line); background: rgba(255,255,255,.24); }
.review-preview strong { color: #2b302d; font-size: 11px; }
.review-preview p { margin: 7px 0 0; color: #5d645f; font-size: 11px; line-height: 1.65; }

/* Right readiness pane */
.context-pane {
  position: relative;
  z-index: 25;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: auto;
  padding: 22px 20px 0;
  background:
    radial-gradient(circle at 100% 0, rgba(255,255,255,.5), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,.1), transparent 44%),
    var(--home-panel-2);
  color: var(--home-ink);
  border-left: 1px solid rgba(39,45,41,.2);
  scrollbar-color: #aca79e transparent;
  scrollbar-width: thin;
}
.context-head { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 17px; border-bottom: 1px solid var(--home-line); }
.context-head h2 { margin: 0; color: var(--home-ink); font-size: 17px; letter-spacing: -.025em; }
.drawer-close { display: none; width: 34px; height: 34px; padding: 7px; border: 1px solid var(--home-line); background: rgba(255,255,255,.25); color: #686e69; cursor: pointer; }
.drawer-close svg { width: 100%; height: 100%; }
.context-status {
  --state-color: var(--unknown);
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 18px 0 0;
  padding: 15px;
  border: 1px solid color-mix(in srgb, var(--state-color) 45%, transparent);
  background: color-mix(in srgb, var(--state-color) 7%, transparent);
  color: var(--state-color);
}
.context-status[data-state="critical"] { --state-color: var(--critical-deep); }
.context-status[data-state="warning"] { --state-color: var(--warning); }
.context-status[data-state="ok"] { --state-color: var(--healthy); }
.context-status small { display: block; color: #777d78; font-size: 9px; }
.context-status strong { display: block; margin-top: 3px; color: #2b302d; font-size: 11px; }
.readiness-list { margin: 17px 0 0; border-top: 1px solid var(--home-line); }
.readiness-list > div { display: grid; grid-template-columns: 76px minmax(0,1fr); gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--home-line); }
.readiness-list dt { color: #676d68; font-size: 10px; }
.readiness-list dd { margin: 0; color: #353c37; font-size: 11px; text-align: right; overflow-wrap: anywhere; }
.command-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; margin-top: 14px; }
.command-actions button {
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid rgba(39,45,41,.18);
  background: rgba(255,255,255,.28);
  color: #414844;
  font-size: 10px;
  cursor: pointer;
}
.command-actions button:hover { border-color: #7e847f; background: rgba(255,255,255,.48); color: #1f2521; }
.command-actions .command-primary { grid-column: 1 / -1; border-color: #306c56; background: #326f58; color: #f8f6f0; }
.command-actions .command-primary:hover { background: #285f4b; color: #fff; }
.command-actions button:disabled { cursor: not-allowed; opacity: .48; }
.next-action {
  margin-top: 21px;
  padding: 16px;
  border: 1px solid rgba(39,45,41,.12);
  border-left: 2px solid var(--warning);
  background: rgba(247,244,237,.62);
  box-shadow: 0 10px 24px rgba(64,57,48,.055);
}
.next-action h3 { margin: 0; color: #2a2f2c; font-size: 12px; }
.next-action p:last-child { margin: 8px 0 0; color: #666c67; font-size: 10px; line-height: 1.65; }
.coverage-mini { margin-top: 24px; }
.context-section-title { display: flex; align-items: center; justify-content: space-between; }
.context-section-title h3 { margin: 0; color: #343a36; font-size: 11px; }
.context-section-title span { color: #767c77; font-family: var(--home-mono); font-size: 10px; }
.coverage-track { height: 3px; margin-top: 11px; background: #bdb8ae; }
.coverage-track span { display: block; width: 0; height: 100%; background: #697b7a; transition: width .2s ease; }
.coverage-mini ul { margin: 11px 0 0; padding: 0; list-style: none; }
.coverage-mini li { display: flex; align-items: center; gap: 8px; padding: 5px 0; color: #747a75; font-size: 9px; }
.coverage-mini li span { width: 6px; height: 6px; border-radius: 50%; background: var(--unknown); }
.coverage-mini li[data-state="ok"] { color: #48504b; }
.coverage-mini li[data-state="ok"] span { background: var(--healthy); }
.model-mini { margin-top: 22px; }
.model-mini-list { margin-top: 9px; border-top: 1px solid var(--home-line); }
.model-mini-list p { margin: 0; padding: 10px 0; color: #767c77; font-size: 9px; }
.model-mini-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--home-line); }
.model-mini-row strong { overflow: hidden; color: #424844; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.model-mini-row span { color: #727976; font-family: var(--home-mono); font-size: 8px; }
.context-notice { margin-top: 25px; padding: 14px 0; border-top: 1px solid var(--home-line); border-bottom: 1px solid var(--home-line); }
.context-notice strong { color: #535a55; font-size: 10px; }
.context-notice p { margin: 5px 0 0; color: #767b76; font-size: 9px; line-height: 1.6; }
.context-foot { margin-top: auto; padding: 18px 0 calc(19px + env(safe-area-inset-bottom)); }
.context-foot a { display: flex; align-items: center; justify-content: space-between; min-height: 35px; color: #3f4642; font-size: 10px; text-decoration: none; }
.context-foot a + a { border-top: 1px solid var(--home-line); }
.context-foot a:hover { color: #111513; }
.drawer-scrim { display: none; }

/* Account */
.account-dialog {
  width: min(360px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid rgba(39,45,41,.22);
  background: var(--home-sheet);
  color: var(--home-ink);
  box-shadow: 0 30px 80px rgba(37,34,29,.32);
}
.account-dialog::backdrop { background: rgba(3,5,7,.7); backdrop-filter: blur(3px); }
.account-dialog form { padding: 20px; }
.account-dialog header { display: flex; justify-content: space-between; align-items: flex-start; }
.account-dialog h2 { margin: 0; font-size: 17px; }
.account-dialog header button { width: 32px; height: 32px; border: 1px solid var(--home-line); background: none; color: #676e69; cursor: pointer; }
.account-identity { display: flex; align-items: center; gap: 12px; margin: 21px 0; padding: 16px; background: var(--home-paper-2); }
.account-identity > span { display: grid; place-items: center; width: 40px; height: 40px; background: #3a4541; color: #fff; font-family: var(--home-mono); }
.account-identity strong, .account-identity small { display: block; }
.account-identity small { margin-top: 3px; color: #747a75; font-size: 9px; }
.account-dialog a, .logout-button { display: block; width: 100%; padding: 10px 0; border: 0; border-top: 1px solid var(--home-line); background: none; color: #414844; text-align: left; text-decoration: none; font-size: 11px; cursor: pointer; }
.logout-button { color: var(--critical); }

/* Command dialogs */
.command-dialog {
  width: min(590px, calc(100vw - 28px));
  max-height: min(820px, calc(100dvh - 28px));
  padding: 0;
  border: 1px solid rgba(39,45,41,.24);
  background: var(--home-sheet);
  color: var(--home-ink);
  box-shadow: 0 34px 90px rgba(31,33,29,.34);
}
.command-dialog::backdrop { background: rgba(15,20,18,.54); backdrop-filter: blur(4px); }
.command-dialog form { display: grid; gap: 15px; padding: 21px; }
.command-dialog header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 15px; border-bottom: 1px solid var(--home-line); }
.command-dialog h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.command-dialog header button { width: 34px; height: 34px; border: 1px solid var(--home-line); background: none; color: #5f6661; font-size: 19px; cursor: pointer; }
.command-dialog label { display: grid; gap: 6px; color: #3d443f; font-size: 10px; font-weight: 650; }
.command-dialog label > span { color: #7a7f7a; font-size: 8px; font-weight: 400; }
.command-dialog textarea, .command-dialog input, .command-dialog select {
  width: 100%;
  min-height: 40px;
  padding: 10px 11px;
  border: 1px solid rgba(39,45,41,.19);
  border-radius: 0;
  outline: 0;
  background: rgba(255,255,255,.42);
  color: var(--home-ink);
  font: 11px/1.55 var(--home-sans);
  resize: vertical;
}
.command-dialog textarea:focus, .command-dialog input:focus, .command-dialog select:focus { border-color: var(--focus); box-shadow: 0 0 0 2px rgba(47,111,150,.1); }
.command-dialog footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding-top: 2px; }
.command-dialog footer button { min-height: 38px; padding: 0 14px; border: 1px solid var(--home-line); background: rgba(255,255,255,.34); color: #414844; cursor: pointer; }
.command-dialog footer .dialog-primary { border-color: #306c56; background: #326f58; color: #fff; }
.command-dialog footer .dialog-danger { border-color: var(--critical-deep); background: var(--critical-deep); color: #fff; }
.dialog-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.dialog-target { margin: -3px 0 0; padding: 11px 12px; background: var(--home-paper-2); color: #4e5550; font-family: var(--home-mono); font-size: 9px; }
.dialog-boundary { margin: 0; padding: 10px 12px; border-left: 2px solid var(--warning); background: rgba(155,105,28,.06); color: #6d6557; font-size: 9px; line-height: 1.6; }
.model-roster { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.model-roster > div { padding: 13px; border: 1px solid var(--home-line); background: rgba(255,255,255,.28); }
.model-roster strong, .model-roster span { display: block; }
.model-roster strong { font-size: 10px; }
.model-roster span { margin-top: 5px; color: #747a75; font-size: 9px; line-height: 1.5; }
.review-dialog form { max-height: min(820px, calc(100dvh - 28px)); overflow: auto; }

.home-icp { position: fixed; z-index: 40; right: 7px; bottom: 2px; padding: 0; pointer-events: none; }
.home-icp a { color: rgba(45,50,47,.38); font-size: 7px; pointer-events: auto; }

@media (min-width: 1540px) {
  .console-shell { grid-template-columns: 68px 312px minmax(620px, 1fr) 352px; }
  .truth-hero { margin-right: 38px; margin-left: 38px; }
  .workspace-tabs { margin-right: 38px; margin-left: 38px; }
  .tab-panels { padding-right: 38px; padding-left: 38px; }
}

/* The readiness pane becomes a real drawer when four columns no longer fit. */
@media (max-width: 1279px) {
  .console-shell { grid-template-columns: 64px 288px minmax(0, 1fr); }
  .context-pane {
    position: fixed;
    z-index: 80;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, calc(100vw - 48px));
    transform: translateX(104%);
    transition: transform .22s cubic-bezier(.2,.8,.2,1);
    box-shadow: -24px 0 70px rgba(42,38,33,.28);
  }
  .home-app.context-open .context-pane { transform: translateX(0); }
  .drawer-close, .context-button { display: grid; }
  .context-button {
    align-items: center;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--home-line);
    background: rgba(255,255,255,.32);
    color: #484d51;
    font-size: 9px;
    cursor: pointer;
  }
  .drawer-scrim {
    position: fixed;
    z-index: 70;
    inset: 0;
    border: 0;
    background: rgba(4,6,8,.58);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .home-app.context-open .drawer-scrim { display: block; opacity: 1; pointer-events: auto; }
}

@media (max-width: 900px) {
  .console-shell { grid-template-columns: 60px 268px minmax(0,1fr); }
  .truth-hero { margin: 23px 22px 0; }
  .workspace-tabs { gap: 19px; margin: 0 22px; overflow-x: auto; scrollbar-width: none; }
  .workspace-tab { flex: 0 0 auto; }
  .tab-panels { padding: 24px 22px 54px; }
  .truth-copy { grid-template-columns: 1fr; gap: 16px; }
  .truth-age { display: grid; grid-template-columns: 1fr auto; min-width: 0; padding: 10px 0 0; border-top: 1px solid var(--home-line); border-left: 0; text-align: left; }
  .truth-age strong { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
  .truth-facts { grid-template-columns: 1fr; }
  .truth-facts > div { border-right: 0; border-bottom: 1px solid var(--home-line); }
  .truth-facts > div:last-child { border-bottom: 0; }
  .evidence-grid, .quota-grid, .coverage-board, .response-board { grid-template-columns: 1fr; }
  .model-task-grid { grid-template-columns: 1fr; }
  .evidence-item:nth-child(odd) { border-right: 0; }
  .evidence-item:nth-child(even) { padding-left: 0; }
}

/* Mobile is list/detail navigation, not four panels stacked into a prototype. */
@media (max-width: 767px) {
  body.home-app { overflow: hidden; }
  .console-shell { display: block; min-height: 100dvh; }
  .global-rail {
    position: fixed;
    z-index: 60;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    width: auto;
    height: calc(60px + env(safe-area-inset-bottom));
    flex-direction: row;
    padding: 4px 7px env(safe-area-inset-bottom);
    border-top: 1px solid rgba(255,255,255,.12);
    border-right: 0;
  }
  .rail-mark { display: none; }
  .rail-links { display: grid; grid-template-columns: repeat(3, 1fr); width: auto; gap: 2px; }
  .rail-foot { display: block; flex: 0 0 25%; padding: 0; border: 0; }
  .home-app.is-admin .rail-links { grid-template-columns: repeat(4, 1fr); }
  .home-app.is-admin .rail-foot { flex-basis: 20%; }
  .home-app.is-admin .rail-links .rail-link:nth-child(n+5) { display: none; }
  .rail-link { min-height: 51px; font-size: 8px; }
  .rail-link svg { width: 18px; height: 18px; }
  .rail-link::before { top: auto; right: 25%; bottom: -4px; left: 25%; width: auto; height: 2px; }
  .signal-pane, .workspace {
    position: fixed;
    inset: 0 0 calc(60px + env(safe-area-inset-bottom));
    width: 100%;
    height: auto;
  }
  .home-app[data-view="list"] .workspace { display: none; }
  .home-app[data-view="detail"] .signal-pane { display: none; }
  .pane-brand { min-height: 78px; padding: 17px 17px 13px; }
  .pane-brand h1 { font-size: 19px; }
  .signal-summary > div { padding: 11px 8px 10px; }
  .signal-tools { padding: 11px 12px 9px; }
  .search-box { min-height: 44px; }
  .search-box input { height: 42px; }
  .filter-chip { min-height: 44px; }
  .signal-card { min-height: 86px; grid-template-columns: 44px minmax(0,1fr) 18px; padding-right: 15px; padding-left: 14px; }
  .pane-sync { padding-bottom: 9px; }
  .workspace-bar { flex-basis: 58px; padding: 0 12px; }
  .source-alert { padding: 9px 12px; }
  .icon-button, .back-button { width: 44px; height: 44px; }
  .back-button { display: grid; flex: 0 0 auto; }
  .workspace-path span, .workspace-path i { display: none; }
  .data-health { display: none; }
  .context-button { min-height: 44px; margin-left: auto; }
  .truth-hero { margin: 21px 16px 0; }
  .truth-copy h2 { font-size: 25px; }
  .truth-copy > div > p:last-child { font-size: 11px; }
  .workspace-tabs { gap: 22px; margin: 0 16px; }
  .tab-panels { padding: 22px 16px 48px; }
  .section-heading { align-items: flex-start; }
  .section-note { max-width: 110px; text-align: right; }
  .change-record { grid-template-columns: 80px minmax(0,1fr); gap: 9px; }
  .change-record > :last-child { grid-column: 1 / -1; }
  .record-row { grid-template-columns: 74px minmax(0,1fr); }
  .record-state { grid-column: 2; justify-self: start; }
  .timeline-list li { grid-template-columns: 82px minmax(0,1fr); gap: 9px; }
  .context-pane { width: min(354px, calc(100vw - 22px)); padding: 18px 18px 0; }
  .drawer-close { width: 44px; height: 44px; }
  .context-foot a { min-height: 44px; }
  .dialog-grid, .model-roster { grid-template-columns: 1fr; }
  .home-icp { display: none; }
}

@media (max-width: 420px) {
  .truth-facts { margin-top: 17px; }
  .workspace-tab { font-size: 10px; }
  .workspace-tabs { gap: 18px; }
  .quota-item { padding: 16px; }
  .signal-summary span { font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .home-app *, .home-app *::before, .home-app *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Unified sub-pages (monitor / command / todo / events / admin / docs) ----------
   One rail + one content column. Components reuse the same paper/ink/state variables so
   every surface reads as the same product. */
body.home-app.page-app { overflow: hidden; }
.page-shell { display: grid; grid-template-columns: 64px minmax(0, 1fr); height: 100dvh; overflow: hidden; }
.page-main {
  min-width: 0;
  overflow: auto;
  padding: 26px 30px 64px;
  background:
    linear-gradient(rgba(39,45,41,.027) 1px, transparent 1px),
    var(--home-paper);
  background-size: 100% 40px;
  scrollbar-color: #c4c0b8 transparent;
  scrollbar-width: thin;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--home-line); }
.page-head h1 { margin: 0; color: var(--home-ink); font-size: 24px; letter-spacing: -.035em; line-height: 1.15; }
.page-head .page-sub { margin: 7px 0 0; max-width: 720px; color: #666a6d; font-size: 11px; line-height: 1.6; }
.page-head .page-head-side { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.page-section { margin-top: 30px; }
.page-section > .section-heading { margin-bottom: 0; }

.panel { border: 1px solid var(--home-line); background: rgba(255,255,255,.26); }
.panel-pad { padding: 16px; }
.panel + .panel { margin-top: 14px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--home-line); }
.panel-title strong { color: #202326; font-size: 12px; }
.panel-title span { color: #7c7f7b; font-family: var(--home-mono); font-size: 9px; }

.page-empty { padding: 26px; border: 1px dashed rgba(39,45,41,.25); background: rgba(255,255,255,.2); color: #747670; font-size: 11px; text-align: center; }
.page-note { color: #858681; font-size: 10px; line-height: 1.6; }
.page-note.err { color: var(--critical-deep); }

/* status dots & badges in the home language */
.state-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--unknown); vertical-align: 1px; }
.state-dot[data-state="critical"] { background: var(--critical-deep); box-shadow: 0 0 0 3px rgba(159,51,45,.12); }
.state-dot[data-state="warning"] { background: var(--warning); box-shadow: 0 0 0 3px rgba(155,105,28,.12); }
.state-dot[data-state="ok"] { background: var(--healthy); box-shadow: 0 0 0 3px rgba(52,121,92,.12); }
.state-dot[data-state="unknown"] { background: var(--unknown); }
.state-badge { padding: 3px 7px; border: 1px solid currentColor; color: #6b7785; font-family: var(--home-mono); font-size: 8px; white-space: nowrap; }
.state-badge[data-state="critical"] { color: var(--critical-deep); }
.state-badge[data-state="warning"] { color: var(--warning); }
.state-badge[data-state="ok"] { color: var(--healthy); }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--home-line); background: rgba(255,255,255,.26); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 11px; color: #3d4245; }
.tbl th { padding: 9px 12px; border-bottom: 1px solid rgba(39,45,41,.4); color: #6b6f6a; font-family: var(--home-mono); font-size: 9px; font-weight: 600; letter-spacing: .04em; text-align: left; white-space: nowrap; }
.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--home-line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .mono, .mono { font-family: var(--home-mono); font-size: 10px; }
.tbl a { color: #2f5a48; }

/* forms & buttons */
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-field { display: grid; gap: 5px; min-width: 140px; }
.form-field > label, .form-field > span.lab { color: #676d68; font-size: 10px; font-weight: 650; }
.form-field input, .form-field select, .form-field textarea {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid rgba(39,45,41,.19);
  border-radius: 0;
  outline: 0;
  background: rgba(255,255,255,.42);
  color: var(--home-ink);
  font: 12px/1.5 var(--home-sans);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 2px rgba(47,111,150,.1); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(39,45,41,.2);
  background: rgba(255,255,255,.3);
  color: #414844;
  font-size: 11px;
  cursor: pointer;
}
.btn:hover { border-color: #7e847f; background: rgba(255,255,255,.5); color: #1f2521; }
.btn:disabled { cursor: not-allowed; opacity: .48; }
.btn.primary { border-color: #306c56; background: #326f58; color: #f8f6f0; }
.btn.primary:hover { background: #285f4b; }
.btn.danger { border-color: var(--critical-deep); background: var(--critical-deep); color: #fff; }
.btn.small { min-height: 28px; padding: 0 10px; font-size: 10px; }
.linkish { border: 0; background: none; padding: 0; color: #4d5852; font-size: 10px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: #151a17; }
.linkish.danger { color: var(--critical-deep); }
.chip { display: inline-block; padding: 1px 6px; border: 1px solid var(--home-line); background: rgba(255,255,255,.3); color: #4d5255; font-family: var(--home-mono); font-size: 9px; }

/* KPI cards (todo / platform pages) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.kpi-card { border: 1px solid var(--home-line); background: rgba(255,255,255,.26); padding: 15px 16px; }
.kpi-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: #24272a; font-size: 12px; flex-wrap: wrap; }
.kpi-card .kpis { display: flex; flex-wrap: wrap; gap: 18px; margin: 6px 0 2px; }
.kpi-card .kpi .n { color: #1a1d20; font-family: var(--home-mono); font-size: 20px; font-weight: 650; }
.kpi-card .kpi .n.na { color: var(--unknown); font-size: 14px; }
.kpi-card .kpi .l { margin-top: 2px; color: #858681; font-size: 9px; }
.kpi-card .freshness { margin-top: 8px; color: #898a86; font-family: var(--home-mono); font-size: 8px; }
.kpi-card .freshness.err { color: var(--critical-deep); }
.chart { width: 100%; height: 280px; }

/* login keeps the same language without the rail */
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: linear-gradient(rgba(39,45,41,.027) 1px, transparent 1px), var(--home-paper); background-size: 100% 40px; }
.login-panel { width: min(360px, calc(100vw - 40px)); border: 1px solid rgba(39,45,41,.22); background: var(--home-sheet); padding: 26px; box-shadow: 0 24px 60px rgba(37,34,29,.14); }
.login-panel h1 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.login-panel .sub { margin: 5px 0 18px; color: #858681; font-size: 10px; }
.login-panel form { display: grid; gap: 13px; }
.login-panel .msg { min-height: 18px; font-size: 10px; }
.login-panel .msg.err { color: var(--critical-deep); }
.login-panel .msg.ok { color: var(--healthy); }

/* monitor page */
.monitor-strip { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; margin-top: 22px; border: 1px solid var(--home-line); background: var(--home-line); }
.monitor-strip > div { min-width: 0; padding: 15px 16px; background: var(--home-sheet); }
.monitor-strip strong { display: block; color: #1a1d20; font-family: var(--home-mono); font-size: 22px; font-weight: 650; }
.monitor-strip span { display: block; margin-top: 4px; color: #858681; font-size: 9px; }
.platform-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 14px; }
.platform-card { --state-color: var(--unknown); border: 1px solid var(--home-line); border-top: 2px solid var(--state-color); background: rgba(255,255,255,.26); padding: 15px 16px; }
.platform-card[data-state="critical"] { --state-color: var(--critical-deep); }
.platform-card[data-state="warning"] { --state-color: var(--warning); }
.platform-card[data-state="ok"] { --state-color: var(--healthy); }
.platform-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.platform-card header strong { color: #24272a; font-size: 12px; }
.platform-card header span { color: var(--state-color); font-family: var(--home-mono); font-size: 8px; text-transform: uppercase; }
.platform-card .plat-loc { margin: 4px 0 0; color: #858681; font-family: var(--home-mono); font-size: 8px; }
.platform-card ul { margin: 11px 0 0; padding: 10px 0 0; border-top: 1px solid var(--home-line); list-style: none; }
.platform-card li { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: #55595b; font-size: 10px; }
.platform-card li time { margin-left: auto; color: #898a86; font-family: var(--home-mono); font-size: 8px; }
.platform-card li a { margin-left: auto; font-size: 9px; }

/* command page */
.command-layout { display: grid; grid-template-columns: minmax(340px, 400px) minmax(0, 1fr); gap: 22px; margin-top: 22px; align-items: start; }
.incident-list { border: 1px solid var(--home-line); background: rgba(255,255,255,.2); }
.incident-row { display: grid; grid-template-columns: 10px minmax(0,1fr) auto; gap: 10px; width: 100%; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--home-line); background: transparent; text-align: left; cursor: pointer; align-items: start; }
.incident-row:hover { background: rgba(255,255,255,.4); }
.incident-row[aria-current="true"] { background: rgba(255,255,255,.5); box-shadow: inset 2px 0 0 var(--state-color, var(--unknown)); }
.incident-row[data-state="critical"] { --state-color: var(--critical-deep); }
.incident-row[data-state="warning"] { --state-color: var(--warning); }
.incident-row[data-state="ok"] { --state-color: var(--healthy); }
.incident-row .dotcol { padding-top: 4px; }
.incident-row .dotcol i { display: block; width: 8px; height: 8px; border: 2px solid var(--state-color); border-radius: 50%; }
.incident-row strong { display: block; overflow: hidden; color: #252a27; font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.incident-row small { display: block; margin-top: 3px; overflow: hidden; color: #757a75; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.incident-row .incident-meta { display: flex; gap: 8px; margin-top: 6px; color: #757a75; font-family: var(--home-mono); font-size: 8px; }
.incident-row .incident-side { text-align: right; color: #757a75; font-family: var(--home-mono); font-size: 8px; white-space: nowrap; }
.incident-row .incident-side .state-badge { display: inline-block; margin-bottom: 5px; }
.command-detail { min-width: 0; }
.command-detail .command-actions { grid-template-columns: repeat(3, minmax(0,1fr)); }
.command-detail .command-actions .command-primary { grid-column: 1 / -1; }

/* monitor page extras */
.monitor-strip small { display: block; margin-bottom: 6px; color: #858681; font-family: var(--home-mono); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.platform-card li > div { min-width: 0; flex: 1; }
.platform-card li > div strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.platform-card li > div small { display: block; overflow: hidden; color: #898a86; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.platform-timeline { margin: 0; padding: 0; list-style: none; }
.platform-timeline li { display: flex; gap: 14px; padding: 11px 16px; border-bottom: 1px solid var(--home-line); align-items: baseline; }
.platform-timeline li:last-child { border-bottom: 0; }
.platform-timeline time { flex: 0 0 90px; color: #898a86; font-size: 9px; }
.platform-timeline p { margin: 0; color: #55595b; font-size: 11px; line-height: 1.55; }
.platform-timeline p strong { color: #24272a; }

@media (max-width: 1100px) {
  .command-layout { grid-template-columns: 1fr; }
  .monitor-strip { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 767px) {
  .page-shell { grid-template-columns: 1fr; height: auto; min-height: 100dvh; }
  .page-shell .global-rail { position: fixed; z-index: 60; right: 0; bottom: 0; left: 0; display: flex; width: auto; height: calc(60px + env(safe-area-inset-bottom)); flex-direction: row; padding: 4px 7px env(safe-area-inset-bottom); border-top: 1px solid rgba(255,255,255,.12); border-right: 0; }
  .page-shell .rail-mark { display: none; }
  .page-shell .rail-links { display: grid; grid-template-columns: repeat(5, 1fr); width: auto; gap: 2px; }
  .page-shell .rail-links .rail-link:nth-child(n+6) { display: none; }
  .page-shell .rail-foot { display: block; flex: 0 0 16%; padding: 0; border: 0; }
  .page-main { padding: 18px 16px calc(80px + env(safe-area-inset-bottom)); overflow: visible; }
  .page-head h1 { font-size: 20px; }
  .monitor-strip { grid-template-columns: 1fr 1fr; }
  .command-detail .command-actions { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
