/* Poltergate cabinet design system — "séance".
   A midnight console on the left, a quiet neutral desk on the right. One flat jade green (no gradients, shine or glow —
   the owner's call) marks focus and the current place; main buttons are black (white in the dark theme); amber means
   asleep, coral trouble. The sidebar stays dark in both themes; light follows the system by default, the dark theme
   is graphite night.
   Icons are duotone: a line drawing over a soft tinted fill (class "d"). */
:root {
  --bg: #f4f5f7;
  --bg-2: #eceef2;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --panel-3: #eff1f5;
  --line: rgba(16, 22, 38, .08);
  --line-2: rgba(16, 22, 38, .14);
  --text: #0f121a;
  --muted: #5a6172;
  --faint: #959bab;
  --accent: #0b9466;
  --accent-2: #067551;
  --accent-soft: rgba(11, 148, 102, .1);
  --accent-glow: rgba(11, 148, 102, .3);
  --primary: #121419;
  --primary-hover: #2a2e38;
  --on-primary: #ffffff;
  --ok: #0f9d58;
  --ok-soft: rgba(15, 157, 88, .1);
  --warn: #c07806;
  --warn-soft: rgba(214, 140, 16, .13);
  --bad: #df463e;
  --bad-soft: rgba(224, 72, 64, .1);
  --info: #2a78d6;
  --info-soft: rgba(42, 120, 214, .1);
  --field: #ffffff;
  --screen: radial-gradient(120% 70% at 50% 0%, #20223a 0%, #08090e 72%);
  --shadow: 0 1px 2px rgba(16, 22, 38, .05), 0 6px 18px -10px rgba(16, 22, 38, .14);
  --shadow-lg: 0 30px 80px -24px rgba(16, 22, 38, .4);
  /* the sidebar: the same midnight in both themes */
  --sb-bg: #0d0f15;
  --sb-line: rgba(255, 255, 255, .07);
  --sb-text: #eef0f6;
  --sb-muted: #9097a9;
  --sb-faint: #5d6377;
  --sb-hover: rgba(255, 255, 255, .05);
  --sb-active: rgba(255, 255, 255, .085);
  --sb-accent: #34c98f;
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar: 248px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f1116;
  --bg-2: #13151b;
  --panel: #171a21;
  --panel-2: #1c1f27;
  --panel-3: #232731;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --text: #eceef3;
  --muted: #979dac;
  --faint: #626879;
  --accent: #2fd39b;
  --accent-2: #74e8bd;
  --accent-soft: rgba(47, 211, 155, .12);
  --accent-glow: rgba(47, 211, 155, .32);
  --primary: #f1f2f5;
  --primary-hover: #ffffff;
  --on-primary: #0f1116;
  --ok: #36d17f;
  --ok-soft: rgba(54, 209, 127, .12);
  --warn: #f0b13e;
  --warn-soft: rgba(240, 177, 62, .13);
  --bad: #ff7b72;
  --bad-soft: rgba(255, 123, 114, .12);
  --info: #5ea8f5;
  --info-soft: rgba(94, 168, 245, .12);
  --field: #13151b;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 28px -14px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .75);
  --sb-bg: #07080b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; }
::selection { background: var(--accent-glow); }
input[type="range"], input[type="checkbox"] { accent-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
svg.i .d { fill: currentColor; fill-opacity: .2; stroke: none; }
svg.i .s { fill: currentColor; stroke: none; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }

/* ---------- shell: sidebar + content ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 2px;
  padding: 18px 12px 14px;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-line);
  color: var(--sb-text);
  color-scheme: dark;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 16px; font-weight: 650; font-size: 15.5px; letter-spacing: -.01em; }
.brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .1); }
.brand small { display: block; font-weight: 500; font-size: 11.5px; color: var(--faint); letter-spacing: 0; }
.sidebar .brand { border-bottom: 1px solid var(--sb-line); margin: 0 -12px 6px; padding: 2px 20px 18px; }
.sidebar .brand small { color: var(--sb-faint); }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; color: var(--sb-faint); padding: 16px 10px 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  height: 36px; padding: 0 10px; border-radius: 8px;
  color: var(--sb-muted); font-weight: 500; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav a svg { width: 17px; height: 17px; }
.nav a:hover { background: var(--sb-hover); color: var(--sb-text); }
.nav a.active { background: var(--sb-active); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04); }
.nav a.active svg { color: var(--sb-accent); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--sb-accent); }
.nav a .count { margin-left: auto; min-width: 22px; height: 19px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--sb-muted); background: rgba(255, 255, 255, .06); font-variant-numeric: tabular-nums; }
.nav a .count:empty { display: none; }
.nav a.active .count { color: var(--sb-text); background: rgba(255, 255, 255, .1); }
.sidebar .spacer { flex: 1; }
.me {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  background: rgba(255, 255, 255, .035); border: 1px solid var(--sb-line);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: #0b9466;
  color: #fff; font-weight: 650; font-size: 13px; text-transform: uppercase;
}
.me .who { flex: 1; min-width: 0; line-height: 1.25; }
.me .who b { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who span { font-size: 11.5px; color: var(--sb-faint); }
.sidebar .btn.ghost { color: var(--sb-muted); }
.sidebar .btn.ghost:hover { background: var(--sb-hover); color: var(--sb-text); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  min-height: 68px; padding: 12px 32px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
:root[data-theme="dark"] .topbar { background: color-mix(in srgb, var(--bg) 82%, transparent); }
.topbar h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; font-family: var(--display); font-size: 19px; font-weight: 680; letter-spacing: -.02em; line-height: 1.25; }
.topbar .sub { color: var(--muted); font-size: 12.5px; }
.topbar .menu-btn { display: none; }
.content { padding: 28px 32px 48px; max-width: 1600px; width: 100%; }

/* ---------- buttons, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--text);
  font-weight: 550; font-size: 13.5px; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn:hover { background: var(--panel-2); border-color: color-mix(in srgb, var(--text) 22%, transparent); }
.btn:not(.ghost):not(.primary) { box-shadow: 0 1px 2px rgba(16, 22, 38, .05); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--primary); border-color: transparent; color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.primary svg .d { fill-opacity: .35; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: transparent; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.sm.icon { width: 30px; padding: 0; }
.btn.block { width: 100%; }
.btn.busy { pointer-events: none; opacity: .7; }
.btn.busy svg { animation: spin 1s linear infinite; }

.input, .select {
  height: 38px; width: 100%; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--field); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 36px; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-weight: 550; }
.switch input { appearance: none; width: 36px; height: 21px; border-radius: 21px; background: var(--panel-3); border: 1px solid var(--line-2); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked { background: var(--accent); border-color: transparent; }
.switch input:checked::after { transform: translateX(15px); }

.check { appearance: none; width: 18px; height: 18px; margin: 0; border-radius: 6px; border: 1.5px solid var(--line-2); background: var(--bg-2); cursor: pointer; display: grid; place-items: center; transition: background .15s, border-color .15s; }
.check:checked { background: var(--accent); border-color: var(--accent); }
.check:checked::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 550; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(16, 22, 38, .1), 0 0 0 1px var(--line); }
:root[data-theme="dark"] .seg button.on { background: var(--panel-3); }
.seg button .n { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
:root:not([data-theme="dark"]) .card { border-color: rgba(16, 22, 38, .07); }
.card-pad { padding: 18px 20px; }
.card h3 { margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.card .card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.card .card-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { position: relative; padding: 18px 20px 16px; }
.kpi.clickable { cursor: pointer; transition: border-color .15s, transform .15s; }
.kpi.clickable:hover { border-color: var(--line-2); transform: translateY(-1px); }
.kpi .kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 550; font-size: 13px; }
.kpi .kpi-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.kpi .kpi-ico svg { width: 20px; height: 20px; }
.kpi .kpi-num { font-family: var(--display); font-size: 32px; font-weight: 700; letter-spacing: -.035em; margin-top: 8px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .kpi-num small { font-size: 15px; color: var(--faint); font-weight: 600; letter-spacing: 0; margin-left: 4px; }
.kpi .kpi-foot { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.kpi .bar { height: 4px; margin-top: 14px; border-radius: 4px; overflow: hidden; background: var(--panel-3); }
.kpi .bar i { display: block; height: 100%; border-radius: 4px; transition: width .6s cubic-bezier(.2, .8, .2, 1); background: var(--tone); }
.tone-accent { --tone: var(--accent); --tone-soft: var(--accent-soft); }
.tone-ok { --tone: var(--ok); --tone-soft: var(--ok-soft); }
.tone-warn { --tone: var(--warn); --tone-soft: var(--warn-soft); }
.tone-bad { --tone: var(--bad); --tone-soft: var(--bad-soft); }
.tone-info { --tone: var(--info); --tone-soft: var(--info-soft); }
.kpi .kpi-ico { background: var(--tone-soft); color: var(--tone); }
/* nothing needs attention: the card stays calm instead of amber */
.kpi.tone-warn:not(.hot) { --tone: var(--faint); --tone-soft: var(--panel-3); }

/* ---------- status pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: 24px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--tone-soft, var(--panel-3)); color: var(--tone, var(--muted));
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.live .dot { animation: pulse 1.8s ease-out infinite; }
.pill.plain { background: var(--panel-3); color: var(--muted); }
.pill.tone-ok, .pill.tone-warn, .pill.tone-bad, .pill.tone-info { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 18%, transparent); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes spin { to { transform: rotate(360deg); } }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 7px; background: var(--panel-3); color: var(--muted); font-family: var(--mono); font-size: 12px; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .input-icon { width: 300px; max-width: 100%; }

/* ---------- phone grid ---------- */
.phones { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 18px; }
.phone-card { display: flex; flex-direction: column; padding: 14px; gap: 14px; transition: transform .18s, border-color .18s, box-shadow .18s; cursor: pointer; }
.phone-card:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow), 0 22px 44px -24px rgba(16, 22, 38, .4); }
.phone-card .pc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.phone-card .pc-name { font-weight: 650; font-size: 14.5px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-card .pc-meta { color: var(--faint); font-size: 12px; margin-top: 2px; }
.phone-card .pc-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.phone-card .pc-status { display: flex; flex-direction: column; gap: 6px; }
.phone-card .pc-hint { color: var(--muted); font-size: 12.5px; }
.phone-card .pc-go { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--faint); background: var(--panel-2); transition: background .15s, color .15s; }
.phone-card:hover .pc-go { background: var(--accent); color: #fff; }
.phone-card .device { position: relative; }
.pc-open {
  position: absolute; left: 50%; bottom: 9%; z-index: 2; transform: translate(-50%, 6px);
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 20px; white-space: nowrap;
  background: rgba(10, 12, 16, .78); color: #fff; font-size: 12px; font-weight: 600;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .18s, transform .18s; pointer-events: none;
}
.pc-open svg { color: #34c98f; }
.phone-card:hover .pc-open { opacity: 1; transform: translate(-50%, 0); }
.fact { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.fact svg { color: var(--faint); }
.fact.warn, .fact.warn svg { color: var(--warn); }
.fact.bad, .fact.bad svg { color: var(--bad); }
.phone-card .device { width: 74%; }
.phone-card .pc-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); padding-top: 11px; }
.ping { margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--line-2); color: var(--muted); font-variant-numeric: tabular-nums; }
.ping.slow { color: var(--warn); }

/* phone frame */
.device {
  position: relative; margin: 0 auto;
  aspect-ratio: 414 / 896; width: 100%;
  border-radius: 13% / 6%;
  padding: 3.2%;
  background: linear-gradient(145deg, #2d2f36, #0f1014 60%, #25272e);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .08), 0 18px 40px -18px rgba(0, 0, 0, .8);
}
:root:not([data-theme="dark"]) .device { background: linear-gradient(145deg, #3b3e47, #15161b 60%, #30333b); }
.device .glass { position: relative; width: 100%; height: 100%; border-radius: 10.5% / 4.9%; overflow: hidden; background: #000; }
.device .glass img, .device .glass canvas { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.device .glass.video img { display: none; }
.device .state {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 18px; text-align: center;
  color: #a8acbd; font-size: 12.5px;
  background: var(--screen);
}
.device .state svg { width: 28px; height: 28px; color: #34c98f; }
.device .state b { color: #f0f1f7; font-size: 14px; font-weight: 600; }
.device.compact .state b { font-size: 12.5px; }
.device.compact .state p { display: none; }

/* loading skeleton */
.skeleton { background: linear-gradient(90deg, var(--panel-2) 0%, var(--panel-3) 50%, var(--panel-2) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
.sk-line { height: 18px; width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* empty state */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 70px 20px; color: var(--muted); }
.empty .empty-ico { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); margin-bottom: 6px; }
.empty .empty-ghost { width: 120px; margin-bottom: 4px; animation: float 6s ease-in-out infinite; }
.empty .empty-ico svg { width: 30px; height: 30px; }
.empty h3 { margin: 0; color: var(--text); font-size: 17px; }
.empty p { margin: 0; max-width: 420px; }

/* ---------- phone page ---------- */
.dev-layout { display: grid; grid-template-columns: minmax(300px, auto) minmax(360px, 460px); gap: 28px; justify-content: center; align-items: start; }
.dev-layout.solo { grid-template-columns: auto; }
.stage { display: flex; flex-direction: column; align-items: center; gap: 16px; position: sticky; top: 84px; }
/* As tall as the window allows (top bar 68 + the page's padding): the phone is the point of this page */
.stage .device { width: auto; height: calc(100vh - 124px); height: calc(100svh - 124px); max-height: 1120px; min-height: 520px; }
.topbar .head-pills { margin-top: 5px; gap: 6px; flex-wrap: wrap; }
.topbar .head-pills .pill { font-size: 11.5px; }
.stage .glass img, .stage .glass canvas { cursor: crosshair; }
.stage .glass.kbd { box-shadow: 0 0 0 3px var(--accent) inset; }
.ripple { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 2px solid #fff; background: rgba(52, 201, 143, .38); pointer-events: none; animation: ripple .55s ease-out forwards; }
@keyframes ripple { from { transform: scale(.35); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.trail { position: absolute; inset: 0; pointer-events: none; width: 100%; height: 100%; }
.trail line { stroke: #fff; stroke-width: 3; stroke-linecap: round; opacity: .8; filter: drop-shadow(0 0 6px var(--accent)); }

.tabs { display: flex; gap: 2px; padding: 4px; margin: 14px 14px 0; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.tabs button { flex: 1; min-width: 0; white-space: nowrap; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(16, 22, 38, .1), 0 0 0 1px var(--line); }
:root[data-theme="dark"] .tabs button.on { background: var(--panel-3); }
.tab { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 18px; }
.section-title { display: flex; align-items: center; gap: 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 650; margin-bottom: -6px; }
/* the control panel: what the mouse does, then buttons that say what they do */
.gestures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.gesture { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); line-height: 1.25; }
.gesture .g-ico { width: 28px; height: 28px; flex: none; display: grid; place-items: center; color: var(--text); }
.gesture .g-ico svg { width: 20px; height: 20px; }
.gesture b { display: block; font-size: 12.5px; font-weight: 650; }
.gesture span { font-size: 12px; color: var(--muted); }
.acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.act {
  display: flex; align-items: center; gap: 9px; min-width: 0;
  padding: 9px 10px; border-radius: 11px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--text); text-align: left; cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 22, 38, .05);
  transition: background .15s, border-color .15s, transform .08s;
}
.act:hover { background: var(--panel-2); border-color: color-mix(in srgb, var(--text) 25%, transparent); }
.act:active { transform: translateY(1px); }
.act-ico { width: 32px; height: 32px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--panel-3); color: var(--text); }
.act-ico svg { width: 19px; height: 19px; }
.act-ico svg .d { fill-opacity: .14; }
.act-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.act-text b { font-size: 12.5px; font-weight: 650; }
.act-text small { font-size: 11.5px; color: var(--muted); }
.arrows { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 11px; background: var(--panel-2); }
.arrows > span { display: flex; flex-direction: column; line-height: 1.25; }
.arrows b { font-size: 12.5px; font-weight: 650; }
.arrows small { font-size: 11.5px; color: var(--muted); }
.arrows .row { gap: 4px; flex-wrap: nowrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv dt[data-tip] { cursor: help; text-decoration: underline dotted var(--line-2); text-underline-offset: 3px; width: fit-content; }
.kv dd.tone-ok, .kv dd.tone-warn, .kv dd.tone-bad { color: var(--tone); font-weight: 600; }
.hint { color: var(--faint); font-size: 12.5px; }
.kbd-key { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--panel-2); }

.list { display: flex; flex-direction: column; }
.list .li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list .li:first-child { border-top: 0; }
.li-ico { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--tone-soft, var(--panel-3)); color: var(--tone, var(--muted)); }
.li-ico svg { width: 16px; height: 16px; }
.li .li-main { flex: 1; min-width: 0; }
.li .li-main b { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .li-main > span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.li time { color: var(--faint); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.code-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--bg-2); border: 1px dashed var(--line-2); font-family: var(--mono); font-size: 19px; letter-spacing: .06em; font-weight: 600; }
.steps { counter-reset: s; display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; color: var(--muted); }
.steps li::before { content: counter(s); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); font-weight: 700; font-size: 12px; }
.steps li b { color: var(--text); font-weight: 600; }
.qr { width: 168px; height: 168px; padding: 10px; border-radius: 14px; background: #fff; flex: none; }
.qr svg { width: 100%; height: 100%; display: block; }

/* ---------- multiview ---------- */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile, 200px), 1fr)); gap: 16px; }
.tile { padding: 10px; display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, box-shadow .15s; }
.tile.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tile .glass img, .tile .glass canvas { cursor: crosshair; }
.tile .t-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.tile .t-head .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .t-foot { display: flex; justify-content: center; }
.sync-on .tile.sel .device { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- activity log ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); font-weight: 650; padding: 11px 20px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.table thead tr:first-child th:first-child { border-top-left-radius: var(--radius); }
.table thead tr:first-child th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 12px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--panel-2); }
.table td.when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; width: 150px; }
.table td.text { color: var(--muted); max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- settings ---------- */
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.settings .wide { grid-column: 1 / -1; }
.settings .tall { grid-row: span 2; }
.token-once { display: flex; gap: 8px; align-items: center; padding: 12px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); }
.token-once code { flex: 1; font-family: var(--mono); font-size: 12.5px; word-break: break-all; color: var(--text); }

/* ---------- help: (?) marks, tooltips, first-visit intro ---------- */
.help { display: inline-grid; place-items: center; color: var(--faint); cursor: help; border-radius: 50%; text-transform: none; letter-spacing: 0; }
.help:hover, .help:focus-visible { color: var(--accent); }
.help svg { width: 15px; height: 15px; }
.tooltip {
  position: fixed; z-index: 200; left: 0; top: 0; max-width: 280px;
  padding: 8px 11px; border-radius: 9px;
  background: #12141a; color: #eef0f5; border: 1px solid rgba(255, 255, 255, .08);
  font-size: 12.5px; line-height: 1.45; font-weight: 500; text-transform: none; letter-spacing: 0;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .45);
  opacity: 0; transform: translateY(3px); transition: opacity .12s, transform .12s; pointer-events: none;
}
.tooltip.on { opacity: 1; transform: none; }
[data-tip] { cursor: help; }
button[data-tip], a[data-tip], label[data-tip], input[data-tip] { cursor: pointer; }

.intro { margin-bottom: 20px; padding: 16px 20px; }
.intro-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.intro-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 680; letter-spacing: -.01em; }
.intro-head h2 svg { color: var(--accent); }
.intro-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.istep { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.istep-ico { position: relative; width: 38px; height: 38px; flex: none; border-radius: 11px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.istep-ico svg { width: 20px; height: 20px; }
.istep-ico i { position: absolute; top: -6px; left: -6px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--on-primary); background: var(--primary); box-shadow: 0 0 0 2px var(--panel-2); }
.istep b { display: block; font-size: 13.5px; font-weight: 650; margin-bottom: 2px; }
.istep p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.intro-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.intro-legend > b { color: var(--text); font-weight: 600; }
.intro-legend span.lg { display: inline-flex; align-items: center; gap: 7px; }
.intro-legend .pill { height: 22px; padding: 0 8px; font-size: 11.5px; }
.how { display: flex; align-items: flex-start; gap: 9px; margin: -6px 0 18px; padding: 11px 14px; border-radius: 11px; font-size: 13px; color: var(--muted); background: var(--accent-soft); }
.how svg { color: var(--accent); margin-top: 2px; }
.how b { color: var(--text); }

/* settings and API cards: icon + title + what it is for */
.head-row { align-items: flex-start; flex-wrap: nowrap; gap: 12px; }
.head-ico { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.head-ico svg { width: 19px; height: 19px; }
.card h3 { display: flex; align-items: center; gap: 6px; }
.input-eye { position: relative; }
.input-eye .input { padding-right: 40px; }
.input-eye .eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.empty-line { display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-radius: 10px; border: 1px dashed var(--line-2); color: var(--muted); font-size: 13px; }
.empty-line svg { color: var(--faint); }
.alert.warn-line { background: var(--warn-soft); color: var(--warn); }
.alert.warn-line b, .alert.warn-line span { color: var(--text); }
.alert.warn-line b { font-weight: 650; }
.code.wrap { white-space: pre-wrap; word-break: break-all; padding-right: 16px; }

/* API quick start */
.qstep { display: flex; gap: 12px; align-items: flex-start; }
.qstep > i { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); }
.qstep > .stack { gap: 6px; flex: 1; min-width: 0; }
.qstep b { font-weight: 650; font-size: 13.5px; line-height: 24px; }
.qstep p { margin: 0; }
.coord-row { align-items: center; flex-wrap: nowrap; gap: 14px; }
.coords { position: relative; flex: none; width: 74px; height: 140px; border-radius: 14px; border: 2px solid var(--line-2); background: var(--panel-2); font-family: var(--mono); font-size: 9.5px; color: var(--muted); }
.coords span { position: absolute; white-space: nowrap; }
.coords .c-tl { left: 5px; top: 5px; }
.coords .c-br { right: 5px; bottom: 5px; }
.coords .c-mid { left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--accent); font-weight: 600; }
.coords .c-mid em { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.api-hint { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

/* ---------- toasts, dialogs ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 420px; padding: 12px 14px;
  border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg); font-weight: 500;
  animation: toast-in .25s cubic-bezier(.2, .8, .2, 1);
}
.toast .li-ico { width: 28px; height: 28px; }
.toast.out { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { transform: translateY(10px) scale(.98); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(6px); opacity: 0; } }

.overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(5, 5, 10, .6); backdrop-filter: blur(6px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .25s cubic-bezier(.2, .8, .2, 1); }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.modal .m-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 0; }
.modal .m-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.modal .m-body { padding: 16px 22px 8px; display: flex; flex-direction: column; gap: 16px; }
.modal .m-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; }

/* ---------- sign in ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 40px;
  padding: 44px;
  background: #0d0f15;
  color: #eef0f6;
}
.auth-art .brand { padding: 0; font-size: 18px; }
.auth-art h2 { font-family: var(--display); font-size: 44px; line-height: 1.06; letter-spacing: -.04em; margin: 0 0 16px; font-weight: 700; max-width: 520px; }
.auth-art h2 em { font-style: normal; color: #34c98f; }
.auth-art p { color: #9a9fb2; max-width: 460px; margin: 0; font-size: 15px; }
.auth-art .feats { display: flex; gap: 22px; flex-wrap: wrap; color: #c4c7d6; font-size: 13px; }
.auth-art .feats span { display: inline-flex; align-items: center; gap: 8px; }
.auth-art .feats svg { color: #34c98f; }
.auth-art > div { position: relative; z-index: 1; }
.auth-art .pitch { margin-top: auto; }
.ghost-float { position: absolute; left: 0; right: 0; margin: 0 auto; top: 13%; width: clamp(170px, 19vw, 290px); animation: float 6s ease-in-out infinite; filter: drop-shadow(0 40px 60px rgba(0, 0, 0, .45)); }
@keyframes float { 50% { transform: translateY(-14px) rotate(-2deg); } }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-form form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.auth-form h1 { margin: 0; font-family: var(--display); font-size: 30px; letter-spacing: -.03em; }
.auth-form .lead { margin: -8px 0 6px; color: var(--muted); }
/* on narrow screens the dark panel is hidden: the app icon and name sit above the form instead (owner's pick of 3) */
.auth-hero { display: none; flex-direction: column; align-items: center; text-align: center; width: 100%; padding: 64px 24px 0; margin-bottom: 30px; }
.hero-icon { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 0 0 1px var(--line-2), 0 18px 40px -16px rgba(16, 22, 38, .45); }
.hero-name { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; margin-top: 14px; }
.hero-tag { margin-top: 4px; font-size: 13.5px; color: var(--muted); }
.hero-tag span { display: inline-block; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 11px; font-size: 13px; background: var(--bad-soft); color: var(--bad); }
.alert.info { background: var(--info-soft); color: var(--info); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* guest via share link */
.guest .app { grid-template-columns: 1fr; }
.guest .sidebar { display: none; }
.guest .topbar .menu-btn { display: none !important; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .settings .tall { grid-row: auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dev-layout { grid-template-columns: minmax(0, 1fr); }
  .stage { position: static; }
  /* the whole phone screen fits the window, with room beside it to scroll the page by finger */
  .stage .device { width: auto; max-width: 100%; min-height: 0; height: min(1120px, calc(100vh - 124px), calc((100vw - 32px) * 2.1)); height: min(1120px, calc(100svh - 124px), calc((100vw - 32px) * 2.1)); }
  .settings { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .45); }
  .topbar { padding: 14px 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { gap: 8px; }
  /* on a phone: the same picture as before, with room beside it to scroll the page by finger; one row of pills */
  .stage .device { height: min(860px, calc(100svh - 170px), calc((100vw - 32px) * 2.1)); }
  .topbar .head-pills { flex-wrap: nowrap; overflow: hidden; }
  .topbar .head-pills > :nth-child(n+3) { display: none; }
  .topbar .sub, .hide-sm { display: none !important; }
  .topbar .lbl { display: none; }
  .topbar .row .btn { width: 36px; padding: 0; }
  .content { padding: 18px 16px 40px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-hero { display: flex; }
  .auth-form { display: flex; flex-direction: column; align-items: center; padding: 0 0 40px; }
  .auth-form form { padding: 0 24px; max-width: 408px; }
  .table td.text { max-width: 200px; }
  .phones { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .pc-open { display: none; }
  .intro-steps { grid-template-columns: 1fr; gap: 8px; }
  .phone-card .pc-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .kpi-num { font-size: 26px; }
  .toolbar .input-icon { width: 100%; }
  .toolbar > div:has(> .select) { flex: 1; }
  .table .opt { display: none; }
  .table td .row { flex-wrap: nowrap; }
  .li .li-main > span { white-space: normal; }
  .table td, .table th { padding-left: 14px; padding-right: 14px; }
  .kpi .kpi-top { align-items: flex-start; gap: 6px; font-size: 12.5px; }
  .kpi .kpi-top .row { flex-wrap: nowrap; gap: 5px; line-height: 1.3; }
  .kpi .kpi-ico { width: 30px; height: 30px; border-radius: 9px; }
  .kpi .kpi-ico svg { width: 17px; height: 17px; }
  .intro { padding: 14px; }
  .istep { padding: 10px 12px; }
  .tabs { margin: 12px 12px 0; }
  .tabs button svg { display: none; }
  .tab { padding: 16px 14px 18px; }
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 8px; gap: 8px; }
  .tile .t-head { align-items: flex-start; font-size: 12.5px; line-height: 1.3; }
  .tile .t-head .grow { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
  .tile-size { display: none !important; }
  .send-row { flex: 1 1 100%; flex-wrap: nowrap; }
  .pair { flex-direction: column; align-items: stretch; }
  .pair .qr { align-self: center; }
  .modal .m-head { padding: 18px 18px 0; }
  .modal .m-body { padding: 14px 18px 8px; }
  .modal .m-foot { padding: 12px 18px 18px; flex-wrap: wrap; }
  .overlay { padding: 12px; }
  .modal { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
}
@media (max-width: 360px) {
  .acts, .gestures { gap: 6px; }
  .act, .gesture { padding: 8px; gap: 7px; }
  .act-ico { width: 28px; height: 28px; }
  .gesture .g-ico { width: 22px; }
  .kpi { padding: 12px; }
  .kpi .kpi-ico { display: none; }
}
/* fingers: no zoom-in when a field is tapped (iOS zooms into text under 16px), buttons big enough to hit */
@media (pointer: coarse) {
  .input, .select, textarea { font-size: 16px; }
  .btn.sm { height: 36px; }
  .btn.sm.icon { width: 36px; }
  .arrows .btn.sm.icon { width: 42px; height: 40px; }
  .check { width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.empty.full { min-height: 100vh; justify-content: center; }
.empty.full img { border-radius: 20px; margin-bottom: 8px; }
.ml { margin-left: 8px; }

/* ---------- API page ---------- */
.dev-intro { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.dev-intro > .card, .code-wrap { min-width: 0; max-width: 100%; }
.link { color: var(--accent-2); font-weight: 600; }
.link:hover { text-decoration: underline; }
.code-wrap { position: relative; }
.code {
  margin: 0; padding: 14px 44px 14px 16px; overflow-x: auto;
  border-radius: 10px; background: #0d0f15; color: #dfe2ee;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre;
  border: 1px solid rgba(255, 255, 255, .06);
}
.copy-btn { position: absolute; top: 8px; right: 8px; color: #9a9fb2; }
.copy-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.api-groups { gap: 20px; }
.api-list { display: flex; flex-direction: column; }
.api-item { border-top: 1px solid var(--line); }
.api-item:first-child { border-top: 0; }
.api-item summary {
  display: grid; grid-template-columns: 58px 340px 1fr; align-items: baseline; gap: 14px;
  padding: 13px 20px; cursor: pointer; list-style: none;
}
.api-item summary::-webkit-details-marker { display: none; }
.api-item summary:hover { background: var(--panel-2); }
.api-item[open] summary { background: var(--panel-2); }
.api-item .code-wrap { padding: 0 20px 16px; background: var(--panel-2); }
.api-item .copy-btn { right: 28px; }
.method { display: inline-flex; justify-content: center; padding: 2px 0; border-radius: 6px; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.method.get { background: var(--info-soft); color: var(--info); }
.method.post { background: var(--accent-soft); color: var(--accent-2); }
.path { font-family: var(--mono); font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.what { color: var(--muted); font-size: 13px; }
@media (max-width: 1180px) {
  .dev-intro { grid-template-columns: 1fr; }
  .api-item summary { grid-template-columns: 52px 1fr; }
  .api-item .what { grid-column: 2; }
}

/* Wi-Fi change in progress (device.js, changeWifi) */
.wp { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 6px 0 2px; text-align: center; }
.wp-anim { position: relative; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.wp-anim svg { width: 32px; height: 32px; position: relative; z-index: 1; }
.wp-anim i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
.wp-anim.run i { animation: wp-wave 2.4s ease-out infinite; }
.wp-anim.run i:nth-of-type(2) { animation-delay: .8s; }
.wp-anim.run i:nth-of-type(3) { animation-delay: 1.6s; }
.wp-anim.run svg { animation: wp-breathe 2.4s ease-in-out infinite; }
.wp-anim.ok { color: var(--ok); background: var(--ok-soft); animation: wp-pop .35s cubic-bezier(.2, .9, .3, 1.4); }
.wp-anim.bad { color: var(--warn); background: var(--warn-soft); animation: wp-pop .35s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes wp-wave { from { transform: scale(.9); opacity: .6; } to { transform: scale(1.9); opacity: 0; } }
@keyframes wp-breathe { 50% { transform: scale(1.08); } }
@keyframes wp-pop { from { transform: scale(.6); opacity: 0; } }
.wp-title { margin: 0; font-size: 16px; font-weight: 650; }
.wp-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; align-self: stretch; text-align: left; }
.wp-steps li { display: flex; align-items: center; gap: 10px; color: var(--faint); transition: color .3s; }
.wp-steps li.now, .wp-steps li.done, .wp-steps li.fail { color: var(--text); }
.wp-dot { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); box-sizing: border-box; position: relative; transition: all .3s; }
.wp-steps li.now .wp-dot { border-color: var(--accent); border-right-color: transparent; animation: spin .9s linear infinite; }
.wp-steps li.done .wp-dot { border-color: var(--ok); background: var(--ok); }
.wp-steps li.done .wp-dot::after { content: ""; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.wp-steps li.fail .wp-dot { border-color: var(--warn); background: var(--warn); }
.wp-steps li.fail .wp-dot::after { content: "!"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 800; }
.wp-bar { align-self: stretch; height: 6px; border-radius: 99px; background: var(--panel-3); overflow: hidden; }
.wp-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 1s linear; }
.wp-bar.bad span { background: var(--warn); }
.wp-meta { align-self: stretch; justify-content: flex-end; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; margin-top: -8px; }
.wp-hint { margin: 0; font-size: 13px; }
.wp-err { margin: 0; }
@media (prefers-reduced-motion: reduce) { .wp-anim.run i, .wp-anim.run svg, .wp-steps li.now .wp-dot { animation: none; } }

/* ---------- Wi-Fi change: networks near the dongle ---------- */
.nets-head { justify-content: space-between; }
.nets-head .btn[disabled] svg { animation: spin 1s linear infinite; }
.nets { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; max-height: 316px; overflow-y: auto; }
.nets-row {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border: 0; border-top: 1px solid var(--line);
  background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.nets-row:first-child, .nets-note + .nets-row { border-top: 0; }
.nets-row:hover { background: var(--panel-2); }
.nets-row[aria-checked="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.nets-row svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.nets-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nets-row[aria-checked="true"] .nets-name { font-weight: 650; }
.nets-type .nets-name { color: var(--muted); }
.nets-lock svg { width: 15px; height: 15px; color: var(--faint); }
.nets-open { font-size: 12px; color: var(--faint); }
.nets-now { height: 20px; font-size: 11px; }
.nets-bars { flex: none; display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.nets-bars i { width: 3px; border-radius: 1px; background: var(--line-2); }
.nets-bars i:nth-child(1) { height: 25%; } .nets-bars i:nth-child(2) { height: 50%; }
.nets-bars i:nth-child(3) { height: 75%; } .nets-bars i:nth-child(4) { height: 100%; }
.nets-bars[data-n="1"] i:nth-child(-n+1), .nets-bars[data-n="2"] i:nth-child(-n+2),
.nets-bars[data-n="3"] i:nth-child(-n+3), .nets-bars[data-n="4"] i { background: var(--accent); }
.nets-wait { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; color: var(--muted); font-size: 13.5px; }
.nets-wait .spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .9s linear infinite; }
.nets-note { margin: 0; padding: 10px 14px; font-size: 13px; }
.nets-show { margin-top: 4px; font-size: 13px; color: var(--muted); font-weight: 400; }
