/* vGuard admin – design tokens
   ink: text & sidebar · fog: canvas · paper: surfaces
   tunnel: protected / primary · alert: blocked / danger · amber: attention */
:root {
  --ink: #13233a;
  --ink-2: #2a3b55;
  --ink-soft: #5b6b82;
  --fog: #edf1f5;
  --paper: #ffffff;
  --line: #d6dee8;
  --line-soft: #e6ebf1;
  --tunnel: #1f8a7a;
  --tunnel-strong: #17695d;
  --tunnel-tint: #e3f3f0;
  --alert: #c8374a;
  --alert-tint: #fbe9ec;
  --amber: #a86d0a;
  --amber-tint: #fbf1dc;
  --sky: #38bdf8;
  --side-bg: #13233a;
  --side-fg: #c9d5e4;
  --side-fg-strong: #ffffff;
  --side-hover: #1d3150;
  --focus: #2b7fd8;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-small: 0.8125rem;   /* 13 */
  --fs-body: 0.9375rem;    /* 15 */
  --fs-h3: 1.125rem;       /* 18 */
  --fs-h2: 1.125rem;
  --fs-h1: 1.5rem;         /* 24 */
  --fs-display: 2rem;      /* 32 */
  --radius-s: 6px;
  --radius-m: 10px;
  --space: 8px;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-other: #b9c2ce;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e4ebf4;
    --ink-2: #c3cfdd;
    --ink-soft: #8d9cb1;
    --fog: #0f1a2a;
    --paper: #16243a;
    --line: #2a3b55;
    --line-soft: #213149;
    --tunnel: #3cb5a2;
    --tunnel-strong: #57c9b6;
    --tunnel-tint: #143a3a;
    --alert: #f07383;
    --alert-tint: #3d1e29;
    --amber: #e3b04b;
    --amber-tint: #3a2f17;
    --side-bg: #0a1320;
    --side-hover: #16243a;
    --focus: #6aaef5;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-other: #4d5f78;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fog);
  color: var(--ink);
  font: var(--fs-body)/1.55 var(--font);
  font-feature-settings: "tnum" 0;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--fs-h1); line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-h2); line-height: 1.35; font-weight: 620; }
a { color: var(--tunnel-strong); text-underline-offset: 2px; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; }
.muted { color: var(--ink-soft); }
.small { font-size: var(--fs-small); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.booting, .fatal { padding: 48px; color: var(--ink-soft); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 10; background: var(--paper); padding: 8px 12px; border-radius: var(--radius-s); }
.skip:focus { left: 8px; }

/* ---------------------------------------------------------------- controls */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: var(--radius-s);
  font: inherit; font-weight: 560; line-height: 1.2;
  padding: 9px 14px; cursor: pointer; white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.is-busy { cursor: progress; }
.btn-primary { background: var(--tunnel); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--tunnel-strong); }
.btn-secondary { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-secondary:not(:disabled):hover { border-color: var(--ink-soft); }
.btn-danger { background: var(--alert); color: #fff; }
.btn-danger:not(:disabled):hover { filter: brightness(.92); }
.btn-ghost { background: transparent; color: var(--tunnel-strong); padding-inline: 8px; }
.btn-ghost:not(:disabled):hover { background: var(--tunnel-tint); }
.btn-on-dark { color: var(--side-fg); }
.btn-on-dark:hover { background: var(--side-hover) !important; color: var(--side-fg-strong); }

.input {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 9px 11px; min-height: 40px;
}
.input:hover { border-color: var(--ink-soft); }
.input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
select.input { padding-right: 28px; }
.input-code { font-size: 1.5rem; letter-spacing: .35em; font-variant-numeric: tabular-nums; text-align: left; max-width: 15ch; }

.field { display: grid; gap: 6px; }
.field label { font-weight: 560; font-size: var(--fs-small); color: var(--ink-2); }
.field-hint { font-size: var(--fs-small); color: var(--ink-soft); }
.form-error {
  background: var(--alert-tint); color: var(--alert); border-left: 3px solid var(--alert);
  padding: 9px 12px; border-radius: 0 var(--radius-s) var(--radius-s) 0; font-weight: 520;
}
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--tunnel); }

