/* MVS Hotspot admin UI — hand-written, no build step.
   Dark (default) and light themes via [data-theme] on <html>. */

/* ------------------------------------------------------------------ tokens */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050a14;
  --bg-glow-1: rgba(22, 94, 255, .16);
  --bg-glow-2: rgba(6, 182, 212, .07);
  --sidebar-bg: rgba(6, 12, 24, .92);
  --surface: rgba(12, 23, 42, .72);
  --surface-solid: #0b1628;
  --surface-2: rgba(19, 36, 64, .55);
  --surface-hover: rgba(30, 58, 102, .45);
  --border: rgba(64, 140, 255, .16);
  --border-strong: rgba(64, 140, 255, .34);
  --text: #e7eefb;
  --text-strong: #ffffff;
  --muted: #8797b3;
  --accent: #2f8cff;
  --accent-2: #22d3ee;
  --accent-hover: #4b9dff;
  --accent-soft: rgba(47, 140, 255, .14);
  --accent-contrast: #ffffff;
  --ok: #2fd27a;
  --ok-soft: rgba(47, 210, 122, .13);
  --warning: #f7b940;
  --warning-soft: rgba(247, 185, 64, .13);
  --critical: #ff5d5d;
  --critical-soft: rgba(255, 93, 93, .13);
  --info: #3ea2ff;
  --info-soft: rgba(62, 162, 255, .13);
  --violet: #8b7bff;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
  --glow: 0 0 0 1px rgba(64, 140, 255, .06), 0 12px 40px -18px rgba(28, 110, 255, .35);
  --skeleton: rgba(120, 160, 230, .08);
  --skeleton-shine: rgba(120, 160, 230, .16);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3fa;
  --bg-glow-1: rgba(47, 140, 255, .10);
  --bg-glow-2: rgba(34, 211, 238, .06);
  --sidebar-bg: rgba(255, 255, 255, .92);
  --surface: rgba(255, 255, 255, .86);
  --surface-solid: #ffffff;
  --surface-2: #f3f7fd;
  --surface-hover: #e8f0fc;
  --border: rgba(30, 80, 160, .13);
  --border-strong: rgba(30, 100, 220, .32);
  --text: #13213a;
  --text-strong: #0a1426;
  --muted: #5b6b85;
  --accent: #1f6fe5;
  --accent-2: #0891b2;
  --accent-hover: #185fc7;
  --accent-soft: rgba(31, 111, 229, .10);
  --ok: #138a4a;
  --ok-soft: rgba(19, 138, 74, .10);
  --warning: #b86e00;
  --warning-soft: rgba(214, 140, 0, .12);
  --critical: #d23a3a;
  --critical-soft: rgba(210, 58, 58, .10);
  --info: #1f6fe5;
  --info-soft: rgba(31, 111, 229, .10);
  --violet: #6a55e8;
  --shadow: 0 8px 24px -14px rgba(20, 40, 80, .25);
  --glow: 0 1px 2px rgba(20, 40, 80, .05), 0 10px 30px -18px rgba(20, 60, 140, .25);
  --skeleton: rgba(30, 80, 160, .07);
  --skeleton-shine: rgba(30, 80, 160, .13);
}

:root {
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 256px;
  --sidebar-w-condensed: 76px;
  --topbar-h: 64px;
  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, Consolas, monospace;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 85% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--bg-glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.02em; color: var(--text-strong); font-weight: 700; }
h2 { font-size: 16px; margin: 0 0 12px; color: var(--text-strong); font-weight: 650; letter-spacing: -.005em; }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); font-size: .92em; }
pre {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; overflow-x: auto; font: 12px/1.65 var(--mono); white-space: pre;
}
kbd {
  font: 600 11px var(--mono); color: var(--muted); padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; color: var(--text-strong); }
