/* ==========================================================================
   Nanuq Design System — Core  (verbatim copy of
   zzz_other_files/Nanuq Design System/styles.css, fonts self-hosted)
   Do not hand-edit component rules here; change the design system and
   re-copy. App-specific extensions live in app.css.
   ========================================================================== */
/* Self-hosted IBM Plex (SIL OFL 1.1) — see ../vendor/plex/LICENSE.txt.
   Self-hosted like the Phosphor glyphs so the app renders behind corporate
   proxies with no outbound font requests. */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../vendor/plex/IBMPlexSans-Regular.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("../vendor/plex/IBMPlexSans-Italic.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../vendor/plex/IBMPlexSans-Medium.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../vendor/plex/IBMPlexSans-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../vendor/plex/IBMPlexSans-Bold.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../vendor/plex/IBMPlexMono-Regular.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: italic; font-weight: 400; font-display: swap; src: url("../vendor/plex/IBMPlexMono-Italic.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../vendor/plex/IBMPlexMono-Medium.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("../vendor/plex/IBMPlexMono-SemiBold.woff2") format("woff2"); }

:root {
  /* === Neutrals — cool arctic grey, blue undertone throughout ===========
     Deliberately NOT warm. Nanuq reads like cold storage. */
  --neutral-0:   #ffffff;
  --neutral-25:  #f6f8fb;   /* page */
  --neutral-50:  #eef2f7;   /* subtle fill */
  --neutral-100: #e2e8f0;   /* divider, hover */
  --neutral-200: #cdd6e3;   /* border */
  --neutral-300: #abb8ca;   /* strong border, instrument rule */
  --neutral-400: #7d8da3;   /* subtle fg, axis */
  --neutral-500: #5b6b81;   /* muted fg */
  --neutral-600: #435268;
  --neutral-700: #2e3c50;
  --neutral-800: #1b2735;   /* default fg */
  --neutral-900: #0c141e;   /* max fg, instrument panel */

  /* === Brand — Nanuq blue. The only chromatic colour in chrome. ========= */
  --brand-50:  #eef1ff;
  --brand-100: #dee4ff;
  --brand-200: #c0cbff;
  --brand-300: #98a9ff;
  --brand-400: #6c83ff;
  --brand-500: #3d5afe;   /* primary */
  --brand-600: #2b41d9;
  --brand-700: #1f31a9;
  --brand-800: #17257d;
  --brand-900: #101a54;
  --accent:    var(--brand-500);

  /* === Reading state ====================================================
     Four states, never colour alone — always glyph + colour (see .nq-status).
       ok     in range
       warn   inside the band but within the warn margin of a limit
       breach outside min/max  (direction shown by glyph ▲ / ▼, not hue)
       stale  no data in the expected interval — NOT the same as "fine"
     -------------------------------------------------------------------- */
  --ok-50:   #e6f7f0;
  --ok-100:  #c6ecdd;
  --ok-500:  #0e9f6e;
  --ok-600:  #0b7f58;
  --ok-700:  #08603f;

  --warn-50:  #fdf3e2;
  --warn-100: #fae3bc;
  --warn-500: #d9860b;
  --warn-600: #b06a05;
  --warn-700: #7d4b03;

  --breach-50:  #fdecec;
  --breach-100: #f9d3d3;
  --breach-500: #e02424;
  --breach-600: #b91c1c;
  --breach-700: #8d1414;

  /* Sub-minimum region tint on gauges and charts. Direction, not severity —
     a below-min breach is still red. */
  --cold-50:  #e4f4fa;
  --cold-100: #c3e6f2;
  --cold-500: #0891b2;
  --cold-600: #067393;
  --cold-700: #05566e;

  /* Stale has no hue of its own — it uses neutrals plus a hatch so a dead
     sensor can never be mistaken for a passing one. */
  --hatch-stale: repeating-linear-gradient(45deg, transparent 0, transparent 3px, #abb8ca 3px, #abb8ca 4.5px); /* @kind other */

  /* === Semantic aliases (USE THESE) ===================================== */
  --bg-page:       var(--neutral-25);
  --bg-surface:    var(--neutral-0);
  --bg-raised:     var(--neutral-0);
  --bg-subtle:     var(--neutral-50);
  --bg-hover:      var(--neutral-100);
  --bg-active:     var(--neutral-200);
  --bg-instrument: var(--neutral-900);

  --fg-default:   var(--neutral-800);
  --fg-muted:     var(--neutral-500);
  --fg-subtle:    var(--neutral-400);
  --fg-on-accent: #ffffff;
  --fg-on-dark:   var(--neutral-25);

  --border-subtle:     var(--neutral-100);
  --border-default:    var(--neutral-200);
  --border-strong:     var(--neutral-300);
  --border-instrument: var(--neutral-400);

  /* === Type ============================================================= */
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --text-2xs:  10px;
  --text-xs:   11px;
  --text-sm:   12px;
  --text-base: 14px;   /* UI base — data-dense tool */
  --text-md:   16px;   /* long-form */
  --text-lg:   18px;
  --text-xl:   22px;
  --text-2xl:  28px;
  --text-3xl:  34px;
  --text-4xl:  44px;

  /* Instrument readout scale — mono, tabular, for temperatures only. */
  --readout-sm: 20px;
  --readout-md: 30px;
  --readout-lg: 52px;
  --readout-xl: 76px;

  --leading-tight:  1.15;
  --leading-snug:   1.35;
  --leading-normal: 1.5;
  --leading-loose:  1.65;

  --tracking-tight: -0.014em;
  --tracking-normal: 0;
  --tracking-wide:  0.03em;
  --tracking-caps:  0.07em;

  /* === Spacing — 4px grid ============================================== */
  --space-0:  0px;
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* === Radii — Nanuq is a square system. 2px is the ceiling. =========== */
  --radius-none: 0px;
  --radius-sm:   1px;
  --radius-md:   2px;
  --radius-lg:   2px;

  /* === Elevation — borders do the work; shadows are cool and tight. ==== */
  --shadow-none: none;
  --shadow-sm: 0 1px 2px rgba(12, 20, 30, 0.06);
  --shadow-md: 0 2px 8px rgba(12, 20, 30, 0.10);
  --shadow-lg: 0 8px 32px rgba(12, 20, 30, 0.16);
  --shadow-focus: 0 0 0 3px rgba(61, 90, 254, 0.35);

  /* === Motion — functional only. Live data ticks; nothing slides. ====== */
  --dur-tick:  120ms;  /* @kind other */
  --dur-fast:  140ms;  /* @kind other */
  --dur-base:  200ms;  /* @kind other */
  --dur-slow:  300ms;  /* @kind other */
  --ease-out:    cubic-bezier(0.2, 0.8, 0.2, 1);  /* @kind other */
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);    /* @kind other */

  /* === Layout =========================================================== */
  --container-max: 1320px;
  --rail-w: 3px;        /* status rail on rows and tiles */
  --topbar-h: 52px;
  --sidebar-w: 216px;
  --sidebar-w-rail: 56px;
}

