/* Bori caregiver app. Lemonade-style calm: soft gray and white, gray line-art scenes, one accent (Bori violet),
   centered serif titles, floating icon nav. Themes: light, dark, or follow the phone (data-theme on <html>). */
@font-face { font-family: "Pretendard"; src: url("/static/fonts/PretendardVariable.woff2") format("woff2-variations"); font-weight: 45 920; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("/static/fonts/Fraunces-latin.woff2") format("woff2-variations"); font-weight: 100 900; font-display: swap; }
:root {
  --bg: #F4F4F7; --surface: #FFFFFF; --ink: #1F1D2B; --ink-2: #4A4858; --muted: #8C8A9B; --line: #E7E6EE; --art: #A9A7BA; --art-fill: #ECEBF2;
  --accent: #6C4CF5; --accent-ink: #FFFFFF; --accent-2: #EEEAFE; --sun: #FFB547; --dark: #24222F; --dark-ink: #F4F3F9;
  --ok: #12A574; --ok-2: #DDF5EB; --warn: #B86E00; --warn-2: #FFF1DA; --bad: #E5403D; --bad-2: #FDE6E5;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, -apple-system, sans-serif;
  --r-xl: 28px; --r-lg: 20px; --r-md: 16px; --r-sm: 12px;
  --shadow: 0 1px 2px rgba(31, 29, 43, .05), 0 10px 26px -18px rgba(31, 29, 43, .28);
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.56, .64, 1);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --gut-l: max(20px, env(safe-area-inset-left, 0px)); --gut-r: max(20px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121118; --surface: #1C1B25; --ink: #F2F1F7; --ink-2: #CFCDDB; --muted: #9B99AC; --line: #2B2A37; --art: #6F6D84; --art-fill: #24232F;
    --accent: #9D86FF; --accent-ink: #121118; --accent-2: #2A2547; --dark: #2A2838; --dark-ink: #F4F3F9;
    --ok: #4FD6A4; --ok-2: #163329; --warn: #FFC56E; --warn-2: #3A2E1A; --bad: #FF7D7A; --bad-2: #3D1D22;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 28px -18px rgba(0, 0, 0, .9);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121118; --surface: #1C1B25; --ink: #F2F1F7; --ink-2: #CFCDDB; --muted: #9B99AC; --line: #2B2A37; --art: #6F6D84; --art-fill: #24232F;
  --accent: #9D86FF; --accent-ink: #121118; --accent-2: #2A2547; --dark: #2A2838; --dark-ink: #F4F3F9;
  --ok: #4FD6A4; --ok-2: #163329; --warn: #FFC56E; --warn-2: #3A2E1A; --bad: #FF7D7A; --bad-2: #3D1D22;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 28px -18px rgba(0, 0, 0, .9);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }
body { font-family: var(--sans); font-size: 16px; line-height: 1.5; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none; word-break: keep-all; transition: background-color .4s ease, color .4s ease; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 12px; }
svg { display: block; flex-shrink: 0; }
#app { max-width: 600px; margin: 0 auto; position: relative; overflow-x: hidden; min-height: 100dvh; }

/* Screens + motion */
.screen { min-height: 100dvh; padding: calc(var(--safe-t) + 10px) var(--gut-r) calc(120px + var(--safe-b)) var(--gut-l); display: grid; align-content: start; gap: 18px; }
.fwd { animation: fwd .46s var(--ease) both; }
.back { animation: back .46s var(--ease) both; }
.fade { animation: fade .4s ease both; }
@keyframes fwd { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes back { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 65% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: -360px 0; } to { background-position: 360px 0; } }
@keyframes sheetUp { from { transform: translateY(105%); } to { transform: none; } }
@keyframes sunUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rays { to { transform: rotate(360deg); } }
@keyframes drift { 0% { transform: translateX(-16px); } 50% { transform: translateX(16px); } 100% { transform: translateX(-16px); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes puff { 0% { transform: translateY(0) scale(.6); opacity: 0; } 30% { opacity: .9; } 100% { transform: translateY(-22px) scale(1.2); opacity: 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229, 64, 61, .5); } 100% { box-shadow: 0 0 0 12px rgba(229, 64, 61, 0); } }
.stagger > * { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms + 40ms); }
.press { transition: transform .16s var(--ease), box-shadow .25s, background-color .25s, opacity .25s; }
.press:active { transform: scale(.965); }

/* Type */
.eyebrow, .label { font-size: 12px; font-weight: 750; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.title { font-family: var(--serif); font-weight: 420; font-size: 34px; line-height: 1.12; letter-spacing: -.5px; text-align: center; text-wrap: balance; }
.title-left { text-align: left; }
h2 { font-family: var(--serif); font-weight: 450; font-size: 23px; line-height: 1.2; letter-spacing: -.2px; }
h3 { font-size: 16.5px; font-weight: 700; letter-spacing: -.2px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.ko { color: var(--muted); font-weight: 500; }
.section-t { display: flex; justify-content: space-between; align-items: baseline; margin: 10px 2px -4px; }
.section-t a, .section-t button { color: var(--accent); font-weight: 750; font-size: 14px; }

/* Top bar (round outline buttons left and right, title in the middle) */
.top { display: grid; grid-template-columns: 46px 1fr 46px; align-items: center; gap: 10px; min-height: 52px; }
.top .title { font-size: 26px; }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 1.6px solid var(--ink-2); color: var(--ink-2); background: transparent; }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn.solid { border: 0; background: var(--surface); box-shadow: var(--shadow); }
.spacer { width: 44px; height: 44px; }

/* Line-art scenes */
.scene { width: 100%; height: auto; overflow: visible; }
.scene .ln { fill: none; stroke: var(--art); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.scene .fill { fill: var(--art-fill); }
.scene .hill { fill: var(--bg); }
.banner .scene .hill, .card .scene .hill, .sheet .scene .hill { fill: var(--surface); }
.scene .sunball { fill: var(--sun); transform-box: fill-box; transform-origin: center; animation: sunUp 1.6s var(--ease) both; }
.scene .rays { transform-box: fill-box; transform-origin: center; animation: rays 30s linear infinite; }
.scene .rays line { stroke: var(--sun); stroke-width: 2.2; stroke-linecap: round; }
.scene .cloud { animation: drift 10s ease-in-out infinite; }
.scene .cloud2 { animation: drift 14s ease-in-out infinite reverse; }
.scene .bird { animation: bob 2.6s ease-in-out infinite; }
.scene .smoke { fill: var(--art-fill); stroke: var(--art); stroke-width: 1.6; animation: puff 3.2s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.scene .smoke.s2 { animation-delay: 1.6s; }
.scene.draw .ln { stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 2.2s var(--ease) forwards; }
.scene-wrap { margin: -6px calc(-1 * var(--gut-l)) 0 calc(-1 * var(--gut-r)); }

/* Cards */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; border: 1px solid var(--line); background: transparent; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 750; padding: 5px 11px; border-radius: 999px;
  background: var(--accent-2); color: var(--accent); white-space: nowrap; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-2); color: var(--ok); } .chip.warn { background: var(--warn-2); color: var(--warn); }
.chip.bad { background: var(--bad-2); color: var(--bad); } .chip.gray { background: var(--bg); color: var(--muted); }

/* Today card */
.today { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.ring { width: 76px; height: 76px; position: relative; }
.ring svg { width: 76px; height: 76px; transform: rotate(-90deg); }
.ring .trk { stroke: var(--line); }
.ring .bar { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 19px; font-weight: 800; }
.today h2 { font-size: 21px; }
.today p { color: var(--muted); font-size: 14.5px; margin-top: 4px; }
.today .chip { margin-top: 8px; }

/* Quick actions: one card, three columns with dividers, circle icons, uppercase labels */
.qa { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.qa > * { display: grid; justify-items: center; align-content: center; gap: 10px; padding: 18px 6px 16px; min-height: 120px; text-align: center;
  font-size: 11.5px; font-weight: 750; letter-spacing: .9px; text-transform: uppercase; color: var(--ink-2); line-height: 1.25;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.qa > *:nth-child(3n) { border-right: 0; }
.qa > *:nth-last-child(-n+3) { border-bottom: 0; }
.circ { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); }
.circ svg { width: 26px; height: 26px; stroke: var(--ink-2); }

/* Needs you: a dark card with one accent action */
.notice { background: var(--dark); color: var(--dark-ink); border-radius: var(--r-lg); padding: 6px 18px; box-shadow: var(--shadow); }
.notice-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.notice-row:last-child { border-bottom: 0; }
.notice-row h3 { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notice-row p { color: rgba(255, 255, 255, .62); font-size: 13.5px; }
.notice-row .t { min-width: 0; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.notice-row .t > div { min-width: 0; }
.notice-row .dot-live { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: pulse 1.6s ease-out infinite; }
.pill-btn { padding: 9px 16px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 13.5px; white-space: nowrap; }

/* Timeline */
.timeline { display: grid; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.tl { display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.tl:last-child { border-bottom: 0; }
.tl .d { text-align: center; line-height: 1.05; }
.tl .d b { display: block; font-family: var(--serif); font-size: 24px; font-weight: 450; }
.tl .d small { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.tl.lvl-due .d b { color: var(--bad); }
.tl .t { min-width: 0; }
.tl .t h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl .t p { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { width: 18px; height: 18px; stroke: var(--muted); }

/* Feature banner */
.banner { display: grid; grid-template-columns: 1fr; gap: 12px; justify-items: center; text-align: center; padding: 22px 18px 20px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.banner .scene { max-width: 240px; }
.banner p { color: var(--muted); font-size: 14.5px; max-width: 32ch; }
.checks { display: grid; gap: 6px; justify-items: start; }
.checks span { display: flex; gap: 8px; align-items: center; font-size: 14.5px; color: var(--ink-2); }
.checks svg { width: 18px; height: 18px; stroke: #fff; background: var(--accent); border-radius: 50%; padding: 3px; }

/* Sections grid */
.sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sec { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 20px 12px 16px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); position: relative; }
.sec h3 { font-size: 15px; }
.sec .ko { font-size: 12.5px; display: block; margin-top: -6px; }
.sec .count { position: absolute; top: 12px; right: 14px; font-size: 12px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Lists */
.search { display: flex; align-items: center; gap: 10px; padding: 0 16px; min-height: 50px; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); }
.search svg { width: 19px; height: 19px; stroke: var(--muted); }
.search input { flex: 1; border: 0; background: transparent; font-size: 16px; min-width: 0; outline: none; }
.list { display: grid; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .circ { width: 42px; height: 42px; } .row .circ svg { width: 20px; height: 20px; }
.row .t { min-width: 0; text-align: left; }
.row .t h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t p { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.alert .circ { background: var(--bad-2); } .row.alert .circ svg { stroke: var(--bad); }
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 26px 16px; color: var(--muted); }
.empty .scene { max-width: 200px; }

/* Tabs (underline) */
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-bottom: 1px solid var(--line); }
.seg button { position: relative; z-index: 1; min-height: 46px; font-weight: 750; font-size: 14px; letter-spacing: .4px; color: var(--muted); transition: color .25s; }
.seg button[aria-selected="true"] { color: var(--ink); }
.seg .ind { position: absolute; bottom: -1px; left: 0; height: 3px; border-radius: 3px; background: var(--accent); transition: transform .42s var(--spring), width .3s var(--ease); }

/* Detail */
.detail-head { display: grid; justify-items: center; gap: 6px; text-align: center; }
.detail-head .circ { width: 64px; height: 64px; background: var(--surface); box-shadow: var(--shadow); }
.detail-head .circ svg { width: 30px; height: 30px; }
.kv { display: grid; }
.kv > div { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { font-weight: 700; color: var(--ink-2); }
.kv dt .ko { display: block; font-size: 12px; }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; white-space: pre-line; }
.kv dd a { color: var(--accent); font-weight: 700; }
.files { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.file { aspect-ratio: 1; border-radius: var(--r-md); overflow: hidden; background: var(--surface); display: grid; place-items: center; position: relative; box-shadow: var(--shadow); }
.file img { width: 100%; height: 100%; object-fit: cover; }
.file .nm { position: absolute; left: 6px; right: 6px; bottom: 6px; font-size: 11px; font-weight: 700; background: rgba(255, 255, 255, .9); color: #1F1D2B;
  border-radius: 8px; padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file svg { width: 28px; height: 28px; stroke: var(--art); }
.voice-card { grid-column: 1 / -1; display: grid; gap: 8px; }
audio { width: 100%; }
.hist { display: grid; gap: 12px; padding: 0; }
.hist li { list-style: none; display: grid; grid-template-columns: 14px 1fr; gap: 12px; }
.hist .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-top: 7px; box-shadow: 0 0 0 4px var(--accent-2); }
.hist ul { padding: 0; display: grid; gap: 4px; margin-top: 6px; }
.hist .chg { font-size: 14px; color: var(--muted); list-style: none; }
.hist .chg s { color: var(--bad); } .hist .chg ins { color: var(--ok); text-decoration: none; font-weight: 700; }

/* Messages (family view) */
.thread { display: grid; gap: 10px; }
.bub { max-width: 84%; padding: 11px 15px; border-radius: 20px; display: grid; gap: 3px; animation: rise .35s var(--ease) both; }
.bub p { white-space: pre-wrap; }
.bub.me { justify-self: start; background: var(--surface); box-shadow: var(--shadow); border-bottom-left-radius: 6px; }
.bub.ai { justify-self: start; background: var(--accent-2); border-bottom-left-radius: 6px; }
.bub.fam { justify-self: end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.bub-who { font-size: 12px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; opacity: .7; }
.bub-t { font-size: 12px; opacity: .6; }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 54px; padding: 0 22px; border-radius: 999px;
  font-weight: 800; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 12px 24px -14px rgba(108, 76, 245, .9); }
.btn svg { width: 19px; height: 19px; stroke: currentColor; }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.btn.outline { background: transparent; color: var(--ink); border: 1.6px solid var(--ink-2); box-shadow: none; }
.btn.danger { background: transparent; color: var(--bad); box-shadow: none; min-height: 44px; }
.btn.short { width: auto; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spinner { width: 20px; height: 20px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.fab { position: fixed; right: max(20px, calc(50% - 280px)); bottom: calc(108px + var(--safe-b)); z-index: 6; width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); box-shadow: 0 16px 30px -12px rgba(108, 76, 245, .9); animation: pop .5s var(--spring) .2s both; }
.fab svg { width: 26px; height: 26px; stroke: var(--accent-ink); }

/* Tab bar: floating pill, icon circles, accent underline under the active one */
.tabbar { position: fixed; z-index: 8; left: 0; right: 0; bottom: calc(14px + var(--safe-b)); margin: 0 auto; width: min(420px, calc(100% - 40px));
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px 10px 10px; border-radius: 999px; background: var(--surface);
  box-shadow: 0 16px 40px -16px rgba(31, 29, 43, .45); animation: rise .5s var(--ease) both; }
.tabbar a { position: relative; z-index: 1; display: grid; justify-items: center; color: var(--muted); }
.tabbar .ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); transition: background-color .3s, transform .35s var(--spring); }
.tabbar svg { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"] .ic { transform: translateY(-2px); }
.tabbar .ind { position: absolute; z-index: 0; bottom: 5px; left: 10px; width: calc((100% - 20px) / 4); display: grid; place-items: center; transition: transform .45s var(--spring); }
.tabbar .ind::after { content: ""; width: 22px; height: 3px; border-radius: 3px; background: var(--accent); }
.tabbar .badge { position: absolute; top: -2px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad);
  color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; animation: pop .45s var(--spring) both; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Sheets + forms */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(18, 17, 24, .45); animation: fade .25s ease both; }
.sheet { position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 600px; max-height: 92dvh; overflow-y: auto; background: var(--bg);
  border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 10px var(--gut-r) calc(24px + var(--safe-b)) var(--gut-l); display: grid; gap: 14px;
  animation: sheetUp .42s var(--ease) both; box-shadow: 0 -20px 50px -30px rgba(0, 0, 0, .5); }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); justify-self: center; margin-bottom: 4px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: -10px; background: var(--bg); padding: 6px 0; z-index: 2; }
.fields { display: grid; gap: 12px; }
.fld { display: grid; gap: 6px; }
.fld > span { font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.fld > span .ko { font-size: 12px; margin-left: 4px; }
.fld .help { font-size: 12.5px; color: var(--muted); }
.inp { width: 100%; min-height: 52px; padding: 12px 14px; border: 1.6px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-size: 16px; }
textarea.inp { min-height: 96px; resize: vertical; }
.inp:focus { outline: none; border-color: var(--accent); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--surface); border-radius: var(--r-sm); border: 1.6px solid var(--line); }
.switch input { appearance: none; width: 50px; height: 30px; border-radius: 15px; background: var(--line); position: relative; transition: background .25s; flex-shrink: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .3s var(--spring); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }
.code-big { font-family: var(--serif); font-size: 50px; font-weight: 420; letter-spacing: 8px; text-align: center; color: var(--accent); font-variant-numeric: tabular-nums; animation: pop .5s var(--spring) both; }
.steps { padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); }

/* Onboarding */
.ob { min-height: 100dvh; padding: calc(var(--safe-t) + 18px) var(--gut-r) calc(28px + var(--safe-b)) var(--gut-l); display: grid; grid-template-rows: auto 1fr auto; gap: 18px; }
.ob-dots { display: flex; justify-content: center; gap: 8px; min-height: 7px; }
.ob-dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--line); transition: width .35s var(--spring), background .3s; }
.ob-dots i.on { width: 22px; background: var(--accent); }
.ob-body { display: grid; align-content: center; gap: 18px; }
.ob-body .title { font-size: 34px; }
.ob-body p.lead { text-align: center; color: var(--muted); font-size: 16.5px; max-width: 32ch; justify-self: center; }
.wordmark { font-family: var(--serif); font-weight: 480; font-size: 64px; letter-spacing: -1.5px; text-align: center; color: var(--ink); animation: rise .8s var(--ease) 1.4s both; }
.wordmark i { color: var(--accent); font-style: normal; }
.ob-intro .lead { animation: rise .8s var(--ease) 1.7s both; }
.ob-intro .ob-foot { animation: rise .8s var(--ease) 2s both; }
.opts { display: grid; gap: 10px; }
.opt { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 16px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow);
  text-align: left; font-weight: 700; border: 2px solid transparent; }
.opt[aria-pressed="true"] { border-color: var(--accent); }
.opt .circ { width: 44px; height: 44px; font-size: 20px; }
.opt .tick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; }
.opt[aria-pressed="true"] .tick { background: var(--accent); border-color: var(--accent); }
.opt .tick svg { width: 14px; height: 14px; stroke: #fff; opacity: 0; }
.opt[aria-pressed="true"] .tick svg { opacity: 1; animation: pop .35s var(--spring); }
.opt small { display: block; font-weight: 500; color: var(--muted); font-size: 13.5px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip-btn { padding: 10px 16px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-weight: 700; border: 2px solid transparent; }
.chip-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.theme-previews { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tp { display: grid; gap: 8px; justify-items: center; padding: 12px 8px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow); border: 2px solid transparent; font-weight: 700; font-size: 14px; }
.tp[aria-pressed="true"] { border-color: var(--accent); }
.tp .mini { width: 100%; aspect-ratio: .7; border-radius: 10px; display: grid; align-content: start; gap: 5px; padding: 8px; }
.tp .mini i { height: 7px; border-radius: 4px; display: block; }
.tp .mini.l { background: #F4F4F7; } .tp .mini.l i { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); } .tp .mini.l i:first-child { background: #6C4CF5; width: 50%; }
.tp .mini.d { background: #121118; } .tp .mini.d i { background: #24232F; } .tp .mini.d i:first-child { background: #9D86FF; width: 50%; }
.tp .mini.a { background: linear-gradient(135deg, #F4F4F7 50%, #121118 50%); }
.tp .mini.a i { background: rgba(127, 127, 140, .45); } .tp .mini.a i:first-child { background: #6C4CF5; width: 50%; }
.celebrate { position: relative; display: grid; place-items: center; height: 150px; }
.celebrate .big { width: 110px; height: 110px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; animation: pop .6s var(--spring) both; }
.celebrate .big svg { width: 54px; height: 54px; stroke: #fff; }
.celebrate .big path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .5s .35s var(--ease) forwards; }
.celebrate i { position: absolute; width: 10px; height: 10px; border-radius: 50%; animation: confetti 1.2s var(--ease) .3s both; }
@keyframes confetti { from { transform: rotate(var(--a)) translateY(0) scale(1); opacity: 1; } to { transform: rotate(var(--a)) translateY(-90px) scale(.3); opacity: 0; } }

/* Skeleton + toast */
.skel { border-radius: var(--r-lg); background: linear-gradient(90deg, var(--line) 0, var(--surface) 40%, var(--line) 80%) 0 0 / 720px 100%; animation: shimmer 1.2s linear infinite; }
.sk-1 { height: 52px; } .sk-2 { height: 170px; } .sk-3 { height: 72px; }
#toast { position: fixed; left: 0; right: 0; margin: 0 auto; width: max-content; max-width: calc(100% - 40px); bottom: calc(108px + var(--safe-b)); z-index: 30;
  display: flex; align-items: center; gap: 10px; background: var(--dark); color: var(--dark-ink); padding: 13px 20px; border-radius: 999px; font-weight: 700;
  box-shadow: 0 16px 34px -14px rgba(0, 0, 0, .5); animation: rise .35s var(--spring) both; }
#toast svg { width: 20px; height: 20px; stroke: var(--ok); }
#toast svg path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .4s .1s var(--ease) forwards; }

/* Sign-in page */
.login-screen { padding-bottom: calc(40px + var(--safe-b)); }
.login-err { color: var(--bad); background: var(--bad-2); border: 0; font-weight: 700; }

@media (max-width: 370px) { .title { font-size: 30px; } .qa > * { font-size: 10.5px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .scene.draw .ln { stroke-dashoffset: 0; }
}

/* Emergency banner */
.sos-banner { background: var(--bad); color: #fff; border-radius: var(--r-lg); padding: 18px; display: grid; gap: 14px; box-shadow: 0 18px 36px -18px rgba(229, 64, 61, .9);
  animation: rise .4s var(--spring) both; }
.sos-banner h2 { color: #fff; }
.sos-banner .label { color: rgba(255, 255, 255, .85); }
.sos-banner a { color: #fff; font-weight: 700; }
.sos-banner .btn { background: #fff; color: var(--bad); box-shadow: none; }
.sos-banner .btn.outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .7); }
