/* BenjiHealth — same look as BenjiGarage / BenjiRoute 2.12: Benjiverse colours, dark always, Sora (self-hosted at fonts/). Mobile first. Base copied from BenjiGarage 1.0 app.css. */

:root {
  /* Benjiverse tokens (match benjiverse.app) */
  /* palette (Me > Appearance > Colours): the teal values below are the default; :root[data-palette] blocks further down override only these --pal-* tokens.
     d = on the dark theme, l = on the light theme. Status colours (good, bad, amber, over-target, calendar states) never come from a palette. */
  --pal-accent-d: #5eead4; --pal-accent-l: #0b7490;
  --pal-viz-d: #1ea5bb; --pal-viz-l: #0891b2;
  --pal-rgb-d: 94, 234, 212; --pal-rgb-l: 8, 145, 178;
  --pal-g1: #5eead4; --pal-g2: #22b8cf; --pal-on: #06202b;
  --void: #070f26;
  --color-bg-top: #0b1736;
  --color-bg-mid: #0b2244;
  --color-bg-bottom: #0a3340;
  --surface: rgba(19, 34, 67, 0.78);
  --surface-hover: #1b2f5a;
  --border: #28406e;
  --ink: #f4f6fb;
  --muted: #9fb2d4;
  --accent-soft: var(--pal-accent-d);
  --blue: #0e7490;
  --blue-bright: var(--pal-g2);
  --ui-gradient: linear-gradient(135deg, var(--pal-g1) 0%, var(--pal-g2) 100%); /* palette gradient: dark --pal-on text on it keeps AA (7:1) in every palette, both modes */
  --accent-gradient: var(--ui-gradient);
  --navy-glow: #1d4f91;
  --nebula-violet: #5b3fd0;
  --nebula-magenta: #b0409a;
  --starlight: #ffe9c4;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --sans: "Sora", system-ui, sans-serif;
  --mono: var(--sans);          /* numbers use Sora with tabular figures, no mono face */

  /* app aliases */
  --bg: #0b1736;
  --panel: #0f1d3f;            /* solid stand-in for --surface over the page gradient */
  --raise: #162a54;            /* inputs / chips on a panel */
  --text: var(--ink);
  --line: var(--border);
  --accent: var(--accent-soft);
  --on-accent: var(--pal-on);
  --focus: var(--pal-accent-d);
  --good: #4ade80;
  --bad: #ff8d93;
  --amber: #fbbf24;
  --c-ok: #3ddc84;
  --c-slow: #ffb020;
  --c-heavy: #ff4d5a;
  --c-closed: #1b1030;
  --c-minor: #8499bf;
  --halo: #070f26;
  --gutter: 14px;
  --tap: 44px;
  --field: #070f26;             /* input background */
  --btn-bg: transparent;
  --tab-bg: rgba(11, 23, 54, 0.94);
  --shadow: rgba(0, 0, 0, 0.6);
  --warn-bg: #3d2c05; --warn-ink: #ffe2a0;
  --err-bg: #4a1220; --err-ink: #ffd6db;
  --note-bg: #2c2268; --note-ink: #ffe9c4;
  /* chart colours: one teal for the data, amber for the goal / "over target" (checked with the dataviz validator: dark ΔE 19+, light ΔE 20+) */
  --viz-line: var(--pal-viz-d); --viz-over: #c98500; --viz-goal: #c98500;
  --viz-grid: rgba(159, 178, 212, 0.16); --viz-axis: rgba(159, 178, 212, 0.45); --viz-tick: #9fb2d4; --viz-ring: #0f1d3f;
  --st-on: #3ddc84; --st-low: #8499bf; --st-over: #ffb020;
  /* accent-derived tokens: change --accent-rgb (palettes / light mode) and the tints follow */
  --accent-rgb: var(--pal-rgb-d);
  --primary-shadow: 0 8px 30px -8px rgba(var(--accent-rgb), 0.45);
  --primary-shadow-hover: 0 10px 36px -6px rgba(var(--accent-rgb), 0.65);
  --switch-knob: var(--muted);
  --tab-sel-bg: rgba(var(--accent-rgb), 0.1);
  --chip-sel-bg: rgba(var(--accent-rgb), 0.12);
  --picker-filter: invert(0.85);
  color-scheme: dark;
}
:root[data-theme="dark"] { color-scheme: dark; }
/* light mode: tokens only. The two blocks below are identical (system light unless the user forced dark, and forced light) — keep them in sync (a test checks). */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --void: #eef3fb; --color-bg-top: #f6f9fe; --color-bg-mid: #edf3fb; --color-bg-bottom: #e4f1f3;
    --surface: rgba(255, 255, 255, 0.92); --surface-hover: #e1eaf7; --border: #b6c5de;
    --ink: #0b1736; --muted: #475a7d; --accent-soft: var(--pal-accent-l); --blue-bright: var(--pal-viz-l);
    --bg: #f6f9fe; --panel: #ffffff; --raise: #e4ecf8; --focus: var(--pal-accent-l);
    --good: #157a3b; --bad: #b42336; --amber: #a64b09; --starlight: #3b2a00;
    --field: #ffffff; --btn-bg: rgba(255, 255, 255, 0.8); --tab-bg: rgba(255, 255, 255, 0.96); --shadow: rgba(11, 23, 54, 0.22);
    --warn-bg: #fff1cc; --warn-ink: #4d3500; --err-bg: #fde3e7; --err-ink: #6a1020; --note-bg: #e7e2fb; --note-ink: #2c2268;
    --viz-line: var(--pal-viz-l); --viz-over: #b45309; --viz-goal: #b45309;
    --viz-grid: rgba(71, 90, 125, 0.16); --viz-axis: rgba(71, 90, 125, 0.5); --viz-tick: #475a7d; --viz-ring: #ffffff;
    --st-on: #157a3b; --st-low: #5b6f93; --st-over: #b45309;
    --accent-rgb: var(--pal-rgb-l); --primary-shadow: 0 8px 24px -10px rgba(var(--accent-rgb), 0.6);
    --switch-knob: #5b6f93; --picker-filter: none;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --void: #eef3fb; --color-bg-top: #f6f9fe; --color-bg-mid: #edf3fb; --color-bg-bottom: #e4f1f3;
  --surface: rgba(255, 255, 255, 0.92); --surface-hover: #e1eaf7; --border: #b6c5de;
  --ink: #0b1736; --muted: #475a7d; --accent-soft: var(--pal-accent-l); --blue-bright: var(--pal-viz-l);
  --bg: #f6f9fe; --panel: #ffffff; --raise: #e4ecf8; --focus: var(--pal-accent-l);
  --good: #157a3b; --bad: #b42336; --amber: #a64b09; --starlight: #3b2a00;
  --field: #ffffff; --btn-bg: rgba(255, 255, 255, 0.8); --tab-bg: rgba(255, 255, 255, 0.96); --shadow: rgba(11, 23, 54, 0.22);
  --warn-bg: #fff1cc; --warn-ink: #4d3500; --err-bg: #fde3e7; --err-ink: #6a1020; --note-bg: #e7e2fb; --note-ink: #2c2268;
  --viz-line: var(--pal-viz-l); --viz-over: #b45309; --viz-goal: #b45309;
  --viz-grid: rgba(71, 90, 125, 0.16); --viz-axis: rgba(71, 90, 125, 0.5); --viz-tick: #475a7d; --viz-ring: #ffffff;
  --st-on: #157a3b; --st-low: #5b6f93; --st-over: #b45309;
  --accent-rgb: var(--pal-rgb-l); --primary-shadow: 0 8px 24px -10px rgba(var(--accent-rgb), 0.6);
  --switch-knob: #5b6f93; --picker-filter: none;
  color-scheme: light;
}

