/* YeNo: calm, native-feeling, playful. CSS does the motion; JS only says which screen to show. */

:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #ecebe6;
  --ink: #1b1b1f;
  --muted: #5f5e5a;
  --faint: #a8a69f;
  --line: #e4e2dc;
  --hair: #efeee9;
  --brand: #3b4a9c;
  --brand-2: #2c3878;
  --brand-soft: #e8eaf6;
  --brand-ink: #ffffff;
  --ok: #1f7a4d;
  --ok-bg: #e3f2ea;
  --warn-bg: #fdf0d5;
  --warn-line: #e0a339;
  --warn-ink: #6b4100;
  --warn-dot: #d48a00;
  --danger: #b42318;
  --danger-bg: #fde7e4;
  --bar-bg: #ffffff;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(27,27,31,.04), 0 6px 20px rgba(27,27,31,.05);
  --shadow-lift: 0 10px 28px rgba(59,74,156,.16);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  /* motion: a soft spring for most things, a bouncier one for playful moments */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --spring: linear(0, .009, .035 2.1%, .141, .281 6.7%, .723 12.9%, .938 16.7%, 1.017, 1.077 20.4%, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, .991, .977 51%, .974 53.8%, .975 57.1%, .997 69.8%, 1.003 76.9%, 1.004 83.8%, 1);
  --spring-soft: linear(0, .06 2.3%, .22 5%, .87 14%, 1.03 19%, 1.06 23%, 1.04 30%, 1 44%, .995 58%, 1);
  color-scheme: light;
  interpolate-size: allow-keywords;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1011;
    --surface: #1a1b1e;
    --surface-2: #26272b;
    --ink: #ecebe6;
    --muted: #a3a4a9;
    --faint: #6b6c71;
    --line: #2d2e33;
    --hair: #26272b;
    --brand: #9aa8f0;
    --brand-2: #b7c1f5;
    --brand-soft: #23284a;
    --brand-ink: #10153a;
    --ok: #5cc98a;
    --ok-bg: #16291f;
    --warn-bg: #2b2210;
    --warn-line: #a37b19;
    --warn-ink: #f2cf74;
    --danger: #ff8a80;
    --danger-bg: #2d1514;
    --bar-bg: #1a1b1e;
    --shadow: none;
    --shadow-lift: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  text-rendering: optimizeLegibility;
}
main { max-width: 560px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 18px 24px; }
h1 { font: 700 30px/1.15 var(--rounded); letter-spacing: -0.02em; margin: 6px 0 6px; text-wrap: balance; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 28px 4px 10px; font-weight: 600; }
h3 { font-size: 17px; margin: 0 0 6px; }
p { margin: 0 0 10px; text-wrap: pretty; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; word-break: break-all; }
.num { font-family: var(--rounded); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 10px; }

.card { background: var(--surface); border: 0; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .card { border: 1px solid var(--line); } }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }

/* ---------- buttons: a quick spring when pressed ---------- */
button, .btn {
  font: inherit; font-weight: 600; border-radius: var(--radius-sm); padding: 12px 16px; cursor: pointer; min-height: 44px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px;
  transition: transform .45s var(--spring), background-color .2s, box-shadow .2s, opacity .2s;
  touch-action: manipulation;
}
button:active:not(:disabled), .btn:active, a.card:active, .app-pick:active, .choice:active { transform: scale(.965); transition-duration: .12s; }
button.primary, .btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; box-shadow: var(--shadow-lift); }
button.danger { background: var(--danger); color: #fff; border-color: transparent; }
button.ghost { background: transparent; }
button.block { width: 100%; }
button:disabled { opacity: .45; cursor: default; box-shadow: none; }
button.small { padding: 7px 12px; font-size: 14px; border-radius: 11px; min-height: 36px; }
a.card { transition: transform .45s var(--spring), box-shadow .2s; }

input, select, textarea {
  font: inherit; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--ink); transition: border-color .2s, background-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); flex: none; width: 22px; height: 22px; margin: 2px 0 0; }
