/* ISP Log Server: NOC console. Light + dark. No inline styles (CSP). */
/* light (default) */
:root {
  --bg: #f5f7fb; --surface: #ffffff; --surface2: #f8fafc; --ink: #172033; --muted: #5f6b7e; --line: #e2e7ef; --line-soft: #edf0f5;
  --accent: #2563eb; --accent-ink: #ffffff; --accent-weak: #eff6ff; --blue: #0891b2;
  --ok: #047857; --ok-weak: #ecfdf5; --danger: #b91c1c; --danger-weak: #fef2f2; --warn: #92400e; --warn-bar: #d97706; --warn-weak: #fffbeb;
  --c1: #2563eb; --c2: #10b981; --c3: #f59e0b; --c4: #a855f7;
  --side: #101827; --side-ink: #cbd5e1; --side-muted: #64748b; --side-active: #1d2a3d; --side-link: #93c5fd;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  --focus: #1d4ed8; --radius-s: 8px; --radius-m: 12px;
  --font: "Segoe UI", "Noto Sans", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
/* dark: system setting ya toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --surface: #111827; --surface2: #172033; --ink: #e5e7eb; --muted: #94a3b8; --line: #263244; --line-soft: #1e293b;
    --accent: #60a5fa; --accent-ink: #0b1220; --accent-weak: #172554; --blue: #22d3ee;
    --ok: #34d399; --ok-weak: #052e22; --danger: #f87171; --danger-weak: #3b1414; --warn: #fbbf24; --warn-bar: #f59e0b; --warn-weak: #2d2008;
    --side: #070b14; --side-active: #172033; --shadow: none; --focus: #93c5fd; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --surface: #111827; --surface2: #172033; --ink: #e5e7eb; --muted: #94a3b8; --line: #263244; --line-soft: #1e293b;
  --accent: #60a5fa; --accent-ink: #0b1220; --accent-weak: #172554; --blue: #22d3ee;
  --ok: #34d399; --ok-weak: #052e22; --danger: #f87171; --danger-weak: #3b1414; --warn: #fbbf24; --warn-bar: #f59e0b; --warn-weak: #2d2008;
  --side: #070b14; --side-active: #172033; --shadow: none; --focus: #93c5fd; color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.5;
  font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 0.95em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.num, td.num { text-align: right; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--side) 250px, var(--bg) 250px); }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; gap: 26px;
  padding: 28px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; flex-direction: column; color: #fff; text-decoration: none; font-weight: 700;
  font-size: 1.15rem; letter-spacing: -0.01em; padding: 0 10px; }
.brand small { font-weight: 400; font-size: 0.8rem; color: #93a39f; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side .group { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--side-muted); padding: 16px 10px 6px; }
.side .group:first-child { padding-top: 0; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius-s);
  color: var(--side-ink); text-decoration: none; font-size: 0.95rem; min-height: 44px; }
.side nav a:hover { background: var(--side-active); }
.side nav a[aria-current="page"] { background: var(--side-active); color: #fff; font-weight: 600; }
.side nav svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.side nav a[aria-current="page"] { box-shadow: inset 3px 0 var(--accent); }
.side nav a[aria-current="page"] svg { stroke: #60a5fa; }
.side .me { margin-top: auto; border-top: 1px solid #26343d; padding: 14px 10px 0; display: flex; flex-direction: column; gap: 8px; }
.who-name { color: #fff; text-decoration: none; font-weight: 600; display: flex; flex-direction: column; }
.who-name small { font-weight: 400; color: #93a39f; font-size: 0.82rem; }
.me-links { display: flex; gap: 16px; align-items: center; }
.me-links a, .me-links .linkish { color: var(--side-link); font-size: 0.9rem; }
.me-links form { margin: 0; }
.linkish { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0;
  text-decoration: underline; min-height: auto; }
.content { min-width: 0; display: flex; flex-direction: column; }
.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px clamp(1rem, 3vw, 2.5rem) 2rem; flex-grow: 1; }
.bare .page { max-width: 72rem; }
.foot { max-width: 1240px; width: 100%; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2.5rem) 2rem; color: var(--muted); font-size: 0.85rem; }
@media (max-width: 60rem) {
  .shell { grid-template-columns: 1fr; background: var(--bg); }
  .side { position: static; height: auto; padding: 16px; gap: 12px; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side .group { display: none; }
  .side nav a { padding: 8px 10px; }
  .side .me { flex-direction: row; justify-content: space-between; align-items: center; margin-top: 0; }
}

/* ---------- type & common ---------- */
h1 { font-size: clamp(1.7rem, 3vw, 2.15rem); line-height: 1.15; margin: 0 0 0.35rem; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; margin: 2rem 0 0.75rem; }
.lede { color: var(--muted); margin: 0 0 1.75rem; max-width: 64ch; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px 22px; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font-size: 1.05rem; }
.panel-head a { font-weight: 600; font-size: 0.92rem; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.88rem; color: var(--muted); }
input, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 0.6rem 0.75rem; min-height: 2.9rem; }
input[aria-invalid="true"] { border-color: var(--danger); }
input[type="checkbox"] { min-height: auto; width: 1.1rem; height: 1.1rem; }
button, a.button { font: inherit; cursor: pointer; border-radius: var(--radius-s); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: 0.6rem 1.1rem; min-height: 2.9rem;
  display: inline-flex; align-items: center; text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.err { color: var(--danger); font-size: 0.85rem; }
.alert { background: var(--danger-weak); color: var(--danger); border-radius: var(--radius-s); padding: 0.75rem 1rem; }
.notice { background: var(--ok-weak); color: var(--ok); border-radius: var(--radius-s); padding: 0.75rem 1rem; }
.stack { display: grid; gap: 1rem; }
.login { max-width: 24rem; margin: 4rem auto 0; }
.dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; margin-right: 0.5rem; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn-bar); } .dot.down { background: var(--danger); }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-m); padding: 1.25rem 1.5rem; color: var(--muted); }
.empty h2 { color: var(--ink); margin-top: 0; }
.badge { font-size: 0.8rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--ok-weak); color: var(--ok); }
.badge.failure, .badge.denied, .badge.error { background: var(--danger-weak); color: var(--danger); }
code { font-family: var(--mono); font-size: 0.9em; }

