/* Base layout for all three themes. Colors are CSS variables set by js/core.js from config/themes.js; the look per theme is in themes.css. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root { --radius: 22px; --radius-sm: 14px; --font: "Nunito", system-ui, -apple-system, sans-serif; --num: var(--font); --shadow: 0 6px 24px rgba(40, 20, 10, .07); --border: 0 solid transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; overflow-x: hidden; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
.screen { display: none; padding: 12px 16px 130px; max-width: 560px; margin: 0 auto; animation: fade .25s ease; }
.screen.on { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.center { text-align: center; } .pad { padding: 32px 0; } .pad-x { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); } .fine { font-size: 12.5px; color: var(--muted); line-height: 1.45; } .sub { color: var(--muted); margin: 6px 0 14px; line-height: 1.45; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--track); border-top-color: var(--accent); animation: spin 0.8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 16px; padding: 12px 18px; font-weight: 800; text-decoration: none; transition: transform .12s ease, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.big { width: 100%; padding: 17px 20px; font-size: 17px; border-radius: 20px; }
.btn.soft { background: var(--fill); }
.btn.danger { color: #E5484D; }
.btn.link { background: none; color: var(--accent); padding: 10px; font-weight: 700; }
.btn.link.muted { color: var(--muted); }
.btn.small { font-size: 13px; padding: 4px 0; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; line-height: 1; background: var(--surface); box-shadow: var(--shadow); }
.icon-btn:disabled { opacity: .3; }
.icon-btn svg { width: 21px; height: 21px; }

/* Home */
.top { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.top .month { flex: 1; text-align: center; font-weight: 800; font-size: 18px; }
.top .gear { margin-left: 4px; }
.banner { width: 100%; display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); font-weight: 700; margin: 6px 0; text-align: left; }
.banner span:nth-child(2) { flex: 1; }
.ring-wrap { display: flex; justify-content: center; margin: 14px 0 6px; }
.ring { position: relative; }
.ring-svg { width: 100%; height: 100%; overflow: visible; }
.ring-seg { transition: stroke-dasharray .9s cubic-bezier(.2, .8, .2, 1); cursor: pointer; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; padding: 0 50px; }
.ring-label { color: var(--muted); font-weight: 700; font-size: 14px; }
.ring-total { font-family: var(--num); font-weight: 900; font-size: 40px; letter-spacing: -.02em; line-height: 1.1; margin: 2px 0; }
.ring-sub { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.ring-sub.over { color: #E5484D; }
.budget-bar { display: none; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.tile { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "i n" "i s" "b b"; column-gap: 10px; align-items: center; text-align: left; padding: 13px 14px 12px; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); transition: transform .12s; }
.tile:active { transform: scale(.97); }
.tile.zero { opacity: .5; }
.tile-icon { grid-area: i; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; background: color-mix(in srgb, var(--c) 20%, transparent); }
.tile-name { grid-area: n; padding-right: 30px; font-size: 13px; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sum { grid-area: s; font-family: var(--num); font-size: 17px; font-weight: 900; }
.tile-share { position: absolute; top: 12px; right: 12px; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.tile-bar { grid-area: b; display: none; height: 6px; border-radius: 6px; background: var(--track); margin-top: 10px; overflow: hidden; }
.tile-bar i { display: block; height: 100%; border-radius: 6px; background: var(--c); }
.cta-wrap { position: fixed; left: 0; right: 0; bottom: 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); z-index: 5; max-width: 560px; margin: 0 auto; }
.cta span { font-size: 22px; line-height: 0; }
.empty { text-align: center; padding: 26px 8px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty p { color: var(--muted); line-height: 1.5; margin: 0; max-width: 340px; }
.empty-ring { position: relative; width: 230px; height: 230px; border-radius: 50%; border: 26px solid var(--track); margin: 8px 0; }
.empty-ring .ring-center { padding: 0 20px; }
.big-emoji { font-size: 64px; }

/* Transactions */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 16px; margin-bottom: 12px; }
.card.dim { opacity: .85; }
.tx-list.card { padding: 4px 0; margin-bottom: 12px; }
.tx { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; text-align: left; }
.tx + .tx { border-top: 1px solid var(--sep); }
.tx-dot { flex: none; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-size: 18px; color: #fff; }
.tx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tx-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 800; }
.tx-main small { color: var(--muted); font-size: 12.5px; }
.tx-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.tx-right b { font-family: var(--num); font-weight: 800; white-space: nowrap; }
.tx-right b.plus { color: #1E9E76; }
.chip { display: inline-flex; align-items: center; border-radius: 99px; padding: 7px 13px; background: var(--fill); font-weight: 700; font-size: 14px; }
.chip.on { background: var(--accent); color: var(--on-accent); }
.chip.small { padding: 3px 9px; font-size: 11.5px; background: color-mix(in srgb, var(--c) 18%, transparent); color: color-mix(in srgb, var(--c) 70%, var(--ink)); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hint { color: var(--muted); font-size: 13px; padding: 10px 14px 4px; margin: 0; line-height: 1.45; }
.fold { width: 100%; text-align: left; padding: 10px 4px; color: var(--muted); font-weight: 700; }
.screen-head { margin: 8px 0 14px; }
.screen-head h1 { font-size: 28px; font-weight: 900; }
.review-cta { display: flex; flex-direction: column; gap: 4px; }
.rev-total { display: flex; justify-content: space-between; font-weight: 700; padding: 0 6px 8px; color: var(--muted); }
.rev-total b { color: var(--ink); font-family: var(--num); font-size: 18px; }

/* Sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(10, 10, 20, 0); transition: background .25s; display: flex; align-items: flex-end; justify-content: center; }
.sheet-wrap.on { background: rgba(10, 10, 20, .4); }
.sheet { width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; background: var(--bg); border-radius: 28px 28px 0 0; padding: 8px 16px calc(22px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.sheet.tall { min-height: 60vh; }
.sheet-wrap.on .sheet { transform: none; }
.grab { width: 40px; height: 5px; border-radius: 5px; background: var(--sep); margin: 4px auto 12px; }
.sheet-title { font-size: 18px; font-weight: 900; margin-bottom: 14px; }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sheet-head div { flex: 1; display: flex; flex-direction: column; }
.sheet-head small { color: var(--muted); }
.sheet-sum { font-family: var(--num); font-size: 20px; }
.big-icon { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; font-size: 24px; }
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cat-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 16px; background: var(--surface); }
.cat-btn span { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 20px; background: color-mix(in srgb, var(--c) 22%, transparent); }
.cat-btn small { font-size: 11.5px; font-weight: 700; text-align: center; }
.cat-btn.on { outline: 2.5px solid var(--c); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 4px; font-weight: 700; }
.switch-row input { width: 22px; height: 22px; accent-color: var(--accent); }
.row-btns { display: flex; gap: 10px; margin-top: 10px; }
.row-btns .btn { flex: 1; }

/* Upload sheet */
.upload { display: flex; flex-direction: column; gap: 10px; }
.up-opt { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; background: var(--surface); text-align: left; box-shadow: var(--shadow); }
.up-opt span:last-child { display: flex; flex-direction: column; gap: 3px; }
.up-opt small { color: var(--muted); line-height: 1.4; }
.up-opt.info { box-shadow: none; background: var(--fill); }
.up-opt.off { opacity: .45; box-shadow: none; }
.up-icon { font-size: 28px; }

/* Busy */
#busy { position: fixed; inset: 0; z-index: 60; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); }
#busy.on { display: flex; }
#busy p { font-weight: 800; font-size: 18px; }
.busy-cloud { position: relative; width: 120px; height: 70px; }
.busy-cloud i { position: absolute; bottom: 0; border-radius: 50%; background: var(--accent); opacity: .85; animation: bob 1.2s ease-in-out infinite; }
.busy-cloud i:nth-child(1) { left: 0; width: 56px; height: 56px; }
.busy-cloud i:nth-child(2) { left: 34px; width: 70px; height: 70px; animation-delay: .15s; background: var(--cat-1); }
.busy-cloud i:nth-child(3) { left: 76px; width: 46px; height: 46px; animation-delay: .3s; background: var(--cat-4); }
@keyframes bob { 50% { transform: translateY(-10px) scale(1.05); } }

/* Toast */
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 70; margin: 0 auto; max-width: 480px; background: var(--ink); color: var(--bg); padding: 13px 16px; border-radius: 16px; font-weight: 700; text-align: center; opacity: 0; transform: translateY(10px); transition: .25s; }
.toast.on { opacity: 1; transform: none; }
.toast.err { background: #E5484D; color: #fff; }

/* Puff */
.puff { position: fixed; left: 50%; top: 42%; z-index: 80; pointer-events: none; display: flex; flex-direction: column; align-items: center; transform: translate(-50%, -50%); }
.puff i { position: absolute; left: -30px; top: -30px; width: 60px; height: 60px; border-radius: 50%; background: var(--fill); box-shadow: inset -6px -6px 0 rgba(0, 0, 0, .05); animation: puff 1.3s cubic-bezier(.2, .8, .2, 1) forwards; }
.puff b { position: relative; font-size: 44px; font-weight: 900; font-family: var(--num); animation: pop 1.6s ease forwards; }
.puff small { position: relative; font-weight: 800; animation: pop 1.6s ease forwards; }
@keyframes puff { 0% { transform: scale(.2); opacity: 0; } 25% { opacity: 1; } 100% { transform: translate(var(--x), var(--y)) scale(var(--s)); opacity: 0; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 20% { transform: scale(1.15); opacity: 1; } 35% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-20px); } }

/* Onboarding */
.onb { display: flex; flex-direction: column; gap: 10px; min-height: calc(100vh - 40px); }
.onb h2 { font-size: 26px; font-weight: 900; margin-top: 10px; }
.onb-dots { display: flex; gap: 6px; justify-content: center; margin: 4px 0 6px; }
.onb-dots i { width: 22px; height: 5px; border-radius: 5px; background: var(--track); }
.onb-dots i.on { background: var(--accent); }
.onb-actions { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 0 calc(8px + env(safe-area-inset-bottom)); }
.onb-hero { text-align: center; padding: 30px 0 10px; }
.onb-hero h1 { font-size: 36px; font-weight: 900; margin-top: 16px; }
.onb-hero .lead { color: var(--muted); font-size: 17px; margin: 8px 0 0; }
.logo-puff { position: relative; width: 120px; height: 120px; margin: 0 auto; display: grid; place-items: center; }
.logo-puff span { position: relative; z-index: 1; font-size: 54px; }
.logo-puff i { position: absolute; border-radius: 50%; background: color-mix(in srgb, var(--accent) 22%, transparent); }
.logo-puff i:nth-child(2) { inset: 10px; }
.logo-puff i:nth-child(3) { width: 34px; height: 34px; right: 0; top: 6px; background: color-mix(in srgb, var(--cat-0) 40%, transparent); }
.logo-puff i:nth-child(4) { width: 24px; height: 24px; left: 4px; bottom: 12px; background: color-mix(in srgb, var(--cat-3) 40%, transparent); }
.onb-points { list-style: none; padding: 0; margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.onb-points li { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border-radius: 16px; font-weight: 700; box-shadow: var(--shadow); }
.onb-points span { font-size: 24px; }
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; background: var(--surface); text-align: left; box-shadow: var(--shadow); outline: 2.5px solid transparent; transition: outline-color .15s; }
.choice.on { outline-color: var(--accent); }
.choice-icon { font-size: 30px; }
.choice-text { display: flex; flex-direction: column; gap: 2px; }
.choice-text small { color: var(--muted); }
.choices.big .choice { padding: 20px 16px; }
.note { background: var(--fill); padding: 12px 14px; border-radius: 14px; line-height: 1.45; font-size: 14px; margin: 4px 0; }
.consent { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--surface); border-radius: 14px; line-height: 1.45; font-size: 14px; font-weight: 600; }
.consent input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.lbl { font-weight: 700; font-size: 14px; color: var(--muted); margin-top: 8px; }
.field { width: 100%; padding: 15px 16px; border-radius: 16px; border: 1.5px solid var(--sep); background: var(--surface); font-size: 18px; font-weight: 700; outline: none; }
.field:focus { border-color: var(--accent); }
textarea.field { font-size: 16px; font-weight: 500; resize: vertical; }

/* Theme picker */
.theme-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 6px 12px; border-radius: 18px; outline: 2.5px solid transparent; box-shadow: var(--shadow); text-align: center; }
.theme-card.on { outline-color: var(--accent); }
.theme-card b { font-size: 13px; } .theme-card small { font-size: 11px; opacity: .7; }
.tc-ring { position: relative; width: 52px; height: 52px; border-radius: 50%; border: 7px solid; margin-bottom: 4px; }
.tc-ring i { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px; border-radius: 50%; }
.theme-card[data-preview="pop"] .tc-ring { border-width: 9px; box-shadow: 0 0 0 2.5px #14121A; }
.theme-card[data-preview="glass"] .tc-ring { border-width: 3px; box-shadow: 0 0 12px currentColor; }
.palettes { display: flex; gap: 10px; margin-top: 10px; }
.pal { flex: 1; display: flex; align-items: center; gap: 4px; padding: 10px; border-radius: 14px; background: var(--surface); outline: 2px solid transparent; }
.pal.on { outline-color: var(--accent); }
.pal i { width: 14px; height: 14px; border-radius: 50%; }
.pal small { margin-left: 4px; font-weight: 700; font-size: 12px; }

/* Settings */
.group-title { margin: 22px 4px 10px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.set-list { overflow: hidden; margin-bottom: 12px; }
.set-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; text-align: left; }
.set-row + .set-row { border-top: 1px solid var(--sep); }
.set-icon { font-size: 20px; }
.set-title { flex: 1; font-weight: 700; }
.set-val { color: var(--muted); font-weight: 600; }
.chev { color: var(--muted); font-size: 20px; }
.set-row.danger .set-title { color: #E5484D; }
.fb-prev img { max-width: 100%; max-height: 240px; border-radius: 14px; }

/* Admin */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.tab { padding: 8px 14px; border-radius: 99px; background: var(--fill); font-weight: 800; font-size: 14px; white-space: nowrap; }
.tab.on { background: var(--accent); color: var(--on-accent); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--surface); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.stat small { font-size: 12px; color: var(--muted); font-weight: 700; }
.stat b { font-size: 24px; font-family: var(--num); font-weight: 900; }
.card h4 { margin-bottom: 10px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.bar i { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; }
.bar small { font-size: 9px; color: var(--muted); }
.dist { display: grid; grid-template-columns: 110px 1fr 36px; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; }
.dist-bar { height: 8px; border-radius: 8px; background: var(--track); overflow: hidden; }
.dist-bar i { display: block; height: 100%; background: var(--accent); }
.dist b { text-align: right; }
.adm-row { display: flex; flex-direction: column; padding: 6px 0; border-top: 1px solid var(--sep); }
.adm-row small { color: var(--muted); }
.adm-user { display: flex; flex-direction: column; gap: 3px; padding: 12px 16px; align-items: flex-start; }
.adm-user + .adm-user { border-top: 1px solid var(--sep); }
.adm-user > div { display: flex; flex-direction: column; }
.adm-user small { color: var(--muted); font-size: 12.5px; }
.fb-text { margin: 6px 0; white-space: pre-wrap; line-height: 1.45; }
.fb-img { max-width: 100%; border-radius: 12px; }
#s-review { padding-bottom: 230px; }
