/* ==========================================================================================================================
   Nuclio UI - the shared design layer of the office portal (both companies). Claude 2026-10-31, branch claude/ui-foundation.
   Docs: docs/ui/design-system.md. Loaded by every office v2 page right after v2.css; NOT by the technician phone pages.

   SAFE BY DESIGN: loading this file changes nothing on its own.
     1. Tokens  - CSS variables, all named --nu-*  (no existing variable is redefined).
     2. Components - classes named .nu-*  (opt-in; no existing class is restyled).
     3. Skin    - <body class="nu-skin"> restyles the EXISTING shared classes inside <main> (.btn, inputs, .v2-card, .cl-table,
                  .of-notice, .pill ...) with the tokens. A page opts in when its batch is converted (Phase 2).
   Company colours follow html.co-tt (company-brand.js); dark mode follows html[data-theme="dark"] (theme-boot.js).
   ========================================================================================================================== */

/* ---------- 1. TOKENS ---------- */
:root {
  /* brand: Nuclio (product) + company (tenant). CC-Teknologies = navy chrome + blue action. */
  --nu-nuclio: #6d3fd6;            /* Nuclio violet - product marks only (launcher, Ask Nuclio, AI) */
  --nu-nuclio-soft: #efe9fd;
  --nu-chrome: var(--nav, #102f49);   /* top bar gradient start (portal-shell --nav; TT overrides it) */
  --nu-chrome-2: var(--nav2, #173f60);
  --nu-brand: #1769aa;             /* primary action / links / selected - 5.8:1 on white */
  --nu-brand-hover: #125688;
  --nu-brand-soft: #e7f1fa;        /* selected row / pressed chip background */
  --nu-brand-border: #a9cbe8;
  --nu-on-brand: #ffffff;
  --nu-accent: #58cae9;            /* logo accent ("TEK") - decoration only, never text on white */

  /* neutrals (cool slate) */
  --nu-bg: #f3f5f8;                /* page plane */
  --nu-surface: #ffffff;           /* cards, tables, inputs */
  --nu-surface-2: #f8fafc;         /* subtle fill: toolbars, zebra rows, card headers */
  --nu-surface-3: #eef2f6;         /* table header, pressed */
  --nu-border: #dde3ea;            /* hairlines */
  --nu-border-strong: #8592a0;     /* input / control borders - 3.2:1 on white (WCAG 1.4.11 non-text contrast) */
  --nu-text: #1b2733;              /* 15.3:1 */
  --nu-text-2: #485868;            /* secondary - 7.4:1 */
  --nu-text-3: #627285;            /* muted / captions - 4.9:1 (AA for small text) */
  --nu-overlay: rgba(15, 23, 32, .48);
  --nu-card-alpha: var(--cc-box-alpha, 1);   /* backdrop.js see-through slider keeps working */
  --nu-surface-rgb: var(--panel-rgb, 255, 255, 255);

  /* semantic (text colour passes AA on its own soft background) */
  --nu-success: #177a4c; --nu-success-soft: #e3f4ea; --nu-success-border: #a6d9bd;
  --nu-warn: #8f5208;    --nu-warn-soft: #fff3dc;    --nu-warn-border: #ecc983;
  --nu-danger: #b42318;  --nu-danger-soft: #fdecea;  --nu-danger-border: #f1b0a9;
  --nu-info: #155e9c;    --nu-info-soft: #e6f1fb;    --nu-info-border: #b5d4f4;
  --nu-solid-success: #177a4c; --nu-solid-danger: #b42318; --nu-solid-warn: #b45309;

  /* typography - ONE stack; Segoe UI first keeps today's look on the office Windows PCs (same first/last fonts as
     portal-shell.css "Segoe UI",Arial, so a skinned page and an old page render the same face side by side).
     No generic system-ui: on Linux kiosks it maps to unpredictable faces. */
  --nu-font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --nu-font-mono: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --nu-fs-xs: 12px; --nu-fs-sm: 13px; --nu-fs-md: 14px; --nu-fs-lg: 16px; --nu-fs-xl: 18px; --nu-fs-2xl: 22px; --nu-fs-3xl: 28px;
  --nu-lh: 1.45; --nu-lh-tight: 1.2;
  --nu-fw-regular: 400; --nu-fw-medium: 500; --nu-fw-semibold: 600; --nu-fw-bold: 700;

  /* spacing 4/8 scale */
  --nu-s-0: 2px; --nu-s-1: 4px; --nu-s-2: 8px; --nu-s-3: 12px; --nu-s-4: 16px; --nu-s-5: 20px; --nu-s-6: 24px; --nu-s-8: 32px; --nu-s-10: 40px;
  --nu-gutter: clamp(16px, 2vw, 32px);   /* page side padding; 16 px on phones */

  /* shape + depth */
  --nu-r-sm: 6px; --nu-r-md: 8px; --nu-r-lg: 12px; --nu-r-pill: 999px;
  --nu-shadow-sm: 0 1px 2px rgba(16, 32, 48, .06), 0 1px 1px rgba(16, 32, 48, .04);
  --nu-shadow-md: 0 4px 12px rgba(16, 32, 48, .08), 0 1px 3px rgba(16, 32, 48, .06);
  --nu-shadow-lg: 0 18px 40px rgba(16, 32, 48, .18), 0 4px 10px rgba(16, 32, 48, .08);
  --nu-focus: 0 0 0 3px rgba(23, 105, 170, .35);
  --nu-focus-color: #1769aa;

  /* controls */
  --nu-ctl-h: 36px; --nu-ctl-h-sm: 30px; --nu-ctl-h-lg: 44px;
  --nu-ease: cubic-bezier(.2, .7, .3, 1); --nu-dur: .14s;

  /* charts - validated categorical order (dataviz reference palette: adjacent CVD dE >= 8 both modes; <= 3 series for
     scatter/all-pairs forms). Status colours are NOT series colours. */
  --nu-cat-1: #2a78d6; --nu-cat-2: #eb6834; --nu-cat-3: #1baf7a; --nu-cat-4: #eda100;
  --nu-cat-5: #e87ba4; --nu-cat-6: #008300; --nu-cat-7: #6250d6; --nu-cat-8: #e34948;
  --nu-seq-1: #cde2fb; --nu-seq-2: #9ec5f4; --nu-seq-3: #6da7ec; --nu-seq-4: #3987e5; --nu-seq-5: #256abf; --nu-seq-6: #184f95; --nu-seq-7: #0d366b;
  --nu-div-neg: #e34948; --nu-div-mid: #f0efec; --nu-div-pos: #2a78d6;
  --nu-status-good: #0ca30c; --nu-status-warning: #fab219; --nu-status-serious: #ec835a; --nu-status-critical: #d03b3b;
  --nu-chart-grid: #e1e0d9; --nu-chart-axis: #c3c2b7; --nu-chart-ink: #52514e;
}
/* Total Temp: warm brown chrome + orange action (5.8:1 on white, 5.2:1 on its soft fill) */
html.co-tt {
  --nu-brand: #a8480c; --nu-brand-hover: #8c3c0a; --nu-brand-soft: #fdf0e6; --nu-brand-border: #f0c3a1;
  --nu-accent: #ffb37a;
  --nu-focus: 0 0 0 3px rgba(168, 72, 12, .35); --nu-focus-color: #a8480c;
}
/* dark mode (html[data-theme=dark] is set before first paint by theme-boot.js) */
html[data-theme="dark"] {
  --nu-nuclio: #b69cf7; --nu-nuclio-soft: #2a2140;
  --nu-brand: #4f9be0; --nu-brand-hover: #6fb0ea; --nu-brand-soft: #16293b; --nu-brand-border: #2d4d6c; --nu-on-brand: #0b1520;
  --nu-bg: #0f1216; --nu-surface: #1a1e24; --nu-surface-2: #1f242b; --nu-surface-3: #262d36;
  --nu-border: #343b45; --nu-border-strong: #6b7584;
  --nu-text: #e7e9ec; --nu-text-2: #c3cad3; --nu-text-3: #a3abb5;
  --nu-overlay: rgba(0, 0, 0, .6);
  --nu-surface-rgb: var(--panel-rgb, 26, 30, 36);
  --nu-success: #8fdcb9; --nu-success-soft: #14352a; --nu-success-border: #2c6b52;
  --nu-warn: #efc57c;    --nu-warn-soft: #3b2d14;    --nu-warn-border: #6b5a1c;
  --nu-danger: #f3a5a0;  --nu-danger-soft: #3b1a1a;  --nu-danger-border: #7a3333;
  --nu-info: #9dc5ee;    --nu-info-soft: #152636;    --nu-info-border: #2d4d6c;
  --nu-solid-success: #1f8a58; --nu-solid-danger: #c0392b; --nu-solid-warn: #b45309;
  --nu-shadow-sm: none; --nu-shadow-md: 0 4px 14px rgba(0, 0, 0, .35); --nu-shadow-lg: 0 18px 44px rgba(0, 0, 0, .55);
  --nu-focus: 0 0 0 3px rgba(111, 176, 234, .45); --nu-focus-color: #6fb0ea;
  --nu-cat-1: #3987e5; --nu-cat-2: #d95926; --nu-cat-3: #199e70; --nu-cat-4: #c98500;
  --nu-cat-5: #d55181; --nu-cat-6: #008300; --nu-cat-7: #9085e9; --nu-cat-8: #e66767;
  --nu-div-mid: #383835; --nu-chart-grid: #2c2c2a; --nu-chart-axis: #383835; --nu-chart-ink: #c3c2b7;
}
html[data-theme="dark"] { --nu-chrome: #0c2134; --nu-chrome-2: #123049; }   /* top bar: a step deeper than light, still navy */
html.co-tt[data-theme="dark"] {
  --nu-chrome: #451b0b; --nu-chrome-2: #5e2710;
  --nu-brand: #f0a050; --nu-brand-hover: #f5b878; --nu-brand-soft: #3a2616; --nu-brand-border: #6e4524; --nu-on-brand: #1d0f04;
  --nu-focus: 0 0 0 3px rgba(240, 160, 80, .45); --nu-focus-color: #f0a050;
}

/* ---------- 2. COMPONENTS (opt-in .nu-*) ---------- */
.nu-page { font-family: var(--nu-font); color: var(--nu-text); font-size: var(--nu-fs-md); line-height: var(--nu-lh);
  width: 100%; box-sizing: border-box; padding: var(--nu-s-4) var(--nu-gutter) 90px; min-width: 0; }
.nu-page *, .nu-page *::before, .nu-page *::after { box-sizing: border-box; }
.nu-page--narrow { max-width: 1100px; margin: 0 auto; }
.nu-page--wide { max-width: 1600px; margin: 0 auto; }

/* page header: breadcrumb, title, summary line, primary action */
.nu-ph { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--nu-s-2) var(--nu-s-4); margin: 0 0 var(--nu-s-4); min-width: 0; }
.nu-ph-main { flex: 1 1 320px; min-width: 0; }
.nu-crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: var(--nu-fs-xs); color: var(--nu-text-3); margin: 0 0 2px; list-style: none; padding: 0; }
.nu-crumbs a { color: var(--nu-text-2); text-decoration: none; }
.nu-crumbs a:hover { color: var(--nu-brand); text-decoration: underline; }
.nu-crumbs > * + *::before { content: "/"; margin-right: 6px; color: var(--nu-border-strong); }
.nu-ph-title { margin: 0; font-size: var(--nu-fs-2xl); line-height: var(--nu-lh-tight); font-weight: var(--nu-fw-semibold); letter-spacing: -.01em; color: var(--nu-text); }
.nu-ph-sum { margin: var(--nu-s-1) 0 0; font-size: var(--nu-fs-sm); color: var(--nu-text-2); max-width: 110ch; }
.nu-ph-actions { display: flex; flex-wrap: wrap; gap: var(--nu-s-2); align-items: center; }
/* phones = less detail (display-conventions): the summary shows 2 lines, tap it for the rest (nuclio-ui.js toggles .is-open) */
@media (max-width: 600px) {
  .nu-ph-title { font-size: var(--nu-fs-xl); } .nu-ph-actions { width: 100%; }
  .nu-ph-sum { font-size: var(--nu-fs-xs); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; cursor: pointer; }
  .nu-ph-sum.is-open { display: block; -webkit-line-clamp: unset; }
}

/* section heading inside a card / page */
.nu-section-title { margin: 0 0 var(--nu-s-2); font-size: var(--nu-fs-xs); font-weight: var(--nu-fw-semibold); text-transform: uppercase; letter-spacing: .06em; color: var(--nu-text-3); }
.nu-h2 { margin: 0 0 var(--nu-s-2); font-size: var(--nu-fs-lg); font-weight: var(--nu-fw-semibold); color: var(--nu-text); }

/* toolbar / filters */
.nu-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--nu-s-2) var(--nu-s-3); padding: var(--nu-s-2) 0; min-width: 0; }
.nu-toolbar > .nu-spacer { flex: 1 1 auto; }
.nu-toolbar .nu-field { flex: 0 1 220px; min-width: 0; }
@media (max-width: 600px) { .nu-toolbar .nu-field { flex: 1 1 140px; } }