/* palettes (teal is the default, set on :root above) */
:root[data-palette="ocean"] { --pal-accent-d: #7cc4ff; --pal-accent-l: #1d5fc4; --pal-viz-d: #3b8cf0; --pal-viz-l: #2563eb; --pal-rgb-d: 124, 196, 255; --pal-rgb-l: 37, 99, 235; --pal-g1: #93c5fd; --pal-g2: #60a5fa; --pal-on: #061a33; }
:root[data-palette="nebula"] { --pal-accent-d: #c4b5fd; --pal-accent-l: #6d28d9; --pal-viz-d: #8b6cf6; --pal-viz-l: #7c3aed; --pal-rgb-d: 196, 181, 253; --pal-rgb-l: 124, 58, 237; --pal-g1: #c4b5fd; --pal-g2: #a78bfa; --pal-on: #1a0f3d; }
:root[data-palette="berry"] { --pal-accent-d: #f9a8d4; --pal-accent-l: #be185d; --pal-viz-d: #e0559e; --pal-viz-l: #db2777; --pal-rgb-d: 249, 168, 212; --pal-rgb-l: 219, 39, 119; --pal-g1: #f9a8d4; --pal-g2: #f472b6; --pal-on: #3a0a24; }
:root[data-palette="moonlight"] { --pal-accent-d: #cbd5e1; --pal-accent-l: #334155; --pal-viz-d: #8fa3c2; --pal-viz-l: #475569; --pal-rgb-d: 203, 213, 225; --pal-rgb-l: 71, 85, 105; --pal-g1: #e2e8f0; --pal-g2: #a5b4c8; --pal-on: #0b1736; }

*, *::before, *::after { box-sizing: border-box; }
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;             /* a scrolling page (not BenjiRoute's fixed map screen), so the sticky header works */
  overflow-x: hidden;
  background-color: var(--void);
  color: var(--ink);
  font: 400 16px/1.45 var(--sans);
  -webkit-text-size-adjust: 100%;
  font-variant-numeric: tabular-nums;
}
body { background-image: linear-gradient(180deg, var(--color-bg-top) 0%, var(--color-bg-mid) 45%, var(--color-bg-bottom) 100%); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
h1, h2, h3 { margin: 0; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; text-wrap: balance; }
h1 em { font-style: normal; color: var(--accent-soft); }
p { margin: 0; }
a { color: var(--accent-soft); }

/* ---------- shared controls (16px inputs: no iOS focus zoom) ---------- */
input[type="text"], input[type="password"], input[type="search"], input[type="tel"], input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}
input[type="text"]:focus-visible, input[type="password"]:focus-visible, input[type="search"]:focus-visible, input[type="tel"]:focus-visible, input[type="date"]:focus-visible, input[type="number"]:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent-soft); outline-offset: 1px; }
/* iOS Safari: date inputs ignore min-height/padding unless appearance is reset, and render a taller, centred value */
input[type="date"] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; line-height: 1.2; text-align: left; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; min-height: 1.2em; margin: 0; }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.8; filter: var(--picker-filter); }
input::placeholder { color: var(--muted); opacity: 1; }
.btn {
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.3s var(--ease), background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.6; cursor: default; }
.btn-primary {
  background: var(--ui-gradient); border-color: transparent; color: var(--on-accent);
  box-shadow: var(--primary-shadow);
}
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); padding: 0 12px; }
.btn-small { min-height: var(--tap); font-size: 0.875rem; padding: 0 14px; }
.btn-danger { color: var(--bad); }
.icon-btn {
  flex: none;
  display: grid; place-items: center;
  width: var(--tap); height: var(--tap);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--btn-bg);
  color: var(--accent-soft);
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s, transform 0.3s var(--ease);
}
.icon-btn:active { transform: scale(0.95); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) {
  .btn:hover { background: var(--surface-hover); border-color: var(--blue-bright); }
  .btn[aria-disabled="true"]:hover, .btn:disabled:hover { background: var(--btn-bg); border-color: var(--line); }
  .btn-primary:hover { background: var(--ui-gradient); box-shadow: var(--primary-shadow-hover); transform: translateY(-2px); }
  .btn-quiet:hover { background: var(--surface-hover); border-color: transparent; color: var(--ink); }
  .icon-btn:hover { background: var(--surface-hover); border-color: var(--blue-bright); }
}
.form-error { color: var(--bad); font-weight: 600; font-size: 0.9375rem; }
.form-error:empty { display: none; }
/* lookup spinner inside the Check button */
.spinner {
  display: inline-block; width: 1em; height: 1em; margin-right: 0.5em; vertical-align: -0.15em;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: max(20px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left)); }
