/* MN TV Support - design system.
   Bright and happy: clean white surfaces on a soft grey page, rounded corners, soft shadows, and one signature
   sunset gradient (amber -> orange -> pink -> purple, Instagram-style) that carries the brand: the logo, primary
   buttons, the active tab, the avatar ring, progress and the public-page heroes. Status keeps its own calm colours
   (green / amber / red) so warnings never get lost in the brand. Light first, full dark theme (follows the system;
   manual toggle). Shared by every page (console, provisioning, apps, login, /get, code card). No build step. */

/* ------------------------------------------------------------------ fonts (self-hosted) */
@font-face { font-family: "Inter"; src: url("/ui/fonts/inter-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/ui/fonts/inter-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/ui/fonts/inter-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/ui/fonts/inter-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/ui/fonts/jetbrains-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/ui/fonts/jetbrains-mono-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

/* ------------------------------------------------------------------ tokens: light (default) */
:root {
  color-scheme: light;

  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-tt: var(--font-ui);          /* legacy alias */

  /* type scale (fixed, ~1.15) */
  --t-xs: .75rem;      /* 12 */
  --t-sm: .8125rem;    /* 13 */
  --t-base: .875rem;   /* 14 */
  --t-md: 1rem;        /* 16 */
  --t-lg: 1.125rem;    /* 18 */
  --t-xl: 1.5rem;      /* 24 page titles */
  --t-2xl: 2.5rem;     /* 40 public-page headlines */

  /* spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px;

  --r: 8px;            /* buttons, inputs */
  --r-lg: 12px;        /* cards, dialogs */
  --r-full: 999px;
  --head-h: 60px;
  --keys-h: 0px;       /* legacy */
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* the signature gradient (sunset). --grad-btn is deeper so white text on it stays readable. */
  --g1: oklch(0.82 0.15 80);    /* amber */
  --g2: oklch(0.7 0.2 45);      /* orange */
  --g3: oklch(0.62 0.24 10);    /* pink */
  --g4: oklch(0.55 0.24 335);   /* magenta */
  --g5: oklch(0.5 0.22 300);    /* purple */
  --grad: linear-gradient(120deg, var(--g1) 0%, var(--g2) 24%, var(--g3) 52%, var(--g4) 76%, var(--g5) 100%);
  --grad-btn: linear-gradient(120deg, oklch(0.6 0.22 12) 0%, oklch(0.55 0.24 348) 50%, oklch(0.5 0.23 312) 100%);
  --grad-soft: linear-gradient(120deg, oklch(0.97 0.035 60), oklch(0.965 0.035 10) 50%, oklch(0.965 0.035 320));
  --glow: 0 6px 18px oklch(0.6 0.22 10 / .28);

  --bg: oklch(0.982 0.003 265);
  --bg-2: oklch(0.968 0.005 265);         /* table heads, toolbars, rails */
  --surface: oklch(1 0 0);                /* cards */
  --surface-2: oklch(0.962 0.006 265);    /* hover, wells */
  --line: oklch(0.915 0.007 265);
  --line-strong: oklch(0.845 0.01 265);
  --text: oklch(0.22 0.02 265);
  --text-2: oklch(0.4 0.02 265);
  --muted: oklch(0.53 0.02 265);          /* >= 4.5:1 on white and on --bg-2 */

  --accent: oklch(0.55 0.23 350);         /* solid brand pink: checkboxes, small fills, focus */
  --accent-hover: oklch(0.5 0.23 350);
  --on-accent: oklch(1 0 0);
  --accent-t: oklch(0.52 0.22 350);       /* links and selected text */
  --accent-soft: oklch(0.965 0.025 350);
  --accent-line: oklch(0.87 0.07 350);
  --focus: oklch(0.62 0.22 350);
  --select-bg: oklch(0.965 0.025 350);
  --hl: var(--accent-t);

  /* status: plain = text, -k = solid dot/meter, -soft = tinted background, -line = tinted border, -solid = white-text fill */
  --ok: oklch(0.5 0.14 152);    --ok-k: oklch(0.7 0.17 152);   --ok-soft: oklch(0.962 0.04 152);  --ok-line: oklch(0.85 0.09 152);  --ok-solid: oklch(0.56 0.15 152);
  --warn: oklch(0.53 0.12 62);  --warn-k: oklch(0.79 0.16 75); --warn-soft: oklch(0.972 0.045 85); --warn-line: oklch(0.86 0.1 80);  --warn-solid: oklch(0.6 0.15 60);
  --err: oklch(0.52 0.2 27);    --err-k: oklch(0.63 0.21 27);  --err-soft: oklch(0.965 0.025 27); --err-line: oklch(0.86 0.07 27);  --err-solid: oklch(0.54 0.21 27);
  --info: oklch(0.5 0.13 235);  --info-k: oklch(0.68 0.14 235); --info-soft: oklch(0.962 0.025 235); --info-line: oklch(0.85 0.06 235);
  --admin: oklch(0.5 0.2 300);  --admin-k: oklch(0.62 0.2 300); --admin-soft: oklch(0.962 0.03 300); --admin-line: oklch(0.86 0.07 300);
  --on-k: oklch(0.2 0.02 265);

  /* legacy ink names (map onto the roles above) */
  --red-t: var(--err); --red-k: var(--err-k);
  --green-t: var(--ok); --green-k: var(--ok-k);
  --yellow-t: var(--warn); --yellow-k: var(--warn-k);
  --cyan-t: var(--info); --cyan-k: var(--info-k);
  --blue-t: var(--accent-t); --blue-k: var(--accent);
  --magenta-t: var(--admin); --magenta-k: var(--admin-k);

  --shadow-sm: 0 1px 2px oklch(0.25 0.02 265 / .06);
  --shadow: 0 1px 2px oklch(0.25 0.02 265 / .05), 0 4px 14px oklch(0.25 0.02 265 / .06);
  --shadow-lg: 0 2px 6px oklch(0.25 0.03 265 / .06), 0 16px 40px oklch(0.25 0.03 265 / .14);
  --scrim: oklch(0.22 0.02 265 / .36);
  --term-bg: oklch(0.19 0.012 265);       /* terminals and logs stay dark in both themes */
  --term-fg: oklch(0.92 0.006 265);
}

/* ---- dark: deep slate, same sunset ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --g1: oklch(0.84 0.15 80); --g2: oklch(0.74 0.19 45); --g3: oklch(0.67 0.23 10); --g4: oklch(0.62 0.23 335); --g5: oklch(0.58 0.21 300);
    --grad-soft: linear-gradient(120deg, oklch(0.27 0.05 50), oklch(0.26 0.06 10) 50%, oklch(0.26 0.06 320));
    --glow: 0 6px 22px oklch(0.6 0.22 10 / .3);
    --bg: oklch(0.165 0.008 265);
    --bg-2: oklch(0.19 0.009 265);
    --surface: oklch(0.205 0.01 265);
    --surface-2: oklch(0.245 0.012 265);
    --line: oklch(0.285 0.012 265);
    --line-strong: oklch(0.375 0.014 265);
    --text: oklch(0.965 0.004 265);
    --text-2: oklch(0.83 0.008 265);
    --muted: oklch(0.69 0.012 265);
    --accent: oklch(0.6 0.22 350);
    --accent-hover: oklch(0.65 0.22 350);
    --accent-t: oklch(0.78 0.14 352);
    --accent-soft: oklch(0.28 0.06 350);
    --accent-line: oklch(0.44 0.12 350);
    --focus: oklch(0.72 0.17 350);
    --select-bg: oklch(0.28 0.06 350);
    --ok: oklch(0.79 0.15 152);   --ok-k: oklch(0.72 0.17 152);  --ok-soft: oklch(0.255 0.05 152); --ok-line: oklch(0.41 0.08 152); --ok-solid: oklch(0.56 0.15 152);
    --warn: oklch(0.84 0.13 82);  --warn-k: oklch(0.8 0.15 75);  --warn-soft: oklch(0.265 0.05 75); --warn-line: oklch(0.43 0.08 75); --warn-solid: oklch(0.6 0.15 60);
    --err: oklch(0.76 0.15 27);   --err-k: oklch(0.67 0.2 27);   --err-soft: oklch(0.26 0.05 27);  --err-line: oklch(0.43 0.1 27);  --err-solid: oklch(0.56 0.2 27);
    --info: oklch(0.79 0.11 235); --info-k: oklch(0.7 0.13 235); --info-soft: oklch(0.255 0.04 235); --info-line: oklch(0.42 0.07 235);
    --admin: oklch(0.78 0.14 300); --admin-k: oklch(0.68 0.19 300); --admin-soft: oklch(0.265 0.06 300); --admin-line: oklch(0.43 0.1 300);
    --shadow-sm: 0 1px 2px oklch(0 0 0 / .3);
    --shadow: 0 1px 2px oklch(0 0 0 / .3), 0 4px 14px oklch(0 0 0 / .25);
    --shadow-lg: 0 2px 6px oklch(0 0 0 / .3), 0 18px 48px oklch(0 0 0 / .5);
    --scrim: oklch(0.08 0.005 265 / .6);
    --term-bg: oklch(0.135 0.008 265);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --g1: oklch(0.84 0.15 80); --g2: oklch(0.74 0.19 45); --g3: oklch(0.67 0.23 10); --g4: oklch(0.62 0.23 335); --g5: oklch(0.58 0.21 300);
  --grad-soft: linear-gradient(120deg, oklch(0.27 0.05 50), oklch(0.26 0.06 10) 50%, oklch(0.26 0.06 320));
  --glow: 0 6px 22px oklch(0.6 0.22 10 / .3);
  --bg: oklch(0.165 0.008 265);
  --bg-2: oklch(0.19 0.009 265);
  --surface: oklch(0.205 0.01 265);
  --surface-2: oklch(0.245 0.012 265);
  --line: oklch(0.285 0.012 265);
  --line-strong: oklch(0.375 0.014 265);
  --text: oklch(0.965 0.004 265);
  --text-2: oklch(0.83 0.008 265);
  --muted: oklch(0.69 0.012 265);
  --accent: oklch(0.6 0.22 350);
  --accent-hover: oklch(0.65 0.22 350);
  --accent-t: oklch(0.78 0.14 352);
  --accent-soft: oklch(0.28 0.06 350);
  --accent-line: oklch(0.44 0.12 350);
  --focus: oklch(0.72 0.17 350);
  --select-bg: oklch(0.28 0.06 350);
  --ok: oklch(0.79 0.15 152);   --ok-k: oklch(0.72 0.17 152);  --ok-soft: oklch(0.255 0.05 152); --ok-line: oklch(0.41 0.08 152); --ok-solid: oklch(0.56 0.15 152);
  --warn: oklch(0.84 0.13 82);  --warn-k: oklch(0.8 0.15 75);  --warn-soft: oklch(0.265 0.05 75); --warn-line: oklch(0.43 0.08 75); --warn-solid: oklch(0.6 0.15 60);
  --err: oklch(0.76 0.15 27);   --err-k: oklch(0.67 0.2 27);   --err-soft: oklch(0.26 0.05 27);  --err-line: oklch(0.43 0.1 27);  --err-solid: oklch(0.56 0.2 27);
  --info: oklch(0.79 0.11 235); --info-k: oklch(0.7 0.13 235); --info-soft: oklch(0.255 0.04 235); --info-line: oklch(0.42 0.07 235);
  --admin: oklch(0.78 0.14 300); --admin-k: oklch(0.68 0.19 300); --admin-soft: oklch(0.265 0.06 300); --admin-line: oklch(0.43 0.1 300);
  --shadow-sm: 0 1px 2px oklch(0 0 0 / .3);
  --shadow: 0 1px 2px oklch(0 0 0 / .3), 0 4px 14px oklch(0 0 0 / .25);
  --shadow-lg: 0 2px 6px oklch(0 0 0 / .3), 0 18px 48px oklch(0 0 0 / .5);
  --scrim: oklch(0.08 0.005 265 / .6);
  --term-bg: oklch(0.135 0.008 265);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--t-base)/1.5 var(--font-ui);
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; letter-spacing: -.011em; text-wrap: balance; }
p { margin: 0 0 var(--s-3); text-wrap: pretty; max-width: 72ch; }
a { color: var(--accent-t); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, kbd, samp, pre, .mono { font-family: var(--font-mono); font-size: .92em; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-4) 0; }
::selection { background: oklch(0.88 0.08 350); color: oklch(0.2 0.02 265); }
[hidden], .hidden { display: none !important; }
.num, .tabular { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--s-2); top: -60px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: var(--s-2) var(--s-3); border-radius: var(--r); font-weight: 600; }
.skip-link:focus { top: var(--s-2); }

/* ------------------------------------------------------------------ utilities */
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }
.xs { font-size: var(--t-xs); }
.mono { font-family: var(--font-mono); }
.tt-font { font-family: var(--font-ui); }   /* legacy alias */
.strong { font-weight: 600; }
.upper { text-transform: uppercase; }
.row { display: flex; align-items: center; }
.row.gap, .gap { gap: var(--s-2); }
.row.gap-lg { gap: var(--s-4); }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--s-3); }
.grow { flex: 1 1 auto; min-width: 0; }
.mt { margin-top: var(--s-3); }
.mt-lg { margin-top: var(--s-5); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.err-text, .st-error { color: var(--err); }
.info-text { color: var(--info); }
.hl { color: var(--hl); }
.grad-fill { background: var(--grad); color: oklch(1 0 0); }

/* ------------------------------------------------------------------ icons (1.75px stroke, round caps) */
.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.ic.lg { width: 1.5em; height: 1.5em; }
/* platform marks (MN.brand): filled, brand colours, lighter Samsung blue on dark. Not ".brand" (the top-left logo link). */
.pmark { flex: none; fill: currentColor; stroke: none; vertical-align: -.2em; }
.pmark-android { width: 1.3em; height: 1.3em; color: #3ddc84; }
.pmark-samsung { height: .8em; width: calc(.8em * 6.543); vertical-align: -.05em; color: #1428a0; }
.pmark-samsung.lg { height: 1.15em; width: calc(1.15em * 6.543); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pmark-samsung { color: #aab6ff; } }
:root[data-theme="dark"] .pmark-samsung { color: #aab6ff; }
/* LG: face + letters, 24 x 10.582 (viewBox cropped to the mark); LG red, lighter on dark. */
.pmark-lg { height: 1.05em; width: calc(1.05em * 2.268); vertical-align: -.25em; color: #a50034; }
.pmark-lg.lg { height: 1.5em; width: calc(1.5em * 2.268); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pmark-lg { color: #ff7a9c; } }
:root[data-theme="dark"] .pmark-lg { color: #ff7a9c; }
.ic.xl { width: 2.25em; height: 2.25em; }

/* ------------------------------------------------------------------ app shell: top bar with section tabs */
body.shell { display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); height: 100dvh; overflow: hidden; }
body.shell > .app-head { grid-row: 1; }
body.shell > .tt-main { grid-row: 2; }
.tt-main { min-height: 0; min-width: 0; overflow: auto; }
.tt-main.fill { overflow: hidden; display: flex; flex-direction: column; }

.app-head {
  position: relative; z-index: 30;
  display: flex; align-items: center; gap: var(--s-5);
  min-height: var(--head-h); padding: 3px var(--s-5) 0;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.app-head::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: oklch(1 0 0);
  background: var(--grad); box-shadow: 0 2px 8px oklch(0.6 0.22 10 / .35), inset 0 1px 0 oklch(1 0 0 / .25); }
.brand-mark .ic { width: 18px; height: 18px; stroke-width: 2.1; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -.015em; white-space: nowrap; }
.brand-name span { color: var(--muted); font-weight: 500; }

.app-nav { display: flex; align-items: stretch; align-self: stretch; gap: var(--s-1); }
.app-nav a {
  position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 0 var(--s-3);
  font-weight: 500; color: var(--muted); text-decoration: none; white-space: nowrap;
  transition: color .15s var(--ease);
}
.app-nav a:hover { color: var(--text); text-decoration: none; }
.app-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.app-nav a[aria-current="page"]::after { content: ""; position: absolute; left: var(--s-3); right: var(--s-3); bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--grad); }
.app-nav a .ic { opacity: .9; }
.app-nav .lbl-s { display: none; }
.app-nav a[aria-current="page"] .ic { color: var(--accent-t); }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: var(--r-full); background: var(--grad-btn); color: oklch(1 0 0); font-size: 11.5px; font-weight: 700; line-height: 1; box-shadow: 0 1px 4px oklch(0.6 0.22 10 / .35); }
.nav-badge[hidden] { display: none; }
.head-spacer { flex: 1; }
.head-tools { display: flex; align-items: center; gap: var(--s-2); flex: none; }
.conn { display: inline-flex; align-items: center; font-size: var(--t-sm); color: var(--muted); white-space: nowrap; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: var(--r);
  color: var(--text-2); background: transparent; border: 1px solid transparent; cursor: pointer; transition: background-color .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .ic { width: 19px; height: 19px; }
.user-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 3px; border-radius: var(--r-full);
  color: var(--text); background: transparent; border: 1px solid var(--line); cursor: pointer; font: 500 var(--t-base)/1 var(--font-ui);
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-2); }
/* avatar with a gradient ring, like a story ring */
.avatar { width: 30px; height: 30px; padding: 2.5px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--grad); flex: none; }
.avatar > span { width: 100%; height: 100%; display: grid; place-items: center; border-radius: 50%; background: var(--surface); color: var(--text); font-size: 11.5px; font-weight: 700; text-transform: uppercase; }
.user-btn > .ic { width: 16px; height: 16px; color: var(--muted); }
/* the assistant's button (MN staff): a soft brand pill, the sparkle in brand pink */
.assist-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px 0 11px; border-radius: var(--r-full);
  color: var(--text); background: var(--grad-soft); border: 1px solid var(--accent-line); cursor: pointer;
  font: 600 var(--t-sm)/1 var(--font-ui); white-space: nowrap; transition: box-shadow .2s var(--ease), border-color .15s var(--ease);
}
.assist-btn .ic { width: 17px; height: 17px; color: var(--accent-t); }
.assist-btn:hover { box-shadow: var(--glow); border-color: var(--accent); }
.assist-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 600px) { .assist-btn { width: 36px; padding: 0; justify-content: center; } .assist-lbl { display: none; } }
@media (pointer: coarse) { .assist-btn { height: 44px; } }
@media (pointer: coarse) and (max-width: 600px) { .assist-btn { width: 44px; } }

@media (max-width: 860px) {
  :root { --head-h: 56px; }
  .app-head { flex-wrap: wrap; gap: 0 var(--s-3); padding: 3px var(--s-4) 0; }
  .brand { min-height: 54px; }
  .head-spacer { display: none; }
  .head-tools { margin-left: auto; }
  .user-name, .conn-text { display: none; }
  .app-nav { order: 3; width: calc(100% + 2 * var(--s-4)); margin: 0 calc(-1 * var(--s-4)); padding: 0 var(--s-2); overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line); min-height: 46px; }
  .app-nav::-webkit-scrollbar { display: none; }
}
@media (max-width: 600px) {
  /* short labels, no icons: all sections fit a phone without scrolling */
  .app-nav { gap: 0; justify-content: space-between; }
  .app-nav a { padding: 0 7px; gap: 5px; font-size: 13.5px; }
  .app-nav a[aria-current="page"]::after { left: 7px; right: 7px; }
  .app-nav a .ic, .app-nav .lbl { display: none; }
  .app-nav .lbl-s { display: inline; }
  .nav-badge { min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; }
}

/* ------------------------------------------------------------------ page headings + content width */
.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: var(--s-6) var(--s-5) var(--s-7); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-5); }
.page-title, .tt-title { font-size: var(--t-xl); font-weight: 700; letter-spacing: -.025em; line-height: 1.2; text-transform: none; font-family: var(--font-ui); }
.page-sub { margin: 6px 0 0; color: var(--muted); font-size: var(--t-base); }
.tt-rule { display: none; }   /* legacy */
.h-sec { font-size: var(--t-base); font-weight: 600; color: var(--text); letter-spacing: -.005em; }
.h-sub { font-size: var(--t-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 860px) { .page { padding: var(--s-5) var(--s-4) var(--s-7); } }

/* ------------------------------------------------------------------ buttons */
.btn {
  --b: transparent; --bg-b: var(--grad-btn); --fg-b: oklch(1 0 0);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 36px; padding: 0 14px;
  font: 600 var(--t-base)/1 var(--font-ui); letter-spacing: -.005em;
  color: var(--fg-b); background: var(--bg-b); border: 1px solid var(--b); border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .2s var(--ease), filter .15s var(--ease), transform .08s var(--ease);
}
.btn:hover { text-decoration: none; filter: brightness(1.06) saturate(1.05); box-shadow: var(--glow); }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 16px; height: 16px; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: var(--t-sm); gap: 6px; }
.btn.small .ic { width: 15px; height: 15px; }
.btn.lg { min-height: 46px; padding: 0 var(--s-5); font-size: 15px; border-radius: 12px; }
.btn.icon { padding: 0; width: 36px; }
.btn.icon.small { width: 30px; }
.btn.ghost, .btn.secondary { --b: var(--line-strong); --bg-b: var(--surface); --fg-b: var(--text); font-weight: 500; }
.btn.ghost:hover, .btn.secondary:hover { --bg-b: var(--surface-2); filter: none; box-shadow: var(--shadow-sm); }
.btn.quiet { --b: transparent; --bg-b: transparent; --fg-b: var(--text-2); box-shadow: none; font-weight: 500; }
.btn.quiet:hover { --bg-b: var(--surface-2); --fg-b: var(--text); filter: none; box-shadow: none; }
.btn.danger { --b: var(--err-line); --bg-b: var(--surface); --fg-b: var(--err); font-weight: 500; }
.btn.danger:hover { --bg-b: var(--err-soft); filter: none; box-shadow: var(--shadow-sm); }
.btn.danger.solid { --b: var(--err-solid); --bg-b: var(--err-solid); --fg-b: oklch(1 0 0); font-weight: 600; }
.btn.danger.solid:hover { filter: brightness(1.08); box-shadow: 0 6px 16px oklch(0.55 0.2 27 / .3); }
/* "changes the customer's TV": an amber dot in front of the label, so staff can tell it from a harmless check */
.btn.alters::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn-k); flex: none; box-shadow: 0 0 0 3px var(--warn-soft); }
.btn.alters:not(.danger):not(.solid) { --b: var(--line-strong); --bg-b: var(--surface); --fg-b: var(--text); font-weight: 500; }
.btn.alters:not(.danger):not(.solid):hover { --bg-b: var(--surface-2); filter: none; box-shadow: var(--shadow-sm); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 15px; height: 15px; border: 2px solid var(--fg-b); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.busy::before { opacity: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent-t); font: inherit; font-weight: 500; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.btn-group { display: inline-flex; }
.btn-group > .btn { border-radius: 0; }
.btn-group > .btn:first-child { border-radius: var(--r) 0 0 var(--r); }
.btn-group > .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.btn-group > .btn + .btn { margin-left: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ form controls */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]), select, textarea {
  width: 100%; min-height: 36px; padding: 7px 11px;
  font: 400 var(--t-base)/1.35 var(--font-ui); color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
textarea { min-height: 84px; resize: vertical; }
select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238891a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 16px; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible,
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[disabled], select[disabled], textarea[disabled] { opacity: .55; cursor: not-allowed; background: var(--surface-2); }
input.mono, textarea.mono { font-family: var(--font-mono); font-size: var(--t-sm); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label, label.lab { font-size: var(--t-sm); font-weight: 500; color: var(--text); }
.field .hint { font-size: var(--t-xs); color: var(--muted); }
.field .err { font-size: var(--t-xs); color: var(--err); }
.field.invalid input, .field.invalid select { border-color: var(--err); }
.field.invalid input:focus { box-shadow: 0 0 0 3px var(--err-soft); }
.inline-input { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--t-sm); color: var(--text-2); }
.inline-input input, .inline-input select { width: auto; min-height: 32px; font-size: var(--t-sm); }
.input-group { display: flex; gap: var(--s-2); }
.input-group > input { flex: 1; min-width: 0; }
.search { position: relative; }
.search > .ic { position: absolute; left: 11px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; width: 16px; height: 16px; }
.search > input { padding-left: 34px !important; }

input[type=checkbox], input[type=radio] {
  appearance: none; flex: none; width: 17px; height: 17px; margin: 0; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 5px; cursor: pointer; display: inline-grid; place-content: center; vertical-align: -3px;
  box-shadow: var(--shadow-sm); transition: background-color .12s var(--ease), border-color .12s var(--ease);
}
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--grad-btn); border-color: transparent; }
input[type=checkbox]:checked::after { content: ""; width: 9px; height: 5px; border: solid oklch(1 0 0); border-width: 0 0 2px 2px; rotate: -45deg; translate: 0 -1px; }
input[type=radio]:checked::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: oklch(1 0 0); }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--accent); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.check { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--t-sm); color: var(--text-2); cursor: pointer; }
/* switch: <input type=checkbox class="switch"> */
input[type=checkbox].switch { width: 34px; height: 20px; border-radius: var(--r-full); background: var(--line-strong); border: 0; position: relative; box-shadow: inset 0 1px 2px oklch(0 0 0 / .1); }
input[type=checkbox].switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: oklch(1 0 0); box-shadow: 0 1px 2px oklch(0 0 0 / .25); border: 0; rotate: none; translate: none; transition: transform .15s var(--ease); }
input[type=checkbox].switch:checked { background: var(--grad-btn); }
input[type=checkbox].switch:checked::after { transform: translateX(14px); }