.stack { display: grid; gap: 16px; align-content: start; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.narrow { max-width: 520px; }

.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 520; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.status-ok { color: var(--tunnel-strong); }
.status-off { color: var(--ink-soft); }
.status-warn { color: var(--amber); }
.status-alert { color: var(--alert); }
.tag {
  display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 4px;
  background: var(--tunnel-tint); color: var(--tunnel-strong); font-size: var(--fs-small); font-weight: 560;
}

.secret {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--fog); border: 1px dashed var(--line); border-radius: var(--radius-s); padding: 10px 12px;
}
.invite-code { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 4px; }
.invite-code strong { font: 700 1.6rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.secret code { font-size: 1.05rem; letter-spacing: .04em; flex: 1 1 auto; white-space: normal; word-spacing: .15em; }

/* ---------------------------------------------------------------- auth screens */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 680; font-size: 1.125rem; letter-spacing: -0.01em; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand-light { color: #fff; }

.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 5fr) minmax(0, 7fr); }
.auth-side {
  background: var(--side-bg); color: var(--side-fg);
  padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
}
.auth-art { color: #8fa6c3; max-width: 420px; }
.route-art { width: 100%; height: auto; display: block; }
.route-line { stroke: #8fd3c7; }
.route-block { stroke: #f07383; }
.auth-claim { font-size: 1.25rem; line-height: 1.45; color: #e4ebf4; max-width: 30ch; font-weight: 480; }
.auth-main { display: grid; place-items: center; padding: 48px 24px; }
.auth-panel { width: 100%; max-width: 420px; display: grid; gap: 20px; }
.auth-panel > h1 { font-size: var(--fs-display); letter-spacing: -0.02em; }
.auth-alt { display: flex; flex-wrap: wrap; gap: 4px; margin-left: -8px; }

.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; display: grid; gap: 22px; }
.steps > li { counter-increment: step; display: grid; grid-template-columns: 32px 1fr; column-gap: 12px; row-gap: 8px; }
.steps > li::before {
  content: counter(step); grid-row: 1 / span 4;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--tunnel); color: var(--tunnel-strong); font-weight: 650; font-size: var(--fs-small);
}
.steps > li > * { grid-column: 2; }
.step-title { font-weight: 620; }
.qr { width: 200px; height: 200px; border-radius: var(--radius-s); border: 1px solid var(--line); background: #fff; image-rendering: pixelated; }
.manual-key summary { cursor: pointer; color: var(--tunnel-strong); font-weight: 520; }
.manual-key .secret { margin-top: 8px; }

.codes {
  list-style: none; margin: 0; padding: 16px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 24px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m);
}
.codes code { font-size: 1.05rem; letter-spacing: .05em; }

@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { padding: 20px 24px; flex-direction: row; align-items: center; }
  .auth-art, .auth-claim { display: none; }
  .auth-main { place-items: start center; padding-top: 32px; }
}

/* ---------------------------------------------------------------- app shell */
.shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar {
  background: var(--side-bg); color: var(--side-fg);
  display: flex; flex-direction: column; gap: 24px; padding: 20px 12px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.nav-toggle { display: none; color: var(--side-fg); }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-s);
  color: var(--side-fg); text-decoration: none; font-weight: 520;
  border-left: 3px solid transparent;
}
a.nav-item:hover { background: var(--side-hover); color: var(--side-fg-strong); }
.nav-item.is-active { background: var(--side-hover); color: var(--side-fg-strong); border-left-color: var(--sky); }
.nav-item.is-soon { opacity: .5; cursor: default; }
.soon { font-size: 0.75rem; font-weight: 500; opacity: .9; }
.sidebar-user { margin-top: auto; display: grid; gap: 6px; border-top: 1px solid #2a3b55; padding-top: 14px; }
.user { display: grid; padding: 6px 10px; border-radius: var(--radius-s); text-decoration: none; color: var(--side-fg); }
.user:hover, .user.is-active { background: var(--side-hover); }
.user-name { color: var(--side-fg-strong); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: var(--fs-small); }
.sidebar-user .btn { justify-self: start; }

.content { padding: 32px 40px 64px; max-width: 1240px; width: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-content: start; }
.content:focus { outline: none; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-header .muted { margin-top: 4px; }
.page-actions { display: flex; gap: 8px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; padding: 12px; gap: 12px; }
  .nav-toggle { display: inline-block; }
  .sidebar nav, .sidebar-user { display: none; }
  .shell.nav-open .sidebar nav, .shell.nav-open .sidebar-user { display: grid; }
  .content { padding: 20px 16px 48px; }
}

/* ---------------------------------------------------------------- content blocks */
.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m);
}
.fact { padding: 18px 20px; display: grid; gap: 6px; align-content: start; }
.fact + .fact { border-left: 1px solid var(--line-soft); }
.fact-label { color: var(--ink-soft); font-size: var(--fs-small); font-weight: 520; }
@media (max-width: 720px) { .fact + .fact { border-left: 0; border-top: 1px solid var(--line-soft); } }

