/* next.css: the new design. Since PR #6 it follows Ledgerline
 * (docs/UI_LEDGERLINE_PLAN.md): its surfaces, type, components and motion,
 * with GTM's teal as the accent.
 *
 * Every rule is scoped to .nx. The classic style.css defines --surface,
 * --border and --accent with other meanings, and the classic screens are light
 * only, so these tokens must not reach :root. A new-design region (the shell
 * and each migrated screen) carries class="nx"; a screen not yet migrated
 * renders inside the new shell without it. style.css points its own tokens at
 * the same light values (the "bridge"), so those screens match.
 *
 * Colour values are Ledgerline's (src/styles/design-tokens.css, tokens.css),
 * except the teal accent and the computed-content colours, which GTM chose.
 * Type scale: eight sizes only, 11 12 13 14 18 23 29 46 px.
 * tests/test_next_css.py fails on any other font size.
 */

/* ── Fonts: self-hosted, OFL-1.1 (licences in templates/fonts/) ──────────────
 * Inter for text, TASA Orbiter for headings and the hero figure, JetBrains Mono
 * for figures and IDs. Latin at 400, 500 and 600. The rupee sign U+20B9 is only
 * in Inter's Latin Extended file, so Inter comes second in the display and mono
 * stacks: the browser draws ₹ in Inter and every other character in the first
 * font. */
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(/templates/fonts/inter-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 500;
  src: url(/templates/fonts/inter-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 600;
  src: url(/templates/fonts/inter-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(/templates/fonts/inter-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 500;
  src: url(/templates/fonts/inter-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 600;
  src: url(/templates/fonts/inter-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "TASA Orbiter"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(/templates/fonts/tasa-orbiter-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "TASA Orbiter"; font-style: normal; font-display: swap; font-weight: 500;
  src: url(/templates/fonts/tasa-orbiter-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "TASA Orbiter"; font-style: normal; font-display: swap; font-weight: 600;
  src: url(/templates/fonts/tasa-orbiter-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(/templates/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 500;
  src: url(/templates/fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 600;
  src: url(/templates/fonts/jetbrains-mono-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* ── Tokens, light ─────────────────────────────────────────────────────────── */
.nx {
  --canvas:#F7F7F7;
  --surface:#FFFFFF;
  --sunken:#EFF0F1;
  --border:#DEE1E3;
  --border-strong:#C8CDD0;
  --ink-1:#050505;
  --ink-2:#292F32;
  --ink-3:#616D75;
  --accent:#0B7A83;
  --accent-hover:#08626A;
  --accent-ink:#08626A;
  --accent-soft:#E6F4F5;
  --on-accent:#FFFFFF;
  --pos:#008F47;
  --pos-2:#7FD3A8;
  --pos-ink:#006432;
  --pos-soft:#E5F5ED;
  --pos-soft-hover:#D6EFE1;
  --crit:#D01E11;
  --crit-ink:#91150C;
  --crit-soft:#FBEAE8;
  --crit-soft-hover:#F8DCD9;
  --warn:#E05E00;
  --warn-ink:#9C4100;
  --warn-soft:#FDF0E6;
  --warn-soft-hover:#FBE5D5;
  --hold:#008BD1;
  --hold-ink:#00648F;
  --hold-soft:#E3F4FC;
  --hold-soft-hover:#D3EDFA;
  --s1:#E9F1FE;
  --s2:#DCE9FD;
  --s3:#C7DCFD;
  --s4:#A9C8FB;
  --s5:#7AA9F7;
  --s6:#4F8BF4;
  --s7:#1364F1;
  --s8:#0E54CD;
  --s9:#0E4BB8;
  --viz-1:#0B7A83;
  --viz-2:#1364F1;
  --viz-3:#C08A00;
  --viz-4:#E05E00;
  --viz-5:#D4408F;
  --viz-6:#01A862;
  --viz-7:#7A5AF0;
  --viz-8:#D01E11;
  --viz-9:#7A868C;
  --ai-from:#7C3AED;
  --ai-to:#4F46E5;
  --ai-ink:#5B21B6;
  --ai-soft:#F3EEFE;
  --twill-a:#E6F4F5;
  --twill-b:#3E959C;
  --overlay:rgb(5 5 5 / 0.55);
  --elev-low:0 2px 4px hsl(200 10% 18% / 0.06);
  --elev-mid:0 4px 10px -2px hsl(200 10% 18% / 0.08),0 1px 3px -1px hsl(200 10% 18% / 0.06);
  --elev-high:0 16px 40px -12px hsl(200 10% 18% / 0.18),0 4px 12px -4px hsl(200 10% 18% / 0.10);
  --bevel-solid:inset 0 -1.5px 0 rgb(0 0 0 / 0.18),inset 0 1.5px 0 rgb(255 255 255 / 0.22);
  --bevel-quiet:inset 0 -1.5px 0 rgb(5 5 5 / 0.05),inset 0 1.5px 0 rgb(255 255 255 / 0.60);
  --display:"TASA Orbiter",Inter,-apple-system,"Segoe UI",Roboto,sans-serif;
  --sans:Inter,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",sans-serif;
  --mono:"JetBrains Mono",Inter,ui-monospace,"SF Mono",Menlo,monospace;
  --ai-grad:linear-gradient(120deg,var(--ai-from),var(--ai-to));

  /* Shape: radii, control heights */
  --r-sm:4px; --r:8px; --r-md:12px; --r-lg:16px;
  --h-sm:28px; --h-md:36px; --h-lg:44px;

  /* Motion: durations and the four easings */
  --dur-instant:80ms; --dur-fast:160ms; --dur-base:280ms; --dur-slow:480ms; --dur-gentle:960ms;
  --stagger:80ms;
  --ease-entrance:cubic-bezier(0,0,0.2,1);
  --ease-exit:cubic-bezier(0.17,0,1,1);
  --ease-standard:cubic-bezier(0.3,0,0.2,1);
  --ease-emph:cubic-bezier(0.5,0,0,1);
  --ease-over:cubic-bezier(0.5,0,0.3,1.5);

  /* Type scale: size and line height. */
  --text-micro: 11px;    --lh-micro: 14px;     /* uppercase micro-labels, table heads */
  --text-meta: 12px;     --lh-meta: 16px;      /* labels, meta, paths and IDs */
  --text-control: 13px;  --lh-control: 18px;   /* controls, nav items, tables */
  --text-body: 14px;     --lh-body: 20px;      /* body */
  --text-card: 18px;     --lh-card: 24px;      /* card titles, summary text */
  --text-page: 23px;     --lh-page: 28px;      /* page title */
  --text-figure: 29px;   --lh-figure: 34px;    /* KPI value */
  --text-hero: 46px;     --lh-hero: 48px;      /* the one hero figure per screen */
}
/* Reduced motion: every duration is 0 and the end states stay. */
@media (prefers-reduced-motion: reduce) {
  .nx { --dur-instant:0ms; --dur-fast:0ms; --dur-base:0ms; --dur-slow:0ms; --dur-gentle:0ms; --stagger:0ms; }
}

/* ── Tokens, dark ──────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nx {
    color-scheme: dark;
    --canvas:#141517;
    --surface:#1F2123;
    --sunken:#2A2D30;
    --border:#33383B;
    --border-strong:#474D51;
    --ink-1:#F7F7F7;
    --ink-2:#C3C9CC;
    --ink-3:#8E979C;
    --accent:#4FC3CC;
    --accent-hover:#7AD3DA;
    --accent-ink:#8FDDE3;
    --accent-soft:#10292C;
    --on-accent:#141517;
    --pos:#3FD48A;
    --pos-2:#1F7A50;
    --pos-ink:#7DEFB8;
    --pos-soft:#0F251C;
    --pos-soft-hover:#143024;
    --crit:#FF7166;
    --crit-ink:#FFA9A1;
    --crit-soft:#2E1614;
    --crit-soft-hover:#3A1B18;
    --warn:#FF9A4D;
    --warn-ink:#FFC08C;
    --warn-soft:#2B1B0E;
    --warn-soft-hover:#362111;
    --hold:#4FB6E8;
    --hold-ink:#8FD3F3;
    --hold-soft:#10262F;
    --hold-soft-hover:#143039;
    --s1:#16233A;
    --s2:#1B2C48;
    --s3:#21406E;
    --s4:#2B5491;
    --s5:#3466B3;
    --s6:#5A92E6;
    --s7:#75AAFF;
    --s8:#8DB9FF;
    --s9:#A8C8FF;
    --viz-1:#4FC3CC;
    --viz-2:#75AAFF;
    --viz-3:#E3B341;
    --viz-4:#FF9A4D;
    --viz-5:#F07AB8;
    --viz-6:#3FD48A;
    --viz-7:#A28BFF;
    --viz-8:#FF7166;
    --viz-9:#9AA4A9;
    --ai-from:#A78BFA;
    --ai-to:#818CF8;
    --ai-ink:#C4B5FD;
    --ai-soft:#221A3A;
    --twill-a:#10292C;
    --twill-b:#3E9AA2;
    --overlay:rgb(0 0 0 / 0.66);
    --elev-low:0 2px 4px rgb(0 0 0 / 0.32);
    --elev-mid:0 4px 10px -2px rgb(0 0 0 / 0.40),0 1px 3px -1px rgb(0 0 0 / 0.32);
    --elev-high:0 16px 40px -12px rgb(0 0 0 / 0.60),0 4px 12px -4px rgb(0 0 0 / 0.40);
    --bevel-solid:inset 0 -1.5px 0 rgb(0 0 0 / 0.28),inset 0 1.5px 0 rgb(255 255 255 / 0.14);
    --bevel-quiet:inset 0 -1.5px 0 rgb(0 0 0 / 0.24),inset 0 1.5px 0 rgb(255 255 255 / 0.06);
  }
}
:root[data-theme="dark"] .nx {
  color-scheme: dark;
  --canvas:#141517;
  --surface:#1F2123;
  --sunken:#2A2D30;
  --border:#33383B;
  --border-strong:#474D51;
  --ink-1:#F7F7F7;
  --ink-2:#C3C9CC;
  --ink-3:#8E979C;
  --accent:#4FC3CC;
  --accent-hover:#7AD3DA;
  --accent-ink:#8FDDE3;
  --accent-soft:#10292C;
  --on-accent:#141517;
  --pos:#3FD48A;
  --pos-2:#1F7A50;
  --pos-ink:#7DEFB8;
  --pos-soft:#0F251C;
  --pos-soft-hover:#143024;
  --crit:#FF7166;
  --crit-ink:#FFA9A1;
  --crit-soft:#2E1614;
  --crit-soft-hover:#3A1B18;
  --warn:#FF9A4D;
  --warn-ink:#FFC08C;
  --warn-soft:#2B1B0E;
  --warn-soft-hover:#362111;
  --hold:#4FB6E8;
  --hold-ink:#8FD3F3;
  --hold-soft:#10262F;
  --hold-soft-hover:#143039;
  --s1:#16233A;
  --s2:#1B2C48;
  --s3:#21406E;
  --s4:#2B5491;
  --s5:#3466B3;
  --s6:#5A92E6;
  --s7:#75AAFF;
  --s8:#8DB9FF;
  --s9:#A8C8FF;
  --viz-1:#4FC3CC;
  --viz-2:#75AAFF;
  --viz-3:#E3B341;
  --viz-4:#FF9A4D;
  --viz-5:#F07AB8;
  --viz-6:#3FD48A;
  --viz-7:#A28BFF;
  --viz-8:#FF7166;
  --viz-9:#9AA4A9;
  --ai-from:#A78BFA;
  --ai-to:#818CF8;
  --ai-ink:#C4B5FD;
  --ai-soft:#221A3A;
  --twill-a:#10292C;
  --twill-b:#3E9AA2;
  --overlay:rgb(0 0 0 / 0.66);
  --elev-low:0 2px 4px rgb(0 0 0 / 0.32);
  --elev-mid:0 4px 10px -2px rgb(0 0 0 / 0.40),0 1px 3px -1px rgb(0 0 0 / 0.32);
  --elev-high:0 16px 40px -12px rgb(0 0 0 / 0.60),0 4px 12px -4px rgb(0 0 0 / 0.40);
  --bevel-solid:inset 0 -1.5px 0 rgb(0 0 0 / 0.28),inset 0 1.5px 0 rgb(255 255 255 / 0.14);
  --bevel-quiet:inset 0 -1.5px 0 rgb(0 0 0 / 0.24),inset 0 1.5px 0 rgb(255 255 255 / 0.06);
}

/* ── Base ──────────────────────────────────────────────────────────────────── */
.nx {
  color: var(--ink-1);
  font-family: var(--sans);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  font-feature-settings: "tnum", "ss01";
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.nx .display { font-family: var(--display); font-weight: 600; letter-spacing: -0.013em; }
.nx .mono  { font-family: var(--mono); font-size: var(--text-meta); line-height: var(--lh-meta); }
/* Micro-label: 11 px, uppercase, 500, wide tracking. */
.nx .micro { font-size: var(--text-micro); line-height: var(--lh-micro); font-weight: 500; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); }

/* ── Icons: <svg class="i"><use href="/templates/icons.svg#i-bell"/></svg> ── */
.nx .i {
  width: 16px; height: 16px; flex: none;
  stroke: currentColor; fill: none; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.nx .i.sm { width: 14px; height: 14px; }

/* ── Mark: the workspace logo, or the first letter of the workspace name ───── *
 * <img class="mark" data-ws-logo> when an admin uploaded a logo in
 * Admin › Workspace, else <span class="mark nx-mono" data-ws-initial>.
 * The letter is 12 px, the smallest step of the scale. */
.nx .mark { width: 20px; height: 20px; flex: none; }
.nx img.mark { object-fit: contain; }
.nx .mark[hidden] { display: none; }
.nx .nx-mono {
  display: inline-grid; place-items: center; border-radius: 5px;
  background: var(--accent); color: var(--on-accent);
  font-family: var(--sans); font-size: var(--text-meta); line-height: 1; font-weight: 600;
}

/* ══ Shell (B2): sidebar, collapsed rail, phone sheet, top bar ═════════════════
 * Ported from design/checkpoint-kit kit.py and build.py. Kit sizes outside the
 * scale are mapped to it: 13.5 → 13, 14.5 and 15 → 14, 11.5 → 12, 11 → 12,
 * 9.5 and 10 → 12, 18 and 19 → 17. Phone sheet rows are all 44 px, nested
 * ones included (the kit drew those at 40). */

/* The root rules below are the only ones outside .nx. */
/* The root's colour scheme and background, for the page scrollbar and the
 * macOS overscroll area, which take them from this element and not from .nx.
 * Dark only where data-theme allows it: migrated screens in dark mode. The
 * value is --canvas in the dark theme. With a root background the body no
 * longer hands its light classic background to the page, so it is cleared
 * and .nx-canvas shows through as before. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; background: #141517; }
  :root:not([data-theme="light"]) > body { background: transparent; }
}
:root[data-theme="dark"] { color-scheme: dark; background: #141517; }
:root[data-theme="dark"] > body { background: transparent; }

/* Page background. The classic body colour is light only, so the page behind
 * the cards takes --canvas from this element instead. It follows data-theme:
 * dark on migrated screens in dark mode, light on every other screen. */
.nx.nx-canvas {
  display: block; position: fixed; inset: 0; z-index: -1;
  pointer-events: none; background: var(--canvas);
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
/* A white rail on the grey page, 224 px, collapsing to 56 px. */
.nx.nx-sb {
  width: 224px; flex: 0 0 224px; position: sticky; top: 0; height: 100vh; z-index: 40;
  display: flex; flex-direction: column; gap: 2px; padding: 12px 10px 10px;
  background: var(--surface); border-right: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden;
  transition: width var(--dur-base) var(--ease-emph), flex-basis var(--dur-base) var(--ease-emph);
}
.nx-sb .brand { display: flex; align-items: center; gap: 10px; padding: 4px 4px 14px; }
.nx-sb .brand .mark { width: 28px; height: 28px; border-radius: var(--r); }
.nx-sb .brand .nx-mono { box-shadow: var(--bevel-solid); }
.nx-sb .brand b { font-family: var(--display); font-size: var(--text-body); line-height: var(--lh-body); font-weight: 600; letter-spacing: -0.013em; }
/* The workspace name is up to 60 characters. Two lines at most; the full name
 * is the label's tooltip. */
.nx-sb .brand b {
  min-width: 0; overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.nx-sb .brand .collapse { margin-left: auto; }
.nx-sb .brand .close { display: none; margin-left: auto; }
.nx-sb .nav-body { display: flex; flex-direction: column; gap: 2px; }
/* Group labels: 11 px uppercase micro-labels. */
.nx-sb .ng {
  font-size: var(--text-micro); line-height: var(--lh-micro); font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--ink-3); padding: 16px 10px 6px;
}
/* Items: 13 px / 500, 8 px 10 px padding. The active item has the accent fill. */
.nx-sb .ni, .nx-sb .nk {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--r);
  color: var(--ink-2); font-size: var(--text-control); font-weight: 500; white-space: nowrap;
  text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.nx-sb .nk { height: 32px; }
.nx-sb .ni:hover, .nx-sb .nk:hover { background: var(--sunken); color: var(--ink-1); }
.nx-sb .ni.on, .nx-sb .nk.on { background: var(--accent-soft); color: var(--accent-ink); }
.nx-sb .ni.on .i, .nx-sb .nk.on .i { color: var(--accent-ink); }
.nx-sb .nk.mk .i { color: var(--ink-3); }
.nx-sb .ni .chev { margin-left: auto; width: 14px; height: 14px; color: var(--ink-3); transition: transform 150ms var(--ease-entrance); }
.nx-sb .grp.open > .ni { color: var(--ink-1); }
.nx-sb .grp.open > .ni .i { color: var(--accent); }
.nx-sb .grp.open > .ni .chev { transform: rotate(90deg); }
.nx-sb .kids { display: none; flex-direction: column; gap: 1px; margin: 1px 0 4px 18px; padding-left: 10px; border-left: 1px solid var(--border); }
.nx-sb .grp.open > .kids { display: flex; }
.nx-sb .kids .fh { display: none; }
/* Marketing lists its seven pages directly; its group head is for the rail. */
.nx-sb .grp.mkt > .kids { display: flex; margin: 0; padding: 0; border: 0; }
.nx-sb .grp.mkt > .rail-only { display: none; }
.nx-sb .ni.dis { color: var(--ink-3); cursor: not-allowed; }
.nx-sb .ni.dis .i { color: var(--ink-3); }
.nx-sb .ni .why { margin-left: auto; display: inline-flex; color: var(--ink-3); }
.nx-sb .dis-note { font-size: var(--text-meta); line-height: var(--lh-meta); color: var(--ink-3); padding: 0 10px 4px 36px; }
.nx-sb hr { border: 0; border-top: 1px solid var(--border); margin: 10px 4px; }
.nx-sb .sb-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 10px; }
/* Moved classic controls: the Today and Leads counts, the user block. */
/* Count pills: 18 px. They show flags and new leads, so they keep the status colour. */
.nx-sb .nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; text-align: center;
  font-family: var(--mono); font-size: var(--text-micro); line-height: 18px; font-weight: 600;
  color: var(--crit-ink); background: var(--crit-soft);
}
.nx-sb .sidenav-profile { display: flex; align-items: center; gap: 10px; padding: 8px 8px 2px; border-top: 1px solid var(--border); margin-top: 6px; border-radius: 0; }
.nx-sb .sidenav-avatar { width: 28px; height: 28px; background: var(--accent); color: var(--on-accent); font-size: var(--text-meta); }
.nx-sb .sidenav-profile-name { font-size: var(--text-control); color: var(--ink-1); }
.nx-sb .sidenav-profile-role { font-size: var(--text-meta); color: var(--ink-3); }
.nx-sb .sidenav-signout { color: var(--ink-3); }

/* ── Collapsed: a 56 px icon rail, groups open as flyouts ─────────────────── */
.nx.nx-sb.collapsed { width: 56px; flex-basis: 56px; padding: 12px 8px; align-items: center; overflow: visible; }
.nx-sb.collapsed .lbl, .nx-sb.collapsed .ng, .nx-sb.collapsed .chev,
.nx-sb.collapsed .dis-note, .nx-sb.collapsed .why,
.nx-sb.collapsed .sidenav-profile-meta, .nx-sb.collapsed .sidenav-signout { display: none; }
.nx-sb.collapsed .brand { flex-direction: column; padding: 4px 0 12px; }
.nx-sb.collapsed .brand .collapse { margin: 8px 0 0; }
.nx-sb.collapsed .ni { width: 40px; height: 40px; padding: 0; justify-content: center; position: relative; }
/* The count does not fit the rail, so it becomes a 6 px dot. The number stays
 * in the markup for screen readers. */
.nx-sb.collapsed .ni .nav-badge {
  position: absolute; top: 7px; right: 7px; margin: 0; min-width: 0; width: 6px; height: 6px; padding: 0;
  border-radius: 50%; background: var(--crit); overflow: hidden; text-indent: 12px; white-space: nowrap;
}
.nx-sb.collapsed .ni.dis::after {
  content: ""; position: absolute; right: 4px; bottom: 4px; width: 7px; height: 7px;
  border: 1.5px solid var(--ink-3); border-radius: 2px;
}
.nx-sb.collapsed hr { width: 28px; margin: 6px 0; }
.nx-sb.collapsed .grp { position: relative; }
.nx-sb.collapsed .grp.mkt > .rail-only { display: flex; }
.nx-sb.collapsed .grp > .kids,
.nx-sb.collapsed .grp.mkt > .kids { display: none; }
.nx-sb.collapsed .grp:hover > .kids,
.nx-sb.collapsed .grp:focus-within > .kids {
  display: flex; position: absolute; left: 44px; top: 0; z-index: 50; width: 210px;
  margin: 0; padding: 6px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--elev-high);
}
.nx-sb.collapsed .kids .fh { display: block; font-size: var(--text-micro); line-height: var(--lh-micro); font-weight: 500; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); padding: 4px 8px; }
.nx-sb.collapsed .kids .lbl { display: inline; }
.nx-sb.collapsed .kids .nk { height: 32px; font-size: var(--text-control); }
.nx-sb.collapsed .sidenav-profile { justify-content: center; padding: 8px 0 2px; }

/* ── Page header ───────────────────────────────────────────────────────────
 * Left: the page title (Inter 600, 23 px) and a muted summary the screen
 * writes (nx.pageSummary). Right: the data time, value toggle, Views, bell.
 * No breadcrumb: the sidebar shows the group. */
.nx.nx-tb {
  display: flex; align-items: center; gap: 16px; min-height: 72px; padding: 0 28px;
  background: color-mix(in srgb, var(--canvas) 88%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.nx-tb .ib.menu { display: none; }
.nx-tb .tb-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nx-tb h1 {
  margin: 0; cursor: default; font-family: var(--sans); font-size: var(--text-page); line-height: var(--lh-page);
  font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nx-tb .sum {
  margin: 0; font-size: var(--text-control); line-height: var(--lh-control); color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nx-tb .when { display: flex; align-items: center; gap: 6px; font-size: var(--text-meta); line-height: var(--lh-meta); color: var(--ink-3); white-space: nowrap; }
.nx .cm { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-meta); color: var(--ink-3); white-space: nowrap; }
.nx .cm i { width: 10px; height: 10px; border-radius: 2px; flex: none; display: inline-block; }
.nx .cm .src { background: var(--ink-3); }
.nx-tb .tb-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nx-tb .tb-r > div:empty, .nx-tb .tb-r > span:empty { display: none; }
/* Moved classic controls: value toggle, deal count, Views, bell. */
.nx-tb .rev-toggle { position: relative; display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r); background: var(--sunken); border: 1px solid var(--border); }
.nx-tb .rev-btn { position: relative; z-index: 1; height: 24px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); font-size: var(--text-meta); font-weight: 500; cursor: pointer; }
.nx-tb .rev-btn.active { color: var(--ink-1); background: transparent; box-shadow: none; }
.nx-tb .rev-toggle:not(:has(.seg-thumb)) .rev-btn.active { background: var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.nx-tb .rev-btn:disabled { color: var(--ink-3); cursor: not-allowed; }
.nx-tb .rev-toggle:has(button:disabled) { opacity: 0.55; }
.nx-tb #deal-badge {
  height: var(--h-sm); display: inline-flex; align-items: center; padding: 0 10px; border-radius: var(--r); border: 0;
  background: var(--sunken); font-family: var(--mono); font-size: var(--text-meta); font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.nx-tb .notif-btn {
  height: var(--h-sm); min-width: var(--h-sm); padding: 0 8px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); color: var(--ink-2); position: relative;
  box-shadow: var(--bevel-quiet);
}
.nx-tb #notif-bell { border-color: transparent; color: var(--ink-3); }
.nx-tb .views-label { margin: 0; font-size: var(--text-meta); font-weight: 500; }
.nx-tb .notif-badge { font-size: var(--text-meta); background: var(--crit); border-color: var(--surface); }

/* The hidden attribute wins over the display rules above. */
.nx[hidden], .nx [hidden] { display: none !important; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.nx .ib {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: var(--r); border: 0; background: transparent; color: var(--ink-3); cursor: pointer; flex: none;
  transition: background-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.nx .ib.sm { width: 26px; height: 26px; }
.nx .ib:hover { background: var(--sunken); color: var(--ink-1); }

/* ── Phone: the sidebar becomes a sheet behind the menu button ────────────── */
.nx.nx-backdrop { display: none; }
@media (max-width: 767px) {
  .nx.nx-sb, .nx.nx-sb.collapsed {
    position: fixed; left: 0; top: 0; width: 320px; max-width: 86vw; height: 100vh; z-index: 60;
    padding: 12px 10px; align-items: stretch; overflow-y: auto; box-shadow: var(--elev-high);
    transform: translateX(-100%); visibility: hidden;
    transition: transform var(--dur-base) var(--ease-emph), visibility var(--dur-base);
  }
  .nx.nx-sb.open { transform: none; visibility: visible; }
  .nx-sb .brand .collapse { display: none; }
  .nx-sb .brand .close { display: inline-flex; }
  .nx-sb .ni, .nx-sb .nk { height: 44px; font-size: var(--text-body); }
  .nx.nx-backdrop.show { display: block; position: fixed; inset: 0; z-index: 59; background: var(--overlay); }
  .nx.nx-tb { min-height: 60px; padding: 6px 8px 6px 6px; gap: 6px; }
  .nx-tb .ib.menu { display: inline-flex; width: 40px; height: 40px; }
  .nx-tb h1 { font-size: var(--text-card); line-height: var(--lh-card); }
  .nx-tb .sum { font-size: var(--text-meta); line-height: var(--lh-meta); }
  /* The summary takes the second line; the data time is on each screen's marks. */
  .nx-tb .tb-r > :not(.slot-bell) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .nx.nx-sb { transition: none; }
  .nx-sb .ni .chev { transition: none; }
}

/* ══ Components (B3) ═══════════════════════════════════════════════════════════
 * templates/modules/nx.js. Ported from design/checkpoint-kit build.py, kit.py
 * and comps.py. Kit sizes outside the scale: 12.5 → 13, 11.5 → 12, 10 and 9 →
 * 12, 19 → 17, 20 → 22. */

/* Boot skeleton: shown while app.js loads, removed by shell_next.js. */
.nx.nx-boot-sb {
  display: flex; flex-direction: column; gap: 14px; width: 232px; flex: 0 0 232px; height: 100vh;
  position: sticky; top: 0; padding: 16px; background: var(--surface); border-right: 1px solid var(--border);
}
.nx.nx-boot-tb {
  display: flex; flex-direction: column; justify-content: center; gap: 6px; min-height: 68px;
  padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--border);
}
@media (max-width: 767px) { .nx.nx-boot-sb { display: none; } }

/* Skeleton */
.nx .sk {
  display: block; border-radius: 6px; background-size: 200% 100%;
  background-image: linear-gradient(90deg, var(--sunken) 0, color-mix(in oklch, var(--sunken) 60%, var(--surface)) 50%, var(--sunken) 100%);
  animation: nx-shim 1.4s linear infinite;
}
@keyframes nx-shim { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.nx .skel-lines { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.nx .nx-view-skel { display: flex; flex-direction: column; gap: 16px; }

/* Layout */
.nx .nx-grid { display: grid; gap: 12px; }
.nx .nx-grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.nx .nx-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.nx .nx-grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 767px) {
  .nx .nx-grid.g3, .nx .nx-grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* In two columns an odd last tile takes the whole row. */
  .nx .nx-grid:is(.g3, .g4) > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
/* Cards: a hairline drawn as an inset shadow plus a low shadow, 12 px radius. */
.nx .nx-card { background: var(--surface); border: 0; box-shadow: inset 0 0 0 1px var(--border), var(--elev-low); border-radius: var(--r-md); min-width: 0; }
.nx .card-h { display: flex; align-items: flex-start; gap: 12px; padding: 16px 16px 12px; }
.nx .card-h .tt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nx .card-h h3 { font-family: var(--display); font-weight: 600; font-size: var(--text-card); line-height: var(--lh-card); letter-spacing: -0.013em; margin: 0; }
.nx .card-h .sub { font-size: var(--text-meta); line-height: var(--lh-meta); color: var(--ink-3); }
.nx .card-h .acts { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.nx .card-b { padding: 0 16px 16px; }
.nx .card-b.flush { padding: 0; }
.nx .dim { color: var(--ink-3); }
.nx .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons: heights 28 / 36 / 44, 8 px radius. Solid buttons carry a bevel (a
 * darker bottom edge, a light top edge); on press they move down 1 px and the
 * bevel goes. Variants: secondary (default), .pri, .ghost, .danger. */
.nx .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--h-md); padding: 0 16px;
  border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-1);
  box-shadow: var(--bevel-quiet);
  font: inherit; font-size: var(--text-control); font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
}
.nx .btn.sm { height: var(--h-sm); padding: 0 12px; font-size: var(--text-meta); }
.nx .btn.lg { height: var(--h-lg); padding: 0 20px; font-size: var(--text-body); }
.nx .btn.pri { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: var(--bevel-solid); }
.nx .btn.danger { background: var(--crit); border-color: var(--crit); color: #FFFFFF; box-shadow: var(--bevel-solid); }
.nx .btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); box-shadow: none; }
.nx .btn:active { transform: translateY(1px); box-shadow: none; }
.nx .btn[disabled] { color: var(--ink-3); background: var(--sunken); border-color: var(--border); box-shadow: none; cursor: not-allowed; transform: none; }
@media (hover: hover) {
  .nx .btn:not([disabled]):hover { background: var(--sunken); border-color: var(--ink-3); }
  .nx .btn.pri:not([disabled]):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .nx .btn.danger:not([disabled]):hover { filter: brightness(1.1); border-color: var(--crit); }
  .nx .btn.ghost:not([disabled]):hover { border-color: transparent; }
}
/* Segmented control. nx.js puts a thumb behind the pressed button and moves it
 * on a spring; without the script the pressed button draws its own fill. */
.nx .seg { position: relative; display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r); background: var(--sunken); border: 1px solid var(--border); }
.nx .seg button {
  position: relative; z-index: 1; height: 24px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2);
  font: inherit; font-size: var(--text-meta); font-weight: 500; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px; transition: color var(--dur-fast) var(--ease-standard);
}
.nx .seg button[aria-pressed="true"] { color: var(--ink-1); }
.nx .seg:not(:has(.seg-thumb)) button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.nx .seg-thumb {
  position: absolute; top: 2px; bottom: 2px; left: 0; z-index: 0; border-radius: 6px; pointer-events: none;
  background: var(--surface); box-shadow: 0 0 0 1px var(--border-strong), var(--elev-low);
}
.nx .kbd { font-family: var(--mono); font-size: var(--text-micro); line-height: var(--lh-meta); font-weight: 500; color: var(--ink-3); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 5px; }
.nx .inp {
  height: 32px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface);
  color: var(--ink-1); font: inherit; font-size: var(--text-control);
}
.nx .inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nx :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Confidence marks */
.nx .cm .est { background: repeating-linear-gradient(135deg, var(--twill-b) 0 1.5px, var(--twill-a) 1.5px 4px); outline: 1px solid var(--twill-b); outline-offset: -1px; }
.nx .cm .mis { border: 1.5px dashed var(--ink-3); }
.nx .cm .pen { border: 1.5px dotted var(--accent); border-radius: 50%; }
.nx .cms { display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* KPI tile: the card surface, 12 px radius, 16 px 20 px padding. The value is
 * in the display face; the delta is a mono pill. */
.nx .kpi {
  background: var(--surface); border: 0; box-shadow: inset 0 0 0 1px var(--border), var(--elev-low);
  border-radius: var(--r-md); padding: 16px 20px;
  display: flex; flex-direction: column; gap: 4px; min-width: 0; position: relative;
}
/* style.css also has .kpi (overflow hidden, a teal border on hover) and .empty
 * (centred, faint). These undo what the rules above do not set. */
.nx .kpi { overflow: visible; }
.nx .kpi:hover { border-color: currentColor; }
.nx .kpi.clickable { cursor: pointer; transition: box-shadow var(--dur-fast) var(--ease-standard); }
@media (hover: hover) { .nx .kpi.clickable:hover { box-shadow: inset 0 0 0 1px var(--border-strong), var(--elev-mid); } }
.nx .kpi .l { font-size: var(--text-meta); line-height: var(--lh-meta); font-weight: 500; color: var(--ink-2); display: flex; align-items: center; gap: 4px; }
.nx .kpi .l .ib { margin: -6px -6px -6px auto; }
.nx .kpi .row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.nx .kpi .v { font-family: var(--display); font-size: var(--text-figure); line-height: var(--lh-figure); font-weight: 600; letter-spacing: -0.013em; white-space: nowrap; }
.nx .kpi .v small { font-family: var(--sans); font-size: var(--text-card); font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.nx .kpi .v.crit { color: var(--crit-ink); }
.nx .kpi .s { font-size: var(--text-meta); line-height: var(--lh-meta); color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; }
.nx .kpi .cms { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
/* Delta pills: mono, a status -soft fill with its -ink text. */
.nx :is(.delta, .pill) {
  display: inline-flex; align-items: center; min-height: 20px; max-width: 100%; padding: 2px 6px; border-radius: var(--r-sm);
  font-family: var(--mono); font-size: var(--text-micro); line-height: var(--lh-micro); font-weight: 500;
  background: var(--sunken); color: var(--ink-3);
}
.nx :is(.delta, .pill).bad { background: var(--crit-soft); color: var(--crit-ink); }
.nx :is(.delta, .pill).good { background: var(--pos-soft); color: var(--pos-ink); }
.nx :is(.delta, .pill).watch { background: var(--warn-soft); color: var(--warn-ink); }
.nx .spark { width: 84px; height: 30px; flex: none; overflow: visible; }
.nx .spark .ln { fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.nx .spark .ar { fill: var(--sunken); }
/* Lines carry no dots. */
.nx .spark .end { display: none; }

/* Chips and stage labels */
.nx .chip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 2px 8px; border-radius: 6px;
  font-size: var(--text-meta); line-height: var(--lh-meta); font-weight: 500; background: var(--sunken); color: var(--ink-2); white-space: nowrap;
}
.nx .chip.crit { background: var(--crit-soft); color: var(--crit-ink); }
.nx .chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.nx .chip.pos { background: var(--pos-soft); color: var(--pos-ink); }
.nx .chip.acc { background: var(--accent-soft); color: var(--accent-ink); }
.nx .chip.hold { background: var(--hold-soft); color: var(--hold-ink); }
.nx .chip.miss { background: transparent; border: 1.5px dashed var(--ink-3); color: var(--ink-2); padding: 1px 6px; }
.nx .chip.pend { background: transparent; border: 1.5px dotted var(--accent); color: var(--accent-ink); padding: 1px 6px; }
.nx .chip .dim { color: inherit; opacity: 0.78; font-weight: 400; }
.nx .stg { display: inline-flex; align-items: flex-start; gap: 7px; color: var(--ink-2); font-size: var(--text-control); line-height: var(--lh-control); }
.nx .stg i { width: 8px; height: 8px; border-radius: 2px; flex: none; margin-top: 5px; }

/* Banners and states */
.nx .banner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r-md); font-size: var(--text-control); border: 1px solid; color: var(--ink-1); }
.nx .banner .sp { flex: 1; }
.nx .banner .d { color: var(--ink-2); }
.nx .banner.bad { background: var(--crit-soft); border-color: color-mix(in oklch, var(--crit) 30%, transparent); }
.nx .banner.bad .i { color: var(--crit-ink); }
.nx .banner.warn { background: var(--warn-soft); border-color: color-mix(in oklch, var(--warn) 40%, transparent); }
.nx .banner.warn .i { color: var(--warn-ink); }
.nx .banner.info { background: var(--sunken); border-color: var(--border); }
.nx .empty {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 22px 18px;
  border: 1px dashed var(--border-strong); border-radius: var(--r-md); background: var(--surface);
}
.nx .empty { text-align: left; color: var(--ink-1); font-size: var(--text-control); }
.nx .empty b { font-size: var(--text-body); font-weight: 600; }
.nx .empty p, .nx .errbox p { margin: 0; font-size: var(--text-control); color: var(--ink-2); max-width: 60ch; }
.nx .errbox {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px; border-radius: 10px;
  border: 1px solid color-mix(in oklch, var(--crit) 30%, transparent); background: var(--crit-soft);
}
.nx .errbox b { font-size: var(--text-body); color: var(--crit-ink); display: flex; gap: 6px; align-items: center; }
.nx .errbox p { color: var(--ink-1); }

/* Third-level tabs and the date bar */
.nx .ptabs { display: flex; flex-wrap: wrap; gap: 4px; }
.nx .ptab {
  height: 32px; padding: 0 12px; border-radius: var(--r); border: 1px solid transparent; background: transparent;
  color: var(--ink-2); font: inherit; font-size: var(--text-control); font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.nx .ptab.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.nx .ptab b { font-family: var(--mono); font-size: var(--text-micro); font-weight: 500; color: inherit; opacity: 0.8; }
.nx .datebar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 16px;
  background: var(--surface); border: 0; box-shadow: inset 0 0 0 1px var(--border), var(--elev-low); border-radius: var(--r-md);
}
.nx .datebar .lbl { font-size: var(--text-meta); font-weight: 600; color: var(--ink-2); }
.nx .datebar .note { font-size: var(--text-meta); color: var(--ink-3); margin-left: auto; }

/* Table kit */
.nx .nx-table { position: relative; }
.nx .nx-table:focus-visible { outline-offset: -2px; }
.nx .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 16px 12px; }
.nx .toolbar .sp, .nx .bulk .sp { flex: 1; }
.nx .tw { overflow-x: auto; }
.nx .tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-control); line-height: var(--lh-control); }
/* Head: sticky, on the sunken surface, 11 px uppercase. */
.nx .tbl th {
  position: sticky; top: 0; z-index: 1; background: var(--sunken); font-size: var(--text-micro); line-height: var(--lh-micro);
  font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-2); text-align: left; padding: 0 10px; height: 32px; white-space: nowrap;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.nx .tbl th.sort { color: var(--ink-1); }
.nx .th-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; }
.nx .th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.nx .tbl th .i { width: 12px; height: 12px; }
.nx .tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: break-word; }
.nx .nx-table.compact .tbl td, .nx .tbl.compact td { padding-top: 6px; padding-bottom: 6px; }
.nx .tbl tr:last-child td { border-bottom: 0; }
.nx .tbl td.r, .nx .tbl th.r { text-align: right; }
/* Numbers: mono, tabular, 500. */
.nx .tbl td.n { font-family: var(--mono); font-size: var(--text-meta); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nx .tbl .first { padding-left: 16px; } .nx .tbl .last { padding-right: 16px; }
.nx .tbl .cb { width: 36px; }
.nx .tbl tbody tr:focus { outline: none; }
.nx .tbl tbody tr.cur td { box-shadow: inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent); }
.nx .tbl tbody tr.cur td:first-child { box-shadow: inset 3px 0 0 var(--accent), inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent); }
.nx .tbl tr.rsel td { background: var(--accent-soft); }
@media (hover: hover) { .nx .tbl tbody tr:hover td { background: color-mix(in srgb, var(--sunken) 40%, var(--surface)); } }
/* Status rows: a 3 px inset edge in the status colour, a tinted fill on hover. */
.nx .tbl tr.st-bad td:first-child { box-shadow: inset 3px 0 0 var(--crit); }
.nx .tbl tr.st-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
@media (hover: hover) {
  .nx .tbl tbody tr.st-bad:hover td { background: var(--crit-soft); }
  .nx .tbl tbody tr.st-warn:hover td { background: var(--warn-soft); }
}
.nx .acts-c { display: flex; gap: 4px; justify-content: flex-end; align-items: center; white-space: nowrap; }
.nx .tfoot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px;
  border-top: 1px solid var(--border); font-size: var(--text-meta); color: var(--ink-3);
}
.nx .pager { display: flex; gap: 8px; align-items: center; }
.nx .bulk {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--accent-soft);
  color: var(--accent-ink); font-size: var(--text-control); border-top: 1px solid var(--border);
}
/* :not(.ib): the phone menu button in the top bar is also class "menu". */
.nx .menu:not(.ib) {
  position: absolute; z-index: 5; width: 250px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--elev-high); padding: 4px; display: flex; flex-direction: column;
}
.nx .menu .mi {
  display: flex; align-items: center; gap: 9px; min-height: 32px; padding: 5px 8px; border-radius: 6px; border: 0;
  background: none; width: 100%; text-align: left; color: var(--ink-1); font: inherit; font-size: var(--text-control); cursor: pointer;
}
.nx .menu .mi span:first-child { display: flex; flex-direction: column; }
.nx .menu .mi small { font-size: var(--text-meta); line-height: var(--lh-meta); color: var(--ink-3); white-space: normal; }
.nx .menu .mi .kbd { margin-left: auto; }
.nx .menu .mi[aria-disabled="true"] { color: var(--ink-3); cursor: not-allowed; }
@media (hover: hover) { .nx .menu .mi:hover { background: var(--sunken); } }
/* The automatic export control (exports.js) on a chart's table view. */
.nx .export-bar { display: flex; justify-content: flex-end; padding: 8px 16px; }
.nx .export-btn { border: 0; background: none; color: var(--ink-2); font: inherit; font-size: var(--text-meta); cursor: pointer; }