/* === Dark theme — arctic night. Explicit opt-in via [data-theme="dark"]. */
[data-theme="dark"] {
  --neutral-0:   #0b1219;
  --neutral-25:  #0f171f;
  --neutral-50:  #16202b;
  --neutral-100: #1e2a37;
  --neutral-200: #2a3846;
  --neutral-300: #3c4c5d;
  --neutral-400: #6b7d92;
  --neutral-500: #93a3b6;
  --neutral-600: #b3c0d0;
  --neutral-700: #cfd8e3;
  --neutral-800: #e6ecf3;
  --neutral-900: #ffffff;

  --brand-50:  #141c3d;
  --brand-100: #1b2755;
  --brand-200: #253578;
  --brand-300: #3a4fb8;
  --brand-400: #5570f0;
  --brand-500: #6c83ff;   /* lightened one step — #3d5afe is too dark here */
  --brand-600: #8a9cff;
  --brand-700: #a8b6ff;
  --brand-800: #c6cfff;
  --brand-900: #e2e7ff;

  --ok-50:  #0d2a20;
  --ok-100: #134032;
  --ok-500: #2fbd8a;
  --ok-600: #57d3a5;
  --ok-700: #8ee5c4;

  --warn-50:  #2e2107;
  --warn-100: #45320c;
  --warn-500: #eda419;
  --warn-600: #f6bd4d;
  --warn-700: #fad489;

  --breach-50:  #331314;
  --breach-100: #4d1b1c;
  --breach-500: #f4595a;
  --breach-600: #f98787;
  --breach-700: #fdb4b4;

  --cold-50:  #0a2836;
  --cold-100: #0f3b4d;
  --cold-500: #2cb6da;
  --cold-600: #5fcde9;
  --cold-700: #96e0f2;

  --hatch-stale: repeating-linear-gradient(45deg, transparent 0, transparent 3px, #3c4c5d 3px, #3c4c5d 4.5px); /* @kind other */

  --bg-page:       var(--neutral-25);
  --bg-surface:    var(--neutral-50);
  --bg-raised:     var(--neutral-100);
  --bg-subtle:     var(--neutral-50);
  --bg-hover:      var(--neutral-100);
  --bg-active:     var(--neutral-200);
  --bg-instrument: #05090d;

  --fg-default:   var(--neutral-800);
  --fg-muted:     var(--neutral-500);
  --fg-subtle:    var(--neutral-400);
  --fg-on-accent: #0b1219;
  --fg-on-dark:   var(--neutral-800);

  --border-subtle:     var(--neutral-100);
  --border-default:    var(--neutral-200);
  --border-strong:     var(--neutral-300);
  --border-instrument: var(--neutral-400);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.55);
  --shadow-focus: 0 0 0 3px rgba(108, 131, 255, 0.4);
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

body, .nq-body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--fg-default);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); text-decoration: underline; text-underline-offset: 2px; }
[data-theme="dark"] a { color: var(--brand-500); }
[data-theme="dark"] a:hover { color: var(--brand-600); }