.notice { border-left: 3px solid var(--sky); padding: 4px 0 4px 16px; display: grid; gap: 6px; max-width: 72ch; }

.table-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: var(--fs-small); font-weight: 600; color: var(--ink-soft);
  padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--fog) 55%, transparent); }
.table .num { font-variant-numeric: tabular-nums; }
.table tr.is-muted td { color: var(--ink-soft); }
.table tr.is-alarm td:nth-child(3) { color: var(--alert); font-weight: 560; }
.cell-title { font-weight: 580; }
.col-actions { width: 1%; text-align: right; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters > .input:first-child { flex: 1 1 280px; }
.filters select.input { width: auto; }
.inline-label { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: var(--fs-small); font-weight: 520; }
.inline-label .input { width: auto; }
.load-more { display: flex; justify-content: center; }
.load-more .btn[hidden] { display: none; }

.empty { padding: 40px 24px; text-align: center; display: grid; gap: 8px; justify-items: center; background: var(--paper); border: 1px dashed var(--line); border-radius: var(--radius-m); }
.empty-title { font-weight: 620; font-size: var(--fs-h3); }

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 48px; align-items: start; }
.split > section { max-width: 460px; }

/* row action menu */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; min-width: 260px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: 0 10px 30px rgb(19 35 58 / .14); padding: 6px; display: grid;
}
.menu-list .btn { text-align: left; color: var(--ink); font-weight: 500; }