/* buttons */
.nu-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--nu-ctl-h); padding: 0 14px;
  font: var(--nu-fw-medium) var(--nu-fs-md)/1 var(--nu-font); white-space: nowrap; text-decoration: none; cursor: pointer;
  border-radius: var(--nu-r-md); border: 1px solid var(--nu-border-strong); background: var(--nu-surface); color: var(--nu-text);
  transition: background var(--nu-dur) var(--nu-ease), border-color var(--nu-dur) var(--nu-ease), box-shadow var(--nu-dur) var(--nu-ease); }
.nu-btn:hover { background: var(--nu-surface-2); border-color: var(--nu-text-3); }
.nu-btn:active { background: var(--nu-surface-3); }
.nu-btn--primary { background: var(--nu-brand); border-color: var(--nu-brand); color: var(--nu-on-brand); }
.nu-btn--primary:hover { background: var(--nu-brand-hover); border-color: var(--nu-brand-hover); }
.nu-btn--ghost { background: transparent; border-color: transparent; color: var(--nu-brand); }
.nu-btn--ghost:hover { background: var(--nu-brand-soft); border-color: transparent; }
.nu-btn--danger { background: var(--nu-solid-danger); border-color: var(--nu-solid-danger); color: #fff; }
.nu-btn--danger:hover { filter: brightness(.92); background: var(--nu-solid-danger); }
.nu-btn--danger-outline { color: var(--nu-danger); border-color: var(--nu-danger-border); }
.nu-btn--sm { height: var(--nu-ctl-h-sm); padding: 0 10px; font-size: var(--nu-fs-sm); }
.nu-btn--lg { height: var(--nu-ctl-h-lg); padding: 0 20px; font-size: var(--nu-fs-lg); }
.nu-btn--icon { width: var(--nu-ctl-h); padding: 0; }
.nu-btn--block { display: flex; width: 100%; }
.nu-btn[disabled], .nu-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: none; }
.nu-btn-group { display: inline-flex; flex-wrap: wrap; gap: var(--nu-s-2); }

