/* TSE Connect — console styles. Tokens first; components only ever read tokens. */
@font-face { font-family: "Archivo"; src: url("/fonts/archivo-var.woff2") format("woff2-variations"), url("/fonts/archivo-var.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/plex-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/plex-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/plex-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/plex-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: light;
  --ground: #F3F5F8; --surface: #FFFFFF; --surface-2: #F7F9FB; --sunken: #EDF1F5;
  --ink: #0D1B2E; --ink-2: #33435A; --muted: #637186; --line: #DDE3EA; --line-strong: #C3CDD9;
  --bar: #0B2545; --bar-2: #12325C; --on-bar: #F2F6FB; --on-bar-muted: #A9B8CC;
  --primary: #0B2545; --primary-hover: #183E70; --on-primary: #FFFFFF;
  --amber: #E27D2F; --amber-soft: #FCEBDC; --amber-ink: #9A4A0F;
  --ok: #16834A; --ok-soft: #E2F3E9; --idle: #4F6F9C; --idle-soft: #E5ECF6;
  --warn: #A8680C; --warn-soft: #FBF0DA; --bad: #C23B3B; --bad-soft: #FBE6E6;
  --focus: #2F6FDB; --qr-bg: #FFFFFF; --qr-ink: #0D1B2E;
  --shadow: 0 1px 2px rgba(13, 27, 46, .06), 0 6px 20px rgba(13, 27, 46, .07);
  --shadow-pop: 0 12px 40px rgba(13, 27, 46, .22);
  --r: 10px; --r-sm: 6px;
  --f-display: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --f-body: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #0A1220; --surface: #101A2B; --surface-2: #0D1727; --sunken: #0B1422;
    --ink: #E6ECF4; --ink-2: #BAC6D6; --muted: #8B99AD; --line: #1E2B40; --line-strong: #2D3D58;
    --bar: #07172D; --bar-2: #0E2544; --on-bar: #EEF3FA; --on-bar-muted: #94A6BF;
    --primary: #D3E2F8; --primary-hover: #E7EFFB; --on-primary: #0B2545;
    --amber: #F29A52; --amber-soft: #3A2412; --amber-ink: #F7B27A;
    --ok: #43C584; --ok-soft: #102E1F; --idle: #93B2DE; --idle-soft: #16243B;
    --warn: #E2AC4A; --warn-soft: #33260D; --bad: #F07272; --bad-soft: #3A1818;
    --focus: #7DA8F0; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.25); --shadow-pop: 0 16px 48px rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0A1220; --surface: #101A2B; --surface-2: #0D1727; --sunken: #0B1422;
  --ink: #E6ECF4; --ink-2: #BAC6D6; --muted: #8B99AD; --line: #1E2B40; --line-strong: #2D3D58;
  --bar: #07172D; --bar-2: #0E2544; --on-bar: #EEF3FA; --on-bar-muted: #94A6BF;
  --primary: #D3E2F8; --primary-hover: #E7EFFB; --on-primary: #0B2545;
  --amber: #F29A52; --amber-soft: #3A2412; --amber-ink: #F7B27A;
  --ok: #43C584; --ok-soft: #102E1F; --idle: #93B2DE; --idle-soft: #16243B;
  --warn: #E2AC4A; --warn-soft: #33260D; --bad: #F07272; --bad-soft: #3A1818;
  --focus: #7DA8F0; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.25); --shadow-pop: 0 16px 48px rgba(0,0,0,.55);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 15px/1.55 var(--f-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--f-display); font-stretch: 112%; font-weight: 650; letter-spacing: -.01em; line-height: 1.15; margin: 0; text-wrap: balance; color: var(--ink); }
h1 { font-size: 28px; } h2 { font-size: 19px; } h3 { font-size: 15.5px; font-weight: 600; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
code, .mono { font-family: var(--f-mono); font-size: .92em; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 26px; height: 26px; stroke-width: 1.5; }

/* ── top bar ─────────────────────────────────────────────────────────────── */
.bar { background: var(--bar); color: var(--on-bar); position: sticky; top: 0; z-index: 20; }
.bar-inner { max-width: 1180px; margin: 0 auto; padding-inline: 24px; display: flex; align-items: center; gap: 20px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--on-bar); flex: none; }
.brand svg { width: 30px; height: 30px; }
.brand b { font-family: var(--f-display); font-stretch: 118%; font-weight: 700; font-size: 16px; letter-spacing: .01em; }
.brand span { color: var(--on-bar-muted); font-size: 12.5px; border-left: 1px solid var(--bar-2); padding-left: 10px; }
.tabs { display: flex; gap: 2px; align-self: stretch; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; align-items: center; gap: 7px; padding: 0 12px; color: var(--on-bar-muted); text-decoration: none; font-weight: 500; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--on-bar); }
.tab[aria-current="page"] { color: var(--on-bar); border-bottom-color: var(--on-bar); }
.tab-sep { width: 1px; background: var(--bar-2); margin: 16px 6px; flex: none; }
.me { position: relative; flex: none; }
.me-btn { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--bar-2); color: var(--on-bar); border-radius: 999px; padding: 3px 10px 3px 3px; cursor: pointer; }
.me-btn:hover { background: var(--bar-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--on-bar); color: var(--bar); font: 600 12px/1 var(--f-body); letter-spacing: .02em; }
.me-name { font-size: 13.5px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 6px; z-index: 30; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .who b { display: block; font-weight: 600; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 10px; border: 0; background: none; text-align: left; border-radius: var(--r-sm); text-decoration: none; cursor: pointer; font-size: 14px; }
.menu a:hover, .menu button:hover { background: var(--sunken); }

/* ── page ────────────────────────────────────────────────────────────────── */
main > * { min-width: 0; }
main { max-width: 1180px; margin: 0 auto; padding: 32px 24px 64px; display: grid; gap: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 64ch; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-body { padding: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; align-items: start; }
.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ── buttons & fields ────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 500; font-size: 14.5px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--sunken); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13.5px; border-radius: 6px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15.5px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.field { display: grid; gap: 6px; }
.field label { font-weight: 500; font-size: 14px; }
.field .hint { font-size: 13px; color: var(--muted); }
.input, select.input { height: 40px; width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); padding: 0 12px; }
.input:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.input.code { font-family: var(--f-mono); font-size: 22px; letter-spacing: .35em; text-align: center; height: 52px; }
.form { display: grid; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.error { color: var(--bad); background: var(--bad-soft); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.note { background: var(--sunken); border-radius: 8px; padding: 12px 14px; font-size: 13.5px; color: var(--ink-2); display: flex; gap: 10px; align-items: flex-start; }
.note svg { margin-top: 2px; color: var(--muted); }

/* ── status pills ────────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; background: var(--sunken); color: var(--ink-2); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.online { background: var(--ok-soft); color: var(--ok); }
.pill.idle { background: var(--idle-soft); color: var(--idle); }
.pill.offline { background: var(--bad-soft); color: var(--bad); }
.pill.never { background: var(--sunken); color: var(--muted); }
.pill.never::before { background: transparent; border: 1.5px solid currentColor; }
.pill.plain::before { display: none; }
.pill.role-admin { background: var(--amber-soft); color: var(--amber-ink); }
.pill.off { background: var(--bad-soft); color: var(--bad); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.online { background: var(--ok); } .dot.idle { background: var(--idle); } .dot.offline { background: var(--bad); }

/* ── status line (summary, not tiles) ────────────────────────────────────── */
.statusline { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; padding: 14px 20px; font-size: 14px; color: var(--ink-2); }
.statusline b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.statusline .sep { width: 1px; height: 16px; background: var(--line); }

/* ── list rows (devices) ─────────────────────────────────────────────────── */
.list { display: grid; }
.li { display: grid; grid-template-columns: minmax(200px, 1.6fr) minmax(120px, .9fr) minmax(170px, 1.1fr) minmax(90px, .6fr) auto; gap: 16px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li-head { padding-block: 10px; background: var(--surface-2); border-radius: var(--r) var(--r) 0 0; }
.li-head span, th { font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.thing { display: flex; gap: 12px; align-items: center; min-width: 0; }
.thing-ico { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--sunken); color: var(--ink-2); flex: none; }
.thing b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thing small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack { display: grid; gap: 3px; justify-items: start; }
.stack small { color: var(--muted); font-size: 12.5px; }
@media (max-width: 760px) {
  .li { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .li > :nth-child(2), .li > :nth-child(3), .li > :nth-child(4) { grid-column: 1; padding-left: 50px; }
  .li > :last-child { grid-column: 2; grid-row: 1; }
  .li-head { display: none; }
}

/* ── tables (admin) ──────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13.5px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.search { flex: 1; min-width: 180px; max-width: 320px; height: 32px; }

/* ── empty state ─────────────────────────────────────────────────────────── */
.empty { padding: 40px 24px; display: grid; justify-items: center; text-align: center; gap: 10px; }
.empty p { color: var(--muted); max-width: 46ch; }

/* ── address translator ──────────────────────────────────────────────────── */
.xlate { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) auto minmax(180px, 1fr); gap: 12px; align-items: end; }
.xlate .arrow { height: 40px; display: grid; place-items: center; color: var(--muted); }
.xlate-out { height: 40px; border-radius: 8px; background: var(--sunken); display: flex; align-items: center; justify-content: space-between; padding: 0 6px 0 12px; font-family: var(--f-mono); font-size: 16px; font-weight: 500; }
@media (max-width: 760px) { .xlate { grid-template-columns: 1fr; } .xlate .arrow { height: auto; transform: rotate(90deg); } }

/* ── wizard ──────────────────────────────────────────────────────────────── */
.wizard { display: grid; grid-template-columns: 240px 1fr; gap: 32px; align-items: start; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; counter-reset: s; position: sticky; top: 88px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 14px; }
.steps li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-strong); font: 600 12.5px/1 var(--f-mono); flex: none; }
.steps li[data-state="current"] { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.steps li[data-state="current"]::before { border-color: var(--ink); background: var(--ink); color: var(--surface); }
.steps li[data-state="done"] { color: var(--ink-2); }
.steps li[data-state="done"]::before { content: "✓"; border-color: var(--ok); background: var(--ok); color: #fff; }
.wiz-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 22px; box-shadow: var(--shadow); }
.wiz-card > header p { color: var(--muted); margin-top: 6px; }
.platforms { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.platform { position: relative; display: grid; gap: 10px; justify-items: start; text-align: left; padding: 16px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .12s, transform .12s; }
.platform:hover { border-color: var(--line-strong); }
.platform[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--sunken); }
.platform b { font-weight: 600; }
.platform small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.platform .tag { position: absolute; top: 10px; right: 10px; font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--amber-ink); background: var(--amber-soft); padding: 2px 7px; border-radius: 999px; }
.howto { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; counter-reset: h; }
.howto li { counter-increment: h; position: relative; padding-left: 38px; min-height: 26px; line-height: 1.9; }
.howto li::before { content: counter(h); position: absolute; left: 0; top: 3px; width: 24px; height: 24px; border-radius: 6px; background: var(--sunken); display: grid; place-items: center; font: 600 12.5px/1 var(--f-mono); color: var(--ink-2); }
.kbd { font-family: var(--f-body); font-weight: 600; background: var(--sunken); border: 1px solid var(--line); border-bottom-width: 2px; padding: 0 6px; border-radius: 5px; font-size: 13px; white-space: nowrap; }
.deliver { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: start; }
.qr { width: 232px; height: 232px; background: var(--qr-bg); border-radius: 12px; padding: 8px; border: 1px solid var(--line); }
.qr svg { width: 100%; height: 100%; display: block; }
.qr svg path { fill: var(--qr-ink); }
.conf { background: var(--sunken); border-radius: 8px; padding: 14px 16px; font: 13px/1.6 var(--f-mono); white-space: pre; overflow-x: auto; max-width: 100%; color: var(--ink-2); }
details.more summary { cursor: pointer; color: var(--ink-2); font-weight: 500; font-size: 14px; }
details.more[open] summary { margin-bottom: 10px; }
@media (max-width: 860px) { .wizard { grid-template-columns: 1fr; } .steps { position: static; grid-auto-flow: column; overflow-x: auto; } .steps li { font-size: 0; gap: 0; padding: 6px; } .steps li::before { font-size: 12.5px; } .steps li[data-state="current"] { font-size: 14px; gap: 10px; padding-right: 12px; } }
@media (max-width: 620px) { .deliver { grid-template-columns: 1fr; justify-items: center; } .wiz-card { padding: 20px; } }

/* the tunnel: the one expressive moment */
.tunnel { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; gap: 0; padding: 22px 20px; border-radius: 12px; background: linear-gradient(180deg, var(--bar) 0%, var(--bar-2) 100%); color: var(--on-bar); }
.node { display: grid; justify-items: center; gap: 6px; font-size: 12px; color: var(--on-bar-muted); text-align: center; min-width: 76px; }
.node .ring { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--on-bar-muted); color: var(--on-bar); background: var(--bar); }
.node b { color: var(--on-bar); font-weight: 600; font-size: 12.5px; }
.node code { font-size: 11.5px; color: var(--on-bar-muted); }
.wire { height: 2px; position: relative; margin-bottom: 36px; background-image: linear-gradient(90deg, var(--on-bar-muted) 50%, transparent 50%); background-size: 10px 2px; opacity: .55; }
.wire::after { content: ""; position: absolute; top: -3px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 12px var(--amber); animation: travel 1.8s ease-in-out infinite; }
.tunnel[data-state="live"] .wire { background: var(--ok); opacity: 1; }
.tunnel[data-state="live"] .wire::after { display: none; }
.tunnel[data-state="live"] .node .ring { border-color: var(--ok); }
.tunnel-status { grid-column: 1 / -1; margin-top: 16px; display: flex; gap: 10px; align-items: baseline; justify-content: center; font-weight: 500; color: var(--on-bar); text-align: center; }
.tunnel-status .pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); animation: pulse 1.4s ease-in-out infinite; flex: none; }
.tunnel[data-state="live"] .tunnel-status .pulse { background: var(--ok); animation: none; }
@keyframes travel { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: calc(100% - 8px); opacity: 0; } }
@keyframes pulse { 50% { transform: scale(1.6); opacity: .45; } }
@media (max-width: 520px) { .node { min-width: 58px; } .node code { display: none; } }