/* dialog */
.dialog {
  border: 1px solid var(--line); border-radius: var(--radius-m); padding: 0; width: min(520px, calc(100vw - 32px));
  background: var(--paper); color: var(--ink); box-shadow: 0 24px 60px rgb(10 20 35 / .28);
}
.dialog::backdrop { background: rgb(10 20 35 / .45); }
.dialog-title { padding: 20px 24px 0; font-size: var(--fs-h3); }
.dialog-body { padding: 14px 24px 8px; display: grid; gap: 14px; }
.dialog-actions { padding: 16px 24px 20px; display: flex; justify-content: flex-end; gap: 8px; }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast {
  background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: var(--radius-s);
  box-shadow: 0 8px 24px rgb(10 20 35 / .25); font-weight: 520; max-width: 380px;
  transition: opacity .4s ease, transform .4s ease;
}
.toast-alert { background: var(--alert); color: #fff; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); }

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

@media (max-width: 640px) {
  .table td { white-space: nowrap; }
}
@media (prefers-color-scheme: dark) {
  .btn-primary { color: #06201c; }
}

/* ---------------------------------------------------------------- F2.2: devices, people */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.summary-item {
  appearance: none; border: 0; background: transparent; font: inherit; color: inherit; text-align: left;
  padding: 14px 18px; display: grid; gap: 2px; border-left: 1px solid var(--line-soft); cursor: pointer;
}
.summary-static .summary-item { cursor: default; }
.summary-item:first-child { border-left: 0; }
button.summary-item:hover { background: color-mix(in srgb, var(--fog) 60%, transparent); }
.summary-item.is-active { background: var(--fog); box-shadow: inset 0 -3px 0 currentColor; }
.summary-num { font-size: 1.75rem; line-height: 1.1; font-weight: 680; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.summary-label { font-size: var(--fs-small); color: var(--ink-soft); font-weight: 520; }
.tone-ok .summary-num { color: var(--tunnel-strong); }
.tone-alert .summary-num { color: var(--alert); }
.tone-warn .summary-num { color: var(--amber); }
.tone-ok.is-active { color: var(--tunnel-strong); }
.tone-alert.is-active { color: var(--alert); }
.tone-warn.is-active { color: var(--amber); }
@media (max-width: 720px) {
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-item:nth-child(3) { border-left: 0; }
  .summary-item:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
}

.table-click tbody tr { cursor: pointer; }
.cell-link { color: var(--ink); text-decoration: none; display: inline-block; }
.cell-link:hover { color: var(--tunnel-strong); text-decoration: underline; }
.inline-check { align-items: center; color: var(--ink-2); font-size: var(--fs-small); font-weight: 520; }

.crumbs { font-size: var(--fs-small); margin-bottom: -18px; }
.crumbs a { color: var(--ink-soft); }

.state-banner {
  display: grid; gap: 4px; padding: 14px 18px; border-radius: var(--radius-m);
  border: 1px solid var(--line); background: var(--paper); border-left-width: 4px;
}
.state-banner .status { font-size: 1.0625rem; }
.state-connected { border-left-color: var(--tunnel); }
.state-disconnected { border-left-color: var(--alert); background: color-mix(in srgb, var(--alert-tint) 45%, var(--paper)); }
.state-never { border-left-color: var(--amber); }
.state-revoked { border-left-color: var(--ink-soft); }
.fact-value { font-size: 1.0625rem; font-weight: 600; }
.section-title { margin-bottom: 10px; }

.props { display: grid; grid-template-columns: minmax(160px, max-content) minmax(0, 1fr); gap: 0; margin: 0;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); }
.props dt, .props dd { padding: 10px 16px; border-top: 1px solid var(--line-soft); margin: 0; }
.props dt { color: var(--ink-soft); font-size: var(--fs-small); font-weight: 560; padding-top: 12px; }
.props dt:first-of-type, .props dt:first-of-type + dd { border-top: 0; }
.break { word-break: break-all; }
@media (max-width: 640px) {
  .props { grid-template-columns: minmax(0, 1fr); }
  .props dd { border-top: 0; padding-top: 0; }
}

.enroll { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
.qr-lg { width: 220px; height: 220px; }
.steps-compact { gap: 12px; }
.steps-compact > li::before { width: 24px; height: 24px; }
.callout { background: var(--amber-tint); color: var(--ink); border-left: 3px solid var(--amber); padding: 9px 12px; border-radius: 0 var(--radius-s) var(--radius-s) 0; font-size: var(--fs-small); }
.config { background: var(--fog); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; overflow-x: auto; font-size: 0.8125rem; margin: 8px 0 0; }
.dialog:has(.enroll) { width: min(640px, calc(100vw - 32px)); }
@media (max-width: 560px) {
  .enroll { grid-template-columns: minmax(0, 1fr); justify-items: center; }
}

.people { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 32px; align-items: start; }
.people > section { display: grid; gap: 14px; }
.people > section > .section-head { margin-bottom: 0; }
@media (max-width: 860px) { .people { grid-template-columns: minmax(0, 1fr); } }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.group-item {
  appearance: none; width: 100%; border: 0; background: transparent; font: inherit; color: var(--ink);
  display: flex; justify-content: space-between; gap: 8px; text-align: left;
  padding: 7px 10px; border-radius: var(--radius-s); cursor: pointer; border-left: 3px solid transparent;
}
.group-item:hover { background: var(--paper); }
.group-item.is-active { background: var(--paper); border-left-color: var(--tunnel); font-weight: 600; }
[data-depth="1"] { padding-left: 26px; }
[data-depth="2"] { padding-left: 42px; }
[data-depth="3"] { padding-left: 58px; }
[data-depth="4"] { padding-left: 74px; }
.group-actions { margin-top: 10px; margin-left: -8px; }

.offline-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; }
.offline-list li::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--alert); margin-right: 10px; vertical-align: middle; }