.check-row { display: flex; align-items: flex-start; gap: 12px; margin-top: 12px; font-weight: 400; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.error { color: var(--danger); font-size: 14px; min-height: 1em; margin-top: 8px; }

/* ---------- the mascot ---------- */
.mascot { display: block; overflow: visible; }
.mascot .eyes { transform-box: fill-box; transform-origin: center; animation: m-blink 5.2s infinite; }
.mascot.float { animation: m-float 5s ease-in-out infinite; }
.mascot.mood-thinking .eyes { animation: m-glance 2.6s ease-in-out infinite; }
.mascot.mood-stopped .eyes { animation: none; }
.mascot.mood-happy { animation: m-hop .9s var(--spring) both; }
@keyframes m-blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.08); } }
@keyframes m-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes m-glance { 0%, 100% { transform: translate(0, 0); } 35%, 60% { transform: translate(4px, -3px); } }
@keyframes m-hop { 0% { transform: scale(.8); } 60% { transform: scale(1.06) translateY(-6px); } 100% { transform: none; } }
.halo { position: relative; display: grid; place-items: center; }
.halo::before { content: ""; position: absolute; inset: 6%; border-radius: 50%; background: var(--halo, transparent); filter: blur(2px); }
.halo > * { position: relative; }
.halo.asking { --halo: radial-gradient(circle, #fff1d9 0 55%, transparent 72%); }
.halo.asking::before { animation: m-pulse 2.4s ease-in-out infinite; }
.halo.stopped { --halo: radial-gradient(circle, #fde7e4 0 55%, transparent 72%); }
@media (prefers-color-scheme: dark) {
  .halo.asking { --halo: radial-gradient(circle, #3a2c10 0 55%, transparent 72%); }
  .halo.stopped { --halo: radial-gradient(circle, #3a1714 0 55%, transparent 72%); }
}
@keyframes m-pulse { 50% { transform: scale(1.08); opacity: .7; } }

/* ---------- home hero: the mascot inside the budget ring ---------- */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 6px 0 4px; }
.hero .ring-wrap { position: relative; width: min(64vw, 248px); aspect-ratio: 1; display: grid; place-items: center; }
.hero .ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.hero .ring .track { stroke: var(--surface-2); }
.hero .ring .fill { stroke: url(#mRing); stroke-dasharray: var(--len) 1000; }
main[data-enter] .hero .ring .fill { animation: ring-in 1.1s var(--ease-out) both .1s; }
.hero .ring .fill.hot { stroke: var(--danger); }
@keyframes ring-in { from { stroke-dasharray: 0 1000; } }
.hero .ring-wrap .mascot { width: 58%; height: auto; }
.hero > .mascot { width: 150px; height: auto; }
.hero .ring-wrap.bare { width: 170px; }
.hero .ring-wrap.bare .mascot { width: 88%; }
.hero .ring-wrap { text-decoration: none; }
.hero-title { font: 700 28px/1.15 var(--rounded); letter-spacing: -0.02em; margin: 14px 0 2px; }
.hero-sub { color: var(--muted); font-size: 15px; margin: 0; }
.hero-stats { display: flex; gap: 22px; margin: 20px 0 4px; list-style: none; padding: 0; }
.hero-stats li { display: flex; flex-direction: column; align-items: center; }
.hero-stats li + li { border-left: 1px solid var(--line); padding-left: 22px; }
.hero-stats b { font: 700 24px/1.1 var(--rounded); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.hero-stats b.accent { color: var(--brand); }
.hero-stats span { font-size: 12px; color: var(--muted); }
.home-top { display: flex; align-items: center; gap: 8px; padding: 2px 2px 0; }
.home-top .brand { font: 700 21px var(--rounded); letter-spacing: -0.02em; }
.home-top .icon-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); }

/* first-load entrance: only after navigating, never on background refresh */
main[data-enter] > * { animation: rise .55s var(--ease-out) both; }
main[data-enter] > :nth-child(2) { animation-delay: .04s; }
main[data-enter] > :nth-child(3) { animation-delay: .08s; }
main[data-enter] > :nth-child(4) { animation-delay: .12s; }
main[data-enter] > :nth-child(5) { animation-delay: .16s; }
main[data-enter] > :nth-child(n+6) { animation-delay: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- status ---------- */
.status { display: flex; align-items: center; gap: 10px; margin: 6px 0 18px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); flex: none; }
.dot.off { background: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 20%, transparent); }
.dot.away, .dot.ask { background: var(--warn-dot); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn-dot) 20%, transparent); }

/* ---------- switches: an iOS-style thumb that stretches when pressed ---------- */
.kill { display: flex; align-items: center; gap: 14px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; margin: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--surface-2); border-radius: 99px; transition: background-color .25s; }
.switch span::before { content: ""; position: absolute; width: 28px; height: 28px; left: 2px; top: 2px; background: #fff; border-radius: 99px;
  box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: transform .5s var(--spring), width .2s var(--ease-out); }
.switch:active span::before { width: 34px; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch:active input:checked + span::before { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
#killswitch:not(:checked) + span { background: var(--danger); }

/* ---------- requests ---------- */
.req { cursor: pointer; }
.req .amount { font: 600 17px/1.3 var(--font); letter-spacing: -0.01em; }
a.req-row { display: flex; align-items: center; gap: 14px; padding: 15px 18px; text-decoration: none; color: inherit; }
a.req-row .req-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warn-dot); flex: none; }
a.req-row .req-dot.bad { background: var(--danger); }
a.req-row .go { color: var(--brand); font-weight: 600; font-size: 14px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); }
.tag.ok { color: var(--ok); background: var(--ok-bg); }
.tag.bad { color: var(--danger); background: var(--danger-bg); }
.warnbox { background: var(--warn-bg); border: 0; color: var(--warn-ink); border-radius: var(--radius-sm); padding: 13px 15px; margin: 12px 0; }
.warnbox strong { display: block; margin-bottom: 4px; }
.warnbox q { display: block; font-family: ui-monospace, Menlo, monospace; font-size: 13px; margin-top: 6px; quotes: "“" "”"; word-break: break-word; }
dl.lines { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; }
dl.lines dt { color: var(--muted); font-size: 14px; }
dl.lines dd { margin: 0; font-size: 14px; word-break: break-word; }
.decide { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 16px; }
.decide #approve { min-height: 58px; font-size: 17px; border-radius: 18px; }
.decide #deny { min-height: 58px; font-size: 16px; border: 0; }

/* approval hero */
.back { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); margin: 0 0 4px; }
.req-hero { display: flex; flex-direction: column; align-items: center; text-align: center; margin: 0 0 18px; }
.req-hero .halo { width: 112px; height: 112px; }
.req-hero .halo .mascot { width: 76px; height: auto; }
.req-hero .who { font-size: 14px; font-weight: 600; color: var(--muted); margin: 2px 0 0; }
.req-hero .who.asking { color: var(--warn-ink); }
.req-hero h1 { font-size: 26px; font-weight: 600; margin: 14px 0 0; }
.req-hero .big { font: 700 68px/1.02 var(--rounded); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
main[data-enter] .req-hero .big { animation: pop .6s var(--spring) both .08s; }
.req-hero .meta { font-size: 14px; color: var(--muted); margin: 6px 0 0; }
@keyframes pop { from { transform: scale(.86); opacity: 0; } }
.fit { margin: 0 0 16px; }
.fit .lbl { display: flex; font-size: 13px; margin-bottom: 8px; }
.fit .lbl span { flex: 1; color: var(--muted); }
.fit .track { height: 7px; border-radius: 99px; background: var(--surface-2); display: flex; overflow: hidden; }
.fit .track i { display: block; height: 100%; background: var(--brand); }
.fit .track i + i { background: var(--warn-dot); transform-origin: left; }
main[data-enter] .fit .track i + i { animation: grow .7s var(--ease-out) both .2s; }
.fit .track i.over { background: var(--danger); }
@keyframes grow { from { transform: scaleX(0); } }

/* ---------- permission grid ---------- */
.perm { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; border-radius: 9px; padding: 7px 11px; font-size: 13px; background: transparent; font-weight: 600; color: var(--muted); min-height: 34px; box-shadow: none; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.seg button.on[data-mode="allow"] { background: var(--ok-bg); color: var(--ok); }
.seg button.on[data-mode="ask"] { background: var(--warn-bg); color: var(--warn-ink); }
.seg button.on[data-mode="block"] { background: var(--danger-bg); color: var(--danger); }

/* ---------- log ---------- */
.log-item { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 11px 0; border-top: 1px solid var(--hair); font-size: 14px; }
.log-item:first-child { border-top: 0; }
.log-item time { color: var(--muted); font-size: 12px; display: block; }

/* ---------- floating tab bar ---------- */
nav.tabs {
  position: fixed; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); translate: -50% 0; width: min(calc(100% - 28px), 520px);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 7px; border-radius: 26px;
  background: color-mix(in srgb, var(--bar-bg) 82%, transparent); -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  box-shadow: 0 10px 30px rgba(27,27,31,.12), 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent); z-index: 5;
  view-transition-name: tabs;
}
nav.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600;
  padding: 7px 0 5px; border-radius: 19px; position: relative; transition: background-color .3s, color .3s, transform .45s var(--spring); }
nav.tabs a:active { transform: scale(.92); transition-duration: .1s; }
nav.tabs a svg { width: 24px; height: 24px; }
nav.tabs a.on { color: var(--brand); background: var(--brand-soft); }
nav.tabs .tab-mascot .tab-eyes { fill: var(--bar-bg); }
nav.tabs a.on .tab-mascot .tab-eyes { fill: var(--brand-soft); }
nav.tabs .badge { position: absolute; top: 2px; right: calc(50% - 24px); background: var(--danger); color: #fff; font-size: 11px; min-width: 18px; height: 18px; line-height: 18px;
  border-radius: 9px; padding: 0 5px; text-align: center; animation: pop .5s var(--spring) both; }

/* ---------- sheets (PIN, Face ID): slide up like a native sheet ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(10,10,20,.42); display: flex; align-items: flex-end; justify-content: center; z-index: 10;
  transition: opacity .3s var(--ease-out); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.sheet { background: var(--surface); width: 100%; max-width: 560px; border-radius: 28px 28px 0 0; padding: 12px 18px calc(22px + env(safe-area-inset-bottom));
  transition: transform .55s var(--spring-soft); box-shadow: 0 -10px 40px rgba(0,0,0,.12); }
.sheet::before { content: ""; display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
@starting-style { .sheet-bg { opacity: 0; } .sheet { transform: translateY(100%); } }
.pin { letter-spacing: .5em; text-align: center; font-size: 26px; }

/* toasts: drop in from the top like a notification banner, and never block a tap */
.toast { position: fixed; left: 12px; right: 12px; top: calc(10px + env(safe-area-inset-top)); max-width: 536px; margin: 0 auto; z-index: 20;
  background: color-mix(in srgb, var(--ink) 92%, transparent); color: var(--bg); padding: 13px 16px; border-radius: 18px; font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,.2); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); pointer-events: none;
  transition: transform .55s var(--spring), opacity .3s; }