/* ---------- tables ---------- */
.scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.bare-scroll { border: 0; border-radius: 0; background: none; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; }
.scroll th { background: var(--bg); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
table.flat th, table.flat td { padding: 0.55rem 0.5rem; }
table.flat th:first-child, table.flat td:first-child { padding-left: 0; }
td.details { white-space: normal; }
td.details span { display: inline-block; margin-right: 0.9rem; }

/* ---------- dashboard ---------- */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.dash-head .lede { margin-bottom: 1.25rem; }
.tg { margin: 0 0 1.4rem; color: var(--muted); font-size: 0.92rem; display: flex; align-items: center; }
.quick { margin-bottom: 20px; }
.quick-form { display: grid; grid-template-columns: 1.4fr 0.7fr 1.35fr 0.6fr auto; gap: 14px; align-items: end; }
.quick-form input { font-size: 1rem; }
.quick-form button { min-height: 2.9rem; white-space: nowrap; }
@media (max-width: 70rem) { .quick-form { grid-template-columns: 1fr 1fr; } .quick-form button { grid-column: 1 / -1; justify-content: center; } }
@media (max-width: 34rem) { .quick-form { grid-template-columns: 1fr; } }

.health5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; margin-bottom: 20px; }
.health5 .h { display: flex; flex-direction: column; gap: 3px; padding: 16px 18px 18px; border-top: 5px solid var(--accent); }
.health5 .h + .h { border-left: 1px solid var(--line-soft); }
.health5 .k { font-size: 0.82rem; color: var(--muted); }
.health5 .v { font-size: 1.35rem; font-weight: 700; color: var(--accent); }
.health5 .n { font-size: 0.82rem; color: var(--muted); }
.health5 .warn { border-top-color: var(--warn-bar); background: var(--warn-weak); }
.health5 .warn .v { color: var(--warn); }
.health5 .down { border-top-color: var(--danger); background: var(--danger-weak); }
.health5 .down .v { color: var(--danger); }
@media (max-width: 70rem) { .health5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .health5 .h + .h { border-left: 0; } .health5 .h { border-bottom: 1px solid var(--line-soft); } }