h1, .nq-h1 { margin: 0; font-size: var(--text-2xl); font-weight: 600; letter-spacing: var(--tracking-tight); line-height: var(--leading-tight); }
h2, .nq-h2 { margin: 0; font-size: var(--text-xl); font-weight: 600; letter-spacing: var(--tracking-tight); line-height: var(--leading-tight); }
h3, .nq-h3 { margin: 0; font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.008em; }
h4, .nq-h4 { margin: 0; font-size: var(--text-md); font-weight: 600; }

.nq-eyebrow { font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--fg-muted); }
.nq-label   { font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--fg-muted); }
.nq-caption { font-size: var(--text-sm); color: var(--fg-muted); line-height: var(--leading-snug); }
.nq-mono    { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Readout — the instrument numeric. Mono, tabular, unit always present.
   ========================================================================== */
.nq-readout { display: inline-flex; align-items: baseline; gap: 0.12em; font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "zero" 1; letter-spacing: -0.02em; line-height: 1; color: var(--fg-default); }
.nq-readout__unit { font-size: 0.42em; font-weight: 500; letter-spacing: 0; color: var(--fg-muted); transform: translateY(-0.15em); }
.nq-readout--sm { font-size: var(--readout-sm); }
.nq-readout--md { font-size: var(--readout-md); }
.nq-readout--lg { font-size: var(--readout-lg); }
.nq-readout--xl { font-size: var(--readout-xl); }
.nq-readout--warn   { color: var(--warn-700); }
.nq-readout--breach { color: var(--breach-600); }
.nq-readout--stale  { color: var(--fg-subtle); }
.nq-readout--stale .nq-readout__unit { color: var(--fg-subtle); }
/* Value update tick — a 120ms flash, never a slide. */
@keyframes nq-tick { from { background: var(--brand-100); } to { background: transparent; } }
.nq-readout--ticking { animation: nq-tick var(--dur-tick) var(--ease-out); }

/* ==========================================================================
   Status — glyph + colour, never colour alone.
   ========================================================================== */
.nq-status { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-wide); text-transform: uppercase; white-space: nowrap; }
.nq-status__glyph { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; flex: none; border-radius: var(--radius-sm); font-size: 10px; font-weight: 700; line-height: 1; border: 1px solid; }
.nq-status--lg .nq-status__glyph { width: 20px; height: 20px; font-size: 12px; }
.nq-status--lg { font-size: var(--text-sm); }
.nq-status--ok     { color: var(--ok-700); }
.nq-status--ok     .nq-status__glyph { background: var(--ok-50); border-color: var(--ok-500); color: var(--ok-700); }
.nq-status--warn   { color: var(--warn-700); }
.nq-status--warn   .nq-status__glyph { background: var(--warn-50); border-color: var(--warn-500); color: var(--warn-700); }
.nq-status--breach { color: var(--breach-600); }
.nq-status--breach .nq-status__glyph { background: var(--breach-500); border-color: var(--breach-500); color: #fff; }
.nq-status--stale  { color: var(--fg-muted); }
.nq-status--stale  .nq-status__glyph { background: var(--hatch-stale); border-style: dashed; border-color: var(--border-strong); color: var(--fg-muted); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.nq-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 600; letter-spacing: 0.01em; border: 1px solid transparent; border-radius: var(--radius-md); cursor: pointer; white-space: nowrap; transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.nq-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.nq-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.nq-btn--sm { height: 26px; padding: 0 10px; font-size: var(--text-xs); }
.nq-btn--md { height: 34px; padding: 0 14px; }
.nq-btn--lg { height: 44px; padding: 0 20px; font-size: var(--text-base); }
.nq-btn--primary { background: var(--brand-500); border-color: var(--brand-500); color: var(--fg-on-accent); }
.nq-btn--primary:hover:not(:disabled) { background: var(--brand-600); border-color: var(--brand-600); }
.nq-btn--secondary { background: var(--bg-surface); border-color: var(--border-default); color: var(--fg-default); }
.nq-btn--secondary:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-strong); }
.nq-btn--ghost { background: transparent; color: var(--fg-muted); }
.nq-btn--ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--fg-default); }
.nq-btn--danger { background: var(--breach-600); border-color: var(--breach-600); color: #fff; }
.nq-btn--danger:hover:not(:disabled) { background: var(--breach-700); border-color: var(--breach-700); }
.nq-btn--block { width: 100%; }

/* ==========================================================================
   Surfaces
   ========================================================================== */
.nq-card { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-md); }
.nq-card--interactive { cursor: pointer; transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.nq-card--interactive:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.nq-card--interactive:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.nq-card__header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle); }
.nq-card__footer { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border-subtle); }

