/* Vazirmatn (SIL OFL 1.1, self-hosted, no external request): Persian, Arabic, Urdu and other Arabic-script text. Only fetched when such text is on the page. */
@font-face { font-family: "Vazirmatn"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/vazirmatn/Vazirmatn-Regular.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200D; }
@font-face { font-family: "Vazirmatn"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/vazirmatn/Vazirmatn-Medium.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200D; }
@font-face { font-family: "Vazirmatn"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/vazirmatn/Vazirmatn-SemiBold.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200D; }
@font-face { font-family: "Vazirmatn"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/vazirmatn/Vazirmatn-Bold.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200D; }
/* TailorLens console: "The cutting table". Tokens are docs/BRAND.md verbatim. The page is a self-healing cutting mat with a
   drafting grid; what the customer reads is a sheet of pattern paper (notched corner); one running-stitch thread ties
   photo, sketch, flat, pattern and palette together (thread.css). Build on token NAMES only; raw hex belongs to this
   file, to measured swatches and to the customer's own palettes. */
:root {
  color-scheme: light;
  --bg: #E5EBE3; --surface: #FBFAF5; --surface-2: #F2F0E7; --ink: #17211D; --muted: #55645E; --line: #C5CFC6; --line-strong: #8D9C93;
  --brand: #2540D9; --brand-ink: #2540D9; --brand-fg: #FFFFFF; --brand-soft: rgba(37,64,217,.09);
  --chalk: #D93F72; --chalk-ink: #A82253;
  --ok: #1D6B4E; --warn: #8A5A00; --bad: #B3261E; --nv: #55645E; --def: #6B4FB3;
  --ok-soft: rgba(29,107,78,.11); --warn-soft: rgba(138,90,0,.12); --bad-soft: rgba(179,38,30,.10); --nv-soft: rgba(85,100,94,.12); --def-soft: rgba(107,79,179,.11);
  --grid: rgba(23,70,52,.075); --grid-major: rgba(23,70,52,.13);
  --paper-shadow: 0 1px 0 rgba(23,33,29,.10), 0 10px 22px -14px rgba(23,33,29,.38);
  --ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand);
  --scrim: rgba(15,26,23,.55);
  --bg-2: color-mix(in srgb, var(--bg) 86%, var(--ink)); --faint: color-mix(in srgb, var(--muted) 70%, var(--surface));
  --display: "Avenir Next", "Segoe UI Variable Display", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;
  --r: 3px; --radius: 3px; --notch: 11px;
  --rail-w: 92px; --dock-h: 62px; --bar-h: 52px; --gutter: 28px; --page-w: 1240px;
  /* compatibility aliases for shared modules */
  --warn-ink: var(--warn); --ok-ink: var(--ok); --bad-ink: var(--bad); --nv-ink: var(--nv); --on-brand: var(--brand-fg); --line-2: var(--line-strong); --focus: var(--brand);
  --info: var(--nv); --info-ink: var(--nv); --info-soft: var(--nv-soft); --ink-2: var(--ink);
  --dir: 1; --sx: 1; --tick-x: right; --gs: 90deg; --notch-ang: 135deg; /* flipped under [dir=rtl] at the end of this file */
  --toast-ok: #5FCB9C; --toast-warn: #E7B24A; --toast-bad: #FF8A82; --toast-link: #B7C2FF;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1A17; --surface: #16241F; --surface-2: #1C2D27; --ink: #E9F0EB; --muted: #A5B6AE; --line: #2B3F37; --line-strong: #4F6A5F;
  --brand: #93A3FF; --brand-ink: #B2BEFF; --brand-fg: #0B1233; --brand-soft: rgba(147,163,255,.13);
  --chalk: #FF86A8; --chalk-ink: #FF9DB9;
  --ok: #5FCB9C; --warn: #E7B24A; --bad: #FF8A82; --nv: #A5B6AE; --def: #B7A2FF;
  --ok-soft: rgba(95,203,156,.13); --warn-soft: rgba(231,178,74,.13); --bad-soft: rgba(255,138,130,.13); --nv-soft: rgba(165,182,174,.13); --def-soft: rgba(183,162,255,.14);
  --grid: rgba(150,230,200,.055); --grid-major: rgba(150,230,200,.10);
  --paper-shadow: 0 1px 0 rgba(0,0,0,.4), 0 12px 24px -14px rgba(0,0,0,.7);
  --scrim: rgba(0,0,0,.66);
  --bg-2: color-mix(in srgb, var(--bg) 82%, var(--ink));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0F1A17; --surface: #16241F; --surface-2: #1C2D27; --ink: #E9F0EB; --muted: #A5B6AE; --line: #2B3F37; --line-strong: #4F6A5F;
    --brand: #93A3FF; --brand-ink: #B2BEFF; --brand-fg: #0B1233; --brand-soft: rgba(147,163,255,.13);
    --chalk: #FF86A8; --chalk-ink: #FF9DB9;
    --ok: #5FCB9C; --warn: #E7B24A; --bad: #FF8A82; --nv: #A5B6AE; --def: #B7A2FF;
    --ok-soft: rgba(95,203,156,.13); --warn-soft: rgba(231,178,74,.13); --bad-soft: rgba(255,138,130,.13); --nv-soft: rgba(165,182,174,.13); --def-soft: rgba(183,162,255,.14);
    --grid: rgba(150,230,200,.055); --grid-major: rgba(150,230,200,.10);
    --paper-shadow: 0 1px 0 rgba(0,0,0,.4), 0 12px 24px -14px rgba(0,0,0,.7);
    --scrim: rgba(0,0,0,.66);
    --bg-2: color-mix(in srgb, var(--bg) 82%, var(--ink));
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0; min-height: 100vh; background-color: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow-wrap: anywhere;
  background-image: linear-gradient(var(--grid-major) 1px, transparent 1px), linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px; background-position: var(--rail-w) 0;
}
body.public { overflow-wrap: normal; background-position: 0 0; }
img, svg, canvas, video { max-width: 100%; }
a { color: var(--brand-ink); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r); }
::selection { background: var(--brand); color: var(--brand-fg); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
h1, h2, h3, h4 { margin: 0; line-height: 1.12; font-family: var(--display); font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: clamp(28px, 4.2vw, 42px); }
h2 { font-size: 20px; letter-spacing: -.01em; }
h3 { font-size: 16px; letter-spacing: 0; }
p { margin: 0; }
.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 14px; } .xs { font-size: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.nowrap { flex-wrap: nowrap; }
.stack { display: grid; gap: 16px; } .stack.sm { gap: 10px; } .stack.lg { gap: 28px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; inset-inline-start: 12px; top: -80px; z-index: 200; padding: 10px 14px; background: var(--ink); color: var(--bg); border-radius: var(--r); }
.skip-link:focus { top: 12px; }
/* a mono label: the dimension tag every caption wears */
.tag, .eyebrow { font: 600 11.5px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.eyebrow { display: flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ""; width: 14px; height: 0; border-top: 2px solid var(--chalk); }

/* ---------- shell: ruler rail (desktop), dock (phone) ---------- */
.rail { position: fixed; z-index: 40; inset-block: 0; inset-inline: 0 auto; width: var(--rail-w); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0 12px;
  background: var(--surface); border-inline-end: 1px solid var(--line-strong); }
.rail::after { content: ""; position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: 9px; pointer-events: none; opacity: .55;
  background: repeating-linear-gradient(180deg, var(--line-strong) 0 1px, transparent 1px 8px) var(--tick-x) / 5px 100% no-repeat, repeating-linear-gradient(180deg, var(--line-strong) 0 1px, transparent 1px 40px) var(--tick-x) / 9px 100% no-repeat; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 800 18px/1 var(--display); letter-spacing: -.03em; }
.brand .mark { width: 40px; height: 40px; display: block; }
.brand:hover { text-decoration: none; }
.rail .brand { margin-bottom: 8px; } .rail .brand .wm { display: none; }
.rail-cta { display: grid; place-items: center; gap: 2px; width: 64px; padding: 9px 0 8px; margin-bottom: 8px; border-radius: var(--r); background: var(--brand); color: var(--brand-fg); text-decoration: none; font: 700 10.5px/1.1 var(--mono); letter-spacing: .06em; text-transform: uppercase; text-align: center; overflow-wrap: break-word; max-width: calc(var(--rail-w) - 12px); }
.rail-cta .i { width: 22px; height: 22px; stroke-width: 2; }
.rail-cta:hover { text-decoration: none; filter: brightness(1.08); }
.rail nav { display: grid; gap: 2px; width: 100%; }
.rail nav a { position: relative; display: grid; justify-items: center; gap: 3px; padding: 10px 4px 9px; color: var(--muted); text-decoration: none; font: 600 10.5px/1.1 var(--mono); letter-spacing: .06em; text-transform: uppercase; text-align: center; overflow-wrap: break-word; }
.rail nav a .i { width: 22px; height: 22px; }
.rail nav a:hover { color: var(--ink); text-decoration: none; background: var(--surface-2); }
.rail nav a[aria-current="page"] { color: var(--brand-ink); background: var(--brand-soft); }
.rail nav a[aria-current="page"]::before { content: ""; position: absolute; inset-inline-start: 0; top: 50%; margin-top: -7px; border: 7px solid transparent; border-inline-start: 8px solid var(--chalk); border-inline-end: 0; }
.rail-foot { margin-top: auto; display: grid; justify-items: center; gap: 8px; width: 100%; }
.wallet-chip { display: grid; justify-items: center; padding: 6px 4px; min-width: 66px; border: 1px dashed var(--line-strong); border-radius: var(--r); color: var(--ink); text-decoration: none; font: 700 13px/1.1 var(--mono); text-align: center; overflow-wrap: break-word; }
.rail .wallet-chip { max-width: calc(var(--rail-w) - 10px); }
.wallet-chip .wl { font-weight: 500; font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.wallet-chip .i { display: none; }
.wallet-chip.low { border-color: var(--warn); color: var(--warn); }
.wallet-chip:hover { text-decoration: none; background: var(--surface-2); }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--surface-2); color: var(--ink); font: 700 13px var(--mono); cursor: pointer; }
.avatar:hover { background: var(--brand-soft); }
.user-menu { position: relative; }
.pop { position: absolute; z-index: 60; max-height: calc(100vh - 24px); overflow: auto; inset-inline-start: calc(100% + 10px); bottom: 0; min-width: 230px; max-width: calc(100vw - var(--rail-w) - 24px); padding: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: var(--paper-shadow); }
.pop a, .pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 2px; background: none; color: var(--ink); text-align: start; text-decoration: none; cursor: pointer; font-size: 15px; }
.pop a:hover, .pop button:hover { background: var(--surface-2); text-decoration: none; }
.pop .who { display: grid; padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pop .who span { color: var(--muted); font-size: 13px; }
.pop hr { margin: 4px 0; }
.shell { margin-inline-start: var(--rail-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: none; }
.main { flex: 1; width: 100%; max-width: var(--page-w); margin: 0 auto; padding: 26px var(--gutter) 40px; outline: none; }
body[data-page="analysis"] .main { max-width: none; padding-top: 16px; }
.foot { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 18px var(--gutter) 26px; max-width: var(--page-w); margin: 0 auto; width: 100%; color: var(--muted); font: 500 12px var(--mono); }
.foot a { color: var(--muted); }
.dock { display: none; }
.more-sheet { position: fixed; inset: 0; z-index: 70; background: var(--scrim); display: none; align-items: flex-end; }
.more-sheet.open { display: flex; }
.more-sheet .sheet-in { width: 100%; padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 2px dashed var(--line-strong); display: grid; gap: 2px; border-radius: 0; }
.more-sheet .sheet-in a, .more-sheet .sheet-in button { display: flex; align-items: center; gap: 12px; padding: 14px 8px; border: 0; background: none; color: var(--ink); text-decoration: none; font-size: 17px; text-align: start; cursor: pointer; border-bottom: 1px solid var(--line); }

@media (max-width: 860px) {
  :root { --gutter: 16px; }
  body { background-position: 0 0; padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom)); }
  .rail { display: none; }
  .shell { margin-inline-start: 0; }
  .topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: var(--bar-h); padding: env(safe-area-inset-top) 14px 0; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-strong); }
  .topbar .brand .mark { width: 30px; height: 30px; }
  .topbar .brand .wm { display: inline; }
  .topbar .wallet-chip { grid-auto-flow: column; gap: 6px; min-width: 0; padding: 5px 9px; }
  .topbar .wallet-chip .wl { display: none; }
  .dock { position: fixed; z-index: 50; inset: auto 0 0 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; height: calc(var(--dock-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line-strong); }
  .dock a, .dock button { display: grid; justify-items: center; align-content: end; gap: 2px; padding: 8px 2px 8px; min-width: 0; text-align: center; overflow-wrap: anywhere; border: 0; background: none; color: var(--muted); text-decoration: none; font: 600 10px/1.1 var(--mono); letter-spacing: .05em; text-transform: uppercase; cursor: pointer; }
  .dock .i { width: 22px; height: 22px; }
  .dock a > span:last-child, .dock button > span:last-child { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; max-width: 100%; overflow: hidden; } /* a long translated label wraps to two lines, never grows the dock */
  .dock a[aria-current="page"], .dock button.current { color: var(--brand-ink); }
  .dock a[aria-current="page"] .i { stroke-width: 2.2; }
  .dock .dock-new { position: relative; top: -14px; }
  .dock .dock-new .ring { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: var(--brand); color: var(--brand-fg); border: 3px solid var(--surface); box-shadow: 0 6px 14px -6px rgba(0,0,0,.5); }
  .dock .dock-new .t { color: var(--ink); }
  .foot { padding-bottom: 24px; }
  .main { padding-top: 18px; }
  body[data-page="analysis"] .main { padding-top: 10px; }
}