/* ------------------------------------------------------------------ status: dots, badges, meters */
.lamp { display: inline-flex; align-items: center; gap: 7px; font-size: var(--t-sm); color: var(--text-2); white-space: nowrap; }
.lamp::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--lc, var(--muted)); }
.lamp.on { --lc: var(--ok-k); }
.lamp.warn { --lc: var(--warn-k); }
.lamp.err { --lc: var(--err-k); }
.lamp.info { --lc: var(--info-k); }
.lamp.off::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.lamp.pulse::before { animation: pulse 1.6s var(--ease) infinite; }
.dot { display: inline-block; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--muted); }
.dot.on, .dot.online { background: var(--ok-k); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--lc, var(--warn-k)) 55%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes blink { 50% { opacity: .35; } }

.chip, .pill, .badge {
  display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 0 8px;
  font-size: var(--t-xs); font-weight: 500; line-height: 1;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-full); white-space: nowrap;
}
.chip .ic { width: 13px; height: 13px; }
.chip.ok { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-line); }
.chip.warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.chip.err { color: var(--err); background: var(--err-soft); border-color: var(--err-line); }
.chip.info { color: var(--info); background: var(--info-soft); border-color: var(--info-line); }
.chip.admin { color: var(--admin); background: var(--admin-soft); border-color: var(--admin-line); }
.chip.accent { color: var(--accent-t); background: var(--accent-soft); border-color: var(--accent-line); }
.chip.brand { color: oklch(1 0 0); background: var(--grad-btn); border-color: transparent; font-weight: 600; }
.chip.ref { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--text); background: var(--surface-2); border-color: var(--line-strong); border-radius: 6px; }
.chip.outline { background: transparent; }