/* Status rail — a 3px hard edge on the leading side of tiles and rows. */
.nq-rail { border-left: var(--rail-w) solid var(--border-strong); }
.nq-rail--ok     { border-left-color: var(--ok-500); }
.nq-rail--warn   { border-left-color: var(--warn-500); }
.nq-rail--breach { border-left-color: var(--breach-500); }
.nq-rail--stale  { border-left-color: var(--neutral-400); border-left-style: dashed; }

/* ==========================================================================
   Sensor tile
   ========================================================================== */
.nq-tile { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); background: var(--bg-surface); border: 1px solid var(--border-default); border-left-width: var(--rail-w); border-radius: var(--radius-md); text-align: left; width: 100%; font-family: inherit; }
.nq-tile--interactive { cursor: pointer; transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.nq-tile--interactive:hover { box-shadow: var(--shadow-sm); }
.nq-tile--interactive:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.nq-tile--stale { background: var(--bg-subtle); }
.nq-tile__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); }
.nq-tile__name { font-size: var(--text-base); font-weight: 600; letter-spacing: -0.006em; color: var(--fg-default); }
.nq-tile__loc { font-size: var(--text-sm); color: var(--fg-muted); }
.nq-tile__body { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); }
/* The readout keeps its size; the sparkline gives way. A five-character
   negative reading must never push the trend out of the tile. */
