/* =========================================================
   Assort Finance Hub — design tokens
   Source of truth: 07 App Preview/DESIGN_SYSTEM.md — the MAINTAINED design doc
   (45-fixes row 4.6, 2026-09-26: this header named 04 Master Documents/
   Design_System.md, frozen since 2026-05-09). Update it FIRST, then mirror here.
   ========================================================= */

/* S434 (Ken's Y on the wave-5 mockup): fonts are SELF-HOSTED — DM Sans +
   JetBrains Mono from /vendor/fonts.css (8 variable-font woff2 on our own
   origin), replacing the Google Fonts CDN import. Same no-external-calls
   reasoning as ADR-053's CDN deletion. FH-038's display=optional decision
   (kill the FOUT/CLS shift; a late font waits for the next visit) is
   PRESERVED — fonts.css carries font-display:optional on every face. Inter
   was fallback-only behind DM Sans and never rendered; the system stack in
   --font-ui covers its slot. */
@import url('/vendor/fonts.css');

:root {
  color-scheme: light;

  /* ---------- Surfaces + lines ---------- */
  --bg:           #fafafa;
  --canvas:       #f0f0f5;
  --card:         #ffffff;
  --card-soft:    #f5f5f7;
  --surface-tint: #f0f0f5;
  --backdrop:     rgba(0, 0, 0, 0.32);

  --border:        #e5e5ea;
  --border-soft:   #f0f0f2;
  --border-strong: #d8d8de;
  --divider:       #ececf0;

  /* ---------- Foreground (text) ---------- */
  --text:     #1a1a1a;
  --text2:    #8e8e93;
  --text3:    #c7c7cc;
  --text-inv: #ffffff;

  /* ---------- Brand-mark, accent, primary action ---------- */
  --brand-mark:  #007AFF;
  --accent:      #1a1a1a;
  --accent-deep: #000000;
  --accent-soft: #f0f0f5;
  --accent-line: #d8d8de;
  --primary:     #007AFF;
  --primary-deep:#0062cc;

  /* ---------- Teal accent ramp (FH-024) ----------
     The KL-007 /vendor-review redesign renamed every interactive accent to
     --teal* but never defined the family, so selected rows, primary buttons,
     checkmarks and the bulk-confirm button silently resolved to nothing.
     This completes the ramp from the brand-teal anchor (--brand-mark #0F766E)
     the redesign already committed to — derived tint/shade, not a new design
     direction. Bespoke re-tuning, if ever wanted, belongs in the design pass. */
  --teal:        #007AFF;
  --teal-deep:   #0062cc;
  --teal-soft:   #F0F5FF;
  --teal-ink:    #0062cc;
  --teal-line:   #B7D4FF;

  /* ---------- Semantic: money + state ---------- */
  --in:       #1F8A5B;
  --in-soft:  #E4F1EA;
  --in-line:  #BAD9C7;
  --out:      #B33A3A;
  --out-soft: #F5E4E3;
  --out-line: #E2BCBA;

  --warn:         #FF9500;
  --warn-soft:    #FFF4E5;
  --warn-line:    #FFD9A6;
  --warn-deep:    #7a5a1f;   /* readable amber TEXT on --warn-soft (ADR-048 conflict card) */
  --info:         #007AFF;
  --info-soft:    #F0F5FF;
  --info-line:    #B7D4FF;
  --neutral:      #5b5b60;
  --neutral-soft: #ececf0;
  --void:         #8e8e93;
  --void-soft:    #f0f0f2;

  /* ---------- Type ---------- */
  --font-ui:   'DM Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --eyebrow-size: 11px;  --eyebrow-track: 1.2px; --eyebrow-weight: 700;
  --label-size:   12px;  --label-weight: 600;
  --body-sm:      13px;
  --body:         14px;
  --body-lg:      15px;
  --h3:           16px;  --h3-weight: 600;
  --h2:           18px;  --h2-weight: 700;
  --h1:           24px;  --h1-weight: 700;
  --metric-sm:    20px;
  --metric:       28px;
  --metric-lg:    36px;

  /* ---------- Spacing ---------- */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 48px; --s9: 64px;

  /* ---------- Radius ---------- */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 14px;
  --r-2xl: 18px;
  --r-pill: 999px;

  /* ---------- Shadow ---------- */
  --shadow-xs: 0 1px 0 rgba(0,0,0,0.03);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.10);
  --shadow-pop: 0 8px 24px rgba(0,0,0,0.12);

  /* ---------- Density (Tweaks-driven; default Medium) ---------- */
  --row-pad-y: 10px;
  --card-pad: 20px;
  /* THE CARD SIDE INSET (45-fixes row 4.5, 2026-09-26) — Ken: "you always forget the
     padding" / "this right sides not padded either". Every card's title AND its content
     sit this far in from BOTH side edges, on a computer and on a phone. 18px is the inset
     the group and company-home cards already used; the library's rows (16px, 12px on a
     phone) and panel head (16px) moved onto it. Checked by
     __tests__/card-side-inset.test.js — a card rule with any other side padding fails. */
  --card-inset: 18px;
}

[data-density="roomy"] {
  --row-pad-y: 14px;
  --card-pad: 24px;
}

