/* Bordaar — shared design tokens for every page ("Ink").
 *
 * Black and white with a pinch of red-orange, hairline borders and no hard shadows. Loaded before
 * app.css / auth.css / landing.css and before each page's own <style>, so every `var(--x)`
 * reference in those files picks up these values.
 *
 * Theme switch: set `data-theme="light"` or `data-theme="dark"` on <html>. LIGHT IS THE DEFAULT (no
 * attribute needed). Pages read/write the `bordaar-theme` localStorage key (see index.html for the
 * reference implementation: an early inline script plus a toggle button). There is one look and
 * two modes; the cream-navy-gold "Paper" look and its palette switcher were removed on 2026-10-05.
 *
 * Right-to-left: components use logical properties. The old hard shadows needed `--dir` (1 or -1)
 * because box-shadow offsets have no logical form; it is still defined, and the flip is
 * `:root[dir="rtl"]`, the same specificity as the theme blocks below and later in the file, so it
 * wins (`html[dir="rtl"]` would NOT).
 *
 * To rebrand: change the colours in the two blocks below, then run tools/logo/build_logo.py.
 */
/* Vazirmatn is served from this site, not only from Google Fonts: Google is often
 * unreachable from Iran, and without this Persian text falls back to a system font.
 * One variable file covers every weight. (SIL OFL licence: fonts/OFL.txt.) */
@font-face{
  font-family:"Vazirmatn";
  src:url("/fonts/Vazirmatn-variable.woff2") format("woff2");
  font-weight:100 900;
  font-style:normal;
  font-display:swap;
}

/* ═══ The look: "Ink" — black, white and a pinch of red-orange ═════════════════════
 * Neutral surfaces, hairline panel borders, NO hard shadows, and the orange kept to a few small
 * things: progress fills, the dot beside the current page, chart ends, focus rings, the
 * underline under a headline word. Everything that is a "chip" or a "tag" is a neutral grey; the
 * orange is --spark, NOT --accent. There is ONE orange (#EA4A1F) in light and dark.
 *
 * ORANGE TEXT must be the dark orange (#B72A05 on white, 6.3:1) and TEXT ON an orange fill must
 * be black: white on #EA4A1F is only 3.8:1. In practice the orange is used as a fill or shape
 * only, never as small text.
 *
 * Some names come from the older "Paper" look (cream, navy and gold, hard shadows) and are kept
 * so every page still resolves them: --gold is the orange, --navy the near-black, --cream the
 * off-white, --hard / --hard-lg are none / a soft shadow. Do not add a gold chip with navy text
 * by writing --gold / --navy: write background:var(--accent);color:var(--on-accent).
 *
 * --mark-tile / --mark-b are read by tools/logo/build_logo.py, which draws the logo from them;
 * no stylesheet uses them.
 */