/* Charts */
.nx svg.ch { display: block; width: 100%; height: auto; overflow: visible; }
.nx .ch text { font-family: var(--sans); font-size: var(--text-meta); fill: var(--ink-2); pointer-events: none; }
.nx .ch .ax { fill: var(--ink-3); font-size: var(--text-micro); }
.nx .ch .lb { fill: var(--ink-1); font-weight: 500; }
.nx .ch .val { fill: var(--ink-1); font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.nx .ch .base { stroke: var(--border-strong); stroke-width: 1; }
.nx .ch .hit { fill: transparent; }
/* Marks under the hit area must not take the pointer, or hovering a bar shows nothing. */
.nx .ch rect:not(.hit), .nx .ch line { pointer-events: none; }
.nx .ch .hit[data-nx-act] { cursor: pointer; }
.nx .ch .hit:hover { fill: var(--sunken); }
.nx .ch .hit:focus-visible { outline: none; stroke: var(--accent); stroke-width: 2; }
.nx .ch .miss { fill: none; stroke: var(--ink-3); stroke-width: 1.2; stroke-dasharray: 3 2; }
/* Grid lines: dashed 2 2. Charts draw only horizontal ones (vertical axis ticks on hbars). */
.nx .ch .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 2; }
.nx .ch .conn { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 2; }