.login-card {
  position: relative;
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 8px;
  padding: 28px 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 60px -24px var(--shadow);
}
.login-card::before {
  content: ""; position: absolute; left: 24px; right: 24px; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-soft), transparent);
}
.login-card h1 { font-size: clamp(2rem, 9vw, 2.5rem); }
.login-lead { color: var(--muted); margin-bottom: 10px; font: 600 0.75rem/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.login-card label { font-weight: 600; font-size: 0.9375rem; margin-top: 6px; color: var(--ink); }
.login-card .btn { margin-top: 14px; min-height: 48px; }
.login-card .btn + .btn { margin-top: 0; }
.login-card form { display: flex; flex-direction: column; }   /* single-button forms (unsubscribe page) */
.login-text { color: var(--ink); font-size: 1rem; line-height: 1.45; }
.login-alt { text-align: center; font-size: 0.9375rem; margin-top: 6px; }
.login-card .btn:not(.btn-primary):not(.btn-quiet) { border-color: var(--muted); }   /* ≥3:1 against the card */
@media (hover: hover) { .login-card .btn:not(.btn-primary):not(.btn-quiet):hover { border-color: var(--blue-bright); } }
.login-alt a { display: inline-block; min-height: 44px; box-sizing: border-box; padding: 13px 10px; color: var(--accent-soft); text-underline-offset: 3px; }   /* 44px+ touch target */
.login-alt a:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 3px; border-radius: 4px; }
@media (max-height: 420px) {
  .login { align-items: start; padding-top: 12px; padding-bottom: 12px; }
  .login-card { padding: 14px 20px 12px; gap: 4px; }
  .login-card h1 { font-size: 1.5rem; }
  .login-lead { display: none; }
  .login-card .btn { min-height: 44px; margin-top: 8px; }
  .login-alt { margin-top: 0; }
  .login-alt a { padding: 11px 10px; min-height: 44px; }
}


