/* ---- Finance components (tokens live in style.css, copied from planner) ---- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.top h1 { margin: 0; min-width: 0; font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top small { display: block; font-size: 12px; font-weight: 700; color: var(--mute); letter-spacing: .02em; }
.tools { display: flex; gap: 8px; }
.tool { position: relative; width: 44px; height: 44px; border-radius: 50%; background: var(--card); color: var(--ink); border: 2px solid var(--line); display: grid; place-items: center; transition: border-color .15s, transform .1s; }
.tool:hover { border-color: var(--brand); }
.tool:active { transform: scale(.94); }
.tool.spin .ico { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tool .badge { position: absolute; top: -6px; right: -6px; min-width: 20px; padding: 0 5px; border-radius: 999px; background: var(--p1); color: #fff; font-size: 12px; font-weight: 800; line-height: 20px; text-align: center; }

.who { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 14px; padding-bottom: 2px; scrollbar-width: none; }
.who::-webkit-scrollbar { display: none; }
.who button, .chip { flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); font-weight: 800; font-size: 14px; color: var(--mute); }
.who button.on, .chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.hero { background: var(--hero); color: var(--hero-ink); border-radius: 28px; padding: 20px 20px 16px; margin-bottom: 14px; }
.hero .lbl { color: inherit; opacity: .8; margin: 0; }
.hero .big { font-size: 44px; line-height: 1.05; font-weight: 800; letter-spacing: -.03em; margin: 4px 0 2px; }
.hero .sub { font-size: 14px; font-weight: 600; opacity: .85; }
.hero .row { display: flex; gap: 22px; margin-top: 14px; flex-wrap: wrap; }
.hero .row b { display: block; font-size: 20px; font-weight: 800; }
.hero .row span { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .8; }
.spark { display: block; width: 100%; height: 46px; margin-top: 12px; }

.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--r); padding: 16px; }
.card h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: .07em; text-transform: uppercase; font-weight: 800; color: var(--mute); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h3 a { color: var(--brand); text-transform: none; letter-spacing: 0; font-size: 14px; cursor: pointer; }
.num { font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.num.ok { color: var(--ok); } .num.bad { color: var(--p1); } .num.warn { color: var(--p2); }
.mute { color: var(--mute); font-size: 14px; font-weight: 600; }
.sec { margin: 22px 2px 8px; font-size: 13px; letter-spacing: .07em; text-transform: uppercase; font-weight: 800; color: var(--mute); display: flex; justify-content: space-between; align-items: center; }

.bar { height: 12px; border-radius: 8px; background: var(--bg); border: 2px solid var(--line); overflow: hidden; margin: 8px 0 4px; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 6px; transition: width .5s; }
.bar.warn > i { background: var(--p2); } .bar.bad > i { background: var(--p1); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--bg); border: 2px solid var(--line); color: var(--mute); }
.pill.red { background: var(--p1); border-color: var(--p1); color: #fff; }
.pill.amber { background: var(--p2); border-color: var(--p2); color: #1a1203; }
.pill.green { background: var(--p3); border-color: var(--p3); color: #04210f; }
[data-mode=dark] .pill.red { color: #2a0606; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r); background: var(--card); border: 2px solid var(--line); border-left: 8px solid var(--mute); margin-bottom: 8px; cursor: pointer; }
.alert.red { border-left-color: var(--p1); } .alert.amber { border-left-color: var(--p2); } .alert.green { border-left-color: var(--p3); } .alert.info { border-left-color: var(--brand); }
.alert b { display: block; font-weight: 800; line-height: 1.25; }
.alert p { margin: 2px 0 0; font-size: 14px; color: var(--mute); font-weight: 600; }
.alert .x { margin-left: auto; flex: none; width: 36px; height: 36px; border-radius: 50%; color: var(--mute); display: grid; place-items: center; }
.alert .x:hover { background: var(--bg); }

.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r); background: var(--card); border: 2px solid var(--line); cursor: pointer; text-align: left; width: 100%; min-height: 64px; transition: border-color .15s; }
.item:hover { border-color: var(--brand); }
.item .ic { flex: none; width: 42px; height: 42px; border-radius: 14px; background: var(--tc, var(--brand)); color: var(--on-tc, #fff); display: grid; place-items: center; }
.item .mid { min-width: 0; flex: 1; }
.item .t { font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.item .s { font-size: 13px; color: var(--mute); font-weight: 600; overflow-wrap: anywhere; }
.item .amt { text-align: right; font-weight: 800; flex: none; font-variant-numeric: tabular-nums; }
.item .amt small { display: block; font-size: 12px; color: var(--mute); font-weight: 700; }
.item.dim { opacity: .55; }
.pos { color: var(--ok); } .neg { color: var(--p1); }

.offer { background: var(--card); border: 2px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 10px; cursor: pointer; border-top: 8px solid var(--tc, var(--brand)); }
.offer.red { border-top-color: var(--p1); } .offer.amber { border-top-color: var(--p2); } .offer.green { border-top-color: var(--p3); }
.offer .hd { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.offer .hd b { font-size: 18px; font-weight: 800; line-height: 1.2; }
.offer .cd { text-align: right; flex: none; }
.offer .cd b { display: block; font-size: 28px; line-height: 1; }
.offer .cd span { font-size: 12px; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; }
.offer .meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }

.catrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 6px 0; }
.catrow .bar { grid-column: 1 / 3; margin: 2px 0 0; height: 10px; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; margin-top: 8px; }
.bars div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; font-size: 11px; font-weight: 700; color: var(--mute); }
.bars i { display: block; width: 100%; max-width: 44px; border-radius: 8px 8px 4px 4px; background: var(--brand); min-height: 3px; }
.bars div.cur i { background: var(--accent); }

.dock { position: fixed; z-index: 9; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; padding: 8px 8px calc(env(safe-area-inset-bottom) + 8px); background: var(--card); border-top: 2px solid var(--line); }
.dock button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px; border-radius: 16px; font-size: 12px; font-weight: 700; color: var(--mute); transition: background .18s, color .18s; }
.dock button.on { background: var(--brand); color: var(--brand-ink); }
@media (min-width: 900px) { .dock { left: 50%; right: auto; bottom: 16px; transform: translateX(-50%); width: 520px; border: 2px solid var(--line); border-radius: 24px; } }
.fab { position: fixed; z-index: 8; right: max(18px, env(safe-area-inset-right)); bottom: calc(env(safe-area-inset-bottom) + var(--dock) + 16px); width: 64px; height: 64px; border-radius: 22px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0,0,0,.28); transition: transform .2s; }
.fab .ico { width: 32px; height: 32px; stroke-width: 2.6; }
.fab:active { transform: scale(.94); }

.scrim { position: fixed; inset: 0; background: rgba(4,20,20,.55); z-index: 10; }
.sheet { position: fixed; z-index: 11; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 28px 28px 0 0; border-top: 2px solid var(--line); padding: 12px 18px calc(env(safe-area-inset-bottom) + 22px); }
@media (min-width: 640px) { .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 520px; transform: translate(-50%, -50%); border-radius: 28px; border: 2px solid var(--line); padding-bottom: 22px; } }
.grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 14px; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.field { margin-bottom: 14px; }
.field > label, .lbl { display: block; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; font-weight: 800; color: var(--mute); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; min-height: 48px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-height: 46px; padding: 0 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); font-weight: 800; color: var(--mute); }
.seg button.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.acts { display: flex; gap: 10px; margin-top: 18px; }
.btn { flex: 1; min-height: 52px; border-radius: 16px; font-weight: 800; background: var(--bg); border: 2px solid var(--line); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); flex: 2; }
.btn.danger { color: var(--p1); flex: 0 0 auto; padding: 0 18px; }
.btn.small { min-height: 44px; flex: 0 0 auto; padding: 0 16px; font-size: 14px; }
details.more { margin: 0 0 14px; border: 2px solid var(--line); border-radius: 14px; padding: 0 14px; }
details.more summary { min-height: 48px; display: flex; align-items: center; font-weight: 800; cursor: pointer; }
details.more[open] { padding-bottom: 6px; }

.toast { position: fixed; left: 0; right: 0; margin: 0 auto; bottom: calc(env(safe-area-inset-bottom) + var(--dock) + 96px); z-index: 20; background: var(--ink); color: var(--bg); border-radius: 16px; padding: 12px 18px; display: flex; gap: 14px; align-items: center; font-weight: 700; box-shadow: 0 8px 30px rgba(0,0,0,.3); width: max-content; max-width: calc(100vw - 32px); }
.toast button { color: var(--accent); font-weight: 800; min-height: 36px; filter: brightness(1.25); }
.empty { text-align: center; padding: 36px 16px; color: var(--mute); font-weight: 600; }
.empty b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { width: 100%; max-width: 340px; text-align: center; }
.login h1 { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 12px 0 4px; }
.login .dots { display: flex; justify-content: center; gap: 12px; margin: 22px 0; height: 18px; }
.login .dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--brand); transition: background .1s, transform .1s; }
.login .dots i.f { background: var(--brand); transform: scale(1.1); }
.login .dots.bad { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pad button { min-height: 64px; border-radius: 20px; background: var(--card); border: 2px solid var(--line); font-size: 24px; font-weight: 800; }
.pad button:active { background: var(--brand); color: var(--brand-ink); }
.login .msg { min-height: 22px; font-weight: 700; color: var(--p1); font-size: 14px; }
.logo { width: 64px; height: 64px; border-radius: 20px; background: var(--brand); color: var(--brand-ink); display: inline-grid; place-items: center; }
.logo .ico { width: 34px; height: 34px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ask */
.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.msg { max-width: 88%; padding: 12px 14px; border-radius: 18px; line-height: 1.4; font-weight: 600; word-break: break-word; }
.msg.me { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 6px; }
.msg.ai { align-self: flex-start; background: var(--card); border: 2px solid var(--line); border-bottom-left-radius: 6px; }
.msg.err { color: var(--p1); }
.msg.typing { color: var(--mute); }
.ideas { display: flex; flex-direction: column; gap: 8px; }
.ideas button { text-align: left; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-weight: 700; }
.askbar { position: sticky; bottom: calc(env(safe-area-inset-bottom) + var(--dock) + 8px); display: flex; gap: 8px; margin-top: 12px; padding: 8px; background: var(--bg); }
.askbar input { flex: 1; min-height: 52px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); color: var(--ink); padding: 0 14px; font: inherit; font-weight: 600; }
.askbar .btn { flex: 0 0 56px; display: grid; place-items: center; }

.backbtn { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 8px -6px; padding: 8px 12px 8px 6px; border-radius: 999px; background: none; border: 0; color: var(--brand); font-weight: 800; font-size: 15px; cursor: pointer; }
.top > #bBack { flex: none; }
