/* ============================================================
   Cōrta — "Aurora" design system
   Reference language: cool gradient wallpaper + floating glass
   cards + bold grotesque headlines + high-contrast pill CTAs.
   The one warm signal is the ember cortisol curve/rings.
   Day = bright sky (high cortisol) · Night = deep indigo (low).
   ============================================================ */

:root {
  /* text + surfaces */
  --fg:        oklch(24% 0.022 275);
  --muted:     oklch(46% 0.032 272);
  --faint:     oklch(52% 0.032 272);
  --surface:   oklch(100% 0 0);
  --surface-2: oklch(96.5% 0.012 280);
  --border:    oklch(92% 0.012 280);
  --hairline:  oklch(94.5% 0.008 285);
  --bg:        oklch(95% 0.016 283);

  /* cool gradient wallpaper (the signature) */
  --wallpaper: linear-gradient(180deg,
      oklch(86% 0.062 248) 0%,
      oklch(91% 0.04 264) 16%,
      oklch(96% 0.018 283) 38%,
      oklch(98.6% 0.008 296) 72%);
  --card-grad: linear-gradient(180deg, oklch(100% 0 0), oklch(98.6% 0.01 286));

  /* signals */
  --accent:    oklch(66% 0.17 46);    /* ember — cortisol / data */
  --accent-ink:oklch(40% 0.14 44);
  --calm:      oklch(56% 0.13 268);   /* periwinkle — rest / HRV */
  --calm-soft: oklch(93% 0.035 275);
  --good:      oklch(60% 0.13 158);
  --watch:     oklch(74% 0.14 78);
  --high:      oklch(60% 0.19 25);

  /* high-contrast pill (reference CTA) */
  --ink:       oklch(22% 0.02 275);
  --ink-on:    oklch(99% 0 0);

  /* circadian curve stops */
  --dawn: #f6c58a; --gold: #ffd98a; --warm: #f4b48a; --dusk: #b8a6e6;

  --font-display: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --r-xl: 30px; --r-lg: 26px; --r-md: 20px; --r-sm: 13px;
  --shadow:      0 2px 6px oklch(40% 0.05 272 / .06), 0 18px 40px -22px oklch(40% 0.08 272 / .40);
  --shadow-lift: 0 4px 12px oklch(40% 0.05 272 / .09), 0 30px 60px -26px oklch(40% 0.10 272 / .50);
}