/* =========================================================
   FORM CONTROLS — HOUSE STYLE (the wall, S575 2026-09-04)

   Ken's order, 2026-09-04 17:07 (relayed to every repo by inventory-hub s272):
   "you always leave the UI file boxes old and like excel sheets. i have told you
   to polish these so many times… make this a rule or temlate so you do no forget
   to do this for every app." His tellings were counted: 15 in five weeks across
   seven apps, five of them repeats, four of them about a form box.

   WHY THE RULE LIVES HERE AND NOT IN A NOTE. Measured at S574's wrap: none of
   this app's 46 stylesheets carried an element-level rule for input/select/
   textarea (only upload.css l.52), while 19 page scripts write controls — so a
   plain <input> got the browser's own chrome every time a builder forgot a class.
   A rule kept in CLAUDE.md or a memory file is not forgotten by ONE session; it
   is forgotten by EVERY session. tokens.css is the single stylesheet every served
   page loads (directly, or through views/partials/shell-top.html), so the house
   look becomes what a bare tag GETS, and the wrong look becomes red:
     · __tests__/form-controls-house-style.test.js   — the block is present + complete
     · scripts/render-smoke-controls.js              — a rendered control in the browser font FAILS

   SPECIFICITY IS THE WHOLE TRICK: :where() keeps these at (0,0,1), so all 94
   existing control rules in the other stylesheets still win untouched. This is a
   floor for the undressed, never a repaint of the dressed.

   NO min-height / line-height ON PURPOSE (the CRM measured it the same day: a base
   min-height grew their header pill 26 → 38px). Several controls here live bare
   inside a chip — .cat-search input, .iv-search input, .filter-search input — and
   inherit their height from the chip. Padding is the floor; height stays theirs.
   ========================================================= */

input:where(:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]):not([type=submit]):not([type=button]):not([type=color]):not([type=image]):not([type=reset])),
select,
textarea {
  font-family: var(--font-ui);
  font-size: var(--body);
  font-weight: 500;
  color: var(--text);
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 10px;
  box-sizing: border-box;
  max-width: 100%;
}

select {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

textarea {
  line-height: 1.45;
  resize: vertical;
}

input:where(:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]):not([type=submit]):not([type=button]):not([type=color]):not([type=image]):not([type=reset])):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--info-soft);
}

input:where(:not([type=checkbox]):not([type=radio])):disabled,
select:disabled,
textarea:disabled,
input:where(:not([type=checkbox]):not([type=radio]))[readonly],
textarea[readonly] {
  /* background-COLOR, not the shorthand — the shorthand erases the chevron painted above,
     which is exactly how a disabled select ended up with no arrow on /triage the hour this
     rule landed. The wall caught its own author (scripts/render-smoke-controls.js). */
  background-color: var(--bg);
  color: var(--text2);
  cursor: default;
}

input::placeholder,
textarea::placeholder {
  color: var(--text3);
  font-weight: 400;
}

/* The field wrapper the house uses when a control needs a label above it. Named
   classes, so a page opts in — never imposed on an existing layout. */
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld-l { font-size: var(--label-size); font-weight: var(--label-weight); color: var(--text2); }
.fld-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }

/* ══════════════════════════════════════════════════════════════════════════════
   THE FLEET SHELL VOCABULARY (S588, 2026-09-06 — Ken's 11:1x order, the standard
   at `13 Design System/09 Fleet Shell/2026-09-06_fleet-shell_v1/`).

   The standard's §4 says tokens.css = V10's file. This repo's file is a 218-line
   FORK that was missing eleven of the names the shared shell CSS uses — which is
   why a ported header/tab-bar would have painted with no colour and the browser's
   own font. These are V10's values, verbatim, added rather than swapped.

   WHY ADDED AND NOT SWAPPED, stated so nobody re-derives it: 72 FH tokens vs 105
   V10 tokens; 15 names exist in both and SIX carry different values —
   `--card` (#ffffff here, #f5f5f7 in V10), the four shadows, and `--teal`.
   Adopting V10's file wholesale therefore repaints every card in this app, which
   is a look change on Ken's taste, not a port. So: the missing names land now
   (nothing on screen changes), and the six collisions are named for the sitting
   where he sees them. Courier to assort-cs-app carries the same paragraph.
   ══════════════════════════════════════════════════════════════════════════════ */
:root {
  --white: #ffffff;
  --font-sans: 'DM Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'DM Sans', 'Inter', -apple-system, sans-serif;
  --indigo: #5856D6;
  --indigo-tint: #EEEDFB;
  --red: #FF3B30;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  --text-mid: #636366;

  /* This app's own accent, from the locked icon family (public/favicon.svg —
     the three rising bars). The standard's ⚑ call: the phone tab bar's active
     colour is the app's brand colour, the same one as its tile. */
  --fh-brand: #34C759;
  --fh-brand-tint: #E8F8ED;

  /* The bar's two numbers. Everything that must clear the bar uses --tabbar-clear —
     never a literal. The home-indicator inset ADDS; it never subtracts.
     ⊕ 84px → 82px 2026-09-07: Ken's own 11:31 spec drop and CRM's `--nav-h`
     (tokens.css:178) both say 82, read at source. ⚠ AND THE INSET STAYS, which is
     the whole judgement here: CRM's comment calls its 82 "incl. safe area" but CRM
     computes NO inset anywhere — `safe-area-inset` is 0 across both its stylesheets
     while `bottom-nav` is 2 in the same file, so that zero is measured, not a blind
     grep. So 82 is CRM's flat number with the home indicator sitting ON its tabs.
     We take the number and keep the calc: on a device with no inset we are 82 and
     identical to CRM; on Ken's iPhone we reserve the indicator instead of hiding
     tabs under it. MATCHING A GEOMETRY IS NOT THE SAME AS IMPORTING AN OMISSION
     (root's ruling, on this repo's measurement). */
  --tabbar-h: 82px;
  --tabbar-clear: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
}