.nq-tile__body > .nq-readout { flex: none; }
.nq-tile__spark { flex: 1 1 0; min-width: 0; width: 100%; max-width: 130px; }

/* ==========================================================================
   Fields
   ========================================================================== */
.nq-field { display: flex; flex-direction: column; gap: 6px; }
.nq-field__label { font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--fg-muted); }
.nq-field__req { color: var(--breach-500); }
.nq-field__wrap { display: flex; align-items: stretch; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface); transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.nq-field__wrap:focus-within { border-color: var(--brand-500); box-shadow: var(--shadow-focus); }
.nq-field--error .nq-field__wrap { border-color: var(--breach-500); }
.nq-field__input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border: none; background: transparent; font-family: var(--font-sans); font-size: var(--text-base); color: var(--fg-default); border-radius: var(--radius-md); }
.nq-field__input:focus { outline: none; }
.nq-field__input::placeholder { color: var(--fg-subtle); }
.nq-field__input--mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.nq-field__unit { display: flex; align-items: center; padding: 0 10px; font-family: var(--font-mono); font-size: var(--text-sm); color: var(--fg-muted); background: var(--bg-subtle); border-left: 1px solid var(--border-default); }
.nq-field__helper { font-size: var(--text-sm); color: var(--fg-muted); }
.nq-field__error { font-size: var(--text-sm); color: var(--breach-600); font-weight: 500; }

/* ==========================================================================
   Segmented control — time ranges
   ========================================================================== */
.nq-seg { display: inline-flex; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface); overflow: hidden; }
.nq-seg__btn { appearance: none; border: none; background: transparent; font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 500; color: var(--fg-muted); padding: 0 12px; height: 30px; cursor: pointer; border-right: 1px solid var(--border-subtle); transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.nq-seg__btn:last-child { border-right: none; }
.nq-seg__btn:hover:not([aria-pressed="true"]) { background: var(--bg-hover); color: var(--fg-default); }
.nq-seg__btn[aria-pressed="true"] { background: var(--brand-500); color: var(--fg-on-accent); font-weight: 600; }
.nq-seg__btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); position: relative; z-index: 1; }
.nq-seg--sm .nq-seg__btn { height: 24px; padding: 0 9px; font-size: var(--text-xs); }

/* ==========================================================================
   Table — dense hairline grid. Mono numerics. Collapses on mobile.
   ========================================================================== */
.nq-table { width: 100%; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface); overflow: hidden; }
.nq-table__head { display: none; }
.nq-table__row { display: grid; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border-subtle); align-items: center; font-size: var(--text-base); }
.nq-table__row:first-child { border-top: none; }
.nq-table--clickable .nq-table__row { cursor: pointer; transition: background var(--dur-fast) var(--ease-out); }
.nq-table--clickable .nq-table__row:hover { background: var(--bg-hover); }
.nq-table__cell { min-width: 0; }
.nq-table__cell--mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--text-sm); }
.nq-table__cell--num { text-align: right; }
.nq-table__cell-label { display: block; font-size: var(--text-2xs); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--fg-subtle); margin-bottom: 2px; }
@media (min-width: 768px) {
  .nq-table__head { display: grid; gap: var(--space-3); padding: var(--space-2) var(--space-4); background: var(--bg-subtle); border-bottom: 1px solid var(--border-default); font-size: var(--text-2xs); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--fg-muted); }
  .nq-table__cell-label { display: none; }
  .nq-table__row { padding: 10px var(--space-4); }
}
@media (max-width: 767px) {
  .nq-table__row { grid-template-columns: 1fr 1fr !important; row-gap: var(--space-2); }
}

