/* ============================================================
   NBI ERP — Design System v1.0 · 06 Aug 2026
   New Bharat Impex · locked "6e" visual language
   One stylesheet: tokens + component classes.
   Font: Figtree (Google Fonts, weights 400–800).
   ============================================================ */

:root {
  /* ---- Color · brand ---- */
  --nbi-primary: #1d47ae;        /* deep blue — primary actions, links, active nav */
  --nbi-primary-deep: #122f78;   /* pressed / hover text on links */
  --nbi-primary-dark: #173a92;   /* text on blue tints */
  --nbi-cyan: #29abe2;           /* gradient partner — never used alone for text */
  --nbi-grad: linear-gradient(90deg, #1d47ae, #29abe2);       /* primary buttons */
  --nbi-grad-avatar: linear-gradient(135deg, #1d47ae, #29abe2);

  /* ---- Color · ink (text) ---- */
  --nbi-ink-900: #101828;  /* headings, key values */
  --nbi-ink-700: #344054;  /* body */
  --nbi-ink-600: #475467;  /* secondary body */
  --nbi-ink-500: #667085;  /* labels, meta */
  --nbi-ink-400: #98a2b3;  /* placeholders, hints */

  /* ---- Color · lines & fills ---- */
  --nbi-line-300: #d0d5dd;
  --nbi-line-200: #e0e4ea;  /* input borders */
  --nbi-line-100: #e7eaf0;  /* card header rules */
  --nbi-fill-100: #f2f4f7;  /* table row rules, neutral chips */
  --nbi-bg: linear-gradient(135deg, #eaf6fd 0%, #eef2fb 45%, #e6edfa 100%); /* app ground */
  --nbi-bg-glow: radial-gradient(1000px 520px at 88% -8%, rgba(41,171,226,0.14), transparent 60%);

  /* ---- Color · semantic (tint / text / border triads) ---- */
  --nbi-blue-tint: #e8effc;    --nbi-blue-text: #1d47ae;    --nbi-blue-border: #b9d0fc;
  --nbi-green-tint: #eef4ee;   --nbi-green-text: #067647;   --nbi-green-border: #cde3cd;
  --nbi-amber-tint: #fff6e6;   --nbi-amber-text: #b54708;   --nbi-amber-border: #f5dcae;
  --nbi-amber-deep: #93370d;   /* body copy inside amber strips */
  --nbi-red-tint: #fdecea;     --nbi-red-text: #b42318;     --nbi-red-border: #f5c6c0;
  --nbi-red-deep: #912018;
  --nbi-purple-tint: #f4ecfb;  --nbi-purple-text: #7c3aed;
  --nbi-pink-tint: #fdeef4;    --nbi-pink-text: #c11574;
  --nbi-teal-tint: #e6f4f7;    --nbi-teal-text: #0e7490;
  --nbi-slate-tint: #eef0f3;   --nbi-slate-text: #5b6b7f;   --nbi-slate-border: #d5dbe3; /* LAPSED */
  --nbi-success-dot: #12b76a;
  --nbi-bar-amber: #f79009;

  /* ---- Glass surfaces ---- */
  --nbi-glass-bg: rgba(255,255,255,0.82);
  --nbi-glass-border: 1px solid rgba(255,255,255,0.95);
  --nbi-glass-blur: blur(10px);
  --nbi-chrome-bg: rgba(255,255,255,0.72);       /* top bar, sidebar */
  --nbi-chrome-border: rgba(29,71,174,0.10);
  --nbi-hover-row: rgba(232,239,252,0.5);        /* table row + nav hover */
  --nbi-hover-nav: rgba(232,239,252,0.8);
  --nbi-scrim: rgba(16,24,40,0.28);              /* Team Chat Build 1b: the light scrim behind the chat drawer */

  /* ---- Type ---- */
  --nbi-font: 'Figtree', sans-serif;
  --nbi-mono: ui-monospace, 'SF Mono', Menlo, monospace;  /* IDs, amounts, refs */
  --fs-caption: 11px;    /* uppercase field labels, tracking 0.05em */
  --fs-chip: 10.5px;     /* status chips & badges, weight 700 */
  --fs-meta: 12px;
  --fs-body-s: 12.5px;
  --fs-body: 13px;
  --fs-table: 13.5px;
  --fs-card-title: 14.5px;
  --fs-tile: 16px;
  --fs-page-title: 20px; /* weight 800, letter-spacing -0.01em */
  --fs-hero: 30px;       /* weight 800, letter-spacing -0.02em */
  --fs-stat: 28px;       /* KPI numbers, weight 800 */

  /* ---- Spacing (4px base) ---- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;  --sp-35: 14px;
  --sp-4: 16px; --sp-45: 18px; --sp-5: 20px; --sp-6: 24px; --sp-7: 28px;

  /* ---- My Work mobile and visual polish (19-Nov-2026): the white the quick-note glyph and the note rows named and
     never had; the ONE vertical rhythm between stacked sections; the stacked work-row card; the quick-note button's
     size, offset and the page clearance that keeps it off the last content---- */
  --nbi-white: #ffffff;
  --rhythm: var(--sp-4);
  --stack-gap: var(--sp-3);
  --stack-pad: var(--sp-3);
  --fab-size: 48px;
  --fab-offset: 18px;
  --fab-clear: calc(var(--fab-size) + var(--fab-offset) + var(--sp-4));

  /* ---- Radius ---- */
  --r-xs: 6px;    /* mono ID chips, flag icons */
  --r-sm: 8px;    /* buttons, nav icon tiles */
  --r-md: 10px;   /* inputs, segmented controls */
  --r-lg: 12px;   /* inner panels, strips */
  --r-xl: 16px;   /* cards */
  --r-2xl: 24px;  /* login card */
  --r-full: 999px;/* chips, progress bars */

  /* ---- Elevation ---- */
  --sh-card: 0 8px 24px rgba(18,47,120,0.08);
  --sh-pop: 0 20px 56px rgba(18,47,120,0.16);
  --sh-btn: 0 4px 14px rgba(29,71,174,0.3);
  --sh-btn-lg: 0 6px 20px rgba(29,71,174,0.3);
  /* --sh-hover is GONE (item 04, 22-Aug). Card hover is now a 2px lift and a
     cyan border; nothing in the app grows a shadow on hover any more. The token
     is removed rather than left unused so the pattern cannot quietly return by
     someone reaching for the obvious name. */
}

/* ============ Base ============ */
body {
  margin: 0;
  font-family: var(--nbi-font);
  color: var(--nbi-ink-700);
  background: var(--nbi-bg-glow), var(--nbi-bg);
  background-attachment: fixed;
  /* Item 01a — every figure in the ERP is a fixed-width figure. Proportional
     digits make a tonnage column wobble as it re-renders and make a changing
     amount jitter in place; both read as instability in a system whose whole
     job is to be trusted with numbers. Set on body so it inherits everywhere,
     and re-stated on the mono classes below, which change font-family and are
     the sites most likely to be copied into a new component. */
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
a { color: var(--nbi-primary); text-decoration: none; }
a:hover { color: var(--nbi-primary-deep); }
::selection { background: #dbe7fe; }
:focus-visible { outline: 2px solid var(--nbi-primary); outline-offset: 2px; }

/* ============ Surfaces ============ */
.card {                       /* the frosted-glass card — default container */
  background: var(--nbi-glass-bg);
  border: var(--nbi-glass-border);
  border-radius: var(--r-xl);
  backdrop-filter: var(--nbi-glass-blur);
  box-shadow: var(--sh-card);
}
.card-header {                /* title row inside a card */
  display: flex; justify-content: space-between; align-items: center;
  padding: 15px var(--sp-45); border-bottom: 1px solid var(--nbi-line-100);
  font-size: var(--fs-card-title); font-weight: 700; color: var(--nbi-ink-900);
}
.chrome {                     /* top bar & sidebar surface */
  background: var(--nbi-chrome-bg);
  backdrop-filter: var(--nbi-glass-blur);
  border-color: var(--nbi-chrome-border);
}

/* ============ Buttons ============ */
.btn { font-family: inherit; font-size: var(--fs-body); font-weight: 600;
  padding: 8px 14px; border-radius: var(--r-sm); border: none; cursor: pointer; }
.btn-primary { background: var(--nbi-grad); color: #fff; box-shadow: var(--sh-btn); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { filter: brightness(0.94); }
.btn-ghost { background: #fff; color: var(--nbi-ink-700); border: 1px solid var(--nbi-line-200); }
.btn-ghost:hover { border-color: var(--nbi-primary); color: var(--nbi-primary); }
.btn-tint { background: var(--nbi-blue-tint); color: var(--nbi-primary-dark); border: 1px solid var(--nbi-blue-border); }
.btn-tint:hover { background: #dbe7fe; }
.btn-text { background: none; border: none; color: var(--nbi-ink-500); font-weight: 600; }
.btn-text:hover { color: var(--nbi-ink-900); }
.btn-danger { background: var(--nbi-red-deep); color: #fff; }
.btn-danger:hover { background: var(--nbi-red-deep); }

/* ============ Chips & badges ============ */
.chip { display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-chip); font-weight: 700; letter-spacing: 0.04em;
  padding: 3px 9px; border-radius: var(--r-full); border: 1px solid transparent; white-space: nowrap; }
.chip-green  { background: var(--nbi-green-tint);  color: var(--nbi-green-text);  border-color: var(--nbi-green-border); }
.chip-blue   { background: var(--nbi-blue-tint);   color: var(--nbi-blue-text);   border-color: var(--nbi-blue-border); }
.chip-amber  { background: var(--nbi-amber-tint);  color: var(--nbi-amber-deep);  border-color: var(--nbi-amber-border); }
.chip-red    { background: var(--nbi-red-tint);    color: var(--nbi-red-deep);    border-color: var(--nbi-red-border); }
.chip-gray   { background: var(--nbi-fill-100);    color: var(--nbi-ink-500);     border-color: var(--nbi-line-200); }
.chip-outline{ background: transparent;            color: var(--nbi-ink-500);     border-color: var(--nbi-line-300); } /* NOT APPLIED */
.chip-slate  { background: var(--nbi-slate-tint);  color: var(--nbi-slate-text);  border-color: var(--nbi-slate-border); } /* LAPSED */
.chip-solid-red { background: var(--nbi-red-deep); color: #fff; border-color: var(--nbi-red-deep); } /* BLACKLISTED */
.mono-id { font-family: var(--nbi-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-meta); font-weight: 600;
  color: var(--nbi-ink-600); background: var(--nbi-fill-100); border-radius: var(--r-xs); padding: 3px 8px; }
.amount { font-family: var(--nbi-mono); font-variant-numeric: tabular-nums; }  /* ref nos.; money uses .money below */

/* ============ Money (item 07) ============
   Currency code FIRST, small and quiet, then the figure. The code is a label,
   not part of the number, so it is set apart rather than run together: at a
   glance the eye lands on the magnitude and only then confirms which currency
   it is in — which is the right order when a single screen carries three.

   Each currency stays its own native figure. There is NO combined total and no
   conversion to rupees anywhere in the ERP, which is a business rule and not a
   style preference: .money-stack exists so several currencies sit one per line
   rather than tempting anyone to add them up. Nothing in this codebase sums
   across currencies today — checked, not assumed. */
.money { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.money .ccy { font-size: 11px; font-weight: 800; letter-spacing: 0.1em;
  color: var(--nbi-ink-500); font-family: var(--nbi-font); }
.money .fig { font-family: var(--nbi-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.money-stack { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }

/* ============ Message strips (persistent, never toasts) ============ */
.strip { display: flex; align-items: flex-start; gap: 10px;
  border-radius: var(--r-lg); padding: 12px 16px; font-size: var(--fs-body); line-height: 1.5; }
.strip-warn  { background: rgba(255,246,230,0.92); border: 1px solid var(--nbi-amber-border); color: var(--nbi-amber-deep); }
.strip-error { background: rgba(253,236,234,0.85); border: 1px solid var(--nbi-red-border);   color: var(--nbi-red-deep); }
.strip-info  { background: rgba(232,239,252,0.7);  border: 1px solid var(--nbi-blue-border);  color: var(--nbi-primary-dark); }
.strip-ok    { background: rgba(238,244,238,0.9);  border: 1px solid var(--nbi-green-border); color: #05603a; }

/* ============ Tables ============ */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-table); color: var(--nbi-ink-700); }
.table thead tr { text-align: left; color: var(--nbi-ink-500); font-size: var(--fs-meta); background: rgba(232,239,252,0.5); }
.table th { padding: 11px 8px; font-weight: 600; }
.table td { padding: 12px 8px; }
.table th:first-child, .table td:first-child { padding-left: var(--sp-45); }
.table th:last-child,  .table td:last-child  { padding-right: var(--sp-45); }
.table tbody tr { border-top: 1px solid var(--nbi-fill-100); cursor: pointer; }
.table tbody tr:hover { background: var(--nbi-hover-row); }

/* ============ Forms ============ */
.field-label { font-size: var(--fs-caption); font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--nbi-ink-500); }
.input { margin-top: 6px; padding: 10px 12px; border: 1px solid var(--nbi-line-200);
  border-radius: var(--r-md); background: #fff; font-size: var(--fs-table);
  font-family: inherit; color: var(--nbi-ink-900); width: 100%; box-sizing: border-box; }
.input::placeholder { color: var(--nbi-ink-400); }
.input:focus { outline: 2px solid var(--nbi-primary); outline-offset: 0; border-color: var(--nbi-primary); }
.input-error { border-color: #f04438; }
.error-text { font-size: var(--fs-meta); color: #d92d20; margin-top: 5px; }  /* red = blocking */
.seg { display: inline-flex; background: var(--nbi-glass-bg); border: var(--nbi-glass-border);
  border-radius: var(--r-md); overflow: hidden; font-size: var(--fs-body-s); font-weight: 600; color: var(--nbi-ink-600); }
.seg > * { padding: 7px 13px; cursor: pointer; border-left: 1px solid var(--nbi-line-100); }
.seg > :first-child { border-left: none; }
.seg > .active { background: var(--nbi-primary); color: #fff; }

/* ============ Progress / utilisation bars ============ */
.bar { height: 6px; background: var(--nbi-fill-100); border-radius: var(--r-full); overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--r-full); background: var(--nbi-primary); }
.bar-fill.ok   { background: var(--nbi-success-dot); }  /* <85% */
.bar-fill.warn { background: var(--nbi-bar-amber); }    /* 85–100% */
.bar-fill.over { background: #d92d20; }                 /* >100% + OVER LIMIT tag */

/* ============ Navigation (top bar) ============ */
.topnav { display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 20px;
  border-bottom: 1px solid var(--nbi-chrome-border); position: sticky; top: 0; z-index: 6; }
.topnav-brand { display: flex; align-items: center; gap: 9px; cursor: pointer; }  /* click -> Command Center */
.topnav-items { display: flex; gap: 2px; min-width: 0; overflow-x: auto; }
.topnav-item { padding: 7px 11px; border-radius: var(--r-sm); border: none; background: none;
  cursor: pointer; font-family: inherit; font-size: var(--fs-body); font-weight: 600;
  color: var(--nbi-ink-600); white-space: nowrap; }
.topnav-item:hover { background: var(--nbi-hover-nav); }
.topnav-item.active { background: rgba(232,239,252,0.9); color: var(--nbi-primary); font-weight: 700; }
.topnav-menu { display: none; position: relative; }   /* single-menu fallback on narrow screens */
/* D-159 (02-Sep-2026) — OPAQUE, AND THE DEAD BLUR REMOVED.

   This read `rgba(255,255,255,0.96)` with `backdrop-filter: var(--nbi-glass-blur)`,
   and the 4% was meant to be hidden by the blur. It never was. The panel's
   parent is `<div class="topnav chrome">`, and `.chrome` carries a
   backdrop-filter of its own — which makes it the BACKDROP ROOT. A
   descendant's backdrop-filter then samples only within that ancestor, not
   the page beneath it, so this blur had no effect from the day it was
   written and the 4% passed the page heading through SHARP. Reported
   02-Sep as the heading bleeding into the open nav menu.

   The other repair available was to take the blur off `.chrome` instead.
   Rejected: `.chrome` is the top bar and the sidebar, its frosting is the
   locked design language (06-Aug), and stripping it to fix a dropdown would
   trade one visible fault for a bigger one across the whole shell.

   So the panel goes opaque, and the inert declaration is DELETED rather than
   left in place — a line that appears to be doing the work is worse than no
   line, because the next reader will trust it and look elsewhere.

   NOT touched, and still true: z-index 30 here sits inside `.topnav`'s own
   stacking context (position: sticky, z-index: 6), so it is scoped and cannot
   lift this panel above anything above 6 at root level. That is a separate,
   latent issue and is not what was reported. */
.menu-panel { position: absolute; top: 42px; left: 0; width: 250px; padding: 8px;
  background: #fff; border-radius: 14px;
  box-shadow: var(--sh-pop); display: flex; flex-direction: column; gap: 1px; z-index: 30; }
@media (max-width: 1120px) { .topnav-items { display: none; } .topnav-menu { display: block; } }
.breadcrumb-bar { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px;
  border-bottom: 1px solid rgba(29,71,174,0.08); background: rgba(255,255,255,0.4);
  backdrop-filter: var(--nbi-glass-blur); }
.crumb { font-size: var(--fs-body-s); color: var(--nbi-ink-500); font-weight: 600;
  background: none; border: none; cursor: pointer; font-family: inherit; }
.crumb.current { color: var(--nbi-ink-900); font-weight: 700; font-size: var(--fs-body); cursor: default; }
.crumb-sep { color: var(--nbi-line-300); }

/* ============ Skeletons (shell-first loading) ============ */
/* Item 09 — skeletons shimmer with a swept highlight instead of pulsing.

   THIS IS A SIBLING OF THE GREETING SHEEN, NOT THE SAME RULE. Item 00 works
   through background-clip: text, which clips the gradient to glyph shapes; on a
   solid bar there are no glyphs to clip to and background-clip does nothing at
   all. Same technique, same 60%-wide travelling highlight over a solid base
   layer, no clip — so it is written out separately rather than shared.

   The old nbi-pulse (opacity 0.5 to 1) is gone. A bar that fades in place says
   "something is here but dim"; a highlight that travels says "work is in
   progress", which is what a loading state is actually claiming.

   The base layer is the same #e4e9f2 the skeletons already used, and the
   highlight is white — the surface colour the glass cards and their borders are
   already built from. No new colour enters the system.

   Note .skel-head .skel in app.css re-declares `background` as a shorthand,
   which resets background-image to none, so table-header skeletons stay flat
   and still. That is deliberate and still works. */
@keyframes nbiSkelSheen {
  0%   { background-position: -150% 0, 0 0; }
  100% { background-position:  250% 0, 0 0; }
}
.skel {
  background-color: #e4e9f2;
  background-image:
    linear-gradient(100deg, rgba(255,255,255,0) 8%, rgba(255,255,255,0.9) 50%, rgba(255,255,255,0) 92%),
    linear-gradient(#e4e9f2, #e4e9f2);
  background-size: 60% 100%, 100% 100%;
  background-repeat: no-repeat, no-repeat;
  background-position: -150% 0, 0 0;
  border-radius: var(--r-xs);
  animation: nbiSkelSheen 1.6s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  /* Dropping to ONE layer truncates background-size and background-position to
     their first value — 60% wide at -150% — which parks the bar off its own box
     and leaves nothing but the background-color. Both must be restated. This is
     the same trap that hid the greeting on item 00. */
  .skel { animation: none;
    background-image: linear-gradient(#e4e9f2, #e4e9f2);
    background-size: 100% 100%;
    background-position: 0 0; }
}
.skel-pill { border-radius: var(--r-full); }

/* ============ Misc ============ */
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--nbi-grad-avatar);
  color: #fff; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; }
.kbd { border: 1px solid var(--nbi-line-200); border-radius: 4px; padding: 1px 5px;
  font-size: var(--fs-chip); color: var(--nbi-ink-500); }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--nbi-success-dot); }

/* ============ C14 Receivables — two shared regions (documented amendment, 28-Oct-2026) ============
   NBI_UI.ageingBar (interface backlog item 06) and NBI_UI.applyTarget, js/ui.js; brief section 7,
   mockup sections 1, 3 and 4. Bucket colours are the system's existing tokens — no new colour (practice
   145, planning's D2). The legend's swatch and amount, and the ticked card, are styled through the
   regions' own elements and state, so no class beyond these nine is added (planning's D1). */
.age-bar { display: flex; height: 14px; border-radius: var(--r-full); overflow: hidden; margin-top: 12px; background: var(--nbi-fill-100); }
.age-bar span { display: block; height: 100%; }
.age-0 { background: var(--nbi-green-text); }
.age-1 { background: var(--nbi-blue-text); }
.age-2 { background: var(--nbi-amber-border); }
.age-3 { background: var(--nbi-amber-deep); }
.age-4 { background: var(--nbi-red-deep); }
.age-5 { background: var(--nbi-red-deep); }
.age-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; margin-top: 12px; font-size: var(--fs-body-s); }
.age-legend span { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.age-legend b { display: block; font-weight: 700; color: var(--nbi-ink-900); margin-left: 16px; }
.apply-target { border: 1px solid var(--nbi-line-200); border-radius: var(--r-md); padding: 12px; margin-top: 10px; background: #fff; }
.apply-target:has(> .apply-target-head input[type="checkbox"]:checked) { border-color: var(--nbi-blue-border); background: var(--nbi-blue-tint); }
.apply-target-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.apply-target-head b { color: var(--nbi-ink-900); }
.apply-target-head > strong { margin-left: auto; color: var(--nbi-ink-900); white-space: nowrap; }
.apply-target-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-top: 10px; }
.apply-target-row > div { flex: 1 1 140px; }
.apply-ded { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; padding-left: 12px; border-left: 3px solid var(--nbi-line-200); }

/* ============ The rice purchase bundle — two shared regions (documented amendment, 29-Oct-2026) ============
   NBI_UI.approvalCard (mockup section 3) and NBI_UI.amountLadder (mockup section 5), js/ui.js; bundle brief v1.3
   section 9. Every colour is a token the system already holds — no new colour. The approval card is drawn for a
   phone first: one column, the actions wrapping beneath; the ladder's minus rows read in the system's red text,
   a provisional row in the amber text. No class beyond these fourteen is added. */
.approval-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.approval-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.approval-title { font-size: var(--fs-card-title); font-weight: 800; color: var(--nbi-ink-900); }
.approval-meta { font-size: var(--fs-body-s); color: var(--nbi-ink-500); }
.approval-rows { display: grid; grid-template-columns: 1fr; gap: 6px 16px; }
.approval-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; border-top: 1px solid var(--nbi-fill-100); padding-top: 6px; }
.approval-value { font-size: var(--fs-body); color: var(--nbi-ink-900); text-align: right; }
.approval-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; padding-top: 6px; }
@media (min-width: 900px) { .approval-rows { grid-template-columns: 1fr 1fr; } }
.ladder { display: flex; flex-direction: column; }
.ladder-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--nbi-fill-100); font-size: var(--fs-table); color: var(--nbi-ink-700); }
.ladder-label { display: flex; flex-direction: column; gap: 2px; }
.ladder-amount { white-space: nowrap; color: var(--nbi-ink-900); }
.ladder-minus .ladder-amount { color: var(--nbi-red-deep); }
.ladder-provisional .ladder-amount, .ladder-provisional .ladder-label { color: var(--nbi-amber-deep); }
.ladder-total { border-top: 2px solid var(--nbi-line-300); font-weight: 800; color: var(--nbi-ink-900); }
.ladder-words { font-size: var(--fs-body-s); color: var(--nbi-ink-600); padding-top: 8px; font-style: italic; }

/* ============================================================
   The trace chain (Rice Production Build 2, 03-Nov-2026; P7): NBI_UI.traceChain — linked steps, children indented
   beneath a rule, each step its kind chip, its title and a meta line. Phone first: the indent is small.
   ============================================================ */
.trace-chain { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--nbi-fill-100); }
.trace-chain.trace-root { padding-left: 0; border-left: 0; }
.trace-step { padding: 8px 0 4px 0; }
.trace-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.trace-kind { font-size: var(--fs-body-s); color: var(--nbi-ink-500); text-transform: uppercase; letter-spacing: 0.04em; min-width: 92px; }
.trace-title { font-weight: 600; color: var(--nbi-ink-900); overflow-wrap: anywhere; }

/* ============================================================
   C13 Payables — three shared regions (29-Oct-2026; brief 13.1): the stat tiles, the group row, the vendor card.
   Tokens only, no raw colours (the class check and the token rule).
   ============================================================ */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat-tile { background: var(--nbi-bg); border: 1px solid var(--nbi-line-200); border-radius: var(--r-md); padding: 12px 14px; }
.stat-tile .stat-label { font-size: 12px; color: var(--nbi-ink-500); }
.stat-tile .stat-value { font-size: var(--fs-tile); font-weight: 800; color: var(--nbi-ink-900); margin-top: 4px; }
.stat-tile .stat-sub { font-size: 12px; color: var(--nbi-ink-500); margin-top: 2px; }
.stat-tile.stat-warn { border-color: var(--nbi-amber-deep); background: var(--nbi-amber-tint); }
.stat-tile.stat-warn .stat-value { color: var(--nbi-amber-deep); }
.stat-tile.stat-bad { border-color: var(--nbi-red-deep); background: var(--nbi-red-tint); }
.stat-tile.stat-bad .stat-value { color: var(--nbi-red-deep); }
tr.group-row td { background: var(--nbi-line-100); font-weight: 700; color: var(--nbi-ink-900); padding: 8px 10px; }
tr.group-row .group-meta { float: right; font-weight: 500; color: var(--nbi-ink-500); font-size: 12px; }
.vendor-card { background: var(--nbi-bg); border: 1px solid var(--nbi-line-200); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 10px; }
.vendor-card .vendor-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.vendor-card .vendor-title { font-weight: 800; color: var(--nbi-ink-900); font-size: 15px; }
.vendor-card .vendor-amount { font-weight: 800; color: var(--nbi-ink-900); }
.vendor-card .vendor-rows { margin-top: 8px; display: grid; gap: 4px; }
.vendor-card .vendor-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--nbi-ink-700); }
.vendor-card .vendor-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
@media (min-width: 1000px) { .vendor-cards-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } }

/* ============================================================
   THE COMPARE PAIR (the Packing Chain Bundle, 04-Nov-2026; NBI_UI.compareImages): the approved artwork beside the
   printer's proof, side by side on a desk and stacked under 760 px. A documented amendment, add-only.
   ============================================================ */
.compare-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 10px; }
.compare-pane { border: 1px solid var(--nbi-line-200); border-radius: 10px; padding: 10px; background: #fff; min-width: 0; }
.compare-view { margin-top: 6px; background: var(--nbi-fill-100); border-radius: 8px; min-height: 160px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.compare-img { display: block; max-width: 100%; max-height: 420px; object-fit: contain; }
.compare-empty { color: var(--nbi-ink-500); font-size: 13px; padding: 24px 12px; text-align: center; }
.compare-view iframe, .compare-view object { width: 100%; height: 420px; border: 0; }
@media (max-width: 760px) { .compare-pair { grid-template-columns: 1fr; } }

/* PERSONAL NOTES (18-Nov-2026): the quick-note button (bottom right on every signed-in screen, hidden while a sheet is open) and the
   note rows. Tokens only; no colour literal. */
.qn-fab { position: fixed; right: calc(var(--fab-offset) + env(safe-area-inset-right, 0px)); bottom: calc(var(--fab-offset) + env(safe-area-inset-bottom, 0px));
  z-index: 40; width: var(--fab-size); height: var(--fab-size); border-radius: 50%; border: none; cursor: pointer;
  background: var(--nbi-primary); color: var(--nbi-white); font-size: 26px; line-height: var(--fab-size); box-shadow: 0 4px 14px rgba(0,0,0,.18);
  display: grid; place-items: center; padding: 0; }
.qn-fab:focus-visible { outline: 2px solid var(--nbi-ink-900); outline-offset: 2px; }
body:has(.acc-modal-wrap) .qn-fab { display: none; }
.note-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.note-row { border: 1px solid var(--nbi-line-100); border-radius: 8px; padding: 10px 12px; background: var(--nbi-white); min-width: 0; }
.note-body { font-size: 13.5px; color: var(--nbi-ink-900); white-space: normal; overflow-wrap: anywhere; }
.note-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.note-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.note-link { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }

/* ============ THE BELL (Realtime R1 and R2, 18-Nov-2026) ============
   The top bar's alert control (js/ui.js bell). The button is the size of the avatar beside it; the count sits on its corner;
   the panel is the house .menu-panel, hung from the right so it stays on a 375px screen, and scrolls inside itself. */
.bell { position: relative; }
.bell-btn { position: relative; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--nbi-line-200);
  background: #fff; color: var(--nbi-ink-600); display: grid; place-items: center; cursor: pointer; padding: 0; font-family: inherit; }
.bell-btn:hover { background: var(--nbi-hover-nav); }
.bell-count { position: absolute; top: -5px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;
  border-radius: 8px; background: var(--nbi-red-text); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.bell-panel { left: auto; right: 0; width: 270px; max-width: calc(100vw - 24px); max-height: min(420px, 70vh); overflow-y: auto; }
.bell-head { padding: 6px 10px 8px; font-size: 12px; font-weight: 700; color: var(--nbi-ink-900); border-bottom: 1px solid var(--nbi-line-100); }
/* three classes on purpose: css/app.css lays every .menu-panel .topnav-item out as a centred row, and it loads after this file */
.bell-panel .topnav-item.bell-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; white-space: normal; }
.bell-label { font-size: 12.5px; font-weight: 600; color: var(--nbi-ink-900); }
.bell-at { font-size: 11.5px; font-weight: 500; color: var(--nbi-ink-500); }
.bell-empty { padding: 14px 10px; font-size: 12.5px; color: var(--nbi-ink-500); }

/* ============ MY WORK MOBILE AND VISUAL POLISH (19-Nov-2026) ============
   The work row (ui.js workRow, workList), the stacked-card table, the aligned tiles, the My Work stack and the search box.
   Tokens only; no colour literal. Above 720 px the work table is exactly the table it was. */
.work-what { font-weight: 600; color: var(--nbi-ink-900); }
.work-amt { text-align: right; white-space: nowrap; }
.work-since { white-space: nowrap; }
.work-act { text-align: right; white-space: nowrap; }
.work-btns { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.work-head-amt { display: block; text-align: right; }
.mw-search { margin: 6px 0 var(--rhythm); }
.mw-stack { display: flex; flex-direction: column; gap: var(--rhythm); }
.mw-stack > .stat-tiles { margin-bottom: 0; }
.input-search { max-width: 340px; }
@media (max-width: 720px) {
  .input-search.input-search-fill { max-width: none; width: 100%; box-sizing: border-box; }
  .input-search.input-search-fill, .input-search.input-search-fill::placeholder { text-overflow: ellipsis; }
  /* the work row becomes a card: what and buyer, the number, amount beside waiting since, from, then the presses */
  .table.table-stack { display: block; overflow: visible; }
  .table-stack thead { display: none; }
  .table.table-stack tbody { display: grid; gap: var(--stack-gap); padding: var(--sp-2); }
  .table.table-stack tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-2) var(--sp-3);
    padding: var(--stack-pad); border: 1px solid var(--nbi-line-200); border-radius: var(--r-md); background: var(--nbi-white); }
  .table.table-stack tbody td { padding: 0; min-width: 0; text-align: left; white-space: normal; }
  .table.table-stack tbody td.ts-lbl::before { content: attr(data-label); display: block; font-size: var(--fs-meta); color: var(--nbi-ink-500); }
  .table.table-stack tbody td.work-title, .table.table-stack tbody td.work-num,
  .table.table-stack tbody td.work-from, .table.table-stack tbody td.work-act { grid-column: 1 / -1; }
  .table.table-stack tbody td.work-num { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .table.table-stack tbody td.work-amt { white-space: nowrap; }
  .table.table-stack tbody td.work-since { text-align: right; }
  .table.table-stack tbody td.work-act .work-btns { display: flex; width: 100%; }
  .table.table-stack tbody td.work-act .work-btns .btn { flex: 1 1 0; min-height: 44px; justify-content: center; }
  /* tiles of one row share one height and the same label, value and sub-line offsets */
  /* the bell: the panel hangs inside the screen, its rows keep the 44px floor, and the 30px button keeps a 44px hit area */
  .bell-panel { position: fixed; top: 60px; left: var(--sp-3); right: var(--sp-3); width: auto; max-width: none; }
  .bell-panel .topnav-item.bell-item { min-height: 44px; }
  .bell-btn::after { content: ''; position: absolute; inset: -7px; }
  .stat-tiles-reserve .stat-tile { display: flex; flex-direction: column; }
  .stat-tiles-reserve .stat-label, .stat-tiles-reserve .stat-sub { line-height: 1.3; }
  .stat-tiles-reserve .stat-label { min-height: 2.6em; }
  .stat-tiles-reserve .stat-sub { min-height: 2.6em; }
}

/* TEAM CHAT BUILD 1 (20-Nov-2026): the chat regions, extracted into js/ui.js as ONE reviewed change (the interface rule): the two-pane
   layout (the room list beside the open room; on a phone one pane at a time), the room row, the message bubble, the day heading and the
   unread line, the reply quote, the composer, the record card and the notice list. Tokens only; no colour literal. Tap targets 44 px. */
.chat-layout { display: flex; gap: 0; min-height: 520px; border: 1px solid var(--nbi-line-100); border-radius: 14px; background: var(--nbi-white); overflow: hidden; min-width: 0; }
.chat-rail { width: 320px; flex-shrink: 0; border-right: 1px solid var(--nbi-line-100); display: flex; flex-direction: column; min-width: 0; }
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-sect { padding: 10px 16px 4px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--nbi-ink-500); }
.chat-foot { border-top: 1px solid var(--nbi-line-100); padding: 4px 16px; display: flex; align-items: center; gap: 10px; min-height: 52px; font-size: 12px; color: var(--nbi-ink-500); margin-top: auto; }
.chat-foot > span { flex: 1; min-width: 0; }
.chat-row { display: flex; gap: 10px; align-items: center; padding: 8px 16px; min-height: 56px; border: none; border-top: 1px solid var(--nbi-fill-100); background: none; width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.chat-row:hover { background: var(--nbi-hover-row); }
.chat-row-on { background: var(--nbi-blue-tint); }
.chat-hash { width: 34px; height: 34px; border-radius: 10px; background: var(--nbi-blue-tint); color: var(--nbi-primary); display: grid; place-items: center; font-weight: 800; font-size: 15px; flex-shrink: 0; }
.chat-row-text { flex: 1; min-width: 0; }
.chat-row-name { font-size: 13.5px; font-weight: 600; color: var(--nbi-ink-900); overflow-wrap: anywhere; }
.chat-row-unread .chat-row-name { font-weight: 800; }
.chat-row-preview { font-size: 12px; color: var(--nbi-ink-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; width: 64px; flex-shrink: 0; }
.chat-time { font-size: 11px; color: var(--nbi-ink-400); }
.chat-badge { display: inline-block; min-width: 18px; text-align: center; font-size: 10.5px; font-weight: 800; border-radius: 999px; padding: 1px 6px; background: var(--nbi-primary); color: var(--nbi-white); }
.chat-badge-mention { background: var(--nbi-red-text); }
.chat-room-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--nbi-line-100); min-height: 56px; flex-wrap: wrap; }
.chat-room-name { font-size: 15px; font-weight: 700; color: var(--nbi-ink-900); overflow-wrap: anywhere; }
.chat-room-sub { font-size: 12px; color: var(--nbi-ink-500); }
.chat-msgs { flex: 1; min-height: 240px; overflow-y: auto; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.chat-day { align-self: center; font-size: 11px; font-weight: 700; color: var(--nbi-ink-500); border: 1px solid var(--nbi-line-100); border-radius: 999px; padding: 3px 12px; }
.chat-unread-line { align-self: stretch; display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 800; color: var(--nbi-red-text); letter-spacing: .05em; }
.chat-unread-line::before, .chat-unread-line::after { content: ""; flex: 1; height: 1px; background: var(--nbi-red-border); }
.chat-msg { display: flex; gap: 8px; max-width: 86%; align-items: flex-start; }
.chat-msg-me { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg-target .chat-bubble { outline: 2px solid var(--nbi-cyan); }
.chat-bubble { max-width: 100%; min-width: 0; background: var(--nbi-white); border: 1px solid var(--nbi-line-100); border-radius: 14px; border-top-left-radius: 4px; padding: 8px 12px; font-size: 13.5px; line-height: 1.5; color: var(--nbi-ink-700); overflow-wrap: anywhere; }
.chat-msg-me .chat-bubble { background: var(--nbi-blue-tint); border-color: var(--nbi-blue-border); border-top-left-radius: 14px; border-top-right-radius: 4px; }
.chat-who { font-size: 11.5px; font-weight: 700; color: var(--nbi-primary); margin-bottom: 2px; }
.chat-who span { font-weight: 500; color: var(--nbi-ink-400); margin-left: 6px; }
.chat-at { color: var(--nbi-primary); font-weight: 700; background: var(--nbi-blue-tint); border-radius: 4px; padding: 0 3px; }
.chat-reply { border-left: 3px solid var(--nbi-cyan); padding: 2px 8px; margin-bottom: 6px; font-size: 12px; color: var(--nbi-ink-500); background: var(--nbi-fill-100); border-radius: 4px; }
.chat-ts { font-size: 10.5px; color: var(--nbi-ink-400); margin-top: 3px; display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.chat-composer { border-top: 1px solid var(--nbi-line-100); padding: 10px 12px; display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.chat-composer textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 160px; border: 1px solid var(--nbi-line-200); border-radius: 12px; padding: 11px 12px; font: inherit; font-size: 13.5px; resize: vertical; }
.chat-composer .btn { min-height: 44px; }
.chat-reply-bar { width: 100%; display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--nbi-ink-500); }
.chat-reply-bar > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-card { border: 1px solid var(--nbi-blue-border); border-radius: 12px; background: var(--nbi-white); overflow: hidden; margin-top: 6px; min-width: 0; max-width: 100%; }
.chat-card-none { border-style: dashed; border-color: var(--nbi-line-300); }
.chat-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 10px; background: var(--nbi-blue-tint); border-bottom: 1px solid var(--nbi-line-100); }
.chat-card-none .chat-card-head { background: var(--nbi-fill-100); }
.chat-card-kind { font-size: 10.5px; font-weight: 800; letter-spacing: .05em; color: var(--nbi-ink-500); text-transform: uppercase; }
.chat-card-body { padding: 8px 10px; font-size: 12.5px; color: var(--nbi-ink-700); }
.chat-card-foot { padding: 4px 10px; border-top: 1px solid var(--nbi-fill-100); display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.chat-notice-list { margin: 8px 0; padding-left: 20px; font-size: 13.5px; line-height: 1.6; color: var(--nbi-ink-700); }
.chat-notice-list li { margin: 5px 0; }
.chat-room-head .back-link { display: none; }
@media (max-width: 720px) {
  .chat-room-head .back-link { display: inline-flex; }
  .chat-composer textarea { flex: 1 1 100%; }
  .chat-layout { border-radius: 10px; }
  .chat-rail { width: 100%; border-right: none; }
  .chat-layout-room .chat-rail { display: none; }
  .chat-layout-list .chat-main { display: none; }
  .chat-msg { max-width: 94%; }
}

/* TEAM CHAT BUILD 1b (21-Nov-2026; Design Brief Addendum v1.3): THE TOP-BAR ICONS AND THE CHAT PANEL. The icons are the bell's own button
   (bell-btn, bell-count, its 44px hit area on a phone); top-icon-on marks the chat icon while its panel is open. THE CHAT PANEL: at 900 px
   and wider a right-hand drawer 420 px wide below the top bar with a scrim over the page (both under the top bar, so its icons stay
   pressable); below 900 px a full-height sheet over the whole screen that keeps above the phone keyboard (--vv-h, --vv-top, app.js).
   Inside it the Build 1 screens show one pane at a time at every width. The page behind does not scroll while it is open
   (chat-panel-open on body). Sheets (.acc-modal-wrap, z 60) sit above it. Tokens only. */
.top-icon-on { background: var(--nbi-blue-tint); border-color: var(--nbi-blue-border); color: var(--nbi-primary); }
body.chat-panel-open { overflow: hidden; }
body.chat-panel-open .qn-fab { display: none; }
.chat-panel-scrim { position: fixed; inset: 56px 0 0 0; z-index: 5; background: var(--nbi-scrim); }
.chat-panel { position: fixed; top: 56px; right: 0; bottom: 0; z-index: 5; width: 420px; max-width: 100vw; display: flex; flex-direction: column;
  background: var(--nbi-white); border-left: 1px solid var(--nbi-line-200); box-shadow: var(--sh-pop); box-sizing: border-box; }
.chat-panel-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--nbi-line-100); min-height: 52px; flex-wrap: wrap; }
.chat-panel-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; color: var(--nbi-ink-900); }
.chat-panel-head .btn { min-height: 36px; }
.chat-panel-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.chat-panel-body > .chat-layout { flex: 1; min-height: 0; border: none; border-radius: 0; }
.chat-panel .chat-rail { width: 100%; border-right: none; }
.chat-panel .chat-layout-room .chat-rail { display: none; }
.chat-panel .chat-layout-list .chat-main { display: none; }
.chat-panel .chat-room-head .back-link { display: inline-flex; }
.chat-panel .chat-msgs { min-height: 0; }
.chat-panel .chat-msg { max-width: 94%; }
/* a chat sheet (the notice, a direct message, a mention, a card) opens inside the panel, not over the whole page */
.chat-panel .acc-modal-wrap { position: absolute; inset: 0; top: 0; bottom: 0; height: auto; padding: var(--sp-3); }
@media (max-width: 899px) {
  .chat-panel-scrim { display: none; }
  .chat-panel { top: var(--vv-top, 0px); height: var(--vv-h, 100dvh); bottom: auto; width: 100vw; z-index: 50; border-left: none; box-shadow: none; }
  .chat-panel-head .btn { min-height: 44px; }
  .chat-panel .chat-composer textarea { flex: 1 1 100%; }
}
