/* ==========================================================================
   Entwine Systems · Store Asset Monitor
   Design system aligned to entwinesystems.com (blue / commercial theme).

   Brand tokens lifted verbatim from the marketing site:
     --navy #0f1b35 · --navy-mid #1e3a6e · --cyan #0ea5c9
     --blue #1d6fa8 · --blue-deep #1e4d8c · --bg #f0f6ff · --bg-deep #e4eef9
   Type: Outfit (UI) · Playfair Display (display) · JetBrains Mono (keys)

   Chart colour is validated, not eyeballed (dataviz six-checks, both modes):
     status ok #0ca30c · warning #fab219 · critical #d03b3b · series #1d6fa8
     CVD separation PASS · normal-vision floor PASS in light and dark.
     Status warning sits below 3:1 on light by design — every status therefore
     ships an ICON + TEXT LABEL, and every chart has a table view. Colour alone
     never carries meaning anywhere in this file.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Playfair+Display:wght@500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* Brand face, declared exactly as entwinesystems.com does: used when the
   viewer has it installed, otherwise the Outfit fallback takes over. */
@font-face { font-family: 'Stream BC'; src: local('Stream BC'), local('StreamBC'); }

/* ---- tokens -------------------------------------------------------------- */

:root {
  color-scheme: light;

  /* brand */
  --navy:            #0f1b35;
  --navy-mid:        #1e3a6e;
  --cyan:            #0ea5c9;
  --blue:            #1d6fa8;
  --blue-deep:       #1e4d8c;
  --sky:             #0ea5c9;   /* site uses #84DCF4 on its dark nav */

  /* surfaces & ink */
  --page:            #f0f6ff;
  --page-deep:       #e4eef9;
  --surface-1:       #ffffff;
  --surface-2:       #f5f9ff;
  --surface-3:       #e8f1fb;
  --text-primary:    #0f1b35;
  --text-secondary:  #2d5a8e;
  --text-muted:      #5a86b0;
  --border:          rgba(14, 165, 201, 0.18);
  --border-strong:   rgba(14, 165, 201, 0.38);
  --grid:            rgba(15, 27, 53, 0.08);
  --axis:            rgba(15, 27, 53, 0.18);

  /* status — fixed, never themed, never alone */
  --st-ok:           #0ca30c;
  --st-warning:      #fab219;
  --st-critical:     #d03b3b;
  --st-info:         #1d6fa8;

  /* chart series hue (non-status channels) */
  --series-1:        #1d6fa8;

  --wash-warning:    rgba(250, 178, 25, 0.13);
  --wash-critical:   rgba(208, 59, 59, 0.09);

  --shadow-sm: 0 1px 2px rgba(15, 27, 53, 0.05);
  --shadow-md: 0 2px 6px rgba(15, 27, 53, 0.06), 0 10px 28px rgba(15, 27, 53, 0.07);
  --shadow-lg: 0 10px 24px rgba(15, 27, 53, 0.10), 0 30px 70px rgba(15, 27, 53, 0.14);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 100px;

  --font: 'Outfit', system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --topbar-h: 62px;
}

/* Dark mode derived from the brand navy — the ops room / 24-7 view.
   Declared under both scopes so the OS setting and the in-app toggle
   each win in their own direction. */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page:           #081020;
    --page-deep:      #050b16;
    --surface-1:      #0f1b35;
    --surface-2:      #16274a;
    --surface-3:      #1e3459;
    --text-primary:   #eaf2fb;
    --text-secondary: #a9c4e2;
    --text-muted:     #7593b8;
    --border:         rgba(14, 165, 201, 0.22);
    --border-strong:  rgba(14, 165, 201, 0.45);
    --grid:           rgba(234, 242, 251, 0.09);
    --axis:           rgba(234, 242, 251, 0.20);
    --series-1:       #22b8dd;
    --st-info:        #22b8dd;
    --sky:            #84DCF4;
    --wash-warning:   rgba(250, 178, 25, 0.12);
    --wash-critical:  rgba(208, 59, 59, 0.14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.45), 0 10px 28px rgba(0, 0, 0, 0.40);
    --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.55), 0 30px 70px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page:           #081020;
  --page-deep:      #050b16;
  --surface-1:      #0f1b35;
  --surface-2:      #16274a;
  --surface-3:      #1e3459;
  --text-primary:   #eaf2fb;
  --text-secondary: #a9c4e2;
  --text-muted:     #7593b8;
  --border:         rgba(14, 165, 201, 0.22);
  --border-strong:  rgba(14, 165, 201, 0.45);
  --grid:           rgba(234, 242, 251, 0.09);
  --axis:           rgba(234, 242, 251, 0.20);
  --series-1:       #22b8dd;
  --st-info:        #22b8dd;
  --sky:            #84DCF4;
  --wash-warning:   rgba(250, 178, 25, 0.12);
  --wash-critical:  rgba(208, 59, 59, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.45), 0 10px 28px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.55), 0 30px 70px rgba(0, 0, 0, 0.55);
}