/* form fields */
.nu-field { display: grid; gap: 4px; min-width: 0; }
.nu-label { font-size: var(--nu-fs-xs); font-weight: var(--nu-fw-semibold); color: var(--nu-text-2); }
.nu-help { font-size: var(--nu-fs-xs); color: var(--nu-text-3); }
.nu-error-text { font-size: var(--nu-fs-xs); color: var(--nu-danger); font-weight: var(--nu-fw-medium); }
.nu-input, .nu-select, .nu-textarea { width: 100%; min-width: 0; height: var(--nu-ctl-h); padding: 0 10px; font: var(--nu-fs-md) var(--nu-font);
  color: var(--nu-text); background: var(--nu-surface); border: 1px solid var(--nu-border-strong); border-radius: var(--nu-r-md);
  transition: border-color var(--nu-dur), box-shadow var(--nu-dur); }
.nu-textarea { height: auto; min-height: 84px; padding: 8px 10px; line-height: var(--nu-lh); resize: vertical; }
.nu-select { padding-right: 30px; appearance: none; -webkit-appearance: none; background-repeat: no-repeat; background-position: right 10px center; background-size: 10px 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23627285' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); }
.nu-input:hover, .nu-select:hover, .nu-textarea:hover { border-color: var(--nu-text-3); }
.nu-input[aria-invalid="true"], .nu-select[aria-invalid="true"], .nu-textarea[aria-invalid="true"] { border-color: var(--nu-danger); }
.nu-input::placeholder, .nu-textarea::placeholder { color: var(--nu-text-3); opacity: 1; }
.nu-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: var(--nu-s-3) var(--nu-s-4); }
.nu-form-grid > .nu-span-all { grid-column: 1 / -1; }
.nu-check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--nu-fs-md); cursor: pointer; min-height: 28px; }
.nu-check input[type=checkbox], .nu-check input[type=radio] { width: 18px; height: 18px; margin: 0; accent-color: var(--nu-brand); }
/* toggle: <label class="nu-check"><input type="checkbox" class="nu-toggle"> Label</label> */
.nu-toggle { appearance: none; -webkit-appearance: none; width: 36px !important; height: 20px !important; border-radius: var(--nu-r-pill); position: relative; cursor: pointer; flex: none;
  background: var(--nu-border-strong); transition: background var(--nu-dur); margin: 0; }