@starting-style { .toast { transform: translateY(-24px) scale(.96); opacity: 0; } }
.toast.out { opacity: 0; transform: translateY(-12px); }
.empty { text-align: center; color: var(--muted); padding: 22px 8px; }
.steps { display: flex; gap: 6px; margin: 4px 0 18px; }
.steps i { height: 4px; flex: 1; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--brand); }
.connector { background: var(--surface-2); border-radius: 12px; padding: 12px; margin: 10px 0; }
details summary { cursor: pointer; font-weight: 600; margin: 8px 0; }
/* smooth open/close where the browser supports it */
details::details-content { block-size: 0; overflow: clip; transition: block-size .35s var(--ease-out), content-visibility .35s allow-discrete; }
details[open]::details-content { block-size: auto; }
ol.howto { padding-left: 20px; margin: 6px 0; }
ol.howto li { margin: 4px 0; }
[hidden] { display: none !important; }

.says .quote { font-size: 16px; margin: 6px 0 0; padding-left: 12px; border-left: 3px solid var(--line); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 8px; }
.stats div { display: flex; flex-direction: column; }
.stats b { font: 700 22px var(--rounded); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--muted); }

/* ---------- agent picker + setup ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 13px; font-size: 14px; border-radius: 99px; font-weight: 600; background: var(--surface-2); border: 0; }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
pre.connector { white-space: pre-wrap; margin: 6px 0 8px; }
ol.progress { list-style: none; padding: 0; margin: 14px 0 18px; }
ol.progress li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--hair); color: var(--muted); }
ol.progress li:first-child { border-top: 0; }
ol.progress li.live, ol.progress li.done { color: var(--ink); }
ol.progress .tick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
ol.progress li.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
main[data-enter] ol.progress li.done .tick { animation: pop .5s var(--spring) both; }
ol.progress li.live .tick { border-color: var(--brand); border-top-color: transparent; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
q { quotes: "“" "”"; font-weight: 600; }
input.code { font-family: ui-monospace, Menlo, monospace; font-size: 22px; letter-spacing: .15em; text-align: center; text-transform: uppercase; }
.code-big { font-size: 34px; letter-spacing: .12em; text-align: center; background: var(--surface); border-radius: var(--radius); padding: 16px; word-break: normal; box-shadow: var(--shadow); }
.scanner video { width: 100%; border-radius: 16px; background: #000; aspect-ratio: 1; object-fit: cover; }
.share-ico { display: inline-block; vertical-align: -3px; color: var(--brand); }
ol.howto.big li { margin: 12px 0; font-size: 1.05em; }
.decide .btn { width: 100%; }

/* "does this make sense?" checks */
.checks ul { list-style: none; margin: 0; padding: 0; }
.checks li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; padding: 5px 0; font-size: 14px; }
.checks li.ok span:first-child, .checks li.info span:first-child { color: var(--ok); font-weight: 700; }
.checks li.warn { color: var(--warn-ink); }
.checks li.warn span:first-child { font-weight: 700; }
.cooling { box-shadow: inset 0 0 0 2px var(--warn-line); }