/* Tooltip and figure card */
/* Tooltip and figure card: inverted, ink on the page colour. */
.nx.nx-tip {
  position: fixed; z-index: 70; max-width: 320px; padding: 10px 12px; border-radius: var(--r); pointer-events: none;
  background: var(--ink-1); color: var(--canvas); border: 0; box-shadow: var(--elev-mid);
  font-size: var(--text-control); line-height: var(--lh-control); opacity: 0; transform: scale(0.97); transform-origin: top left;
  transition: opacity var(--dur-fast) var(--ease-entrance), transform var(--dur-fast) var(--ease-entrance);
}
.nx.nx-tip.on { opacity: 1; transform: none; }
.nx-tip .tt { font-weight: 600; }
.nx-tip .tv { font-family: var(--display); font-size: var(--text-page); line-height: var(--lh-page); font-weight: 600; letter-spacing: -0.013em; margin: 2px 0 6px; }
.nx-tip dl { margin: 0; display: grid; grid-template-columns: 70px 1fr; gap: 3px 10px; }
.nx-tip dt { color: color-mix(in srgb, var(--canvas) 72%, var(--ink-1)); } .nx-tip dd { margin: 0; }
.nx-tip .dim, .nx-tip .ax { color: color-mix(in srgb, var(--canvas) 72%, var(--ink-1)); }
.nx-tip .go { margin-top: 8px; padding-top: 7px; border-top: 1px solid color-mix(in srgb, var(--canvas) 25%, var(--ink-1)); color: var(--canvas); font-weight: 600; }