.nu-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--nu-shadow-sm); transition: transform var(--nu-dur) var(--nu-ease); }
.nu-toggle:checked { background: var(--nu-brand); }
.nu-toggle:checked::after { transform: translateX(16px); }

/* cards */
.nu-card { background: rgba(var(--nu-surface-rgb), var(--nu-card-alpha)); border: 1px solid var(--nu-border); border-radius: var(--nu-r-lg);
  box-shadow: var(--nu-shadow-sm); padding: var(--nu-s-4); min-width: 0; margin: 0 0 var(--nu-s-3); }
.nu-card--flush { padding: 0; overflow: hidden; }
.nu-card-head { display: flex; align-items: center; gap: var(--nu-s-2); justify-content: space-between; flex-wrap: wrap; margin: 0 0 var(--nu-s-3); }
.nu-card--flush > .nu-card-head { margin: 0; padding: var(--nu-s-3) var(--nu-s-4); border-bottom: 1px solid var(--nu-border); background: var(--nu-surface-2); }
.nu-card-foot { margin-top: var(--nu-s-3); padding-top: var(--nu-s-3); border-top: 1px solid var(--nu-border); display: flex; gap: var(--nu-s-2); flex-wrap: wrap; }
.nu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(var(--nu-min, 280px), 100%), 1fr)); gap: var(--nu-s-3); }
.nu-grid > * { min-width: 0; }
@media (max-width: 600px) { .nu-card { padding: var(--nu-s-3); border-radius: var(--nu-r-md); } }

/* KPI tiles - the dept-kpis pattern: Needs follow-up / Department / My items / My team */
.nu-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); gap: var(--nu-s-2); }
.nu-kpi { position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: var(--nu-s-3) var(--nu-s-3) var(--nu-s-3) calc(var(--nu-s-3) + 4px);
  background: var(--nu-surface); border: 1px solid var(--nu-border); border-radius: var(--nu-r-lg); color: inherit; text-decoration: none; font: inherit; text-align: left; }
.nu-kpi::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--nu-kpi-accent, var(--nu-border-strong)); }
a.nu-kpi:hover, button.nu-kpi:hover { border-color: var(--nu-brand-border); box-shadow: var(--nu-shadow-md); cursor: pointer; }
.nu-kpi[aria-pressed="true"], .nu-kpi.is-active { border-color: var(--nu-brand); background: var(--nu-brand-soft); }
.nu-kpi-label { font-size: var(--nu-fs-xs); font-weight: var(--nu-fw-semibold); color: var(--nu-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nu-kpi-value { font-size: var(--nu-fs-3xl); line-height: 1.1; font-weight: var(--nu-fw-semibold); color: var(--nu-text); letter-spacing: -.01em; }
.nu-kpi-foot { font-size: var(--nu-fs-xs); color: var(--nu-text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nu-kpi-delta { font-size: var(--nu-fs-xs); font-weight: var(--nu-fw-semibold); }
.nu-kpi-delta.is-up { color: var(--nu-success); } .nu-kpi-delta.is-down { color: var(--nu-danger); }
.nu-kpi--follow { --nu-kpi-accent: var(--nu-solid-warn); }
.nu-kpi--dept   { --nu-kpi-accent: var(--nu-brand); }
.nu-kpi--mine   { --nu-kpi-accent: var(--nu-nuclio); }
.nu-kpi--team   { --nu-kpi-accent: var(--nu-solid-success); }
.nu-kpi--danger { --nu-kpi-accent: var(--nu-solid-danger); }
@media (max-width: 600px) { .nu-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .nu-kpi-value { font-size: var(--nu-fs-2xl); } }

/* data tables: the box scrolls sideways, never the page */
.nu-table-wrap { position: relative; width: 100%; max-width: 100%; overflow: auto; border: 1px solid var(--nu-border); border-radius: var(--nu-r-md); background: var(--nu-surface); -webkit-overflow-scrolling: touch; }
.nu-table-wrap--tall { max-height: min(70vh, 720px); }
.nu-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--nu-fs-sm); color: var(--nu-text); background: var(--nu-surface); }
.nu-table th { position: sticky; top: 0; z-index: 1; background: var(--nu-surface-3); color: var(--nu-text-2); text-align: left; font-weight: var(--nu-fw-semibold);
  font-size: var(--nu-fs-xs); padding: 8px 10px; border-bottom: 1px solid var(--nu-border-strong); white-space: nowrap; vertical-align: bottom; }
.nu-table td { padding: 8px 10px; border-bottom: 1px solid var(--nu-border); vertical-align: top; }
.nu-table tbody tr:nth-child(even) td { background: var(--nu-surface-2); }
.nu-table tbody tr:hover td { background: var(--nu-brand-soft); }
.nu-table tbody tr:last-child td { border-bottom: 0; }
.nu-table .nu-num, .nu-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* .nu-money: format the text with NuUI.money(); the class right-aligns with tabular figures */
.nu-money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nu-table .is-neg, .nu-neg { color: var(--nu-danger); }
.nu-table caption { caption-side: top; text-align: left; padding: 0 0 6px; font-size: var(--nu-fs-xs); color: var(--nu-text-3); }
/* card list on phones: <table class="nu-table nu-table--stack"> + NuUI labels each td from its th (data-label) */
@media (max-width: 600px) {
  .nu-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .nu-table--stack, .nu-table--stack tbody, .nu-table--stack tr, .nu-table--stack td { display: block; width: 100%; }
  .nu-table--stack tr { border-bottom: 1px solid var(--nu-border-strong); padding: 6px 0; }
  .nu-table--stack tbody tr:nth-child(even) td { background: transparent; }
  .nu-table--stack td { display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr); gap: 8px; border: 0; padding: 3px 10px; text-align: left; white-space: normal; }
  .nu-table--stack td::before { content: attr(data-label); font-size: var(--nu-fs-xs); font-weight: var(--nu-fw-semibold); color: var(--nu-text-3); }
  .nu-table--stack td.nu-num, .nu-table--stack td.nu-money { text-align: left; }
}

/* empty / error / loading */
.nu-empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: var(--nu-s-8) var(--nu-s-4); color: var(--nu-text-3); font-size: var(--nu-fs-md); }
.nu-empty-title { font-size: var(--nu-fs-lg); font-weight: var(--nu-fw-semibold); color: var(--nu-text-2); }
.nu-empty-icon { font-size: 28px; line-height: 1; opacity: .6; }
.nu-error { padding: var(--nu-s-3) var(--nu-s-4); border-radius: var(--nu-r-md); background: var(--nu-danger-soft); color: var(--nu-danger); border: 1px solid var(--nu-danger-border); }
.nu-skeleton { display: block; height: 12px; border-radius: 6px; margin: 8px 0;
  background: linear-gradient(90deg, var(--nu-surface-3) 25%, var(--nu-surface-2) 37%, var(--nu-surface-3) 63%); background-size: 400% 100%; animation: nu-shimmer 1.3s ease infinite; }