/* ---- base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

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

/* ---- login --------------------------------------------------------------- */

.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 560px at 50% -8%, rgba(14, 165, 201, 0.14), transparent 70%),
    linear-gradient(180deg, var(--page), var(--page-deep));
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-brand { display: flex; align-items: center; gap: 12px; }
/* On the login card the mark is larger — its circuit detail needs the room. */
.login-brand .logo { width: 46px; height: 46px; }
.login-brand .wordmark b { font-size: 16px; }
.login-brand .wordmark i { font-size: 8px; }

.login-product { display: flex; flex-direction: column; gap: 3px; margin-top: -2px; }
.login-product h1 { font-family: var(--font-display); font-size: 21px; font-weight: 600; }
.login-card .tagline { margin: 0; }
.login-card .sub { margin: 0 0 4px; color: var(--text-secondary); font-size: 13px; }

/* The Entwine circuit mark, as used on entwinesystems.com. */
.logo {
  width: 38px;
  height: 38px;
  flex: none;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(132, 220, 244, 0.28));
}

/* Wordmark lockup — ENTWINE over SYSTEMS, with the site's tracking.
   'Stream BC' is the brand face; it is used when installed locally and
   falls back to Outfit, which is what the website itself does. */
.wordmark {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.06;
  flex: none;
}
.wordmark b {
  font-family: 'Stream BC', var(--font);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}
.wordmark i {
  font-family: 'Stream BC', var(--font);
  font-size: 6.5px;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--sky);
}

.brand-rule {
  width: 1px;
  height: 26px;
  background: var(--border-strong);
  flex: none;
}
.brand-txt { min-width: 0; }

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.login-card input, .field {
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.login-card input:focus, .field:focus { background: var(--surface-1); outline-offset: 0; }

.btn-primary {
  margin-top: 6px;
  padding: 12px 22px;
  border: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--cyan), var(--blue-deep));
  color: #fff;
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--ease) 0.3s;
  transition-property: transform, box-shadow, filter;
  box-shadow: 0 4px 14px rgba(14, 165, 201, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(14, 165, 201, 0.4); }
.btn-primary:disabled { opacity: 0.55; cursor: default; transform: none; }

.login-err {
  color: var(--st-critical);
  font-size: 13px;
  min-height: 18px;
  display: flex; align-items: center; gap: 6px;
}
.login-err:not(:empty)::before { content: "⚠"; }

.demo-hint {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}
.demo-hint code { font-family: var(--mono); font-size: 11px; }

.tagline {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
  font-weight: 500;
}

/* ---- top bar ------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface-1) 86%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 { font-family: var(--font-display); font-size: 16px; font-weight: 600; white-space: nowrap; }
.brand .sub {
  margin: 0; font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.topbar-spacer { flex: 1; }
.status-cluster { display: flex; align-items: center; gap: 8px; }

.store-select {
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 500;
  max-width: 210px;
  cursor: pointer;
}

/* health chips — dot + word, so state never rides on colour alone */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); flex: none; }
.chip.up .dot { background: var(--st-ok); }
.chip.down .dot { background: var(--st-critical); }
.chip.up { border-color: color-mix(in srgb, var(--st-ok) 38%, var(--border)); }
.chip.down {
  border-color: color-mix(in srgb, var(--st-critical) 45%, var(--border));
  color: var(--text-primary);
  background: var(--wash-critical);
}

