/* Kozir Admin console. Plain CSS, no external resources (strict CSP).
   Tokens first; dark values are declared twice (OS preference + manual toggle). */

:root {
  color-scheme: light;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f5f6f5;
  --surface: #ffffff;
  --surface-2: #f7f8f7;
  --surface-3: #eff1ef;
  --border: #e3e6e3;
  --border-strong: #cdd2ce;
  --text: #121513;
  --text-2: #464e49;
  --text-3: #69716c;

  --accent: #0f5132;
  --accent-hover: #0b3f27;
  --accent-fg: #ffffff;
  --accent-text: #0f6b41;
  --accent-soft: #e6f0ea;
  --gold: #f5c542;
  --gold-text: #7d5800;
  --gold-soft: #fcf1cf;
  --focus: #1b7a4b;

  --ok: #157a3a;      --ok-bg: #e3f4e8;      --ok-border: #bfe3c9;
  --warn: #965800;    --warn-bg: #fcf0d6;    --warn-border: #efd397;
  --crit: #b42318;    --crit-bg: #fde8e6;    --crit-border: #f3c1bb;
  --info: #1f5fbf;    --info-bg: #e6eefb;    --info-border: #c4d6f4;
  --neutral: #525a55; --neutral-bg: #eff1ef; --neutral-border: #dbdfdc;
  --danger-btn: #b42318; --danger-btn-hover: #962015;

  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  --pos: #2a78d6; --neg: #e34948;
  --grid: #eceeec; --axis: #c9cdca;

  --shadow: 0 1px 2px rgba(16, 24, 20, .05);
  --shadow-lg: 0 18px 40px rgba(16, 24, 20, .18), 0 2px 8px rgba(16, 24, 20, .08);
  --backdrop: rgba(10, 14, 12, .42);
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-w: 232px;
  --topbar-h: 52px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d100f;
    --surface: #151917;
    --surface-2: #191e1b;
    --surface-3: #202623;
    --border: #252b28;
    --border-strong: #353d38;
    --text: #eceeed;
    --text-2: #b3bbb6;
    --text-3: #838c87;
    --accent: #1a7a4c;
    --accent-hover: #1f8c58;
    --accent-fg: #ffffff;
    --accent-text: #5cc591;
    --accent-soft: rgba(92, 197, 145, .12);
    --gold-text: #f5c542;
    --gold-soft: rgba(245, 197, 66, .13);
    --focus: #f5c542;
    --ok: #55c97f;      --ok-bg: rgba(85, 201, 127, .12);   --ok-border: rgba(85, 201, 127, .28);
    --warn: #f0b545;    --warn-bg: rgba(240, 181, 69, .12); --warn-border: rgba(240, 181, 69, .3);
    --crit: #f2685c;    --crit-bg: rgba(242, 104, 92, .13); --crit-border: rgba(242, 104, 92, .32);
    --info: #6fa8f6;    --info-bg: rgba(111, 168, 246, .12);--info-border: rgba(111, 168, 246, .3);
    --neutral: #a4ada8; --neutral-bg: rgba(164, 173, 168, .1); --neutral-border: rgba(164, 173, 168, .22);
    --danger-btn: #c0392b; --danger-btn-hover: #d64535;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --pos: #3987e5; --neg: #e66767;
    --grid: #222825; --axis: #3a423d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
    --backdrop: rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d100f;
  --surface: #151917;
  --surface-2: #191e1b;
  --surface-3: #202623;
  --border: #252b28;
  --border-strong: #353d38;
  --text: #eceeed;
  --text-2: #b3bbb6;
  --text-3: #838c87;
  --accent: #1a7a4c;
  --accent-hover: #1f8c58;
  --accent-fg: #ffffff;
  --accent-text: #5cc591;
  --accent-soft: rgba(92, 197, 145, .12);
  --gold-text: #f5c542;
  --gold-soft: rgba(245, 197, 66, .13);
  --focus: #f5c542;
  --ok: #55c97f;      --ok-bg: rgba(85, 201, 127, .12);   --ok-border: rgba(85, 201, 127, .28);
  --warn: #f0b545;    --warn-bg: rgba(240, 181, 69, .12); --warn-border: rgba(240, 181, 69, .3);
  --crit: #f2685c;    --crit-bg: rgba(242, 104, 92, .13); --crit-border: rgba(242, 104, 92, .32);
  --info: #6fa8f6;    --info-bg: rgba(111, 168, 246, .12);--info-border: rgba(111, 168, 246, .3);
  --neutral: #a4ada8; --neutral-bg: rgba(164, 173, 168, .1); --neutral-border: rgba(164, 173, 168, .22);
  --danger-btn: #c0392b; --danger-btn-hover: #d64535;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
  --pos: #3987e5; --neg: #e66767;
  --grid: #222825; --axis: #3a423d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
  --backdrop: rgba(0, 0, 0, .6);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
code, kbd, pre, .mono { font-family: var(--mono); font-size: .92em; }
pre { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.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: absolute; left: 12px; top: -48px; z-index: 200; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.skip-link:focus { top: 10px; }
.icon { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: middle; }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.pos-val { color: var(--ok); }
.neg-val { color: var(--crit); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.ellipsis { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.break { overflow-wrap: anywhere; }

/* ---------- Boot / auth ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--text-3); }
.boot-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.logo-bg { fill: #0f5132; }
.logo-k { stroke: #f5c542; fill: none; }
.auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background:
    radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 28px 24px 22px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-brand h1 { font-size: 18px; }
.auth-brand .badge-row { margin-left: auto; }
.auth-card h2 { font-size: 20px; margin-bottom: 6px; }
.auth-card .lead { color: var(--text-2); margin-bottom: 18px; }
.auth-card .fineprint { color: var(--text-3); font-size: 12.5px; margin-top: 16px; text-align: center; }
.auth-card .stack { gap: 12px; }
.auth-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; color: var(--text-3); font-size: 12px; gap: 8px; flex-wrap: wrap; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; height: var(--topbar-h); color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-name { font-weight: 650; letter-spacing: -.01em; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--text-3); font-weight: 500; letter-spacing: .02em; }
.nav { padding: 6px 10px 12px; display: flex; flex-direction: column; gap: 1px; }
.nav-section { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); padding: 14px 10px 6px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; font-size: 13.5px;
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold);
}
.nav a .icon { opacity: .9; }
.sidebar-foot { margin-top: auto; padding: 12px 16px 16px; border-top: 1px solid var(--border); display: none; flex-direction: column; align-items: flex-start; gap: 10px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 25; height: var(--topbar-h); display: flex; align-items: center; gap: 10px;
  padding: 0 20px 0 24px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
}
.topbar .spacer { flex: 1; }
.topbar-brand { display: none; align-items: center; gap: 8px; color: var(--text); font-weight: 650; }
.topbar-brand:hover { text-decoration: none; }
.env { display: flex; align-items: center; gap: 8px; min-width: 0; }
.commit { color: var(--text-3); font-size: 12px; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); white-space: nowrap; }
.node-id { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.who { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 13px; }
.who-name { font-weight: 600; }
.topbar .menu-btn { display: none; }
.content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 20px 24px 64px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-h h1 { font-size: 21px; line-height: 1.25; }
.page-h h1:focus { outline: none; }
.page-sub { color: var(--text-2); margin-top: 3px; font-size: 13px; }
.page-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.updated { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.updated .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.updated.busy .live-dot { background: var(--info); box-shadow: 0 0 0 3px var(--info-bg); }
.updated.failed { color: var(--warn); }
.updated.failed .live-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.back-link:hover { color: var(--text); }

/* ---------- Layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.toolbar { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .grow { flex: 1 1 220px; min-width: 0; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 4px 0 -4px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column; }
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 12px; padding: 13px 16px 0; flex-wrap: wrap; }
.card-titles { min-width: 0; }
.card-title { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-sub { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.card-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-b { padding: 12px 16px 16px; min-width: 0; flex: 1; }
.card-b.flush { padding: 10px 0 0; overflow: hidden; border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px); }
.card-b.flush:first-child { padding-top: 0; border-radius: calc(var(--radius) - 1px); }
.card-b.flush:first-child > .table-wrap > .t th { border-top: 0; }
.card-b.flush > .empty { margin: 0 16px 16px; }
.card.danger-zone { border-color: var(--crit-border); }
.card.danger-zone .card-title { color: var(--crit); }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid; font-size: 13px; }
.callout .icon { margin-top: 2px; }
.callout-crit { background: var(--crit-bg); border-color: var(--crit-border); color: var(--text); }
.callout-crit .icon { color: var(--crit); }
.callout-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--text); }
.callout-warn .icon { color: var(--warn); }
.callout-info { background: var(--info-bg); border-color: var(--info-border); color: var(--text); }
.callout-info .icon { color: var(--info); }
.callout-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--text); }
.callout-ok .icon { color: var(--ok); }
.callout strong { font-weight: 600; }
.explain { font-size: 14px; line-height: 1.55; color: var(--text); }
.explain b { font-weight: 650; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; }
.kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi {
  display: flex; flex-direction: column; gap: 2px; padding: 13px 14px 11px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); min-width: 0;
  position: relative; overflow: hidden;
}
a.kpi:hover { text-decoration: none; border-color: var(--border-strong); }
.kpi-label { font-size: 12px; color: var(--text-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-size: 26px; font-weight: 620; letter-spacing: -.02em; line-height: 1.2; }
.kpi-value .unit { font-size: 14px; color: var(--text-3); font-weight: 500; margin-left: 3px; letter-spacing: 0; }
.kpi-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .spark { display: block; width: 100%; height: 24px; margin-top: 6px; }
.spark path { fill: none; stroke: var(--text-3); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; opacity: .75; }
.kpi-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.stat { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.stat-label { font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.stat-value { font-size: 18px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 11.5px; color: var(--text-3); }

/* ---------- Pills & badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px 1px 7px; border-radius: 999px; border: 1px solid;
  font-size: 11.5px; font-weight: 550; line-height: 18px; white-space: nowrap; vertical-align: middle;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.no-dot { padding-left: 8px; }
.pill-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.pill-warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.pill-crit { color: var(--crit); background: var(--crit-bg); border-color: var(--crit-border); }
.pill-info { color: var(--info); background: var(--info-bg); border-color: var(--info-border); }
.pill-neutral { color: var(--neutral); background: var(--neutral-bg); border-color: var(--neutral-border); }
.pill-gold { color: var(--gold-text); background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 55%, transparent); }
.realm { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; border: 1px solid; white-space: nowrap; }
.realm-release { background: var(--crit); color: #fff; border-color: var(--crit); }
.realm-qualification { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.realm-local { background: var(--neutral-bg); color: var(--neutral); border-color: var(--neutral-border); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; border-radius: 5px; font-size: 11.5px; background: var(--surface-3); color: var(--text-2); line-height: 19px; white-space: nowrap; }
.tag.mono { font-size: 11px; }
.fresh { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 550; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); white-space: nowrap; cursor: pointer; }
.fresh .icon { width: 14px; height: 14px; }
.fresh.is-fresh { color: var(--ok); border-color: var(--ok-border); background: var(--ok-bg); cursor: default; }
.fresh:not(.is-fresh):hover { border-color: var(--border-strong); color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none; user-select: none;
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger-btn); border-color: var(--danger-btn); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-btn-hover); border-color: var(--danger-btn-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-outline-danger { color: var(--crit); border-color: var(--crit-border); background: var(--surface); }
.btn-outline-danger:hover:not(:disabled) { background: var(--crit-bg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn-lg { height: 40px; padding: 0 16px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-btn { width: 32px; padding: 0; }
.icon-btn.btn-sm { width: 28px; }
.icon-btn.btn-xs { width: 24px; }
.btn.copied { color: var(--ok); }
.btn .spinner { width: 14px; height: 14px; border-width: 2px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Forms ---------- */
.input, .select, .textarea {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 13.5px; transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.select { padding-right: 28px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-3)); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-text) 22%, transparent);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--crit); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: .6; cursor: not-allowed; background: var(--surface-2); }
.input.mono { font-family: var(--mono); font-size: 12.5px; }
.input-search { padding-left: 32px; background-image: none; }
.search-wrap { position: relative; }
.search-wrap .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.field-label .req { color: var(--crit); margin-left: 2px; }
.field-hint { font-size: 12px; color: var(--text-3); }
.field-error { font-size: 12px; color: var(--crit); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 16px; }
.form-grid .field-wide { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.form-actions .grow { flex: 1; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.check {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer; min-width: 0;
}
.check:hover { border-color: var(--border-strong); }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }
.check .check-text { display: flex; flex-direction: column; min-width: 0; }
.check .check-title { font-size: 13px; font-weight: 550; }
.check .check-sub { font-size: 11.5px; color: var(--text-3); }
.check.is-changed { border-color: var(--gold); background: var(--gold-soft); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font-size: 12.5px; font-weight: 550; color: var(--text-2); margin-bottom: 6px; }
.switch {
  appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong);
  position: relative; cursor: pointer; flex: none; margin: 0; transition: background-color .15s;
}
.switch::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(14px); }
.switch:disabled { opacity: .5; cursor: not-allowed; }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.switch-row:last-child { border-bottom: 0; }
.switch-row .switch-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.switch-row .switch-title { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.switch-row .switch-desc { font-size: 12px; color: var(--text-3); }
.switch-row.is-changed .switch-title::after { content: "edited"; margin-left: 8px; font-family: var(--font); font-size: 10.5px; font-weight: 600; color: var(--gold-text); background: var(--gold-soft); padding: 1px 6px; border-radius: 4px; }
.input.is-changed { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-3); border: 1px solid var(--border); gap: 2px; max-width: 100%; overflow-x: auto; }
.seg-btn {
  height: 26px; padding: 0 10px; border-radius: 6px; border: 0; background: transparent; color: var(--text-2); font-size: 12.5px;
  font-weight: 550; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.seg-count { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.radio-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card:has(input:checked) { border-color: var(--accent-text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-text); }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.radio-card .rc-title { font-weight: 600; font-size: 13px; }
.radio-card .rc-sub { font-size: 11.5px; color: var(--text-3); }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; max-width: 100%; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.table-wrap:focus-visible { outline-offset: -2px; }
.table-wrap.scroll-y { max-height: min(68vh, 640px); }
.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.t th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; font-weight: 550; color: var(--text-3);
  font-size: 12px; padding: 7px 12px; border-bottom: 1px solid var(--border); border-top: 1px solid var(--border); white-space: nowrap;
}
.t td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.t tbody tr:last-child td { border-bottom: 0; }
.t th:first-child, .t td:first-child { padding-left: 16px; }
.t th:last-child, .t td:last-child { padding-right: 16px; }
.t .r { text-align: right; }
.t td.r { font-variant-numeric: tabular-nums; }
.t td.wrap { white-space: normal; min-width: 180px; max-width: 420px; overflow-wrap: anywhere; }
.t td.mono { font-size: 12px; }
.t tbody tr:hover > td { background: var(--surface-3); }
.t tr.clickable { cursor: pointer; }
.t tr.is-off > td { opacity: .62; }
.t tr.detail > td { background: var(--surface-2); white-space: normal; padding-top: 12px; padding-bottom: 14px; }
.t tr.detail:hover > td { background: var(--surface-2); }
.t tfoot td { font-weight: 600; border-top: 1px solid var(--border); border-bottom: 0; background: var(--surface-2); }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-stack { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.cell-stack .sub { font-size: 11.5px; color: var(--text-3); }
.plink { display: inline-flex; align-items: center; gap: 5px; color: var(--text); font-weight: 550; max-width: 260px; }
.plink span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plink:hover { color: var(--accent-text); }
.plink .icon { width: 14px; height: 14px; color: var(--text-3); }
.id-chip { display: inline-flex; align-items: center; gap: 2px; font-family: var(--mono); font-size: 12px; color: var(--text-2); max-width: 100%; }
.id-chip .id-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.id-chip .btn { height: 22px; width: 22px; color: var(--text-3); }
.id-chip .btn .icon { width: 13px; height: 13px; }
.list-more { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; justify-content: center; }

/* ---------- Avatars & chips ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; background: var(--surface-3);
  color: var(--text-2); font-weight: 650; line-height: 1; user-select: none; border: 1px solid var(--border);
}
.avatar-sm { width: 24px; height: 24px; font-size: 13px; }
.avatar-md { width: 30px; height: 30px; font-size: 16px; }
.avatar-lg { width: 56px; height: 56px; font-size: 30px; }
.avatar-bot { background: var(--info-bg); border-color: var(--info-border); }
.avatar-engine-bot { background: var(--neutral-bg); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px 0 6px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 500; max-width: 180px; white-space: nowrap;
}
a.chip:hover { text-decoration: none; border-color: var(--border-strong); background: var(--surface-3); }
.chip .icon { width: 13px; height: 13px; color: var(--text-3); }
.chip-name { overflow: hidden; text-overflow: ellipsis; }
.chip-bot { border-color: var(--info-border); background: var(--info-bg); }
.chip-bot .icon { color: var(--info); }
.chip-engine-bot { border-style: dashed; }
.chip-off { opacity: .55; border-style: dashed; }
.chip-out .chip-name { text-decoration: line-through; }
.chip-durak { border-color: var(--warn-border); background: var(--warn-bg); }
.chip .chip-meta { color: var(--text-3); font-size: 11px; }

/* ---------- Key/value ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px 18px; margin: 0; }
.kv > div { min-width: 0; }
.kv dt { font-size: 11.5px; color: var(--text-3); font-weight: 500; margin-bottom: 2px; }
.kv dd { margin: 0; font-size: 13.5px; font-weight: 500; overflow-wrap: anywhere; }
.kv.kv-rows { grid-template-columns: 1fr; gap: 0; }
.kv.kv-rows > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.kv.kv-rows > div:last-child { border-bottom: 0; }
.kv.kv-rows dt { margin: 0; font-size: 12.5px; color: var(--text-2); }
.kv.kv-rows dd { text-align: right; }

/* ---------- Meter ---------- */
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; border: 1px solid var(--border); }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--accent-text); width: 0; transition: width .3s; }
.meter.tone-warn > span { background: var(--warn); }
.meter.tone-crit > span { background: var(--crit); }
.meter-row { display: flex; flex-direction: column; gap: 5px; }
.meter-row .row-between { font-size: 12.5px; }
.meter-row .row-between span:first-child { color: var(--text-2); }