/* calm layout: quiet rows, folded details, an approve bar that stays in reach */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.srow { display: flex; align-items: center; gap: 12px; padding: 12px 0 4px; border-top: 1px solid var(--hair); }
.card > .srow:first-child { border-top: 0; padding-top: 0; }
details.why { padding: 0 0 10px; }
details.why summary { font-size: 13px; font-weight: 600; color: var(--brand); margin: 2px 0 0; list-style: none; }
details.why summary::-webkit-details-marker { display: none; }
details.why[open] summary { margin-bottom: 6px; }
details.mini { padding: 12px 16px; }
details.mini summary { font-size: 14px; font-weight: 500; margin: 0; list-style: none; color: var(--muted); }
details.mini summary::-webkit-details-marker { display: none; }
details.mini summary::after { content: " ›"; }
details.mini[open] summary::after { content: ""; }
details.mini.checks { background: transparent; border: 1px dashed var(--line); border-radius: var(--radius-sm); margin-bottom: 12px; }
.card details.mini { padding: 6px 0 0; }
.okdot { color: var(--ok); font-weight: 700; }
.claim { opacity: .8; }
.actionbar { position: sticky; bottom: calc(80px + env(safe-area-inset-bottom)); margin: 16px -18px 0; padding: 14px 18px 8px;
  background: linear-gradient(to bottom, transparent, var(--bg) 22px); z-index: 2; }