.nowrap { white-space: nowrap; }
.text-critical { color: var(--critical); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 600;
}
.skip-link:focus { top: 12px; color: #fff; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.stack { display: grid; gap: 14px; }
.inline { display: inline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------------ sidebar */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
  transition: transform .22s ease, width .22s ease;
}
.brand {
  display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; color: var(--text-strong);
}
.brand:hover { color: var(--text-strong); }
.brand-logo {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 20px -6px rgba(47, 140, 255, .65);
}
.brand-logo .icon { width: 22px; height: 22px; }
.brand-text { display: grid; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.nav-section {
  margin: 16px 10px 6px; font-size: 11px; font-weight: 650; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); opacity: .8;
}
.nav-section:first-child { margin-top: 4px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 8px 12px; border-radius: 10px;
  color: var(--text); font-weight: 500; opacity: .86;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-item .icon { color: var(--muted); transition: color .15s; }
a.nav-item:hover { background: var(--surface-hover); color: var(--text-strong); opacity: 1; }
a.nav-item:hover .icon { color: var(--accent); }
.nav-item.active {
  opacity: 1; color: var(--text-strong);
  background: linear-gradient(90deg, rgba(47, 140, 255, .28), rgba(47, 140, 255, .08));
  border-color: var(--border-strong);
  box-shadow: inset 3px 0 0 var(--accent), 0 6px 20px -12px rgba(47, 140, 255, .7);
}
.nav-item.active .icon { color: var(--accent); }
.nav-item.is-soon { cursor: default; opacity: .5; }
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.soon {
  font-size: 10px; font-weight: 650; letter-spacing: .03em; padding: 1px 6px; border-radius: 99px;
  color: var(--muted); border: 1px solid var(--border);
}
.sidebar-foot { padding: 14px 22px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--border); }
.nav-scrim { display: none; }

/* ------------------------------------------------------------------ shell & topbar */
.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; transition: margin .22s ease; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  height: var(--topbar-h); padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar form { margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 0; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted);
  cursor: pointer; list-style: none; transition: background .15s, color .15s, border-color .15s;
}
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text-strong); border-color: var(--border); }
.nav-open { display: none; }

.search {
  display: flex; align-items: center; gap: 10px; width: min(420px, 100%); height: 42px; padding: 0 10px 0 14px;
  border-radius: 11px; background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: 14px var(--font);
}
.search input::-webkit-calendar-picker-indicator { display: none !important; }

.router-switch {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 4px 0 12px;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--accent);
}
.router-switch select {
  height: 38px; border: 0; background: transparent; color: var(--text); font: 600 13.5px var(--font);
  max-width: 180px; cursor: pointer; padding: 0 6px;
}
.router-switch select:focus-visible { outline: none; }
.router-switch:focus-within { border-color: var(--border-strong); }
.router-switch option { background: var(--surface-solid); color: var(--text); }

.theme-toggle .theme-icon-light { display: none; }
:root[data-theme="light"] .theme-toggle .theme-icon-light { display: contents; }
:root[data-theme="light"] .theme-toggle .theme-icon-dark { display: none; }
.theme-toggle span { display: contents; }

.notif-slot { display: contents; }
.badge-count {
  position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 99px;
  background: var(--critical); color: #fff; font: 700 10.5px/1 var(--font);
  box-shadow: 0 0 0 2px var(--bg);
}

.account { display: flex; align-items: center; gap: 10px; padding: 0 6px 0 10px; margin-left: 4px; border-left: 1px solid var(--border); }
.avatar {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, rgba(47, 140, 255, .35), rgba(34, 211, 238, .25));
  border: 1px solid var(--border-strong); color: var(--text-strong); font-weight: 700; font-size: 13px;
}
.account-meta { display: grid; line-height: 1.15; gap: 3px; }
.account-meta strong { color: var(--text-strong); font-size: 13.5px; }
.role-badge {
  justify-self: start; font-size: 10.5px; font-weight: 650; padding: 1px 8px; border-radius: 99px;
  color: var(--ok); background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
}

/* dropdown (notifications) */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown-panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 50; width: min(380px, calc(100vw - 24px));
  padding: 14px; border-radius: var(--radius);
  background: var(--surface-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow), var(--glow);
}
.dropdown-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; padding: 0 4px; }
.dropdown-head strong { color: var(--text-strong); }

/* ------------------------------------------------------------------ content */
.content { flex: 1; width: 100%; max-width: 1560px; padding: 26px 28px 40px; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.datetime {
  display: flex; align-items: center; gap: 12px; min-width: 230px; padding: 10px 16px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--accent);
}
.datetime .icon { width: 22px; height: 22px; }
.datetime div { display: grid; line-height: 1.35; font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }

/* cards & panels */
.card, .panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--glow); backdrop-filter: blur(12px);
}
.card { padding: 22px; margin-bottom: 18px; }
.card.empty { text-align: center; padding: 44px 20px; }
.card.empty .btn { margin-top: 10px; }