.warnbar { display: flex; gap: 16px; align-items: center; background: var(--warn-weak); border: 1px solid var(--warn-bar);
  border-radius: var(--radius-m); padding: 14px 20px; margin-bottom: 20px; color: var(--ink); }
.warnbar svg { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: var(--warn); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.warnbar div { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; }
.warnbar strong { color: var(--warn); }
.warnbar a { font-weight: 600; color: var(--warn); white-space: nowrap; }
.alertlist { background: var(--danger-weak); border-radius: var(--radius-m); padding: 14px 20px; margin-bottom: 20px; }
.alertlist strong { color: var(--danger); }
.alertlist ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .k { color: var(--muted); font-size: 0.9rem; }
.kpi .v { font-size: clamp(1.6rem, 2.6vw, 2.05rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.kpi .n { color: var(--muted); font-size: 0.82rem; }
@media (max-width: 70rem) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.two.wide-left { grid-template-columns: 1.15fr 1fr; }
@media (max-width: 60rem) { .two, .two.wide-left { grid-template-columns: 1fr; } }

.chart { margin: 0; }
.chart figcaption { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; gap: 1rem; }
.chart .ct { font-weight: 600; }
.chart .cs { color: var(--muted); font-size: 0.82rem; }
svg.bars { width: 100%; height: 170px; display: block; border-bottom: 1px solid var(--line); }
svg.bars rect { fill: var(--accent); }
svg.bars.blue rect { fill: var(--blue); }
svg.bars rect:hover { fill: var(--ink); }
.chart .axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.78rem; margin-top: 6px; }

svg.meter { width: 100%; height: 9px; display: block; }
svg.meter .track { fill: var(--line-soft); }
svg.meter .fill { fill: var(--accent); }
svg.meter.hot .fill { fill: #b4541a; }
.talkers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.tl { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.tl a { color: var(--ink); text-decoration: none; }
.tl a:hover { text-decoration: underline; }
.tl .tc { margin-left: auto; font-weight: 600; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 0.92rem; }
.activity li:last-child { border-bottom: 0; }
.diskline { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 0.92rem; }
.diskline + svg.meter { margin-bottom: 6px; height: 12px; }
.backupnote { margin: 14px 0 0; padding: 10px 14px; border-radius: 8px; background: var(--warn-weak); color: var(--warn); font-size: 0.9rem; }

/* ---------- forms on other pages ---------- */
.query { display: grid; gap: 1rem; align-items: start;
  grid-template-columns: minmax(10rem, 1.3fr) minmax(6rem, 0.6fr) minmax(13rem, 1.3fr) minmax(8rem, 0.7fr) auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.25rem; }
.query .f-go { align-self: end; }
.query.q4 { grid-template-columns: minmax(8rem, 0.7fr) minmax(10rem, 1.2fr) minmax(12rem, 1fr) minmax(12rem, 1fr) auto; }
.query .check, .card-form .check { flex-direction: row; align-items: center; gap: 0.5rem; grid-column: 1 / -2; }
.query.q4 > button { grid-column: -2 / -1; align-self: end; }
@media (max-width: 60rem) { .query, .query.q4 { grid-template-columns: 1fr 1fr; }
  .query .f-go, .query.q4 > button, .query .check { grid-column: 1 / -1; } }
@media (max-width: 34rem) { .query, .query.q4 { grid-template-columns: 1fr; } }
.filters { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.card-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 1.25rem; margin-bottom: 1.5rem; display: grid; gap: 1rem; }
.card-form h2 { margin: 0; }
.card-form > button { justify-self: start; }
.narrow { max-width: 28rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 60rem) { .grid3, .grid4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 34rem) { .grid3, .grid4 { grid-template-columns: 1fr; } }
.actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
form.inline { display: flex; gap: 0.4rem; margin: 0; }
form.inline.wrap { flex-wrap: wrap; }
form.inline input, form.inline select, form.inline button { min-height: 2.3rem; padding: 0.3rem 0.55rem; }
form.inline input[type="password"] { width: 9rem; }
form.inline input[name="reason"] { min-width: 14rem; }
.rowactions { display: flex; gap: 0.4rem; }
.roles-help { margin-bottom: 1.25rem; }
.roles-help summary { cursor: pointer; color: var(--accent); }
.roles-help ul, .roles-help ol { color: var(--muted); }

/* ---------- investigation result ---------- */
.results { margin-top: 2rem; }
.results h2 { margin-top: 0; }
.count { color: var(--muted); font-weight: 600; font-size: 1rem; }
.resulthead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.resulthead h2 { margin: 0; }
.resulthead form { margin: 0; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chain { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-m); margin-bottom: 1rem; overflow: hidden; }
.link { position: relative; padding: 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 0.2rem; }
.link + .link { border-left: 1px solid var(--line); }
.link + .link::before { content: ""; position: absolute; left: -0.55rem; top: 50%; width: 1rem; height: 1rem;
  transform: translateY(-50%) rotate(45deg); background: var(--surface); border-top: 1px solid var(--line); border-right: 1px solid var(--line); }
.link .k { font-size: 0.8rem; color: var(--muted); }
.link .v { font-size: 1.25rem; font-weight: 650; word-break: break-all; }
.link .n { font-size: 0.85rem; color: var(--muted); }
.link.end { background: var(--accent-weak); }
.link.end .v { color: var(--accent); font-size: 1.45rem; }
.link.end.missing { background: var(--danger-weak); }
.link.end.missing .v { color: var(--danger); font-size: 1.1rem; }
.chain .meta { grid-column: 1 / -1; margin: 0; padding: 0.6rem 1.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
@media (max-width: 48rem) { .chain { grid-template-columns: 1fr; }
  .link + .link { border-left: 0; border-top: 1px solid var(--line); }
  .link + .link::before { left: 1.5rem; top: -0.55rem; transform: rotate(135deg); } }
.raw { margin-top: 1rem; }
.raw summary { cursor: pointer; color: var(--accent); padding: 0.5rem 0; }
.logtable td.msg { white-space: pre-wrap; word-break: break-all; min-width: 30rem; }
.logtable tr.sev0 td, .logtable tr.sev1 td, .logtable tr.sev2 td, .logtable tr.sev3 td { color: var(--danger); }
tr.ev-up td:nth-child(2) { color: var(--accent); font-weight: 600; }
tr.ev-down td:nth-child(2) { color: var(--danger); font-weight: 600; }
tr.ev-snapshot td { color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* mobile fixes */
.two > *, .kpis > *, .health5 > * { min-width: 0; }
.bare-scroll { overflow-x: auto; }
@media (max-width: 34rem) {
  .kpis { grid-template-columns: 1fr; }
  .warnbar { flex-wrap: wrap; }
  .page { padding-top: 20px; }
}

/* ---------- Find ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.findbox { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 14px; align-items: end; margin-bottom: 20px; }
.findbox .fq input { font-size: 1.1rem; min-height: 3.2rem; }
.findbox button { min-height: 3.2rem; padding: 0 1.6rem; }
.findbox .custom { grid-column: 1 / -1; }
.findbox .custom summary { cursor: pointer; color: var(--muted); font-size: 0.88rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 10px; }
@media (max-width: 60rem) { .findbox { grid-template-columns: 1fr 1fr; } .findbox .fq, .findbox button { grid-column: 1 / -1; } }
@media (max-width: 34rem) { .findbox, .grid2 { grid-template-columns: 1fr; } }
.tips h2 { margin: 0 0 14px; font-size: 1.05rem; }
.tipgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 12px; }
.tipgrid > div { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--line-soft); border-radius: 8px; }
.tipgrid span { color: var(--muted); font-size: 0.9rem; }
.tipgrid code { margin-top: auto; padding-top: 6px; color: var(--accent); }
@media (max-width: 60rem) { .tipgrid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 34rem) { .tipgrid { grid-template-columns: 1fr; } }
.searchedas { color: var(--muted); margin: 0 0 16px; }
.searchedas strong { color: var(--ink); }
.livetag { color: var(--accent); font-weight: 600; }
.statuscard { display: grid; grid-template-columns: 1.4fr repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.statuscard > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.statuscard .k { font-size: 0.8rem; color: var(--muted); }
.statuscard .sc-main .v { font-size: 1.5rem; font-weight: 700; word-break: break-all; }
.statuscard .state.ok { color: var(--ok); font-weight: 700; }
.statuscard .state.off { color: var(--muted); font-weight: 600; }
@media (max-width: 70rem) { .statuscard { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 34rem) { .statuscard { grid-template-columns: 1fr 1fr; } }
.sess { margin-bottom: 16px; }
.sess summary { cursor: pointer; font-weight: 600; }
td.strong { font-weight: 600; }
a.primary-link { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.smartfind { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 14px; }
.smartfind svg { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.smartfind input { flex-grow: 1; border: 0; font-size: 1.1rem; min-height: 3rem; background: transparent; }
.smartfind input:focus-visible { outline: none; }
.smartfind:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.smartfind select { min-width: 9rem; }
@media (max-width: 40rem) { .smartfind { flex-wrap: wrap; } .smartfind input { min-width: 100%; } }


/* ---------- v2: top bar, KPI icons, donut, stream, statuses ---------- */
.brand { flex-direction: row; align-items: center; gap: 12px; }
.brand > span:last-child { display: flex; flex-direction: column; }
.logo { width: 38px; height: 38px; border-radius: 11px; background: #2563eb; color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 0.95rem; flex-shrink: 0; }
.topbar { position: sticky; top: 0; z-index: 5; height: 68px; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 clamp(1rem, 3vw, 2rem); }
.topsearch { display: flex; align-items: center; gap: 8px; width: min(420px, 55%); background: var(--surface2);
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0 12px; }
.topsearch:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; }
.topsearch svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; flex-shrink: 0; }
.topsearch input { border: 0; background: transparent; min-height: 2.6rem; width: 100%; padding: 0; }
.topsearch input:focus-visible { outline: none; }
.topright { display: flex; align-items: center; gap: 12px; }
.iconbtn { position: relative; width: 44px; height: 44px; min-height: 44px; padding: 0; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface2); color: var(--ink); }
.iconbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn svg .half { fill: currentColor; stroke: none; }
.badgecount { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--danger); color: #fff; font-size: 0.72rem; font-weight: 700; display: grid; place-items: center; }
.avatarlink { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-weak); color: var(--accent); display: grid;
  place-items: center; font-weight: 700; font-size: 0.85rem; }
.av-text { display: flex; flex-direction: column; line-height: 1.25; }
.av-text strong { font-size: 0.88rem; }
.av-text small { color: var(--muted); font-size: 0.76rem; }
@media (max-width: 60rem) { .av-text { display: none; } .topbar { position: static; } }
.page { padding-top: 26px; }
.dash-head .actions { display: flex; gap: 10px; margin-bottom: 1.25rem; }

.kpitop { display: flex; justify-content: space-between; align-items: center; }
.kicon { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-weak); color: var(--accent); display: grid; place-items: center; }
.kicon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi .n.good { color: var(--ok); }
.kpi .n.bad { color: var(--danger); }
.chartrow { grid-template-columns: 1.55fr 1fr; }
@media (max-width: 60rem) { .chartrow { grid-template-columns: 1fr; } }
.donutwrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
svg.donut { width: 150px; height: 150px; flex-shrink: 0; transform: rotate(0deg); }
svg.donut circle { fill: none; stroke-width: 6; }
svg.donut .ring { stroke: var(--line-soft); }
svg.donut .seg.c1, .sw.c1 { stroke: var(--c1); background: var(--c1); }
svg.donut .seg.c2, .sw.c2 { stroke: var(--c2); background: var(--c2); }
svg.donut .seg.c3, .sw.c3 { stroke: var(--c3); background: var(--c3); }
svg.donut .seg.c4, .sw.c4 { stroke: var(--c4); background: var(--c4); }
.legendlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; flex-grow: 1; font-size: 0.9rem; }
.legendlist li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; }
.legendlist .sw { width: 10px; height: 10px; border-radius: 3px; }
.stream { margin-bottom: 20px; }
.livepill { margin-left: 8px; font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--ok-weak); color: var(--ok); vertical-align: middle; }
.tag { font-size: 0.72rem; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--accent-weak); color: var(--accent); }
.tag.t-login { background: var(--ok-weak); color: var(--ok); }
.tag.t-logout { background: var(--danger-weak); color: var(--danger); }
.status { font-size: 0.76rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.status.ok { background: var(--ok-weak); color: var(--ok); }
.status.warn { background: var(--warn-weak); color: var(--warn); }
.status.down { background: var(--danger-weak); color: var(--danger); }
.syslist { list-style: none; margin: 0; padding: 0; }
.syslist li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 0.92rem; }
.syslist li:last-child { border-bottom: 0; }
table.flat th { text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.72rem; }
svg.meter.hot .fill { fill: var(--warn-bar); }
.diag .checks { margin: 0.75rem 0 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.75rem; color: var(--ink); }
.diag .checks li.hit { color: var(--ok); }
.diag .checks li.miss { color: var(--danger); }
.diag .checks form { margin-top: 0.5rem; }
.diag table { margin-top: 0.5rem; }