button.danger-link { background: none; border: 0; color: var(--danger); padding: 18px 0 6px; font-size: 15px; box-shadow: none; }

.seg.presets { display: flex; width: 100%; }
.seg.presets button { flex: 1; padding: 9px 6px; font-size: 14px; }
.seg.presets button.on { background: var(--brand); color: var(--brand-ink); }
.warnbox button.danger { background: var(--danger); color: #fff; border: 0; }

label.similar { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 14px; margin: 14px 2px 0; }
label.similar input { width: 20px; height: 20px; flex: none; margin-top: 2px; }

/* Face ID / PIN */
.bio-ico { vertical-align: -5px; margin-right: 6px; }
button .bio-ico, .btn .bio-ico { flex: none; }
.linkish { background: none; border: 0; color: var(--brand); font-weight: 600; padding: 10px 0 0; min-height: 44px; width: 100%; box-shadow: none; }
.choice { display: flex; align-items: center; justify-content: flex-start; gap: 14px; text-align: left; width: 100%; padding: 16px; min-height: 72px; border-radius: 18px;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--ink); font: inherit; cursor: pointer; }
.choice:hover, .choice:focus-visible { border-color: var(--brand); }
.choice > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.choice strong { font-size: 17px; }
.choice .bio-ico { width: 30px; height: 30px; margin: 0; color: var(--brand); }
.choice .pin-ico { flex: none; display: inline-block; width: 30px; text-align: center; font-weight: 700; font-size: 15px; letter-spacing: 0; color: var(--brand); }
#unlockCard .srow button + button { margin-left: 6px; }