.nu-skeleton--title { height: 20px; width: 40%; }
@keyframes nu-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* badges / status chips (never colour alone: the text says the state) */
.nu-badge { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 2px 9px; border-radius: var(--nu-r-pill); font-size: var(--nu-fs-xs);
  font-weight: var(--nu-fw-semibold); line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
  background: var(--nu-surface-3); color: var(--nu-text-2); border: 1px solid transparent; }
.nu-badge--info { background: var(--nu-info-soft); color: var(--nu-info); border-color: var(--nu-info-border); }
.nu-badge--success { background: var(--nu-success-soft); color: var(--nu-success); border-color: var(--nu-success-border); }
.nu-badge--warn { background: var(--nu-warn-soft); color: var(--nu-warn); border-color: var(--nu-warn-border); }
.nu-badge--danger { background: var(--nu-danger-soft); color: var(--nu-danger); border-color: var(--nu-danger-border); }
.nu-badge--brand { background: var(--nu-brand-soft); color: var(--nu-brand); border-color: var(--nu-brand-border); }
.nu-badge--nuclio { background: var(--nu-nuclio-soft); color: var(--nu-nuclio); }
.nu-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.nu-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--nu-r-pill); font-size: 11px; font-weight: var(--nu-fw-bold); background: var(--nu-brand); color: var(--nu-on-brand); }

/* tabs: role=tablist > button[role=tab][aria-selected] */
.nu-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--nu-border); overflow-x: auto; scrollbar-width: thin; margin: 0 0 var(--nu-s-3); }
.nu-tab { flex: none; height: 38px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: none; font: var(--nu-fw-medium) var(--nu-fs-md) var(--nu-font);
  color: var(--nu-text-2); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.nu-tab:hover { color: var(--nu-text); background: var(--nu-surface-2); }
.nu-tab[aria-selected="true"], .nu-tab.is-active { color: var(--nu-brand); border-bottom-color: var(--nu-brand); font-weight: var(--nu-fw-semibold); }
/* segmented choice (pick one of a few): same markup, pill look */
.nu-segment { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: var(--nu-r-lg); background: var(--nu-surface-3); max-width: 100%; }
.nu-segment > button, .nu-segment > a { border: 0; background: transparent; border-radius: var(--nu-r-md); padding: 7px 14px; font: var(--nu-fw-medium) var(--nu-fs-md) var(--nu-font); color: var(--nu-text-2); cursor: pointer; text-decoration: none; }
.nu-segment > button:hover, .nu-segment > a:hover { color: var(--nu-text); }
.nu-segment > [aria-pressed="true"], .nu-segment > [aria-selected="true"], .nu-segment > .is-active, .nu-segment > .on { background: var(--nu-surface); color: var(--nu-brand); box-shadow: var(--nu-shadow-sm); font-weight: var(--nu-fw-semibold); }

/* notices (inline banners) */
.nu-notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--nu-r-md); border: 1px solid var(--nu-info-border); background: var(--nu-info-soft); color: var(--nu-info); font-size: var(--nu-fs-sm); }
.nu-notice--success { border-color: var(--nu-success-border); background: var(--nu-success-soft); color: var(--nu-success); }
.nu-notice--warn { border-color: var(--nu-warn-border); background: var(--nu-warn-soft); color: var(--nu-warn); }
.nu-notice--danger { border-color: var(--nu-danger-border); background: var(--nu-danger-soft); color: var(--nu-danger); }