/* meter: N segments, --n lit of --of.  <span class="meter" style="--n:3;--of:4"> */
.meter { --of: 4; --n: 0; --c: var(--ok-k); position: relative; display: inline-block; width: calc(var(--of) * 7px - 2px); height: 10px; vertical-align: -1px; flex: none;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 5px, transparent 5px 7px); border-radius: 2px; }
.meter::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--n) * 7px - 2px);
  background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 7px); border-radius: 2px; }
.meter.warn { --c: var(--warn-k); } .meter.err { --c: var(--err-k); } .meter.info { --c: var(--accent); }
.meter.tall { height: 16px; }
.meter.lg { width: calc(var(--of) * 10px - 3px); height: 8px; background: repeating-linear-gradient(90deg, var(--line) 0 7px, transparent 7px 10px); }
.meter.lg::after { width: calc(var(--n) * 10px - 3px); background: repeating-linear-gradient(90deg, var(--c) 0 7px, transparent 7px 10px); }
/* progress bar: <div class="progress" style="--p:40%"> - the brand gradient fills it */
.progress { position: relative; height: 8px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.progress::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); border-radius: inherit; background: var(--grad); transition: width .4s var(--ease); }
.progress.ok::after { background: var(--ok-solid); }
.progress.err::after { background: var(--err-solid); }