/* getting started */
.setup-card { box-shadow: inset 0 0 0 2px var(--brand), var(--shadow); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .6s var(--ease-out); }
ol.progress.setup { margin: 4px 0 0; }
ol.progress.setup li { align-items: flex-start; }
ol.progress.setup li:not(.done):not(.now) strong { color: var(--muted); font-weight: 500; }
ol.progress.setup li.done strong { color: var(--muted); font-weight: 500; text-decoration: line-through; text-decoration-color: var(--line); }
ol.progress.setup li.now .tick { border-color: var(--brand); }
ol.progress.setup .todo { margin-top: 6px; display: flex; flex-direction: column; gap: 8px; }
ol.progress.setup .todo p { margin: 0; }
.seg button.on[data-first] { background: var(--brand); color: var(--brand-ink); }
.match { font-size: 28px; font-weight: 600; letter-spacing: 3px; color: var(--brand); }
.demo-card { box-shadow: inset 0 0 0 2px var(--warn-line); }
.demo-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-acts button { font-size: 14px; padding: 10px 8px; }
.plan-card.current { box-shadow: inset 0 0 0 2px var(--brand); }
button.linkcard { background: var(--surface); border: 0; color: var(--ink); font: inherit; cursor: pointer; }

/* add an app */
.app-grid { display: grid; gap: 8px; }
#pasteBox { margin-top: 22px; }
.app-pick { display: flex; justify-content: flex-start; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 12px; border-radius: 16px; border: 0; background: var(--surface); color: inherit; font: inherit; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .45s var(--spring); }
.app-pick > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.app-tile { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; }
.seg button.on[data-app-mode] { background: var(--brand); color: var(--brand-ink); }
#appMode { display: flex; width: 100%; }
#appMode button { flex: 1; padding: 9px 6px; }
.decide.three { grid-template-columns: 1fr 1fr 1.4fr; }
.powers { padding: 4px 18px; }
.powers .pw { display: grid; grid-template-columns: 7.5em 1fr; gap: 10px; padding: 11px 0; border-top: 1px solid var(--hair); color: inherit; text-decoration: none; font-size: 15px; }
.powers .pw:first-child { border-top: 0; }
.risk { font-size: 14px; margin: -2px 0 12px; }
.risk-high strong { color: var(--danger); } .risk-medium strong { color: var(--warn-ink); } .risk-low strong { color: var(--ok); }
.risk-high { color: var(--danger); }

/* live */
.livedot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 4px; vertical-align: middle; }
.livedot.on, #watchLive .livedot { background: var(--ok); animation: livepulse 1.6s ease-in-out infinite; }
@keyframes livepulse { 50% { opacity: .35; } }
.log-item.fresh { animation: livein .6s var(--ease-out); background: color-mix(in srgb, var(--ok) 10%, transparent); border-radius: 10px; }
@keyframes livein { from { opacity: 0; transform: translateY(-6px); } }

/* "More" */
details.more { margin-top: 22px; }
details.more > summary { list-style: none; cursor: pointer; font-weight: 600; padding: 15px 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); display: flex; justify-content: space-between; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "›"; transform: rotate(90deg); transition: transform .3s var(--spring); }
details.more[open] > summary::after { transform: rotate(-90deg); }
details.more > .srow:first-of-type { margin-top: 12px; }