/* ---------- banners / badges / notes / dialogs (from BenjiRoute) ---------- */
.banners { display: flex; flex-direction: column; }
.banner { padding: 9px var(--gutter); font-size: 0.8125rem; line-height: 1.35; font-weight: 600; border-left: 4px solid transparent; }
.banner-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.banner-demo { background: var(--note-bg); color: var(--note-ink); border-left-color: var(--nebula-violet); }
.banner-warn { background: var(--warn-bg); color: var(--warn-ink); border-left-color: var(--amber); }
.banner-error { background: var(--err-bg); color: var(--err-ink); border-left-color: var(--c-heavy); }
.badge {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--field);
  font: 600 0.6875rem/1.6 var(--mono); letter-spacing: 0; color: var(--muted);
}
.badge.trend-worse { color: var(--bad); border-color: var(--bad); }
.badge.trend-better { color: var(--good); border-color: var(--good); }
.badge.confirmed { color: var(--good); border-color: var(--good); }
.badge.warn { color: var(--amber); border-color: var(--amber); }   /* #fbbf24 on #070f26 / #0f1d3f is ~11:1 */
.note { padding: 10px var(--gutter); font-size: 0.8125rem; color: var(--muted); }
.dialog {
  width: min(92vw, 420px); padding: 24px 22px;
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--panel); color: var(--ink);
  box-shadow: 0 24px 60px -16px var(--shadow);
  overscroll-behavior: contain;
}
.dialog::backdrop { background: rgba(7, 15, 38, 0.72); }
.dialog h2 { font-size: 1.375rem; margin-bottom: 14px; }
.dialog label { display: block; font-weight: 600; margin-bottom: 4px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.manage-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.manage-row { display: flex; gap: 6px; align-items: center; }
.manage-row input { flex: 1; min-width: 0; }
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 50;
  padding: 6px max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  padding-top: max(6px, env(safe-area-inset-top));
  background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px;
}
.top-row { display: flex; align-items: center; gap: 10px; min-height: 40px; padding-bottom: 6px; }
.top-row h1 { font-size: 1.375rem; font-weight: 800; }
.brand-mark { width: auto; height: 1.4em; display: inline-block; vertical-align: -0.3em; margin-right: 0.35em; }   /* as BenjiRoute */
.login-card .brand-mark { height: 1.15em; vertical-align: -0.2em; }
.status { flex: 1; min-width: 0; font: 600 0.6875rem/1.3 var(--mono); letter-spacing: 0.01em; color: var(--muted); text-align: right; }
.banner-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 14px max(var(--gutter), env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left)); }
.panel-tab { display: flex; flex-direction: column; gap: 16px; }
.panel-tab:focus-visible { outline-offset: 4px; }
.panel-tab > h2, .block > h2 { font-size: 1.125rem; letter-spacing: -0.02em; }
.block { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; width: 100%; min-width: 0; }
.hint { color: var(--muted); font-size: 0.9375rem; line-height: 1.5; }
.field-label { font-weight: 600; font-size: 0.9375rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row > .btn { flex: 1 1 140px; }
.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-weight: 700; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; position: relative; margin: 0; width: 52px; height: 32px; border-radius: 999px; background: var(--raise); border: 2px solid var(--border); cursor: pointer; transition: background-color 0.15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--switch-knob); transition: transform 0.15s, background-color 0.15s; }
.switch input:checked { background: var(--accent-soft); border-color: var(--accent-soft); }
.switch input:checked::after { transform: translateX(20px); background: var(--void); }
.switch input:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.switch-hint { margin: -4px 0 4px 64px; font-size: 0.875rem; color: var(--muted); }
.form-ok { color: var(--good); font-weight: 600; font-size: 0.9375rem; }
.form-ok:empty { display: none; }
.credit { padding: 4px 0 0; font-size: 0.8125rem; color: var(--muted); line-height: 1.5; }
.credit p + p { margin-top: 8px; }
.dialog p { margin-bottom: 4px; }


.panel-title { font-size: 1.125rem; letter-spacing: -0.02em; margin-bottom: 10px; }
.noscript { padding: var(--gutter); }
.panel-tab[hidden] { display: none !important; }
.login-card h1 { text-align: center; }
.login-card h1:focus, #status:focus { outline: none; }   /* programmatic focus targets, not controls */
.app.is-guest .top-row h1 { flex: 1; }
.empty { padding: 20px 16px; text-align: center; border: 1px dashed var(--line); border-radius: 16px; display: flex; flex-direction: column; gap: 6px; }
.empty strong { font-size: 1.125rem; }

@media (min-width: 640px) { .main { padding-top: 24px; } }
@media (prefers-reduced-motion: reduce) {
  .tab, .switch input, .switch input::after, .ring-fg, .meter-fill { transition: none; }
  .btn:active { transform: none; }
  .spinner { animation: none; width: 0.5em; height: 0.5em; margin-right: 0.6em; vertical-align: 0.05em; background: currentColor; border: 0; }
}
@media (forced-colors: active) {
  .switch input { forced-color-adjust: none; background: Canvas; border-color: CanvasText; }
  .switch input::after { background: CanvasText; }
  .switch input:checked { background: Highlight; border-color: Highlight; }
  .switch input:checked::after { background: HighlightText; }
  .tab[aria-selected="true"] { outline: 2px solid Highlight; }
  .viz * { forced-color-adjust: auto; }
}