.brand { font-size: 1rem; white-space: nowrap; }
.brand small { white-space: nowrap; }

/* ---------- MikroTik auto-setup ---------- */
.crumb { color: var(--muted); font-size: 0.88rem; margin: 0 0 0.4rem; }
.h2flat { margin: 0 0 10px; font-size: 1.05rem; }
.narrow-wide { max-width: 44rem; }
.plainlist { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.plainlist strong { color: var(--ink); }
.routercard { display: grid; grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.routercard > div { display: flex; flex-direction: column; }
.routercard .k { font-size: 0.8rem; color: var(--muted); }
.routercard .v { font-size: 1.4rem; font-weight: 700; }
@media (max-width: 48rem) { .routercard { grid-template-columns: 1fr 1fr; } }
.warnnote { background: var(--warn-weak); color: var(--warn); margin-bottom: 16px; }
.steps { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 14px; }
.steps .st-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.steps ul { margin: 6px 0 0; color: var(--muted); }
.panel + .actions, form.actions { margin-top: 16px; }
.autoadd { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 20px; }
.autoadd p { margin: 0; }
.checklist { list-style: none; margin: 0 0 16px; display: flex; flex-direction: column; gap: 0; }
.checklist li { display: grid; grid-template-columns: 7rem 1fr; gap: 14px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.checklist li:last-child { border-bottom: 0; }
.checklist li div { display: flex; flex-direction: column; }
.rowlinks a { margin-right: 10px; }

/* session times */
.sessline { grid-column: 1 / -1; margin: 0; padding: 0.8rem 1.5rem; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.sessline div { display: flex; flex-direction: column; }
.sessline dt { font-size: 0.78rem; color: var(--muted); }
.sessline dd { margin: 0; font-weight: 600; }
@media (max-width: 48rem) { .sessline { grid-template-columns: 1fr 1fr; } }
.colhelp { margin: 0 0 8px; }

/* ---------- v3: font, full width, compact dashboard ---------- */
@font-face { font-family: "Inter"; src: url("/static/fonts/inter.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap; }
:root { --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif; }
body { font-size: 15px; letter-spacing: -0.005em; -webkit-font-smoothing: antialiased; }
.page, .foot { max-width: 1680px; }
.page { padding-top: 22px; }
.panel { padding: 16px 18px; }
.kpis { gap: 16px; margin-bottom: 16px; }
.kpi .v { font-size: clamp(1.5rem, 2.2vw, 1.9rem); }
.grid-b { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.grid-c { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.grid-d { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.stackcol { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.grid-b > *, .grid-c > *, .grid-d > * { min-width: 0; }
@media (max-width: 90rem) { .grid-b { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } .grid-b > :last-child { grid-column: 1 / -1; } }
@media (max-width: 70rem) { .grid-c, .grid-d { grid-template-columns: 1fr; } }
@media (max-width: 48rem) { .grid-b { grid-template-columns: 1fr; } }
svg.bars { height: 150px; }
svg.donut { width: 128px; height: 128px; }
.donutcard .legendlist li { grid-template-columns: 12px 1fr auto; }
.stream { margin-bottom: 0; }
table.dense th, table.dense td { padding: 0.42rem 0.45rem; font-size: 0.86rem; }
.syslist.compact li { padding: 7px 0; font-size: 0.88rem; }
.devlist { list-style: none; margin: 0; padding: 0; }
.devlist li { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.devlist li:last-child { border-bottom: 0; }
.devlist .dn { display: flex; flex-direction: column; min-width: 0; }
.devlist .dot { margin-right: 0; }
.talkers { gap: 10px; }
.activity li { padding: 6px 0; }
.dash-head .lede { margin-bottom: 1rem; }
.warnbar, .alertlist { margin-bottom: 16px; padding: 12px 18px; }
/* devices page */
.found { margin-bottom: 16px; border-color: var(--warn-bar); }
.found form.inline input { min-width: 12rem; }
.small-btn { min-height: 2.3rem; padding: 0.3rem 0.9rem; }
.manual { margin-top: 16px; }
.manual summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.devform { margin-top: 14px; }
.panel + .panel { margin-top: 16px; }
.grid-c .panel + .panel, .stackcol .panel + .panel, .grid-d .panel + .panel, .grid-b .panel + .panel { margin-top: 0; }
.grid-b .chart { display: flex; flex-direction: column; }
.grid-b svg.bars { flex-grow: 1; min-height: 150px; height: auto; }
.grid-b .donutcard .donutwrap { flex-grow: 1; justify-content: center; }

/* devices v10 */
.devtable td { vertical-align: top; }
.rowlinks { white-space: nowrap; }
details.del { display: inline-block; position: relative; }
details.del summary { list-style: none; cursor: pointer; color: var(--danger); text-decoration: underline; }
details.del summary::-webkit-details-marker { display: none; }
details.del[open] form { position: absolute; right: 0; top: 1.6rem; z-index: 4; width: 16rem; white-space: normal;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px; box-shadow: var(--shadow); }
details.del p { margin: 0 0 8px; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.nathelp { margin: 12px 0 0; max-width: 90ch; }
.span2 { grid-column: span 2; }
@media (max-width: 34rem) { .span2 { grid-column: auto; } }
.ver { float: right; opacity: 0.7; }

/* ---------- side panel (drawer) ---------- */
.clickrow { cursor: pointer; }
.clickrow:hover td, li.clickrow:hover { background: var(--surface2); }
.clickrow:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
td.chev { color: var(--muted); font-size: 1.2rem; text-align: right; width: 1.5rem; }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(560px, 100vw); max-width: 100vw;
  padding: 0; border: 0; border-left: 1px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18); display: none; flex-direction: column; }
dialog.drawer[open] { display: flex; animation: slidein 160ms ease-out; }
dialog.drawer::backdrop { background: rgba(15, 23, 42, 0.35); }
@keyframes slidein { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.drawer-title { font-weight: 700; }
.drawer-body { padding: 18px; overflow-y: auto; flex-grow: 1; }
.drawer-loading { padding: 2rem 0; text-align: center; }
.dv-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.dv-name { margin: 0; font-size: 1.4rem; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 16px; padding: 12px; background: var(--surface2); border-radius: var(--radius-s); }
.facts div { display: flex; flex-direction: column; }
.facts dt { font-size: 0.78rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.dv-h { font-size: 0.95rem; margin: 16px 0 8px; }
.checklist.tight { padding: 0; }
.checklist.tight li { grid-template-columns: 6.5rem 1fr; padding: 8px 0; }
.dv-sec { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; margin-top: 12px; }
.dv-sec summary { cursor: pointer; font-weight: 600; }
.dv-sec form { margin-top: 12px; }
.danger-zone { border-color: var(--danger); }
.danger-zone summary { color: var(--danger); }
.dv-actions { margin-top: 16px; }
.narrow-page { max-width: 640px; }
.rowbtns { display: flex; gap: 6px; align-items: center; }
@media (prefers-reduced-motion: reduce) { dialog.drawer[open] { animation: none; } }
.dv-sec form button, .stack > button { justify-self: start; }

/* backup page */
.jobbox { display: flex; flex-direction: column; gap: 6px; padding: 12px; background: var(--accent-weak); border-radius: var(--radius-s); }
.bform { align-items: end; gap: 12px; margin-bottom: 8px; }
.bform input[type="date"] { min-height: 2.9rem; }
.bform button { min-height: 2.9rem; }
.whatinside { margin-top: 12px; }
.whatinside summary { cursor: pointer; color: var(--accent); }
.legal { list-style: none; margin: 0; padding: 0; }
.legal li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.legal li:last-child { border-bottom: 0; }
.legal li div { display: flex; flex-direction: column; }
.legal .dot { margin-top: 6px; }