.clock { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text-primary); border-color: var(--border-strong); }

/* ---- layout -------------------------------------------------------------- */

main {
  max-width: 1520px;
  margin: 0 auto;
  padding: 26px 20px 72px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head h2 {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.section-head .hint { font-size: 12px; color: var(--text-muted); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 26px;
  align-items: start;
}
@media (max-width: 1100px) { .layout { grid-template-columns: 1fr; } }

/* ---- hero band ----------------------------------------------------------- */

.summary {
  display: grid;
  grid-template-columns: minmax(280px, 1.5fr) repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
@media (max-width: 900px) { .summary { grid-template-columns: 1fr 1fr; } }

.hero, .stat { background: var(--surface-1); padding: 20px 22px; }

.hero { display: flex; flex-direction: column; gap: 6px; }
.hero .k {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-muted); font-weight: 600;
}
/* Hero figure — the one big number on the view.
   Proportional figures (never tabular at display size). */
.hero .v {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--font-display);
  font-size: 48px; line-height: 1.05; font-weight: 600; letter-spacing: -0.025em;
}
.hero .v .glyph { font-family: var(--font); font-size: 30px; line-height: 1; }
.hero .note { font-size: 12px; color: var(--text-secondary); }
.hero.ok .glyph { color: var(--st-ok); }
.hero.warn .glyph { color: var(--st-warning); }
.hero.crit .glyph { color: var(--st-critical); }

.stat { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.stat .k {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-muted); font-weight: 600;
}
.stat .v { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.stat .v small { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.stat .sub { font-size: 12px; color: var(--text-secondary); }

/* ---- asset cards --------------------------------------------------------- */

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 17px 17px 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
  transition: var(--ease) 0.3s;
  transition-property: box-shadow, transform, border-color;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }

/* status rail — supplements the badge, never the sole signal */
.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--text-muted);
}
.card.ok::before       { background: var(--st-ok); }
.card.warning::before  { background: var(--st-warning); }
.card.critical::before { background: var(--st-critical); }
.card.warning  { background: linear-gradient(var(--wash-warning), var(--wash-warning)), var(--surface-1); }
.card.critical { background: linear-gradient(var(--wash-critical), var(--wash-critical)), var(--surface-1); }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-head .name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
}
.badge .glyph { font-size: 11px; line-height: 1; }
.badge.ok       { color: var(--st-ok);        border-color: color-mix(in srgb, var(--st-ok) 42%, var(--border)); }
.badge.warning  { color: var(--text-primary); border-color: color-mix(in srgb, var(--st-warning) 58%, var(--border)); background: var(--wash-warning); }
.badge.critical { color: var(--st-critical);  border-color: color-mix(in srgb, var(--st-critical) 48%, var(--border)); background: var(--wash-critical); }
.badge.info     { color: var(--st-info);      border-color: color-mix(in srgb, var(--st-info) 42%, var(--border)); }

.reading { display: flex; align-items: baseline; gap: 7px; }
.reading .big { font-size: 32px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.reading .unit { font-size: 14px; color: var(--text-secondary); font-weight: 400; }
.reading .set { margin-left: auto; font-size: 11px; color: var(--text-muted); }

.spark { width: 100%; height: 48px; display: block; }

.meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 11px;
  border-top: 1px solid var(--border);
}