/* ==========================================================================
   Alarm row
   ========================================================================== */
.nq-alarm { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); background: var(--bg-surface); border: 1px solid var(--border-default); border-left-width: var(--rail-w); border-radius: var(--radius-md); }
.nq-alarm--ack { background: var(--bg-subtle); }
.nq-alarm__sensor { font-size: var(--text-base); font-weight: 600; color: var(--fg-default); }
.nq-alarm__msg { font-size: var(--text-sm); color: var(--fg-muted); }
.nq-alarm__side { display: flex; align-items: center; gap: var(--space-3); }
@media (max-width: 639px) {
  .nq-alarm { grid-template-columns: auto 1fr; }
  .nq-alarm__side { grid-column: 1 / -1; justify-content: space-between; padding-top: var(--space-1); border-top: 1px solid var(--border-subtle); }
}

/* ==========================================================================
   Timestamp
   ========================================================================== */
.nq-ts { display: inline-flex; align-items: baseline; gap: 6px; font-family: var(--font-mono); font-size: var(--text-sm); font-variant-numeric: tabular-nums; color: var(--fg-muted); }
.nq-ts__abs { color: var(--fg-subtle); font-size: var(--text-xs); }
.nq-ts--stale { color: var(--breach-600); font-weight: 500; }

/* ==========================================================================
   Empty state
   ========================================================================== */
.nq-empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-12) var(--space-6); text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); background: var(--bg-subtle); }
.nq-empty__title { font-size: var(--text-md); font-weight: 600; color: var(--fg-default); }
.nq-empty__desc { font-size: var(--text-sm); color: var(--fg-muted); max-width: 42ch; }

/* ==========================================================================
   Utilities
   ========================================================================== */
.nq-grid-tiles { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.nq-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.nq-stack { display: flex; flex-direction: column; gap: var(--space-2); }
.nq-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }


/* ==========================================================================
   Shell tokens — the nav chrome is a fixed dark surface in both themes,
   so it needs its own scale rather than flipping neutrals.
   ========================================================================== */
:root {
  --mobile-tabs-h: 58px;
  --shell-bg:        #0c141e;
  --shell-fg:        #abb8ca;
  --shell-fg-strong: #ffffff;
  --shell-border:    #1b2735;
  --shell-hover:     #1b2735;
  --shell-active:    #2e3c50;
}
[data-theme="dark"] {
  --shell-bg:        #070c12;
  --shell-fg:        #93a3b6;
  --shell-fg-strong: #ffffff;
  --shell-border:    #1e2a37;
  --shell-hover:     #16202b;
  --shell-active:    #2a3846;
}

/* ==========================================================================
   App shell — sidebar (desktop) → icon rail (tablet) → bottom tabs (field)
   ========================================================================== */