/* ── dialogs & toasts ────────────────────────────────────────────────────── */
dialog { border: 0; padding: 0; border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(7, 18, 36, .5); }
.dlg { padding: 24px; display: grid; gap: 18px; }
.dlg p { color: var(--ink-2); }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(440px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--surface); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-pop); font-size: 14px; display: flex; gap: 10px; align-items: center; animation: rise .2s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.copyline { display: flex; gap: 8px; align-items: center; background: var(--sunken); border-radius: 8px; padding: 6px 6px 6px 12px; }
.copyline code { flex: 1; overflow-x: auto; white-space: nowrap; font-size: 13px; }

/* ── auth screens ────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-brand { background: linear-gradient(170deg, #0B2545 0%, #102E57 55%, #1B3868 100%); color: #F2F6FB; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; position: relative; overflow: hidden; }
.auth-brand::after { content: ""; position: absolute; left: 0; right: 0; bottom: 118px; height: 1px; background: linear-gradient(90deg, transparent, #E27D2F 30%, #F4B37A 50%, #E27D2F 70%, transparent); opacity: .7; }
.auth-brand .brand b { font-size: 18px; }
.auth-brand h1 { color: #F2F6FB; font-size: clamp(30px, 3.4vw, 44px); font-stretch: 118%; font-weight: 700; max-width: 16ch; line-height: 1.08; }
.auth-brand p { color: #B4C3D8; max-width: 44ch; margin-top: 14px; font-size: 16px; }
.sitecodes { display: flex; flex-wrap: wrap; gap: 8px; font: 500 12px/1 var(--f-mono); color: #C9D6E8; }
.sitecodes span { border: 1px solid rgba(201, 214, 232, .28); padding: 6px 9px; border-radius: 6px; display: inline-flex; gap: 7px; align-items: center; }
.sitecodes span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #43C584; }
.sitecodes span.off::before { background: #7F8EA3; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--ground); }
.auth-card { width: min(400px, 100%); display: grid; gap: 22px; }
.auth-card header p { color: var(--muted); margin-top: 8px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.ms-btn { background: var(--surface); }
.ms-mark { width: 18px; height: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.ms-mark i { display: block; background: var(--ink-2); }
.enrol { display: grid; grid-template-columns: 160px 1fr; gap: 18px; align-items: center; }
.enrol .qr { width: 160px; height: 160px; padding: 6px; }
@media (max-width: 880px) { .auth { grid-template-columns: 1fr; } .auth-brand { padding: 28px 24px; gap: 24px; } .auth-brand::after { bottom: 0; } .auth-brand h1 { font-size: 28px; } .sitecodes { display: none; } }
@media (max-width: 480px) { .enrol { grid-template-columns: 1fr; justify-items: center; } main { padding: 22px 16px 48px; } .bar-inner { padding-inline: 16px; gap: 12px; } .brand span, .brand b, .me-name { display: none; } .tab { padding: 0 9px; } h1 { font-size: 24px; } }

.demo-banner { background: var(--amber-soft); color: var(--amber-ink); font-size: 13px; text-align: center; padding: 7px 16px; }
.demo-banner b { font-weight: 600; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── small layout helpers & lists ────────────────────────────────────────── */
.spacer { flex: 1; }
.field.grow { flex: 1; min-width: 180px; }
.row > .field { min-width: 110px; }
dl.reach, dl.kv { margin: 0; display: grid; grid-template-columns: minmax(130px, auto) 1fr; gap: 12px 18px; }
dl.reach dt, dl.kv dt { color: var(--muted); font-size: 13.5px; padding-top: 2px; }
dl.reach dd, dl.kv dd { margin: 0; display: grid; gap: 2px; justify-items: start; min-width: 0; overflow-wrap: anywhere; }
dl.kv dd { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
@media (max-width: 480px) { dl.reach, dl.kv { grid-template-columns: 1fr; gap: 2px; } dl.reach dd, dl.kv dd { margin-bottom: 10px; } }
ul.tips { margin: 0; padding-left: 18px; display: grid; gap: 10px; color: var(--ink-2); font-size: 14.5px; }
ul.tips li::marker { color: var(--amber); }
.rowmenu { position: relative; display: inline-block; }
.rowmenu summary { list-style: none; }
.rowmenu summary::-webkit-details-marker { display: none; }
.rowmenu .menu { top: 36px; }
.rowmenu .menu .danger { color: var(--bad); }
.panel-body > .note + .form, .panel-body > .error + .form { margin-top: 14px; }
.panel-body > .note { margin-bottom: 4px; }