kbd, .kbd { display: inline-block; min-width: 20px; padding: 1px 6px; font: 500 var(--t-xs)/1.5 var(--font-mono); text-align: center; color: var(--text-2); background: var(--surface); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; }

/* ------------------------------------------------------------------ surfaces */
.panel, .sheet, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; gap: var(--s-3); padding: 14px var(--s-4); border-bottom: 1px solid var(--line); min-height: 52px; }
.panel-head h2, .panel-head h3 { font-size: 15px; font-weight: 600; color: var(--text); letter-spacing: -.01em; text-transform: none; }
.panel-body { padding: var(--s-4); }
.bar, .pane-bar { display: flex; align-items: center; gap: var(--s-2); padding: 10px var(--s-4); background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; min-height: 52px; }
.pane-bar.section-bar { border-top: 1px solid var(--line); margin-top: var(--s-3); }
.pane-bar h3 { font-size: var(--t-base); font-weight: 600; color: var(--text); text-transform: none; letter-spacing: -.005em; }
.well { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s-3) var(--s-4); }
/* a soft brand-tinted band, e.g. a "what happens next" summary or a hero strip */
.brand-band { background: var(--grad-soft); border: 1px solid var(--accent-line); border-radius: var(--r-lg); }

.callout { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border: 1px solid var(--line); background: var(--bg-2); border-radius: var(--r); color: var(--text); }
.callout > .ic { margin-top: 1px; width: 18px; height: 18px; color: var(--muted); }
.callout.warn { background: var(--warn-soft); border-color: var(--warn-line); } .callout.warn > .ic { color: var(--warn); }
.callout.err { background: var(--err-soft); border-color: var(--err-line); } .callout.err > .ic { color: var(--err); }
.callout.ok { background: var(--ok-soft); border-color: var(--ok-line); } .callout.ok > .ic { color: var(--ok); }
.callout.info { background: var(--info-soft); border-color: var(--info-line); } .callout.info > .ic { color: var(--info); }