/* ---------- Alerts list ---------- */
.alerts { display: flex; flex-direction: column; gap: 6px; }
.alert-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.alert-item.lvl-critical { border-left: 3px solid var(--crit); }
.alert-item.lvl-warning { border-left: 3px solid var(--warn); }
.alert-item.lvl-info { border-left: 3px solid var(--info); }
.alert-item .alert-msg { flex: 1; min-width: 0; font-size: 13.5px; }
.alert-item .alert-code { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.all-good { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--ok-bg); border: 1px solid var(--ok-border); color: var(--text); font-size: 13.5px; }
.all-good .icon { color: var(--ok); }

/* ---------- Empty / loading / error ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 28px 16px; color: var(--text-3); text-align: center; font-size: 13px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.empty .icon { width: 20px; height: 20px; }
.empty.compact { padding: 14px; }
.loading-view { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 64px 16px; color: var(--text-3); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent-text); animation: spin .8s linear infinite; flex: none; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-view { max-width: 560px; margin: 40px auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.error-view .icon { width: 28px; height: 28px; color: var(--crit); }
.error-view h2 { font-size: 16px; }
.error-view p { color: var(--text-2); }
.form-error { color: var(--crit); font-size: 13px; font-weight: 500; }

/* ---------- Dialogs ---------- */
dialog.modal {
  padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg); width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow: hidden;
}
dialog.modal[open] { display: flex; flex-direction: column; }
dialog.modal.modal-sm { width: min(420px, calc(100vw - 24px)); }
dialog.modal.modal-lg { width: min(720px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: var(--backdrop); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.modal-form { display: flex; flex-direction: column; min-height: 0; max-height: inherit; }
.modal-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 4px; }
.modal-title { font-size: 16px; }
.modal-b { padding: 8px 18px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.modal-b > p { color: var(--text-2); }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.modal-x { margin: -4px -6px 0 0; }
.diff-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.diff-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.diff-row:last-child { border-bottom: 0; }
.diff-row .path { font-family: var(--mono); font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.diff-row .from { color: var(--text-3); text-decoration: line-through; overflow-wrap: anywhere; }
.diff-row .to { font-weight: 600; overflow-wrap: anywhere; }
.diff-row .arrow { color: var(--text-3); }
.secret-box { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--gold); background: var(--gold-soft); }
.secret-line { display: flex; gap: 6px; align-items: center; }
.secret-line .input { background: var(--surface); }
.codeblock {
  position: relative; display: block; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 40px 10px 12px; font-family: var(--mono); font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text);
}
.codeblock .btn { position: absolute; top: 6px; right: 6px; }
.json { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; color: var(--text); }
.json-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.json-grid h4 { font-size: 11.5px; color: var(--text-3); font-weight: 600; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 13px; animation: toast-in .18s ease-out; color: var(--text);
}
.toast .icon { margin-top: 1px; }
.toast-ok .icon { color: var(--ok); }
.toast-error { border-color: var(--crit-border); }
.toast-error .icon { color: var(--crit); }
.toast-info .icon { color: var(--info); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Charts ---------- */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart { position: relative; display: flex; flex-direction: column; gap: 8px; }
.chart .legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--text-2); min-height: 18px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend-val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.key { display: inline-block; width: 14px; height: 2px; border-radius: 2px; flex: none; }
.k1 { background: var(--series-1); } .k2 { background: var(--series-2); } .k3 { background: var(--series-3); }
.chart-plot-wrap { position: relative; min-height: 120px; }
.chart-plot { position: relative; width: 100%; transition: opacity .2s; }
.chart.loading .chart-plot { opacity: .45; }
.chart-plot svg { display: block; overflow: visible; touch-action: pan-y; }
.chart-plot .gl { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart-plot .bl { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart-plot .tk { fill: var(--text-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart-plot .pl { fill: var(--text-2); font-size: 11.5px; font-family: var(--font); font-weight: 600; }
.chart-plot .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-plot .s1 { stroke: var(--series-1); } .chart-plot .s2 { stroke: var(--series-2); } .chart-plot .s3 { stroke: var(--series-3); }
.chart-plot .ar { stroke: none; fill-opacity: .1; }
.chart-plot .f1 { fill: var(--series-1); } .chart-plot .f2 { fill: var(--series-2); } .chart-plot .f3 { fill: var(--series-3); }
.chart-plot .pt { stroke: var(--surface); stroke-width: 2; }
.chart-plot .xh { stroke: var(--text-3); stroke-width: 1; shape-rendering: crispEdges; }
.chart-plot .hit { fill: transparent; cursor: crosshair; }
.chart-plot .hit:focus-visible { outline: none; stroke: var(--focus); stroke-width: 2; }
.chart-empty { display: flex; align-items: center; justify-content: center; height: 190px; color: var(--text-3); font-size: 13px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.chart-tip {
  position: absolute; top: 0; left: 0; z-index: 5; pointer-events: none; min-width: 150px; padding: 8px 10px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); font-size: 12px;
}
.chart-tip .tip-time { color: var(--text-3); font-size: 11.5px; margin-bottom: 4px; white-space: nowrap; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; white-space: nowrap; line-height: 1.6; }
.chart-tip .tip-val { font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text); }
.chart-tip .tip-label { color: var(--text-2); }
.chart-table { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.chart-table .t th:first-child, .chart-table .t td:first-child { padding-left: 12px; }

/* ---------- Timeline (queue autofill) ---------- */
.timeline { position: relative; width: 240px; height: 26px; }
.tl-track { position: absolute; left: 0; right: 0; top: 11px; height: 4px; border-radius: 4px; background: var(--border-strong); }
.tl-window { position: absolute; top: 8px; height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--series-1) 35%, transparent); border: 1px solid var(--series-1); }
.tl-now { position: absolute; top: 3px; width: 2px; height: 20px; margin-left: -1px; border-radius: 1px; background: var(--text); }
.tl-now.past { background: var(--warn); margin-left: -2px; }
.tl-slot { position: absolute; top: 8px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; border: 2px solid var(--surface); background: var(--text-3); }
.tl-slot.st-enqueued { background: var(--info); }
.tl-slot.st-matched { background: var(--ok); }
.tl-slot.st-skipped { background: var(--crit); }
.tl-slot.st-planned { background: var(--neutral); }
.tl-caption { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.tl-caption b { color: var(--text-2); font-weight: 600; }

/* ---------- Economy flows ---------- */
.flows { display: flex; flex-direction: column; }
.flow-row { display: grid; grid-template-columns: minmax(110px, 170px) minmax(120px, 1fr) minmax(84px, auto) minmax(52px, auto); align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.flow-row:last-child { border-bottom: 0; }
.flow-row.head { font-size: 11.5px; color: var(--text-3); font-weight: 550; padding-top: 0; }
.flow-reason { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-track { position: relative; height: 14px; display: grid; grid-template-columns: 1fr 1fr; }
.flow-half { position: relative; height: 100%; }
.flow-half.neg { border-right: 1px solid var(--axis); }
.flow-bar { position: absolute; top: 2px; bottom: 2px; min-width: 2px; }
.flow-half.neg .flow-bar { right: 2px; background: var(--neg); border-radius: 4px 0 0 4px; }
.flow-half.pos .flow-bar { left: 2px; background: var(--pos); border-radius: 0 4px 4px 0; }
.flow-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.flow-n { text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 12px; }
.flow-total { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--border-strong); }
.flow-total b { font-variant-numeric: tabular-nums; color: var(--text); }
.flow-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.flow-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.flow-legend .lg-pos { background: var(--pos); }
.flow-legend .lg-neg { background: var(--neg); }

/* ---------- Pending changes bar ---------- */
.pending-bar {
  position: sticky; bottom: 12px; z-index: 15; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding: 10px 12px 10px 16px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--gold); box-shadow: var(--shadow-lg);
}
.pending-bar .grow { flex: 1; min-width: 160px; font-size: 13px; }
.pending-bar .count { font-weight: 650; }

/* ---------- Detail header ---------- */
.detail-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.detail-head .who-block { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.detail-head h2 { font-size: 20px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.detail-meta { display: flex; gap: 6px 16px; flex-wrap: wrap; color: var(--text-2); font-size: 12.5px; }
.detail-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.server-card .card-title .icon { color: var(--text-3); }
.server-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.admin-row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.admin-row:last-child { border-bottom: 0; }
.admin-row .admin-main { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.admin-row .admin-name { font-weight: 650; font-size: 14.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-row details { font-size: 12.5px; }
.admin-row summary { cursor: pointer; color: var(--text-2); }
.admin-row summary:hover { color: var(--text); }
.mini-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.mini-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 6px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.mini-list li b { color: var(--text); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1040px) {
  .charts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; right: 0; bottom: 0; height: auto; border-right: 0;
    opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .16s, transform .16s, visibility 0s .16s;
    box-shadow: var(--shadow-lg);
  }
  .shell.nav-open .sidebar { opacity: 1; visibility: visible; transform: none; transition: opacity .16s, transform .16s; }
  .sidebar .brand { display: none; }
  .sidebar-foot { display: flex; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 0 10px 0 8px; gap: 8px; }
  .topbar-brand { display: inline-flex; }
  .hide-sm { display: none !important; }
  .content { padding: 16px 16px 56px; }
  .page-h h1 { font-size: 19px; }
}
@media (max-width: 720px) {
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .json-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi-value { font-size: 23px; }
  .diff-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .diff-row .path { grid-column: 1 / -1; }
  .diff-row .arrow { display: none; }
  .flow-row { grid-template-columns: minmax(90px, 1fr) minmax(90px, 1.3fr) minmax(70px, auto); }
  .flow-row .flow-n { display: none; }
  .modal-f .btn { flex: 1; }
}
@media (max-width: 420px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 11px 12px 10px; }
  .topbar .realm { padding: 2px 6px; letter-spacing: .03em; }
}
@media (min-width: 901px) {
  .show-sm { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (forced-colors: active) {
  .pill, .realm, .btn, .chip { border: 1px solid CanvasText; }
  .chart-plot .ln { stroke: CanvasText; }
}
@media (max-width: 560px) {
  .fresh { padding: 0 8px; }
  .fresh .fresh-text { display: none; }
}
@media (max-width: 340px) {
  .topbar-brand .brand-text { display: none; }
}

.flows-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); }
.add-server { margin-top: 16px; }
time.deadline.overdue { color: var(--warn); font-weight: 600; }
time.deadline.overdue::before { content: "overdue · "; font-weight: 500; }
