/* WiFiPilot — clean operator dashboard.
   White sidebar with grouped navigation, soft blue-grey canvas, blue primary,
   colored icon tiles on stat cards. Light and dark themes via tokens. */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e6eaf2;
  --line-2: #d4dbe8;
  --primary: #2563eb;
  --primary-ink: #ffffff;
  --primary-hover: #1d4ed8;
  --primary-soft: #eaf1ff;
  --side: #ffffff;
  --side-ink: #334155;
  --side-muted: #94a3b8;
  --side-hover: #f1f5fb;
  --ok: #15803d;   --ok-bg: #e7f7ed;
  --warn: #a16207; --warn-bg: #fdf4dc;
  --err: #c0262d;  --err-bg: #fdecec;
  --info: #1d4ed8; --info-bg: #e8effd;
  --sim: #6b21a8;  --sim-bg: #f3e8fd;
  --violet: #7c3aed; --violet-bg: #f1eafe;
  --cyan: #0891b2;   --cyan-bg: #e0f6fa;
  --green: #16a34a;  --green-bg: #e5f7ec;
  --amber: #d97706;  --amber-bg: #fdf1df;
  --bar-revenue: #3b82f6;
  --bar-usage: #06b6d4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(15, 23, 42, .05);
  --focus: 0 0 0 3px rgba(37, 99, 235, .35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --side-w: 256px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120; --surface: #111a2e; --surface-2: #0f1729; --ink: #e6ebf5; --ink-2: #c4cddc; --muted: #8a97ad;
    --line: #1e2a44; --line-2: #2b3a5c; --primary: #4f8cff; --primary-hover: #6ea1ff; --primary-soft: #182a4f;
    --side: #0f1729; --side-ink: #c4cddc; --side-muted: #64748b; --side-hover: #16213a;
    --ok: #4ade80; --ok-bg: #12301f; --warn: #fbbf24; --warn-bg: #33270b; --err: #f87171; --err-bg: #3a1618;
    --info: #93b4ff; --info-bg: #172647; --sim: #d8b4fe; --sim-bg: #2b1a40;
    --violet: #a78bfa; --violet-bg: #251c45; --cyan: #22d3ee; --cyan-bg: #0e2e36; --green: #4ade80; --green-bg: #12301f; --amber: #fbbf24; --amber-bg: #33270b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120; --surface: #111a2e; --surface-2: #0f1729; --ink: #e6ebf5; --ink-2: #c4cddc; --muted: #8a97ad;
  --line: #1e2a44; --line-2: #2b3a5c; --primary: #4f8cff; --primary-hover: #6ea1ff; --primary-soft: #182a4f;
  --side: #0f1729; --side-ink: #c4cddc; --side-muted: #64748b; --side-hover: #16213a;
  --ok: #4ade80; --ok-bg: #12301f; --warn: #fbbf24; --warn-bg: #33270b; --err: #f87171; --err-bg: #3a1618;
  --info: #93b4ff; --info-bg: #172647; --sim: #d8b4fe; --sim-bg: #2b1a40;
  --violet: #a78bfa; --violet-bg: #251c45; --cyan: #22d3ee; --cyan-bg: #0e2e36; --green: #4ade80; --green-bg: #12301f; --amber: #fbbf24; --amber-bg: #33270b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; margin-top: 1rem; }
code { font: .85em/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 6px; overflow-wrap: anywhere; }
.small { font-size: .85rem; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

/* ---------- Shell ---------- */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--side); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 16px 12px; z-index: 30; }
.brand a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 4px 8px 18px; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; background: var(--primary); display: grid; place-items: center; flex: none; }
.brand-mark .brand-icon { stroke: #fff; width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; font-weight: 800; font-size: 1.12rem; line-height: 1.1; }
.brand-text small { font-weight: 500; font-size: .72rem; color: var(--muted); margin-top: 2px; }
.brand-icon { width: 26px; height: 26px; stroke: var(--primary); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-group { margin-bottom: 10px; }
.nav-label { margin: 10px 12px 4px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--side-muted); }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a, .nav-btn { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--side-ink); text-decoration: none; font-weight: 500; font-size: .93rem; }
.nav a:hover, .nav-btn:hover { background: var(--side-hover); color: var(--ink); }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a.active .icon { stroke: var(--primary); }
.nav-btn { width: 100%; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 10px; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px clamp(16px, 3vw, 32px); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.org { display: flex; align-items: center; gap: 10px; min-width: 0; }
.org-badge { width: 32px; height: 32px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: .82rem; flex: none; }
.org-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { font-size: .72rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 8px; text-transform: capitalize; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { color: var(--primary); border-color: var(--line-2); }
.menu-btn { display: none; }
.theme-btn .icon-sun { display: none; }
:root[data-theme="dark"] .theme-btn .icon-sun { display: block; }
:root[data-theme="dark"] .theme-btn .icon-moon { display: none; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; text-decoration: none; }
.avatar:hover { color: #fff; filter: brightness(1.08); }
.scrim { display: none; }
.main { padding: 24px clamp(16px, 3vw, 32px) 64px; max-width: 1320px; width: 100%; outline: none; }

/* ---------- Page header ---------- */
.page-head { margin-bottom: 20px; }
.page-head-row { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.subtitle { color: var(--muted); margin: 4px 0 0; max-width: 75ch; }
.back { display: inline-block; margin-bottom: 6px; font-size: .9rem; text-decoration: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter { display: flex; gap: 8px; align-items: center; }
.filter label { white-space: nowrap; }
.filter select { min-width: 180px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-title-pad { padding: 16px 20px 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.form-card { max-width: 780px; }
.danger-zone { border-color: color-mix(in srgb, var(--err) 25%, var(--line)); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-2.gap { gap: 18px; }
.grid-2.gap > .card { margin-bottom: 0; }
.grid-2.gap { margin-bottom: 18px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-main .form-card { max-width: none; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stats-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
a.stat:hover { border-color: var(--primary); color: var(--ink); }
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-l { font-weight: 600; color: var(--muted); font-size: .88rem; }
.stat-n { font-size: 1.75rem; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.stat-s { color: var(--muted); font-size: .8rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stat-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.stat-ico .icon { width: 21px; height: 21px; }
.tone-violet { background: var(--violet-bg); color: var(--violet); }
.tone-cyan { background: var(--cyan-bg); color: var(--cyan); }
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-amber { background: var(--amber-bg); color: var(--amber); }
.trend { font-weight: 700; font-size: .76rem; border-radius: 999px; padding: 1px 7px; }
.trend.up { color: var(--ok); background: var(--ok-bg); }
.trend.down { color: var(--err); background: var(--err-bg); }
.trend.flat { color: var(--muted); background: var(--surface-2); }
.setup h2 { margin-bottom: 0; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: center; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: inline-grid; place-items: center; font-size: .75rem; color: #fff; flex: none; }
.checklist li.done .tick { background: var(--primary); border-color: var(--primary); }
.checklist li.done a { color: var(--muted); text-decoration: line-through; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.chart-revenue .bar { fill: var(--bar-revenue); }
.chart-usage .bar { fill: var(--bar-usage); }
.chart .bar:hover { opacity: .8; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list.compact li { padding: 6px 0; justify-content: flex-start; }
.list-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dot-status { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); flex: none; }
.dot-status.ok { background: var(--green); }
.dot-status.error { background: var(--err); }
.dot-status.stale { background: var(--amber); }
.plain { padding-left: 1.2rem; }
.plain li { margin-bottom: 6px; }
.kv { margin: 0; display: grid; gap: 8px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.kv-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); column-gap: 24px; }
.iface { list-style: none; padding: 0; columns: 2; margin: 8px 0 0; }
.iface li { margin-bottom: 4px; }
.stack { display: inline-flex; flex-direction: column; }
.steps-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px 16px 40px; margin: 0 0 18px; box-shadow: var(--shadow); }
.steps-list li { margin: 4px 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; background: var(--surface-2); padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions > * { margin-left: 6px; }
.details { white-space: pre-wrap; word-break: break-all; display: inline-block; max-width: 420px; }
.code { font: 600 .92rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; text-decoration: none; }
.code-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.code-grid li { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }

/* ---------- Toolbar, tabs, search ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 14px; width: fit-content; flex-wrap: wrap; }
.toolbar .tabs { margin-bottom: 0; }
.tab { padding: 6px 14px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { background: var(--surface-2); color: var(--ink); }
.tab.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tab .count { font-size: .74rem; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 0 7px; }
.tab.active .count { background: var(--surface); color: var(--primary); }
.search { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search input[type=search] { min-width: 220px; }
.search select { width: auto; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 10px; padding: 9px 16px; font: 600 .9rem/1.2 var(--font); border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover { filter: brightness(.92); color: #fff; }
.btn-block { width: 100%; padding: 12px; }
.btn:disabled, fieldset:disabled .btn { opacity: .55; cursor: not-allowed; }
.inline-form { display: inline; }
.link-btn { background: none; border: 0; color: var(--primary); font: inherit; cursor: pointer; padding: 0; }

/* ---------- Forms ---------- */
fieldset { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
fieldset fieldset { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 6px; }
legend { font-weight: 700; padding: 0; margin-bottom: 8px; font-size: 1rem; }
fieldset fieldset legend { float: left; width: 100%; padding-top: 4px; }
fieldset fieldset legend + * { clear: both; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; }
.req { color: var(--err); }
.opt { font-weight: 400; color: var(--muted); font-size: .82rem; }
input:not([type=checkbox]):not([type=color]):not([type=radio]), select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 9px 12px; min-height: 42px;
}
textarea { resize: vertical; }
textarea.script { font: .8rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); white-space: pre; overflow-wrap: normal; overflow-x: auto; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { background: var(--surface-2); color: var(--muted); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--err); }
.hint { margin: 5px 0 0; color: var(--muted); font-size: .84rem; }
.error { margin: 5px 0 0; color: var(--err); font-size: .86rem; font-weight: 500; }
.field-check .check, label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.field-check input, label.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.inline-grid { display: grid; grid-template-columns: 2fr 1.4fr 1.2fr auto; gap: 0 12px; align-items: end; }
.field-btn { align-self: end; }
.color-row { display: flex; gap: 8px; }
.color-row input[type=color] { width: 48px; height: 42px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); flex: none; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.choice { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.choice:hover { border-color: var(--primary); color: var(--ink); }
.choice-featured { border-color: var(--primary); background: linear-gradient(180deg, var(--primary-soft), var(--surface) 70%); }
.choice span:last-child { color: var(--muted); font-size: .9rem; }
.disclosure { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin: 8px 0 14px; }
.disclosure summary { cursor: pointer; font-weight: 600; }
.disclosure[open] summary { margin-bottom: 12px; }

/* ---------- Badges & notices ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; border: 1px solid transparent; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-error { background: var(--err-bg); color: var(--err); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--surface-2); color: var(--ink-2); border-color: var(--line); }
.badge-sim { background: var(--sim-bg); color: var(--sim); border-style: dashed; border-color: color-mix(in srgb, var(--sim) 40%, transparent); }
.flash { border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; font-weight: 500; }
.flash-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); }
.flash-error { background: var(--err-bg); color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 25%, transparent); }
.notice { border-radius: var(--radius-sm); padding: 10px 12px; margin: 0 0 12px; font-size: .92rem; }
.notice ul { margin: 6px 0 0; padding-left: 1.2rem; }
.notice-warn { background: var(--warn-bg); color: var(--warn); }
.notice-error { background: var(--err-bg); color: var(--err); }
.notice-info { background: var(--info-bg); color: var(--info); }
.notice-sim { background: var(--sim-bg); color: var(--sim); border: 1px dashed color-mix(in srgb, var(--sim) 40%, transparent); }
.legend { display: flex; gap: 8px; flex-wrap: wrap; }
.empty { text-align: center; padding: 44px 20px; }
.empty h2 { font-size: 1.1rem; }
.empty p { color: var(--muted); max-width: 52ch; margin: 0 auto 16px; }
.fp { font-size: .78rem; word-break: break-all; }
.tls { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 4px; }
.ticket { text-align: center; border: 2px dashed var(--primary); }
.big-code { font: 800 2.2rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; margin: 6px 0; color: var(--primary); }

/* ---------- Packages ---------- */
.pkg header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.pkg h2 { margin: 0; font-size: 1.05rem; }
.pkg h2 a { color: var(--ink); text-decoration: none; }
.price { font-weight: 800; color: var(--primary); margin: 0; font-size: 1.15rem; white-space: nowrap; }

/* ---------- Portal studio ---------- */
.studio { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.studio-preview { position: sticky; top: 76px; }
.phone { border: 10px solid #1d2433; border-radius: 30px; overflow: hidden; background: #f3f6f5; max-width: 380px; margin: 0 auto 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.phone iframe { display: block; width: 100%; height: 600px; border: 0; background: #f3f6f5; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--surface) 30%); padding: 14px 0 4px; }
.pipeline { list-style: none; display: flex; gap: 0; padding: 0; margin: 0 0 18px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.step { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; font-size: .9rem; padding: 4px 18px 4px 0; position: relative; }
.step + .step::before { content: ""; width: 22px; height: 2px; background: var(--line-2); margin-right: 4px; }
.step .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); }
.step-done { color: var(--ink-2); }
.step-done .dot { background: var(--primary); border-color: var(--primary); }
.step-current { color: var(--ink); font-weight: 700; }
.step-current .dot { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.step-failed { color: var(--err); font-weight: 700; }
.step-failed .dot { background: var(--err); border-color: var(--err); }
.events { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.ev { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ev-step { font-weight: 600; color: var(--ink-2); text-transform: capitalize; }
.ev-warn .ev-msg { color: var(--warn); }
.ev-error .ev-msg { color: var(--err); font-weight: 500; }
.ev time { color: var(--muted); font-size: .8rem; white-space: nowrap; }

/* ---------- Auth ---------- */
.auth-body { min-height: 100vh; }
.auth-split { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(0, 1.1fr); min-height: 100vh; }
.auth-hero { background: linear-gradient(150deg, #1e40af, #2563eb 55%, #0ea5e9); color: #fff; padding: 48px clamp(24px, 5vw, 64px); display: flex; flex-direction: column; justify-content: center; }
.auth-hero h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1.15; margin: 28px 0 12px; letter-spacing: -.02em; }
.auth-hero p { opacity: .9; max-width: 44ch; font-size: 1.02rem; }
.auth-hero .auth-brand { color: #fff; }
.auth-hero .brand-icon { stroke: #fff; }
.auth-points { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.auth-points .icon { width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: rgba(255,255,255,.16); }
.auth-wrap { max-width: 520px; width: 100%; margin: 0 auto; padding: 48px 20px; align-self: center; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.3rem; color: var(--ink); }
.auth-brand-sm { display: none; margin-bottom: 18px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 30px; box-shadow: var(--shadow); max-width: 440px; }
.auth-card-wide { max-width: 560px; }
.auth-card fieldset { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.auth-switch { margin: 16px 0 0; color: var(--muted); }
.auth-foot { color: var(--muted); font-size: .85rem; margin-top: 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .studio, .grid-main { grid-template-columns: 1fr; }
  .studio-preview { position: static; }
  .inline-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px); transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
  .nav-toggle:checked ~ .shell .sidebar { transform: none; }
  .nav-toggle:checked ~ .shell .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 25; }
  .menu-btn { display: inline-grid; }
  .chip { display: none; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-brand-sm { display: flex; }
}
@media (max-width: 720px) {
  .main { padding: 18px 16px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2.gap > .card { margin-bottom: 0; }
  .inline-grid { grid-template-columns: 1fr; }
  .search input[type=search] { min-width: 0; flex: 1; }
  .filter select { min-width: 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table td { border: 0; padding: 4px 16px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; text-align: left; }
  .row-actions { justify-content: flex-end !important; }
  .ev { grid-template-columns: 1fr; gap: 2px; }
  .phone iframe { height: 520px; }
  .stat-n { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- Add-router wizard (NettPortal-style modal) ---------- */
.wz-backdrop { min-height: calc(100vh - 140px); display: grid; place-items: start center; padding: 8px 0 40px; }
.wz { width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px rgba(15, 23, 42, .18); padding: 22px 22px 18px; }
.wz-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 6px; }
.wz-head h1 { font-size: 1.3rem; margin: 0; }
.wz-head p { margin: 2px 0 0; font-size: .88rem; }
.wz-head .icon-btn { text-decoration: none; flex: none; }
.wz-steps { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 14px 24px 18px; margin: 0; }
.wz-steps li { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: .85rem; color: var(--muted); }
.wz-steps li span:last-child { display: flex; flex-direction: column; }
.wz-steps small { font-size: .72rem; }
.wz-steps .wz-line { flex: 1; height: 2px; background: var(--line-2); margin: 0 10px 34px; }
.wz-steps .wz-line.done { background: var(--green); }
.wz-dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; border: 2px solid var(--line-2); background: var(--surface); color: var(--muted); }
.wz-steps li.current { color: var(--ink); }
.wz-steps li.current .wz-dot { border-color: var(--green); color: var(--green); box-shadow: 0 0 0 4px var(--green-bg); }
.wz-steps li.done .wz-dot { background: var(--green); border-color: var(--green); color: #fff; }
.wz-form .lbl { font-weight: 600; font-size: .88rem; margin-bottom: 6px; float: none; padding: 0; }
.wz-form fieldset.field { border: 0; padding: 0; margin: 0 0 14px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { position: relative; display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line-2); border-radius: 12px; padding: 12px 14px; cursor: pointer; background: var(--surface-2); }
.tile input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--green); flex: none; }
.tile:not(.tile-check) input { position: absolute; opacity: 0; }
.tile:not(.tile-check) span { width: 100%; text-align: center; }
.tile span { display: flex; flex-direction: column; gap: 2px; }
.tile small { color: var(--muted); font-size: .76rem; }
.tile small.net { opacity: .8; }
.tile:has(input:checked) { border-color: var(--green); background: var(--green-bg); }
.tile:has(input:checked) strong { color: var(--green); }
.tile:has(input:focus-visible) { box-shadow: var(--focus); }
.tile-wide { margin-top: 10px; }
.segs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.seg { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 10px 6px; border: 1.5px solid var(--line-2); border-radius: 10px; font-weight: 600; font-size: .82rem; background: var(--surface-2); }
.seg input:checked + span { border-color: var(--green); color: var(--green); background: var(--green-bg); }
.seg input:focus-visible + span { box-shadow: var(--focus); }
.wz-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.wz-foot form { display: contents; }
.wz-foot .btn { width: 100%; padding: 12px; }
.wz-foot .btn-primary { background: var(--green); }
.wz-foot .btn-primary:hover { filter: brightness(.95); background: var(--green); }
.wz-foot .is-waiting { background: var(--line-2); color: var(--muted); pointer-events: none; }
.wz-router { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; }
.wz-other { text-align: center; margin: 14px 0 0; }
.wz-panel { border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.wz-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.wz-panel h2 { margin: 0; font-size: 1rem; color: var(--green); }
.wz-panel p { margin: 2px 0 0; }
.cmd { border: 1px solid color-mix(in srgb, var(--green) 35%, var(--line)); border-radius: 12px; overflow: hidden; margin-bottom: 8px; }
.cmd-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--surface); }
.cmd-text { border: 0 !important; border-radius: 0 !important; font: .8rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace !important; background: var(--surface) !important; resize: none; word-break: break-all; min-height: 120px; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.cmd-head .btn-primary { background: var(--green); }
.wz-status { margin: 0; }
@media (max-width: 640px) {
  .tiles, .segs { grid-template-columns: 1fr 1fr; }
  .wz { padding: 16px 14px; border-radius: 14px; }
}
/* ---------- Setup feature checklist ---------- */
.feature-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.feature-list li { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: var(--surface-2); }
.feature-list li span:last-child { display: flex; flex-direction: column; min-width: 0; }
.feature-list small { color: var(--muted); font-size: .76rem; overflow-wrap: anywhere; }
.feature-list .tick { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; flex: none; background: var(--line); color: var(--muted); }
.feature-list li.on .tick { background: var(--green); color: #fff; }
.notice-ok-soft { background: var(--ok-bg); color: var(--ok); }

/* ---------- Captive portal editor ---------- */
.studio { grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); }
.studio .studio-preview { position: sticky; top: 76px; }
.studio .phone { max-width: 400px; }
.studio .phone iframe { height: 680px; }
.ed-panel { padding: 16px; }
.editor .ed-radio { position: absolute; opacity: 0; pointer-events: none; }
.ed-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 12px; }
.ed-tabs label { padding: 6px 10px; border-radius: 8px; font-size: .82rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.ed-tabs label:hover { background: var(--surface-2); color: var(--ink); }
#ed-template:checked ~ .ed-tabs label[for=ed-template],#ed-text:checked ~ .ed-tabs label[for=ed-text],#ed-background:checked ~ .ed-tabs label[for=ed-background],#ed-fonts:checked ~ .ed-tabs label[for=ed-fonts],#ed-colors:checked ~ .ed-tabs label[for=ed-colors],#ed-button:checked ~ .ed-tabs label[for=ed-button],#ed-settings:checked ~ .ed-tabs label[for=ed-settings] { background: var(--green-bg); color: var(--green); }
.ed-pane { display: none; }
#ed-template:checked ~ .ed-body [data-pane=template],#ed-text:checked ~ .ed-body [data-pane=text],#ed-background:checked ~ .ed-body [data-pane=background],#ed-fonts:checked ~ .ed-body [data-pane=fonts],#ed-colors:checked ~ .ed-body [data-pane=colors],#ed-button:checked ~ .ed-body [data-pane=button],#ed-settings:checked ~ .ed-body [data-pane=settings] { display: block; }
.ed-h { font-weight: 700; margin: 4px 0 8px; }
.ed-body .tiles { margin-bottom: 12px; }
.tiles-3 { grid-template-columns: repeat(3, 1fr); }
.tiles-4 { grid-template-columns: repeat(2, 1fr); }
.ed-body input[type=range] { width: 100%; accent-color: var(--primary); }
.ed-status { margin: 8px 0 0; }
.input-sm { width: 120px !important; min-height: 32px !important; padding: 4px 8px !important; font-size: .8rem !important; display: inline-block; }
@media (max-width: 1080px) { .studio .studio-preview { position: static; } .studio .phone iframe { height: 560px; } }
/* ---------- Tabbed panels (gateways, payment methods) ---------- */
.tabset .tab-radio { position: absolute; opacity: 0; pointer-events: none; }
.gw-tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.gw-tabs label { padding: 9px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; }
.gw-tabs label:hover { color: var(--ink); }
#gt-paystack:checked ~ .gw-tabs label[for=gt-paystack], #gt-hubtel:checked ~ .gw-tabs label[for=gt-hubtel], #gt-wpp:checked ~ .gw-tabs label[for=gt-wpp],
#pt-wpp:checked ~ .gw-tabs label[for=pt-wpp], #pt-paystack:checked ~ .gw-tabs label[for=pt-paystack], #pt-hubtel:checked ~ .gw-tabs label[for=pt-hubtel] { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
#gt-paystack:checked ~ [data-tab=paystack], #gt-hubtel:checked ~ [data-tab=hubtel], #gt-wpp:checked ~ [data-tab=wpp],
#pt-wpp:checked ~ [data-tab=wpp], #pt-paystack:checked ~ [data-tab=paystack], #pt-hubtel:checked ~ [data-tab=hubtel] { display: block; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font: .85rem ui-monospace, Menlo, monospace !important; }