/* Drawer */
.nx.nx-scrim {
  position: fixed; inset: 0; z-index: 64; background: var(--overlay); opacity: 0;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); transition: opacity var(--dur-base) var(--ease-standard);
}
.nx.nx-scrim.on { opacity: 1; }
.nx.nx-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 65; width: min(600px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--elev-high); border-radius: var(--r-lg) 0 0 var(--r-lg);
  overflow: hidden;
  font-size: var(--text-control); line-height: var(--lh-control); transform: translateX(100%); transition: transform var(--dur-base) var(--ease-emph);
}
.nx.nx-drawer.on { transform: none; }
.nx-drawer .dh { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.nx-drawer .dh > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nx-drawer .dh b { font-family: var(--display); font-size: var(--text-card); line-height: var(--lh-card); font-weight: 600; letter-spacing: -0.013em; }
.nx-drawer .dh span { font-size: var(--text-meta); color: var(--ink-3); }
.nx-drawer .db { overflow: auto; flex: 1; }
.nx-drawer .dn { padding: 12px 18px; color: var(--ink-2); border-top: 1px solid var(--border); }
.nx-drawer .df { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }

/* Toast */
/* Toast: bottom right, arrives on the overshoot curve. */
.nx.nx-toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 80; display: flex; align-items: center; gap: 14px;
  padding: 9px 10px 9px 14px; border-radius: var(--r); background: var(--ink-1); color: var(--surface);
  font-size: var(--text-control); box-shadow: var(--elev-high); max-width: calc(100vw - 32px);
  animation: nx-toast-in var(--dur-base) var(--ease-over) both;
}
@keyframes nx-toast-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (max-width: 767px) { .nx.nx-toast { right: 16px; left: 16px; bottom: 16px; } }
.nx-toast button {
  border: 0; background: none; color: var(--surface); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px; padding: 2px 4px;
}