/* the box PIN note (Help requests home, Device register): common knowledge, so it stands out */
.pin-note { margin: var(--s-4) 0; font-size: var(--t-base); }
.pin-note strong { font-weight: 700; }

/* ------------------------------------------------------------------ tabs (role=tablist / tab) */
.tabs { display: flex; align-items: stretch; gap: var(--s-1); padding: 0 var(--s-4); background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab, .tabs > button {
  position: relative; display: inline-flex; align-items: center; gap: var(--s-2); min-height: 46px; padding: 0 var(--s-3);
  font: 500 var(--t-base)/1 var(--font-ui); color: var(--muted); background: transparent; border: 0; cursor: pointer; white-space: nowrap;
  transition: color .15s var(--ease);
}
.tab .ic, .tabs > button .ic { width: 16px; height: 16px; }
.tab:hover, .tabs > button:hover { color: var(--text); }
.tab.active, .tab[aria-selected="true"], .tabs > button.active { color: var(--text); font-weight: 600; }
.tab.active .ic, .tab[aria-selected="true"] .ic, .tabs > button.active .ic { color: var(--accent-t); }
.tab.active::after, .tab[aria-selected="true"]::after, .tabs > button.active::after { content: ""; position: absolute; left: var(--s-3); right: var(--s-3); bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--grad); }
.tab-spacer { flex: 1; }
/* segmented control: <div class="seg-ctl" role="tablist"><button aria-selected="true">..</button></div> */
.seg-ctl { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.seg-ctl > button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: 500 var(--t-sm)/1 var(--font-ui); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg-ctl > button:hover { color: var(--text); }
.seg-ctl > button[aria-selected="true"], .seg-ctl > button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }

/* ------------------------------------------------------------------ tables */
.tbl, .apps-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-base); }
.tbl th, .apps-table th { text-align: left; padding: 10px var(--s-4); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--bg-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.tbl td, .apps-table td { padding: 12px var(--s-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td, .apps-table tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover, .apps-table tbody tr:hover { background: var(--bg-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .actions, .apps-table .actions { text-align: right; white-space: nowrap; }
.tbl .sub, .apps-table .sub { display: block; margin-top: 2px; font-size: var(--t-xs); color: var(--muted); }
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px var(--s-5); margin: 0; font-size: var(--t-base); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ empty / skeleton */
.empty-state { display: grid; justify-items: center; gap: var(--s-2); padding: var(--s-7) var(--s-5); text-align: center; color: var(--text-2); }
.empty-state > .ic { box-sizing: content-box; width: 24px; height: 24px; padding: 14px; margin-bottom: var(--s-2); border-radius: 18px; color: oklch(1 0 0); background: var(--grad); box-shadow: var(--glow); }
.empty-state h2 { font-size: var(--t-md); color: var(--text); }
.empty-state p { margin: 0; max-width: 46ch; color: var(--muted); }
.empty-state .btn { margin-top: var(--s-3); }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 0 40%, var(--line) 50%, var(--surface-2) 60% 100%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; border-radius: 6px; min-height: 14px; }
@keyframes shimmer { to { background-position: -300% 0; } }

/* ------------------------------------------------------------------ steps */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps > li { position: relative; display: flex; align-items: center; gap: var(--s-3); padding: 10px 0; }
.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 11px; top: 36px; bottom: -8px; width: 2px; border-radius: 2px; background: var(--line); }
.steps > li.done:not(:last-child)::after { background: var(--ok-k); }
.step-mark { position: relative; z-index: 1; width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface); color: var(--muted); border: 2px solid var(--line-strong); }
.step-mark .ic { width: 13px; height: 13px; stroke-width: 2.5; }
.steps > li.done .step-mark { background: var(--ok-solid); border-color: var(--ok-solid); color: oklch(1 0 0); }
.steps > li.run .step-mark { border-color: transparent; background: var(--grad); box-shadow: var(--glow); }
.steps > li.run .step-mark::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: oklch(1 0 0); animation: blink 1.2s var(--ease) infinite; }
.steps > li.fail .step-mark { background: var(--err-solid); border-color: var(--err-solid); color: oklch(1 0 0); }
.steps > li.skip { opacity: .55; }

/* ------------------------------------------------------------------ menu (overflow / user) */
.menu-wrap { position: relative; display: inline-block; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 220px; padding: var(--s-1);
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  font: 400 var(--t-base)/1.4 var(--font-ui); animation: pop .14s var(--ease);
}
.menu.up { top: auto; bottom: calc(100% + 6px); }
.menu.left { right: auto; left: 0; }
.menu > button, .menu > a, .menu > div > button, .menu > div > a {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 10px;
  font: 500 var(--t-base)/1 var(--font-ui); color: var(--text); background: transparent; border: 0; border-radius: 8px; cursor: pointer; text-align: left; text-decoration: none;
}
.menu > button .ic, .menu > a .ic, .menu > div > button .ic, .menu > div > a .ic { width: 16px; height: 16px; color: var(--muted); }
.menu > button:hover, .menu > a:hover, .menu > div > button:hover, .menu > div > a:hover { background: var(--surface-2); text-decoration: none; }
.menu > button.danger, .menu > div > button.danger, .menu > button.danger .ic, .menu > div > button.danger .ic { color: var(--err); }
.menu > button.alters::after, .menu > div > button.alters::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn-k); margin-left: auto; }
.menu .menu-label { padding: 8px 10px 6px; font-size: var(--t-xs); color: var(--muted); }
.menu hr { margin: var(--s-1) 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ------------------------------------------------------------------ picklist (search-as-you-type results under a field) */
.picklist { margin-top: 6px; max-height: 300px; overflow: auto; padding: var(--s-1); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); }
.picklist > button { display: flex; align-items: center; gap: var(--s-3); width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.picklist > button > .ic { color: var(--accent-t); width: 18px; height: 18px; }
.picklist > button:hover, .picklist > button:focus-visible { background: var(--surface-2); outline: none; }
.picklist .pl-main { flex: 1; min-width: 0; }
.picklist .pl-sub { display: block; margin-top: 1px; font-size: var(--t-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picklist .pl-empty { padding: 10px; color: var(--muted); font-size: var(--t-sm); }
/* a chosen saved network, shown in place of the typed fields */
.picked { display: flex; align-items: center; gap: var(--s-3); padding: 10px 12px; border-radius: 12px; background: var(--grad-soft); border: 1px solid var(--accent-line); }
.picked > .ic { color: var(--accent-t); width: 20px; height: 20px; }
.picked .pl-sub { display: block; font-size: var(--t-xs); color: var(--text-2); }

/* ------------------------------------------------------------------ dialog */
dialog {
  width: min(500px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; overflow: auto;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
}
dialog.wide-dlg, dialog.wide { width: min(980px, calc(100vw - 32px)); }
dialog[open] { animation: dlg-in .2s var(--ease); }
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
dialog > form, dialog > .dlg-body { padding: var(--s-5); }
dialog h3 { font-size: var(--t-lg); margin-bottom: var(--s-1); }
dialog .dlg-title { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-2); }
dialog .dlg-title .ic { box-sizing: content-box; width: 18px; height: 18px; padding: 9px; flex: none; border-radius: 12px; color: oklch(1 0 0); background: var(--grad); }
dialog.is-alters .dlg-title .ic, dialog.is-warn .dlg-title .ic { color: var(--warn); background: var(--warn-soft); }
dialog.is-danger .dlg-title .ic { color: var(--err); background: var(--err-soft); }
dialog .dlg-fields { display: flex; flex-direction: column; gap: var(--s-4); margin: var(--s-4) 0 0; }
dialog .dlg-actions { display: flex; justify-content: flex-end; gap: var(--s-2); margin: var(--s-5) calc(-1 * var(--s-5)) calc(-1 * var(--s-5)); padding: var(--s-4) var(--s-5); background: var(--bg-2); border-top: 1px solid var(--line); }
.saved-scroll { max-height: min(55vh, 520px); overflow: auto; margin-top: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-lg); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; z-index: 200; right: var(--s-4); bottom: var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4); background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); font-size: var(--t-base); animation: toast-in .22s var(--ease); }
.toast > .ic { margin-top: 2px; width: 17px; height: 17px; }
.toast.ok > .ic { color: var(--ok); }
.toast.err > .ic { color: var(--err); }
.toast.warn > .ic { color: var(--warn); }
.toast.info > .ic { color: var(--accent-t); }
.toast .btn { margin: -4px -4px -4px 0; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .2s var(--ease), transform .2s var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* ------------------------------------------------------------------ code / output */
.out, pre.out { margin: 0; padding: var(--s-3) var(--s-4); max-height: 320px; overflow: auto; font: 400 var(--t-sm)/1.55 var(--font-mono); background: var(--term-bg); color: var(--term-fg); white-space: pre-wrap; word-break: break-word; border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ------------------------------------------------------------------ touch + motion + print */
@media (pointer: coarse) {
  .btn { min-height: 44px; } .btn.small { min-height: 40px; }
  input:not([type=checkbox]):not([type=radio]), select { min-height: 44px; }
  .tab { min-height: 48px; }
  .icon-btn { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media print {
  .app-head, .toasts { display: none !important; }
  body.shell { display: block; height: auto; overflow: visible; }
}
