/* =========================================================
   Campus App — design system v3 ("quiet monochrome")
   Modelled on the Stoic iOS app: cool light-grey canvas, white cards with big radii,
   ink-black pill buttons, lowercase bold titles, tracked caps labels, a floating "+" in the tab bar,
   one lavender gradient accent. WCAG 2.2 AA: secondary text is a notch darker than the reference.
   ========================================================= */

:root {
  /* shape (one token set, so the whole app can be re-rounded in a single place) */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-pill: 999px;

  /* motion */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);
  --dur: .34s;
  --dur-fast: .18s;
  --dir: 1;

  /* type */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, "Noto Sans", "Noto Sans Arabic", "Noto Naskh Arabic", "Noto Sans SC", Tahoma, Arial, sans-serif;

  /* light palette */
  --page: #E4E6E8;
  --bg: #F1F3F4;
  --surface: #FFFFFF;
  --surface-2: #F1F3F4;
  --surface-3: #E3E5E8;
  --text: #161616;
  --text-2: #5B5F64;
  --primary: #161616;      /* ink: buttons, selected states, the "+" */
  --primary-2: #161616;    /* headings */
  --on-primary: #FFFFFF;
  --accent-a: #7F8FCB;     /* the one colour: a soft lavender gradient */
  --accent-b: #C98BB9;
  --accent: linear-gradient(100deg, #7F8FCB, #C98BB9);
  --on-accent: #161616;
  --accent-ink: #5B5F64;
  --line: #E4E6E8;
  --control: #82868B;
  --focus: #0A63D8;
  --ok: #0E6B38;      --ok-bg: #E2F3E7;
  --warn: #7A4300;    --warn-bg: #FBEFD5;
  --bad: #B3261E;     --bad-bg: #FBE6E4;
  --hero: linear-gradient(150deg, #343436 0%, #121213 58%, #000000 100%);
  --on-hero: #FFFFFF; --on-hero-2: #C7C9CD;
  --map-bg: #E8EAEC;  --map-road: #FFFFFF; --map-green: #DCE5DE;
  --shadow-1: 0 1px 2px rgba(22, 22, 22, .04), 0 6px 18px rgba(22, 22, 22, .04);
  --shadow-2: 0 18px 48px rgba(22, 22, 22, .22);
  --border-w: 0px;
  --ring: transparent;               /* outline for selected states when the accent is a light colour */
  --sel-stroke: var(--primary);
  --gfx: var(--primary);             /* accent as a line or fill on light grounds (bars, route, dots) */
  --hero-line: #FFFFFF;              /* progress ring and bars inside the hero card */
  --hero-track: rgba(255, 255, 255, .2);
}

/* dark: three styles like the reference (Black, Graphite, Blue) */
html[data-theme="dark"] {
  --page: #050505;
  --bg: #000000;
  --surface: #121212;
  --surface-2: #1C1C1E;
  --surface-3: #2C2C2E;
  --text: #F5F5F7;
  --text-2: #A4A6AB;
  --primary: #FFFFFF;
  --primary-2: #FFFFFF;
  --on-primary: #000000;
  --on-accent: #0B0B0C;
  --accent-ink: #A4A6AB;
  --line: #2A2A2C;
  --control: #8E9094;
  --focus: #6EA8FF;
  --ok: #8BE0A8;   --ok-bg: #12362A;
  --warn: #FFD28A; --warn-bg: #3D2E0F;
  --bad: #FFA39C;  --bad-bg: #4A1D1A;
  --hero: linear-gradient(150deg, #2C2C2E 0%, #151516 60%, #0A0A0A 100%);
  --on-hero: #F5F5F7; --on-hero-2: #B4B6BA;
  --map-bg: #161618; --map-road: #2A2A2C; --map-green: #16241B;
  --shadow-1: none;
  --shadow-2: 0 18px 48px rgba(0, 0, 0, .6);
}
html[data-theme="dark"][data-dark="graphite"] { --page: #121214; --bg: #1C1C1E; --surface: #2C2C2E; --surface-2: #3A3A3C; --surface-3: #48484A; --line: #3C3C3E; --map-bg: #242426; --map-road: #3A3A3C; --text-2: #B8BABF; --on-hero-2: #D3D5D9; --hero: linear-gradient(150deg, #4A4A4D 0%, #2C2C2E 60%, #1C1C1E 100%); }
html[data-theme="dark"][data-dark="blue"] { --page: #060B16; --bg: #0A1222; --surface: #121C33; --surface-2: #1B2845; --surface-3: #263659; --line: #22304F; --map-bg: #0E1A31; --map-road: #1B2845; --text-2: #A9B4CC; --hero: linear-gradient(150deg, #2A3C66 0%, #121C33 60%, #0A1222 100%); }

/* Accent colour (Settings): replaces the ink black on buttons, selected states, the "+", the avatar and the hero card.
   Light fills use dark text and get a dark outline when selected so the state never depends on colour alone.
   High contrast ignores the accent (applyPrefs sets it back to ink). */
html:not([data-theme="dark"])[data-accent="mustard"] { --gfx: #8A6200; --hero-line: #161616; --hero-track: rgba(22, 22, 22, .16); --primary: #E1AD28; --on-primary: #161616; --ring: #161616; --sel-stroke: #161616; --hero: linear-gradient(150deg, #F0C95C 0%, #DBA81F 100%); --on-hero: #161616; --on-hero-2: #38362E; }
html:not([data-theme="dark"])[data-accent="blue"] { --gfx: #1F6DB5; --hero-line: #161616; --hero-track: rgba(22, 22, 22, .16); --primary: #86BFF0; --on-primary: #161616; --ring: #161616; --sel-stroke: #161616; --hero: linear-gradient(150deg, #A9D3F5 0%, #74B0E8 100%); --on-hero: #161616; --on-hero-2: #1B2733; }
html:not([data-theme="dark"])[data-accent="red"] { --gfx: #C23B30; --hero-line: #161616; --hero-track: rgba(22, 22, 22, .16); --primary: #F28B82; --on-primary: #161616; --ring: #161616; --sel-stroke: #161616; --hero: linear-gradient(150deg, #F7ADA6 0%, #EE7E74 100%); --on-hero: #161616; --on-hero-2: #371B19; }
html:not([data-theme="dark"])[data-accent="pink"] { --gfx: #C23C80; --hero-line: #161616; --hero-track: rgba(22, 22, 22, .16); --primary: #F4A6C8; --on-primary: #161616; --ring: #161616; --sel-stroke: #161616; --hero: linear-gradient(150deg, #F8C3DA 0%, #EE93BC 100%); --on-hero: #161616; --on-hero-2: #3A1F2D; }
html:not([data-theme="dark"])[data-accent="green"] { --gfx: #1F7A44; --hero-line: #161616; --hero-track: rgba(22, 22, 22, .16); --primary: #8FD9A6; --on-primary: #161616; --ring: #161616; --sel-stroke: #161616; --hero: linear-gradient(150deg, #B1E7C2 0%, #7BCB94 100%); --on-hero: #161616; --on-hero-2: #223A2B; }
html:not([data-theme="dark"])[data-accent="purple"] { --primary: #6F43CF; --on-primary: #FFFFFF; --sel-stroke: #6F43CF; --hero: linear-gradient(150deg, #7A4FD6 0%, #5A30B4 100%); --on-hero: #FFFFFF; --on-hero-2: #F1EAFF; }
html[data-theme="dark"][data-accent="mustard"] { --primary: #E8B84A; --on-primary: #0B0B0C; --sel-stroke: #E8B84A; --hero: linear-gradient(150deg, #4B3B10 0%, #241C06 100%); }
html[data-theme="dark"][data-accent="blue"] { --primary: #8FC8F5; --on-primary: #0B0B0C; --sel-stroke: #8FC8F5; --hero: linear-gradient(150deg, #1E3A57 0%, #0E1E2F 100%); }
html[data-theme="dark"][data-accent="red"] { --primary: #F59A92; --on-primary: #0B0B0C; --sel-stroke: #F59A92; --hero: linear-gradient(150deg, #5A2724 0%, #2B1210 100%); }
html[data-theme="dark"][data-accent="pink"] { --primary: #F7B2D0; --on-primary: #0B0B0C; --sel-stroke: #F7B2D0; --hero: linear-gradient(150deg, #5A2840 0%, #2C1220 100%); }
html[data-theme="dark"][data-accent="green"] { --primary: #9BE0B1; --on-primary: #0B0B0C; --sel-stroke: #9BE0B1; --hero: linear-gradient(150deg, #1F4A31 0%, #0E2418 100%); }
html[data-theme="dark"][data-accent="purple"] { --primary: #B497FF; --on-primary: #0B0B0C; --sel-stroke: #B497FF; --hero: linear-gradient(150deg, #3E2477 0%, #1D0F42 100%); }

/* High contrast: black and white, thick lines (works on top of either theme) */
html[data-contrast="high"] {
  --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #EDEDED; --surface-3: #D9D9D9;
  --text: #000000; --text-2: #1A1A1A; --primary: #000000; --primary-2: #000000;
  --on-primary: #FFFFFF; --accent: #000000; --on-accent: #FFFFFF; --accent-ink: #1A1A1A; --line: #000000; --control: #000000; --focus: #8A2F00;
  --ok: #004D1F; --ok-bg: #E3F5E8; --warn: #4D2A00; --warn-bg: #FFF1CC; --bad: #8A0000; --bad-bg: #FFE3E1;
  --hero: #000000; --on-hero: #FFFFFF; --on-hero-2: #F0F0F0;
  --map-bg: #F4F4F4; --map-road: #FFFFFF; --map-green: #DDEEDD;
  --border-w: 2px;
  --shadow-1: none;
}
html[data-contrast="high"][data-theme="dark"] {
  --bg: #000000; --surface: #000000; --surface-2: #1A1A1A; --surface-3: #2E2E2E;
  --text: #FFFFFF; --text-2: #F0F0F0; --primary: #FFFFFF; --primary-2: #FFFFFF;
  --on-primary: #000000; --accent: #FFFFFF; --on-accent: #000000; --accent-ink: #F0F0F0; --line: #FFFFFF; --control: #FFFFFF; --focus: #FFE066;
  --ok: #8FFFB0; --ok-bg: #002B12; --warn: #FFE08A; --warn-bg: #2E2100; --bad: #FFB4AE; --bad-bg: #330000;
  --hero: #000000;
  --map-bg: #0A0A0A; --map-road: #2E2E2E; --map-green: #0F2A1F;
}

html { font-size: 100%; -webkit-text-size-adjust: 100%; color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
@media (pointer: fine) { html { overscroll-behavior: none; } }
html[data-text="lg"] { font-size: 118%; }
html[data-text="xl"] { font-size: 136%; }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}

/* Reading comfort (dyslexia-friendly spacing; no justified text) */
html[data-comfort="on"] body { letter-spacing: .02em; word-spacing: .12em; line-height: 1.75; }
html[data-comfort="on"] p, html[data-comfort="on"] li { max-width: 62ch; }

[hidden] { display: none !important; }
a { color: var(--text); text-underline-offset: .18em; }
button { font: inherit; color: inherit; cursor: pointer; }
a, button, input, select, textarea, label { touch-action: manipulation; }
input[type="radio"], input[type="checkbox"] { border-radius: var(--r-xs); }
.seg input, .opt input, .check input { -webkit-appearance: none; appearance: none; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3, .h1, .h2, .h3, .sheet-head h2, .onb-hero h1 { text-wrap: balance; }
p, .lead, .hint, .sub { text-wrap: pretty; }
p + p { margin-top: .6em; }

.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; inset-inline-start: 12px; top: -80px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: 12px 20px; border-radius: var(--r-pill); font-weight: 700; transition: top var(--dur-fast) var(--ease); }
.skip:focus { top: 12px; }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: var(--r-sm); }
#view:focus, #view h1:focus { outline: none; }

/* icons: thin rounded line, like the reference */
.i { inline-size: 1.5rem; block-size: 1.5rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { inline-size: 1.125rem; block-size: 1.125rem; }
.i.lg { inline-size: 2rem; block-size: 2rem; }
[dir="rtl"] .flip { transform: scaleX(-1); }

/* ---------- layout shell ---------- */
.stage { min-height: 100dvh; display: grid; place-items: center; }
.device {
  position: relative; width: 100%; max-width: 430px; height: 100dvh;
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  background: var(--bg); overflow: hidden; isolation: isolate;
}
@media (min-width: 600px) {
  .stage { padding: 16px; background: var(--page); }
  .device { height: min(900px, calc(100dvh - 32px)); border-radius: 44px; box-shadow: var(--shadow-2), 0 0 0 9px #111; }
}
.device[data-chrome="none"] { grid-template-rows: minmax(0, 1fr); }
.device[data-chrome="none"] .topbar, .device[data-chrome="none"] .tabbar { display: none; }

.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: calc(12px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 4px max(20px, env(safe-area-inset-left)); min-block-size: 60px; }
.topbar .tl { display: flex; align-items: center; gap: 8px; justify-self: start; min-inline-size: 0; }
.topbar .tc { font-size: 1.3125rem; font-weight: 700; letter-spacing: -.02em; text-align: center; white-space: nowrap; }
.topbar .tr { display: flex; align-items: center; gap: 8px; justify-self: end; }
.streak { display: inline-flex; align-items: center; gap: 6px; min-block-size: 40px; padding: 0 14px; border-radius: var(--r-pill); background: var(--surface); font-weight: 700; font-size: 1rem; color: var(--text); text-decoration: none; border: var(--border-w) solid var(--line); }
.icon-btn {
  inline-size: 44px; block-size: 44px; border-radius: var(--r-pill); border: var(--border-w) solid var(--line); background: transparent;
  display: grid; place-items: center; color: var(--text); padding: 0;
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease-soft);
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.solid { background: var(--primary); color: var(--on-primary); }
.icon-btn.solid:hover { background: var(--primary); opacity: .88; }
.icon-btn.sos { background: var(--surface); color: var(--bad); }
.icon-btn .avatar { inline-size: 100%; block-size: 100%; font-size: .95rem; background: transparent; color: inherit; }

#view { overflow-y: auto; overscroll-behavior: contain; padding: 8px max(20px, env(safe-area-inset-right)) calc(124px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); scroll-padding-block: 8px 140px; scroll-behavior: smooth; scrollbar-width: none; }
.device[data-chrome="none"] #view { padding-block-end: 28px; }
#view::-webkit-scrollbar { display: none; }
.screen { display: block; }
.screen > * + * { margin-block-start: 22px; }

/* screen transitions (direction aware, RTL aware) */
@keyframes pushIn { from { opacity: 0; transform: translateX(calc(var(--dir) * 36px)); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: translateX(calc(var(--dir) * -36px)); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.screen.push { animation: pushIn var(--dur) var(--ease) both; }
.screen.pop { animation: popIn var(--dur) var(--ease) both; }
.screen.fade { animation: fadeIn var(--dur) var(--ease) both; }
.stagger > * { animation: riseIn .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }

/* motion off */
html[data-motion="reduced"] *, html[data-motion="reduced"] *::before, html[data-motion="reduced"] *::after {
  animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
  transition-duration: .001ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
}

/* ---------- tab bar: flat on the canvas, a black "+" in the middle ---------- */
.tabbar {
  position: absolute; z-index: 5; inset-inline: 0; inset-block-end: 0;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; gap: 0; padding: 14px 10px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, color-mix(in srgb, var(--bg) 0%, transparent));
}
html[data-contrast="high"] .tabbar { background: var(--bg); border-top: 2px solid var(--line); }
.tab { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; padding: 2px; min-block-size: 58px; font-size: .75rem; font-weight: 500; color: var(--text-2); border-radius: var(--r-md); }
.tab .pill { display: grid; place-items: center; }
.tab[aria-current="page"] { color: var(--text); font-weight: 700; }
.tab[aria-current="page"] .i { fill: currentColor; }
.tab:active .pill { transform: scale(.9); }
.tab .pill { transition: transform var(--dur-fast) var(--ease); }
.tab.plus { padding: 0; }
.tab.plus .plus-c { inline-size: 58px; block-size: 58px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; box-shadow: 0 8px 20px rgba(0, 0, 0, .22); transition: transform var(--dur-fast) var(--ease); }
.tab.plus .plus-c .i { inline-size: 1.75rem; block-size: 1.75rem; stroke-width: 1.8; }
.tab.plus:active .plus-c { transform: scale(.92); }

/* ---------- typography helpers ---------- */
.h1 { font-size: 2.125rem; line-height: 1.06; font-weight: 800; color: var(--primary-2); letter-spacing: -.03em; text-transform: lowercase; }
html[lang="en"] .h1::after { content: "."; }
.h2 { font-size: 1.25rem; line-height: 1.25; font-weight: 700; color: var(--primary-2); letter-spacing: -.015em; }
.h3 { font-size: 1.0625rem; line-height: 1.35; font-weight: 600; }
.lead { color: var(--text-2); font-size: 1.0625rem; }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--text-2); }
/* section labels: small tracked capitals (Arabic-script text keeps normal spacing so letters still join) */
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-block-end: 10px; }
html[lang="en"] .screen h2.h2:not(.keep) { font-size: .75rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--text-2); }
.num { font-size: 2.75rem; line-height: 1; font-weight: 700; letter-spacing: -.035em; }
.num small { font-size: 1rem; font-weight: 500; letter-spacing: 0; color: var(--text-2); margin-inline-start: 6px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border-radius: var(--r-xl); padding: 20px; box-shadow: var(--shadow-1); border: var(--border-w) solid var(--line); }
.card.flat { box-shadow: none; background: var(--surface); }
.card.hero, .card.dark { background: var(--hero); color: var(--on-hero); border-color: transparent; overflow: hidden; position: relative; isolation: isolate; padding: 26px 22px; text-align: center; border-radius: 34px; }
.card.hero .h2, .card.hero .h1, .card.hero .num, .card.dark .h2, .card.dark .num { color: var(--on-hero); }
html[lang="en"] .card.hero h2.h2, html[lang="en"] .card.dark h2.h2 { font-size: 1rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--on-hero-2); }
.card.hero .muted, .card.hero .num small, .card.dark .muted, .card.dark .num small { color: var(--on-hero-2); }
.hero-art { position: absolute; inset-inline-start: 0; inset-block-end: 0; inline-size: 100%; block-size: auto; z-index: 0; pointer-events: none; }
[dir="rtl"] .hero-art { transform: scaleX(-1); }
.card.warn { background: var(--warn-bg); color: var(--warn); box-shadow: none; }
.card.bad { background: var(--bad-bg); color: var(--bad); box-shadow: none; }
.card.ok { background: var(--ok-bg); color: var(--ok); box-shadow: none; }
.stack > * + * { margin-block-start: 14px; }
.stack-sm > * + * { margin-block-start: 8px; }
.cluster { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- buttons: ink pills ---------- */
.btn {
  min-block-size: 54px; padding: 10px 30px; border-radius: var(--r-pill); border: 1.5px solid transparent; font-weight: 600; font-size: 1.0625rem; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; text-align: center;
  background: var(--primary); color: var(--on-primary);
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease-soft), box-shadow var(--dur-fast) var(--ease-soft);
}
.btn:hover { box-shadow: 0 8px 20px rgba(0, 0, 0, .2); transform: translateY(-1px); }
.btn:active { transform: scale(.97); box-shadow: none; }
.btn.block { display: flex; inline-size: 100%; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--control); }
.btn.ghost { background: transparent; color: var(--text); border-color: transparent; text-decoration: underline; text-underline-offset: .2em; }
.btn.accent { background: #FFFFFF; color: #161616; }
.btn.grad { background: var(--accent); color: #161616; }
.btn.danger { background: var(--bad); color: #fff; }
html[data-theme="dark"] .btn.danger { background: #B3261E; }
.btn.sm { min-block-size: 44px; padding: 6px 20px; font-size: .9375rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
html[data-large="on"] .btn { min-block-size: 62px; font-size: 1.125rem; }
html[data-large="on"] .row { min-block-size: 76px; }
html[data-large="on"] .chip { min-block-size: 54px; }

/* ---------- grouped lists: one white rounded block, hairline dividers ---------- */
.list { display: grid; gap: 0; background: var(--surface); border-radius: var(--r-lg); overflow: hidden; border: var(--border-w) solid var(--line); }
.list > .row, .list > li > .row, .list > .static { border-radius: 0; box-shadow: none; border: 0; border-block-end: 1px solid var(--line); background: transparent; }
.list > :last-child, .list > li:last-child > .row { border-block-end: 0; }
.list.loose { background: transparent; gap: 10px; border: 0; overflow: visible; }
.list.loose > .row { background: var(--surface); border-radius: var(--r-lg); border-block-end: 0; }
.row {
  display: flex; align-items: center; gap: 14px; inline-size: 100%; min-block-size: 60px; padding: 12px 16px; text-align: start;
  background: var(--surface); border-radius: var(--r-lg); border: var(--border-w) solid var(--line); box-shadow: none; text-decoration: none; color: var(--text);
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease-soft);
}
button.row, a.row { cursor: pointer; }
.row:hover { background: var(--surface-2); }
.row:active { background: var(--surface-3); }
.row .ic { inline-size: 28px; block-size: 28px; border-radius: 0; background: none; color: var(--text); display: grid; place-items: center; flex: none; }
.row .tx { min-inline-size: 0; flex: 1; }
.row .tt { font-weight: 500; font-size: 1.0625rem; line-height: 1.3; }
.row .sub { color: var(--text-2); font-size: .875rem; line-height: 1.35; }
.row .go { color: var(--text-2); }
.row.static { cursor: default; }
.row.static:hover { background: transparent; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; min-block-size: 116px; padding: 16px 12px; border-radius: var(--r-lg); background: var(--surface);
  border: var(--border-w) solid var(--line); box-shadow: none; text-decoration: none; color: var(--text);
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease-soft);
}
.tile:hover { background: var(--surface-3); transform: translateY(-2px); }
.tile:active { transform: scale(.97); }
.tile .ic { inline-size: 32px; block-size: 32px; display: grid; place-items: center; color: var(--text); }
.tile .ic .i { inline-size: 1.75rem; block-size: 1.75rem; }
.tile.accent { background: var(--primary); color: var(--on-primary); }
.tile.accent .ic, .tile.accent .sub { color: var(--on-primary); }
.tile .tt { font-weight: 600; line-height: 1.25; }
.tile .sub { font-size: .8125rem; color: var(--text-2); line-height: 1.3; }

/* carousels bleed off the screen edge so people see there is more */
.carousel { display: flex; gap: 10px; overflow-x: auto; margin-inline: -20px; padding: 2px 20px 10px; scroll-snap-type: x proximity; scroll-padding-inline: 20px; scrollbar-width: none; position: relative; }
.carousel::-webkit-scrollbar { display: none; }
.carousel > * { flex: 0 0 min(72%, 280px); scroll-snap-align: start; }
.fac { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: var(--border-w) solid var(--line); text-align: start; color: var(--text); text-decoration: none; min-block-size: 136px; transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease-soft); }
.fac:hover { background: var(--surface-3); transform: translateY(-2px); }
.fac:active { transform: scale(.98); }
.fac .ic { inline-size: 44px; block-size: 44px; border-radius: 22px 22px 8px 8px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; }
.fac .tt { font-weight: 600; margin-block-start: 6px; }
.fac .sub { color: var(--text-2); font-size: .875rem; }
.fac .pill-s { align-self: flex-start; margin-block-start: auto; }

/* week strip (Home) */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; margin-inline: -6px; }
.day { border: 1.5px solid transparent; background: transparent; border-radius: var(--r-md); padding: 7px 0 8px; font-size: .75rem; color: var(--text-2); display: grid; gap: 2px; justify-items: center; min-block-size: 58px; }
.day b { font-size: .9375rem; font-weight: 500; color: var(--text); }
.day.today { border-color: var(--control); }
.day.today b { font-weight: 800; }
.day i { inline-size: 5px; block-size: 5px; border-radius: 50%; background: var(--text); }
.day i.none { background: transparent; }

/* ---------- pills, chips, badges ---------- */
.pill-s { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--r-pill); font-size: .8125rem; font-weight: 600; line-height: 1.3; background: var(--surface-2); color: var(--text); }
.card .pill-s, .list .pill-s { background: var(--surface-2); }
.pill-s.ok { background: var(--ok-bg); color: var(--ok); }
.pill-s.warn { background: var(--warn-bg); color: var(--warn); }
.pill-s.bad { background: var(--bad-bg); color: var(--bad); }
.chips { position: relative; /* keeps visually hidden text inside the scroller so #view never scrolls sideways */ display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-block-size: 46px; padding: 0 20px; border-radius: var(--r-sm); border: var(--border-w) solid var(--line); background: var(--surface); color: var(--text); font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background-color var(--dur-fast) var(--ease-soft), transform var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease-soft);
}
.chip .i { inline-size: 0; opacity: 0; transition: inline-size var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.chip[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: inset 0 0 0 2px var(--ring); }
.chip[aria-pressed="true"] .i { inline-size: 1.125rem; opacity: 1; }
.chip:active { transform: scale(.96); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field label, .label { font-weight: 600; }
.input, .select, .textarea {
  inline-size: 100%; min-block-size: 54px; padding: 12px 18px; border-radius: var(--r-md); border: 1.5px solid var(--control); background: var(--surface); color: var(--text); font: inherit;
  transition: border-color var(--dur-fast) var(--ease-soft), box-shadow var(--dur-fast) var(--ease-soft);
}
.textarea { min-block-size: 96px; resize: vertical; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.searchbar { position: relative; }
.searchbar .i { position: absolute; inset-inline-start: 18px; top: 50%; transform: translateY(-50%); color: var(--text-2); pointer-events: none; }
.searchbar .input { padding-inline-start: 50px; border-radius: var(--r-pill); }
.hint { font-size: .875rem; color: var(--text-2); }
.hint.err { color: var(--bad); font-weight: 600; }
.input[aria-invalid="true"] { border-color: var(--bad); }

/* segmented control (real radios): white track, ink selected segment */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 4px; border-radius: var(--r-md); background: var(--surface); border: var(--border-w) solid var(--line); }
.seg input { position: absolute; opacity: 0; inline-size: 1px; block-size: 1px; }
.seg label { min-block-size: 44px; display: grid; place-items: center; border-radius: var(--r-sm); font-weight: 600; text-align: center; padding: 4px 10px; cursor: pointer; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur-fast) var(--ease); }
.seg input:checked + label { background: var(--primary); color: var(--on-primary); box-shadow: inset 0 0 0 2px var(--ring); }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg label:active { transform: scale(.97); }

/* accent colour picker */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.swatches input { position: absolute; opacity: 0; inline-size: 1px; block-size: 1px; }
.swatches label { --sw: #161616; --sw-on: #FFFFFF; min-block-size: 44px; display: grid; justify-items: center; align-content: start; gap: 8px; padding: 14px 6px 12px; border-radius: var(--r-md); background: var(--surface); font-size: .8125rem; font-weight: 600; line-height: 1.25; text-align: center; cursor: pointer; transition: transform var(--dur-fast) var(--ease); }
.swatches label:active { transform: scale(.97); }
.swatches .sw-dot { inline-size: 36px; block-size: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--sw); color: var(--sw-on); box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .4); transition: box-shadow var(--dur) var(--ease); }
.swatches .sw-dot svg { inline-size: 18px; block-size: 18px; opacity: 0; transform: scale(.5); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.swatches input:checked + label .sw-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.swatches input:checked + label .sw-dot svg { opacity: 1; transform: none; }
.swatches input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.swatches input:disabled + label { opacity: .45; cursor: not-allowed; }
.swatches [data-c="mustard"] { --sw: #E1AD28; --sw-on: #161616; }
.swatches [data-c="blue"] { --sw: #86BFF0; --sw-on: #161616; }
.swatches [data-c="red"] { --sw: #F28B82; --sw-on: #161616; }
.swatches [data-c="pink"] { --sw: #F4A6C8; --sw-on: #161616; }
.swatches [data-c="green"] { --sw: #8FD9A6; --sw-on: #161616; }
.swatches [data-c="purple"] { --sw: #6F43CF; --sw-on: #FFFFFF; }
html[data-theme="dark"] .swatches [data-c="ink"] { --sw: #FFFFFF; --sw-on: #000000; }
html[data-theme="dark"] .swatches [data-c="mustard"] { --sw: #E8B84A; --sw-on: #0B0B0C; }
html[data-theme="dark"] .swatches [data-c="blue"] { --sw: #8FC8F5; --sw-on: #0B0B0C; }
html[data-theme="dark"] .swatches [data-c="red"] { --sw: #F59A92; --sw-on: #0B0B0C; }
html[data-theme="dark"] .swatches [data-c="pink"] { --sw: #F7B2D0; --sw-on: #0B0B0C; }
html[data-theme="dark"] .swatches [data-c="green"] { --sw: #9BE0B1; --sw-on: #0B0B0C; }
html[data-theme="dark"] .swatches [data-c="purple"] { --sw: #B497FF; --sw-on: #0B0B0C; }

/* switch (role=switch): iOS-style, ink when on */
.switch-row { display: flex; align-items: center; gap: 14px; min-block-size: 64px; padding: 10px 16px; border-radius: var(--r-lg); background: var(--surface); border: var(--border-w) solid var(--line); }
.switch-row .tx { flex: 1; min-inline-size: 0; }
.switch { position: relative; flex: none; inline-size: 52px; block-size: 32px; border-radius: var(--r-pill); border: 0; background: var(--surface-3); padding: 0; transition: background-color var(--dur) var(--ease); box-shadow: inset 0 0 0 1.5px var(--control); }
.switch::before { content: ""; position: absolute; inset: -8px -4px; border-radius: var(--r-pill); } /* 48px tall touch target */
.switch::after { content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; inline-size: 26px; block-size: 26px; border-radius: 50%; background: var(--control); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease); }
.switch[aria-checked="true"] { background: var(--primary); box-shadow: inset 0 0 0 2px var(--ring); }
.switch[aria-checked="true"]::after { background: var(--on-primary); transform: translateX(calc(var(--dir) * 20px)); }
.switch .st { display: none; }

/* checklist (native checkbox): round tick like the reference */
.check { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--surface); border: var(--border-w) solid var(--line); transition: background-color var(--dur) var(--ease); }
.check input { position: absolute; inset-block-start: 0; inset-inline-start: 0; z-index: 1; opacity: 0; inline-size: 58px; block-size: 100%; margin: 0; cursor: pointer; } /* covers the whole tick area, above .box */
.check .box { position: relative; pointer-events: none; flex: none; inline-size: 28px; block-size: 28px; margin-block-start: 1px; border-radius: 50%; border: 1.5px solid var(--control); background: var(--surface); display: grid; place-items: center; color: var(--on-primary); transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.check .box .i { inline-size: 16px; block-size: 16px; stroke-width: 3; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset var(--dur) var(--ease) .05s; }
.check input:checked ~ .box { background: var(--primary); border-color: var(--primary); box-shadow: inset 0 0 0 2px var(--ring); animation: pop .4s var(--ease); }
.check input:checked ~ .box .i { stroke-dashoffset: 0; }
.check input:checked ~ .tx .tt { color: var(--text-2); }
.check input:focus-visible ~ .box { outline: 3px solid var(--focus); outline-offset: 3px; }
.check .tx { flex: 1; min-inline-size: 0; }
.check .tt { font-weight: 500; font-size: 1.0625rem; }
.check { position: relative; cursor: pointer; }
.check .ext { flex: none; }

/* progress */
.ring { position: relative; inline-size: 76px; block-size: 76px; flex: none; }
.ring svg { inline-size: 100%; block-size: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; stroke-linecap: round; }
.ring .bg { stroke: var(--hero-track); }
.ring .fg { stroke: var(--hero-line); stroke-dasharray: 188.5; stroke-dashoffset: 188.5; transition: stroke-dashoffset 1s var(--ease); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1rem; font-weight: 700; }
.bar { block-size: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.card.hero .bar, .card.dark .bar { background: var(--hero-track); }
.bar.ok > i { background: var(--ok); }
.bar.warn > i { background: #B86E00; }
.bar.bad > i { background: var(--bad); }
/* fill slides in with transform only (compositor friendly); --w is set from data-w */
.bar > i { display: block; block-size: 100%; border-radius: inherit; inline-size: 100%; transform: translateX(calc(var(--dir) * (var(--w, 0) - 100) * 1%)); transition: transform 1s var(--ease); background-color: var(--gfx); }
.card.hero .bar > i, .card.dark .bar > i { background-color: var(--hero-line); }
.bar.tall { block-size: 12px; }

/* ---------- onboarding ---------- */
.onb { min-block-size: 100%; display: flex; flex-direction: column; gap: 20px; padding: 24px 0 8px; }
.onb-hero { position: relative; padding: 18px 0 150px; margin-block-end: 22px; color: var(--text); isolation: isolate; }
.onb-hero .logo { display: none; }
.onb-nav { position: sticky; inset-block-end: 0; padding-block: 12px 4px; background: linear-gradient(to top, var(--bg) 70%, transparent); z-index: 2; }
.onb-hero h1 { color: var(--text); font-size: 2.5rem; line-height: 1.04; font-weight: 800; letter-spacing: -.03em; text-transform: lowercase; position: relative; z-index: 1; }
html[lang="en"] .onb-hero h1::after { content: "."; }
.onb-hero p { color: var(--text-2); margin-block-start: 12px; position: relative; z-index: 1; font-size: 1.0625rem; }
.onb-hero .hero-art { inset-inline-start: -20px; inline-size: calc(100% + 40px); max-inline-size: none; }
.dots { display: flex; gap: 6px; justify-content: center; }
.dots i { inline-size: 26px; block-size: 3px; border-radius: var(--r-pill); background: var(--control); opacity: .35; transition: opacity var(--dur) var(--ease), background-color var(--dur) var(--ease); }
.dots i[data-on] { opacity: 1; background: var(--gfx); }
.opt-list { display: grid; gap: 10px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; inline-size: 100%; block-size: 100%; inset: 0; margin: 0; cursor: pointer; }
.opt .opt-card { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; min-block-size: 56px; padding: 12px 22px; border-radius: var(--r-pill); background: var(--surface); border: var(--border-w) solid var(--line); font-weight: 600; text-align: center; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur-fast) var(--ease); }
.opt .opt-card .dot { position: absolute; inset-inline-start: 16px; inline-size: 22px; block-size: 22px; display: grid; place-items: center; opacity: 0; transform: scale(.4); transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.opt .opt-card .dot .i { inline-size: 16px; block-size: 16px; stroke-width: 3; }
.opt input:checked + .opt-card { background: var(--primary); color: var(--on-primary); box-shadow: inset 0 0 0 2px var(--ring); }
.opt input:checked + .opt-card .dot { opacity: 1; transform: none; }
.opt input:focus-visible + .opt-card { outline: 3px solid var(--focus); outline-offset: 3px; }
.opt input:active + .opt-card { transform: scale(.98); }
.opt input:disabled + .opt-card { opacity: .6; border-style: dashed; }
.opt .native { position: absolute; inset-inline-end: 18px; font-weight: 400; opacity: .75; font-size: .8125rem; }

/* ---------- map ---------- */
.mapcard { border-radius: var(--r-xl); background: var(--map-bg); overflow: hidden; border: var(--border-w) solid var(--line); }
.map-svg { inline-size: 100%; block-size: auto; }
.map-svg .road { fill: none; stroke: var(--map-road); stroke-width: 22; stroke-linecap: round; stroke-linejoin: round; }
.map-svg .walk { fill: none; stroke: var(--control); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; opacity: .7; }
.map-svg .green { fill: var(--map-green); }
.map-svg .bld { cursor: pointer; }
.map-svg .bld rect { fill: var(--surface); stroke: transparent; stroke-width: 1.5; transition: fill var(--dur) var(--ease), stroke var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.map-svg .bld text { fill: var(--text); font: 700 13px var(--font); text-anchor: middle; pointer-events: none; }
.map-svg .bld .sub { font: 500 9.5px var(--font); fill: var(--text-2); }
.map-svg .bld:hover rect { fill: var(--surface-3); }
.map-svg .bld[data-sel="1"] rect { fill: var(--primary); stroke: var(--sel-stroke); stroke-width: 2.5; }
.map-svg .bld[data-sel="1"] text, .map-svg .bld[data-sel="1"] .sub { fill: var(--on-primary); }
.map-svg .bld[data-dim="1"] { opacity: .4; }
.map-svg .bld:focus-visible { outline: none; }
.map-svg .bld:focus-visible rect { stroke: var(--focus); stroke-width: 4; }
.map-svg .lot rect { fill: var(--surface-2); stroke: var(--control); stroke-width: 1.5; stroke-dasharray: 4 3; transition: fill var(--dur) var(--ease); }
.map-svg .lot rect.hit { fill: transparent; stroke: none; }
.map-svg .lot { cursor: pointer; }
.map-svg .lot:hover rect:not(.hit) { fill: var(--surface-3); }
.map-svg .lot:focus-visible { outline: none; }
.map-svg .lot:focus-visible rect:not(.hit) { stroke: var(--focus); stroke-width: 4; stroke-dasharray: none; }
.map-svg .lot text { fill: var(--text); font: 700 11px var(--font); text-anchor: middle; }
.map-svg .lot[data-dim="1"] { opacity: .4; }
.map-svg .route { fill: none; stroke: var(--gfx); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.map-svg .route-bg { fill: none; stroke: var(--surface); stroke-width: 11; stroke-linecap: round; stroke-linejoin: round; opacity: .95; }
.map-svg .you circle.halo { fill: var(--gfx); opacity: .22; animation: pulse 2s var(--ease-soft) 2; transform-box: fill-box; transform-origin: center; }
.map-svg .you circle.dot { fill: var(--gfx); stroke: var(--surface); stroke-width: 3; }
.map-svg .dest { fill: var(--bad); stroke: var(--surface); stroke-width: 3; }
.map-svg .compass text { fill: var(--text-2); font: 700 10px var(--font); text-anchor: middle; }
@keyframes pulse { 0% { transform: scale(.7); opacity: .45; } 100% { transform: scale(1.8); opacity: 0; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 16px 14px; font-size: .8125rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { inline-size: 14px; block-size: 14px; border-radius: 4px; border: 1.5px solid var(--control); background: var(--surface); display: inline-block; }
.legend i.l { border-style: dashed; background: var(--surface-2); }
.step-list { counter-reset: s; display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.step-list li { position: relative; counter-increment: s; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1.5px solid transparent; transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.step-list li::before { content: counter(s); position: relative; z-index: 1; flex: none; inline-size: 28px; block-size: 28px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; font-size: .875rem; }
/* dotted route line between steps */
.step-list li:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: 29px; inset-block-start: 42px; inset-block-end: -22px; border-inline-start: 2px dotted var(--control); }
.step-list li[aria-current="step"] { border-color: var(--gfx); }
.step-list li[aria-current="step"]::before { background: var(--primary); color: var(--on-primary); }
.step-list li[data-done="1"] { opacity: .75; }
.step-list li[data-done="1"]::before { content: "✓"; background: var(--ok-bg); color: var(--ok); }

/* ---------- details ---------- */
.kv { display: grid; gap: 0; border-radius: var(--r-lg); overflow: hidden; background: var(--surface); border: var(--border-w) solid var(--line); }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 18px; border-block-end: 1px solid var(--line); }
.kv > div:last-child { border-block-end: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 600; text-align: end; }
.bullets { margin: 0; padding-inline-start: 1.2em; display: grid; gap: 6px; }
.address-card { text-align: center; padding: 26px 20px; border-radius: var(--r-xl); background: var(--hero); color: var(--on-hero); }
.address-card .eyebrow { color: var(--on-hero-2); }
.address-card .big { font-size: 1.5rem; font-weight: 700; line-height: 1.25; margin-block: 8px; letter-spacing: -.02em; }
.sample-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: var(--r-pill); background: var(--warn-bg); color: var(--warn); font-size: .75rem; font-weight: 700; }
.big-call { display: flex; align-items: center; gap: 14px; inline-size: 100%; padding: 18px; border-radius: var(--r-xl); background: var(--bad); color: #fff; text-decoration: none; font-weight: 700; font-size: 1.25rem; transition: transform var(--dur-fast) var(--ease); }
html[data-theme="dark"] .big-call { background: #B3261E; }
.big-call:active { transform: scale(.98); }
.big-call .ic { inline-size: 52px; block-size: 52px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: grid; place-items: center; }

/* ---------- profile ---------- */
.avatar { inline-size: 40px; block-size: 40px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 700; flex: none; }
.avatar.lg { inline-size: 76px; block-size: 76px; font-size: 2rem; }
.profile-head { display: flex; align-items: center; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 14px 12px; border-radius: var(--r-lg); background: var(--surface); border: var(--border-w) solid var(--line); }
.stat b { display: block; font-size: 1.75rem; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; }
.stat span { display: block; font-size: .75rem; color: var(--text-2); margin-block-start: 4px; line-height: 1.25; }

/* ---------- sheet (native dialog) ---------- */
dialog.sheet { border: 0; padding: 0; margin: auto auto 0; inline-size: min(100%, 430px); max-block-size: 92dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--bg); color: var(--text); box-shadow: var(--shadow-2); overflow: hidden; overscroll-behavior: contain; }
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheetUp .42s var(--ease) both; }
dialog.sheet.closing { animation: sheetDown .26s var(--ease-soft) both; }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .5); backdrop-filter: blur(2px); animation: fadeBack .3s var(--ease) both; }
dialog.sheet.closing::backdrop { animation: fadeBackOut .26s var(--ease-soft) both; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetDown { from { transform: none; } to { transform: translateY(100%); } }
@keyframes fadeBack { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeBackOut { from { opacity: 1; } to { opacity: 0; } }
.sheet-grab { inline-size: 40px; block-size: 5px; border-radius: var(--r-pill); background: var(--control); opacity: .5; margin: 10px auto 0; flex: none; }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 22px 8px; }
.sheet-head h2 { flex: 1; font-size: 2rem; line-height: 1.05; font-weight: 800; letter-spacing: -.035em; text-transform: lowercase; color: var(--primary-2); }
html[lang="en"] .sheet-head h2::after { content: "."; }
.sheet-head .icon-btn { background: var(--surface); }
.sheet-body { padding: 8px 22px calc(26px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
.sheet-body > * + * { margin-block-start: 16px; }

/* ---------- toast ---------- */
.toast { position: fixed; inset-inline: 0; inset-block-end: 112px; display: flex; justify-content: center; pointer-events: none; z-index: 50; padding-inline: 16px; }
.toast > div { background: var(--primary); color: var(--on-primary); padding: 13px 22px; border-radius: var(--r-pill); font-weight: 600; box-shadow: var(--shadow-2); animation: toastIn .4s var(--ease) both; max-inline-size: 420px; text-align: center; }
.toast > div.out { animation: toastOut .3s var(--ease-soft) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ---------- pointer hover (only where a pointer really hovers) ---------- */
@media (hover: hover) {
  .chip:hover { background: var(--surface-3); }
  .chip[aria-pressed="true"]:hover { filter: brightness(.9); }
  .seg input:not(:checked) + label:hover { background: var(--surface-2); }
  .opt:hover .opt-card { background: var(--surface-3); }
  .opt input:checked:hover + .opt-card { filter: brightness(.9); }
  .check:hover { background: var(--surface-2); }
  .tab:not([aria-current="page"]):not(.plus):hover { color: var(--text); }
  .btn.secondary:hover { background: var(--surface-3); }
  .btn.ghost:hover { background: transparent; box-shadow: none; }
  .btn.grad:hover { box-shadow: 0 8px 22px rgba(201, 139, 185, .45); }
}

/* ---------- misc ---------- */
.divider { block-size: 1px; background: var(--line); border: 0; margin-block: 4px; }
.banner-note { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface); font-size: .875rem; color: var(--text-2); }
.banner-note .i { margin-block-start: 2px; color: var(--text); }
.preview-text { padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); }
.logo { inline-size: 36px; block-size: 36px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; flex: none; }
.logo .i { inline-size: 20px; block-size: 20px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.quick-grid .tile { min-block-size: 104px; padding: 12px 6px; }
.quick-grid .tile .sub { display: none; }
@media (max-width: 360px) { .tiles { grid-template-columns: 1fr; } }
@media (forced-colors: active) { .btn, .chip, .row, .tile, .card, .fac, .stat, .list { border: 1px solid CanvasText; } }
@media print { .tabbar, .topbar, .toast { display: none !important; } .device { height: auto; box-shadow: none; } #view { overflow: visible; } }

/* ---------- agent chat ---------- */
.screen:has(> .agent-screen) { display: flex; flex-direction: column; min-block-size: 100%; }
#view:has(.agent-screen) { padding-block-end: 0; }
.agent-screen { flex: 1; display: flex; flex-direction: column; gap: 14px; min-inline-size: 0; }
.agent-screen > * + * { margin-block-start: 0; }
.agent-log { display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; align-items: flex-end; gap: 8px; min-inline-size: 0; }
.msg[hidden] { display: none; }
.msg.user { justify-content: flex-end; }
.msg .av { flex: none; inline-size: 30px; block-size: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); box-shadow: inset 0 0 0 2px var(--ring); }
.msg .av .i { inline-size: 16px; block-size: 16px; }
.bubble { max-inline-size: min(100%, 320px); padding: 12px 16px; border-radius: 22px; line-height: 1.45; overflow-wrap: anywhere; }
.msg.agent .bubble { background: var(--surface); border: var(--border-w) solid var(--line); border-end-start-radius: 8px; box-shadow: var(--shadow-1); animation: riseIn .4s var(--ease) both; }
.msg.user .bubble { background: var(--primary); color: var(--on-primary); border-end-end-radius: 8px; box-shadow: inset 0 0 0 2px var(--ring); animation: riseIn .3s var(--ease) both; }
.bubble p + p, .bubble p + .msg-list, .msg-list + p { margin-block-start: 8px; }
.msg-list { margin: 0; padding-inline-start: 18px; }
.msg-list li + li { margin-block-start: 2px; }
.msg-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 12px; }
.msg-act { display: inline-flex; align-items: center; gap: 6px; min-block-size: 44px; padding: 0 14px; border-radius: var(--r-pill); border: 1.5px solid var(--control); background: var(--surface); color: var(--text); font: inherit; font-size: .9375rem; font-weight: 600; text-decoration: none; text-align: start; transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease-soft); }
.msg-act:active { transform: scale(.96); }
.msg-act .i { flex: none; }
.typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.typing i { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--control); animation: typingDot 1.2s var(--ease-soft) infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typingDot { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.agent-dock { position: sticky; inset-block-end: 0; z-index: 2; margin-block-start: auto; margin-inline: -20px; padding: 10px 20px calc(88px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 90%, color-mix(in srgb, var(--bg) 0%, transparent)); display: flex; flex-direction: column; gap: 10px; }
.dock-row { display: flex; align-items: center; gap: 8px; min-inline-size: 0; }
.dock-row .new { flex: none; background: var(--surface); box-shadow: var(--shadow-1); }
.dock-row .chips { flex: 1; min-inline-size: 0; margin-inline-end: -20px; padding-inline-end: 20px; padding-block: 4px; }
.composer { display: flex; align-items: center; gap: 6px; padding: 5px; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--shadow-1); border: var(--border-w) solid var(--line); }
.composer:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.composer input { flex: 1; min-inline-size: 0; min-block-size: 46px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 1rem; padding: 0 14px; outline: none; }
.composer input::placeholder { color: var(--text-2); opacity: 1; }
.composer .send { flex: none; inline-size: 46px; block-size: 46px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); box-shadow: inset 0 0 0 2px var(--ring); transition: transform var(--dur-fast) var(--ease); }
.composer .send:active { transform: scale(.92); }
.composer .send .i { inline-size: 22px; block-size: 22px; stroke-width: 2.2; }
@media (hover: hover) { .msg-act:hover { background: var(--surface-2); } }