.nq-shell { display: flex; min-height: 100vh; background: var(--bg-page); }
.nq-shell__side { width: var(--sidebar-w); flex: none; background: var(--shell-bg); color: var(--shell-fg); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.nq-shell__brand { display: flex; align-items: center; gap: 10px; flex: none; height: var(--topbar-h); padding: 0 14px; border-bottom: 1px solid var(--shell-border); color: var(--shell-fg-strong); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.nq-shell__mark { width: 20px; height: 20px; flex: none; background: var(--brand-500); border-radius: 1px; display: flex; align-items: center; justify-content: center; color: #fff; font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.nq-shell__foot { flex: none; border-top: 1px solid var(--shell-border); padding: 6px 0; }
.nq-shell__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nq-shell__top { flex: none; min-height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; background: var(--bg-surface); border-bottom: 1px solid var(--border-default); position: sticky; top: 0; z-index: 10; }
.nq-shell__body { flex: 1; width: 100%; max-width: var(--container-max); margin: 0 auto; padding: 20px 24px 40px; box-sizing: border-box; }
.nq-shell__tabs { display: none; }

.nq-nav { display: flex; flex-direction: column; gap: 1px; padding: 8px 0; flex: 1; overflow-y: auto; }
.nq-nav__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 14px; background: transparent; border: none; border-left: var(--rail-w) solid transparent; color: var(--shell-fg); font-family: var(--font-sans); font-size: var(--text-base); font-weight: 500; text-align: left; cursor: pointer; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.nq-nav__item:hover { background: var(--shell-hover); color: var(--shell-fg-strong); }
.nq-nav__item[aria-current="page"] { background: var(--shell-active); color: var(--shell-fg-strong); border-left-color: var(--brand-500); font-weight: 600; }
.nq-nav__item:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.nq-nav__glyph { width: 18px; flex: none; text-align: center; font-family: var(--font-mono); font-size: 13px; }
.nq-nav__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nq-nav__count { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600; padding: 1px 5px; border-radius: var(--radius-sm); background: var(--breach-500); color: #fff; }
.nq-nav__count--muted { background: var(--shell-active); color: var(--shell-fg); }

/* Site switcher */
.nq-site { position: relative; padding: 8px 10px; flex: none; }
.nq-site__btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px; background: var(--shell-hover); border: 1px solid var(--shell-border); border-radius: var(--radius-md); color: var(--shell-fg-strong); font-family: var(--font-sans); font-size: var(--text-sm); text-align: left; cursor: pointer; }
.nq-site__btn:hover { border-color: var(--shell-active); }
.nq-site__btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.nq-site__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.nq-site__caret { flex: none; font-family: var(--font-mono); font-size: 10px; opacity: 0.7; }
.nq-site__menu { position: absolute; left: 10px; right: 10px; top: calc(100% - 2px); z-index: 40; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 3px; max-height: 260px; overflow: auto; }
.nq-site__opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 9px; background: transparent; border: none; border-radius: var(--radius-sm); font-family: var(--font-sans); font-size: var(--text-sm); color: var(--fg-default); text-align: left; cursor: pointer; }
.nq-site__opt:hover { background: var(--bg-hover); }
.nq-site__opt[aria-selected="true"] { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.nq-site__meta { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--fg-subtle); }

@media (min-width: 768px) and (max-width: 1023px) {
  .nq-shell__side { width: var(--sidebar-w-rail); }
  .nq-nav__label, .nq-site__name, .nq-site__caret, .nq-nav__count, .nq-shell__brand span { display: none; }
  .nq-nav__item { justify-content: center; padding: 11px 0; }
  .nq-shell__brand { justify-content: center; padding: 0; }
  .nq-site { padding: 8px 6px; }
  .nq-site__btn { justify-content: center; padding: 7px 0; }
  .nq-site__menu { left: 6px; width: 210px; right: auto; }
}

@media (max-width: 767px) {
  .nq-shell { flex-direction: column; }
  .nq-shell__side { display: none; }
  .nq-shell__body { padding: 16px 14px calc(var(--mobile-tabs-h) + 20px); }
  .nq-shell__tabs { display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: var(--mobile-tabs-h); background: var(--bg-surface); border-top: 1px solid var(--border-default); z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
  .nq-tab { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: transparent; border: none; border-top: 2px solid transparent; color: var(--fg-muted); font-family: var(--font-sans); font-size: var(--text-2xs); font-weight: 600; cursor: pointer; }
  .nq-tab[aria-current="page"] { color: var(--brand-600); border-top-color: var(--brand-500); }
  .nq-tab:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
  .nq-tab__glyph { font-family: var(--font-mono); font-size: 15px; }
  .nq-tab__count { position: absolute; top: 5px; left: 50%; margin-left: 4px; font-family: var(--font-mono); font-size: 9px; font-weight: 700; background: var(--breach-500); color: #fff; border-radius: var(--radius-sm); padding: 0 3px; }
}

/* ==========================================================================
   Toggle — square knob, brand when on
   ========================================================================== */
.nq-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--text-base); color: var(--fg-default); }
.nq-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.nq-toggle__track { width: 38px; height: 20px; flex: none; position: relative; background: var(--neutral-300); border-radius: var(--radius-md); transition: background var(--dur-fast) var(--ease-out); }
.nq-toggle__knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 1px; transition: transform var(--dur-fast) var(--ease-out); }
.nq-toggle input:checked + .nq-toggle__track { background: var(--brand-500); }
.nq-toggle input:checked + .nq-toggle__track .nq-toggle__knob { transform: translateX(18px); }
.nq-toggle input:focus-visible + .nq-toggle__track { box-shadow: var(--shadow-focus); }
.nq-toggle input:disabled + .nq-toggle__track { opacity: 0.45; }
.nq-toggle--disabled { cursor: not-allowed; color: var(--fg-subtle); }

/* ==========================================================================
   Select
   ========================================================================== */
.nq-select { position: relative; display: flex; width: 100%; }
.nq-select__el { appearance: none; -webkit-appearance: none; width: 100%; height: 34px; padding: 0 30px 0 10px; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-md); font-family: var(--font-sans); font-size: var(--text-base); color: var(--fg-default); cursor: pointer; }
.nq-select__el:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--shadow-focus); }
.nq-select__el:disabled { opacity: 0.45; cursor: not-allowed; }
.nq-select__caret { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--fg-muted); font-family: var(--font-mono); font-size: 10px; }
.nq-select--mono .nq-select__el { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Modal — centred on desktop, bottom sheet on small screens
   ========================================================================== */
.nq-modal__scrim { position: fixed; inset: 0; z-index: 50; background: rgba(12, 20, 30, 0.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.nq-modal { display: flex; flex-direction: column; width: 100%; max-width: 520px; max-height: calc(100vh - 40px); background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.nq-modal--sm { max-width: 400px; }
.nq-modal--lg { max-width: 720px; }
.nq-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); }
.nq-modal__title { font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.008em; }
.nq-modal__sub { font-size: var(--text-sm); color: var(--fg-muted); margin-top: 2px; }
.nq-modal__body { flex: 1; padding: 16px; overflow: auto; }
.nq-modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border-subtle); }
.nq-modal__x { background: transparent; border: none; color: var(--fg-muted); font-family: var(--font-mono); font-size: 15px; padding: 2px 6px; border-radius: var(--radius-sm); cursor: pointer; }
.nq-modal__x:hover { background: var(--bg-hover); color: var(--fg-default); }
@media (max-width: 639px) {
  .nq-modal__scrim { padding: 0; align-items: flex-end; }
  .nq-modal { max-width: none; max-height: 88vh; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; }
}