/* =====================================================================================================================
   1.0 screens
   ===================================================================================================================== */
textarea { padding: 10px 14px; min-height: 88px; resize: vertical; line-height: 1.4; }
select { padding-right: 34px; -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--bad); }
input.is-check { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
label.field-label, .field > label { font-weight: 600; font-size: 0.9375rem; }
.field-hint { font-size: 0.8125rem; color: var(--muted); }
.field-error { font-size: 0.875rem; color: var(--bad); font-weight: 600; }
.field-error:empty { display: none; }
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1 1 0; }
.unit-suffix { position: relative; }
.unit-suffix input { padding-right: 44px; }
.unit-suffix::after { content: attr(data-unit); position: absolute; right: 14px; top: 0; height: var(--tap); display: flex; align-items: center; color: var(--muted); font-size: 0.875rem; pointer-events: none; }
.field .unit-suffix { margin-top: 0; }

/* ---- bottom tab bar (iOS safe area) ---- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px;
  padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: var(--tab-bg); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; padding: 4px 2px; border: 0; border-radius: 14px;
  background: transparent; color: var(--muted); font: inherit; font-size: 0.6875rem; font-weight: 700; cursor: pointer;
  transition: color 0.25s, background-color 0.25s;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-selected="true"] { color: var(--accent-soft); background: var(--tab-sel-bg); }
.tab:focus-visible { outline-offset: -3px; }
@media (hover: hover) { .tab:hover { color: var(--ink); background: var(--surface-hover); } }
@media (min-width: 700px) { .tabs { max-width: 640px; left: 50%; right: auto; width: 100%; transform: translateX(-50%); border-radius: 20px 20px 0 0; border: 1px solid var(--line); border-bottom: 0; } }

/* ---- cards, stacks, headings ---- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.card { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.card h3, .card-title { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.big { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.lead { font-size: 1.0625rem; font-weight: 600; }
.muted { color: var(--muted); }
.sm { font-size: 0.875rem; }
.xs { font-size: 0.8125rem; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-soft); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; }
.warnbox { padding: 12px 14px; border-radius: 14px; background: var(--warn-bg); color: var(--warn-ink); font-size: 0.9375rem; line-height: 1.45; border-left: 4px solid var(--amber); }
.infobox { padding: 12px 14px; border-radius: 14px; background: var(--raise); font-size: 0.9375rem; line-height: 1.45; }

/* ---- date stepper ---- */
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stepper-label { flex: 1; text-align: center; font-weight: 800; font-size: 1.125rem; letter-spacing: -0.02em; }
.stepper-label small { display: block; font-size: 0.75rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }

/* ---- calorie ring ---- */
.ring-wrap { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; width: 148px; height: 148px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--raise); stroke-width: 13; }
.ring-fg { fill: none; stroke: var(--viz-line); stroke-width: 13; stroke-linecap: round; transition: stroke-dashoffset 0.6s var(--ease), stroke 0.3s; }
.ring-fg.is-over { stroke: var(--viz-over); }
.ring-centre { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring-centre strong { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.ring-centre span { font-size: 0.75rem; color: var(--muted); font-weight: 600; margin-top: 3px; }
.ring-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.kv { display: flex; justify-content: space-between; gap: 8px; font-size: 0.9375rem; }
.kv b { font-weight: 700; }
.macro { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: center; font-size: 0.8125rem; }
.meter { height: 8px; border-radius: 999px; background: var(--raise); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--viz-line); transition: width 0.5s var(--ease); }
.meter-fill.is-over { background: var(--viz-over); }

/* ---- buttons grid ---- */
.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.add-grid .btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border-radius: 16px; }
.btn svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-ghost-danger { color: var(--bad); border-color: var(--bad); }
.btn-wide { width: 100%; }