/* ══ Ledgerline additions (PR #6) ══════════════════════════════════════════════
 * The hero figure, rolling digits, computed-content colour, filter pills and
 * the load animation. Values from Ledgerline's globals.css and ds-effects.css. */

/* Hero figure: one per screen (nx.hero). */
.nx .nx-hero {
  display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 20px 24px 22px;
  background: var(--surface); border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--border), var(--elev-low);
}
.nx .nx-hero.clickable { cursor: pointer; transition: box-shadow var(--dur-fast) var(--ease-standard); }
@media (hover: hover) { .nx .nx-hero.clickable:hover { box-shadow: inset 0 0 0 1px var(--border-strong), var(--elev-mid); } }
.nx .nx-hero h2 { margin: 0; }
.nx .hero-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 14px; margin-top: 2px; }
.nx .hero-fig { display: inline-flex; flex-direction: column; min-width: 0; }
.nx .hero-v {
  font-family: var(--display); font-size: var(--text-hero); line-height: var(--lh-hero); font-weight: 600;
  letter-spacing: -0.033em; white-space: nowrap; color: var(--ink-1);
}
/* The rail under the hero is the computed-content gradient: the figure is
 * summed from every deal under it. */
.nx .hero-rail { display: block; height: 2px; margin-top: 8px; border-radius: 1px; background: var(--ai-grad); transform-origin: left center; }
.nx .hero-row .pill { margin-bottom: 14px; }
.nx .hero-s { margin: 4px 0 0; max-width: 64ch; font-size: var(--text-body); line-height: var(--lh-body); color: var(--ink-2); text-wrap: pretty; }
.nx .nx-hero .cms { margin-top: 4px; }
@media (max-width: 767px) {
  .nx .nx-hero { padding: 16px; }
  .nx .hero-v { font-size: var(--text-figure); line-height: var(--lh-figure); }
  .nx .hero-row .pill { margin-bottom: 8px; }
}

/* Overview: seven tiles follow its hero in four columns; the last one spans
 * the empty cell. On a phone (two columns) it spans the row. */
.nx-pipeline .nx-grid.g4.after-hero > .kpi:last-child:nth-child(7) { grid-column: span 2; }
.nx .nx-hero + .nx-grid { margin-top: 12px; }

/* Rolling digits (motion.js roll): each digit is a column of 0-9. */
.nx .roll { display: inline-flex; align-items: flex-start; overflow: hidden; height: 1.08em; line-height: 1.08em; vertical-align: top; }
.nx .roll .col { display: inline-flex; flex-direction: column; align-self: flex-start; transition: transform var(--dur-gentle) var(--ease-emph); }
.nx .roll .col span { height: 1.08em; text-align: center; }
.nx .still .roll .col { transition: none; }
.nx .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Computed content: what the dashboard worked out rather than read from the
 * CRM (What changed, the insights, the pipeline health score) carries the
 * violet-to-indigo gradient. The teal accent stays for chrome. */
.nx :is(.nx-card.ai, [data-today="changed"], [data-card="health"]) { position: relative; overflow: hidden; }
.nx :is(.nx-card.ai, [data-today="changed"], [data-card="health"])::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--ai-grad);
}
.nx .ai-mark {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: var(--r-sm);
  font-size: var(--text-micro); font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--ai-soft); color: var(--ai-ink);
}

/* Filter pills (Ledgerline FilterPill): 12 px, 6 px radius, a mono count. */
:is(.nx-today, .nx-closing) .fchip {
  display: inline-flex; align-items: center; gap: 8px; height: var(--h-sm); padding: 0 12px; border-radius: 6px; flex: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); font: inherit;
  font-size: var(--text-meta); font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-emph), color var(--dur-fast) var(--ease-emph);
}
@media (hover: hover) { :is(.nx-today, .nx-closing) .fchip:hover { background: var(--sunken); color: var(--ink-1); } }
:is(.nx-today, .nx-closing) .fchip b { font-family: var(--mono); font-size: var(--text-micro); font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
:is(.nx-today, .nx-closing) .fchip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
:is(.nx-today, .nx-closing) .fchip[aria-pressed="true"] b { color: var(--accent-ink); }

/* Load animation. The shell puts .nx-entering on the main column for 1.6 s
 * after a route change (shell_next.js markEntering), so a redraw of the same
 * screen does not replay it. Sections rise 18 px, 80 ms apart; table rows
 * follow 40 ms apart (the first 12); bars grow to 103% and settle; the hero
 * rail draws in. With reduced motion every duration is 0 and the end states
 * stay. */
@keyframes nx-rise { 0% { opacity: 0; transform: translateY(18px) scale(0.992); } 70% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes nx-row { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes nx-bar-x { 0% { transform: scaleX(0); } 78% { transform: scaleX(1.03); } 100% { transform: none; } }
@keyframes nx-bar-y { 0% { transform: scaleY(0); } 78% { transform: scaleY(1.03); } 100% { transform: none; } }
@keyframes nx-rail { from { transform: scaleX(0); } to { transform: none; } }
.nx-entering .nx:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity) > * {
  animation: nx-rise var(--dur-slow) var(--ease-entrance) both;
  animation-delay: calc(var(--i, 0) * var(--stagger));
}
.nx-entering .nx:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity) > :nth-child(2) { --i: 1; }
.nx-entering .nx:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity) > :nth-child(3) { --i: 2; }
.nx-entering .nx:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity) > :nth-child(4) { --i: 3; }
.nx-entering .nx:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity) > :nth-child(5) { --i: 4; }
.nx-entering .nx:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity) > :nth-child(6) { --i: 5; }
.nx-entering .nx:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity) > :nth-child(7) { --i: 6; }
.nx-entering .nx:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity) > :nth-child(8) { --i: 7; }
.nx-entering .nx .tbl tbody tr:nth-child(-n+12) {
  animation: nx-row var(--dur-base) var(--ease-entrance) both;
  animation-delay: calc(var(--dur-fast) + var(--r, 0) * var(--stagger) / 2);
}
.nx-entering .nx .tbl tbody tr:nth-child(2) { --r: 1; }
.nx-entering .nx .tbl tbody tr:nth-child(3) { --r: 2; }
.nx-entering .nx .tbl tbody tr:nth-child(4) { --r: 3; }
.nx-entering .nx .tbl tbody tr:nth-child(5) { --r: 4; }
.nx-entering .nx .tbl tbody tr:nth-child(6) { --r: 5; }
.nx-entering .nx .tbl tbody tr:nth-child(7) { --r: 6; }
.nx-entering .nx .tbl tbody tr:nth-child(8) { --r: 7; }
.nx-entering .nx .tbl tbody tr:nth-child(9) { --r: 8; }
.nx-entering .nx .tbl tbody tr:nth-child(10) { --r: 9; }
.nx-entering .nx .tbl tbody tr:nth-child(11) { --r: 10; }
.nx-entering .nx .tbl tbody tr:nth-child(12) { --r: 11; }
.nx-entering .nx .ch .bar {
  transform-box: fill-box; transform-origin: left center;
  animation: nx-bar-x var(--dur-gentle) var(--ease-emph) var(--dur-base) both;
}
.nx-entering .nx .ch .bar.col { transform-origin: center bottom; animation-name: nx-bar-y; }
.nx-entering .nx .hero-rail { animation: nx-rail var(--dur-gentle) var(--ease-emph) var(--dur-slow) both; }

/* ══ Today (C1) ════════════════════════════════════════════════════════════════
 * templates/modules/today_next.js. Ported from design/checkpoint-kit build.py
 * (today_screen, phone_today) and kit.py (.dlg, .fld, .cmpv). Kit sizes outside
 * the scale: 16 (phone summary) → 17, 0.88em figures → 14, 18 (dialog title)
 * → 17, 12.5 → 13, 11.5 → 12. */
.nx.nx-today { display: flex; flex-direction: column; gap: 30px; min-width: 0; }
:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity) .sec { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity) .sec-h { display: flex; align-items: baseline; gap: 10px; }
:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity) .sec-h h2 { margin: 0; font-family: var(--sans); font-size: var(--text-control); line-height: var(--lh-control); font-weight: 600; color: var(--ink-2); }
:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity) .sec-h span { font-size: var(--text-meta); color: var(--ink-3); }
:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity) .card-h h3 { display: flex; align-items: center; gap: 6px; }
.nx-today .card-b.stack { display: flex; flex-direction: column; gap: 12px; }
.nx-today a.btn { text-decoration: none; }
.nx-today .btn.wide { width: 100%; height: 40px; }
.nx .nx-grid.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* What changed */
:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity) .summary {
  margin: 0; max-width: 78ch; font-family: var(--display); font-size: var(--text-card); line-height: 27px;
  color: var(--ink-1); text-wrap: pretty;
}
.nx-today .fig {
  font-family: var(--sans); font-size: var(--text-body); font-weight: 600; white-space: nowrap; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 4px;
}
.nx-today .fig:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.nx-today .signal {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r);
  background: var(--ai-soft); font-size: var(--text-control);
}
.nx-today .signal .i { color: var(--ai-ink); }
.nx-today .signal .chip { margin-left: auto; }

