@layer ui-sdk;

/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --bg: #eceef3;
  --panel: #ffffff;
  --soft: #f4f5f8;
  --ink: #15171c;
  --muted: #5f6673;
  --line: #e3e5eb;
  --edge: #8a919e;
  --lav: #d9d3ff;  --lav-ink: #2f2671;
  --mint: #c5f1df; --mint-ink: #0d4b35;
  --peach: #ffd9c2; --peach-ink: #6b2f0b;
  --tile-dark: #17191f; --tile-dark-ink: #f4f5f8;
  --accent: #5b4ce0;
  --ok: #0b7a52; --ok-bg: #d3f5e5;
  --warn: #9a4a07; --warn-bg: #ffe8d1;
  --bad: #b42318; --bad-bg: #fee4e2;
  --info: #3a2fb0; --info-bg: #e7e3ff;
  --shadow: 0 1px 2px rgba(20, 22, 30, .04), 0 8px 24px rgba(20, 22, 30, .06);
  --r-lg: 20px; --r-md: 14px; --r-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --ui-background: var(--panel);
  --ui-foreground: var(--ink);
  --ui-muted: var(--soft);
  --ui-muted-foreground: var(--muted);
  --ui-border: var(--line);
  --ui-input: var(--edge);
  --ui-primary: var(--ink);
  --ui-primary-foreground: var(--panel);
  --ui-ring: var(--accent);
  --ui-ring-border: var(--accent);
  --ui-radius: 12px;
  --ui-font-sans: var(--font);
  --ui-overlay: rgba(15, 17, 22, .35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0e12; --panel: #17191f; --soft: #20232b; --ink: #eef0f4; --muted: #a2a9b6; --line: #2b2f38; --edge: #6b7280;
    --lav: #352d6b; --lav-ink: #e4dfff; --mint: #133f30; --mint-ink: #c7f5e2; --peach: #4a2814; --peach-ink: #ffdcc6;
    --tile-dark: #eef0f4; --tile-dark-ink: #15171c; --accent: #a99dff;
    --ok: #5fd3a3; --ok-bg: #12382a; --warn: #fdb46b; --warn-bg: #43280c; --bad: #ff9c8f; --bad-bg: #4a1610; --info: #c5bdff; --info-bg: #2b2556;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --ui-overlay: rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0e12; --panel: #17191f; --soft: #20232b; --ink: #eef0f4; --muted: #a2a9b6; --line: #2b2f38; --edge: #6b7280;
  --lav: #352d6b; --lav-ink: #e4dfff; --mint: #133f30; --mint-ink: #c7f5e2; --peach: #4a2814; --peach-ink: #ffdcc6;
  --tile-dark: #eef0f4; --tile-dark-ink: #15171c; --accent: #a99dff;
  --ok: #5fd3a3; --ok-bg: #12382a; --warn: #fdb46b; --warn-bg: #43280c; --bad: #ff9c8f; --bad-bg: #4a1610; --info: #c5bdff; --info-bg: #2b2556;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --ui-overlay: rgba(0, 0, 0, .55);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.sm { width: 16px; height: 16px; } .i.lg { width: 26px; height: 26px; } .i.xl { width: 34px; height: 34px; }
.hint { color: var(--muted); font-size: .82rem; }
.err { color: var(--bad); font-size: .85rem; min-height: 1em; }
.grow { flex: 1; min-width: 0; }
.right { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.dark { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.btn.dark:hover { opacity: .9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; color: var(--ink); text-decoration: none; }
.icon-btn:hover { background: var(--soft); }
.link-btn { border: 0; background: none; color: var(--muted); font-size: .85rem; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.link-btn:hover { color: var(--ink); background: var(--soft); }

input:not([type="checkbox"]):not([type="radio"]), textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--soft); color: var(--ink); outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); background: var(--panel); }
input:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.field-stack { display: flex; flex-direction: column; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ---------- app shell (ui-tabs used as the navigation) ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 26px 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; padding: 0 8px; }
.brand-mark { width: 30px; height: 30px; border-radius: 10px; background: conic-gradient(from 210deg, var(--accent), #7fd6b4, #ffb38a, var(--accent)); }
.nav[data-slot="tabs-list"] { flex-direction: column; gap: 4px; border: 0; }
.nav ui-tabs-tab { display: block; }
.nav [data-slot="tabs-tab"] {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 42px; margin: 0; padding: 0 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font-size: .95rem; font-weight: 600; cursor: pointer; text-align: start;
}
.nav [data-slot="tabs-tab"]:hover { background: var(--panel); color: var(--ink); }
.nav [data-slot="tabs-tab"][aria-selected="true"] { background: var(--ink); color: var(--panel); }
.nav .count { margin-inline-start: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--soft); color: var(--ink); font-size: .75rem; text-align: center; }
.nav .count:empty { display: none; }
.nav .count.warn { background: var(--peach); color: var(--peach-ink); }
.nav [aria-selected="true"] .count { background: rgba(255, 255, 255, .18); color: inherit; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.mini-card { background: var(--panel); border-radius: var(--r-md); padding: 12px 14px; font-size: .82rem; box-shadow: var(--shadow); }
.mini-card:empty { display: none; }
.mini-card b { display: block; font-size: .9rem; margin-bottom: 2px; }
.mini-card .row { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.mini-card .row span:last-child { color: var(--ink); font-variant-numeric: tabular-nums; }

.main { min-width: 0; width: 100%; max-width: 1280px; padding: 22px 28px 40px 6px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.eyebrow { color: var(--muted); font-size: .9rem; }
.top h1 { font-size: 1.6rem; letter-spacing: -.02em; line-height: 1.15; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.pill-status { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: .85rem; font-weight: 600; }
.pill-status:empty { display: none; }
.panel[data-slot="tabs-panel"] { outline: none; }
.panel[hidden] { display: none; }

/* ---------- cards ---------- */
.card { background: var(--panel); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h2 { font-size: .98rem; letter-spacing: -.01em; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--edge); display: inline-block; flex: none; }
.dot.on { background: #16b37a; box-shadow: 0 0 0 4px color-mix(in srgb, #16b37a 22%, transparent); }
.dot.off { background: var(--bad); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--soft); font-size: .78rem; font-weight: 600; color: var(--ink); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.pill.authorized { background: var(--ok-bg); color: var(--ok); }
.pill.new { background: var(--info-bg); color: var(--info); }
.pill.exceeded { background: var(--warn-bg); color: var(--warn); }
.pill.blocked { background: var(--bad-bg); color: var(--bad); }
.pill.soft { background: var(--soft); color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* ---------- overview ---------- */
.grid-hero { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.map { display: grid; grid-template-columns: 1fr minmax(30px, 1fr) auto minmax(30px, 1fr) 1fr; align-items: center; padding: 4px 4px 0; }
.node { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; min-width: 0; }
.node b { font-size: .95rem; }
.node-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--soft); color: var(--ink); }
.node-ic.big { width: 76px; height: 76px; border-radius: 22px; background: var(--ink); color: var(--panel); box-shadow: var(--shadow); }
.node.down .node-ic { background: var(--bad-bg); color: var(--bad); }
.link { height: 4px; margin-bottom: 44px; background-image: radial-gradient(circle, #16b37a 1.6px, transparent 2px); background-size: 10px 4px; background-repeat: repeat-x; background-position: 0 center; animation: flow 1.2s linear infinite; }
.link.down { background-image: radial-gradient(circle, var(--bad) 1.6px, transparent 2px); animation: none; opacity: .7; }
.link.idle { background-image: radial-gradient(circle, var(--edge) 1.6px, transparent 2px); animation: none; }
@keyframes flow { to { background-position: 10px center; } }
@keyframes flow-v { to { background-position: center 10px; } }
@media (prefers-reduced-motion: reduce) { .link { animation: none; } }

.traffic { background: var(--tile-dark); color: var(--tile-dark-ink); }
.traffic .hint { color: color-mix(in srgb, var(--tile-dark-ink) 70%, transparent); }
.rates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rates .lbl { display: flex; align-items: center; gap: 6px; font-size: .8rem; opacity: .8; }
.rates b { display: block; font-size: 1.4rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.spark { width: 100%; height: 64px; display: block; }
.spark .down { stroke: #8f84ff; } .spark .up { stroke: #5fd3a3; }
.spark .fill { fill: color-mix(in srgb, #8f84ff 22%, transparent); stroke: none; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.tile { border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-height: 112px; }
.tile-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px; background: rgba(255, 255, 255, .55); margin-bottom: auto; }
.tile p { font-size: .82rem; font-weight: 600; margin-top: 8px; }
.tile b { font-size: 1.55rem; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: .75rem; opacity: .85; }
.tile.lav { background: var(--lav); color: var(--lav-ink); }
.tile.mint { background: var(--mint); color: var(--mint-ink); }
.tile.peach { background: var(--peach); color: var(--peach-ink); }
.tile.ink { background: var(--tile-dark); color: var(--tile-dark-ink); }
.tile.ink .tile-ic { background: rgba(255, 255, 255, .12); }
:root[data-theme="dark"] .tile-ic { background: rgba(255, 255, 255, .1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tile-ic { background: rgba(255, 255, 255, .1); } }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.rows { display: flex; flex-direction: column; gap: 4px; }
.row-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); border: 0; background: none; width: 100%; text-align: start; cursor: pointer; }
.row-item:hover { background: var(--soft); }
.row-item .name { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .meta { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .end { margin-inline-start: auto; text-align: end; font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { color: var(--muted); font-size: .88rem; padding: 18px 8px; text-align: center; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--soft); color: var(--ink); flex: none; position: relative; }
.avatar.lg { width: 44px; height: 44px; border-radius: 14px; }
.avatar.c1 { background: var(--lav); color: var(--lav-ink); } .avatar.c2 { background: var(--mint); color: var(--mint-ink); }
.avatar.c3 { background: var(--peach); color: var(--peach-ink); } .avatar.ap { background: var(--ink); color: var(--panel); }
.avatar .dot { position: absolute; right: -2px; bottom: -2px; border: 2px solid var(--panel); width: 12px; height: 12px; box-shadow: none; }

.meters { display: flex; flex-direction: column; gap: 9px; }
.meter-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: .85rem; }
.meter-row span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.bar > i.hi { background: #f59e0b; } .bar > i.full { background: var(--bad); }

/* ---------- segmented control (ui-sdk) ---------- */
.seg[data-slot="segmented-control"] { border-radius: 999px; padding: 4px; background: var(--soft); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg [data-slot="segmented-control-item"] { height: 30px; padding-inline: 12px; border-radius: 999px; font-weight: 600; color: var(--muted); white-space: nowrap; flex: 0 0 auto; }
.seg [data-slot="segmented-control-item"][data-checked] { color: var(--panel); }
.seg [data-slot="segmented-control-indicator"] { border-radius: 999px; border: 0; background: var(--ink); }
.seg.wide[data-slot="segmented-control"] { display: flex; }
.seg.wide [data-slot="segmented-control-item"] { flex: 1; }
.seg[data-disabled] { opacity: .55; }

/* ---------- devices ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); min-width: 240px; flex: 0 1 320px; color: var(--muted); }
.search input { border: 0 !important; background: none !important; padding: 0 !important; color: var(--ink); }
.dev-list { display: flex; flex-direction: column; gap: 6px; }
.dev-row {
  display: grid; grid-template-columns: auto minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1.6fr) 20px; align-items: center; gap: 16px;
  padding: 9px 14px; border-radius: var(--r-md); background: var(--panel); border: 0; width: 100%; text-align: start; cursor: pointer; box-shadow: var(--shadow);
}
.dev-row:hover { outline: 1px solid var(--line); }
.dev-row .name { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-row .meta { display: block; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-row .grow br, .row-item .grow br { display: none; }
.row-item .name, .row-item .meta { display: block; }
.dev-row .speed { font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dev-row .use { display: grid; gap: 5px; font-size: .8rem; color: var(--muted); }
.dev-row .use b { color: var(--ink); }
.dev-row > .i { color: var(--muted); }

/* ---------- access points ---------- */
.ap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.ap-card { position: relative; }
.ap-card.down { outline: 2px solid var(--bad-bg); }
.ap-card.sug { outline: 2px dashed var(--line); }
.ap-hero { display: flex; align-items: center; gap: 14px; }
.ap-hero h3 { font-size: 1.05rem; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats-row div { background: var(--soft); border-radius: var(--r-sm); padding: 8px 10px; }
.stats-row span { display: block; font-size: .72rem; color: var(--muted); }
.stats-row b { font-variant-numeric: tabular-nums; font-size: .95rem; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- settings ---------- */
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.settings .save-bar { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.banner { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; border-radius: var(--r-md); background: var(--info-bg); color: var(--info); margin-bottom: 18px; font-size: .9rem; }
.banner[hidden] { display: none; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch-row > span { display: flex; flex-direction: column; gap: 2px; }
[data-slot="switch"] { width: 48px; height: 28px; padding: 3px; border-radius: 999px; }
[data-slot="switch-thumb"] { width: 22px; height: 22px; }
[data-slot="switch"][data-checked] { background: var(--ok); border-color: var(--ok); }
:root[data-theme="dark"] [data-slot="switch"][data-checked] [data-slot="switch-thumb"] { background: #0d0e12; }

/* ---------- drawers (ui-sdk) ---------- */
.side-drawer [data-slot="drawer-content"] { padding: 0; gap: 0; border: 0; background: var(--bg); overflow: hidden; }
.side-drawer [data-slot="drawer-content"]:is([data-side="right"], [data-side="left"]) { width: min(460px, 100vw); max-height: none; height: 100dvh; }
.side-drawer [data-slot="drawer-content"][data-side="right"] { border-radius: var(--r-lg) 0 0 var(--r-lg); }
.side-drawer [data-slot="drawer-content"][data-side="bottom"] { width: 100%; max-height: 92dvh; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: var(--panel); }
.drawer-head [data-slot="drawer-title"] { font-size: 1.2rem; font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { overflow-y: auto; padding: 14px 18px 32px; display: flex; flex-direction: column; gap: 12px; }
.drawer-body > * { flex-shrink: 0; }
.usage-card { background: var(--tile-dark); color: var(--tile-dark-ink); border-radius: var(--r-md); padding: 16px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.usage-card .big { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.usage-card span { font-size: .78rem; opacity: .8; }
.usage-card .bar { grid-column: 1 / -1; background: rgba(255, 255, 255, .15); }
:root[data-theme="dark"] .usage-card .bar { background: rgba(0, 0, 0, .12); }
.list-group { background: var(--panel); border-radius: var(--r-md); overflow: hidden; }
.list-group:empty { display: none; }
.list-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; text-align: start; font-weight: 600; color: var(--ink); text-decoration: none; }
.list-btn:last-child { border-bottom: 0; }
.list-btn:hover { background: var(--soft); }
.list-btn .end { margin-inline-start: auto; color: var(--muted); }
.list-btn.danger { color: var(--bad); }
.form-card { background: var(--panel); border-radius: var(--r-md); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.form-card h3 { font-size: .95rem; }
.limit { display: flex; flex-direction: column; gap: 8px; }
.limit .seg[data-slot="segmented-control"], .form-card .field > .seg[data-slot="segmented-control"] { display: flex; }
.form-card .field > .seg [data-slot="segmented-control-item"] { flex: 1; }
.limit .seg [data-slot="segmented-control-item"] { flex: 1; height: 32px; }
.unit-input { display: flex; align-items: center; gap: 8px; }
.unit-input input { flex: 1; }
.unit-input span { color: var(--muted); font-size: .85rem; min-width: 38px; }
.unit-input[hidden] { display: none; }
.info-sect { background: var(--panel); border-radius: var(--r-md); padding: 14px 18px; }
.info-sect h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: .86rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82em; }
.events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.events li { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .82rem; }
.events li:last-child { border-bottom: 0; }
.events time { color: var(--muted); }
.wifi-radio { background: var(--panel); border-radius: var(--r-md); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.wifi-net { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; background: var(--ink); color: var(--panel); padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem; z-index: 100; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--bad); color: #fff; }

/* ---------- ui-sdk alert dialog (confirm) ---------- */
[data-slot="alert-dialog-content"] { border-radius: var(--r-lg); padding: 24px; border: 0; }
[data-slot="alert-dialog-content"] button { border-radius: 999px; height: 40px; padding: 0 18px; font-weight: 600; }
[data-slot="alert-dialog-content"] button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
[data-slot="alert-dialog-content"] [data-slot="alert-dialog-title"] { font-size: 1.1rem; font-weight: 700; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .dev-row { grid-template-columns: auto minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.4fr) 20px; }
  .dev-row .speed { display: none; }
}
@media (max-width: 900px) {
  .app { display: block; }
  .side { position: fixed; inset: auto 0 0 0; top: auto; height: auto; z-index: 20; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--panel); box-shadow: 0 -4px 20px rgba(0, 0, 0, .08); gap: 0; }
  .brand, .side-foot { display: none; }
  .nav[data-slot="tabs-list"] { flex-direction: row; justify-content: space-around; }
  /* bottom bar: icons only, the active tab shows its label */
  .nav [data-slot="tabs-tab"] { flex-direction: row; gap: 6px; height: 46px; width: auto; min-width: 46px; padding: 0 12px; border-radius: 999px; font-size: .8rem; position: relative; justify-content: center; }
  .nav [data-slot="tabs-tab"] span { display: none; white-space: nowrap; }
  .nav [data-slot="tabs-tab"][aria-selected="true"] span { display: inline; }
  .nav .count { position: absolute; top: 2px; right: 2px; margin: 0; }
  .nav [data-slot="tabs-tab"][aria-selected="true"] .count { display: none; }
  .main { padding: 18px 16px 100px; }
  .top h1 { font-size: 1.5rem; }
  .pill-status { display: none; }
  .grid-hero, .grid-3, .settings { grid-template-columns: 1fr; }
  .tiles { gap: 12px; }
  .tile { min-height: 128px; padding: 16px; }
  .tile b { font-size: 1.6rem; }
  .map { display: flex; flex-direction: column; align-items: stretch; padding: 4px 0 0; }
  .node { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; row-gap: 4px; align-items: center; text-align: start; }
  .node .node-ic { grid-row: 1 / 3; }
  .node b { align-self: end; }
  .node > .chip, .node > .chips { justify-self: start; justify-content: flex-start; align-self: start; white-space: normal; }
  .node-ic, .node-ic.big { width: 56px; height: 56px; border-radius: 18px; }
  .node-ic.big .i { width: 26px; height: 26px; }
  .link { width: 4px; height: 26px; margin: 4px 0 4px 26px; background-image: radial-gradient(circle, #16b37a 1.6px, transparent 2px); background-size: 4px 10px; background-repeat: repeat-y; animation: flow-v 1.2s linear infinite; }
  .link.down { background-image: radial-gradient(circle, var(--bad) 1.6px, transparent 2px); }
  .link.idle { background-image: radial-gradient(circle, var(--edge) 1.6px, transparent 2px); }
  .dev-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; }
  .dev-row .use, .dev-row .speed, .dev-row > .i { display: none; }
  .two, .three { grid-template-columns: 1fr; }
  .search { flex: 1 1 100%; min-width: 0; }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
}

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 400px; gap: 22px; padding: 30px 28px; }
.login .brand { padding: 0; }
.login h1 { font-size: 1.6rem; letter-spacing: -.02em; }
.login .btn { height: 46px; margin-top: 4px; }
.meter-row.top-procs span:last-child { font-size: .8rem; color: var(--muted); text-align: end; }

/* routers in the way (DHCP on / plugged in by the internet port) */
.issues { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.issue { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-md); background: var(--warn-bg); color: var(--ink); }
.issue b { color: var(--warn); }
.issue .meta { font-size: .8rem; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.issue .hint { font-size: .82rem; margin-top: 4px; }
.issue .avatar { background: var(--panel); color: var(--warn); }
.issue .btn { flex: none; }
@media (max-width: 900px) { .issue { flex-wrap: wrap; } .issue .btn { width: 100%; } }
.pill.router { background: var(--warn-bg); color: var(--warn); }