/* ---- meals + entries ---- */
.meal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.meal-head h3 { font-size: 1rem; font-weight: 800; letter-spacing: -0.01em; text-transform: none; color: var(--ink); }
.meal-head .kcal { font-weight: 700; color: var(--muted); font-size: 0.9375rem; }
.entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.entry { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 8px 4px; background: none; border: 0; border-top: 1px solid var(--line); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.entries li:first-child .entry { border-top: 0; }
.entry-main { min-width: 0; display: flex; flex-direction: column; }
.entry-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-sub { font-size: 0.8125rem; color: var(--muted); }
.entry-kcal { font-weight: 700; white-space: nowrap; }
@media (hover: hover) { .entry:hover { background: var(--surface-hover); border-radius: 10px; } }

/* ---- segmented control + chips ---- */
.seg { display: flex; padding: 3px; gap: 3px; background: var(--raise); border-radius: 999px; }
.seg button { flex: 1 1 0; min-height: 40px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 0.875rem; font-weight: 700; cursor: pointer; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 4px var(--shadow); }
.seg-small button { min-height: 36px; font-size: 0.8125rem; }
.seg button:focus-visible { outline-offset: -2px; }

/* ---- stat tiles ---- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-label { font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.tile-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.tile-sub { font-size: 0.75rem; color: var(--muted); }

/* ---- charts ---- */
.chart-card { gap: 8px; }
.readout { min-height: 2.6em; font-size: 0.9375rem; display: flex; flex-direction: column; }
.readout b { font-size: 1.25rem; letter-spacing: -0.02em; }
.chart-box { position: relative; touch-action: pan-y; outline-offset: 2px; border-radius: 10px; }
.viz { display: block; width: 100%; height: auto; overflow: visible; user-select: none; -webkit-user-select: none; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-axis { stroke: var(--viz-axis); stroke-width: 1; }
.viz-tick { fill: var(--viz-tick); font: 500 11px var(--sans); }
.viz-line { fill: none; stroke: var(--viz-line); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.viz-line-raw { fill: none; stroke: var(--viz-line); stroke-width: 1; stroke-opacity: 0.4; stroke-linejoin: round; }
.viz-dot { fill: var(--viz-line); stroke: var(--viz-ring); stroke-width: 2; }
.viz-bar { fill: var(--viz-line); }
.viz-bar-over { fill: var(--viz-over); }
.viz-goal { stroke: var(--viz-goal); stroke-width: 1.5; stroke-dasharray: 5 4; }
.viz-goal-label { fill: var(--viz-tick); font: 600 11px var(--sans); }
.viz-cross { stroke: var(--viz-axis); stroke-width: 1; }
.viz-mark { fill: var(--viz-line); stroke: var(--viz-ring); stroke-width: 2; }
.viz-hi { fill: var(--viz-grid); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.8125rem; color: var(--muted); }
.legend i { display: inline-block; vertical-align: middle; margin-right: 6px; }
.lg-line { width: 18px; height: 2px; background: var(--viz-line); }
.lg-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--viz-line); }
.lg-goal { width: 18px; height: 0; border-top: 2px dashed var(--viz-goal); }
.lg-bar { width: 10px; height: 10px; border-radius: 3px; background: var(--viz-line); }
.lg-over { width: 10px; height: 10px; border-radius: 3px; background: var(--viz-over); }
details.table-view > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--accent-soft); font-weight: 600; font-size: 0.9375rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th, .data-table td { padding: 7px 6px; border-top: 1px solid var(--line); text-align: right; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th { color: var(--muted); font-weight: 600; font-size: 0.75rem; border-top: 0; }
.table-scroll { max-height: 280px; overflow: auto; -webkit-overflow-scrolling: touch; }

/* ---- calendar ---- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-title { font-weight: 800; font-size: 1.125rem; letter-spacing: -0.02em; text-align: center; flex: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: 0.6875rem; font-weight: 700; color: var(--muted); padding: 2px 0; }
.cal-cell {
  position: relative; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 2px;
  min-height: 62px; padding: 5px 4px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; overflow: hidden;
}
.cal-cell.is-out { opacity: 0.4; }
.cal-cell.is-today { border-color: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.cal-cell.is-future { opacity: 0.55; }
.cal-num { font-size: 0.8125rem; font-weight: 700; line-height: 1; }
.cal-w { font-size: 0.6875rem; font-weight: 600; color: var(--muted); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-k { font-size: 0.625rem; font-weight: 700; line-height: 1.1; white-space: nowrap; }
.cal-bar { height: 5px; border-radius: 3px; background: transparent; }
.cal-cell[data-status="on"] .cal-bar { background: var(--st-on); }
.cal-cell[data-status="over"] .cal-bar { background: var(--st-over); }
.cal-cell[data-status="low"] .cal-bar { background: var(--st-low); }
.cal-cell[data-status="logged"] .cal-bar { background: var(--viz-line); }
.cal-cell[data-status="on"] .cal-k { color: var(--st-on); } .cal-cell[data-status="over"] .cal-k { color: var(--st-over); } .cal-cell[data-status="low"] .cal-k { color: var(--st-low); }
.cal-dumb { position: absolute; top: 4px; right: 4px; display: flex; gap: 2px; color: var(--accent-soft); font-size: 0.625rem; font-weight: 800; align-items: center; }
.cal-dumb svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
@media (hover: hover) { .cal-cell:hover { background: var(--surface-hover); } }
.key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.75rem; color: var(--muted); }
.key span::before { content: ""; display: inline-block; width: 12px; height: 6px; border-radius: 3px; margin-right: 6px; vertical-align: middle; background: var(--c); }

/* ---- sheet (bottom sheet dialog) ---- */
.sheet {
  width: 100%; max-width: 640px; max-height: calc(100dvh - 24px - env(safe-area-inset-top)); margin: auto auto 0; padding: 0;
  border: 1px solid var(--line); border-radius: 24px 24px 0 0; background: var(--panel); color: var(--ink);
  box-shadow: 0 -20px 60px -16px var(--shadow); overscroll-behavior: contain; overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; }
.sheet::backdrop { background: rgba(7, 15, 38, 0.66); }
.sheet-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 8px 20px; flex: none; }
.sheet-bar h2 { font-size: 1.25rem; outline: none; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 24px; } }
@media (prefers-reduced-motion: no-preference) { .sheet[open] { animation: sheet-in 0.28s var(--ease); } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0.4; } }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; }
.sheet-actions .btn { width: 100%; }