/* Cells */
:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity, .nx-drawer) .dl { display: flex; flex-direction: column; min-width: 0; }
:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity, .nx-drawer) .dl :is(a, b) { font-weight: 500; color: var(--ink-1); text-decoration: none; }
:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity, .nx-drawer) .dl a:hover { text-decoration: underline; text-underline-offset: 2px; }
:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity, .nx-drawer) .dl > span { font-size: var(--text-meta); color: var(--ink-3); }
:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity, .nx-drawer) .zl { display: inline-flex; color: var(--ink-3); vertical-align: -2px; }
.nx-today .why { display: flex; flex-wrap: wrap; gap: 4px; }
/* Inline blocks, so a chip that wraps keeps its text in one run. */
.nx-today .why .chip { display: inline-block; white-space: normal; }
.nx-today .why .chip .i { vertical-align: -2px; margin-right: 5px; }
.nx-today .note {
  color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.nx-today .note b { display: block; font-size: var(--text-meta); font-weight: 500; color: var(--ink-3); }
:is(.nx-today, .nx-pipeline, .nx-closing, .nx-activity, .nx-drawer) .mk-miss {
  display: inline-flex; align-items: center; height: 18px; padding: 0 5px; border: 1.5px dashed var(--ink-3);
  border-radius: 4px; font-size: var(--text-meta); font-weight: 500; color: var(--ink-2); line-height: 1;
}
.nx-today .tbl tr.grp td {
  background: var(--sunken); font-size: var(--text-meta); font-weight: 600; color: var(--ink-2);
  padding-top: 6px; padding-bottom: 6px;
}
.nx-today .tbl td.b { font-weight: 600; }
.nx-today .act { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.nx-today .act .as { font-size: var(--text-meta); line-height: var(--lh-meta); color: var(--ink-3); text-align: right; }

/* Ranked: filters, column widths, selection, inline forms */
.nx-today .fchips { display: flex; flex-wrap: wrap; gap: 6px; }
.nx-today .inp.sel { height: 28px; font-size: var(--text-meta); }
.nx-today .rank-table .tbl { table-layout: fixed; }
.nx-today .rank-table th:nth-child(1) { width: 36px; }
.nx-today .rank-table th:nth-child(2) { width: 13%; }
.nx-today .rank-table th:nth-child(3) { width: 10%; }
.nx-today .rank-table th:nth-child(4) { width: 9%; }
.nx-today .rank-table th:nth-child(5) { width: 11%; }
.nx-today .rank-table th:nth-child(6) { width: 7%; }
.nx-today .rank-table th:nth-child(7) { width: 16%; }
.nx-today .rank-table th:nth-child(8) { width: 12%; }
.nx-today .rank-table th:nth-child(9) { width: 8%; }
.nx-today .rank-table th:nth-child(10) { width: 76px; }
.nx-today .rank-table th:nth-child(11) { width: 44px; }
.nx-today .bulk .why-off { font-size: var(--text-meta); color: var(--ink-2); }
.nx-today .nx-form-row td { background: var(--sunken); }
.nx-today .nx-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.nx-today .nx-inline label { font-size: var(--text-control); font-weight: 600; color: var(--ink-1); }
.nx-today .nx-inline .inp { height: 30px; min-width: 220px; }
.nx-today .nx-inline .hint { flex-basis: 100%; font-size: var(--text-meta); color: var(--ink-3); }

/* Data integrity */
.nx-today .int {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 9px; color: var(--ink-1); text-decoration: none;
}
.nx-today .int:hover { border-color: var(--border-strong); }
.nx-today .int b { font-size: var(--text-page); line-height: var(--lh-page); font-weight: 600; font-variant-numeric: tabular-nums; }
.nx-today .int span { font-size: var(--text-control); font-weight: 500; }
.nx-today .int small { font-size: var(--text-meta); line-height: var(--lh-meta); color: var(--ink-3); }
.nx-today .link {
  display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; color: var(--accent-ink);
  font-size: var(--text-control); font-weight: 600; text-decoration: none;
}

/* Phone (390 px): cards, lists and 40 px targets */
.nx-today.phone { gap: 18px; }
.nx-today.phone .summary { line-height: 25px; }
.nx-today.phone .kpi { padding: 11px 12px; }
.nx-today.phone .kpi .v { font-size: var(--text-page); line-height: var(--lh-page); }
.nx-today.phone .nx-grid { gap: 8px; }
.nx-today.phone .kpi .cm { white-space: normal; }
.nx-today .hscroll { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.nx-today .pc {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px; min-width: 0;
}
.nx-today .pc .r1 { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.nx-today .pc .r1 b { font-size: var(--text-body); line-height: 19px; font-weight: 600; }
.nx-today .pc .r1 .v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nx-today .pc .r2 { font-size: var(--text-meta); line-height: var(--lh-meta); color: var(--ink-3); overflow-wrap: anywhere; }
.nx-today .pc .r3 { display: flex; gap: 6px; margin-top: 2px; }
.nx-today .pc .r3 .btn { flex: 1; height: 40px; }
.nx-today .pc .r3 .ib { width: 40px; height: 40px; border: 1px solid var(--border-strong); }
.nx-today .pc .menu { position: static; width: auto; box-shadow: none; }
.nx-today .pc .menu .mi { min-height: 44px; }
.nx-today .pc .nx-inline .inp { flex: 1; min-width: 0; height: 40px; }
.nx-today .pc .nx-inline .btn { height: 40px; }
.nx-today .list { padding: 0 12px; }
.nx-today .li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 9px 0;
  border-top: 1px solid var(--border); color: var(--ink-1); text-decoration: none;
}
.nx-today .li:first-child { border-top: 0; }
.nx-today .li .t { font-size: var(--text-control); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nx-today .li .v { font-size: var(--text-control); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nx-today .li .m { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; font-size: var(--text-meta); color: var(--ink-3); }
.nx-today .li .m.r { justify-content: flex-end; }
.nx-today .more { padding: 8px 0 10px; }
@media (max-width: 767px) { .nx .nx-grid.g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Zoho dialogs: one field on one deal, one close date on many */
.nx.nx-dlg {
  width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink-1); box-shadow: var(--elev-high);
}
.nx.nx-dlg.wide { width: min(560px, calc(100vw - 32px)); }
.nx.nx-dlg::backdrop { background: var(--overlay); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.nx-dlg .dh2 { display: flex; flex-direction: column; gap: 3px; padding: 16px 18px 10px; }
.nx-dlg .dh2 b { font-family: var(--display); font-size: var(--text-card); line-height: 24px; font-weight: 600; letter-spacing: -0.013em; }
.nx-dlg .dh2 span { font-size: var(--text-control); color: var(--ink-3); }
.nx-dlg .db2 { display: flex; flex-direction: column; gap: 12px; padding: 4px 18px 14px; font-size: var(--text-control); }
.nx-dlg .df2 {
  display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 18px;
  border-top: 1px solid var(--border); background: var(--canvas);
}
.nx-dlg .df2 .sp { flex: 1; font-size: var(--text-meta); color: var(--ink-3); }
.nx-dlg .fld { display: flex; flex-direction: column; gap: 5px; }
.nx-dlg .fld label { font-size: var(--text-meta); font-weight: 600; color: var(--ink-2); }
.nx-dlg .cmpv {
  display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 6px 10px; align-items: center;
  padding: 10px 12px; border-radius: 8px; background: var(--sunken);
}
.nx-dlg .cmpv span { font-size: var(--text-meta); color: var(--ink-3); }
.nx-dlg .cmpv b { font-variant-numeric: tabular-nums; }
.nx-dlg .tb-note { font-size: var(--text-meta); color: var(--ink-3); }
.nx-dlg .aon { display: inline-flex; gap: 8px; align-items: center; }

/* ══ Deal detail (C2) ══════════════════════════════════════════════════════════
 * templates/modules/deal_next.js. Ported from design/checkpoint-kit kit.py
 * (.ddr, .facts4, .sub-h, .tl2) and build.py (.ph-top, .ph-b). Kit sizes outside
 * the scale: 21 (drawer title) → 22, 19 (phone title) → 17, 18 (fact value) → 17,
 * 12.5 → 13, 11.5 → 12. */
.nx.nx-drawer.deal { width: min(660px, 100vw); }
.nx-drawer.deal .dh { padding: 16px 20px 12px; }
.nx-drawer.deal .dh > div { gap: 3px; min-width: 0; }
.nx-drawer.deal #nx-dr-t { font-size: var(--text-page); line-height: 27px; }
.nx-drawer.deal #nx-dr-s { font-size: var(--text-control); }
.nx-drawer.deal .dh-acts { display: flex; }
.nx-drawer.deal .dh-acts a { text-decoration: none; }
.nx-drawer.deal .dh-acts .lbl { font-size: var(--text-meta); color: inherit; }
.nx-drawer.deal .dh-lead { display: none; }
.nx-drawer.deal .dd-body { display: flex; flex-direction: column; gap: 18px; padding: 14px 20px 20px; }
.nx-drawer.deal .dd-body > * { flex-shrink: 0; min-width: 0; }
.nx-drawer.deal .why { display: flex; flex-wrap: wrap; gap: 4px; }
.nx-drawer.deal .why .chip { white-space: normal; }
.nx-drawer.deal .facts4 {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.nx-drawer.deal .facts4 > div {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 12px; border-right: 1px solid var(--border);
}
.nx-drawer.deal .facts4 > div:last-child { border-right: 0; }
.nx-drawer.deal .facts4 span { font-size: var(--text-meta); line-height: var(--lh-meta); font-weight: 500; color: var(--ink-3); }
.nx-drawer.deal .facts4 b {
  font-size: var(--text-card); line-height: 24px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.nx-drawer.deal .facts4 small { font-size: var(--text-meta); line-height: var(--lh-meta); color: var(--ink-2); }
.nx-drawer.deal .sub-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; }
.nx-drawer.deal .sub-h h4 { margin: 0; font-family: var(--sans); font-size: var(--text-control); line-height: var(--lh-control); font-weight: 600; color: var(--ink-1); }
.nx-drawer.deal .sub-h > span { font-size: var(--text-meta); color: var(--ink-3); }
.nx-drawer.deal .sub-h .seg { margin-left: auto; align-self: center; }
.nx-drawer.deal .nx-card.dd-sec { border: 0; background: none; padding: 0; border-radius: 0; box-shadow: none; }
.nx-drawer.deal .dd-sec .tbl tr.cur td { background: var(--accent-soft); }
.nx-drawer.deal .ch .step { fill: none; stroke: var(--ink-1); stroke-width: 1.6; }
.nx-drawer.deal .tl2 { display: flex; flex-direction: column; }
.nx-drawer.deal .tl2 .ev {
  display: grid; grid-template-columns: 64px 20px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 7px 0;
  border-top: 1px solid var(--border); font-size: var(--text-control); line-height: var(--lh-control);
}
.nx-drawer.deal .tl2 .ev:first-child { border-top: 0; }
.nx-drawer.deal .tl2 .ev .d { color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: var(--text-control); }
.nx-drawer.deal .tl2 .ev .i { color: var(--ink-3); margin-top: 1px; }
.nx-drawer.deal .tl2 .ev b { font-weight: 500; }
.nx-drawer.deal .tl2 .ev .r { font-size: var(--text-meta); color: var(--ink-3); white-space: nowrap; }
.nx-drawer.deal .tl2 .ev small { display: block; color: var(--ink-2); font-size: var(--text-control); overflow-wrap: anywhere; }
.nx-drawer.deal .dd-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.nx-drawer.deal .tb-note { margin: 6px 0 0; font-size: var(--text-meta); line-height: var(--lh-meta); color: var(--ink-3); }
.nx-drawer.deal .note {
  color: var(--ink-1); font-size: var(--text-control); display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
.nx-drawer.deal .note b { display: block; font-size: var(--text-meta); font-weight: 500; color: var(--ink-3); }
.nx-drawer.deal .mk-miss {
  display: inline-flex; align-items: center; height: 18px; padding: 0 5px; border: 1.5px dashed var(--ink-3);
  border-radius: 4px; font-size: var(--text-meta); font-weight: 500; color: var(--ink-2); line-height: 1;
}
.nx-drawer.deal .df { position: relative; flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 20px; background: var(--canvas); }
.nx-drawer.deal .dd-form:empty { display: none; }
.nx-drawer.deal .nx-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.nx-drawer.deal .nx-inline label { font-size: var(--text-control); font-weight: 600; color: var(--ink-1); }
.nx-drawer.deal .nx-inline .inp { height: 30px; min-width: 220px; }
.nx-drawer.deal .nx-inline .hint { flex-basis: 100%; font-size: var(--text-meta); color: var(--ink-3); }
.nx-drawer.deal .dd-acts .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.nx-drawer.deal .dd-acts .sp { flex: 1; }
.nx-drawer.deal .dd-acts .as, .nx-drawer.deal .why-off { font-size: var(--text-meta); line-height: var(--lh-meta); color: var(--ink-3); }
.nx-drawer.deal .dd-acts .why-off { margin-top: 6px; }
.nx-drawer.deal .btn[aria-disabled="true"] { color: var(--ink-3); background: var(--sunken); border-color: var(--border); cursor: not-allowed; }
.nx-drawer.deal .dd-more { right: 14px; bottom: calc(100% - 4px); top: auto; width: min(300px, calc(100vw - 28px)); }

/* Phone (390 px): full screen, a 56 px header with Back, a sticky bottom bar */
@media (max-width: 767px) {
  .nx.nx-drawer.deal { width: 100vw; border-left: 0; }
  .nx-drawer.deal .dh { align-items: center; gap: 6px; height: 56px; padding: 0 8px 0 6px; }
  .nx-drawer.deal .dh > div, .nx-drawer.deal [data-close] { display: none; }
  .nx-drawer.deal .dh-lead { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
  .nx-drawer.deal .dh-lead .ib, .nx-drawer.deal .dh-acts a { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .nx-drawer.deal .dh-acts .lbl { display: none; }
  .nx-drawer.deal .dd-phone-t { display: flex; flex-direction: column; min-width: 0; line-height: 16px; }
  .nx-drawer.deal .dd-phone-t b {
    font-family: var(--display); font-size: var(--text-card); line-height: 24px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .nx-drawer.deal .dd-phone-t span { font-size: var(--text-meta); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nx-drawer.deal .dd-body { gap: 14px; padding: 14px; }
  .nx-drawer.deal .facts4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nx-drawer.deal .facts4 > div:nth-child(2n) { border-right: 0; }
  .nx-drawer.deal .facts4 > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .nx-drawer.deal .tl2 .ev { grid-template-columns: 52px 20px minmax(0, 1fr) auto; }
  .nx-drawer.deal .df { padding: 10px 14px 14px; background: var(--surface); }
  .nx-drawer.deal .dd-acts { display: grid; grid-template-columns: 1fr 1fr 44px; gap: 8px; }
  .nx-drawer.deal .dd-acts .btn { height: 44px; }
  .nx-drawer.deal .dd-acts .ib { width: 44px; height: 44px; border: 1px solid var(--border-strong); }
  .nx-drawer.deal .dd-acts .why-off { grid-column: 1 / -1; margin: 0; }
  .nx-drawer.deal .dd-more .mi { min-height: 44px; }
  .nx-drawer.deal .nx-inline .inp { flex: 1; min-width: 0; height: 40px; }
  .nx-drawer.deal .nx-inline .btn { height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .nx .sk { animation: none; }
  .nx.nx-drawer, .nx.nx-scrim, .nx.nx-tip { transition: none; }
  .nx .btn:active { transform: none; }
}

/* ══ Pipeline › Overview (C3) ══════════════════════════════════════════════════
 * templates/modules/pipeline_next.js. Ported from design/checkpoint-kit
 * build.py (bridge, snapshot, lists, matrix, meter, ded, hbar, lbbar) and
 * kit.py (heat, risk, lockt, lockb). Kit sizes outside the scale: 16 (bridge
 * summary) → 17, 34 (health score) → 28, 12.5 and 11.5 → 12. */
.nx:is(.nx-pipeline, .nx-closing, .nx-activity) { display: flex; flex-direction: column; gap: 30px; min-width: 0; }
:is(.nx-pipeline, .nx-closing, .nx-activity) .sec-b { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
:is(.nx-pipeline, .nx-closing, .nx-activity) .nx-card { min-width: 0; }
.nx-pipeline .fine { margin: 0; font-size: var(--text-meta); line-height: var(--lh-meta); color: var(--ink-3); }
.nx-pipeline .bad { color: var(--crit-ink); font-weight: 600; }
.nx-pipeline .toolbar.legend-row { padding-top: 10px; }
.nx .ch .nov { fill: none; stroke-width: 0.8; stroke-dasharray: 2 1.5; }
.nx .legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--text-meta); color: var(--ink-2); align-items: center; }
.nx .legend span { display: inline-flex; align-items: center; gap: 6px; }
.nx .legend i {
  width: 12px; height: 12px; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center;
  font-style: normal; font-size: var(--text-meta); font-weight: 600; color: var(--ink-1);
}
:is(.nx-pipeline, .nx-closing, .nx-activity) :is(.card-b, [data-pane]) > .legend { margin-top: 10px; }

/* This week */
.nx-pipeline .bridge { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.nx-pipeline .bridge-t { display: flex; flex-direction: column; gap: 10px; padding-top: 18px; }
.nx-pipeline .bridge-t .summary { font-size: var(--text-card); line-height: 25px; }
.nx-pipeline .said { margin: 0; font-size: var(--text-control); line-height: var(--lh-control); color: var(--ink-2); }

/* Stage snapshot */
.nx-pipeline .snap { display: flex; flex-direction: column; gap: 14px; }
.nx-pipeline .band { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; align-items: stretch; }
.nx-pipeline .band-h { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 10px 12px; border-radius: 9px; background: var(--sunken); }
.nx-pipeline .band-h b { font-size: var(--text-control); font-weight: 600; }
.nx-pipeline .band-h span { font-size: var(--text-meta); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.nx-pipeline .band-c { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.nx-pipeline .sc {
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px 10px;
  display: flex; flex-direction: column; gap: 2px; cursor: pointer; text-align: left; min-width: 0;
  font: inherit; color: inherit; transition: border-color 120ms ease;
}
@media (hover: hover) { .nx-pipeline .sc:hover { border-color: var(--ink-3); } }
.nx-pipeline .sc .stg { font-size: var(--text-meta); line-height: 15px; min-height: 30px; }
.nx-pipeline .sc .chip { align-self: flex-start; }
.nx-pipeline .sc .ct { font-size: var(--text-page); line-height: var(--lh-page); font-weight: 600; font-variant-numeric: tabular-nums; }
.nx-pipeline .sc .vl { font-size: var(--text-meta); color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nx-pipeline .sc .ag { font-size: var(--text-meta); line-height: var(--lh-meta); color: var(--ink-3); }
.nx-pipeline .sc .ag.w { color: var(--warn-ink); }
.nx-pipeline .sc .bar { height: 4px; border-radius: 2px; background: var(--sunken); margin-top: 6px; overflow: hidden; }
.nx-pipeline .sc .bar i { display: block; height: 100%; border-radius: 2px; }

/* Owner leaderboard */
:is(.nx-pipeline, .nx-activity) .who { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
:is(.nx-pipeline, .nx-activity) .av {
  width: 20px; height: 20px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--text-meta); font-weight: 600; background: var(--sunken); color: var(--ink-2); border: 1px solid var(--border);
}
.nx-pipeline .lbbar { display: flex; align-items: center; gap: 8px; }
.nx-pipeline .lbbar i { display: block; height: 8px; border-radius: 0 3px 3px 0; background: var(--s6); flex: none; }
.nx-pipeline .lbbar b { font-weight: 600; font-variant-numeric: tabular-nums; }
.nx-pipeline .heat {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 24px; padding: 0 6px;
  border-radius: 5px; font-weight: 600; font-variant-numeric: tabular-nums; font-size: var(--text-meta);
}
.nx-pipeline .heat.h0 { color: var(--ink-3); }
.nx-pipeline .heat.h1 { background: var(--s1); }
.nx-pipeline .heat.h2 { background: var(--s3); }
.nx-pipeline .heat.h3 { background: var(--s5); color: var(--ink-1); }
.nx-pipeline .heat.h4 { background: var(--s7); color: #fff; }
.nx-pipeline .risk { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-meta); font-weight: 600; }
.nx-pipeline .risk.low { color: var(--ink-3); }
.nx-pipeline .risk.med { color: var(--warn-ink); }
.nx-pipeline .risk.high { color: var(--crit-ink); }

/* Deal velocity */
.nx-pipeline .hbar { display: flex; height: 8px; border-radius: 3px; overflow: hidden; gap: 2px; width: 160px; }
.nx-pipeline .hbar i { display: block; height: 100%; }

/* The matrix */
.nx-pipeline .mx-dates { display: inline-flex; align-items: center; gap: 6px; }
.nx-pipeline .mx-wrap { overflow-x: auto; padding: 0 16px 4px; }
.nx-pipeline table.mx { border-collapse: separate; border-spacing: 3px; font-size: var(--text-meta); line-height: 15px; width: 100%; min-width: 900px; }
.nx-pipeline .mx th { font-weight: 500; color: var(--ink-2); vertical-align: bottom; text-align: left; padding: 0 3px 6px; }
.nx-pipeline .mx th.rh { width: 140px; padding-right: 10px; }
.nx-pipeline .mx th.tot, .nx-pipeline .mx td.tot { width: 64px; text-align: right; color: var(--ink-3); }
.nx-pipeline .mx th.gap, .nx-pipeline .mx td.gap { width: 6px; padding: 0; }
.nx-pipeline .mx th .stg { font-size: var(--text-meta); line-height: 15px; white-space: normal; }
/* The row labels carry the stage colour; the column heads need the width. */
.nx-pipeline .mx th .stg i { display: none; }
.nx-pipeline .mx-grp { font-size: var(--text-meta); font-weight: 600; color: var(--ink-3); }
.nx-pipeline .mx-grp.ul { border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.nx-pipeline .mx td { height: 48px; border-radius: 5px; text-align: center; vertical-align: middle; font-variant-numeric: tabular-nums; padding: 2px; }
.nx-pipeline .mx td.rl { text-align: left; padding-left: 2px; }
.nx-pipeline .mx td.e { color: var(--border-strong); }
.nx-pipeline .mx td.self { background: repeating-linear-gradient(135deg, var(--sunken) 0 4px, transparent 4px 8px); }
.nx-pipeline .mx td.c { cursor: pointer; position: relative; transition: box-shadow 120ms ease; }
.nx-pipeline .mx td.c b { display: block; font-size: var(--text-body); font-weight: 600; line-height: 17px; }
.nx-pipeline .mx td.c span { display: block; font-size: var(--text-meta); line-height: 14px; opacity: 0.9; }
.nx-pipeline .mx td.c .g { position: absolute; top: 3px; left: 4px; font-weight: 600; line-height: 10px; opacity: 0.85; }
.nx-pipeline .mx td.c:hover, .nx-pipeline .mx td.c:focus-visible { box-shadow: 0 0 0 2px var(--ink-1); outline: none; }
.nx-pipeline .mx .fwd1 { background: var(--s1); color: var(--ink-1); }
.nx-pipeline .mx .fwd2 { background: var(--s3); color: var(--ink-1); }
.nx-pipeline .mx .fwd3 { background: var(--s7); color: #fff; }
.nx-pipeline .mx .won1 { background: var(--pos-soft); color: var(--pos-ink); }
.nx-pipeline .mx .won2 { background: var(--pos-2); color: #003D1E; }
.nx-pipeline .mx .won3 { background: var(--pos); color: #fff; }
.nx-pipeline .mx .lost1 { background: var(--crit-soft); color: var(--crit-ink); }
.nx-pipeline .mx .lost2 { background: #F6C9C5; color: var(--crit-ink); }
.nx-pipeline .mx .lost3 { background: var(--crit); color: #fff; }
.nx-pipeline .mx :is(.back1, .back2, .back3) { background: var(--warn-soft); color: var(--warn-ink); box-shadow: inset 0 0 0 1.5px var(--warn); }
.nx-pipeline .mx :is(.hold1, .hold2, .hold3) { background: var(--hold-soft); color: var(--hold-ink); box-shadow: inset 0 0 0 1.5px var(--hold); }
.nx-pipeline .mx tr.tr td { height: auto; padding-top: 6px; color: var(--ink-3); }
.nx-pipeline .mx tr.tr td.rl { color: var(--ink-3); }
.nx-pipeline .mx tr.tr b, .nx-pipeline .mx td.tot b { color: var(--ink-1); }
.nx-pipeline .mx tr.sep td { height: 6px; padding: 0; }
:is(.nx-pipeline, .nx-closing, .nx-activity) .tb-note { margin: 0; padding: 0 16px; font-size: var(--text-meta); color: var(--ink-3); }
.nx-pipeline .mx-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; padding: 10px 16px 14px; border-top: 1px solid var(--border); margin-top: 8px; }
.nx .legend i.lg.won { background: var(--pos-2); color: #003D1E; }
.nx .legend i.lg.lost { background: var(--crit-soft); color: var(--crit-ink); }
.nx .legend i.lg.back { background: var(--warn-soft); box-shadow: inset 0 0 0 1.5px var(--warn); color: var(--warn-ink); }
.nx .legend i.lg.hold { background: var(--hold-soft); box-shadow: inset 0 0 0 1.5px var(--hold); color: var(--hold-ink); }
.nx .legend i.lg.churn { background: var(--crit-soft); box-shadow: inset 0 0 0 1.5px var(--crit); color: var(--crit-ink); }
.nx-pipeline .threads { padding: 0 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.nx-pipeline .threads p { margin: 0; font-size: var(--text-control); color: var(--ink-2); max-width: 100ch; }

/* Recent activity, won and lost */
.nx-pipeline .cols { gap: 0; }
.nx-pipeline .rcol + .rcol { border-left: 1px solid var(--border); }
:is(.nx-pipeline, .nx-activity) .lh { display: flex; align-items: center; gap: 6px; padding: 8px 16px; font-size: var(--text-meta); font-weight: 600; color: var(--ink-2); }
:is(.nx-pipeline, .nx-activity) .ls { display: flex; flex-direction: column; }
:is(.nx-pipeline, .nx-activity) .li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 9px 16px; border-top: 1px solid var(--border); }
@media (hover: hover) { :is(.nx-pipeline, .nx-activity) .li:hover { background: var(--sunken); } }
:is(.nx-pipeline, .nx-activity) .li .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--text-control); }
:is(.nx-pipeline, .nx-activity) .li .t a { color: var(--ink-1); text-decoration: none; }
:is(.nx-pipeline, .nx-activity) .li .t a:hover { text-decoration: underline; text-underline-offset: 2px; }
:is(.nx-pipeline, .nx-activity) .li .v { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; font-size: var(--text-control); white-space: nowrap; }
:is(.nx-pipeline, .nx-activity) .li .m { font-size: var(--text-meta); color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
:is(.nx-pipeline, .nx-activity) .li .m.r { justify-content: flex-end; }
.nx-pipeline .li .m .stg { font-size: var(--text-meta); line-height: 16px; }
.nx-pipeline .arrow { color: var(--ink-3); }
.nx-pipeline .none { margin: 0; padding: 4px 16px 12px; font-size: var(--text-meta); color: var(--ink-3); }

/* Pipeline health score */
.nx-pipeline .health { display: flex; flex-direction: column; gap: 12px; }
.nx-pipeline .hs { display: flex; align-items: baseline; gap: 10px; }
.nx-pipeline .score { font-family: var(--display); font-size: var(--text-figure); line-height: var(--lh-figure); font-weight: 600; letter-spacing: -0.013em; color: var(--ai-ink); }
.nx-pipeline .meter {
  position: relative; height: 10px; border-radius: 5px; background: var(--sunken); overflow: hidden;
  background-image: linear-gradient(90deg, transparent calc(40% - 1px), var(--border-strong) calc(40% - 1px), var(--border-strong) 40%, transparent 40%,
                                    transparent calc(70% - 1px), var(--border-strong) calc(70% - 1px), var(--border-strong) 70%, transparent 70%);
}
.nx-pipeline .meter i { position: absolute; inset: 0 auto 0 0; border-radius: 5px; }
.nx-pipeline .bands { position: relative; height: 16px; font-size: var(--text-meta); color: var(--ink-3); margin-top: 4px; }
.nx-pipeline .bands span { position: absolute; top: 0; white-space: nowrap; border-left: 1px solid var(--border-strong); padding-left: 4px; }
.nx-pipeline .bands span:first-child { border-left: 0; padding-left: 0; }
.nx-pipeline .bands span.end { right: 0; border-left: 0; }
.nx-pipeline .ded { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; font-size: var(--text-control); }
.nx-pipeline .ded b { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.nx-pipeline .ded .t { border-top: 1px solid var(--border); padding-top: 6px; }
.nx-pipeline .ded .tl { font-weight: 600; color: var(--ink-1); }

/* Pipeline integrity, and the member state of the moved sections */
.nx-pipeline .datebar .note { margin-left: auto; }
.nx-pipeline .lockt {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px;
  border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--ink-3); font-size: var(--text-control);
}
.nx-pipeline .lockb { display: flex; gap: 12px; align-items: flex-start; color: var(--ink-2); font-size: var(--text-control); }
.nx-pipeline .lockb > .i { color: var(--ink-3); flex: none; margin-top: 2px; }
.nx-pipeline .lockb b { font-weight: 600; color: var(--ink-1); }
.nx-pipeline .lockb p { margin: 4px 0 0; }

@media (max-width: 767px) {
  .nx-pipeline .bridge, .nx-pipeline .band, .nx-pipeline .nx-grid.g2, .nx-pipeline .nx-grid.g3 { grid-template-columns: minmax(0, 1fr); }
  .nx-pipeline .band-c { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nx-pipeline .rcol + .rcol { border-left: 0; border-top: 1px solid var(--border); }
  .nx-pipeline .bridge-t { padding-top: 0; }
  .nx-pipeline .datebar .note { margin-left: 0; }
  :is(.nx-pipeline, .nx-closing, .nx-activity) .toolbar .seg { max-width: 100%; overflow-x: auto; }
  :is(.nx-pipeline, .nx-closing, .nx-activity) .card-h { flex-wrap: wrap; }
  :is(.nx-pipeline, .nx-closing, .nx-activity) .card-h .acts { margin-left: 0; justify-content: flex-start; }
  /* A long value pushes the sparkline under it rather than over it. */
  :is(.nx-pipeline, .nx-closing, .nx-activity) .kpi .row { flex-wrap: wrap; }
  /* Charts keep a readable size and scroll inside their card. */
  :is(.nx-pipeline, .nx-closing, .nx-activity) [data-pane]:has(> svg.ch) { overflow-x: auto; }
  :is(.nx-pipeline, .nx-closing, .nx-activity) [data-pane] > svg.ch { min-width: 540px; }
}
/* Dark theme: dark text on the strongest matrix and heat steps, as in the kit. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nx-pipeline :is(.mx .fwd3, .mx .won3, .mx .lost3, .heat.h4) { color: #141517; }
  :root:not([data-theme="light"]) .nx-pipeline .mx .won2 { color: #E5F5ED; }
  :root:not([data-theme="light"]) .nx-pipeline .mx .lost2 { background: #8A2A22; color: #FBEAE8; }
}
:root[data-theme="dark"] .nx-pipeline :is(.mx .fwd3, .mx .won3, .mx .lost3, .heat.h4) { color: #141517; }
:root[data-theme="dark"] .nx-pipeline .mx .won2 { color: #E5F5ED; }
:root[data-theme="dark"] .nx-pipeline .mx .lost2 { background: #8A2A22; color: #FBEAE8; }

/* ══ Pipeline › Closing and Activity (C4) ══════════════════════════════════════
 * templates/modules/closing_next.js and activity_next.js. Ported from
 * design/checkpoint-kit sales_a.py closing() and activity(). Most rules are
 * shared with Overview above. */
.nx-closing .dates { display: inline-flex; align-items: center; gap: 6px; }
:is(.nx-closing, .nx-activity) .n.warn, .nx-closing .dl b.warn { color: var(--warn-ink); }
.nx-activity .n.warn { display: inline-flex; align-items: center; gap: 4px; }
.nx-activity .nx-grid.g7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.nx-activity .ctl { display: flex; flex-direction: column; gap: 12px; margin-top: -12px; }
.nx-activity .view { display: flex; flex-direction: column; gap: 30px; min-width: 0; }
.nx-activity .toolbar input[type="search"] { width: 260px; }
.nx .lnk {
  border: 0; padding: 0; background: none; font: inherit; color: var(--accent-ink); cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px;
}
.nx .lnk:hover { text-decoration-color: currentColor; }
.nx .lnk:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.nx-activity .who a { color: var(--ink-1); text-decoration: none; }
.nx-activity .wk { display: inline-flex; color: var(--ink-3); }
.nx-activity .wk .spark { width: 56px; height: 20px; }
.nx-activity .cl a { color: var(--ink-1); text-decoration: none; }
.nx-activity .dlink { display: block; color: var(--ink-1); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.nx-activity a.dlink:hover { text-decoration: underline; text-underline-offset: 2px; }
/* The feed: type, title, duration; then the meta line and the sequence. */
.nx-activity [data-card="feed"] .lh { background: var(--sunken); border-top: 1px solid var(--border); }
.nx-activity [data-card="feed"] .li { grid-template-columns: 110px minmax(0, 1fr) auto; }
.nx-activity [data-card="feed"] .li .m { grid-column: 2; }
.nx-activity [data-card="feed"] .li .m.r { grid-column: 3; }
.nx-activity [data-card="feed"] .li .m a { color: var(--ink-2); }
.nx-activity .more { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: var(--text-meta); color: var(--ink-3); }
.nx-activity [data-card="feed"] > .card-b > .empty { margin: 12px 16px; }
/* The client timeline drawer */
.nx-drawer.timeline .tl-stats { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.nx-drawer.timeline .tl-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--sunken); min-width: 90px; }
.nx-drawer.timeline .tl-stats > div.wide { flex: 1; min-width: 150px; }
.nx-drawer.timeline .tl-stats > div:last-child:not(.wide) { border: 0; background: none; }
.nx-drawer.timeline .tl-stats b { font-size: var(--text-card); font-weight: 600; }
.nx-drawer.timeline .tl-stats .wide b { font-size: var(--text-control); }
.nx-drawer.timeline .tl-stats span { font-size: var(--text-meta); color: var(--ink-3); }
.nx-drawer.timeline .tl-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.nx-drawer.timeline h4 { margin: 0 0 10px; font-size: var(--text-control); font-weight: 600; color: var(--ink-2); }
.nx-drawer.timeline .tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.nx-drawer.timeline .tl li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: var(--text-control); }
.nx-drawer.timeline .tl.deals li { grid-template-columns: minmax(0, 1fr) auto; }
.nx-drawer.timeline .tl li > span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nx-drawer.timeline .tl li > span.r { align-items: flex-end; }
.nx-drawer.timeline .tl .dt { color: var(--ink-3); font-size: var(--text-meta); }
.nx-drawer.timeline .tl .chip { align-self: flex-start; }
.nx-drawer.timeline .tl a, .nx-drawer.timeline .tl b { color: var(--ink-1); font-weight: 500; }
.nx-drawer.timeline .tl small { font-size: var(--text-meta); color: var(--ink-3); }
.nx-drawer.timeline p.dim { margin: 10px 0 0; font-size: var(--text-meta); }
.nx-drawer .ppl { list-style: none; margin: 0; padding: 0; }
.nx-drawer .ppl li { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--border); font-size: var(--text-control); }

@media (max-width: 767px) {
  .nx-activity .nx-grid.g7 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nx-activity .ctl .datebar .note { margin-left: 0; }
  .nx-activity .ctl .datebar .seg { max-width: 100%; overflow-x: auto; }
  .nx-activity .ptabs { flex-wrap: nowrap; overflow-x: auto; }
  .nx-activity .toolbar input[type="search"] { width: 100%; }
  .nx-activity [data-card="feed"] .li { grid-template-columns: minmax(0, 1fr) auto; }
  .nx-activity [data-card="feed"] .li .ty { grid-column: 1 / -1; }
  .nx-activity [data-card="feed"] .li .m, .nx-activity [data-card="feed"] .li .m.r { grid-column: 1 / -1; justify-content: flex-start; }
  .nx-closing .dates { flex-wrap: wrap; }
  .nx-closing .dates .inp { min-width: 0; flex: 1; }
  .nx-drawer.timeline .tl-cols { grid-template-columns: minmax(0, 1fr); }
}