/* ==========================================================================
   Role badge — neutrals and brand only. Status colour is for readings.
   ========================================================================== */
.nq-role { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border: 1px solid; border-radius: var(--radius-sm); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.nq-role--admin   { background: var(--brand-50); border-color: var(--brand-500); color: var(--brand-700); }
.nq-role--manager { background: var(--neutral-100); border-color: var(--border-strong); color: var(--fg-default); }
.nq-role--staff   { background: transparent; border-color: var(--border-default); color: var(--fg-muted); }
.nq-role--auditor { background: transparent; border-color: var(--border-strong); border-style: dashed; color: var(--fg-muted); }
.nq-role--tech    { background: var(--bg-subtle); border-color: var(--border-default); color: var(--fg-muted); font-family: var(--font-mono); font-weight: 500; }

/* ==========================================================================
   Auth — single centred panel, flat. No gradient, no illustration.
   ========================================================================== */
.nq-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg-page); }
.nq-auth__panel { width: 100%; max-width: 380px; }
.nq-auth__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-size: 18px; font-weight: 600; letter-spacing: -0.012em; color: var(--fg-default); }
.nq-auth__mark { width: 26px; height: 26px; flex: none; background: var(--brand-500); border-radius: 1px; display: flex; align-items: center; justify-content: center; color: #fff; font-family: var(--font-mono); font-size: 15px; font-weight: 600; }
.nq-auth__foot { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: var(--text-sm); }
