/* StyleScore console, v2 "Lookbook": a quiet black-and-paper magazine where the
   colours measured from your photo are the only loud thing. docs/BRAND.md is the
   source of every value; docs/UI.md lists the components. Light is paper and ink,
   dark is noir. Colour appears as data (swatches, score colours) plus ONE
   vermilion accent for the single primary action per view. Every scored dimension
   keeps one colour in every chip, bar, ring and legend. */
:root {
  color-scheme: light;
  --bg: #F4F3EF; --bg-2: #EAE8E2; --bg-3: #DFDDD6;
  --surface: #FFFFFF; --surface-2: #FAFAF8;
  --ink: #0E0E10; --ink-2: #2A2A2E; --muted: #66666E; --faint: #9A9AA2;
  --line: #DDDCD6; --line-2: #C6C5BE;
  --brand: #F0472A; --brand-ink: #C8321A; --brand-soft: #FDE7E2; --brand-strong: #D93A1F;
  --on-brand: #0E0E10;
  --harmony: #F0472A; --harmony-ink: #C8321A; --harmony-soft: rgba(240,71,42,.10);
  --contrast: #2B59FF; --contrast-ink: #1F44D6; --contrast-soft: rgba(43,89,255,.10);
  --formal: #7B4DFF; --formal-ink: #6538E0; --formal-soft: rgba(123,77,255,.10);
  --coherence: #0FA37F; --coherence-ink: #0A7A5F; --coherence-soft: rgba(15,163,127,.12);
  --weather: #E59A00; --weather-ink: #8A5A00; --weather-soft: rgba(229,154,0,.15);
  --prefs: #E0489A; --prefs-ink: #B02A78; --prefs-soft: rgba(224,72,154,.11);
  --ok: #0F9F6E; --ok-ink: #0A7650; --ok-soft: rgba(15,159,110,.12);
  --warn: #B7791F; --warn-ink: #85560B; --warn-soft: rgba(183,121,31,.14);
  --bad: #D13438; --bad-ink: #B02226; --bad-soft: rgba(209,52,56,.10);
  --info: #2B59FF; --info-ink: #1F44D6; --info-soft: rgba(43,89,255,.10);
  --navy: #0E0E10; --on-solid: #FFFFFF;
  --focus: #0E0E10;
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus);
  --shadow: none;
  --shadow-lg: 0 18px 48px -18px rgba(14,14,16,.38);
  --glow: transparent;
  --scrim: rgba(14,14,16,.52);
  --sw-edge: rgba(14,14,16,.14);
  --radius: 10px; --radius-sm: 6px; --radius-xs: 2px;
  --font: ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "SF Pro Display", "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino", "Georgia", serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --page-w: 1200px; --gutter: 32px; --bar-h: 64px;
  /* Older names, kept so a stray rule never loses its colour. */
  --accent: var(--brand); --accent-ink: var(--brand-ink); --accent-soft: var(--brand-soft); --accent-strong: var(--brand-strong);
  --on-accent: var(--on-solid);
  --sun: var(--brand); --sun-ink: var(--brand-ink); --sun-soft: var(--brand-soft); --sun-strong: var(--brand-strong);
  --text: var(--ink); --text-2: var(--ink-2); --surface-solid: var(--surface); --baseline: var(--faint);
  --sidebar-w: 0px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0B0C; --bg-2: #121214; --bg-3: #1A1A1D;
  --surface: #151517; --surface-2: #1B1B1E;
  --ink: #F5F5F2; --ink-2: #DADADD; --muted: #A0A0A8; --faint: #74747C;
  --line: #2A2A2E; --line-2: #3A3A40;
  --brand: #FF6A4D; --brand-ink: #FF8468; --brand-soft: #3A1A14; --brand-strong: #FF8468;
  --harmony: #FF6A4D; --harmony-ink: #FF8468; --harmony-soft: rgba(255,106,77,.16);
  --contrast: #7C9BFF; --contrast-ink: #7C9BFF; --contrast-soft: rgba(124,155,255,.16);
  --formal: #B397FF; --formal-ink: #B397FF; --formal-soft: rgba(179,151,255,.16);
  --coherence: #4FD9B3; --coherence-ink: #4FD9B3; --coherence-soft: rgba(79,217,179,.15);
  --weather: #FFC24D; --weather-ink: #FFC24D; --weather-soft: rgba(255,194,77,.15);
  --prefs: #FF8CC4; --prefs-ink: #FF8CC4; --prefs-soft: rgba(255,140,196,.15);
  --ok: #4FD9A0; --ok-ink: #4FD9A0; --ok-soft: rgba(79,217,160,.15);
  --warn: #E8B055; --warn-ink: #E8B055; --warn-soft: rgba(232,176,85,.15);
  --bad: #FF7A7E; --bad-ink: #FF9A9D; --bad-soft: rgba(255,122,126,.15);
  --info: #7C9BFF; --info-ink: #7C9BFF; --info-soft: rgba(124,155,255,.16);
  --navy: #0E0E10; --on-solid: #0B0B0C;
  --focus: #F5F5F2;
  --shadow-lg: 0 24px 60px -18px rgba(0,0,0,.85);
  --scrim: rgba(0,0,0,.7);
  --sw-edge: rgba(255,255,255,.2);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B0B0C; --bg-2: #121214; --bg-3: #1A1A1D;
    --surface: #151517; --surface-2: #1B1B1E;
    --ink: #F5F5F2; --ink-2: #DADADD; --muted: #A0A0A8; --faint: #74747C;
    --line: #2A2A2E; --line-2: #3A3A40;
    --brand: #FF6A4D; --brand-ink: #FF8468; --brand-soft: #3A1A14; --brand-strong: #FF8468;
    --harmony: #FF6A4D; --harmony-ink: #FF8468; --harmony-soft: rgba(255,106,77,.16);
    --contrast: #7C9BFF; --contrast-ink: #7C9BFF; --contrast-soft: rgba(124,155,255,.16);
    --formal: #B397FF; --formal-ink: #B397FF; --formal-soft: rgba(179,151,255,.16);
    --coherence: #4FD9B3; --coherence-ink: #4FD9B3; --coherence-soft: rgba(79,217,179,.15);
    --weather: #FFC24D; --weather-ink: #FFC24D; --weather-soft: rgba(255,194,77,.15);
    --prefs: #FF8CC4; --prefs-ink: #FF8CC4; --prefs-soft: rgba(255,140,196,.15);
    --ok: #4FD9A0; --ok-ink: #4FD9A0; --ok-soft: rgba(79,217,160,.15);
    --warn: #E8B055; --warn-ink: #E8B055; --warn-soft: rgba(232,176,85,.15);
    --bad: #FF7A7E; --bad-ink: #FF9A9D; --bad-soft: rgba(255,122,126,.15);
    --info: #7C9BFF; --info-ink: #7C9BFF; --info-soft: rgba(124,155,255,.16);
    --navy: #0E0E10; --on-solid: #0B0B0C;
    --focus: #F5F5F2;
    --shadow-lg: 0 24px 60px -18px rgba(0,0,0,.85);
    --scrim: rgba(0,0,0,.7);
    --sw-edge: rgba(255,255,255,.2);
  }
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; font: 15px/1.55 var(--font); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--display); line-height: 1.08; letter-spacing: -.03em; font-weight: 750; }
h1 { font-size: clamp(2.2rem, 6vw, 3.9rem); font-weight: 800; letter-spacing: -.04em; line-height: 1; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); } h3 { font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em; }
h1 em, h2 em, h3 em, .serif { font-family: var(--serif); font-style: italic; font-weight: 500; letter-spacing: -.01em; }
p { margin: 0 0 .75em; }
a { color: inherit; text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
p a, .sub a, .hint a, .link { color: var(--brand-ink); text-decoration: underline; text-decoration-thickness: 1px; }
/* Two-layer focus ring: paper gap, then ink, visible on any surface. */
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, .mono { font-family: var(--mono); font-size: .86em; font-variant-numeric: normal; }
::selection { background: var(--brand); color: var(--on-brand); }
[hidden] { display: none !important; }
svg.i { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- editorial primitives ---- */
.eyebrow { font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-family: var(--font); }
.eyebrow.brand { color: var(--brand-ink); }
.display { font-family: var(--display); font-weight: 800; font-size: clamp(3.5rem, 13vw, 9rem); line-height: .88; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.display.md { font-size: clamp(2.6rem, 8vw, 5.5rem); } .display.sm { font-size: clamp(2rem, 5vw, 3.4rem); line-height: .95; letter-spacing: -.04em; }
.rule { height: 0; border: 0; border-top: 1px solid var(--line); margin: 0; }
.rule.thick { border-top: 2px solid var(--ink); }
/* A page's editorial title: eyebrow, giant headline, optional right-aligned action. */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 32px; padding-bottom: 8px; }
.page-head > :first-child { min-width: 0; flex: 1 1 340px; }
.page-head .eyebrow { display: block; margin-bottom: 14px; }
.page-head h1 { max-width: 16ch; }
.page-head .sub { color: var(--muted); margin-top: 14px; max-width: 58ch; font-size: 1.02rem; line-height: 1.5; }
.page-head .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.crumbs { font-size: .8rem; color: var(--muted); margin-bottom: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
/* Containers and the 12-column grid. */
.page { width: 100%; max-width: var(--page-w); margin: 0 auto; padding-inline: var(--gutter); }
.grid12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px 32px; }
.grid12 > * { min-width: 0; }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; } .col-9 { grid-column: span 9; } .col-12 { grid-column: 1 / -1; }
.start-2 { grid-column-start: 2; } .start-5 { grid-column-start: 5; } .start-7 { grid-column-start: 7; } .start-9 { grid-column-start: 9; }
@media (max-width: 860px) { .grid12 { gap: 20px; } .grid12 > [class*="col-"] { grid-column: 1 / -1; } .grid12 > [class*="start-"] { grid-column-start: auto; } }
/* A full-width swatch band: flat colour samples side by side; widths follow --w. */
.band { display: flex; height: var(--band-h, 44px); overflow: hidden; }
.band > * { flex: var(--w, 1) 1 0; min-width: 0; background: var(--sw, var(--bg-2)); }
.band.tall { --band-h: 88px; } .band.slim { --band-h: 14px; }
.band.bleed { width: 100vw; margin-inline: calc(50% - 50vw); }
/* An object card: a thing you could hold (a look, a piece, a check). */
.obj, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.obj.flush, .card.flush { padding: 0; overflow: hidden; }
.obj.hover, .card.hover { transition: border-color .15s; } .obj.hover:hover, .card.hover:hover { border-color: var(--ink); }
.card.tint { background: var(--bg-2); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head .sub { color: var(--muted); font-size: .86rem; margin-top: 2px; }
.card-head h2 { font-size: 1.15rem; }

/* ---- shell: slim top bar, no sidebar ---- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--bar-h); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding-inline: max(var(--gutter), calc((100vw - var(--page-w)) / 2 + var(--gutter)));
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 1.12rem; letter-spacing: -.035em; justify-self: start; }
.brand:hover { text-decoration: none; }
.brand-mark { display: block; width: 30px; height: 30px; border-radius: 22%; overflow: hidden; flex: none; }
.brand-mark img { width: 100%; height: 100%; display: block; }
.topnav { display: flex; align-self: stretch; gap: 4px; }
.topnav a { position: relative; display: flex; align-items: center; padding: 0 14px; font-size: .9rem; font-weight: 600; color: var(--muted); }
.topnav a:hover { color: var(--ink); text-decoration: none; }
.topnav a[aria-current="page"] { color: var(--ink); }
.topnav a[aria-current="page"]::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--brand); }
.topnav a:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); border-radius: 0; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; justify-self: end; }
.wallet-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); font-weight: 650; font-size: .82rem; }
.wallet-chip:hover { text-decoration: none; border-color: var(--ink); }
.wallet-chip .wl { font-weight: 500; }
.wallet-chip.low { border-color: var(--warn); color: var(--warn-ink); }
.user-menu { position: relative; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--ink); color: var(--bg); font-weight: 750; font-size: .8rem; letter-spacing: .02em; border: 0; cursor: pointer; }
.avatar:hover { background: var(--ink-2); }
.pop { position: absolute; right: 0; top: calc(100% + 10px); min-width: 230px; padding: 6px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 40; animation: pop .14s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.pop .who b { display: block; } .pop .who span { color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.pop a, .pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: var(--radius-sm); color: var(--ink); cursor: pointer; text-align: left; font-size: .92rem; }
.pop a:hover, .pop button:hover { background: var(--bg-2); text-decoration: none; }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { border-color: var(--ink); color: var(--ink); }
.main { padding: 48px var(--gutter) 112px; max-width: var(--page-w); width: 100%; margin: 0 auto; outline: none; }
#app { display: grid; gap: 56px; align-content: start; min-width: 0; }
#app > * { min-width: 0; }
.banner { display: flex; gap: 12px; align-items: center; padding: 9px 14px; border-radius: var(--radius-sm); margin-bottom: 28px; border: 1px solid var(--line-2); background: var(--bg-2); font-size: .9rem; }
.banner.warn { background: var(--warn-soft); border-color: var(--warn); }
.banner.bad { background: var(--bad-soft); border-color: var(--bad); }
.banner.info { background: var(--info-soft); border-color: var(--info); }
.banner.ok { background: var(--ok-soft); border-color: var(--ok); }
.banner .grow { flex: 1; min-width: 0; }
.alert { padding: 10px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface-2); font-size: .9rem; margin: 0; }
.alert.err { background: var(--bad-soft); border-color: var(--bad); color: var(--bad-ink); }
.alert.info { background: var(--info-soft); border-color: var(--info); }
.alert.ok { background: var(--ok-soft); border-color: var(--ok); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn); }
.tabbar, .more-sheet { display: none; }

/* ---- layout helpers ---- */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.stack { display: grid; gap: 22px; } .stack.sm { gap: 10px; }
.grid { display: grid; gap: 24px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: .84rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.pos { color: var(--ok-ink); } .neg-text { color: var(--bad-ink); }
.t-brand { color: var(--brand-ink); } .t-harmony { color: var(--harmony-ink); } .t-contrast { color: var(--contrast-ink); } .t-formal { color: var(--formal-ink); }
.t-coherence { color: var(--coherence-ink); } .t-weather { color: var(--weather-ink); } .t-prefs { color: var(--prefs-ink); }
.grow { flex: 1; min-width: 0; }
.sec-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 700; }

/* ---- KPI (legacy block, flat): a big number over a small label ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0; border-top: 1px solid var(--ink); }
.kpi { position: relative; padding: 18px 20px 18px 0; border: 0; border-radius: 0; background: none; container-type: inline-size; }
.kpi + .kpi { padding-left: 20px; border-left: 1px solid var(--line); }
.kpi .label { display: block; color: var(--muted); font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .value { font-family: var(--display); font-size: clamp(1.8rem, 16cqi, 3rem); font-weight: 800; letter-spacing: -.04em; margin-top: 8px; line-height: 1; white-space: nowrap; }
.kpi .value.text { font-size: 1.15rem; line-height: 1.25; white-space: normal; letter-spacing: -.01em; overflow-wrap: anywhere; font-weight: 700; }
.kpi .value small { font-size: .9rem; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi .foot { margin-top: 8px; font-size: .84rem; color: var(--muted); }
.callout { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--bg-2); border-left: 3px solid var(--brand); }
.callout .ic { display: grid; place-items: center; width: 34px; height: 34px; background: var(--ink); color: var(--bg); flex: none; border-radius: var(--radius-sm); }
.callout > div { min-width: 0; }

/* ---- controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: transparent; color: var(--ink); font-weight: 650; font-size: .92rem; cursor: pointer; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; line-height: 1.2;
}
.btn:hover { border-color: var(--ink); text-decoration: none; }
.btn.primary, .btn.ink { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover, .btn.ink:hover { background: var(--ink-2); border-color: var(--ink-2); color: var(--bg); }
/* The one vermilion button per view. */
.btn.cta { background: var(--brand); color: var(--on-brand); border-color: var(--brand); font-weight: 750; }
.btn.cta:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
.btn.danger { color: var(--bad-ink); border-color: var(--bad); } .btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; } .btn.ghost:hover { background: var(--bg-2); border-color: transparent; }
.btn.lg { padding: 14px 26px; font-size: 1.02rem; }
.btn.sm { padding: 6px 12px; font-size: .84rem; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label, .field > .lbl { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.field .hint { font-size: .82rem; color: var(--muted); } .field .err { font-size: .82rem; color: var(--bad-ink); min-height: 0; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); min-height: 42px; transition: border-color .15s;
}
.input::placeholder { color: var(--faint); }
textarea.input { min-height: 90px; resize: vertical; font-family: inherit; }
.input:hover { border-color: var(--faint); }
.input:focus { outline: none; border-color: var(--ink); box-shadow: var(--ring); }
.field.invalid .input { border-color: var(--bad); }
.input[type="color"] { padding: 2px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.switch { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 2px; background: var(--line-2); position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 1px; background: var(--bg); transition: transform .15s; }
.switch:checked { background: var(--ink); } .switch:checked::after { transform: translateX(18px); }
:root[data-theme="dark"] .switch::after { background: #0B0B0C; }
.switch:focus-visible { box-shadow: var(--ring); border-radius: 2px; }
.switch[disabled] { opacity: .5; cursor: not-allowed; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: none; padding: 7px 14px; cursor: pointer; color: var(--muted); font-weight: 650; font-size: .86rem; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; max-width: 100%; }
.tabs button { border: 0; background: none; padding: 10px 0; cursor: pointer; color: var(--muted); font-weight: 650; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--brand); }
/* Setting row: a sentence on the left, its control on the right. */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 0; border-top: 1px solid var(--line); }
.setting:first-of-type { border-top: 0; padding-top: 2px; }
.setting .txt { min-width: 0; } .setting .txt b { display: block; font-weight: 650; }
.setting .txt span { color: var(--muted); font-size: .88rem; }

/* ---- badges & chips ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--radius-xs); font-size: .68rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok-ink); } .badge.bad { background: var(--bad-soft); color: var(--bad-ink); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); } .badge.info { background: var(--info-soft); color: var(--info-ink); }
.badge.accent, .badge.brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge.harmony { background: var(--harmony-soft); color: var(--harmony-ink); } .badge.contrast { background: var(--contrast-soft); color: var(--contrast-ink); }
.badge.formal { background: var(--formal-soft); color: var(--formal-ink); } .badge.coherence { background: var(--coherence-soft); color: var(--coherence-ink); }
.badge.weather { background: var(--weather-soft); color: var(--weather-ink); } .badge.prefs { background: var(--prefs-soft); color: var(--prefs-ink); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-sm); background: var(--bg-2); font-size: .8rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.chip.brand { background: var(--brand-soft); color: var(--brand-ink); }
.chip.harmony { background: var(--harmony-soft); color: var(--harmony-ink); } .chip.contrast { background: var(--contrast-soft); color: var(--contrast-ink); }
.chip.formal { background: var(--formal-soft); color: var(--formal-ink); } .chip.coherence { background: var(--coherence-soft); color: var(--coherence-ink); }
.chip.weather { background: var(--weather-soft); color: var(--weather-ink); } .chip.prefs { background: var(--prefs-soft); color: var(--prefs-ink); }
.chip.garment { padding: 3px 10px 3px 4px; background: var(--surface); border: 1px solid var(--line-2); color: var(--ink); font-weight: 600; }
.chip.garment .swatch { --sw-size: 18px; }
.chip.garment:not(:has(.swatch)) { padding-left: 10px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: var(--radius-xs); font-size: .68rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; background: var(--bg-2); color: var(--ink-2); }

/* ---- the swatch: a fabric sample, flat, square-ish ---- */
.swatch { display: inline-block; flex: none; width: var(--sw-size, 28px); height: var(--sw-size, 28px); border-radius: var(--radius-xs); background: var(--sw, var(--bg-2)); box-shadow: inset 0 0 0 1px var(--sw-edge); }
.swatch.sm { --sw-size: 18px; } .swatch.lg { --sw-size: 44px; } .swatch.xl { --sw-size: 64px; }
.swatch.round { border-radius: 50%; }
.swatch-strip { display: flex; height: var(--strip-h, 40px); border-radius: var(--radius-xs); overflow: hidden; box-shadow: inset 0 0 0 1px var(--sw-edge); }
.swatch-strip > * { flex: var(--w, 1) 1 0; min-width: 0; background: var(--sw, var(--bg-2)); }
.swatch-strip.tall { --strip-h: 64px; } .swatch-strip.slim { --strip-h: 12px; }
.swatch-list { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch-list .sw { display: grid; gap: 6px; justify-items: center; font-size: .76rem; color: var(--muted); text-align: center; max-width: 72px; }
.swatch-list .sw .swatch { --sw-size: 48px; }

/* ---- score ring: SVG ring (circle with pathLength=100) ---- */
.score-ring { --size: 96px; --v: 0; --ring-c: var(--brand); position: relative; display: inline-grid; place-items: center; width: var(--size); height: var(--size); flex: none; }
.score-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .track { fill: none; stroke: var(--bg-2); stroke-width: 8; }
.score-ring .arc { fill: none; stroke: var(--ring-c); stroke-width: 8; stroke-linecap: butt; stroke-dasharray: var(--v) 100; transition: stroke-dasharray .9s cubic-bezier(.2,.8,.2,1); }
.score-ring .n { position: relative; font-family: var(--display); font-weight: 800; font-size: calc(var(--size) * .38); letter-spacing: -.05em; line-height: 1; }
.score-ring .n small { display: block; margin-top: 2px; font-family: var(--font); font-size: .62rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.score-ring.lg { --size: 140px; } .score-ring.sm { --size: 56px; } .score-ring.sm .n small { display: none; }
.score-ring.ok { --ring-c: var(--ok); } .score-ring.warn { --ring-c: var(--warn); } .score-ring.bad { --ring-c: var(--bad); }

/* ---- dimension bar: label, track, value; the colour is the dimension's ---- */
.dim-bar { --dim: var(--brand); display: grid; grid-template-columns: minmax(84px, 128px) minmax(0, 1fr) 2.6em; gap: 12px; align-items: center; font-size: .88rem; }
.dim-bar .name { display: flex; align-items: center; gap: 7px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.dim-bar .name::before { content: ""; width: 9px; height: 9px; border-radius: var(--radius-xs); background: var(--dim); flex: none; }
.dim-bar .track { height: 6px; border-radius: 0; background: var(--bg-2); overflow: hidden; }
.dim-bar .track > i { display: block; height: 100%; width: calc(var(--v, 0) * 1%); background: var(--dim); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.dim-bar .val { text-align: right; font-weight: 750; font-variant-numeric: tabular-nums; }
.dim-bar.na .track > i { width: 0; } .dim-bar.na .val { color: var(--faint); font-weight: 500; }
.dim-bar.harmony { --dim: var(--harmony); } .dim-bar.contrast { --dim: var(--contrast); } .dim-bar.formal { --dim: var(--formal); }
.dim-bar.coherence { --dim: var(--coherence); } .dim-bar.weather { --dim: var(--weather); } .dim-bar.prefs { --dim: var(--prefs); }

/* ---- photo drop zone ---- */
.photo-drop { display: grid; place-items: center; gap: 8px; text-align: center; min-height: 220px; padding: 28px 20px; border: 1px dashed var(--ink); border-radius: var(--radius);
  background: var(--surface-2); color: var(--muted); cursor: pointer; transition: background .15s; position: relative; }
.photo-drop:hover, .photo-drop.over { background: var(--bg-2); color: var(--ink-2); }
.photo-drop .big { display: grid; place-items: center; width: 52px; height: 52px; background: var(--ink); color: var(--bg); border-radius: var(--radius-sm); }
.photo-drop .big svg { width: 24px; height: 24px; }
.photo-drop b { color: var(--ink); font-weight: 700; }
.photo-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.photo-drop:focus-within { box-shadow: var(--ring); }
.photo-drop.filled { padding: 0; overflow: hidden; border-style: solid; }
.photo-drop img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---- numbered steps ---- */
.step-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: step; }
.step-list > li { counter-increment: step; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; align-items: start; }
.step-list > li::before { content: counter(step); display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--ink); border-radius: var(--radius-sm); font-weight: 800; font-family: var(--display); font-size: 1rem; }
.step-list > li b { display: block; margin-bottom: 2px; }
.step-list > li.done::before { content: "✓"; background: var(--ok-soft); color: var(--ok-ink); border-color: var(--ok); }
.step-list > li.now::before { background: var(--ink); color: var(--bg); }

/* ---- calendar grid (looks planner) ---- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dow { text-align: center; font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 4px 0; }
.cal .day { min-height: 76px; padding: 6px 7px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 4px; min-width: 0; text-align: left; font: inherit; color: inherit; }
button.cal .day, .cal button.day { cursor: pointer; } .cal button.day:hover { border-color: var(--ink); }
.cal .day .d { font-size: .78rem; font-weight: 700; color: var(--muted); }
.cal .day.other { background: transparent; border-style: dashed; opacity: .6; }
.cal .day.today { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); } .cal .day.today .d { color: var(--ink); }
.cal .day.has { background: var(--bg-2); }

/* ---- tables: hairlines, small caps heads, no zebra ---- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; font-weight: 700; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--ink); white-space: nowrap; background: transparent; }
table.t th:first-child, table.t td:first-child { padding-left: 0; } table.t th:last-child, table.t td:last-child { padding-right: 0; }
table.t th.sortable { cursor: pointer; user-select: none; } table.t th.sortable:hover { color: var(--ink); }
table.t th[aria-sort="ascending"]::after { content: " ↑"; } table.t th[aria-sort="descending"]::after { content: " ↓"; }
table.t td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.clickable { cursor: pointer; } table.t tbody tr:hover { background: var(--bg-2); }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: left; padding: 40px 0; color: var(--muted); }
.empty .big { width: 48px; height: 48px; margin: 0 0 16px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: var(--radius-sm); color: var(--ink); }
.empty .big svg { width: 24px; height: 24px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; font-size: 1.4rem; font-weight: 800; letter-spacing: -.035em; }
.empty p { max-width: 44ch; margin: 0 0 14px; }
.pagebar { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }

/* ---- skeleton ---- */
.skel { position: relative; overflow: hidden; border-radius: var(--radius-xs); background: var(--bg-2); min-height: 14px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel.chart { height: 260px; } .skel.line { height: 14px; margin: 8px 0; } .skel.kpi-s { height: 96px; }
.skel.title { height: 56px; width: min(420px, 70%); }

/* ---- toasts & dialogs ---- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 90; max-width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--ink); color: var(--bg); animation: toast-in .22s ease-out; border-left: 4px solid var(--info); font-size: .9rem; }
.toast a { color: inherit; text-decoration: underline; }
.toast.ok { border-left-color: var(--ok); } .toast.bad { border-left-color: var(--bad); } .toast.warn { border-left-color: var(--warn); }
.toast .body { flex: 1; min-width: 0; overflow-wrap: anywhere; } .toast .x { border: 0; background: none; cursor: pointer; color: inherit; opacity: .7; line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
.scrim { position: fixed; inset: 0; z-index: 80; background: var(--scrim); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.dialog { width: min(540px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 24px; animation: pop .18s ease-out; }
.dialog.wide { width: min(760px, 100%); }
.dialog h2 { margin-bottom: 6px; font-size: 1.5rem; font-weight: 800; letter-spacing: -.035em; } .dialog .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.dialog .err { color: var(--bad-ink); font-size: .86rem; }

/* ---- code ---- */
pre.code { margin: 0; padding: 14px 16px; border-radius: var(--radius-sm); background: #0E0E10; color: #E8E8E4; overflow-x: auto; line-height: 1.55; border: 1px solid #2A2A2E; max-width: 100%; }
.codebox { position: relative; min-width: 0; } .codebox .copy { position: absolute; top: 8px; right: 8px; }
.secret, .secret-box { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px dashed var(--ink); font-family: var(--mono); overflow-wrap: anywhere; }

/* ---- legends and charts (chart code owns the drawing; these are shared) ---- */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: var(--radius-xs); margin-right: 6px; vertical-align: -1px; }
.legend i.brand { background: var(--brand); } .legend i.harmony { background: var(--harmony); } .legend i.contrast { background: var(--contrast); } .legend i.formal { background: var(--formal); }
.legend i.coherence { background: var(--coherence); } .legend i.weather { background: var(--weather); } .legend i.prefs { background: var(--prefs); }
.chart { position: relative; width: 100%; min-height: 120px; }
.chart svg { display: block; overflow: visible; max-width: 100%; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis-line { stroke: var(--ink); shape-rendering: crispEdges; }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; opacity: .55; pointer-events: none; }
.chart .bar { transition: opacity .15s; } .chart .bar.dim { opacity: .45; }
.chart-tip { position: absolute; pointer-events: none; z-index: 5; min-width: 130px; max-width: 260px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: .8rem; background: var(--ink); color: var(--bg); opacity: 0; transition: opacity .1s; transform: translateY(-6px); }
.chart-tip.on { opacity: 1; } .chart-tip b { display: block; margin-bottom: 3px; }
.chart-tip .tr { display: flex; justify-content: space-between; gap: 14px; } .chart-tip .tr i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; }
.chart-msg { display: grid; place-items: center; text-align: center; color: var(--muted); min-height: 140px; padding: 20px; }
.meter { height: 6px; background: var(--bg-2); overflow: hidden; } .meter > i { display: block; height: 100%; background: var(--ink); transition: width .5s; }
.timeline { display: grid; gap: 10px; } .tl { display: grid; grid-template-columns: 12px 1fr; gap: 12px; } .tl .dot { width: 8px; height: 8px; background: var(--ink); margin-top: 7px; }

/* ---- list rows ---- */
.rows { display: grid; border-top: 1px solid var(--ink); }
.rows > .r { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); min-width: 0; }
.rows > .r:first-child { border-top: 0; }
.rows .r .grow b { display: block; font-weight: 650; overflow-wrap: anywhere; } .rows .r .grow span { color: var(--muted); font-size: .86rem; }
/* Toggle chips (colour families): a flat swatch and a name, pressed = chosen. */
.pick-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { display: inline-flex; align-items: center; gap: 9px; padding: 5px 13px 5px 5px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: .88rem; cursor: pointer; transition: border-color .15s, background .15s; }
.pick .swatch { --sw-size: 24px; }
.pick:hover { border-color: var(--ink); }
.pick[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.pick.avoid[aria-pressed="true"] { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-ink); box-shadow: none; }
.pick.avoid[aria-pressed="true"] span:last-child { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.pick[disabled] { opacity: .5; cursor: progress; }

/* ---- motion & responsive ---- */
.fade-in { animation: fade-up .35s ease-out both; }
.settled .fade-in { animation: none; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }
@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 (max-width: 1100px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1000px) { .topnav a { padding: 0 9px; } .topnav a[aria-current="page"]::after { left: 9px; right: 9px; } .wallet-chip .wl { display: none; } }

/* Phone and small tablet <= 860: bottom tab bar, "More" sheet. */
@media (max-width: 860px) {
  :root { --gutter: 18px; --bar-h: 56px; }
  .topbar { grid-template-columns: 1fr auto; }
  .topnav, .top-cta { display: none; }
  .main { padding-top: 28px; padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  #app { gap: 40px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0, 1fr); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; align-items: end;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
  .tabbar a, .tabbar button { position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; padding: 7px 2px 5px; border: 0; background: none;
    color: var(--muted); font: inherit; font-size: .66rem; font-weight: 650; cursor: pointer; min-height: 50px; letter-spacing: .01em; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"], .tabbar button.current, .tabbar button[aria-expanded="true"] { color: var(--ink); }
  .tabbar a[aria-current="page"]::before, .tabbar button.current::before { content: ""; position: absolute; top: -7px; left: 28%; right: 28%; height: 2px; background: var(--brand); }
  /* The one action sits raised in the middle of the bar. */
  .tabbar a.tab-check { color: var(--ink); }
  .tabbar a.tab-check svg { width: 52px; height: 52px; padding: 14px; border-radius: 50%; background: var(--brand); color: var(--on-brand); margin-top: -26px; box-shadow: 0 0 0 5px var(--bg); }
  .tabbar a.tab-check::before { display: none; }
  .toasts { bottom: calc(86px + env(safe-area-inset-bottom)); left: 12px; right: 12px; max-width: none; }
  .more-sheet.open { display: grid; }
  /* 16px stops iOS zooming into a field on focus. */
  input.input, select.input, textarea.input, .input { font-size: 16px; }
  .btn, .icon-btn { min-height: 40px; }
  .tabs { margin-left: calc(var(--gutter) * -1); margin-right: calc(var(--gutter) * -1); padding: 0 var(--gutter); scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .kpi { padding-right: 12px; } .kpi + .kpi { padding-left: 14px; }
}
@media (max-width: 640px) {
  .page-head > :not(:first-child) { width: 100%; }
  .seg { width: 100%; } .seg button { flex: 1; }
  /* Dialogs become bottom sheets, with the actions always in reach. */
  .scrim { place-items: end center; padding: 0; }
  .dialog, .dialog.wide { width: 100%; max-height: 92vh; border-radius: var(--radius) var(--radius) 0 0; padding: 22px 18px calc(16px + env(safe-area-inset-bottom)); animation: sheet .22s ease-out; border-bottom: 0; }
  .dialog .actions { position: sticky; bottom: -16px; margin: 18px -18px -16px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .dialog .actions .btn { flex: 1; justify-content: center; }
  /* Wide tables become one block per row: label on the left, value on the right. */
  table.t.stackable thead { display: none; }
  table.t.stackable, table.t.stackable tbody, table.t.stackable tr, table.t.stackable td { display: block; width: 100%; }
  table.t.stackable tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.t.stackable tr:last-child { border-bottom: 0; }
  table.t.stackable tbody tr:hover { background: none; }
  table.t.stackable td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 5px 0; border: 0; text-align: right; }
  table.t.stackable td::before { content: attr(data-label); flex: none; text-align: left; color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
  table.t.stackable td:first-child { display: block; text-align: left; font-size: .98rem; padding-bottom: 8px; }
  table.t.stackable td:first-child::before, table.t.stackable td.td-actions::before { display: none; }
  table.t.stackable td.td-actions { justify-content: flex-end; padding-top: 8px; }
  .cal { gap: 4px; } .cal .day { min-height: 60px; padding: 4px 5px; }
  .dim-bar { grid-template-columns: minmax(70px, 100px) minmax(0, 1fr) 2.4em; gap: 8px; }
  .page-head h1 { max-width: none; }
}
@keyframes sheet { from { transform: translateY(30px); opacity: 0; } }
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr 1fr; } .kpis > :first-child:nth-last-child(odd) { grid-column: 1 / -1; }
  .kpi:nth-child(odd) { padding-left: 0; border-left: 0; }
  .card, .obj { padding: 16px; }
  .wallet-chip { padding: 5px 8px; }
  .setting { gap: 14px; }
}
@media print { .topbar, .toasts, .tabbar, .more-sheet { display: none !important; } body { background: #fff; color: #000; } }

/* ---- the More sheet (phone): secondary places, theme, sign out ---- */
.more-sheet { position: fixed; inset: 0; z-index: 70; background: var(--scrim); align-items: end; }
.more-sheet .sheet { background: var(--surface); border-top: 1px solid var(--line-2); border-radius: var(--radius) var(--radius) 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); animation: sheet .22s ease-out; }
.more-sheet .sheet .eyebrow { display: block; margin-bottom: 8px; }
.more-sheet a, .more-sheet button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 15px 2px; border: 0; border-top: 1px solid var(--line); background: none; font-size: 1.05rem; font-weight: 650; color: var(--ink); cursor: pointer; text-align: left; font-family: var(--display); letter-spacing: -.02em; }
.more-sheet a:first-of-type { border-top: 1px solid var(--ink); }
.more-sheet a:hover, .more-sheet button:hover { text-decoration: none; background: var(--bg-2); }

/* ---- public error page ---- */
.err-page { min-height: 100vh; display: grid; align-content: space-between; background: var(--navy); color: #F5F5F2; }
.err-page .err-in { padding: clamp(28px, 6vw, 72px); display: grid; gap: 22px; align-content: center; max-width: 920px; }
.err-page .brand { color: #F5F5F2; margin-bottom: clamp(24px, 8vh, 80px); }
.err-page h1 { color: #F5F5F2; max-width: 14ch; }
.err-page .eyebrow { color: #A0A0A8; }
.err-page p { margin: 0; color: #C9C9CE; max-width: 52ch; font-size: 1.05rem; }
.err-page .band { margin-top: 8px; }
.err-page .btn.cta { justify-self: start; }
/* Team join page: the form on paper, centred (teamauth.js draws it). */
.auth { border-top: 3px solid var(--ink); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-family: var(--display); font-weight: 800; font-size: 1.2rem; letter-spacing: -.035em; }
.auth-brand img { width: 32px; height: 32px; border-radius: 22%; }
.auth h1 { font-size: 2rem; }
.auth .foot { color: var(--muted); }

/* ---- editorial sections (usage, settings): a heavy rule, a title, then the body ---- */
.sect { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px 32px; border-top: 2px solid var(--ink); padding-top: 22px; }
.sect > * { min-width: 0; }
.sect-head { grid-column: span 4; }
.sect-head h2 { margin-bottom: 8px; }
.sect-head .sub, .sect-head p { color: var(--muted); font-size: .94rem; max-width: 34ch; margin: 0; }
.sect-body { grid-column: span 8; display: grid; gap: 22px; align-content: start; }
.sect.full .sect-head, .sect.full .sect-body { grid-column: 1 / -1; }
@media (max-width: 860px) { .sect { gap: 16px; } .sect-head, .sect-body { grid-column: 1 / -1; } .sect-head .sub, .sect-head p { max-width: none; } }
/* Facts: label left, value right, hairlines between. */
.facts { margin: 0; display: grid; border-top: 1px solid var(--line); }
.facts > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: .86rem; } .facts dd { margin: 0; font-weight: 650; text-align: right; overflow-wrap: anywhere; }
.u-hero { align-items: start; }
.u-hero .display { color: var(--ink); }
.u-cap { margin: 14px 0 0; font-size: 1.05rem; color: var(--muted); max-width: 30ch; }
.u-explain { font-size: 1.05rem; line-height: 1.55; color: var(--ink-2); margin: 0; }

/* ---- public bar (landing): wordmark left, quiet sign-in right ---- */
.pubbar { position: absolute; z-index: 20; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; height: var(--bar-h);
  padding: env(safe-area-inset-top) max(var(--gutter), calc((100vw - var(--page-w)) / 2 + var(--gutter))) 0; color: #F5F5F2; }
.pubbar .brand { color: #F5F5F2; }
.pubbar-actions { display: flex; align-items: center; gap: 14px; }
.pub-link { font-weight: 650; font-size: .9rem; color: #F5F5F2; }
.pubbar .icon-btn { color: #F5F5F2; border-color: rgba(255,255,255,.28); }

/* ---- app feel ---- */
html { -webkit-tap-highlight-color: transparent; }
.topbar, .tabbar, .more-sheet, .btn, .seg, .tabs { -webkit-user-select: none; user-select: none; }
.topbar { padding-top: env(safe-area-inset-top); height: calc(var(--bar-h) + env(safe-area-inset-top)); }
.btn:active, .icon-btn:active, .avatar:active { transform: scale(.97); opacity: .85; }
.tabbar a:active, .tabbar button:active, .more-sheet a:active, .more-sheet button:active { opacity: .55; transform: scale(.95); }
@media (max-width: 860px) { .tabbar a, .tabbar button { min-height: 48px; min-width: 44px; } }
.sect-act { margin-top: 16px; }
.key-ic { display: grid; place-items: center; background: var(--bg-2); color: var(--ink); }
.sect .setting:first-child { padding-top: 0; }

/* One vermilion action per screen: on the pages that carry their own primary action (the analyze page's
   "Check this outfit", the result page's "Save look") the top bar's shortcut steps aside. */
body[data-page="analyze"] .topbar .btn.cta,
body[data-page="analysis"] .topbar .btn.cta{display:none}

/* =====================================================================================================
   TAILORING MOTIFS (design kit). Tokens only, light and dark, static, no external assets.
   stitch, stitch-box, tag, chip-card, woven, stamp, grain, reveal, stagger, loupe. See docs/UI.md.
   ===================================================================================================== */

/* .stitch / .rule.stitch: a running-stitch divider, 2px dashes with round caps, offset like thread. */
.stitch, .rule.stitch { display: block; height: 2px; border: 0; margin: 0; border-radius: 2px; background: repeating-linear-gradient(90deg, var(--line-2) 0 9px, transparent 9px 14px); background-position: 4px 0; }
.stitch.ink { background-image: repeating-linear-gradient(90deg, var(--ink) 0 9px, transparent 9px 14px); }
.stitch.brand { background-image: repeating-linear-gradient(90deg, var(--brand) 0 9px, transparent 9px 14px); }

/* .stitch-box: a stitched border inside an object, like a sewn-on patch. Needs no wrapper. */
.stitch-box { position: relative; }
.stitch-box::after, .dialog::after, .pop::after { content: ""; position: absolute; inset: 6px; border: 1.5px dashed var(--line-2); border-radius: 6px; pointer-events: none; }
.dialog { position: relative; }
.pop > * { position: relative; z-index: 1; }

/* .tag: a hang-tag with one cut corner, a punched hole and a short string. Variants .tag.ink, .tag.brand. */
.tag { --hole: var(--bg); position: relative; display: inline-flex; align-items: center; min-height: 22px; padding: 3px 10px 3px 25px; border-radius: 0; font-size: .66rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; line-height: 1;
  background: var(--bg-2); color: var(--ink-2); white-space: nowrap; clip-path: polygon(11px 0, 100% 0, 100% 100%, 0 100%, 0 11px); }
.tag::before { content: ""; position: absolute; left: 9px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--hole); box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 40%, transparent); }
.tag::after { content: ""; position: absolute; left: 1px; top: 4px; width: 11px; height: 1px; background: currentColor; opacity: .5; transform: rotate(-38deg); transform-origin: left center; }
.tag.ink { background: var(--ink); color: var(--bg); --hole: var(--bg); }
.tag.brand { background: var(--brand); color: var(--on-brand); --hole: var(--bg); }

/* .chip-card: a Pantone-style swatch card. Set --c on it. Children: .cc-field, .cc-name, .cc-hex, .cc-lab. Sizes .sm .lg. */
.chip-card { --c: var(--bg-2); --cc-h: 96px; display: grid; gap: 3px; align-content: start; min-width: 0; padding: 8px 8px 10px; background: var(--surface); border: 1px solid var(--line); border-bottom: 2px solid var(--ink); border-radius: 2px; color: var(--ink); }
.chip-card .cc-field { height: var(--cc-h); border-radius: 1px; background: var(--c); box-shadow: inset 0 0 0 1px var(--sw-edge); margin-bottom: 8px; }
.chip-card .cc-name { font-family: var(--display); font-weight: 800; font-size: .92rem; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.chip-card .cc-hex, .chip-card .cc-lab { font-family: var(--mono); font-size: .66rem; color: var(--muted); letter-spacing: .02em; text-transform: uppercase; font-variant-numeric: normal; }
.chip-card.sm { --cc-h: 52px; padding: 6px 6px 8px; } .chip-card.sm .cc-name { font-size: .8rem; } .chip-card.sm .cc-lab { display: none; }
.chip-card.lg { --cc-h: 156px; padding: 10px 10px 12px; } .chip-card.lg .cc-name { font-size: 1.15rem; }

/* .woven: a woven care-label score. Put the numeral inside, then <small>Out of 100</small>. .woven.sm is the small one. */
.woven { display: inline-grid; justify-items: center; align-content: center; gap: 8px; width: 92px; padding: 30px 8px; background-color: var(--ink); color: var(--bg);
  background-image: repeating-linear-gradient(0deg, color-mix(in srgb, var(--bg) 9%, transparent) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, color-mix(in srgb, var(--bg) 6%, transparent) 0 1px, transparent 1px 3px);
  font-family: var(--display); font-weight: 800; font-size: 3rem; line-height: .9; letter-spacing: -.06em; text-align: center;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 10px 52% repeat-x, conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / 10px 52% repeat-x;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 10px 52% repeat-x, conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / 10px 52% repeat-x; }
.woven small { font: 700 .5rem/1.2 var(--font); letter-spacing: .2em; text-transform: uppercase; opacity: .8; }
.woven.sm { width: 58px; padding: 22px 5px; font-size: 1.7rem; gap: 5px; } .woven.sm small { display: none; }

/* .stamp: a quality-control rubber stamp, rotated, double-bordered, vermilion. .stamp.in plays a one-time thud-in. */
.stamp { display: inline-block; padding: 7px 14px; color: var(--brand-ink); border: 3px solid currentColor; border-radius: 8px; outline: 1.5px solid currentColor; outline-offset: 3px;
  font: 800 .78rem/1.2 var(--display); letter-spacing: .2em; text-transform: uppercase; transform: rotate(-6deg); opacity: .94; white-space: nowrap; }
.stamp.in { animation: stamp-in .55s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes stamp-in { from { transform: rotate(-6deg) scale(1.6); opacity: 0; } 55% { opacity: .94; } to { transform: rotate(-6deg) scale(1); opacity: .94; } }

/* .grain: static paper grain behind the content (also on body in the shell). Subtle, no animation. */
.grain { position: relative; isolation: isolate; }
.grain::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .05; mix-blend-mode: multiply;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1.1 -.1'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
body.grain::before { position: fixed; }
:root[data-theme="dark"] .grain::before, .grain.dark::before { mix-blend-mode: screen; filter: invert(1); opacity: .045; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .grain::before { mix-blend-mode: screen; filter: invert(1); opacity: .045; } }

/* .reveal: fade and rise 12px once as it scrolls into view (CSS scroll timeline where supported, visible otherwise). */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@supports (animation-timeline: view()) {
  .reveal { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 35%; }
}
/* .stagger > *: children rise in 40ms apart (first twelve). */
.stagger > * { animation: rise .5s ease-out both; animation-delay: calc(var(--i, 0) * 40ms); }
.stagger > :nth-child(1) { --i: 0; } .stagger > :nth-child(2) { --i: 1; } .stagger > :nth-child(3) { --i: 2; } .stagger > :nth-child(4) { --i: 3; }
.stagger > :nth-child(5) { --i: 4; } .stagger > :nth-child(6) { --i: 5; } .stagger > :nth-child(7) { --i: 6; } .stagger > :nth-child(8) { --i: 7; }
.stagger > :nth-child(9) { --i: 8; } .stagger > :nth-child(10) { --i: 9; } .stagger > :nth-child(11) { --i: 10; } .stagger > :nth-child(12) { --i: 11; }
@media (prefers-reduced-motion: reduce) { .reveal, .stagger > *, .stamp.in { animation: none !important; opacity: 1; } .stamp.in { opacity: .94; } }

/* .loupe: a 96px measuring lens with a crosshair and a name+hex pill (.loupe > .pill). Position with transform in JS. */
.loupe { position: absolute; left: 0; top: 0; width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: 50%; pointer-events: none; z-index: 5;
  border: 2px solid var(--ink); box-shadow: 0 0 0 1.5px rgba(255,255,255,.75), 0 12px 32px rgba(0,0,0,.32), inset 0 0 0 1px rgba(255,255,255,.25); }
.loupe::before, .loupe::after { content: ""; position: absolute; left: 50%; top: 50%; background: var(--ink); box-shadow: 0 0 0 .5px rgba(255,255,255,.7); }
.loupe::before { width: 14px; height: 1px; margin: 0 0 0 -7px; } .loupe::after { width: 1px; height: 14px; margin: -7px 0 0 0; }
.loupe .pill { position: absolute; left: 50%; top: calc(100% + 10px); transform: translateX(-50%); display: inline-flex; gap: 8px; align-items: center; padding: 4px 10px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font: 700 .72rem/1.2 var(--font); white-space: nowrap; }
.loupe .pill .mono { opacity: .75; font-weight: 500; }

/* ---- shell elevation ---- */
/* The wordmark: bold grotesque with an italic serif tail (StyleScore). */
.brand .wm em { font-family: var(--serif); font-style: italic; font-weight: 500; letter-spacing: -.01em; }
/* The top bar gains a stitched edge once the page scrolls (class set by app.js). */
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 2px; opacity: 0; transition: opacity .2s; pointer-events: none;
  background: repeating-linear-gradient(90deg, var(--line-2) 0 9px, transparent 9px 14px); background-position: 4px 0; }
.topbar.scrolled::after { opacity: 1; }
/* The active link hangs a tiny tag from the bar. */
.topnav a[aria-current="page"]::after { left: 50%; right: auto; bottom: -11px; width: 24px; height: 11px; margin-left: -12px; z-index: 2;
  clip-path: polygon(0 100%, 0 30%, 18% 0, 82% 0, 100% 30%, 100% 100%); background: radial-gradient(circle at 50% 42%, var(--bg) 0 1.7px, transparent 2px), var(--brand); }
/* Empty states: a stitched outline with the hanger glyph. */
.empty { padding: 40px 28px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); }
.empty .big { border: 0; background: var(--bg-2); }
.stitch-box > .skip, .banner { position: relative; }