/* modal + drawer: <div class="nu-veil"><div class="nu-modal" role="dialog" aria-modal="true">...</div></div> (NuUI.modal builds it) */
.nu-veil { position: fixed; inset: 0; z-index: 2147482000; background: var(--nu-overlay); display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh var(--nu-s-3) var(--nu-s-3); overflow-y: auto; animation: nu-fade var(--nu-dur) var(--nu-ease); }
.nu-modal { width: 100%; max-width: 560px; background: var(--nu-surface); color: var(--nu-text); border-radius: var(--nu-r-lg); box-shadow: var(--nu-shadow-lg);
  font: var(--nu-fs-md)/var(--nu-lh) var(--nu-font); animation: nu-rise .18s var(--nu-ease); }
.nu-modal--wide { max-width: 900px; }
.nu-modal-head { display: flex; align-items: center; gap: var(--nu-s-2); padding: var(--nu-s-4) var(--nu-s-4) var(--nu-s-2); }
.nu-modal-head h2 { margin: 0; font-size: var(--nu-fs-xl); font-weight: var(--nu-fw-semibold); flex: 1; }
.nu-modal-body { padding: var(--nu-s-2) var(--nu-s-4) var(--nu-s-4); }
.nu-modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--nu-s-2); padding: var(--nu-s-3) var(--nu-s-4); border-top: 1px solid var(--nu-border); background: var(--nu-surface-2); border-radius: 0 0 var(--nu-r-lg) var(--nu-r-lg); }
.nu-veil--drawer { justify-content: flex-end; align-items: stretch; padding: 0; }
.nu-drawer { width: min(480px, 100vw); height: 100%; overflow-y: auto; background: var(--nu-surface); color: var(--nu-text); box-shadow: var(--nu-shadow-lg); font: var(--nu-fs-md)/var(--nu-lh) var(--nu-font); animation: nu-slide .2s var(--nu-ease); }
@keyframes nu-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nu-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes nu-slide { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (max-width: 600px) { .nu-veil { padding: var(--nu-s-2); } }

/* toasts (NuUI.toast) - above the bottom button band */
.nu-toasts { position: fixed; z-index: 2147482600; left: 50%; bottom: 76px; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.nu-toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--nu-r-md); background: #1b2733; color: #fff;
  box-shadow: var(--nu-shadow-lg); font: var(--nu-fs-sm)/1.4 var(--nu-font); animation: nu-rise .18s var(--nu-ease); border-left: 4px solid var(--nu-cat-1); }
.nu-toast--success { border-left-color: var(--nu-status-good); } .nu-toast--warn { border-left-color: var(--nu-status-warning); } .nu-toast--danger { border-left-color: var(--nu-status-critical); }
.nu-toast button { margin-left: auto; background: none; border: 0; color: inherit; opacity: .75; cursor: pointer; font: inherit; }
html[data-theme="dark"] .nu-toast { background: #2a313a; }

/* chart frame + legend (pair with NuUI.chartColors for Chart.js) */
.nu-chart { position: relative; min-width: 0; }
.nu-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--nu-fs-xs); color: var(--nu-text-2); margin: 0 0 6px; }
.nu-legend span { display: inline-flex; align-items: center; gap: 6px; }
.nu-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* utilities */
.nu-stack { display: grid; gap: var(--nu-s-3); } .nu-stack--sm { gap: var(--nu-s-2); }
.nu-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--nu-s-2); min-width: 0; }
.nu-muted { color: var(--nu-text-3); } .nu-small { font-size: var(--nu-fs-xs); } .nu-strong { font-weight: var(--nu-fw-semibold); }
.nu-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nu-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 600px) { .nu-hide-phone { display: none !important; } }
@media (min-width: 601px) { .nu-only-phone { display: none !important; } }

/* focus + motion: every nu control */
.nu-btn:focus-visible, .nu-input:focus-visible, .nu-select:focus-visible, .nu-textarea:focus-visible, .nu-tab:focus-visible, .nu-kpi:focus-visible,
.nu-segment > :focus-visible, .nu-toggle:focus-visible, .nu-check input:focus-visible, .nu-crumbs a:focus-visible {
  outline: 2px solid var(--nu-focus-color); outline-offset: 1px; box-shadow: var(--nu-focus); }
@media (prefers-reduced-motion: reduce) { .nu-page *, .nu-veil, .nu-modal, .nu-drawer, .nu-toast, .nu-skeleton { animation: none !important; transition: none !important; } }
@media (forced-colors: active) { .nu-btn, .nu-badge, .nu-kpi, .nu-card { border: 1px solid CanvasText; } }

/* ---------- 3. SKIN: <body class="nu-skin"> restyles the existing shared classes inside <main> ----------
   The top bar, bottom buttons (Suggest / Ask Nuclio / status) and floating helpers stay exactly as they are, so skinned and
   not-yet-skinned pages share one frame while Phase 2 runs. Specificity stays low (body.nu-skin main .x) - a page's own
   rule with !important still wins, which is the cue to clean that rule up in its batch. */
body.nu-skin { font-family: var(--nu-font); color: var(--nu-text); background-color: var(--nu-bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html.nu-frame .topbar .v2-tag { display: none; }   /* "v2" label is noise for staff (every office page, 2026-11-01) */
body.nu-skin main { font-size: var(--nu-fs-md); line-height: var(--nu-lh); }
/* [hidden] always hides (B6 2026-11-01: card / .btn display rules beat the browser's own [hidden] rule, e.g. the billing-leaks
   "No access" box showed). An element a script shows with an inline style (el.style.display = "block" while the attribute
   stays, e.g. prospect-calls #seBox) keeps working: inline display still wins, exactly as before the skin. */
body.nu-skin main [hidden]:not([style*="display"]) { display: none !important; }
body.nu-skin main h1 { font-size: var(--nu-fs-2xl); font-weight: var(--nu-fw-semibold); letter-spacing: -.01em; line-height: var(--nu-lh-tight); }
body.nu-skin main a:not([class]) { color: var(--nu-brand); text-underline-offset: 2px; }
/* buttons */
body.nu-skin main .btn, body.nu-skin main button.btn, body.nu-skin .of-bar .btn, body.nu-skin .cg-card .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--nu-ctl-h-sm); padding: 5px 12px; border-radius: var(--nu-r-md);
  border: 1px solid var(--nu-border-strong); background: var(--nu-surface); color: var(--nu-text); font: var(--nu-fw-medium) var(--nu-fs-sm)/1.2 var(--nu-font);
  text-decoration: none; transition: background var(--nu-dur), border-color var(--nu-dur); }