[data-theme="night"] {
  --fg:        oklch(96% 0.01 285);
  --muted:     oklch(74% 0.03 275);
  --faint:     oklch(66% 0.03 272);
  --surface:   oklch(27% 0.035 272);
  --surface-2: oklch(32% 0.04 272);
  --border:    oklch(38% 0.04 272);
  --hairline:  oklch(35% 0.035 272);
  --bg:        oklch(20% 0.05 270);

  --wallpaper: linear-gradient(180deg,
      oklch(15% 0.03 268) 0%,
      oklch(19% 0.05 270) 32%,
      oklch(25% 0.065 274) 66%,
      oklch(31% 0.08 280) 100%);
  --card-grad: linear-gradient(180deg, oklch(29% 0.04 272), oklch(26% 0.035 272));

  --accent:    oklch(74% 0.16 52);
  --accent-ink:oklch(86% 0.10 60);
  --calm:      oklch(74% 0.12 268);
  --calm-soft: oklch(34% 0.06 270);

  --ink:       oklch(95% 0.01 285);   /* inverts to a light pill at night */
  --ink-on:    oklch(20% 0.02 275);

  --shadow:      0 2px 8px oklch(0% 0 0 / .34), 0 22px 48px -22px oklch(0% 0 0 / .6);
  --shadow-lift: 0 4px 14px oklch(0% 0 0 / .4), 0 34px 70px -26px oklch(0% 0 0 / .72);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: oklch(88% 0.03 275); color: var(--fg);
  font-family: var(--font-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
[data-theme="night"] html, [data-theme="night"] body { background: oklch(14% 0.03 268); }

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.025em; text-wrap: balance; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.eyebrow { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }

/* ============================================================
   DEVICE FRAMES
   ============================================================ */
.stage { min-height: 100%; display: grid; place-items: center; padding: 40px 16px; overflow-x: hidden;
  background: radial-gradient(130% 90% at 50% -10%, color-mix(in oklab, var(--calm) 22%, transparent), transparent 60%), oklch(90% 0.02 275); }
[data-theme="night"] .stage { background: radial-gradient(130% 90% at 50% -10%, color-mix(in oklab, var(--calm) 30%, transparent), transparent 60%), oklch(13% 0.03 268); }

.device { position: relative; width: 390px; height: 844px; border-radius: 56px; background: #05060a; padding: 12px; flex: none;
  box-shadow: 0 0 0 2px oklch(35% 0.02 270 / .6), 0 0 0 12px #0a0b10, 0 0 0 13px oklch(40% 0.02 270 / .5), var(--shadow-lift); }
.device.android { border-radius: 44px; }

.screen-frame { position: relative; width: 100%; height: 100%; border-radius: 44px; overflow: hidden;
  background: var(--wallpaper); display: flex; flex-direction: column; }
.android .screen-frame { border-radius: 32px; }

.statusbar { position: relative; z-index: 6; height: 54px; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 30px 0; font-size: 15px; font-weight: 600; color: var(--fg); }
.android .statusbar { height: 40px; padding: 0 18px; font-size: 13px; }
.statusbar .sb-icons { display: flex; gap: 7px; align-items: center; }
.statusbar svg { display: block; }

.island { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: 122px; height: 34px; background: #05060a; border-radius: 20px; z-index: 8; }
.punch { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 11px; height: 11px; background: #05060a; border-radius: 50%; z-index: 8; }
.home-indicator { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); width: 138px; height: 5px; border-radius: 3px; background: var(--fg); opacity: .26; z-index: 20; }
.android-nav { position: absolute; bottom: 0; left: 0; right: 0; height: 26px; z-index: 20; display: flex; align-items: center; justify-content: center; gap: 74px; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.canvas { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 2px 18px 168px; scrollbar-width: none; background: transparent; }
.canvas::-webkit-scrollbar { display: none; }

.appbar { padding: 8px 4px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.appbar .lead-col { flex: 1; }
.appbar .date { font-size: 13px; color: var(--calm); font-weight: 700; }
.appbar h1 { font-size: 32px; line-height: 1.0; }
.appbar .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.android .appbar h1 { font-size: 25px; }

.screen { display: none; }
.screen.is-active { display: block; animation: rise .5s cubic-bezier(.2,.7,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* header progress ring (reference) */
.headring { position: relative; width: 60px; height: 60px; flex: none; display: grid; place-items: center; text-align: center; }
.headring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.headring b { font-family: var(--font-mono); font-size: 15px; font-weight: 600; line-height: 1; }
.headring span { font-size: 8px; color: var(--muted); letter-spacing: .04em; display: block; margin-top: 1px; }

/* ============================================================
   CARDS + PRIMITIVES
   ============================================================ */
.card { background: var(--card-grad); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
[data-theme="night"] .card { border-color: color-mix(in oklab, var(--border) 60%, transparent); }
.card + .card, .stack > * + * { margin-top: 14px; }
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-h .t { font-size: 13px; font-weight: 700; letter-spacing: -0.01em; }
.card-h .m { font-size: 11.5px; color: var(--faint); font-family: var(--font-mono); }
.divider { height: 1px; background: var(--hairline); margin: 12px -18px; }

/* focus card = reference "Today's focus" white card with big headline + pill */
.focus { background: var(--card-grad); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 20px; box-shadow: var(--shadow-lift); overflow: hidden; }
.focus .fh { font-family: var(--font-display); font-weight: 800; font-size: 32px; line-height: 1.0; letter-spacing: -0.035em; margin-top: 10px; }
.focus .fsub { color: var(--muted); font-size: 13.5px; line-height: 1.45; margin-top: 8px; max-width: 30ch; }
.focus .curve-wrap { margin: 6px -8px 0; }
.focus .frow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.axis { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); padding: 2px 4px 0; }

/* tag pill (category chip on cards) */
.tagpill { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; padding: 5px 11px; border-radius: 999px;
  background: color-mix(in oklab, var(--fg) 7%, transparent); color: var(--muted); letter-spacing: .02em; }

/* metrics */
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metric { background: var(--card-grad); border: 1px solid var(--border); border-radius: var(--r-md); padding: 15px; box-shadow: var(--shadow); }
.metric .lbl { font-size: 11px; color: var(--muted); font-weight: 600; }
.metric .big { font-family: var(--font-display); font-weight: 800; font-size: 30px; margin-top: 6px; letter-spacing: -0.03em; }
.metric .big small { font-size: 14px; color: var(--faint); font-weight: 600; }
.metric .delta { font-size: 11px; font-weight: 600; margin-top: 3px; }
.up { color: var(--good); } .down { color: var(--high); } .flat { color: var(--muted); }

/* compliance ring (inside cards) */
.ring-card { display: flex; align-items: center; gap: 16px; }
.ring { --p: 62; --sz: 92px; width: var(--sz); height: var(--sz); border-radius: 50%; flex: none;
  background: conic-gradient(var(--accent) calc(var(--p)*1%), var(--surface-2) 0); display: grid; place-items: center; position: relative; }
.ring::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface); }
.ring .rv { position: relative; z-index: 2; text-align: center; }
.ring .rv b { font-family: var(--font-mono); font-size: 22px; }
.ring .rv span { display: block; font-size: 9.5px; color: var(--muted); letter-spacing: .06em; }
.ring-sm { --sz: 60px; } .ring-sm::after { inset: 7px; } .ring-sm .rv b { font-size: 15px; }

/* week strip (reference) */
.weekstrip { display: flex; justify-content: space-between; gap: 4px; }
.weekstrip .dcell { flex: 1; text-align: center; padding: 10px 0 8px; border-radius: 16px; transition: .2s; }
.weekstrip .dcell .dn { font-size: 10px; color: var(--faint); font-weight: 700; }
.weekstrip .dcell .dd { font-family: var(--font-mono); font-size: 15px; font-weight: 600; margin-top: 7px; }
.weekstrip .dcell .wd { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); margin: 6px auto 0; }
.weekstrip .dcell.on { background: var(--surface); box-shadow: var(--shadow); }
.weekstrip .dcell.on .dn { color: var(--accent); }

/* streak dots */
.streak { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.streak .dot { width: 15px; height: 15px; border-radius: 5px; background: var(--surface-2); }
.streak .dot.on { background: var(--accent); }
.streak .dot.today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }

/* next-up horizontal cards (reference) */
.nextup { display: flex; gap: 12px; overflow-x: auto; margin: 0 -18px; padding: 2px 18px 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.nextup::-webkit-scrollbar { display: none; }
.nextup .nu { flex: 0 0 60%; scroll-snap-align: start; background: var(--card-grad); border: 1px solid var(--border); border-radius: var(--r-md); padding: 15px; box-shadow: var(--shadow); }
.nextup .nu .nt { font-size: 14.5px; font-weight: 700; margin-top: 10px; letter-spacing: -0.01em; }
.nextup .nu .nm { font-family: var(--font-mono); font-size: 11px; color: var(--faint); margin-top: 4px; }

/* source list (reference "based on N sources") */
.srclist .srow { display: flex; align-items: center; gap: 11px; padding: 10px 0; }
.srclist .srow + .srow { border-top: 1px solid var(--hairline); }
.srclist .si { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; color: #fff; }
.srclist .sl { flex: 1; font-size: 13px; font-weight: 600; }
.srclist .st { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }

/* quick-log grid */
.qlog { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qbtn { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; text-align: left; color: var(--fg); font: inherit; transition: .18s; min-height: 44px; box-shadow: var(--shadow); }
.qbtn .qi { width: 20px; height: 20px; flex: none; color: var(--muted); }
.qbtn .ql { font-size: 12.5px; font-weight: 600; line-height: 1.1; }
.qbtn .qt { font-size: 10px; color: var(--faint); font-family: var(--font-mono); }
.qbtn.done { background: color-mix(in oklab, var(--accent) 16%, var(--surface)); border-color: color-mix(in oklab, var(--accent) 42%, var(--border)); }
.qbtn.done .qi { color: var(--accent); }
.qbtn:active { transform: scale(.97); }

/* protocol checklist */
.check { display: flex; align-items: center; gap: 12px; padding: 11px 2px; cursor: pointer; }
.check + .check { border-top: 1px solid var(--hairline); }
.check .box { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--border); flex: none; display: grid; place-items: center; transition: .18s; }
.check .box svg { width: 13px; height: 13px; opacity: 0; color: #fff; }
.check.on .box { background: var(--accent); border-color: var(--accent); }
.check.on .box svg { opacity: 1; }
.check .body { flex: 1; min-width: 0; }
.check .name { font-size: 13.5px; font-weight: 600; }
.check.on .name { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.check .meta { font-size: 11px; color: var(--faint); font-family: var(--font-mono); margin-top: 1px; }
.check .win { font-size: 10px; color: var(--calm); font-weight: 700; font-family: var(--font-mono); }

/* pills / chips */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; font-family: var(--font-mono); }
.pill.good { background: color-mix(in oklab, var(--good) 16%, transparent); color: var(--good); }
.pill.watch { background: color-mix(in oklab, var(--watch) 22%, transparent); color: color-mix(in oklab, var(--watch) 72%, var(--fg)); }
.pill.high { background: color-mix(in oklab, var(--high) 15%, transparent); color: var(--high); }
.pill.calm { background: var(--calm-soft); color: var(--calm); }
.pill.ghost { background: var(--surface-2); color: var(--muted); }
.dot-b { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 12.5px; font-weight: 600; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; transition: .15s; }
.chip.sel { background: var(--ink); color: var(--ink-on); border-color: var(--ink); }

/* sliders */
.slider-row { padding: 10px 0; }
.slider-row .top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.slider-row .k { font-size: 13px; font-weight: 600; }
.slider-row .v { font-family: var(--font-mono); font-size: 15px; font-weight: 600; color: var(--accent); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; background: var(--surface-2); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); box-shadow: var(--shadow); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); cursor: pointer; }
.scale-ticks { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 9px; color: var(--faint); margin-top: 4px; padding: 0 2px; }

/* buttons — reference pill CTA */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: 15px; padding: 14px 22px; border-radius: 999px; border: none; cursor: pointer; min-height: 52px; width: 100%; transition: .16s; }
.btn.primary { background: var(--ink); color: var(--ink-on); box-shadow: var(--shadow); }
.btn.primary:active { transform: translateY(1px); }
.btn.ember { background: var(--accent); color: #fff; box-shadow: 0 10px 24px -10px var(--accent); }
.btn.ghost { background: var(--surface-2); color: var(--fg); }
.btn.line { background: transparent; border: 1.5px solid var(--border); color: var(--fg); }
.btn.sm { width: auto; min-height: auto; padding: 10px 16px; font-size: 13px; }

/* lists / rows */
.list { background: var(--card-grad); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.list .row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; min-height: 52px; }
.list .row + .row { border-top: 1px solid var(--hairline); }
.list .row .ri { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; }
.list .row .rl { flex: 1; } .list .row .rl .a { font-size: 14px; font-weight: 600; } .list .row .rl .b { font-size: 11.5px; color: var(--faint); }
.list .row .chev { color: var(--faint); }

/* segmented control (reference pill toggle) */
.segment { display: flex; background: color-mix(in oklab, var(--surface) 55%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--hairline); border-radius: 999px; padding: 4px; gap: 2px; box-shadow: var(--shadow); }
.segment button { flex: 1; font: inherit; font-size: 12.5px; font-weight: 700; padding: 9px; border: none; background: transparent; color: var(--muted); border-radius: 999px; cursor: pointer; min-height: 38px; }
.segment button.on { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }

/* trend chart */
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); margin-top: 8px; }
.legend b { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.legend .sw { width: 12px; height: 3px; border-radius: 2px; }

/* insight cards */
.insight { display: flex; gap: 12px; padding: 15px; border-radius: var(--r-md); background: var(--card-grad); border: 1px solid var(--border); box-shadow: var(--shadow); }
.insight .mk { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--calm-soft); color: var(--calm); }
.insight .it { font-size: 13px; font-weight: 700; } .insight .ib { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 82%; padding: 12px 14px; border-radius: 20px; font-size: 13.5px; line-height: 1.45; }
.bubble.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.bubble.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.cite { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; font-family: var(--font-mono); font-size: 10.5px; color: var(--calm); font-weight: 600; }
.disclaimer { font-size: 10.5px; color: var(--faint); margin-top: 6px; font-style: italic; }
.chat-input { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.chat-input input { flex: 1; font: inherit; font-size: 13.5px; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); }
.chat-input .send { width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--accent); color: #fff; cursor: pointer; flex: none; display: grid; place-items: center; }

.lab-legend { display: flex; gap: 16px; font-size: 11px; margin-top: 6px; }

/* premium / paywall */
.premium { border: 1px solid color-mix(in oklab, var(--accent) 35%, var(--border)); border-radius: var(--r-xl); padding: 20px;
  background: radial-gradient(120% 100% at 90% 0%, color-mix(in oklab, var(--accent) 13%, var(--surface)), var(--surface)); box-shadow: var(--shadow-lift); }
.price { display: flex; align-items: baseline; gap: 4px; }
.price .p { font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: -0.03em; }
.price .per { color: var(--muted); font-size: 13px; }
.feat { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 5px 0; }
.feat svg { color: var(--accent); flex: none; }

/* ============================================================
   FLOATING ACTION PILL (reference "I want to become…")
   ============================================================ */
.floatbar { position: absolute; left: 16px; right: 16px; bottom: 98px; z-index: 14; display: none; align-items: center; gap: 10px;
  padding: 7px 7px 7px 18px; border-radius: 999px; background: color-mix(in oklab, var(--surface) 62%, transparent);
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid color-mix(in oklab, var(--surface) 40%, var(--border)); box-shadow: var(--shadow-lift); }
.app:has([data-screen="today"].is-active) .floatbar { display: flex; }
.floatbar input { flex: 1; border: none; background: transparent; font: inherit; font-size: 14px; color: var(--fg); }
.floatbar input::placeholder { color: var(--muted); }
.floatbar .go { width: 42px; height: 42px; border-radius: 50%; border: none; background: var(--accent); color: #fff; cursor: pointer; flex: none; display: grid; place-items: center; }

/* ============================================================
   TAB / NAV BARS (frosted on the wallpaper)
   ============================================================ */
.tabbar { position: absolute; bottom: 0; left: 0; right: 0; z-index: 15; display: flex; padding: 9px 10px 26px;
  background: color-mix(in oklab, var(--surface) 68%, transparent); backdrop-filter: saturate(170%) blur(22px); -webkit-backdrop-filter: saturate(170%) blur(22px);
  border-top: 1px solid color-mix(in oklab, var(--surface) 30%, var(--hairline)); }
.tabbar button { flex: 1; background: none; border: none; cursor: pointer; color: var(--faint); font: inherit; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; }
.tabbar button svg { width: 24px; height: 24px; } .tabbar button .tl { font-size: 10px; font-weight: 600; }
.tabbar button.on { color: var(--accent); }

.navbar { position: absolute; bottom: 0; left: 0; right: 0; z-index: 15; display: flex; padding: 10px 8px 30px;
  background: color-mix(in oklab, var(--surface) 82%, transparent); backdrop-filter: saturate(170%) blur(20px); border-top: 1px solid var(--hairline); }
.navbar button { flex: 1; background: none; border: none; cursor: pointer; color: var(--muted); font: inherit; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 2px 0; }
.navbar button .nb-i { padding: 4px 18px; border-radius: 999px; transition: .2s; display: grid; place-items: center; }
.navbar button svg { width: 24px; height: 24px; } .navbar button .tl { font-size: 11px; font-weight: 600; }
.navbar button.on { color: var(--accent-ink); }
.navbar button.on .nb-i { background: color-mix(in oklab, var(--accent) 24%, var(--surface)); color: var(--accent-ink); }

.fab { position: absolute; right: 16px; bottom: 92px; z-index: 16; width: 60px; height: 60px; border-radius: 20px; border: none; background: var(--accent); color: #fff; box-shadow: var(--shadow-lift); cursor: pointer; display: grid; place-items: center; }

/* theme (day/night) toggle */
.toggle { width: 52px; height: 30px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); position: relative; cursor: pointer; flex: none; }
.toggle .kn { position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; transition: .28s cubic-bezier(.3,.8,.3,1); color: var(--accent); }
[data-theme="night"] .toggle { background: color-mix(in oklab, var(--calm) 34%, var(--surface-2)); }
[data-theme="night"] .toggle .kn { transform: translateX(22px); color: var(--calm); }

/* ============================================================
   ONBOARDING
   ============================================================ */
.onb { padding: 8px 20px 30px; height: 100%; display: flex; flex-direction: column; }
.onb .prog { display: flex; gap: 6px; margin: 6px 0 22px; }
.onb .prog i { height: 4px; border-radius: 2px; background: color-mix(in oklab, var(--fg) 12%, transparent); flex: 1; }
.onb .prog i.on { background: var(--accent); }
.onb .oh { font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1.05; letter-spacing: -0.03em; margin-bottom: 6px; }
.onb .os { color: var(--muted); font-size: 14px; margin-bottom: 20px; line-height: 1.45; }
.onb .opt { display: flex; align-items: center; gap: 14px; padding: 15px 16px; border-radius: 16px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; margin-bottom: 10px; transition: .15s; box-shadow: var(--shadow); }
.onb .opt.sel { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 9%, var(--surface)); }
.onb .opt .oi { width: 26px; text-align: center; } .onb .opt .oi svg { display: block; margin: auto; color: var(--accent); }
.onb .opt .oname { font-size: 14.5px; font-weight: 600; } .onb .opt .odesc { font-size: 11.5px; color: var(--faint); }
.onb .spacer { flex: 1; }

.proto { padding: 15px 16px; border-radius: 18px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; margin-bottom: 11px; position: relative; transition: .15s; box-shadow: var(--shadow); }
.proto.sel { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 8%, var(--surface)); }
.proto .pn { font-size: 15px; font-weight: 700; } .proto .pd { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.proto .rec { position: absolute; top: 13px; right: 13px; }

.perm { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.perm + .perm { border-top: 1px solid var(--hairline); }
.perm .pi { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--accent); flex: none; }

.brand-wm { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em; }
.welcome { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; }
.welcome .mark { font-family: var(--font-display); font-weight: 800; font-size: 60px; line-height: 1; letter-spacing: -0.04em; }
.welcome .tag { color: var(--muted); font-size: 15px; margin-top: 10px; }

.mut { color: var(--muted); } .fnt { color: var(--faint); }
.mt8{margin-top:8px} .mt12{margin-top:12px} .mt16{margin-top:16px} .mt20{margin-top:20px} .mt24{margin-top:24px}
.sec-title { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .08em; margin: 24px 4px 12px; text-transform: uppercase; }
.center { text-align: center; }

/* hide app chrome during onboarding */
.app:has(.screen[data-screen="onboarding"].is-active) .tabbar,
.app:has(.screen[data-screen="onboarding"].is-active) .navbar,
.app:has(.screen[data-screen="onboarding"].is-active) .fab,
.app:has(.screen[data-screen="onboarding"].is-active) .floatbar { display: none; }
.app:has(.screen[data-screen="onboarding"].is-active) .canvas { padding-bottom: 22px; }

@media (max-width: 430px) {
  .stage { padding: 14px 0; }
  .device { transform: scale(.9); transform-origin: top center; }
}

/* ── Polish pass · states + accessibility ─────────────────────── */
button, a, input, textarea, .check, .qbtn, .chip, .opt, .proto, .row, .toggle, .go, .send, [data-theme-toggle] { -webkit-tap-highlight-color: transparent; }

:where(button, a, input, textarea, [tabindex], .check, .qbtn, .chip, .opt, .proto, .list .row, .toggle):focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
}
[data-theme="night"] :where(button, a, input, textarea, [tabindex], .check, .qbtn, .chip, .opt, .proto, .list .row, .toggle):focus-visible { outline-color: var(--calm); }

/* button / row press feedback */
.btn:active { transform: translateY(1px); }
.chip:active { transform: scale(.96); }
.tabbar button:active { transform: scale(.9); }
.list .row:active { background: var(--surface-2); }

/* Cōrta AI typing (loading) indicator */
.bubble.typing { align-self: flex-start; display: inline-flex; gap: 5px; align-items: center; padding: 15px 16px; }
.bubble.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: mtype 1.1s infinite ease-in-out both; }
.bubble.typing span:nth-child(2) { animation-delay: .16s; }
.bubble.typing span:nth-child(3) { animation-delay: .32s; }
@keyframes mtype { 0%, 70%, 100% { transform: translateY(0); opacity: .35; } 35% { transform: translateY(-4px); opacity: 1; } }

/* respect reduced motion everywhere (vestibular safety) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
