/* =============================================================================
   ADEPT LIFE SCIENCES ERP - Single entry point
   Layers cascade: tokens -> primitives -> domain components
   Every page links only this one file.

   Cache busting: the ?v= markers below are a DEPLOY LABEL, not the freshness
   mechanism. Freshness comes from `Cache-Control: no-cache` on /styles,
   /components and /data (vercel.json "headers"), which makes the browser
   revalidate against the ETag on every load and pick up a changed file
   immediately.

   This changed on 2026-07-18 because the old contract ("the ?v= here matches
   every asset reference in *.html; bump both together") had already broken:
   app.css was referenced at THREE different versions across the pages
   (20260716b on 99 of them, 20260717a, 20260717b) while the @imports below
   stayed at 20260716b. So an edit to primitives.css or domain.css reached
   nobody, no matter which page you loaded — a shared file changed while the
   cache key that governs it did not. That is the half-applied-fix class
   (docs/LAYER-AGREEMENT.md) wearing a cache costume, and hand-syncing a
   constant across 100+ files was never going to hold.
   ============================================================================= */
@import url('./tokens.css?v=20260716b');
@import url('./primitives.css?v=20260716b');
@import url('./domain.css?v=20260824b');
@import url('./responsive.css?v=20260716b');
@import url('./review.css?v=20260716b');
@import url('./quick-create.css?v=20260726a');
@import url('./bug-flags.css?v=20260726a');

/* =============================================================================
   TAN THEME OVERRIDE - 2026-07-16 (Eric: colors only)
   "Warm Drafting Table" palette ported from agent/refero-full-site-redesign
   styles/tokens.css. This :root block loads AFTER the imports above, so it is
   the single source of truth that recolors the whole site. COLOR VALUES ONLY:
   no layout, spacing, typography, radii, or shadow-geometry changes. Variable
   names stay as the live site uses them. To revert to the previous slate
   theme, delete this block.
   ============================================================================= */
:root {

  /* Surfaces - warm ivory vellum */
  --bg:              #FBF8F2;
  --bg-warm:         #F4EFE4;
  --surface:         #FFFFFF;
  --surface-alt:     #F6F1E7;
  --surface-sunken:  #EEE8DA;

  /* Ink - warm near-black */
  --ink:             #211C16;
  --ink-2:           #322B22;
  --muted:           #6E6457;
  --faint:           #8C8273;
  --disabled:        #B3A998;

  /* Hairlines - warm */
  --hairline:        #ECE4D5;
  --hairline-strong: #DCD2BF;
  --hairline-focus:  #B9AD96;

  /* Brand - Adept deep teal accent on warm paper */
  --blue:            #0F6B6E;
  --blue-hover:      #0A5154;
  --blue-soft:       #E3EDE9;

  --terra:           #B5722A;
  --terra-soft:      #F4E6CE;

  /* Derived (not a literal refero value): refero's --teal #30AEAF is
     logo-ambient only and fails white-on-teal contrast; the live site uses
     --teal as a solid accent bg with white text, so it takes the refero
     accent teal instead. --teal-deep keeps refero's readable deep teal. */
  --teal:            #0F6B6E;
  --teal-deep:       #125D6A;

  /* Status - muted earthy sage / ochre / clay per refero */
  --ok:              #4F7A5E;
  --ok-soft:         #E9F0EA;
  --warn:            #9C6B2E;
  --warn-soft:       #F2E7D5;
  --danger:          #A45142;
  --danger-soft:     #F1E5DF;
  --danger-bg:       #FBF6F3;
  --info:            #3C6E81;
  --info-soft:       #E7EDEE;
  --neutral:         #6E6457;
  --neutral-soft:    #F0EADD;

  /* Shadows - refero's warm shadow COLOR rgb(60,44,20) on the site's
     existing shadow geometry and alphas (geometry is not a color change) */
  --shadow-card:     0 1px 2px rgba(60,44,20,0.04);
  --shadow-card-hover: 0 2px 8px rgba(60,44,20,0.06);
  --shadow-elevated: 0 8px 24px rgba(60,44,20,0.08);
  --shadow-popover:  0 12px 32px rgba(60,44,20,0.12);
  /* --shadow-focus, --btn-primary* alias var(--blue*) and update automatically */

  /* Added 2026-07-16: refero-only color token the current file lacked */
  --grid-line:       rgba(120, 96, 56, 0.025);

  /* OP Tracker (Adept's live "Material Tracking" sheet).
     Two dept-band hues the base status palette lacks (Warehouse purple, QC teal),
     kept distinct from --teal which the theme remapped onto --blue. */
  --purple:              #7C3AED;
  --purple-soft:         #F1EAFE;
  --qc:                  #0F766E;
  --qc-soft:             #E6F6F4;
  /* Status pill fills, EXACT colors from the sheet's conditional formatting.
     Single source of truth for these; do not alter the hex, do not duplicate. */
  --ot-complete:         #C5DEB5;
  --ot-pending-release:  #FFEB9C;
  --ot-pending-purchase: #8EAADB;
  --ot-pending-receipt:  #FFC7CE;
  --ot-status-ink:       #1F2328;
  /* NS Status — Adept's derived split of "Pending Purchase". Sourcing = warm amber
     (no real supplier yet), Send PO = a Complete-family green, distinct from
     Complete (#C5DEB5), that flags a supplier is chosen but no PO is cut yet. */
  --ot-sourcing:         #F5C97B;
  --ot-send-po:          #A9CD90;
  /* Send Payment sits after the goods are in: a cool slate, kept clear of the
     amber (still sourcing) and the green (ready to buy). */
  --ot-send-payment:     #B7C4D6;

}

/* Compact field-lineage index for operational pages. This is structured page
   data, not explanatory copy: the rows state owners, calculations and mismatched
   source paths so the reader can spot a wrong feed before acting on the page. */
.lineage {
  margin: 0 0 var(--space-4);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-card-sm);
  background: var(--surface-alt);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.lineage-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: var(--weight-strong);
  cursor: pointer;
  list-style: none;
}
.lineage-title::-webkit-details-marker { display: none; }
.lineage-title::after { content: '+'; color: var(--muted); font-family: var(--font-mono); }
.lineage[open] .lineage-title { border-bottom: 1px solid var(--hairline); }
.lineage[open] .lineage-title::after { content: '−'; }
.lineage dl { margin: 0; }
.lineage-row {
  display: grid;
  grid-template-columns: minmax(78px, 0.16fr) minmax(0, 1fr);
  gap: var(--space-2);
  padding: 7px var(--space-3);
  border-bottom: 1px solid var(--hairline);
  font-size: var(--text-xs);
  line-height: 1.4;
}
.lineage-row:last-child { border-bottom: 0; }
.lineage-row dt {
  color: var(--faint);
  font-weight: var(--weight-strong);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}
.lineage-row dd {
  display: flex;
  flex-wrap: wrap;
  gap: 4px var(--space-3);
  min-width: 0;
  margin: 0;
  color: var(--ink-2);
}
.lineage-row dd span { overflow-wrap: anywhere; }
.lineage-row dd span + span::before {
  content: '•';
  margin-right: var(--space-3);
  color: var(--hairline-focus);
}
.lineage-row[data-tone="warn"] {
  background: var(--warn-soft);
}
.lineage-row[data-tone="warn"] dt { color: var(--warn); }

@media (max-width: 640px) {
  .lineage-row { grid-template-columns: 1fr; gap: 3px; }
  .lineage-row dd { display: grid; gap: 3px; }
  .lineage-row dd span + span::before { content: none; }
}