.scope-box { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 14px 12px; margin: 0; display: grid; gap: 8px; }
.scope-box legend { font-weight: 560; font-size: var(--fs-small); color: var(--ink-2); padding: 0 4px; }
.scope-box[hidden] { display: none; }
.scope-list { display: grid; gap: 6px; max-height: 220px; overflow-y: auto; }


/* ---------------------------------------------------------------- F2.3: DNS log */
.summary-static:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chart { min-height: 0; }
.chart-fig { margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px 10px; }
.chart-fig svg { display: block; width: 100%; height: 120px; }
.chart-fig .bar { fill: color-mix(in srgb, var(--tunnel) 45%, var(--line)); }
.chart-fig .bar-blocked { fill: var(--alert); }
.chart-fig g:hover .bar { fill: var(--tunnel); }
.chart-axis { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.chart-legend { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 8px; }
.key-total { background: color-mix(in srgb, var(--tunnel) 45%, var(--line)); }
.key-blocked { background: var(--alert); }

.dns-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); gap: 28px; align-items: start; }
@media (max-width: 1000px) { .dns-layout { grid-template-columns: minmax(0, 1fr); } }
.dns-side h2 { font-size: 1rem; }
.toplist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.toplist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline; }
.toplist-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.toplist-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--tunnel) 55%, var(--line)); }
.toplist-bar.is-blocked { background: var(--alert); }
.link-btn { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--tunnel-strong); text-decoration: underline; }
td.domain { word-break: break-all; }
.table tr.is-blocked td.domain, .table tr.is-blocked td.domain .link-btn { color: var(--alert); }
.dns-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; }
.dns-foot p { max-width: 70ch; }
.verify { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* rules */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-top: -8px; overflow-x: auto; }
.tab {
  padding: 9px 14px; color: var(--ink-soft); text-decoration: none; font-weight: 540; white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--tunnel); }