/* ---- toast ---- */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 80; display: flex; align-items: center; gap: 6px; max-width: min(92vw, 520px); padding: 8px 8px 8px 16px; border-radius: 999px; background: var(--ink); color: var(--void); font-weight: 600; font-size: 0.9375rem; box-shadow: 0 10px 30px var(--shadow); }
.toast .btn { color: var(--void); text-decoration: underline; }

/* ---- camera ---- */
.cam { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-frame { position: absolute; inset: 22% 8%; border: 2px solid rgba(255, 255, 255, 0.85); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35); pointer-events: none; }
.cam-line { position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: #ff5a5f; opacity: 0.85; }
@media (prefers-reduced-motion: no-preference) { .cam-line { animation: scan 1.8s ease-in-out infinite alternate; } }
@keyframes scan { from { top: 30%; } to { top: 70%; } }
.file-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; text-align: center; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 16px; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.progress { height: 8px; border-radius: 999px; background: var(--raise); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--viz-line); transition: width 0.2s; }

/* ---- workouts ---- */
.plan-card { display: flex; flex-direction: column; gap: 8px; }
.plan-ex { margin: 0; padding-left: 18px; font-size: 0.875rem; color: var(--muted); }
.ex-card { display: flex; flex-direction: column; gap: 8px; }
.ex-title { font-weight: 800; font-size: 1.0625rem; letter-spacing: -0.01em; }
.set-row { display: grid; grid-template-columns: 48px 1fr 1fr auto; gap: 8px; align-items: center; }
.set-row .set-n { font-weight: 700; color: var(--muted); font-size: 0.875rem; }
.set-row input { text-align: center; padding: 0 6px; }
.set-row .tick { width: 48px; height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--field); color: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; }
.set-row .tick svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.set-row .tick[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--on-accent); }
.set-row.done input { opacity: 0.6; }
.set-head { display: grid; grid-template-columns: 48px 1fr 1fr 48px; gap: 8px; font-size: 0.6875rem; font-weight: 700; color: var(--muted); text-align: center; }
.set-row { grid-template-columns: 48px 1fr 1fr 48px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.25rem; }
.ex-edit { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }
.ex-edit .wide { grid-column: 1 / -1; }
.ex-edit-row { padding: 12px; border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--field); }
.ex-tools { display: flex; gap: 6px; justify-content: flex-end; }
.hist-item { display: flex; width: 100%; justify-content: space-between; gap: 10px; align-items: center; padding: 12px 4px; background: none; border: 0; border-top: 1px solid var(--line); color: var(--ink); font: inherit; text-align: left; cursor: pointer; min-height: 56px; }
.hist-item:first-child { border-top: 0; }