/* ---------- page header ---------- */
.ph { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.ph .tag { display: block; margin-bottom: 8px; }
.ph p { color: var(--muted); max-width: 62ch; margin-top: 6px; }
.crumbs { display: flex; gap: 8px; align-items: center; font: 600 12px var(--mono); color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }

/* ---------- sheets (paper with a cut corner) ---------- */
.sheet { position: relative; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--paper-shadow);
  --clip: polygon(var(--notch) 0, 100% 0, 100% 100%, 0 100%, 0 var(--notch)); clip-path: var(--clip); }
.sheet::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; width: var(--notch); height: var(--notch); pointer-events: none;
  background: linear-gradient(var(--notch-ang), transparent calc(50% - .7px), var(--line-strong) calc(50% - .7px) calc(50% + .7px), transparent calc(50% + .7px)); }
/* clip-path would also clip the paper shadow: wrap the sheet when a shadow matters */
.sheet.plain { clip-path: none; } .sheet.plain::before { display: none; }
.sheet.tight { padding: 12px 14px; } .sheet.flush { padding: 0; }
.sheet-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 14px; margin-bottom: 14px; }
.sheet-head h2 + .sub { margin-top: 2px; }
.sub { color: var(--muted); font-size: 14px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 18px 20px; }
a.sheet, a.card { color: inherit; text-decoration: none; display: block; }
a.sheet:hover { border-color: var(--brand); text-decoration: none; }
.well { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }

/* dimension-line heading: |<---- Title ---->| */
.dim { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font: 700 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.dim::before, .dim::after { content: ""; flex: 1 1 14px; height: 9px; border-left: 1.5px solid var(--chalk); border-right: 1.5px solid var(--chalk); background:
  linear-gradient(var(--chalk), var(--chalk)) center / 100% 1.5px no-repeat; opacity: .85; }
.dim::before { flex: 0 0 22px; } .dim.left::after { flex: 1 1 auto; } .dim.left::before { display: none; }
.dim b { color: var(--ink); font-weight: 700; }
/* stitched rule */
.seam { height: 2px; border: 0; margin: 18px 0; background: repeating-linear-gradient(90deg, var(--brand) 0 7px, transparent 7px 12px); opacity: .85; }

/* ---------- buttons ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 16px; border: 1.5px solid var(--ink); border-radius: var(--r);
  background: transparent; color: var(--ink); font: 600 15px/1.2 var(--font); text-decoration: none; cursor: pointer; white-space: normal; text-align: center; overflow-wrap: break-word; max-width: 100%; transition: background .12s, color .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.cta, .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.btn.cta:hover, .btn.primary:hover { filter: brightness(1.08); background: var(--brand); }
.btn.ghost { border-color: transparent; color: var(--brand-ink); padding-inline: 10px; }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger.fill { background: var(--bad); color: #fff; }
.btn.sm { min-height: 34px; padding: 5px 11px; font-size: 14px; }
.btn.lg { min-height: 52px; padding: 13px 24px; font-size: 17px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn[aria-busy="true"] { color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn.cta[aria-busy="true"]::after { border-color: var(--brand-fg); border-right-color: transparent; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid transparent; border-radius: var(--r); background: none; color: var(--ink); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); }
.icon-btn[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); border-color: var(--brand); }
.link { background: none; border: 0; padding: 0; color: var(--brand-ink); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; font: inherit; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; } .field > label, .lbl { font: 600 13px var(--font); color: var(--ink); }
.field .hint { font-size: 13px; color: var(--muted); }
.field .err { font-size: 13px; color: var(--bad); }
.input, .select, .textarea { width: 100%; min-height: 42px; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--r); color: var(--ink); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { box-shadow: var(--ring); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.input.mono { font-family: var(--mono); }
.textarea { min-height: 84px; resize: vertical; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 15px; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.seg button { min-height: 36px; padding: 6px 14px; border: 0; border-inline-end: 1px solid var(--line-strong); background: none; font: 600 13px var(--mono); letter-spacing: .04em; cursor: pointer; color: var(--ink); min-width: 0; overflow-wrap: break-word; }
.seg { max-width: 100%; }
.seg button:last-child { border-inline-end: 0; }
.seg button[aria-pressed="true"], .seg button[aria-checked="true"] { background: var(--ink); color: var(--bg); }
.seg button:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); border-radius: 0; }
input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface-2); cursor: pointer; }

/* ---------- chips and badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 2px; font: 600 11.5px/1.5 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: transparent; max-width: 100%; overflow-wrap: break-word; }
.badge.ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); } .badge.warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.badge.bad { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); } .badge.brand { color: var(--brand-ink); border-color: var(--brand); background: var(--brand-soft); }
.badge.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
/* evidence label: the printed word + a shape + a colour (never colour alone) */
.ev { display: inline-flex; align-items: center; gap: 6px; padding-block: 1px; padding-inline: 6px 8px; border-radius: 2px; border: 1px solid currentColor; font: 700 10.5px/1.6 var(--mono); letter-spacing: .06em; text-transform: uppercase; max-width: 100%; overflow-wrap: break-word; }
.ev::before { content: ""; width: 8px; height: 8px; flex: none; background: currentColor; }
.ev-observed { color: var(--brand-ink); background: var(--brand-soft); } .ev-observed::before { border-radius: 50%; }
.ev-inferred { color: var(--warn); background: var(--warn-soft); border-style: dashed; } .ev-inferred::before { border-radius: 50%; background: transparent; border: 1.5px dashed currentColor; }
.ev-confirmed { color: var(--ok); background: var(--ok-soft); } .ev-confirmed::before { clip-path: polygon(0 55%, 18% 40%, 40% 62%, 82% 5%, 100% 20%, 40% 100%); }
.ev-template_default { color: var(--def); background: var(--def-soft); } .ev-template_default::before { transform: rotate(45deg) scale(.8); background: transparent; border: 1.5px solid currentColor; }
.ev-not_verifiable { color: var(--nv); background: repeating-linear-gradient(135deg, var(--nv-soft) 0 3px, transparent 3px 6px); border-style: dotted; } .ev-not_verifiable::before { border-radius: 50%; background: transparent; border: 1.5px solid currentColor; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: start; font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1.5px solid var(--ink); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.num, .tbl th.num { text-align: end; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tbl tbody tr:hover { background: var(--surface-2); }

/* ---------- banners, empty, skeleton ---------- */
#banners { display: grid; gap: 10px; margin-bottom: 14px; } #banners:empty { display: none; }
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--warn); border-inline-start-width: 5px; border-radius: var(--r); background: var(--warn-soft); }
.banner.plain { border-color: var(--line-strong); background: var(--surface-2); }
.banner.bad { border-color: var(--bad); background: var(--bad-soft); } .banner.ok { border-color: var(--ok); background: var(--ok-soft); } .banner.info { border-color: var(--brand); background: var(--brand-soft); }
.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 34px 18px; }
.empty .big { width: 84px; height: 84px; display: grid; place-items: center; color: var(--brand-ink); }
.empty .big .i { width: 56px; height: 56px; stroke-width: 1.1; }
.empty p { color: var(--muted); max-width: 46ch; }
.skel { background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface) 50%, var(--surface-2) 70%) 0 0 / 220% 100%; border-radius: var(--r); animation: shimmer 1.4s linear infinite; min-height: 14px; }
.skel.line { height: 14px; margin: 6px 0; } .skel.chart { height: 220px; }
@keyframes shimmer { to { background-position: -220% 0; } }

