:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1f2630;
  --border: #2a313c;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #12b886;
  --accent-ink: #04251a;
  --warn: #f59f00;
  --bad: #fa5252;
  --good: #40c057;
  --blue: #4dabf7;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 Inter, system-ui, sans-serif; }
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: rgba(13, 17, 23, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.badge.pro { background: var(--accent); color: var(--accent-ink); }

main { max-width: 920px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0 0 16px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 2px; }
.stat .hint { color: var(--muted); font-size: 12px; margin-top: 2px; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 3px; }
.seg button { border: 0; background: none; color: var(--muted); padding: 6px 12px; border-radius: 99px; font: inherit; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--surface-2); color: var(--text); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--muted); padding: 6px 12px; border-radius: 99px; font: inherit; font-size: 13px; cursor: pointer; }
.chip.on { border-color: var(--accent); color: var(--text); background: rgba(18, 184, 134, .12); }

.btn { border: 0; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; cursor: pointer; }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .5; cursor: wait; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.best td { background: rgba(18, 184, 134, .08); }
.note { color: var(--muted); font-size: 12px; }
.save { color: var(--good); font-weight: 600; }
.cost { color: var(--bad); font-weight: 600; }
.est { color: var(--warn); font-size: 11px; }

.banner { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; font-size: 14px; background: rgba(77, 171, 247, .1); border: 1px solid rgba(77, 171, 247, .35); }
.banner.warn { background: rgba(245, 159, 0, .1); border-color: rgba(245, 159, 0, .4); }
.banner.ok { background: rgba(64, 192, 87, .1); border-color: rgba(64, 192, 87, .4); }
.confirm-box { border: 1px solid var(--accent); border-radius: 12px; padding: 14px; background: rgba(18, 184, 134, .06); }
.big-reading { font-size: 34px; font-weight: 700; letter-spacing: 2px; margin: 6px 0; font-variant-numeric: tabular-nums; }
.lock { text-align: center; padding: 32px 16px; }
.lock p { color: var(--muted); }

.chart { position: relative; height: 260px; }
.chart.tall { height: 320px; }
.chart.pie { height: 280px; max-width: 560px; margin: 0 auto; }
.mix-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; }
.mix-emoji { font-size: 34px; line-height: 1; }
@media (max-width: 560px) { .chart.pie { height: 340px; } }