.skeleton {
  border-radius: var(--r-lg);
  background: linear-gradient(90deg, var(--surface-1) 0%, var(--surface-2) 50%, var(--surface-1) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  height: 176px;
  border: 1px solid var(--border);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- alerts rail --------------------------------------------------------- */

.alerts { position: sticky; top: calc(var(--topbar-h) + 26px); }

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: calc(100dvh - var(--topbar-h) - 150px);
  overflow-y: auto;
  padding-right: 3px;
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.count.hot { background: var(--st-critical); color: #fff; }

.alert {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.alert.critical { border-left-color: var(--st-critical); }
.alert.warning  { border-left-color: var(--st-warning); }
.alert.info     { border-left-color: var(--st-info); }

.alert .msg { font-size: 13px; line-height: 1.5; }
.alert .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.alert .when { font-size: 11px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 5px; }

.ack {
  padding: 4px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.ack:hover { background: var(--surface-3); color: var(--text-primary); }

.empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--surface-1);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
}
.empty .glyph { display: block; font-size: 22px; margin-bottom: 8px; color: var(--st-ok); }

/* ---- modal --------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 16, 32, 0.6);
  backdrop-filter: blur(4px);
}

.modal {
  width: 100%;
  max-width: 900px;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 19px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.modal-head .spacer { flex: 1; }

.close {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  cursor: pointer;
  color: var(--text-secondary);
}
.close:hover { background: var(--surface-3); color: var(--text-primary); }

.modal-body { padding: 19px; overflow-y: auto; }

/* segmented control — chart / table view switch */
.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-2);
}
.seg button {
  padding: 5px 13px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.seg button[aria-pressed="true"] { background: var(--surface-1); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* small multiples — one channel per panel, single series each */
.panel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 14px; }

.panel {
  padding: 13px 13px 9px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.panel-head .plabel { font-size: 12px; color: var(--text-secondary); }
.panel-head .pvalue { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.panel canvas { width: 100%; height: 78px; display: block; }
.panel .prange {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; padding-top: 3px;
}

/* table view — the always-available non-colour channel */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 8px 11px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th {
  color: var(--text-muted); font-weight: 600; text-transform: uppercase;
  font-size: 10px; letter-spacing: 0.09em;
  position: sticky; top: 0; background: var(--surface-1);
}
.data-table td:last-child, .data-table th:last-child { text-align: right; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .st { display: inline-flex; align-items: center; gap: 5px; }

/* chart tooltip */
.viz-tip {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  padding: 7px 10px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.viz-tip .t { color: var(--text-muted); font-size: 11px; }

/* ---- settings ------------------------------------------------------------ */

.set-section { margin-bottom: 24px; }
.set-section:last-child { margin-bottom: 0; }
.set-section h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--text-muted); margin-bottom: 11px;
}

.chan-row {
  display: grid;
  grid-template-columns: 88px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 7px;
  font-size: 13px;
}
.chan-row .type { font-weight: 600; text-transform: capitalize; }
.chan-row .tgt { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan-row .sev { font-size: 11px; color: var(--text-muted); }
.chan-row .del {
  padding: 4px 11px; border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  background: var(--surface-1); font-size: 11px; cursor: pointer; color: var(--text-secondary);
}
.chan-row .del:hover { color: var(--st-critical); border-color: var(--st-critical); }

.add-chan { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; }
.add-chan select, .add-chan input {
  padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface-2); font-size: 13px;
}
.add-chan input { flex: 1; min-width: 170px; }
.add-chan button {
  padding: 8px 18px; border: 0; border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--cyan), var(--blue-deep));
  color: #fff; font-weight: 600; font-size: 13px; cursor: pointer;
}

.hint { font-size: 12px; color: var(--text-muted); margin: 9px 0 0; }
.hint code { font-family: var(--mono); font-size: 11px; }

.keybox {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.keybox code { flex: 1; font-family: var(--mono); font-size: 12px; overflow-x: auto; color: var(--text-primary); }
.keybox button {
  padding: 5px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  background: var(--surface-1); font-size: 11px; cursor: pointer; flex: none;
}

/* ---- toast --------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 90;
  padding: 10px 20px;
  background: var(--navy);
  color: #eaf2fb;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
}

/* ---- forced colours ------------------------------------------------------ */

@media (forced-colors: active) {
  .card, .alert, .panel, .modal, .chip { border: 1px solid CanvasText; }
  .card::before { forced-color-adjust: none; }
}

/* ---- narrow -------------------------------------------------------------- */

@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .brand h1, .brand .sub, .clock, .wordmark, .brand-rule { display: none; }
  main { padding: 16px 12px 52px; }
  .summary { grid-template-columns: 1fr; }
  .hero .v { font-size: 32px; }
  .alerts { position: static; }
  .chan-row { grid-template-columns: 1fr auto; }
  .modal-body { padding: 14px; }
}