/* ---------- toasts, dialogs ---------- */
.toasts { position: fixed; z-index: 120; inset-inline-end: 16px; bottom: 16px; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
@media (max-width: 860px) { .toasts { bottom: calc(var(--dock-h) + 14px + env(safe-area-inset-bottom)); inset-inline-end: 12px; } }
.toast { display: flex; gap: 10px; align-items: flex-start; padding-block: 12px; padding-inline: 14px 12px; background: #17211D; color: #F2F5F2; border-radius: var(--r); border-inline-start: 4px solid var(--toast-ok); box-shadow: 0 10px 28px -10px rgba(0,0,0,.6); }
.toast.bad { border-color: var(--toast-bad); } .toast.warn { border-color: var(--toast-warn); } .toast.info { border-color: var(--toast-link); }
.toast .body { flex: 1; font-size: 14.5px; } .toast a { color: var(--toast-link); }
.toast .x { border: 0; background: none; color: inherit; cursor: pointer; opacity: .7; } .toast .x:hover { opacity: 1; }
.scrim { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: var(--scrim); overflow: auto; }
.dialog { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: 0 24px 60px -20px rgba(0,0,0,.6); }
.dialog.wide { width: min(760px, 100%); }
.dialog .actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.dialog h2 { font-size: 22px; }
.secret { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px dashed var(--line-strong); background: var(--surface-2); font: 600 14px var(--mono); word-break: break-all; }

/* ---------- misc ---------- */
.swatch { display: inline-block; width: 22px; height: 22px; border-radius: 2px; border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent); background: var(--sw, #888); flex: none; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.stat { display: grid; gap: 2px; } .stat b { font: 800 clamp(30px, 4vw, 44px)/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; } .stat span { font: 600 11.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
details > summary { cursor: pointer; font-weight: 600; } details > summary::marker { color: var(--brand); }
.settled .reveal { animation: none; }
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: rise .35s ease-out both; }
  .reveal:nth-child(2) { animation-delay: .05s; } .reveal:nth-child(3) { animation-delay: .1s; } .reveal:nth-child(4) { animation-delay: .15s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }
@media print { .rail, .dock, .topbar, .foot, .toasts { display: none !important; } .shell { margin: 0; } body { background: #fff; } }

/* Measure a garment you own (wizard and inspector) */
.gm-sec { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); margin: 6px 0; }
.gm-sec > summary { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; list-style: none; }
.gm-sec > summary::-webkit-details-marker { display: none; }
.gm-sec[open] > summary .sp-chev { transform: rotate(180deg); }
.gm-sec .gm-body { padding: 0 12px 12px; }
.gm-from { white-space: nowrap; unicode-bidi: isolate; }
.gm-sec .sp-t { flex: 1; font-weight: 600; } .gm-sec .sp-n { color: var(--muted); }
.gm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.ws-spec .gm-grid { grid-template-columns: 1fr; }

/* Form alignment: controls in a row share one baseline, whatever hints their siblings carry. */
.field { align-content: start; }
.grid2, .grid3 { align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.select { appearance: none; -webkit-appearance: none; padding-inline-end: 38px; text-align: start; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23666' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: var(--tick-x) 14px center; }
.input, .select { height: 44px; }
.optsec { display: grid; gap: 10px; padding: 16px 0; border-top: 1px dashed var(--line-strong); }
.optsec:first-of-type { border-top: 0; padding-top: 4px; }
.optsec-h { margin: 0; font: 700 12px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.optsec .hint { margin: 0; font-size: 13px; color: var(--muted); }
.optsec .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
.optsec .seg button { text-align: center; }
.colourrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.colourrow input[type=color] { width: 44px; height: 44px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer; }
@media (max-width: 520px) { .grid3, .grid2 { grid-template-columns: 1fr; } }

/* ======================================================================================================================
   Right-to-left, scripts and long words. Everything above is written with logical properties, so a page that carries
   <html lang="ar" dir="rtl"> mirrors by itself; this block holds only what logic cannot express. LTR renders as before.
   Deliberately physical (geometry, not layout): .vw-stage + .vw-vp + its rulers (the origin is the top-left of the drawing),
   .cam-video.mirror (front camera), the .lp-checks tick, the spinner arc, .dim end caps (symmetric), .cropper (image coords).
   ====================================================================================================================== */
[dir="rtl"] { --dir: -1; --sx: -1; --tick-x: left; --gs: 270deg; --notch-ang: 225deg; }
.flip-rtl { display: inline-block; }
[dir="rtl"] .flip-rtl, [dir="rtl"] .i.flip, [dir="rtl"] .flip-rtl-icon { transform: scaleX(-1); }
/* sprite icons that point somewhere: mirrored without markup changes (class .flip-rtl on the svg does the same) */
[dir="rtl"] .i:has(> use[href="#i-arrow-right"]), [dir="rtl"] .i:has(> use[href="#i-chevron-left"]), [dir="rtl"] .i:has(> use[href="#i-chevron-right"]),
[dir="rtl"] .i:has(> use[href="#i-logout"]), [dir="rtl"] .i:has(> use[href="#i-history"]) { transform: scaleX(-1); }
[dir="rtl"] .df-arrow { transform: scaleX(-1); }
[dir="rtl"] .sheet { --clip: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, 0 100%); }
[dir="rtl"] body:not(.public) { background-position: calc(100% - var(--rail-w)) 0; }
@media (max-width: 860px) { [dir="rtl"] body:not(.public) { background-position: 0 0; } }
[dir="rtl"] .skel, [dir="rtl"] .stitching { animation-direction: reverse; }

/* LTR islands inside an RTL page: drawings, ids, code, numbers, addresses */
svg:not(.i) { direction: ltr; }
code, kbd, samp, pre, .secret, .hex { direction: ltr; unicode-bidi: isolate; text-align: start; }
.mono { unicode-bidi: isolate; }
.input.mono, input.mono { direction: ltr; text-align: start; }
input, textarea, select, .input, .select, .textarea { text-align: start; }
[dir="rtl"] input[type="number"], [dir="rtl"] input[inputmode="decimal"], [dir="rtl"] input[inputmode="numeric"] { direction: ltr; text-align: right; } /* digits read LTR, the box hugs the RTL start edge */
[dir="rtl"] input[type="email"], [dir="rtl"] input[type="url"], [dir="rtl"] input[type="tel"] { direction: ltr; text-align: left; }
[dir="rtl"] .sp-unit, [dir="rtl"] .ph-col { unicode-bidi: isolate; }

/* ---------- fonts per script: system fonts only, no web fonts, no requests ---------- */
:root:lang(ar), :root:lang(fa), :root:lang(ur), :root:lang(ps), :root:lang(ckb), :root:lang(ku), :root:lang(sd), :root:lang(ug) { --font: "Vazirmatn", system-ui, "Noto Naskh Arabic", "Geeza Pro", "Segoe UI", Tahoma, sans-serif; --display: var(--font);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Vazirmatn", "Noto Naskh Arabic", "Geeza Pro", "Segoe UI", Tahoma, monospace; --lh: 1.75; --lh-h: 1.45; }
:root:lang(ur) { --lh: 1.9; --lh-h: 1.6; } /* Urdu: Vazirmatn covers the extended letters; a little more line height for its taller joins */
:root:lang(he) { --font: system-ui, "Arial Hebrew", "Segoe UI", Arial, sans-serif; --display: var(--font);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Arial Hebrew", "Segoe UI", Arial, monospace; --lh: 1.6; --lh-h: 1.3; }
:root:lang(zh) { --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif; --display: var(--font);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", monospace; --lh: 1.65; --lh-h: 1.35; }
:root:lang(ja) { --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans CJK JP", Meiryo, system-ui, sans-serif; --display: var(--font);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Hiragino Sans", "Yu Gothic", "Noto Sans CJK JP", Meiryo, monospace; --lh: 1.65; --lh-h: 1.35; }
:root:lang(ko) { --font: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR", system-ui, sans-serif; --display: var(--font);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR", monospace; --lh: 1.65; --lh-h: 1.35; }
:root:lang(hi) { --font: "Noto Sans Devanagari", "Kohinoor Devanagari", "Nirmala UI", system-ui, sans-serif; --display: var(--font);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Noto Sans Devanagari", "Kohinoor Devanagari", "Nirmala UI", monospace; --lh: 1.75; --lh-h: 1.45; }
:root:lang(bn) { --font: "Noto Sans Bengali", "Kohinoor Bangla", "Nirmala UI", system-ui, sans-serif; --display: var(--font);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Noto Sans Bengali", "Kohinoor Bangla", "Nirmala UI", monospace; --lh: 1.75; --lh-h: 1.45; }
/* scripts without case or with joining letters: no tracked uppercase captions, no italics */
:is(:lang(ar),:lang(fa),:lang(ur),:lang(he),:lang(hi),:lang(bn),:lang(zh),:lang(ja),:lang(ko)) *, :is(:lang(ar),:lang(fa),:lang(ur),:lang(he),:lang(hi),:lang(bn),:lang(zh),:lang(ja),:lang(ko)) *::before, :is(:lang(ar),:lang(fa),:lang(ur),:lang(he),:lang(hi),:lang(bn),:lang(zh),:lang(ja),:lang(ko)) *::after { text-transform: none !important; letter-spacing: normal !important; font-style: normal !important; }
:root:is(:lang(ar),:lang(fa),:lang(ur),:lang(he),:lang(hi),:lang(bn),:lang(zh),:lang(ja),:lang(ko)) body { line-height: var(--lh); }
:root:is(:lang(ar),:lang(fa),:lang(ur),:lang(he),:lang(hi),:lang(bn),:lang(zh),:lang(ja),:lang(ko)) :is(h1, h2, h3, h4, .lp-hero h1, .lp-wrap h2) { line-height: var(--lh-h); }
:root:is(:lang(ar),:lang(fa),:lang(ur),:lang(he),:lang(hi),:lang(bn),:lang(zh),:lang(ja),:lang(ko)) :is(.tag, .eyebrow, .rail-cta, .rail nav a, .wallet-chip, .wallet-chip .wl, .badge, .ev, .btn, .seg button, .thread .nm, .thread .sb, .tbl th, .dim,
  .stat span, .st-stats dt, .ws-sw .nm, .lp-chips .nm, .sp-sec > summary, .sp-fn, .pl-src, .gt-meta, .cmp-tbl .rowlab, .mk-log .when, .optsec-h, .lp-nav a, .lp-ticks li, .crumbs, .foot, .lp-foot, .sh-foot, .pl-name, .gt-name) { line-height: var(--lh); }
:root:is(:lang(ar), :lang(fa), :lang(ur), :lang(he), :lang(hi), :lang(bn), :lang(zh), :lang(ja), :lang(ko)) :is(.dock a, .dock button) { line-height: 1.15; } /* the dock is a fixed 62px: two label lines must fit */

/* ---- language: hold the first paint until the catalog arrives (non-English only; a 1.5 s safety net shows the page anyway) ---- */
html.i18n-wait body { opacity: 0; animation: tl-show 0s linear 1.5s forwards; }
@keyframes tl-show { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { html.i18n-wait body { animation-duration: 0s; } }

/* ---- language switcher ---- */
[data-lang-switch] .lang-cur { unicode-bidi: isolate; }
.foot-lang { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; padding: 4px 8px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.foot-lang:hover { text-decoration: underline; }
.lang-btn { display: inline-flex; align-items: center; gap: 6px; }
.auth-lang { display: flex; justify-content: center; margin-block: 14px; }
.lang-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; max-height: min(60vh, 460px); overflow: auto; }
.lang-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; text-align: start; cursor: pointer; }
.lang-item:hover { background: var(--surface-2); }
.lang-item[aria-checked="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); font-weight: 600; }
.lang-item:focus-visible { outline: 2px solid var(--ring, var(--brand)); outline-offset: 2px; }
.pop button[data-lang-switch] .lang-cur { margin-inline-start: 0; }
.lang-btn, .lang-btn .lang-cur, .foot-lang { white-space: nowrap; overflow-wrap: normal; word-break: keep-all; flex-shrink: 0; }
@media (max-width: 560px) { .lp-bar .lang-btn .lang-cur, .sh-bar .lang-btn .lang-cur { display: none; } .lp-bar .lang-btn, .sh-bar .lang-btn { padding-inline: 8px; } }
.lp-signin { white-space: nowrap; }