/* ---------- grouped lists (iOS "inset grouped") ---------- */
.group { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0; margin-bottom: 12px; overflow: hidden; list-style: none; }
@media (prefers-color-scheme: dark) { .group { border: 1px solid var(--line); } }
.group > li, .group > a, .group > .gi { display: flex; align-items: center; gap: 14px; padding: 14px 18px; text-decoration: none; color: inherit; position: relative; min-height: 52px; }
.group > li + li::before, .group > a + a::before, .group > .gi + .gi::before { content: ""; position: absolute; top: 0; left: 54px; right: 0; border-top: 1px solid var(--hair); }
.group .ico { width: 24px; height: 24px; flex: none; color: var(--brand); }
.group .val { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.group .chev { width: 14px; height: 14px; flex: none; color: var(--faint); }
.group a:active { background: var(--surface-2); transform: none; }
.group label { margin: 0; font-weight: 500; }
.group .gi input:not([type="checkbox"]), .group .gi select { width: 30%; min-width: 84px; text-align: right; background: transparent; border: 0; padding: 6px 0; font-variant-numeric: tabular-nums; }
.group .gi input:focus, .group .gi select:focus { box-shadow: none; background: transparent; }
.group .gi textarea { background: transparent; border: 0; padding: 4px 0; min-height: 0; resize: none; }
.group .stacked { flex-direction: column; align-items: stretch; gap: 4px; }
.group .stacked label { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------- your rules ---------- */
.seg[role="tablist"] { display: flex; width: 100%; }
.seg a.btn { border: 0; border-radius: 9px; padding: 7px 10px; font-size: 13px; background: transparent; font-weight: 600; color: var(--muted); flex: 1; min-height: 34px; box-shadow: none; }
.seg a.btn.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
#levelSeg { display: flex; width: 100%; }
#levelSeg button { flex: 1; }
#levelSeg button.on, #sOver button.on { background: var(--brand); color: var(--brand-ink); }
.budget-num { margin: 6px 0 8px; }
.budget-num b { font: 700 26px var(--rounded); letter-spacing: -0.01em; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .6s var(--ease-out); }
.bar span.hot { background: var(--danger); }
.ok-text { color: var(--ok); }
textarea.mono { font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; overflow-x: auto; }
.rules-hero { display: flex; gap: 14px; align-items: center; }
.rules-hero .mascot { width: 54px; height: auto; flex: none; }
.import-card { background: var(--brand-soft); border-radius: var(--radius); padding: 18px; display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.import-card .mascot { width: 52px; height: auto; flex: none; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* stamp (Test a request) */
.stamp { display: inline-flex; flex-direction: column; align-items: center; padding: 18px 30px; border-radius: 26px; border: 4px solid; rotate: -4deg; animation: stamp .55s var(--spring) both; }
.stamp small { font: 700 12px var(--rounded); letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.stamp b { font: 700 40px/1.05 var(--rounded); letter-spacing: -0.02em; }
.stamp.yes { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.stamp.ask { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.stamp.no { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
@keyframes stamp { from { transform: scale(1.5); opacity: 0; } 60% { opacity: 1; } }

/* suggestion cards (memory import) */
.suggest { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 10px; transition: opacity .3s, transform .45s var(--spring); }
.suggest .kind { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.suggest .what { font: 600 17px/1.3 var(--font); margin: 2px 0 10px; }
.suggest blockquote { margin: 0 0 12px; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.suggest blockquote b { color: var(--ink); }
.suggest.added { box-shadow: inset 0 0 0 2px var(--ok), var(--shadow); }
.suggest.gone { opacity: 0; transform: scale(.96); }

/* long lists render only when scrolled near (fast on low-end phones) */
.lazy { content-visibility: auto; contain-intrinsic-size: auto 480px; }

/* ---------- moving between screens: a native-feeling push / pop ---------- */
#view { view-transition-name: page; }
::view-transition-old(page) { animation: vt-fade-out .16s var(--ease-out) both; }
::view-transition-new(page) { animation: vt-fade-in .28s var(--ease-out) both; }
html:active-view-transition-type(forward) ::view-transition-old(page) { animation: vt-out-left .26s var(--ease-out) both; }
html:active-view-transition-type(forward) ::view-transition-new(page) { animation: vt-in-right .34s var(--ease-out) both; }
html:active-view-transition-type(back) ::view-transition-old(page) { animation: vt-out-right .24s var(--ease-out) both; }
html:active-view-transition-type(back) ::view-transition-new(page) { animation: vt-in-left .32s var(--ease-out) both; }
::view-transition-group(tabs) { animation: none; }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes vt-out-left { to { opacity: 0; transform: translateX(-24%); } }
@keyframes vt-in-right { from { opacity: 0; transform: translateX(32%); } }
@keyframes vt-out-right { to { opacity: 0; transform: translateX(28%); } }
@keyframes vt-in-left { from { opacity: 0; transform: translateX(-20%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
    animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important;
  }
}

/* Rule store */
.store-icon { display: inline-grid; place-items: center; inline-size: 44px; block-size: 44px; border-radius: 12px; background: color-mix(in srgb, var(--brand) 10%, var(--surface)); font-size: 24px; flex: none; }
.store-icon.big { inline-size: 72px; block-size: 72px; border-radius: 20px; font-size: 40px; }
.store-item { gap: 12px; align-items: center; }
.store-featured { display: grid; grid-auto-flow: column; grid-auto-columns: 72%; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: none; }
.store-featured::-webkit-scrollbar { display: none; }
.store-feature { display: flex; flex-direction: column; gap: 6px; scroll-snap-align: start; margin: 0; }
.store-hero { text-align: center; display: grid; justify-items: center; gap: 4px; margin-bottom: 12px; }
.store-hero h1 { margin: 8px 0 0; }
.verified { color: var(--brand); font-weight: 600; }
search input { width: 100%; }

/* collapsed rows: one line until tapped */
.row-details { display: block; padding: 0; }
.row-details > summary { display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; list-style: none; }
.row-details > summary::-webkit-details-marker { display: none; }
.row-details > summary::after { content: "›"; color: var(--muted); transition: rotate .25s var(--spring, ease); }
.row-details[open] > summary::after { rotate: 90deg; }
.row-body { padding: 0 16px 14px; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.icon-btn { min-width: 36px; min-height: 36px; padding: 0; border-radius: 50%; font-size: 20px; line-height: 1; background: transparent; border: 0; color: var(--muted); }
.bad-ink { color: var(--bad-ink, #b42318); }
details.more { margin-top: 18px; }
details.more > summary { color: var(--muted); cursor: pointer; padding: 8px 0; }
.empty-hero { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 28px 12px; }
.empty-hero .mascot { inline-size: 88px; }
.chev { width: 14px; height: 14px; flex: none; color: var(--faint); }
.group > .gi.row-details { display: block; padding: 0; }
.row-details > summary { min-height: 52px; padding: 0 18px; }
.week-card .mascot { inline-size: 46px; flex: none; }
.week-card .stats { margin-top: 12px; display: grid; grid-template-columns: repeat(4, 1fr); }

/* plain full-width fields inside a row's body (e.g. Child's AI) */
.row-body input.field { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface, #fff); font: inherit; }

/* "Always" → Adjust: a label on the left, a small field on the right */
.lesson-num { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; font-size: 15px; }
.lesson-num input.field { width: 90px; text-align: right; }
.lesson-num select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }

/* a role choice on an AI's page */
.role-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.role-opt.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
a.card.drift { display: block; text-decoration: none; color: inherit; }

/* a tappable row in a group (Use these rules anywhere) */
.gi-btn { width: 100%; text-align: left; background: none; border: 0; border-radius: 0; font: inherit; color: inherit; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.gi-btn:active { background: var(--line); }

/* store rule sets (Safety) and the refund replay */
.group > button.gi { width: 100%; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-weight: 400; justify-content: flex-start; text-align: left; margin: 0; }
.group > button.gi[aria-pressed="true"] { background: var(--brand-soft); }
.group > button.gi + button.gi::before { content: ""; position: absolute; top: 0; left: 54px; right: 0; border-top: 1px solid var(--hair); }
#replayLink { margin-top: 4px; }
#replaySum .warn strong { color: var(--warn-ink); }
.btn.block { display: flex; width: 100%; }

/* what changed: removals struck through, additions marked */
.diffcard { display: grid; gap: 10px; }
.dfield { display: grid; gap: 4px; }
.dlbl { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; }
.dlbl .muted { font-weight: 400; }
p.diff { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
p.diff del { color: var(--danger); background: var(--danger-bg); text-decoration-thickness: 1.5px; border-radius: 4px; padding: 0 2px; }
p.diff ins { color: var(--ok); background: var(--ok-bg); text-decoration: none; border-radius: 4px; padding: 0 2px; font-weight: 600; }
p.diff .gap { color: var(--faint); padding: 0 4px; }
#edDiff .diffcard { margin: 10px 0 0; box-shadow: none; background: var(--surface-2); }

/* what an AI can use */
fieldset.access { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
fieldset.access legend { font-size: 14px; font-weight: 600; padding: 0; }

/* worth a look */
.warndot, .infodot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; }
.warndot { background: var(--warn-dot); }
.infodot { background: var(--faint); }
.rundot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--ok); }

/* calendar card: three equal subscribe buttons */
.calbtns{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.calbtns>*{display:flex;align-items:center;justify-content:center;min-height:44px;padding:0 8px;font-size:.9375rem;text-align:center;width:auto}

/* recipes */
#recipeGroups { margin: 4px 0 12px; }

/* AI costs and results: how each AI's asks went */
.perf { display: block; margin: 6px 0 2px; }
.perf-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; gap: 2px; margin-bottom: 6px; max-width: 240px; }
.perf-bar i { display: block; min-width: 4px; }
.perf-bar .ok { background: var(--ok); } .perf-bar .edit { background: var(--brand); } .perf-bar .bad { background: var(--danger); } .perf-bar .idle { background: var(--faint); }
