/* NCS Devices — one design system for every page. */
:root {
  --navy-950: #0b1726;
  --navy-800: #18304d;
  --blue-700: #1556b0;
  --blue-600: #1a66cc;
  --blue-50: #eef4fd;
  --ink-900: #0f1b2d;
  --ink-700: #3d4a5c;
  --ink-500: #697586;
  --ink-400: #8a95a5;
  --line: #e3e8ef;
  --line-strong: #cdd5df;
  --surface: #ffffff;
  --subtle: #f7f9fb;
  --canvas: #f2f4f7;
  --good: #067647;
  --good-bg: #ecfdf3;
  --good-line: #abefc6;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --warn-line: #fedf89;
  --bad: #b42318;
  --bad-bg: #fef3f2;
  --bad-line: #fecdca;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-900);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--blue-600); }
.hidden { display: none !important; }
.muted { color: var(--ink-500); }
.small { font-size: 12px; }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Sign-in and first-time setup: the NCS logo on a card over the brand's blue, with its yellow
   signal arcs behind. */
.sign-in { position: relative; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 32px 16px; overflow: hidden; background: radial-gradient(circle at 18% 12%, #2d6fc0 0%, #17457f 38%, var(--navy-950) 100%); }
.sign-in::before, .sign-in::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.sign-in::before { width: 900px; height: 900px; right: -420px; bottom: -420px; background: repeating-radial-gradient(circle, transparent 0 46px, rgba(248, 188, 64, .16) 46px 62px); -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%); }
.sign-in::after { width: 520px; height: 520px; left: -260px; top: -260px; background: repeating-radial-gradient(circle, transparent 0 34px, rgba(255, 255, 255, .06) 34px 44px); }
.sign-in-card { position: relative; z-index: 1; width: min(420px, 100%); display: grid; gap: 16px; padding: 36px 36px 32px; border-radius: 16px; background: var(--surface); box-shadow: 0 30px 70px rgba(4, 16, 36, .45); border-top: 4px solid #f8bc40; }
.sign-in-logo { display: block; width: 190px; height: auto; margin: 0 auto 6px; }
.sign-in-heading { text-align: center; }
.sign-in-heading h1 { margin: 0; font-size: 20px; font-weight: 700; color: var(--ink-900); }
.sign-in-heading p { margin: 4px 0 0; }
.sign-in-card label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-700); }
.sign-in-card input { height: 42px; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0 12px; }
.sign-in-card input:focus { outline: 3px solid var(--blue-50); border-color: #2462ae; }
.sign-in-card .primary-button { height: 42px; margin-top: 4px; background: linear-gradient(180deg, #2d73c9, #2462ae); }
.sign-in-footer { position: relative; z-index: 1; margin: 0; color: rgba(255, 255, 255, .55); font-size: 12px; }
.form-title { margin: 0; font-size: 17px; }
.form-notice { margin: 0; padding: 10px 12px; border-radius: var(--radius); color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line); font-size: 13px; }
/* A password field with its eye button inside, on the right. */
.password-field { position: relative; display: block; }
.password-field input[data-reveal] { width: 100%; padding-right: 42px; }
.reveal { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--ink-400); cursor: pointer; }
.reveal:hover { color: var(--ink-700); background: var(--subtle); }
.reveal:focus-visible { outline: 2px solid var(--blue-600); outline-offset: -2px; }
.reveal .icon { width: 18px; height: 18px; }
.form-error { margin: 0; padding: 10px 12px; border-radius: var(--radius); color: var(--bad); background: var(--bad-bg); font-size: 13px; }

/* Shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 16px 12px; background: var(--navy-950); color: #c5d0de; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 14px; color: white; text-decoration: none; font-size: 16px; font-weight: 700; }
.brand-dark { color: var(--ink-900); padding: 0; font-size: 18px; }
.brand-logo { display: block; margin: 0 2px 10px; padding: 10px 14px; border-radius: 10px; background: white; }
.brand-logo img { display: block; width: 100%; max-width: 150px; height: auto; margin: 0 auto; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 30px; background: linear-gradient(145deg, #4ba3ff, #1460c4); color: white; clip-path: polygon(50% 0, 93% 18%, 84% 78%, 50% 100%, 16% 78%, 7% 18%); font-size: 13px; font-weight: 800; }
.nav-label { padding: 14px 10px 6px; color: #7d8ba0; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 2px; }
.nav-item { width: 100%; border: 0; border-radius: 6px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: #c5d0de; background: transparent; text-decoration: none; text-align: left; font-size: 14px; cursor: pointer; }
.nav-item:hover { color: white; background: rgba(255, 255, 255, .06); }
.nav-item.active { color: white; background: var(--navy-800); box-shadow: inset 3px 0 0 #4ba3ff; }
.nav-meta { margin-left: auto; color: #7d8ba0; font-size: 12px; font-variant-numeric: tabular-nums; }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; display: grid; place-items: center; background: #d92d20; color: white; font-size: 11px; font-weight: 700; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 10px; }
.sidebar-footer p { margin: 0; padding: 4px 10px 6px; color: #7d8ba0; font-size: 12px; }
.sidebar-footer strong { color: #e1e8f0; font-weight: 600; }

main { min-width: 0; }
.topbar { height: 56px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 5; }
.breadcrumb { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink-500); }
.breadcrumb a { color: var(--ink-500); text-decoration: none; white-space: nowrap; }
.breadcrumb a:hover { color: var(--blue-600); }
.breadcrumb span { white-space: nowrap; }
.breadcrumb strong { color: var(--ink-900); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb .icon { color: var(--ink-400); width: 14px; height: 14px; }
.refresh-state { color: var(--ink-400); font-size: 12px; white-space: nowrap; }
.workspace { width: 100%; max-width: 1320px; margin: 0 auto; padding: 24px; display: grid; gap: 20px; align-content: start; }

/* Page header */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-header h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-header > div > p { margin: 4px 0 0; color: var(--ink-500); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 8px; color: var(--ink-500); font-size: 13px; }
.meta strong { color: var(--ink-700); font-weight: 600; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Summary numbers */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.stat .stat-label { display: block; color: var(--ink-500); font-size: 13px; }
.stat strong { display: block; margin-top: 4px; font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat.good strong { color: var(--good); }
.stat.bad strong { color: var(--bad); }

/* Panels */
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-header h2 { margin: 0; font-size: 15px; font-weight: 650; }
.card-header .sub { margin-left: 8px; color: var(--ink-500); font-size: 12px; font-weight: 400; }
.card-body { padding: 16px; }
.card-footer { padding: 10px 16px; border-top: 1px solid var(--line); background: var(--subtle); color: var(--ink-500); font-size: 12px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 20px; align-items: start; }

/* Label/value lists */
.kv { margin: 0; display: grid; grid-template-columns: minmax(140px, 44%) 1fr; }
.kv dt, .kv dd { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.kv dt { color: var(--ink-500); }
.kv dd { font-weight: 500; word-break: break-word; }
.kv dd small { display: block; margin-top: 2px; color: var(--ink-500); font-weight: 400; font-size: 12px; }
.kv > :nth-last-child(-n+2) { border-bottom: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 16px; color: var(--ink-500); font-size: 12px; font-weight: 600; text-align: left; vertical-align: bottom; background: var(--subtle); border-bottom: 1px solid var(--line); }
td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfd; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--blue-50); }
td.actions-cell { width: 1%; white-space: nowrap; text-align: right; }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--ink-500); font-size: 12px; }
.nowrap { white-space: nowrap; }
.empty { margin: 0; padding: 40px 16px; color: var(--ink-500); text-align: center; }
.empty strong { display: block; margin-bottom: 4px; color: var(--ink-900); font-weight: 600; }

/* Status */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; border: 1px solid var(--line); background: var(--subtle); color: var(--ink-700); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.good { color: var(--good); background: var(--good-bg); border-color: var(--good-line); }
.pill.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.pill.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.tag { display: inline-block; padding: 1px 8px; margin: 1px 4px 1px 0; border-radius: 4px; background: var(--subtle); border: 1px solid var(--line); font-size: 12px; color: var(--ink-700); white-space: nowrap; }

/* Buttons */
.primary-button, .action-button, .danger-button, .ghost-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; text-decoration: none; }
.primary-button { border: 1px solid var(--blue-600); color: white; background: var(--blue-600); }
.primary-button:hover:not(:disabled) { background: var(--blue-700); }
.action-button { border: 1px solid var(--line-strong); color: var(--ink-900); background: var(--surface); box-shadow: var(--shadow-sm); }
.action-button:hover:not(:disabled) { background: var(--subtle); }
.danger-button { border: 1px solid #d92d20; color: white; background: #d92d20; }
.danger-button:hover:not(:disabled) { background: var(--bad); }
.ghost-button { height: 30px; padding: 0 8px; border: 1px solid transparent; color: var(--ink-700); background: transparent; }
.ghost-button:hover:not(:disabled) { background: var(--subtle); border-color: var(--line); }
.ghost-button.danger { color: var(--bad); }
.ghost-button.danger:hover:not(:disabled) { background: var(--bad-bg); border-color: var(--bad-line); }
button:disabled { cursor: not-allowed; opacity: .5; }
.search { height: 34px; width: min(300px, 100%); border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 12px 0 32px; background: var(--surface) no-repeat 10px center / 14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23697586' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); }
.search:focus { outline: 3px solid var(--blue-50); border-color: var(--blue-600); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 2px solid transparent; color: var(--ink-500); font-weight: 600; text-decoration: none; white-space: nowrap; }
.tab:hover { color: var(--ink-900); }
.tab.active { color: var(--blue-600); border-bottom-color: var(--blue-600); }
.tab .count { min-width: 20px; padding: 0 6px; border-radius: 99px; background: #e8ecf1; color: var(--ink-500); font-size: 11px; text-align: center; }
.tab.active .count { background: var(--blue-50); color: var(--blue-600); }
.tab-body { display: grid; gap: 20px; }
.live { display: grid; gap: 20px; }
.live > [data-live="notice"]:empty { display: none; }
#updateStatus:empty { display: none; }
.choice-list { display: grid; gap: 8px; max-height: 240px; overflow-y: auto; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--blue-700); background: var(--blue-50); }
.choice input { margin-top: 3px; }
.choice span { display: grid; gap: 2px; min-width: 0; }
.choice strong { font-weight: 600; overflow-wrap: anywhere; }
.choice small { color: var(--ink-500); font-size: 12px; }
.choice-remove { margin-left: auto; align-self: center; color: var(--bad); }

/* Messages */
.notice { margin: 0; padding: 10px 14px; border-radius: var(--radius); border: 1px solid; font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.notice .icon { margin-top: 1px; }
.notice.good { color: var(--good); background: var(--good-bg); border-color: var(--good-line); }
.notice.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.notice.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.backup-notice { flex-wrap: wrap; align-items: center; }
.backup-notice .notice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.notice.info { color: var(--blue-700); background: var(--blue-50); border-color: #c7dbf7; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 8px; width: min(400px, calc(100vw - 40px)); }
.toast { padding: 12px 14px; border-radius: var(--radius); background: var(--ink-900); color: white; box-shadow: var(--shadow-lg); font-size: 13px; display: flex; gap: 10px; align-items: flex-start; animation: rise .18s ease-out; }
.toast .icon { margin-top: 1px; }
.toast.good .icon { color: #47cd89; }
.toast.warn .icon { color: #fdb022; }
.toast.bad .icon { color: #f97066; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Side panel (forms) and dialogs */
.sheet, .dialog { border: 0; padding: 0; color: var(--ink-900); background: var(--surface); box-shadow: var(--shadow-lg); }
.sheet::backdrop, .dialog::backdrop { background: rgba(15, 27, 45, .45); }
.sheet { margin: 0 0 0 auto; width: min(540px, 100vw); height: 100vh; max-height: 100vh; }
.sheet[open] { display: flex; flex-direction: column; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.sheet-header h2 { margin: 0; font-size: 17px; font-weight: 650; }
.sheet-header p { margin: 2px 0 0; color: var(--ink-500); font-size: 13px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 20px; display: grid; gap: 18px; align-content: start; }
.sheet-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--subtle); }
.sheet-footer > span { flex: 1; min-width: 0; }
.sheet-footer .toolbar { flex: none; flex-wrap: nowrap; }
.steps { display: flex; gap: 6px; align-items: center; color: var(--ink-400); font-size: 12px; font-weight: 600; }
.steps .on { color: var(--blue-600); }
.close-button { width: 32px; height: 32px; border: 0; border-radius: 6px; display: grid; place-items: center; background: transparent; color: var(--ink-500); cursor: pointer; }
.close-button:hover { background: var(--subtle); color: var(--ink-900); }
.dialog { width: min(480px, calc(100vw - 32px)); border-radius: 12px; }
.dialog[open] { animation: rise .18s ease-out; }
.dialog-body { display: grid; gap: 14px; padding: 24px; }
.dialog-body h2 { margin: 0; font-size: 17px; font-weight: 650; }
.dialog-body p { margin: 0; color: var(--ink-700); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.dialog-wide { width: min(780px, calc(100vw - 32px)); }
.dialog-scroll { max-height: 45vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.restore-stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.restore-stage { display: flex; gap: 10px; align-items: baseline; color: var(--ink-500); }
.restore-stage.good { color: var(--good); }
.restore-stage.warn { color: var(--ink-900); font-weight: 600; }
.restore-stage.bad { color: var(--bad); font-weight: 600; }
.restore-mark { width: 16px; flex: none; text-align: center; }
.account-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.log-collect { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.log-collect select { height: 34px; }
.log-range { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 0; }
.choice-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.choice-row input { margin-top: 3px; }
.choice-row > span { display: grid; gap: 2px; }
.choice-detail { margin-left: 26px; max-width: calc(100% - 26px); }
.dialog-body tr.differs td { font-weight: 600; }
.dialog-body details summary { cursor: pointer; }
.eyebrow { margin: 0; color: var(--ink-500); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.code-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.code-choice { height: 56px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 19px; font-weight: 700; letter-spacing: .08em; cursor: pointer; }
.code-choice:hover:not(:disabled) { border-color: var(--blue-600); background: var(--blue-50); }

/* Form fields */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-700); }
.field > span em { color: var(--ink-400); font-style: normal; font-weight: 400; }
.field small { color: var(--ink-500); font-size: 12px; }
.field input:not([type=radio]):not([type=checkbox]), .field select, .stacked-form input, .inline-form input { height: 38px; width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 12px; background: var(--surface); }
.field input:focus, .field select:focus, .stacked-form input:focus, .inline-form input:focus { outline: 3px solid var(--blue-50); border-color: var(--blue-600); }
.field.invalid input, .field.invalid select, .field.invalid .segmented, .field.invalid .member-list { border-color: #f04438; }
.field .error { color: var(--bad); font-size: 12px; }
.check-cell { width: 36px; padding-right: 0 !important; }
.check-cell input { width: 16px; height: 16px; cursor: pointer; }
tr.selected td { background: var(--blue-50); }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .field-pair { grid-template-columns: 1fr; } }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; width: fit-content; max-width: 100%; }
.segmented label { position: relative; display: flex; align-items: center; padding: 7px 16px; font-size: 13px; font-weight: 600; color: var(--ink-700); cursor: pointer; border-right: 1px solid var(--line-strong); background: var(--surface); }
.segmented label:last-child { border-right: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--blue-600); color: white; }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--blue-600); outline-offset: -2px; }
.member-list { display: grid; gap: 2px; max-height: 260px; overflow-y: auto; padding: 6px; border: 1px solid var(--line-strong); border-radius: 6px; }
.member { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 4px; font-size: 13px; cursor: pointer; word-break: break-all; }
.member:hover { background: var(--subtle); }
.member-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-500); }
.link-button { border: 0; padding: 0; background: none; color: var(--blue-600); font-size: 12px; font-weight: 600; cursor: pointer; }
.review { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.review th, .review td { padding: 9px 12px; font-size: 13px; }
.review .before { color: var(--ink-500); text-decoration: line-through; }
.review .after { font-weight: 600; }
.stacked-form { display: grid; gap: 14px; max-width: 420px; }
.stacked-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-700); }
.stacked-form button { justify-self: start; }
.stacked-form select, .stacked-form textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px 12px; background: var(--surface); }
.stacked-form select { height: 38px; padding: 0 12px; }
.stacked-form textarea { resize: vertical; font: inherit; }
.stacked-form input, .stacked-form select, .stacked-form textarea { font-weight: 400; }
.stacked-form select:focus, .stacked-form textarea:focus { outline: 3px solid var(--blue-50); border-color: var(--blue-600); }
.stacked-form .check-row { display: flex; align-items: center; gap: 8px; }
.stacked-form .check-row input { width: 16px; height: 16px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { width: min(320px, 100%); }

/* Home: a welcome band, then a card per product. */
.welcome { position: relative; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; padding: 28px 28px 26px; border-radius: 16px; color: white; overflow: hidden; background: linear-gradient(120deg, #2462ae 0%, #17457f 55%, var(--navy-950) 100%); box-shadow: 0 12px 32px rgba(23, 69, 127, .25); }
.welcome::after { content: ""; position: absolute; right: -140px; top: -170px; width: 420px; height: 420px; border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 30px, rgba(248, 188, 64, .22) 30px 40px); -webkit-mask: radial-gradient(circle, #000 35%, transparent 70%); mask: radial-gradient(circle, #000 35%, transparent 70%); pointer-events: none; }
.welcome-text { position: relative; z-index: 1; max-width: 560px; }
.welcome .eyebrow { color: #f8bc40; }
.welcome h1 { margin: 6px 0 6px; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.welcome p { margin: 0; color: rgba(255, 255, 255, .78); }
.welcome-stats { position: relative; z-index: 1; margin: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.welcome-stats div { min-width: 104px; padding: 10px 14px; border-radius: 10px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); }
.welcome-stats dt { color: rgba(255, 255, 255, .7); font-size: 12px; }
.welcome-stats dd { margin: 2px 0 0; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.welcome-stats .alert dd { color: #f8bc40; }
.product-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 16px; }
.product-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink-900); text-decoration: none; box-shadow: var(--shadow-sm); overflow: hidden; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.product-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--accent); }
.product-card:hover, .product-card:focus-visible { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: 0 14px 30px rgba(16, 24, 40, .12); outline: none; }
.product-card-top { display: flex; justify-content: space-between; align-items: center; }
.product-card .icon-tile { background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000)); color: white; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.product-card-go { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--ink-400); background: var(--subtle); transition: background .15s ease, color .15s ease; }
.product-card:hover .product-card-go { color: white; background: var(--accent); }
.product-card h2 { margin: 4px 0 0; font-size: 18px; font-weight: 700; }
.product-card p { margin: 0; color: var(--ink-500); min-height: 40px; }
.product-card-meter { height: 6px; margin-top: auto; border-radius: 99px; background: var(--line); overflow: hidden; }
.product-card-meter span { display: block; width: 0; height: 100%; border-radius: inherit; background: #17b26a; transition: width .4s ease; }
.product-card-counts { margin: 0; display: flex; gap: 6px 14px; flex-wrap: wrap; }
.product-card-counts dt { color: var(--ink-500); font-size: 12px; }
.product-card-counts dd { margin: 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.product-card-counts .good dd { color: var(--good); }
.product-card-counts .bad dd { color: var(--bad); }
.product-card-counts .warn dd { color: var(--warn); }

@media (max-width: 760px) {
  .brand.brand-logo { margin: 0 6px 0 0; padding: 6px 10px; }
  .brand-logo img { width: 84px; }
  .welcome { padding: 22px 20px; }
  .welcome h1 { font-size: 22px; }
  .welcome-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .welcome-stats div { min-width: 0; padding: 8px 10px; }
  .welcome-stats dd { font-size: 20px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 10px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; }
  .brand { padding: 0 8px 0 2px; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-item { width: auto; padding: 6px 10px; font-size: 13px; }
  .nav-item .icon, .nav-item .icon-tile, .nav-label, .sidebar-footer p, .nav-meta { display: none; }
  .sidebar-footer { margin: 0; border: 0; padding: 0; }
  .topbar { padding: 0 16px; }
  .refresh-state { display: none; }
  .workspace { padding: 16px; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { padding-bottom: 0; border-bottom: 0; }
  .hide-narrow { display: none; }
}

/* Colour: an accent per product and per section, used for icon tiles, tabs and headers. */
.tone-blue { --accent: #2563eb; --accent-bg: #eff6ff; --accent-line: #bfdbfe; }
.tone-teal { --accent: #0d9488; --accent-bg: #f0fdfa; --accent-line: #99f6e4; }
.tone-violet { --accent: #7c3aed; --accent-bg: #f5f3ff; --accent-line: #ddd6fe; }
.tone-amber { --accent: #d97706; --accent-bg: #fffbeb; --accent-line: #fde68a; }
.tone-rose { --accent: #e11d48; --accent-bg: #fff1f2; --accent-line: #fecdd3; }
.tone-green { --accent: #16a34a; --accent-bg: #f0fdf4; --accent-line: #bbf7d0; }
.tone-indigo { --accent: #4f46e5; --accent-bg: #eef2ff; --accent-line: #c7d2fe; }
.tone-sky { --accent: #0284c7; --accent-bg: #f0f9ff; --accent-line: #bae6fd; }
.tone-slate { --accent: #475569; --accent-bg: #f1f5f9; --accent-line: #cbd5e1; }

.icon-tile { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 9px; background: var(--accent-bg, var(--blue-50)); color: var(--accent, var(--blue-600)); }
.icon-tile .icon { width: 18px; height: 18px; }
.icon-tile.small { width: 26px; height: 26px; border-radius: 7px; }
.icon-tile.small .icon { width: 14px; height: 14px; }
.icon-tile.large { width: 48px; height: 48px; border-radius: 12px; }
.icon-tile.large .icon { width: 24px; height: 24px; }
.card-header h2 { display: flex; align-items: center; gap: 10px; }

/* Sidebar products carry their colour. */
.sidebar .nav-item .icon-tile { background: rgba(255, 255, 255, .06); color: var(--accent); }
.sidebar .nav-item.active .icon-tile { background: var(--accent); color: white; }
.nav-item.active { box-shadow: inset 3px 0 0 var(--accent, #4ba3ff); }

/* Summary numbers with an icon and a coloured edge. */
.stat { display: flex; align-items: center; gap: 14px; border-left: 4px solid var(--accent, var(--line)); }
.stat div { min-width: 0; }
.stat.good strong, .stat.bad strong { color: inherit; }
.stat strong { color: var(--ink-900); }
.stat.tone-green strong { color: #15803d; }
.stat.tone-rose.alert strong { color: #be123c; }
.stat.tone-amber.alert strong { color: #b45309; }
/* Cards that pick what the list shows: pressable, and the one in use filled in its colour. */
.stat-filter { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s, background-color .15s; }
.stat-filter:hover { border-color: var(--accent-line, var(--line)); border-left-color: var(--accent, var(--line)); box-shadow: 0 4px 12px rgba(16, 24, 40, .08); }
.stat-filter:focus-visible { outline: 2px solid var(--accent, var(--blue-600)); outline-offset: 2px; }
.stat-filter.selected { background: var(--accent-bg, var(--surface)); border-color: var(--accent, var(--line)); box-shadow: 0 0 0 1px var(--accent, var(--line)), var(--shadow-sm); }
.stat-filter.selected .stat-label { color: var(--accent, var(--ink-700)); font-weight: 600; }
.stat-filter.selected .icon-tile { background: var(--accent); color: white; }

/* Device and list headers: a tinted band in the product's colour. */
.hero { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 20px 22px; border: 1px solid var(--accent-line, var(--line)); border-radius: 12px; background: linear-gradient(120deg, var(--accent-bg, var(--blue-50)) 0%, #ffffff 65%); box-shadow: var(--shadow-sm); overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: var(--accent, var(--blue-600)); opacity: .06; pointer-events: none; }
.hero-main { display: flex; gap: 16px; align-items: flex-start; min-width: 0; }
.hero h1 { margin: 0; font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero .eyebrow { color: var(--accent, var(--ink-500)); }
.hero .icon-tile { background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000)); color: white; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.hero .meta { margin-top: 6px; }
.hero .actions { position: relative; z-index: 1; }

/* Tabs follow the product colour, set on the page. */
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab.active .count { background: var(--accent); color: white; }
.tab-body { animation: fade .16s ease-out; }
@keyframes fade { from { opacity: .35; } to { opacity: 1; } }

/* Tables: a tinted header and coloured row accents. */
th { background: #f5f7fb; }
.primary-button { background: linear-gradient(180deg, #2a72d6, var(--blue-600)); }
.toast { border-left: 4px solid #47cd89; }
.toast.warn { border-left-color: #fdb022; }
.toast.bad { border-left-color: #f97066; }
.kv dt { display: flex; align-items: center; }

.mono-id { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; font-weight: 600; color: var(--ink-700); letter-spacing: .02em; }

.stat strong .of { color: var(--ink-400); font-size: 16px; font-weight: 600; }
.stat-pill { font-size: 14px !important; margin-top: 6px !important; }
.stat-pill .pill { font-size: 13px; padding: 3px 10px; }
.detail-row td { background: var(--subtle); padding: 12px 16px 14px; }
.detail-grid { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 20px; }
.detail-grid dt { color: var(--ink-500); font-size: 12px; }
.detail-grid dd { margin: 2px 0 0; font-weight: 500; word-break: break-word; }
.dialog .field input { height: 38px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 12px; }

/* Sub-tabs inside a group tab (Calling, Units, ...). */
.subtabs { display: flex; gap: 8px; flex-wrap: wrap; }
.subtab { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink-700); font-size: 13px; font-weight: 600; text-decoration: none; box-shadow: var(--shadow-sm); }
.subtab:hover { border-color: var(--line-strong); color: var(--ink-900); }
.subtab.active { border-color: var(--accent, var(--blue-600)); background: var(--accent-bg, var(--blue-50)); color: var(--accent, var(--blue-600)); }
.subtab .count { min-width: 20px; padding: 0 6px; border-radius: 99px; background: #e8ecf1; color: var(--ink-500); font-size: 11px; text-align: center; }
.subtab.active .count { background: var(--accent, var(--blue-600)); color: white; }

/* Progress bar at the top while the page waits on the server */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 50; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .2s; }
.progress.on { opacity: 1; }
.progress::before { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; background: var(--blue-600); animation: progress 1.1s ease-in-out infinite; }
@keyframes progress { from { left: -40%; } to { left: 100%; } }
.empty.loading { padding: 24px 16px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