label.f { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, select { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px 10px; font: inherit; }
.form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 10px; }
.band { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.band input { width: 90px; }

.big { font-size: 40px; font-weight: 700; line-height: 1.1; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.pill.very-low, .pill.low { background: rgba(64, 192, 87, .18); color: var(--good); }
.pill.moderate { background: rgba(245, 159, 0, .18); color: var(--warn); }
.pill.high, .pill.very-high { background: rgba(250, 82, 82, .18); color: var(--bad); }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; justify-content: space-around; background: #010409; border-top: 1px solid var(--border); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; padding: 4px 0; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--accent); }

.bill-detail { display: grid; gap: 10px; padding: 4px 0; }
.pie-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.pie-box { background: var(--surface-2); border-radius: 12px; padding: 12px; }
.pie-box h3 { margin: 0 0 6px; font-size: 15px; }
.chart.pie-sm { height: 260px; }
details summary { cursor: pointer; padding: 6px 0; }
.detail-row { padding: 10px 12px; background: var(--surface-2); border-radius: 10px; }
.tabs button { font-size: 11px; min-width: 0; }
/* Splash */
#splash { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: radial-gradient(circle at 50% 42%, #10302a 0%, var(--bg) 60%); transition: opacity .5s ease; }
#splash.out { opacity: 0; pointer-events: none; }
.splash-mark { width: 120px; height: 120px; border-radius: 30px; background: var(--accent); display: grid; place-items: center; animation: pop .6s cubic-bezier(.2, 1.4, .4, 1) both; box-shadow: 0 10px 40px rgba(18, 184, 134, .35); }
.splash-svg { width: 96px; height: 96px; overflow: visible; }
.s-bolt { fill: #ffd43b; opacity: 0; animation: boltOn .35s ease-out .95s both; }
.s-lens circle { fill: #04251a; stroke: #fff; stroke-width: 4; }
.s-lens path { stroke: #fff; stroke-width: 6; stroke-linecap: round; }
.s-lens { transform-origin: 28px 28px; animation: sweep .8s cubic-bezier(.3, .8, .3, 1) .25s both; }
.s-bolt { transform-origin: 28px 28px; }
.splash-name { font-size: 30px; font-weight: 700; margin-top: 18px; animation: rise .5s ease-out .9s both; }
.splash-tag { color: var(--muted); font-size: 16px; animation: rise .5s ease-out 1.15s both; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes sweep { 0% { transform: translate(-34px, 26px) rotate(-25deg) scale(.7); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes boltOn { 0% { opacity: 0; transform: scale(.3); } 70% { opacity: 1; transform: scale(1.25); } 100% { opacity: 1; transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Today: cards arrive one at a time so the screen reads in order rather than all at once. */
.reveal { animation: rise .45s ease-out both; animation-delay: calc(var(--i, 0) * 140ms); }
@media (prefers-reduced-motion: reduce) {
  .reveal, .splash-mark, .s-lens, .s-bolt, .splash-name, .splash-tag { animation: none; opacity: 1; }
}
.attention { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; background: rgba(245, 159, 0, .14); color: var(--warn); border: 0; font-family: inherit; cursor: pointer; }
.attention.ok { background: rgba(64, 192, 87, .14); color: var(--good); cursor: default; }
details.fine summary { color: var(--muted); font-size: 13px; list-style: none; }
details.fine summary::-webkit-details-marker { display: none; }
details.fine[open] summary { margin-bottom: 8px; }

/* Onboarding: no tabs or plan badge, one calm column. */
body.onboarding .tabs, body.onboarding #planBadge { display: none; }
body.onboarding { padding-bottom: 24px; }
.ob { max-width: 480px; margin: 0 auto; display: grid; gap: 14px; animation: rise .4s ease-out both; }
.ob h1 { font-size: 26px; margin: 0; }
.ob .sub { margin: 0; font-size: 16px; }
.ob-dots { display: flex; gap: 6px; justify-content: center; margin: 4px 0 6px; }
.ob-dots .dot { width: 28px; height: 5px; border-radius: 99px; background: var(--surface-2); }
.ob-dots .dot.on { background: var(--accent); }
.ob-hero { text-align: center; display: grid; gap: 6px; justify-items: center; margin: 8px 0; }
.ob-hero img { border-radius: 22px; box-shadow: 0 8px 30px rgba(18, 184, 134, .3); margin-bottom: 8px; }
.ob-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ob-list li { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.ob-list li > span { font-size: 24px; line-height: 1.2; }
.ob-privacy { font-size: 14px; padding: 12px 14px; border-radius: 12px; background: rgba(18, 184, 134, .08); border: 1px solid rgba(18, 184, 134, .3); }
.btn.big { display: block; width: 100%; text-align: center; padding: 14px 16px; font-size: 16px; text-decoration: none; box-sizing: border-box; }
.link { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; justify-self: center; padding: 6px; }
.ob-steps { margin: 0; padding-left: 22px; display: grid; gap: 12px; font-size: 15px; }
.mock { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: #fff; color: #222; border: 1px solid #ddd; max-width: 320px; }
.mock-label { font-size: 12px; color: #666; margin-bottom: 4px; }
.mock-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mock-row code { font-size: 13px; }
.mock-copy { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; border: 2px solid var(--warn); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(245, 159, 0, .25); } }
.ob-paste { display: flex; gap: 8px; }
.ob-paste input { flex: 1; min-width: 0; font-size: 16px; padding: 12px; font-family: ui-monospace, Consolas, monospace; }
.ob-show { display: flex; gap: 6px; align-items: center; margin-top: -6px; }
.ob-found { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--accent); animation: rise .35s ease-out both; }
.ob-found h2 { margin: 0; }
.ob-acc { display: flex; gap: 10px; align-items: flex-start; }
.ob-meter { margin-top: 6px; font-size: 15px; }
.ob-bar { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.ob-bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), #63e6be); border-radius: 99px; transition: width .6s ease; }
.ob-spin img { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-6deg); } }

/* Alerts */
.top-right { display: flex; align-items: center; gap: 10px; }
.bell { position: relative; border: 0; background: none; color: var(--text); cursor: pointer; padding: 4px; display: grid; }
.bell svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bell-count { position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.bell-count[hidden] { display: none; }
body.onboarding .bell { display: none; }
.al-item { display: flex; gap: 10px; padding: 12px; border-radius: 10px; background: var(--surface-2); margin-bottom: 8px; }
.al-item.unread { box-shadow: inset 3px 0 0 var(--accent); }
.al-item .when { color: var(--muted); font-size: 12px; margin-top: 2px; }
.toggle-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.toggle-row:last-child { border-bottom: 0; }
.switch { position: relative; flex: none; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); transition: .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); background: #fff; }
.switch input:disabled + span { opacity: .4; cursor: not-allowed; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); }
.push-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* What if? */
.wi-link { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer; padding: 14px 16px; margin-bottom: 14px; border-radius: var(--radius); border: 1px dashed rgba(18, 184, 134, .5); background: rgba(18, 184, 134, .06); font-size: 22px; }
.wi-link > span { font-size: 15px; }
.wi-link:hover { background: rgba(18, 184, 134, .12); }
.wi-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.wi-emoji { flex: none; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; background: var(--surface-2); }
.quotes { border-color: rgba(18, 184, 134, .4); }

/* Today */
.hello { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.hello h1 { margin: 0; font-size: 24px; }
.hello .sub { margin: 0; }
.hello-emoji { font-size: 40px; line-height: 1; }
.tcard h2 { font-size: 17px; }
.light-row { display: flex; align-items: center; gap: 14px; }
.light { flex: none; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; background: color-mix(in srgb, var(--c) 18%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 45%, transparent); }
.t-big { font-size: 26px; font-weight: 700; line-height: 1.15; }
.t-unit { font-size: 14px; font-weight: 500; color: var(--muted); }
.t-line { font-size: 15px; margin: 4px 0; }
.t-tip { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 15px; }
.t-list { margin: 6px 0 10px; padding-left: 20px; font-size: 15px; }
.t-list li { margin: 4px 0; }
.health { display: grid; gap: 8px; }
.h-item { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.h-item.warn { background: rgba(245, 159, 0, .1); }
.h-icon { font-size: 20px; line-height: 1.2; }
.h-item .note { font-size: 13px; margin-top: 2px; }
.btn.small { padding: 6px 12px; font-size: 13px; margin-top: 8px; }
.center { text-align: center; }
#readingCard, #accountCard { scroll-margin-top: 70px; }
.center a { color: var(--accent); }

.spinner { color: var(--muted); padding: 40px 0; text-align: center; }
.scroll-x { overflow-x: auto; }
@media (max-width: 560px) { .hide-sm { display: none; } .big { font-size: 32px; } }