:root,
:root[data-theme="light"]{
  /* type */
  --font:"Figtree",system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --font-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;
  --font-fa:"Vazirmatn","IRANSansX","IRANSans","Estedad",Tahoma,"Segoe UI",sans-serif;

  --brand-1:#3A3A3A; --brand-2:#EA4A1F;
  --navy:#111111; --cream:#F7F7F6; --gold:#EA4A1F;

  /* surfaces + text */
  --bg:#F7F7F6; --band2:#EFEFED; --card:#FFFFFF; --card-alt:#F7F7F6;
  --ink:#111111; --ink-2:#3A3A3A; --muted:#666666;
  --line:#E2E2E0; --line-soft:#EDEDEB;
  --outline:#8F8F8B;      /* controls: ghost buttons, inputs, the language pill (3.3:1 on white) */
  --shadow-c:#111111;

  /* highlighted word, small label, dark tag chips */
  --hl:#E9E9E6; --hl-fg:#111111;
  --kicker:#3A3A3A;
  --tag-bg:#111111; --tag-fg:#F7F7F6;

  /* near-black surfaces that stay dark in BOTH themes (toasts, payment card face) */
  --midnight:#111111; --midnight-2:#1C1C1C;
  --fixed-dark:#111111; --fixed-dark-2:#242424;

  --grad:linear-gradient(135deg,var(--brand-1) 0%,var(--brand-2) 100%);
  --brand-grad-fixed:linear-gradient(135deg,var(--brand-1) 0%,var(--brand-2) 100%);

  /* "accent" is a neutral chip; the orange is --spark */
  --accent:#E9E9E6; --accent-ink:#111111; --on-accent:#111111;
  --accent-soft:var(--line-soft); --accent-soft-border:var(--line);
  --accent-glow:color-mix(in srgb,#EA4A1F 32%,transparent);
  --spark:#EA4A1F;           /* the small accent: progress fills, the nav dot, chart ends, focus glow */

  /* the "brand chip": primary button, active lang pill, avatar */
  --brand-fill:#111111; --brand-fill-fg:#FFFFFF; --brand-fill-glow:transparent;

  /* icon chip (.ico) */
  --ico-bg:#ECECEA; --ico-fg:#111111;

  --stripe:var(--outline);    /* the bar down the side of an open question or pending request */
  --panel-bd:var(--line);     /* border of panels, cards, topbar, sidebar: a hairline */
  --mark-ring:#D2D2CE;        /* ring around the logo tile */
  --nav-active-bg:#ECECEA; --nav-active-fg:#111111; --nav-active-ring:none;

  /* semantic: hue is the same across themes, the readable INK differs */
  --danger:#D9376E; --ok:#16A37B; --amber:#E7B84A;
  --danger-soft:color-mix(in srgb,var(--danger) 14%,var(--bg));
  --danger-soft-border:color-mix(in srgb,var(--danger) 34%,var(--bg));
  --danger-ink:#B8285A;
  --ok-soft:color-mix(in srgb,var(--ok) 14%,var(--bg));
  --ok-soft-border:color-mix(in srgb,var(--ok) 34%,var(--bg));
  --ok-ink:#0E7F5F;
  --amber-soft:color-mix(in srgb,var(--amber) 16%,var(--bg));
  --amber-soft-border:color-mix(in srgb,var(--amber) 38%,var(--bg));
  --amber-ink:#8A6414;

  --shadow-sm:none;
  --shadow-lg:0 24px 50px -26px rgba(0,0,0,.35);
  --dir:1;
  --hard:none; --hard-lg:var(--shadow-lg);   /* no hard offset shadows; the names remain for older rules */

  /* back-compat aliases: pages still styled with the old violet-brand names
     (--violet/--violet-2/--deep) pick up the accent and stay theme-aware. */
  --violet:var(--accent-ink); --violet-2:var(--accent); --deep:var(--accent-ink);

  --mark-tile:#E9E9E6; --mark-b:#111111;
}
:root[dir="rtl"]{--dir:-1}

:root[data-theme="dark"]{
  --bg:#0E0E0E; --band2:#080808; --card:#171717; --card-alt:#0E0E0E;
  --ink:#F4F4F2; --ink-2:#CFCFCB; --muted:#9B9B97;
  --line:#2B2B2B; --line-soft:#212121;
  --outline:#6B6B67;
  --shadow-c:#F4F4F2;

  --hl:#262626; --hl-fg:#F4F4F2;
  --kicker:#CFCFCB;
  --tag-bg:#F4F4F2; --tag-fg:#0E0E0E;

  --accent:#2A2A2A; --accent-ink:#F4F4F2; --on-accent:#F4F4F2;
  --accent-glow:color-mix(in srgb,#EA4A1F 38%,transparent);
  --spark:#EA4A1F;

  --brand-fill:#F4F4F2; --brand-fill-fg:#0E0E0E;
  --ico-bg:#262626; --ico-fg:#F4F4F2;

  --mark-ring:#3A3A3A;
  --nav-active-bg:#242424; --nav-active-fg:#F4F4F2;

  --danger-soft:color-mix(in srgb,var(--danger) 16%,var(--bg));
  --ok-soft:color-mix(in srgb,var(--ok) 16%,var(--bg));
  --amber-soft:color-mix(in srgb,var(--amber) 12%,var(--bg));
  --danger-ink:#FF9DBE;
  --ok-ink:#5FE0B8;
  --amber-ink:#E7B84A;

  --shadow-lg:0 24px 50px -26px rgba(0,0,0,.7);

  --mark-tile:#262626; --mark-b:#F4F4F2;
}

/* ═══ The near-black panel (2026-10-16) ═══════════════════════════════════════════
 * The closing panel of the landing page, made a shared piece: the landing hero, "what your customers
 * see", the popular plan, the dashboard's plan panel and the sign-in side panel are all this panel. It
 * stays near-black in BOTH modes (a touch lighter in dark, with a hairline), so the orange on it is the
 * same bright orange as everywhere else and a button on it keeps black text. White type, one or two
 * orange words, an orange pill for the action, an outlined pill for the second choice.
 * These are --pnl*, not --panel-bd: that one already means "the border of a card".
 *   --pnl-mut  muted text on the panel (5.8:1 on #111, passes)   --pnl-line  a hairline inside it
 *   --pop      the popular plan's cell (the panel colour, but one step lighter in dark mode)
 * The orange as TEXT is only ever a large headline phrase, and on a light page it is 3.6:1, enough for 30px+. */
:root{--pnl:#111111;--pnl-fg:#F7F7F6;--pnl-mut:rgba(247,247,246,.74);--pnl-bd:transparent;--pnl-line:rgba(247,247,246,.18);--pop:#111111}
:root[data-theme="dark"]{--pnl:#1A1A1A;--pnl-bd:var(--line);--pop:#262626}

/* The logo on every page that draws it as `.mark`: a soft grey tile with a black B, and a dark
   version for dark mode (drawn by tools/logo/build_logo.py). Each stylesheet's own `.mark` sets the
   light one; this swaps it. */
:root[data-theme="dark"] .mark{background-image:url("bordaar-mark-ink-dark.svg?v=1")}

/* ── scrollbars (thin, theme-coloured, instead of the default OS bar) ───── */
*{scrollbar-width:thin;scrollbar-color:var(--line) transparent}
::-webkit-scrollbar{width:9px;height:9px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background-color:var(--line);border-radius:999px;border:2px solid transparent;background-clip:padding-box}
::-webkit-scrollbar-thumb:hover{background-color:var(--muted)}

/* ── numbers inside a shape (count chips, step circles) ──────────────────────────────────────────────────────────
   A line box is centred on its font's ascent and descent, not on the digits. Figtree is balanced (digits measured 0.00em
   off), but Vazirmatn, which draws every Persian page, has a deep descent (1.03em above the baseline, 0.54em below it), so
   its digits sit about 0.115em ABOVE the middle of the shape. Measured by rasterising the real CSS at 1x, 2x and 3x
   density: 1 to 3 px high, worst in the 32px step circles (the "5" on the products list was the report). Pushing the content
   down by twice that (padding-top: .23em; the content box is then centred) and giving the line box no spare height
   (line-height:1, which also keeps the centring from overflowing) brings every one of them within half a pixel.
   English needs only a little: Figtree is balanced, but layout rounds the ascent and descent to whole pixels, which at 1x
   density left the 30 and 32px circles 1 px high; a .06em push (measured the same way) takes that to 0 and keeps 2x and 3x
   within a quarter pixel.
   Written here with `html` in front of each selector so it beats the page's own one-class rule whatever order the sheets
   load in; the pages keep their own `padding:0 6px` for the sides. A NEW digit-in-a-shape needs its selector added to
   these lists, or in Persian it sits high again (the shapes with words in them, "5 questions", are not digits and not here).
   The pills that grow with their text (no fixed height) keep their own padding and add the push on top. */
:root{--digit-pad:.06em}
:root[dir="rtl"]{--digit-pad:.23em}
html .gap-chip b, html .ov-gaps b, html .act-gaps b, html .pg-tabs .cnt, html .af .n,
html .step-num:not(.done), html .acard-num, html .bt-n{line-height:1;padding-top:var(--digit-pad)}
html .fopt .n{padding-top:calc(1px + var(--digit-pad))}
html .count-pill{padding-top:calc(2px + var(--digit-pad))}
html .side-badge{line-height:1;padding-top:var(--digit-pad)}

/* ── the FA / EN switch: the language that is NOT chosen is quiet (2026-10-24) ───────────────────────────────────
   Every page draws its switch as the `.lang` pill with two buttons, `#btn-en` and `#btn-fa`, and the stylesheet of each family of
   pages (app.css, auth.css, landing.css) gave BOTH the same bold ink colour, so the only thing saying which one was chosen was the
   filled pill: the unchosen label shouted as loudly as the chosen one (worst in dark mode, where both are bright white). The
   unchosen one now takes the muted text colour (5.4:1 on light, 6.4:1 on dark, still readable) and a lighter weight, and comes
   back to full ink on hover or keyboard focus. Written against the two ids on purpose: `.lang.seg` (the model pickers on
   product.html) is the same pill with option labels, and those must stay in full ink. The ids beat every `.lang button` rule
   whatever order the sheets load in. */
#btn-en:not(.on), #btn-fa:not(.on){color:var(--muted);font-weight:600}
#btn-en:not(.on):hover, #btn-fa:not(.on):hover,
#btn-en:not(.on):focus-visible, #btn-fa:not(.on):focus-visible{color:var(--ink)}

/* ── native drop-down lists (<select>): one drawn arrow, set in from the edge (2026-10-25) ────────────────────────
   The browser's own arrow sits about 4px from the control's edge and cannot be moved, so on a rounded control it looked stuck to
   the corner. The arrow is drawn here instead (`appearance:none` + a background chevron) 14px in from the END edge, and the text keeps
   clear of it with padding. The edge is logical: the right side in English, the left in Persian. A data-URI cannot read a CSS variable,
   so there are two chevrons, one per theme (muted ink on light, muted ink on dark: both clear 3:1 on the card colour). Written with
   `html` in front so it beats a page's own `select{background:...}` shorthand, which would otherwise wipe the image. */
html select:not([multiple]):not([size]){
  -webkit-appearance:none;appearance:none;
  padding-inline-start:14px;padding-inline-end:40px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23666' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-size:12px 8px;
  background-position:right 16px center;
  cursor:pointer;
}
html[dir="rtl"] select:not([multiple]):not([size]){background-position:left 16px center}
:root[data-theme="dark"] select:not([multiple]):not([size]){
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23B5B5B5' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5'/%3E%3C/svg%3E");
}