/* ---- first-run screens ---- */
.gate-card { max-width: 440px; }
.gate-title { font-size: 1.375rem; margin: 4px 0 2px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; font-size: 0.9375rem; line-height: 1.45; cursor: pointer; }
.check input { flex: none; width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--accent-soft); }
.setup { min-height: 100dvh; display: flex; justify-content: center; padding: max(20px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left)); }
.setup-card { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 14px; }
.setup-card h2 { font-size: 1.625rem; }
.estimate { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.estimate .target-num { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }
.stepdots { display: flex; gap: 6px; }
.stepdots i { width: 28px; height: 5px; border-radius: 3px; background: var(--raise); }
.stepdots i.on { background: var(--accent-soft); }

/* ---- misc ---- */
.list-plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.skeleton { height: 90px; border-radius: 16px; background: var(--raise); opacity: 0.6; }
.disclaimer { font-size: 0.8125rem; color: var(--muted); line-height: 1.5; }
.me-row { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; min-height: 52px; padding: 8px 0; background: none; border: 0; border-top: 1px solid var(--line); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.me-row:first-of-type { border-top: 0; }
.me-row .chev { color: var(--muted); }
.dev-flag { position: fixed; top: 0; left: 0; right: 0; z-index: 99; padding: 2px 8px; font-size: 0.6875rem; font-weight: 700; text-align: center; background: #c026d3; color: #fff; }
.gate-title:focus, .setup-card h2:focus, .sheet-bar h2:focus { outline: none; }

.skip-link { position: absolute; left: 8px; top: -60px; z-index: 120; padding: 10px 14px; border-radius: 10px; background: var(--panel); color: var(--ink); font-weight: 700; }
.skip-link:focus { top: max(8px, env(safe-area-inset-top)); }
html { scroll-padding-top: 76px; scroll-padding-bottom: 96px; }
option { background: var(--field); color: var(--ink); }
.main:focus { outline: none; }

/* ---- report a problem / make a request (speech-bubble in the header, sheet "Tell us") ---- */
.feedback-btn { color: var(--muted); }
.feedback-btn[hidden] { display: none; }
.fb-form { display: flex; flex-direction: column; gap: 14px; }
.fb-kinds { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-chip { position: relative; display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--btn-bg); color: var(--ink); font-weight: 600; font-size: 0.9375rem; cursor: pointer; transition: background-color 0.25s, border-color 0.25s; }
.fb-chip:has(.fb-radio:checked) { border-color: var(--accent-soft); background: var(--chip-sel-bg); color: var(--accent-soft); }
.fb-chip:has(.fb-radio:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.fb-radio { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.fb-text { min-height: 120px; padding: 10px 14px; }
.fb-count { align-self: flex-end; font-variant-numeric: tabular-nums; }
.fb-msg { color: var(--bad); font-weight: 600; font-size: 0.9375rem; }
.fb-msg:empty { display: none; }
.fb-thanks { font-weight: 700; font-size: 1.0625rem; color: var(--good); outline: none; }
.fb-thanks[hidden] { display: none; }

/* ---- Me tab: Benjiverse avatar + name ---- */
.me-card { flex-direction: row; align-items: center; gap: 16px; }
.me-pic { flex: none; }
.me-id { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.card .me-name { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; text-transform: none; color: var(--ink); overflow-wrap: anywhere; }
.me-link { display: inline-flex; align-items: center; min-height: var(--tap); }   /* 44px tap height */
.av { position: relative; display: block; box-sizing: border-box; width: 72px; height: 72px; border-radius: 50%; overflow: hidden; background: #0f1b3d; }
.av img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.av[data-frame] { padding: 3px; background: var(--ring, #0f1b3d); }
.av[data-frame] img { background: #0f1b3d; }
.av[data-frame="rainbow-ring"] { background: conic-gradient(#ef4444, #f59e0b, #eab308, #22c55e, #06b6d4, #6366f1, #d946ef, #ef4444); }
.av[data-frame="bronze-ring"] { --ring: #b45309; }
.av[data-frame="silver-ring"] { --ring: #94a3b8; }
.av[data-frame="gold-ring"] { --ring: #eab308; }
.av[data-frame="platinum-ring"] { --ring: #67e8f9; }
.av[data-frame="diamond-ring"] { --ring: #c4b5fd; }
.av[data-frame="copper-ring"] { --ring: #b87333; }
.av[data-frame="emerald-ring"] { --ring: #10b981; }
.av[data-frame="sapphire-ring"] { --ring: #2563eb; }
.av[data-frame="ruby-ring"] { --ring: #dc2626; }
.av[data-frame="pink-ring"] { --ring: #ec4899; }

/* ---- Me tab: Appearance (theme + colour palette) ---- */
.seg-tall button { min-height: 44px; padding: 0 4px; font-size: 0.8125rem; white-space: nowrap; }
.pal-set { margin: 4px 0 0; padding: 0; border: 0; min-width: 0; }
.pal-set legend { padding: 0; margin-bottom: 8px; }
.pal-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.pal-chip { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 14px 0 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--btn-bg); color: var(--ink); font-weight: 600; font-size: 0.9375rem; cursor: pointer; transition: background-color 0.25s, border-color 0.25s; }
.pal-chip:has(.fb-radio:checked) { border-color: var(--accent-soft); background: var(--chip-sel-bg); color: var(--accent-soft); }
.pal-chip:has(.fb-radio:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.swatch { flex: none; width: 28px; height: 28px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 0 0 1px rgba(11, 23, 54, 0.35); }
.swatch[data-swatch="teal"] { background: linear-gradient(135deg, #5eead4, #22b8cf); }
.swatch[data-swatch="ocean"] { background: linear-gradient(135deg, #93c5fd, #2563eb); }
.swatch[data-swatch="nebula"] { background: linear-gradient(135deg, #c4b5fd, #7c3aed); }
.swatch[data-swatch="berry"] { background: linear-gradient(135deg, #f9a8d4, #db2777); }
.swatch[data-swatch="moonlight"] { background: linear-gradient(135deg, #e2e8f0, #64748b); }
.pal-tick { font-weight: 800; visibility: hidden; }
.pal-chip:has(.fb-radio:checked) .pal-tick { visibility: visible; }
@media (forced-colors: active) { .pal-chip:has(.fb-radio:checked) { border-color: Highlight; border-width: 2px; } .swatch { forced-color-adjust: none; } }
.av-ph { background: #0f1b3d; }
