/* =========================================================
   SELF-HOSTED TYPE (milestone 41). Inter and IBM Plex Mono ship with
   the app from fonts/ — no font CDN, so a shop with patchy internet
   and a test runner on any machine draw the same glyphs at the same
   widths, and balanceko.html (build.py embeds these files as data
   URLs) opens with no network at all. Latin + Latin-extended subsets
   only; the Arabic-script paper uses system faces (see .slip[dir="rtl"]).
   font-display: block — a flash of fallback text on a money screen is
   worse than a moment's wait. Inter is one variable file per subset
   (weights 400–700 in it); Plex Mono is one static file per weight.
   Vazirmatn (m43) carries the Arabic script for the Dari and Pashto UI —
   one variable file, the Arabic subset only, so Latin letters, digits and
   codes still fall through to Inter and Plex Mono.
   Licences: fonts/LICENSE-Inter.txt, fonts/LICENSE-IBM-Plex.txt,
   fonts/LICENSE-Vazirmatn.txt (all OFL 1.1).
   ========================================================= */
@font-face{font-family:'Inter';font-style:normal;font-weight:400 700;font-display:block;
  src:url(/fonts/inter-latin.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:'Vazirmatn';font-style:normal;font-weight:100 900;font-display:block;
  src:url(/fonts/vazirmatn-arabic.woff2) format('woff2');
  unicode-range:U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1}
@font-face{font-family:'IBM Plex Mono';font-style:normal;font-weight:400;font-display:block;
  src:url(/fonts/ibm-plex-mono-400-latin.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:'IBM Plex Mono';font-style:normal;font-weight:500;font-display:block;
  src:url(/fonts/ibm-plex-mono-500-latin.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:'IBM Plex Mono';font-style:normal;font-weight:600;font-display:block;
  src:url(/fonts/ibm-plex-mono-600-latin.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}

/* =========================================================
   Balanceko design tokens — both themes, per DESIGN.md.
   Porcelain (light) lives on :root; Midnight (dark) overrides on
   :root[data-theme="dark"]. The theme switcher writes the attribute
   and localStorage (sarafi.theme = light | dark | auto).

   Rules these tokens encode (DESIGN.md, all were real bugs):
   - stage vs paper: --nav/--dk are the stage, they flip with the theme;
     the toast and tooltip are ALWAYS dark and never share a stage token.
   - stage vs selected control: --solid/--on-solid is a selected control
     (yellow + dark letters on dark), never the stage colour.
   - shadow vs overlay: --sh is always cast by the dark; --ov is the
     hover tint and is the OPPOSITE of its surface, so it flips.
   - data colours (currency colours, shop accents) are the user's data and
     are NOT tokens; category and chart colours are the theme's and are.
   ========================================================= */
:root{
  /* the ground a shop's logo is drawn on (round 23): white, as the paper it prints on */
  --logo-ground:#FFFFFF; --logo-edge:#E9E8E2;
  /* tell the browser which scheme its OWN widgets should follow — the
     date-picker indicator, select arrows, scrollbars, autofill. Without
     this every native control stays light-scheme black in Midnight. */
  color-scheme:light;
  /* MOTION (item 4). One scale, theme-independent, all under 200ms; the
     highlight that says an entry landed is the one deliberate slow one.
     A single reduced-motion rule (main.css) zeroes every duration. */
  --dur-1:120ms;   /* press, hover, popover scale */
  --dur-2:160ms;   /* page change, drawer, modal, menu */
  --dur-3:200ms;   /* sheet rise, larger moves */
  --dur-count:300ms; /* KPI count-up on first paint */
  --dur-land:1200ms; /* the soft highlight on a freshly saved row */
  --ease-out:cubic-bezier(.2,.8,.3,1);
  --ease-in-out:cubic-bezier(.4,0,.2,1);
  /* Porcelain = a clean, modern, Wise/Mercury-grade light UI (2026-11-13,
     revised). A crisp near-white canvas with the faintest COOL cast
     (#F7F8FA) — never cream, never beige. The depth is read from SOFT,
     slightly cool, LAYERED SHADOWS and spacing, not from a tinted canvas:
     TRUE-WHITE cards float off the near-white page on --e-1, and the grey
     hairlines stay minimal. Confident near-black text (#181A20) over a
     neutral-grey secondary (#474D57) and muted tertiary (#667180) — crisp
     hierarchy. The Binance yellow #FCD535 stays the accent (it pops on the
     clean white), with deep ink (#181A20) for letters ON it; green #0A7C4E /
     red #C6293F carry money, tuned for AA on the near-white. Every value here
     is overridden in the Midnight block below, so this leaves the dark theme
     untouched. */
  --ink:#181A20;
  --paper:#F7F8FA;
  --panel:#FFFFFF;
  --line:#E7E9ED;
  --line-2:#F0F1F4;
  --text:#181A20;
  --muted:#474D57;
  --faint:#616873;        /* neutral tertiary; clears AA (4.5) on the white card and the near-white surfaces */
  --brass:#FCD535;
  --brass-2:#E8C130;
  --pos:#0A7C4E;          /* figures: a step darker than Binance green so they clear AA on the near-white and its tints */
  --neg:#C6293F;          /* figures: a step darker than Binance red so they clear AA on the near-white and its tints */
  --on-neg:#FFFFFF;       /* the letters on a solid --neg fill (.btn-danger); back-ported from the phone, PARITY D10 */
  --pos-ic:#0ECB81;       /* icons and badges: the bright Binance green/red */
  --neg-ic:#F6465D;
  --pos-bg:#E4F7EF;
  --neg-bg:#FDECEE;
  /* money moving, and the kinds of account a shop deals with */
  --in:#0A7C4E; --out:#C6293F;
  --cat-cust:#2563EB; --cat-biz:#7C3AED; --cat-net:#0F766E; --cat-supp:#B45309;
  /* the dark stage: the rail, the login wall and the tooltip */
  --dk:#0B0E11; --dk-2:#181A20; --dk-line:#E4E8F0;
  --dk-text:#0E1220; --dk-nav:#4A5266; --dk-mut:#565E72; --dk-faint:#67707F;
  /* the raised surfaces — a cool near-white ladder under the white cards */
  --tint:#F0F2F5; --tint-2:#F5F6F8; --edge:#D5D8DE;
  /* a panel edge may whisper; the edge of something you type into may not.
     --field is the grey that still reads >=3.0 as a boundary. */
  --field:#7A808A;
  /* the small surfaces the app leans on, named so a whole palette can move */
  --wash:#ECEEF2;        /* a resting tile behind an icon */
  --pos-line:#B7E7D2; --neg-line:#F6CDD3; --neg-tint:#FEF3F4;
  --brass-line:#FBE6A0; --brass-tint:#FEFAE3; --brass-wash:#FCF3C6;
  --on-brass:#181A20;    /* the only text that sits on solid brass */
  /* brass is a good colour for a mark and a poor one for a word, so words
     that must be brass use the darker one */
  --brass-t:#806500;     /* words in brass: deep gold; AA (4.5) on the card, the near-white and every tint (21 Nov 2026: was #8A6D00, 4.24 on the wash) */
  /* ---- the type scale (m25). Eight sizes, no one-offs: every font-size
     in the app resolves to one of these. Tracking tightens as size grows;
     caps labels share one tracking so they read as one voice. ---- */
  --t-2xs:11px;      /* micro: caps labels, table headers, chips */
  --t-xs:12.5px;     /* secondary: sec lines, hints, small buttons */
  --t-s:14px;        /* body and tables */
  --t-m:16px;        /* emphasised body, modal titles */
  --t-l:20px;        /* section figures, drawer items */
  --t-xl:26px;       /* KPI dominant numbers */
  --t-2xl:34px;      /* hero figures */
  --t-3xl:42px;      /* the one board headline */
  --track-1:-.035em; /* 34px and up */
  --track-2:-.03em;  /* 26px */
  --track-3:-.02em;  /* 16–20px headings */
  --track-caps:.12em;/* every uppercase micro label */

  /* the border an INTERACTIVE control wears (m29 ph4): field-grade, so
     every button, chip and picker stands >=3.0 off any app surface in
     both themes. Panels, tables and separators keep their hairlines. */
  --ctl-line:#7B818B;

  /* the surface ladder (m25): page < panel < raised(tint) < float.
     Porcelain floats stay white and cast a shadow; Midnight floats step
     UP the ladder and wear an edge instead (DESIGN rule: no dark shadows). */
  --float:#FFFFFF;
  --float-line:#E3E6EA;
  /* SCROLLBARS (job 3): the thumb as an rgb triplet so it can rest at 30%
     and wake to full; it reads >=3.0 against the panel, the float and the
     rail in both themes. The lane is the bar's own width — content stops
     12px before it (main.css). */
  --sb:138,143,151;        /* #8A8F97 — 3.1 on the paper, 3.25 on white */
  --sb-hover:111,116,124;  /* #6F747C — darker under the pointer */
  --sb-idle:.3;            /* the resting alpha; 1 while scrolling or hovered */
  --sb-lane:0px;
  /* the one hover/active tint ladder: every state tint is one of these */
  --ov-1:.06;        /* hover */
  --ov-2:.1;         /* active / selected wash */
  --ov-3:.15;        /* pressed / strong */

  /* one elevation system (m25): flat panels wear only their hairline;
     raised rests on --e-1; floating (popover, modal, menus) on --e-2.
     Midnight keeps shadows almost invisible by nature and reads depth
     from --float + --float-line edges instead (DESIGN rule). */
  --e-1:0 1px 2px rgba(var(--sh),.04),0 6px 16px rgba(var(--sh),.08);          /* soft, slightly cool, layered: a white card floats off the near-white canvas — depth from shadow, not a border */
  --e-2:0 6px 16px rgba(var(--sh),.07),0 28px 60px rgba(var(--sh),.18);        /* floating: popover, modal, menu */
  --e-raised:0 8px 18px rgba(var(--sh),.11),0 16px 34px rgba(var(--sh),.14);   /* item 2: a raised round control (the phone FAB) — one neutral elevation, never a coloured/yellow halo */
  --scrim:rgba(11,15,20,.44);

  --r:12px;
  /* THE OVERLAY RADII (2026-10-13) — one token per family, on all four
     corners of the whole container, nothing one-off:
     a modal / dialog / confirm / the security sheet / the lock card;
     a sheet that stands at an edge (the transfer drawer, a phone's sheet);
     a popover / dropdown / menu / panel */
  --r-modal:16px;
  --r-sheet:18px;
  --r-pop:12px;
  --ctl:48px;        /* every form control is exactly this tall */
  --ctl-in:36px;     /* and the parts nested inside a money field, this */

  --on-solid:#FFFFFF;
  --on-stage:#FFFFFF;
  --toast-hover:rgba(255,255,255,.12);   /* the ✕ on the always-dark toast; a stage constant, same in both themes */
  --solid:#101321;
  --neg-deep:#9F1239;
  --cat-cust-bg:#EAF0FE;
  --ser-1:#0F766E;
  --ser-6:#0E7490;
  --ser-7:#A16207;
  --ser-8:#9D174D;
  --ser-9:#4D7C0F;
  --ov:11,15,20;
  --hi:255,255,255;
  --sh:11,15,20;

  --nav:#FFFFFF;
  --nav-2:#F3F4F7;
  --on-nav:#181A20;
  --nav-line:#E7E9ED;

  /* the kind dots: one colour per thing that crosses the book, worn as a
     dot on the shared transaction tag (item 2). Decorative — the tag's
     own label stays neutral, so the colour never has to carry contrast. */
  --k-deposit:#14B8A6;
  --k-withdraw:#F43F5E;
  --k-exchange:#6366F1;
  --k-hawala:#D9A400;
  --k-transfer:#8B5CF6;
  --k-expense:#EA580C;
  --k-bank:#0EA5E9;
  --k-profit:#0D9488;
  --k-commission:#65A30D;
  --k-partner:#0891B2;
  --k-other:#94A3B8;
  /* the kind ICON (the Type cell's glyph): the same hue, deep enough to
     clear 3:1 on the chip's wash, the tints and the brass tint (2026-10-13) */
  --ki-deposit:#0F766E; --ki-withdraw:#BE123C; --ki-exchange:#4F46E5; --ki-hawala:#A16207;
  --ki-transfer:#7C3AED; --ki-expense:#C2410C; --ki-bank:#0369A1; --ki-profit:#047857;
  --ki-commission:#4D7C0F; --ki-partner:#0E7490; --ki-other:#5B6576;}
:root[data-theme="dark"]{
  color-scheme:dark;
  /* a logo sits on white in both themes: most are drawn for white paper */
  --logo-ground:#FFFFFF; --logo-edge:#2B3139;
  /* Midnight = Binance's near-black ladder: page #0B0E11, panel #181A20,
     raised #1E2329, borders #2B3139; text #EAECEF / #B7BDC6 / #848E9C;
     yellow #FCD535 for the primary action and active states; green
     #0ECB81 / red #F6465D for money in and out. */
  --ink:#05070A;
  --paper:#0B0E11;
  --panel:#181A20;
  --on-solid:#1E2329;
  --on-stage:#EAECEF;
  --solid:#FCD535;
  --line:#2B3139;
  --line-2:#22272E;
  --text:#EAECEF;
  --muted:#B7BDC6;
  --faint:#8A94A2;        /* AA (4.5) on the raised wash too (21 Nov 2026: was #848E9C, 4.36 there) */
  --edge:#2B3139;
  --field:#667079;
  --tint:#1E2329;
  --tint-2:#1A1E24;
  --wash:#242A31;
  --brass:#FCD535;
  --brass-2:#FCD535;
  --brass-t:#FCD535;
  --on-brass:#1E2329;
  --brass-line:#4A3B08;
  --brass-tint:#241C05;
  --brass-wash:#2E2507;
  --pos:#0ECB81;
  --neg:#FF5C6E;          /* money figures: a hair brighter than Binance red #F6465D so they clear AA on the raised surface */
  --on-neg:#1E2329;       /* --neg brightens on the dark stage, so its letters go dark (PARITY D10) */
  --pos-ic:#0ECB81;
  --neg-ic:#F6465D;       /* fills, icons and badges keep the exact Binance red */
  --neg-deep:#FF8598;
  --pos-bg:#0B2A20;
  --neg-bg:#2A1418;
  --pos-line:#17453A;
  --neg-line:#4A1D25;
  --neg-tint:#241216;
  --in:#0ECB81;
  --out:#FF5C6E;
  --cat-cust:#6E9BFF;
  --cat-biz:#A98CFF;
  --cat-net:#0ECB81;
  --cat-supp:#FCD535;
  --cat-cust-bg:#16203A;
  --dk:#0B0E11;
  --dk-2:#181A20;
  --dk-line:rgba(255,255,255,.09);
  --dk-text:#EAECEF;
  --dk-nav:#B7BDC6;
  --dk-mut:#848E9C;
  --dk-faint:#6B747E;
  --ser-1:#2FB98A;
  --ser-6:#4FC3D9;
  --ser-7:#D0AC55;
  --ser-8:#E08CB8;
  --ser-9:#7FC463;
  --ov:255,255,255;
  --hi:255,255,255;
  --sh:0,0,0;
  --nav:#0B0E11;
  --nav-2:#181A20;
  --on-nav:#EAECEF;
  --nav-line:#2B3139;
  --float:#1E2329;
  --sb:112,122,138;        /* #707A8A — 4.0 on the panel, 3.9 on the float */
  --sb-hover:132,142,156;  /* #848E9C — lighter under the pointer */
  --float-line:#2B3139;
  --ctl-line:#6B7580;
  --e-1:0 1px 2px rgba(0,0,0,.2);
  --e-2:0 24px 60px rgba(0,0,0,.5);
  --e-raised:0 10px 26px rgba(0,0,0,.5);
  --scrim:rgba(0,0,0,.56);

  /* the kind dots, brightened for the dark stage (item 2) */
  --k-deposit:#2DD4BF;
  --k-withdraw:#FB7185;
  --k-exchange:#818CF8;
  --k-hawala:#F0C33A;
  --k-transfer:#A78BFA;
  --k-expense:#FB923C;
  --k-bank:#38BDF8;
  --k-profit:#5EEAD4;
  --k-commission:#A3E635;
  --k-partner:#22D3EE;
  --k-other:#94A3B8;
  --ki-deposit:#2DD4BF; --ki-withdraw:#FB7185; --ki-exchange:#A5B4FC; --ki-hawala:#F0C33A;
  --ki-transfer:#C4B5FD; --ki-expense:#FB923C; --ki-bank:#38BDF8; --ki-profit:#5EEAD4;
  --ki-commission:#A3E635; --ki-partner:#22D3EE; --ki-other:#A3AEC0;
}

/* The transfer check and the phone page are fixed dark stages in BOTH
   themes too: the stage tokens (the language switcher reads them) are the
   Midnight ones there, whatever the theme. */
#check,#gate{
  --dk:#0B0E11; --dk-2:#181A20; --dk-line:rgba(255,255,255,.09);
  --dk-text:#EAECEF; --dk-nav:#B7BDC6; --dk-mut:#848E9C; --dk-faint:#767E8C;
  --ov:255,255,255; --brass:#FCD535; --on-brass:#1E2329;
}
/* The sign-in screen is a fixed dark stage with a light card in BOTH
   themes, so it remaps the palette locally and ignores the switch. */
#login{
  color-scheme:light;   /* the card is light in BOTH themes, on Binance's near-black stage */
  --nav:#0B0E11; --on-nav:#EAECEF; --nav-line:rgba(255,255,255,.08);
  --paper:#0B0E11; --panel:#FFFFFF; --text:#1E2329; --muted:#474D57; --faint:#667180;   /* Binance's tertiary #707A8A is 4.34 on the white card; the root's AA value (PARITY D10, from the phone) */
  --on-neg:#FFFFFF;     /* the card's --neg is the light red in both themes */
  --line:#E9E8E2; --line-2:#F1F0EB; --edge:#D4D3CC; --field:#7C838B;
  --tint:#F5F4EF; --tint-2:#F7F6F2; --wash:#EFEEE9; --ctl-line:#7C828A;
  --brass:#FCD535; --brass-2:#E8C130; --brass-t:#8A6D00; --on-brass:#1E2329;
  --brass-line:#FBE6A0; --brass-tint:#FEFAE3;
  --pos:#0A7C4E; --neg:#C6293F; --pos-ic:#0ECB81; --neg-ic:#F6465D;
  --solid:#101321; --on-solid:#FFFFFF; --on-stage:#FFFFFF;
  --dk:#0B0E11; --dk-2:#181A20; --dk-line:rgba(255,255,255,.09);
  --dk-text:#EAECEF; --dk-nav:#B7BDC6; --dk-mut:#848E9C; --dk-faint:#767E8C;
  --ov:255,255,255; --hi:255,255,255; --sh:0,0,0;
  --sb:112,122,138; --sb-hover:132,142,156;   /* the stage scrolls dark in both themes */
}