body.nu-skin main .btn:hover, body.nu-skin .of-bar .btn:hover { background: var(--nu-surface-2); border-color: var(--nu-text-3); }
body.nu-skin main .btn.primary, body.nu-skin .of-bar .btn.primary, body.nu-skin .cg-card .btn.primary { background: var(--nu-brand); border-color: var(--nu-brand); color: var(--nu-on-brand); }
body.nu-skin main .btn.primary:hover, body.nu-skin .of-bar .btn.primary:hover { background: var(--nu-brand-hover); border-color: var(--nu-brand-hover); }
body.nu-skin main .btn.big, body.nu-skin .of-bar .btn.big { min-height: var(--nu-ctl-h); padding: 6px 16px; font-size: var(--nu-fs-md); }
body.nu-skin main .btn.danger { color: var(--nu-danger); border-color: var(--nu-danger-border); }
body.nu-skin main .btn:disabled { opacity: .5; cursor: not-allowed; }
/* inputs */
body.nu-skin main input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]),
body.nu-skin main select, body.nu-skin main textarea {
  font-family: var(--nu-font); color: var(--nu-text); background-color: var(--nu-surface); border: 1px solid var(--nu-border-strong); border-radius: var(--nu-r-md);
  transition: border-color var(--nu-dur), box-shadow var(--nu-dur); max-width: 100%; }
body.nu-skin main input:not([type=checkbox]):not([type=radio]):hover, body.nu-skin main select:hover, body.nu-skin main textarea:hover { border-color: var(--nu-text-3); }
body.nu-skin main input[type=checkbox], body.nu-skin main input[type=radio] { accent-color: var(--nu-brand); }
body.nu-skin main ::placeholder { color: var(--nu-text-3); opacity: 1; }
/* cards / panels */
body.nu-skin main .v2-card { border-color: var(--nu-border); border-radius: var(--nu-r-lg); box-shadow: var(--nu-shadow-sm); }
body.nu-skin main .of-panel { border-color: var(--nu-border); }
/* the shared list (list-tools.js) + other .grid / .v2-table tables */
body.nu-skin main .cl-bar { gap: var(--nu-s-2); }
body.nu-skin main .cl-search { height: var(--nu-ctl-h-sm); border-radius: var(--nu-r-md); }
body.nu-skin main .cl-count { color: var(--nu-text-3); }
body.nu-skin main .cl-scroll { border: 1px solid var(--nu-border); border-radius: var(--nu-r-md); background: var(--nu-surface); max-width: 100%; }
body.nu-skin main table.grid, body.nu-skin main table.v2-table { border-collapse: separate; border-spacing: 0; background: var(--nu-surface); color: var(--nu-text); font-size: var(--nu-fs-sm); }
body.nu-skin main table.grid th, body.nu-skin main table.v2-table th { background: var(--nu-surface-3); color: var(--nu-text-2); font-weight: var(--nu-fw-semibold); font-size: var(--nu-fs-xs);
  border: 0; border-bottom: 1px solid var(--nu-border); padding: 8px 10px; }