.tag-amber { background: var(--amber-tint); color: var(--amber); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--fog); border: 1px solid var(--line);
  font-size: var(--fs-small); font-weight: 520; color: var(--ink-2); white-space: nowrap;
}
.chip.is-foreign { color: var(--ink-soft); border-style: dashed; }
.block { display: block; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8125rem; }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.5; }
.fieldset { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--paper); padding: 14px 18px 16px; display: grid; gap: 12px; margin: 0; }
.fieldset legend { font-weight: 620; padding: 0 6px; margin-left: -6px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 24px; }
.cat-name { font-weight: 580; }
.warn-text { color: var(--amber); }
.policy-form { max-width: 980px; }
.split-tight { gap: 24px; }
.split-tight > .field { max-width: none; }
.form-actions { position: sticky; bottom: 0; background: var(--fog); padding: 12px 0; border-top: 1px solid var(--line); }
.sched .day { font-weight: 500; }
.assign-list { display: grid; gap: 6px; }
.target-picker select.input { width: auto; flex: 1 1 200px; }
.field-label { font-weight: 560; font-size: var(--fs-small); }
.verdict { border-radius: var(--radius-m); padding: 16px 20px; display: grid; gap: 8px; border: 1px solid var(--line); background: var(--paper); border-left-width: 4px; max-width: 760px; }
.verdict.is-blocked { border-left-color: var(--alert); }
.verdict.is-allowed { border-left-color: var(--tunnel); }
.verdict-title { font-size: var(--fs-h3); font-weight: 650; }
.verdict.is-blocked .verdict-title { color: var(--alert); }
.verdict.is-allowed .verdict-title { color: var(--tunnel-strong); }
.result { display: grid; gap: 2px; }
.result-cell { min-width: 140px; }
.result-cell .small { max-width: 34ch; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.sched input[type="time"] { width: auto; }

/* ---------------------------------------------------------------- alerts (F2.5) */
.nav-badge { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--amber); color: #13233a; font-size: 0.75rem; font-weight: 700; line-height: 20px; text-align: center; }
.nav-badge.is-critical { background: var(--alert); color: #fff; }
.nav-badge[hidden] { display: none; }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.alert-item {
  display: flex; gap: 16px; justify-content: space-between; align-items: flex-start;
  background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--amber);
  border-radius: var(--radius-m); padding: 14px 16px;
}
.alert-item.sev-critical { border-left-color: var(--alert); }
.alert-item.st-acknowledged { border-left-style: dashed; }
.alert-item.st-closed { border-left-color: var(--line); }
.alert-main { display: grid; gap: 4px; min-width: 0; }
.alert-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.alert-title { font-size: var(--fs-body); font-weight: 650; margin: 0; }
.alert-device { font-weight: 560; }
.alert-note { font-size: var(--fs-small); background: var(--fog); border-radius: var(--radius-s); padding: 6px 10px; white-space: pre-wrap; }
.alert-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.alert-rule { gap: 8px; }
.alert-rule-body { padding-left: 26px; }
.input-num { width: 6.5em !important; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.dash-grid h2 { margin-bottom: 12px; }
@media (max-width: 860px) {
  .alert-item { flex-direction: column; }
  .alert-actions { justify-content: flex-start; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
.prefix-list { columns: 3 12em; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: var(--fs-small); max-height: 50vh; overflow: auto; margin: 0; padding: 0; list-style: none; }
.filters-compact > .input:first-child { flex: 0 1 auto; width: auto; min-width: 14em; }

/* ---------------------------------------------------------------- MDM (F3) */
.wizard { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.wizard-step { display: flex; gap: 14px; align-items: flex-start; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px; }
.wizard-step:not(.is-active):not(.is-done) { opacity: .6; }
.wizard-step.is-active { border-color: var(--tunnel); box-shadow: 0 0 0 1px var(--tunnel) inset; }
.wizard-num { flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: var(--fs-small); background: var(--fog); color: var(--ink-soft); }
.wizard-step.is-active .wizard-num { background: var(--tunnel); color: #fff; }
.wizard-step.is-done .wizard-num { background: var(--tunnel-tint); color: var(--tunnel-strong); }
.wizard-title { font-size: var(--fs-body); font-weight: 650; margin: 3px 0 0; }
.wizard-step > .stack-tight { flex: 1; min-width: 0; }
.stack-tight { display: grid; gap: 8px; }
.plain-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.row input[type=file].input { width: auto; flex: 1; min-width: 12em; }

/* Device page: MDM section */
.mdm-state { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.mdm-state p { margin: 0; }
.mdm-commands summary { cursor: pointer; font-weight: 560; padding: 6px 0; }
.mdm-commands .table-wrap { margin-top: 8px; }
.fact .small { overflow-wrap: anywhere; }

/* vGuard app */
.fold { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--paper); padding: 10px 16px; }
.fold > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.fold[open] > summary { margin-bottom: 12px; }

/* Messages to the app (F4.4) */
.pre-line { white-space: pre-line; overflow-wrap: anywhere; }
.msg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.msg-list > li { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px 14px; background: var(--paper); }
.msg-list .msg-head { margin-bottom: 4px; }
.msg-list p { margin: 0 0 6px; }

/* ---------------------------------------------------------------- FamilyGuard (P3) */
.kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.kid-card {
  display: grid; gap: 12px; padding: 18px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-m); color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s;
}
.kid-card:hover { border-color: var(--tunnel); box-shadow: 0 2px 10px rgba(19, 35, 58, .08); }
.kid-head { display: flex; align-items: center; gap: 12px; }
.kid-avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--tunnel-tint); color: var(--tunnel-strong); font-weight: 700; font-size: 1.15rem;
}
.kid-name { font-weight: 650; font-size: var(--fs-h3); }
.kid-status { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.kid-facts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: var(--fs-small); }

.requests { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.request {
  display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap;
  padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m);
}
.request-main { display: grid; gap: 4px; min-width: 0; flex: 1 1 320px; }
.request-msg { color: var(--ink-2); font-style: italic; }
.request-side { display: grid; gap: 8px; justify-items: end; }
.request-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) { .request-side { justify-items: start; } .request-actions { justify-content: flex-start; } }

.settings-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; max-width: 72ch; }
.settings-list li { padding: 12px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); }
.settings-list p { margin-top: 2px; }
.fact-value { font-weight: 600; }