.panel { display: flex; flex-direction: column; min-width: 0; padding: 18px 18px 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; min-height: 32px; }
.panel-head h2 { margin: 0; display: flex; align-items: center; gap: 9px; }
.panel-body { flex: 1; min-width: 0; }
.panel-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; margin-top: 14px; }
.panel-note { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.panel-note .icon { width: 14px; height: 14px; }
.api-result:not(:empty) { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 12.5px; }
.link-soon { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; cursor: default; opacity: .7; }
.link-soon .icon { width: 14px; height: 14px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text-strong); }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; }
.btn-primary {
  color: var(--accent-contrast); border-color: transparent;
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
  box-shadow: 0 8px 22px -10px rgba(47, 140, 255, .8);
}
.btn-primary:hover { color: #fff; border-color: transparent; background: linear-gradient(180deg, #5eaaff, var(--accent-hover)); }
.btn-outline { color: var(--accent); border-color: var(--border-strong); background: var(--accent-soft); }
.btn-danger { color: #fff; border-color: transparent; background: var(--critical); }
.btn-danger:hover { color: #fff; background: color-mix(in srgb, var(--critical) 88%, #000); border-color: transparent; }
.btn-danger-ghost { color: var(--critical); background: transparent; }
.btn-danger-ghost:hover { color: var(--critical); background: var(--critical-soft); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { min-height: 48px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; padding: 0; }
.btn.is-disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.is-disabled:active { transform: none; }
.btn.htmx-request { opacity: .6; pointer-events: none; }

.select-sm {
  height: 32px; padding: 0 30px 0 12px; border-radius: 9px; font: 600 12.5px var(--font);
  border: 1px solid var(--border); background-color: var(--surface-2); color: var(--text); cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238797b3' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 14px;
}
.select-sm option { background: var(--surface-solid); }

/* badges, pills, status */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 650;
  color: var(--accent); background: var(--accent-soft);
}
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 7px; font: 700 11px var(--font); letter-spacing: .05em; text-transform: uppercase; }
.pill-ok { color: var(--ok); background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.pill-critical { color: var(--critical); background: var(--critical-soft); border: 1px solid color-mix(in srgb, var(--critical) 35%, transparent); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; margin-right: 6px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-ok { color: var(--ok); }
.status-error { color: var(--critical); }
.status-muted { color: var(--muted); }
.trend { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 7px; font-weight: 700; font-size: 12px; }
.trend .icon { width: 13px; height: 13px; }
.trend-up { color: var(--ok); background: var(--ok-soft); }
.trend-down { color: var(--critical); background: var(--critical-soft); }

.alert { padding: 12px 15px; border-radius: var(--radius-sm); margin-bottom: 18px; border: 1px solid transparent; }
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.alert-error { background: var(--critical-soft); color: var(--critical); border-color: color-mix(in srgb, var(--critical) 28%, transparent); }

/* ------------------------------------------------------------------ dashboard */
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.stat-card {
  position: relative; display: flex; align-items: center; gap: 16px; min-height: 108px; padding: 18px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--glow); color: var(--text); backdrop-filter: blur(12px);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
a.stat-card:hover, .stat-card:not(.is-loading):hover {
  color: var(--text); border-color: var(--border-strong); transform: translateY(-2px);
  box-shadow: var(--glow), 0 14px 34px -18px rgba(47, 140, 255, .55);
}
.stat-icon {
  display: grid; place-items: center; width: 54px; height: 54px; flex: none; border-radius: 14px;
  border: 1px solid currentColor;
}
.stat-icon .icon { width: 26px; height: 26px; }
.tone-blue { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.tone-cyan { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 13%, transparent); border-color: color-mix(in srgb, var(--accent-2) 30%, transparent); }
.tone-green { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.tone-violet { color: var(--violet); background: color-mix(in srgb, var(--violet) 14%, transparent); border-color: color-mix(in srgb, var(--violet) 30%, transparent); }
.stat-body { display: grid; gap: 3px; min-width: 0; flex: 1; }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.stat-value {
  color: var(--text-strong); font-size: clamp(19px, 1.5vw, 24px); font-weight: 750; line-height: 1.2; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.stat-value-compact { font-size: clamp(15px, 1.05vw, 19px); white-space: nowrap; overflow-wrap: normal; line-height: 1.6; }
.stat-sep { color: var(--muted); font-weight: 500; }
.stat-sub { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
a.stat-card { padding-right: 34px; }
.stat-arrow { position: absolute; right: 12px; top: 50%; margin-top: -9px; display: flex; color: var(--muted); transition: transform .18s, color .18s; }
a.stat-card:hover .stat-arrow { color: var(--accent); transform: translateX(3px); }

.dash-grid {
  display: grid; gap: 18px; margin-bottom: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
  grid-template-areas:
    "status    sessions sales"
    "inventory recent   alerts";
}
.area-status { grid-area: status; }
.area-sessions { grid-area: sessions; }
.area-sales { grid-area: sales; }
.area-inventory { grid-area: inventory; }
.area-recent { grid-area: recent; }
.area-alerts { grid-area: alerts; }
.area-status .panel-body, .area-sessions .panel-body, .area-sales .panel-body { min-height: 318px; }
.area-inventory .panel-body, .area-recent .panel-body, .area-alerts .panel-body { min-height: 236px; }

/* router status */
.router-card { display: grid; gap: 14px; }
.router-head {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.router-logo {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; flex: none; color: #fff;
  background: linear-gradient(135deg, var(--accent), #1e4fd8); box-shadow: 0 0 0 4px var(--accent-soft);
}
.router-logo .icon { width: 22px; height: 22px; }
.router-title { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.router-title strong { color: var(--text-strong); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.specs { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 7px 12px; margin: 0; padding: 0 4px; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.meters { display: grid; gap: 10px; padding: 0 4px; }
.meter-row { display: grid; grid-template-columns: 110px 64px minmax(0, 1fr); align-items: center; gap: 12px; }
.meter-row > span:first-child { color: var(--muted); }
.meter-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { position: relative; display: block; height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s ease; }
.bar-ok > span { background: linear-gradient(90deg, #1fb866, var(--ok)); }
.bar-warning > span { background: var(--warning); }
.bar-critical > span { background: var(--critical); }

/* tables */
.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.data-table th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); white-space: nowrap;
  padding: 9px 12px; background: var(--surface-2); border-block: 1px solid var(--border);
}
.data-table th:first-child { border-left: 1px solid var(--border); border-radius: 9px 0 0 9px; }
.data-table th:last-child { border-right: 1px solid var(--border); border-radius: 0 9px 9px 0; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table .num { text-align: right; }
.cell-sub { display: block; color: var(--muted); font-size: 11.5px; }
.countdown { font: 700 13px var(--mono); font-variant-numeric: tabular-nums; }
.countdown.level-ok { color: var(--ok); }
.countdown.level-warning { color: var(--warning); }
.countdown.level-critical { color: var(--critical); }
.countdown.level-none { color: var(--muted); font-family: var(--font); font-weight: 500; }
.stock { display: inline-block; min-width: 38px; text-align: center; padding: 2px 8px; border-radius: 7px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stock.level-ok { color: var(--ok); background: var(--ok-soft); }
.stock.level-warning { color: var(--warning); background: var(--warning-soft); }
.stock.level-critical { color: var(--critical); background: var(--critical-soft); }
.method { display: inline-block; min-width: 58px; text-align: center; padding: 3px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 650; border: 1px solid var(--border); background: var(--surface-2); }
.method-gcash { color: #fff; background: #0a5bd8; border-color: #0a5bd8; }
.method-maya { color: #04130b; background: #2fd27a; border-color: #2fd27a; }
.method-bank { color: var(--violet); background: color-mix(in srgb, var(--violet) 14%, transparent); }

/* sales */
.sales-total { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sales-amount { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.sales-period { margin: 0 0 6px; }
.chart-wrap { position: relative; margin: 0 -6px; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis { fill: var(--muted); font: 11px var(--font); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; filter: drop-shadow(0 4px 10px rgba(47, 140, 255, .45)); }
.chart-dot { fill: var(--surface-solid); stroke: var(--accent); stroke-width: 2; }
.chart-stop { stop-color: var(--accent); }
.chart-line.line-tx, .chart-dot.line-tx { stroke: var(--accent-2); }
.chart-line.line-tx { filter: none; stroke-dasharray: 5 4; stroke-width: 2; }
.chart-line.line-latency, .chart-dot.line-latency { stroke: var(--warning); filter: none; }
.chart-stop.line-latency { stop-color: var(--warning); }
.chart-dot-peak { fill: var(--accent); stroke: var(--accent-soft); stroke-width: 8; paint-order: stroke; }
.chart-empty { position: absolute; inset: 0 0 26px 40px; display: grid; place-items: center; pointer-events: none; }
.chart-empty span { padding: 5px 12px; border-radius: 99px; background: var(--surface-solid); border: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.mini-stat { display: grid; gap: 2px; padding: 10px 12px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.mini-stat span { color: var(--muted); font-size: 12px; }
.mini-stat strong { color: var(--text-strong); font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* alerts */
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; }
.alert-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.alert-item:last-child { border-bottom: 0; }
.alert-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; }
.alert-icon .icon { width: 15px; height: 15px; }
.alert-msg { font-size: 13px; overflow-wrap: anywhere; }
.alert-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.alert-item.level-ok .alert-icon { color: var(--ok); background: var(--ok-soft); }
.alert-item.level-info .alert-icon { color: var(--info); background: var(--info-soft); }
.alert-item.level-warning .alert-icon { color: var(--warning); background: var(--warning-soft); }
.alert-item.level-critical .alert-icon { color: var(--critical); background: var(--critical-soft); }
.alert-item.level-critical .alert-msg { color: var(--text-strong); font-weight: 600; }

/* loading / empty / error states */
.skeleton { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--skeleton) 25%, var(--skeleton-shine) 50%, var(--skeleton) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton-stack { display: grid; gap: 12px; }
.skeleton-line { height: 12px; }
.skeleton-line.lg { height: 22px; }
.skeleton-row { height: 34px; }
.skeleton-tile { width: 54px; height: 54px; border-radius: 14px; flex: none; }
.skeleton-chart { height: 170px; margin: 14px 0; }
.skeleton-box { height: 56px; border-radius: 11px; }
.stat-card.is-loading .stat-body { gap: 8px; }
.w-40 { width: 40%; } .w-50 { width: 50%; } .w-70 { width: 70%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.state {
  height: 100%; min-height: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 18px 12px; text-align: center;
}
.state p { display: grid; gap: 3px; margin: 0; max-width: 320px; }
.state strong { color: var(--text-strong); }
.state .muted { font-size: 12.5px; }
.state-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--border); }
.state-icon .icon { width: 22px; height: 22px; }
.state-error .state-icon { color: var(--critical); background: var(--critical-soft); }
.router-card .state { min-height: 200px; }

/* CTA */
.cta {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 20px; padding: 22px 26px;
  border-radius: var(--radius); border: 1px solid var(--border-strong);
  background:
    radial-gradient(600px 160px at 20% 120%, rgba(47, 140, 255, .22), transparent 70%),
    linear-gradient(90deg, rgba(47, 140, 255, .14), rgba(34, 211, 238, .04) 60%, rgba(47, 140, 255, .12));
  box-shadow: var(--glow);
}
.cta-icon {
  display: grid; place-items: center; width: 58px; height: 58px; flex: none; border-radius: 16px;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--border-strong);
}
.cta-icon .icon { width: 28px; height: 28px; }
.cta-text { flex: 1; min-width: 0; }
.cta-text h2 { font-size: 19px; margin: 0 0 2px; }
.cta-text p { margin: 0; }

/* no-router hero */
.hero-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 48px 24px 28px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--glow);
}
.hero-empty h2 { font-size: 22px; margin: 6px 0 0; }
.hero-empty > p { max-width: 460px; margin: 0 0 8px; }
.hero-icon {
  display: grid; place-items: center; width: 76px; height: 76px; border-radius: 22px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 16px 40px -14px rgba(47, 140, 255, .8);
}
.hero-icon .icon { width: 36px; height: 36px; }
.steps { list-style: none; margin: 26px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; width: 100%; max-width: 860px; text-align: left; }
.steps li { display: flex; gap: 12px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.steps li div { display: grid; gap: 2px; font-size: 13px; }
.steps strong { color: var(--text-strong); }
.step-no { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; font-weight: 700; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--border-strong); }

/* ------------------------------------------------------------------ other pages (routers, accounts) */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap;
  background: var(--surface-2); padding: 11px 16px; border-bottom: 1px solid var(--border);
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-hover); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn + .btn, .table .actions .btn + form { margin-left: 6px; }
.test-cell { min-width: 180px; }

.form h2 { margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--border); }
.form h2:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; margin-bottom: 20px; }
.span-2 { grid-column: span 2; }
.field { display: grid; gap: 6px; align-content: start; }
.field > span { font-weight: 600; font-size: 13px; color: var(--text-strong); }
.field small { font-size: 12px; }
input:not([type=checkbox]):not([type=radio]):not([type=search]), .field select {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text);
  font: 14px var(--font); transition: border-color .15s, box-shadow .15s;
}
input:not([type=checkbox]):not([type=radio]):not([type=search]):focus, .field select:focus { outline: none; border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.field select option { background: var(--surface-solid); }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 20px; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--border); }
.help summary { cursor: pointer; font-weight: 600; color: var(--text-strong); }
.help[open] summary { margin-bottom: 10px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-color: color-mix(in srgb, var(--critical) 35%, var(--border)); }
.danger-zone h2 { color: var(--critical); margin-bottom: 2px; }
.danger-zone p { margin: 0; }

/* auth & error pages */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card {
  width: 100%; max-width: 400px; padding: 32px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow), var(--glow);
  backdrop-filter: blur(14px);
}
.auth-card > .muted { margin-top: 4px; }
.auth-card .brand { padding: 0 0 8px; }
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.brand-lg { font-size: 18px; font-weight: 700; gap: 12px; color: var(--text-strong); }
.error-code { font-size: 48px; font-weight: 800; margin: 0; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ------------------------------------------------------------------ list pages */
.text-strong { color: var(--text-strong); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-actions form { margin: 0; }
.inline-form { display: inline-flex; gap: 6px; margin: 0; }
.link-more { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; }
.link-more .icon { width: 14px; height: 14px; }
.link-quiet { color: inherit; }
.link-quiet:hover { color: var(--accent); text-decoration: underline; }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.toolbar-search {
  display: flex; align-items: center; gap: 8px; flex: 1 1 260px; max-width: 420px; height: 38px; padding: 0 12px;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--muted);
}
.toolbar-search:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--accent-soft); }
.toolbar-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: 14px var(--font); }
.toolbar .select-sm { height: 38px; }
.toolbar-date input { height: 38px !important; width: auto !important; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px 0 12px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; border: 1px solid var(--border-strong); }
.chip a { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: inherit; }
.chip a:hover { background: var(--surface-hover); }
.chip .icon { width: 13px; height: 13px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 9px;
  color: var(--muted); border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 13px;
}
.tab:hover { color: var(--text-strong); border-color: var(--border-strong); }
.tab.active { color: var(--text-strong); background: var(--accent-soft); border-color: var(--border-strong); }
.tab-count { min-width: 22px; padding: 0 6px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 11.5px; text-align: center; }
.tab.active .tab-count { background: var(--accent); color: #fff; }

.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); min-height: 44px; }
.bulk-bar .spacer { flex: 1; }
.check-col { width: 36px; }
.check-col input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.row-actions { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; }
.row-actions form { margin: 0; display: inline-flex; }
.btn-muted-icon { color: var(--muted); }
.cell-clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.row-highlight td { background: var(--accent-soft); }
.row-muted td { opacity: .55; }

.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 650; white-space: nowrap; border: 1px solid transparent; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-unused { color: var(--info); background: var(--info-soft); }
.status-active { color: var(--ok); background: var(--ok-soft); }
.status-used { color: var(--muted); background: var(--surface-2); border-color: var(--border); }
.status-expired { color: var(--warning); background: var(--warning-soft); }
.status-disabled { color: var(--critical); background: var(--critical-soft); }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--border); }

.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 28%, transparent); }
.note { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 12.5px; }
.note .icon { width: 16px; height: 16px; margin-top: 1px; flex: none; }
.note-warning { color: var(--warning); background: var(--warning-soft); }

/* profiles */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.profile-card { gap: 12px; }
.profile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.profile-head h2 { margin: 0 0 2px; font-size: 18px; overflow-wrap: anywhere; }
.profile-price { font-size: 24px; font-weight: 800; color: var(--accent); white-space: nowrap; letter-spacing: -.02em; }
.specs-compact { grid-template-columns: 96px minmax(0, 1fr); gap: 6px 10px; padding: 12px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.profile-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.profile-actions form { margin: 0 0 0 auto; }
.profile-price.is-empty { color: var(--muted); font-size: 18px; }
.log-target { font-weight: 600; color: var(--text-strong); }
.chart-compact { display: none; }

/* Router status: the whole page fits one screen, the long lists scroll inside */
.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.status-grid .stat-card { margin: 0; min-height: 0; padding: 12px 14px; gap: 12px; }
.status-grid .stat-icon { width: 42px; height: 42px; }
.status-grid .stat-icon .icon { width: 20px; height: 20px; }
.status-grid .stat-body { gap: 3px; }
.status-grid .stat-value { font-size: 26px; }
.status-grid .bar { margin-top: 2px; }
.status-cols { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.status-cols .panel { margin: 0; padding: 12px 14px; }
.status-cols .panel-head { margin-bottom: 8px; }
.status-cols .panel-head h2 { font-size: 15px; }
.status-cols .specs-compact { grid-template-columns: 92px minmax(0, 1fr); gap: 5px 10px; padding: 10px; font-size: 12.5px; }
.status-scroll { max-height: 300px; overflow-y: auto; }
.status-cols .data-table th, .status-cols .data-table td { padding: 7px 10px; }
.status-log .log-item { grid-template-columns: 30px minmax(0, 1fr) auto; padding: 7px 2px; }
.status-log .log-icon { width: 28px; height: 28px; }
.status-log .log-time { font-size: 11px; }

/* desktop: pin the page to the viewport so nothing below the fold */
@media (min-width: 1101px) {
  body:has(.status-page) .content { flex: none; height: calc(100vh - var(--topbar-h)); min-height: 0; padding-bottom: 20px; display: flex; flex-direction: column; overflow: hidden; }
  body:has(.status-page) .page-head { flex: none; }
  .status-page { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
  .status-page .status-grid { flex: none; }
  .status-page .status-cols { flex: 1; min-height: 0; align-items: stretch; }
  .status-page .status-cols > .panel { display: flex; flex-direction: column; min-height: 0; }
  .status-page .status-scroll { flex: 1; min-height: 0; max-height: none; }
  .status-page .status-system .specs-compact { overflow-y: auto; }
}
.if-state { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; background: var(--muted); }
.if-state.is-up { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.if-state.is-down { background: var(--muted); }
.if-state.is-disabled { background: var(--critical); }

/* WAN monitor: sized so a few links fit one screen without scrolling */
.tabs-inline { margin: 0; }
.page-head-compact { margin-bottom: 14px; align-items: center; }
.page-title-inline { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.page-title-inline h1 { font-size: 22px; margin: 0; }
.wan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-content: start; }
.wan-tile { gap: 8px; padding: 12px 14px; margin: 0 !important; }
.wan-tile-head { display: flex; align-items: center; gap: 10px; }
.wan-tile-title { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.wan-tile-title h2 { margin: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wan-tile-title > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wan-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; flex: none; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--border-strong); }
.wan-icon .icon { width: 16px; height: 16px; }
.wan-live { display: grid; gap: 8px; min-height: 76px; align-content: start; }
.wan-live-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wan-since { color: var(--text-strong); font-weight: 600; }
.wan-detail { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-warning { color: var(--warning); background: var(--warning-soft); border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent); }
.pill-muted { color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); }
.wan-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.wan-metric { display: grid; gap: 1px; padding: 6px 7px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.wan-metric span { color: var(--muted); font-size: 10.5px; }
.wan-metric strong { font-size: 14px; color: var(--text-strong); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skeleton-metric { height: 44px; border-radius: 9px; }
.text-rx { color: var(--accent) !important; }
.text-tx { color: var(--accent-2) !important; }
.level-text-warning { color: var(--warning) !important; }
.level-text-critical { color: var(--critical) !important; }
.state-inline { flex-direction: row; justify-content: flex-start; text-align: left; min-height: 0; padding: 9px 10px; border-radius: 10px; background: var(--critical-soft); }
.state-inline .state-icon { width: 32px; height: 32px; }
.state-inline p { gap: 0; }

/* chart with a Traffic / Latency switch */
.wan-chart .chart-wrap { margin: 0 -4px; }
.chart-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; margin: 0 0 2px; }
.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.seg label { display: inline-flex; cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg span { padding: 3px 9px; border-radius: 6px; color: var(--muted); font-weight: 600; font-size: 11.5px; }
.seg input:checked + span { color: var(--text-strong); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--border-strong); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.legend { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.swatch { display: inline-block; width: 12px; height: 3px; border-radius: 2px; background: var(--accent); }
.swatch.line-tx { background: var(--accent-2); margin-left: 6px; }
.swatch.line-latency { background: var(--warning); }
.wan-chart .chart-latency, .wan-chart .legend-latency { display: none; }
.wan-chart:has(.seg-latency:checked) .chart-traffic, .wan-chart:has(.seg-latency:checked) .legend-traffic { display: none; }
.wan-chart:has(.seg-latency:checked) .chart-latency, .wan-chart:has(.seg-latency:checked) .legend-latency { display: block; }
.wan-chart:has(.seg-latency:checked) .legend-latency { display: inline-flex; }

.wan-foot { margin: 0; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wan-foot strong { color: var(--text-strong); font-variant-numeric: tabular-nums; }
.wan-history { width: min(420px, calc(100vw - 24px)); }
.wan-feed { max-height: min(60vh, 420px); overflow-y: auto; margin-right: -8px; padding-right: 8px; }
.wan-feed .alert-item { grid-template-columns: 26px minmax(0, 1fr); padding: 8px 2px; }
.wan-feed .alert-msg { font-size: 12.5px; }
.page-head h1 .live-dot { display: inline-block; vertical-align: middle; margin: 0 8px 4px 2px; }

/* generate & settings */
.generate-layout, .settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.generate-layout .card, .settings-layout .card { margin-bottom: 0; }
.generate-side { position: sticky; top: calc(var(--topbar-h) + 18px); display: grid; gap: 14px; }
.generate-side h2 { margin: 0; }
.choice-group { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice-group legend { font-weight: 600; font-size: 13px; color: var(--text-strong); margin-bottom: 6px; padding: 0; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--border-strong); background: var(--accent-soft); }
.choice input { margin-top: 3px; accent-color: var(--accent); }
.choice span { display: grid; gap: 2px; }

/* sales */
.split-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.split-grid .panel { margin: 0; }
section.panel { margin-bottom: 18px; }
.dash-grid section.panel { margin-bottom: 0; }
.share-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.share-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin-bottom: 6px; }
.share-cell { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.share-cell .bar { flex: 1; }

/* activity */
.log-list { list-style: none; margin: 0; padding: 0; }
.log-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.log-item:last-child { border-bottom: 0; }
.log-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--accent); background: var(--accent-soft); }
.log-icon .icon { width: 16px; height: 16px; }
.log-item.is-danger .log-icon { color: var(--critical); background: var(--critical-soft); }
.log-main { min-width: 0; overflow-wrap: anywhere; }
.log-time { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1440px) {
  .summary-grid { gap: 14px; }
  .stat-card { gap: 13px; padding: 16px; }
  .stat-icon { width: 48px; height: 48px; }
}

/* tablet: 2-column dashboard */
@media (max-width: 1280px) {
  .generate-layout, .settings-layout, .split-grid { grid-template-columns: minmax(0, 1fr); }
  .generate-side { position: static; }
  .dash-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "status    sales"
      "sessions  sessions"
      "inventory alerts"
      "recent    recent";
  }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* tablet: condensed icon sidebar with tooltips */
@media (max-width: 1100px) and (min-width: 861px) {
  .sidebar { width: var(--sidebar-w-condensed); }
  .shell { margin-left: var(--sidebar-w-condensed); }
  .brand { justify-content: center; padding: 18px 0; }
  .brand-text, .nav-label, .soon, .nav-section, .sidebar-foot { display: none; }
  .nav { padding: 8px 10px; gap: 4px; overflow: visible; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .nav-item.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .nav-item[data-tooltip]:hover::after, .nav-item[data-tooltip]:focus-visible::after {
    content: attr(data-tooltip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
    padding: 5px 10px; border-radius: 7px; white-space: nowrap; font-size: 12.5px; font-weight: 600; z-index: 60;
    background: var(--surface-solid); color: var(--text-strong); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  }
  .account-meta { display: none; }
  .status-cols { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
}

/* mobile: off-canvas sidebar */
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .nav-toggle:checked ~ .sidebar { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .5); }
  .nav-toggle:checked ~ .nav-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(2, 6, 14, .6); backdrop-filter: blur(2px); }
  .shell { margin-left: 0; }
  .nav-open { display: inline-grid; }
  .topbar { padding: 0 14px; gap: 8px; }
  .content { padding: 18px 16px 32px; }
  .account-meta, .search kbd { display: none; }
  .account { border-left: 0; padding: 0; margin: 0; }
  .search { width: auto; flex: 1; min-width: 0; }
  .router-switch select { max-width: 110px; }
  .grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .danger-zone { flex-direction: column; align-items: stretch; }
}

@media (max-width: 700px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "status" "sessions" "sales" "inventory" "recent" "alerts"; }
  .summary-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .stat-card { min-height: 92px; }
  .datetime { min-width: 0; width: 100%; }
  .cta { flex-direction: column; text-align: center; padding: 24px 18px; }
  .cta .btn { width: 100%; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .choice-group { grid-template-columns: minmax(0, 1fr); }
  .chart-wide { display: none; }
  .wan-grid { grid-template-columns: minmax(0, 1fr); }
  .wan-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-title-inline { flex-direction: column; gap: 2px; }
  .chart-compact { display: block; }
  .toolbar-search { max-width: none; flex-basis: 100%; }
  .pagination { flex-wrap: wrap; justify-content: center; }
  .log-item { grid-template-columns: 34px minmax(0, 1fr); }
  .log-time { grid-column: 2; }
  .router-switch { padding-left: 8px; }
  .router-switch .icon { display: none; }
  h1 { font-size: 22px; }
}

@media (max-width: 480px) {
  .topbar-actions { gap: 2px; }
  .theme-toggle { display: none; }
  .meter-row { grid-template-columns: 90px 56px minmax(0, 1fr); gap: 8px; }
  .specs { grid-template-columns: 96px minmax(0, 1fr); }
  .mini-stats { grid-template-columns: minmax(0, 1fr); }
  .mini-stat { grid-template-columns: 1fr auto; align-items: center; }
  .panel { padding: 14px; }
}

/* touch targets */
@media (pointer: coarse) {
  .btn-sm { min-height: 40px; }
  .btn-icon { width: 40px; }
  .nav-item { min-height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .sidebar, .topbar, .page-actions, .toolbar, .nav-scrim, .pagination, .bulk-bar { display: none !important; }
  .shell { margin: 0 !important; }
  body { background: #fff !important; color: #000; }
  .panel, .card, .stat-card { box-shadow: none !important; backdrop-filter: none !important; border-color: #ccc !important; background: #fff !important; }
}