body.nu-skin main table.grid tr.cl-filters th { background: var(--nu-surface-2); padding: 4px 6px 6px; border-bottom: 1px solid var(--nu-border-strong); }
body.nu-skin main table.grid td, body.nu-skin main table.v2-table td { border: 0; border-bottom: 1px solid var(--nu-border); padding: 8px 10px; }
body.nu-skin main table.grid tbody tr:nth-child(even) td, body.nu-skin main table.v2-table tbody tr:nth-child(even) td { background: var(--nu-surface-2); }
body.nu-skin main table.grid tbody tr:hover td, body.nu-skin main table.v2-table tbody tr:hover td { background: var(--nu-brand-soft); }
body.nu-skin main table.grid tbody tr:last-child td { border-bottom: 0; }
body.nu-skin main table .nu-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
body.nu-skin main .cl-filter { border-color: var(--nu-border); border-radius: var(--nu-r-sm); }
body.nu-skin main .cl-sort:hover, body.nu-skin main .cl-sort:focus-visible, body.nu-skin main .cl-arrow { color: var(--nu-brand); }
/* chips, badges, notices */
body.nu-skin main .pill, body.nu-skin main .v2-badge { border-radius: var(--nu-r-pill); font-weight: var(--nu-fw-semibold); font-size: var(--nu-fs-xs); }
body.nu-skin main .of-notice { border-radius: var(--nu-r-md); }
body.nu-skin main .of-help, body.nu-skin main .v2-sub, body.nu-skin main .note { color: var(--nu-text-3); }
/* focus ring on everything in the page body */
body.nu-skin main :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
body.nu-skin .of-bar :is(a, button):focus-visible { outline: 2px solid var(--nu-focus-color); outline-offset: 2px; box-shadow: var(--nu-focus); }
body.nu-skin main input:not([type=checkbox]):not([type=radio]):focus-visible, body.nu-skin main select:focus-visible, body.nu-skin main textarea:focus-visible { outline-offset: 0; border-color: var(--nu-focus-color); }
@media (max-width: 600px) { body.nu-skin main h1 { font-size: var(--nu-fs-xl); } }
@media print { body.nu-skin { background: #fff; } body.nu-skin main table.grid tbody tr:nth-child(even) td { background: transparent; } }

/* ---------- 4. FRAME: the shared top bar + bottom band on every office page (Claude 2026-11-01, claude/ui-topbar) ----------
   Opt-in class html.nu-frame is set in <head> by theme-boot.js on /v2/ pages (before first paint, so no flash). The technician
   app (../technician-portal-preview.html) never gets the class and never loads this file, so it is untouched.
   APPEARANCE ONLY: colours, borders, radius, type. Sizes, wrapping and the phone / tablet one-line rules stay in v2.css + nav.js
   (fit logic); every button keeps its id, class, handler and permission check. Skinned and not-yet-skinned pages share it. */
html.nu-frame .topbar { background: linear-gradient(100deg, var(--nu-chrome) 0%, var(--nu-chrome-2) 100%); font-family: var(--nu-font);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .22), 0 2px 10px rgba(8, 20, 32, .16); -webkit-font-smoothing: antialiased; }
html.nu-frame[data-theme="dark"] .topbar { box-shadow: 0 1px 0 rgba(255, 255, 255, .07), 0 2px 10px rgba(0, 0, 0, .4); }
html.nu-frame .topbar .brand { letter-spacing: -.01em; }
html.nu-frame .topbar .brand b { color: var(--nu-accent); }
html.nu-frame .topbar .title { font-weight: var(--nu-fw-semibold); letter-spacing: -.005em; color: rgba(255, 255, 255, .95); }
@media (min-width: 1001px) {
  html.nu-frame .topbar .title { font-size: var(--nu-fs-lg); }   /* 17 -> 16 px: the page name keeps more of its room on busy bars */
}
/* one look for every control in the bar: quiet glass buttons on the chrome (they came in 4 styles: white, outline, glass, blue) */
html.nu-frame .topbar :is(.btn, .cc-back, .cc-theme-btn, .cc-look-btn, .cc-pin-top, .cc-task-top, .cc-guide):not(.primary):not(.cc-tc-hot) {
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .26); color: #fff; border-radius: var(--nu-r-md);
  font-family: var(--nu-font); font-weight: var(--nu-fw-medium); line-height: 1.2; box-shadow: none; text-decoration: none;
  transition: background-color var(--nu-dur) var(--nu-ease), border-color var(--nu-dur) var(--nu-ease); }
html.nu-frame .topbar :is(.btn, .cc-back, .cc-theme-btn, .cc-look-btn, .cc-pin-top, .cc-task-top, .cc-guide):not(.primary):not(.cc-tc-hot):hover {
  background: rgba(255, 255, 255, .17); border-color: rgba(255, 255, 255, .45); }
/* the one primary action (+ New): solid white on the chrome, chrome-coloured text (TT: company-brand.js paints every
   .btn.primary orange with !important, so the bar's copy needs the same weight) */
html.nu-frame .topbar .btn.primary { background: #fff; border: 1px solid #fff; color: var(--nu-chrome); border-radius: var(--nu-r-md);
  font-family: var(--nu-font); font-weight: var(--nu-fw-semibold); box-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
html.nu-frame .topbar .btn.primary:hover { background: #e9eef3; border-color: #e9eef3; }
html.nu-frame.co-tt .topbar .btn.primary { background: #fff !important; border-color: #fff !important; color: var(--nu-chrome) !important; }
html.nu-frame.co-tt .topbar .btn.primary:hover { background: #f6ece6 !important; border-color: #f6ece6 !important; }
/* keyboard focus is visible on the dark bar (several helpers set outline:none) */
html.nu-frame .topbar :is(a, button, [tabindex], .brand.cc-home):focus-visible { outline: 2px solid #fff; outline-offset: 2px; box-shadow: none; }
/* count chips in Pinned / Tasks: chrome ink instead of CC blue (the red "due" chip keeps its colour) */
html.nu-frame .topbar :is(.cc-pin-top, .cc-task-top):not(.due) b { background: #fff; color: var(--nu-chrome); font-weight: var(--nu-fw-bold); }
html.nu-frame .topbar .lb-user { font-family: var(--nu-font); }
html.nu-frame .topbar .lb-user > span { color: rgba(255, 255, 255, .8); font-size: var(--nu-fs-xs); }
html.nu-frame .topbar .portal-switcher a { border-radius: var(--nu-r-md); font-family: var(--nu-font); font-weight: var(--nu-fw-medium); }
/* bottom band behind Something's wrong / status / Ask Nuclio: the page plane colour, one hairline */
html.nu-frame body::after { background: color-mix(in srgb, var(--nu-bg) 95%, transparent); border-top: 1px solid var(--nu-border);
  box-shadow: 0 -2px 10px rgba(16, 32, 48, .05); }
/* "Something's wrong / Suggest": company action colour (was CC blue on both portals); the warning state keeps its own look */
html.nu-frame .cr-btn:not(.cr-warn) { background: var(--nu-surface); color: var(--nu-brand); border-color: var(--nu-brand); font-family: var(--nu-font); font-weight: var(--nu-fw-medium); }
html.nu-frame .cr-btn:not(.cr-warn):hover { background: var(--nu-brand-soft); }
html.nu-frame .cc-ai-btn { font-family: var(--nu-font); font-weight: var(--nu-fw-medium); }
@media print { html.nu-frame .topbar { box-shadow: none; } }