.fact .link-btn { justify-self: start; color: var(--tunnel-strong); font-weight: 600; margin-top: 2px; }
.facts-note { display: flex; gap: 8px; margin-top: 12px; }
.col-actions .row { flex-wrap: nowrap; justify-content: flex-end; gap: 4px; }
.request-actions select.input { width: auto; min-width: 124px; }
.link-btn.link-danger { color: var(--alert); }

/* ---------------------------------------------------------------- activity */
.act-filters select.input, .act-filters input.input { width: auto; }
.range-inputs { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.range-inputs[hidden], .act-filters [hidden] { display: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips[hidden] { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: var(--fs-small); font-weight: 560; }
.chip-x { border: 0; background: transparent; color: var(--ink-soft); font-size: 1rem; line-height: 1; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; }
.chip-x:hover { background: var(--fog); color: var(--ink); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: baseline; flex: none; }
.act-num { font-size: 1.4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-chart.is-loading { opacity: .6; transition: opacity .2s; }
.act-fig { padding: 14px 16px 12px; }
.act-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.act-plot { position: relative; outline-offset: 4px; cursor: crosshair; touch-action: pan-y; }
.act-plot svg { display: block; width: 100%; height: auto; }
.act-grid { stroke: var(--line-soft); stroke-width: 1; }
.act-base { stroke: var(--line); stroke-width: 1; }
.act-now { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 3 3; }
.act-tick { fill: var(--ink-soft); font-size: 11px; font-variant-numeric: tabular-nums; }
.act-band { fill: var(--ink); opacity: .07; }
.act-blocked-tick { fill: var(--alert); }
.act-tip { position: absolute; top: 4px; z-index: 5; min-width: 200px; max-width: 300px; padding: 10px 12px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: 0 6px 24px rgb(0 0 0 / .14); font-size: var(--fs-small); pointer-events: none; }
.tip-title { font-weight: 640; margin-bottom: 6px; }
.tip-sec { margin-top: 8px; color: var(--ink-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.tip-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.tip-row > span:first-child { display: inline-flex; align-items: center; min-width: 0; }
.tip-strong { font-weight: 640; }
.tip-dom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip-hint { margin-top: 8px; color: var(--ink-soft); font-size: 11px; }
.act-legend { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 10px; }
.legend-item { display: inline-flex; align-items: center; border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: var(--fs-small); padding: 3px 8px; border-radius: var(--radius-s); cursor: pointer; }
.legend-item:hover { background: var(--fog); color: var(--ink); }
.legend-item.is-static { cursor: default; background: transparent; }
.act-fig figcaption { margin-top: 6px; }
.act-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 28px; align-items: start; }
@media (max-width: 1440px) { .act-layout { grid-template-columns: minmax(0, 1fr); } }
.act-table .link-btn { display: inline-flex; align-items: center; text-align: left; }
.act-table tr.is-selected td { background: var(--tunnel-tint); }
.act-dur { min-width: 120px; }
.act-dur > span:first-child { display: block; }
.act-bar-track { display: block; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--line-soft); }
.act-bar { display: block; height: 4px; border-radius: 2px; }
.text-alert { color: var(--alert); }
.act-table td.domain { word-break: break-word; overflow-wrap: anywhere; min-width: 10em; }
.act-sub { margin-left: 16px; }
.act-table td.domain .act-sub { margin-left: 0; }
.wrap-anywhere { overflow-wrap: anywhere; word-break: break-all; font-size: var(--fs-small) !important; letter-spacing: 0 !important; }
