/* Budget — design system shared with the ergani HRM app (tokens, sidebar, cards, stat tiles, badges). */
:root {
  --bg:#f4f6fb; --surface:#ffffff; --surface-2:#f8f9fc; --ink:#101828; --muted:#667085; --line:#e6e9f2;
  --brand:#4f46e5; --brand-ink:#ffffff; --brand-soft:#eef0ff; --brand-2:#7c3aed;
  --ok:#067647; --ok-soft:#e7f8ee; --err:#b42318; --err-soft:#fdecea; --warn:#a15c07; --warn-soft:#fff4dc;
  --info:#1d4ed8; --info-soft:#e8f0ff; --violet:#7c3aed; --violet-soft:#f1eaff;
  --nick:#2563eb; --nick-soft:#e3edff; --stam:#c026d3; --stam-soft:#fbe8fd;
  --shadow:0 1px 2px rgba(16,24,40,.05), 0 4px 14px rgba(16,24,40,.05); --radius:14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0b1020; --surface:#141a2e; --surface-2:#192038; --ink:#eef1f8; --muted:#97a0b8; --line:#262f4a;
    --brand:#7c83ff; --brand-ink:#0b1020; --brand-soft:#232a52; --brand-2:#a78bfa;
    --ok:#4ade80; --ok-soft:#10301f; --err:#f87171; --err-soft:#341618; --warn:#fbbf24; --warn-soft:#33270a;
    --info:#7ab0ff; --info-soft:#14284d; --violet:#c4a8ff; --violet-soft:#2a1f4d;
    --nick:#7ab0ff; --nick-soft:#16284a; --stam:#f0abfc; --stam-soft:#3a1840;
    --shadow:0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg:#0b1020; --surface:#141a2e; --surface-2:#192038; --ink:#eef1f8; --muted:#97a0b8; --line:#262f4a;
  --brand:#7c83ff; --brand-ink:#0b1020; --brand-soft:#232a52; --brand-2:#a78bfa;
  --ok:#4ade80; --ok-soft:#10301f; --err:#f87171; --err-soft:#341618; --warn:#fbbf24; --warn-soft:#33270a;
  --info:#7ab0ff; --info-soft:#14284d; --violet:#c4a8ff; --violet-soft:#2a1f4d;
  --nick:#7ab0ff; --nick-soft:#16284a; --stam:#f0abfc; --stam-soft:#3a1840;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing:border-box }
html { -webkit-text-size-adjust:100% }
body { margin:0; background:var(--bg); color:var(--ink); font:15px/1.55 Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; -webkit-font-smoothing:antialiased }
a { color:var(--brand) }
h1 { font-size:26px; line-height:1.2; margin:0 0 4px; letter-spacing:-.02em; font-weight:650 }
h2 { font-size:16px; margin:0; font-weight:600 }
h3 { font-size:14px; margin:18px 0 10px; font-weight:600 }
.sub { color:var(--muted); margin:0 0 22px }
.muted { color:var(--muted); font-size:13px }
.note { color:var(--muted); font-size:13px; margin:10px 0 0 }

/* ---------- layout ---------- */
.app { display:grid; grid-template-columns:248px minmax(0,1fr); min-height:100vh }
.side { background:var(--surface); border-right:1px solid var(--line); padding:18px 14px; position:sticky; top:0; height:100vh; display:flex; flex-direction:column; gap:2px; overflow-y:auto }
.brand { display:flex; align-items:center; gap:10px; padding:4px 10px 14px; font-weight:700; font-size:19px; letter-spacing:-.02em; text-decoration:none }
.logo { width:34px; height:34px; border-radius:10px; background:linear-gradient(135deg,var(--brand),var(--brand-2)); color:#fff; display:grid; place-items:center; font-weight:700; box-shadow:0 4px 12px rgba(79,70,229,.35) }
.logo svg { width:19px; height:19px }
.nav-label { font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); padding:14px 12px 6px; font-weight:600 }
.nav a { display:flex; align-items:center; gap:11px; padding:9px 12px; border-radius:10px; color:var(--muted); text-decoration:none; font-weight:500; cursor:pointer }
.nav a:hover { background:var(--surface-2); color:var(--ink) }
.nav a.on { background:var(--brand-soft); color:var(--brand) }
.nav svg { width:19px; height:19px; flex:none }
.nav .new { margin-left:auto; background:var(--ok-soft); color:var(--ok); border-radius:99px; font-size:10.5px; padding:1px 7px; font-weight:650 }
.side-foot { margin-top:auto; padding-top:14px; border-top:1px solid var(--line); display:grid; gap:6px }
.main { min-width:0 }
.topbar { display:flex; align-items:center; gap:10px; padding:14px 28px; position:sticky; top:0; background:color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter:blur(8px); z-index:5 }
.topbar .spacer { flex:1 }
.topbar .monthpick { display:flex; align-items:center; margin:0; background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:3px 4px; box-shadow:var(--shadow) }
.topbar .monthpick span { color:var(--muted); font-size:13px; font-weight:500 }
.topbar .monthpick input { width:auto; border:0; box-shadow:none; padding:6px 6px; background:transparent }
.save-state { font-size:12.5px; color:var(--muted); display:flex; align-items:center; gap:6px }
.save-state i { width:8px; height:8px; border-radius:50%; background:var(--ok) } .save-state.saving i { background:var(--warn) } .save-state.error i { background:var(--err) }
.menu-btn { display:none }
.iconbtn { width:38px; height:38px; border-radius:10px; border:1px solid var(--line); background:var(--surface); color:var(--ink); display:grid; place-items:center; cursor:pointer; padding:0; box-shadow:var(--shadow) }
.iconbtn:hover { background:var(--surface-2); filter:none } .iconbtn svg { width:19px; height:19px }
.theme-sun { display:none } :root[data-theme="dark"] .theme-sun { display:block } :root[data-theme="dark"] .theme-moon { display:none }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-sun { display:block } :root:not([data-theme="light"]) .theme-moon { display:none } }
.content { padding:6px 28px 48px; max-width:1340px }
.pagehead { display:flex; justify-content:space-between; align-items:flex-end; gap:16px; flex-wrap:wrap; margin-bottom:18px }
.pagehead .sub { margin:0 }

/* ---------- components ---------- */
.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:20px; margin-bottom:16px; box-shadow:var(--shadow) }
.card-head { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:14px }
.card-head .actions { margin-left:auto }
.grid { display:grid; gap:16px } .g2 { grid-template-columns:repeat(auto-fit,minmax(320px,1fr)) } .g3 { grid-template-columns:repeat(auto-fit,minmax(240px,1fr)) }
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); grid-auto-rows:1fr; gap:16px; margin-bottom:16px }
.stat { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:18px 20px; box-shadow:var(--shadow); height:100%; display:flex; flex-direction:column; justify-content:center; gap:2px }
.stat .n { font-size:27px; font-weight:700; letter-spacing:-.02em; line-height:1.15 } .stat .l { color:var(--muted); font-size:13px }
.stat .n small { font-size:15px; font-weight:600; color:var(--muted) }
.stat.hero { background:linear-gradient(135deg,var(--brand),var(--brand-2)); color:#fff; border:0 } .stat.hero .l, .stat.hero .n small { color:rgba(255,255,255,.82) }
.stat.good { border-color:color-mix(in srgb, var(--ok) 35%, var(--line)) } .stat.bad { border-color:color-mix(in srgb, var(--err) 35%, var(--line)) }
a.tilelink { text-decoration:none; color:inherit; display:block; height:100%; cursor:pointer } a.tilelink:hover .stat { border-color:var(--brand) }
.badge { display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:99px; font-size:12px; font-weight:550; background:var(--info-soft); color:var(--info); white-space:nowrap }
.badge::before { content:''; width:6px; height:6px; border-radius:50%; background:currentColor }
.badge.ok { background:var(--ok-soft); color:var(--ok) } .badge.err { background:var(--err-soft); color:var(--err) } .badge.warn { background:var(--warn-soft); color:var(--warn) } .badge.violet { background:var(--violet-soft); color:var(--violet) }
.who { display:inline-flex; align-items:center; gap:6px; font-weight:600 } .who::before { content:''; width:9px; height:9px; border-radius:50%; background:var(--pc, var(--brand)) }
.who.nick { --pc:var(--nick) } .who.stam { --pc:var(--stam) }
.hint { margin-top:12px; padding:10px 14px; border-radius:10px; background:var(--brand-soft); color:var(--brand); font-weight:500; font-size:14px }
.hint.warn { background:var(--warn-soft); color:var(--warn) } .hint.err { background:var(--err-soft); color:var(--err) } .hint.ok { background:var(--ok-soft); color:var(--ok) }
.empty { color:var(--muted); padding:22px 6px; text-align:center }
.pos { color:var(--ok) } .neg { color:var(--err) }

/* ---------- tables ---------- */
.tablewrap { overflow-x:auto; margin:0 -4px }
table { width:100%; border-collapse:collapse }
th, td { text-align:right; padding:9px 10px; border-bottom:1px solid var(--line); vertical-align:middle; white-space:nowrap }
th:first-child, td:first-child { text-align:left }
th { color:var(--muted); font-weight:550; font-size:12px; text-transform:uppercase; letter-spacing:.04em }
th.nick { color:var(--nick) } th.stam { color:var(--stam) }
tbody tr:last-child td, table tr:last-child td { border-bottom:0 }
tr.total td { font-weight:650; background:var(--surface-2) }
tr.total td:first-child { border-radius:10px 0 0 10px } tr.total td:last-child { border-radius:0 10px 10px 0 }
tr.off td { color:var(--muted) } tr.off input { opacity:.5 }
tr:has(td):hover td { background:color-mix(in srgb, var(--brand) 6%, transparent) }
tr.drop-target td { box-shadow:inset 0 2px 0 var(--brand) }
td.wrap, th.wrap { white-space:normal }

/* ---------- forms ---------- */
label { display:block; font-size:13px; color:var(--muted); margin:0 0 6px; font-weight:500 }
input, select, textarea { width:100%; padding:9px 12px; border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--ink); font:inherit; outline:none; transition:border-color .12s, box-shadow .12s }
input:focus, select:focus, textarea:focus { border-color:var(--brand); box-shadow:0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent) }
td input, td select { padding:6px 9px; border-radius:8px; font-size:14px }
td input[type=number] { width:104px; text-align:right }
td input[type=text] { min-width:140px }
td input[type=month] { width:150px }
input[type=checkbox] { width:17px; height:17px; padding:0; accent-color:var(--brand); vertical-align:middle; cursor:pointer }
input[type=month], select { cursor:pointer }
:root[data-theme="dark"] input::-webkit-calendar-picker-indicator { filter:invert(1) }
input[type=number] { -moz-appearance:textfield; appearance:textfield }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance:none; margin:0 }
.fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:14px }
.field label { margin-bottom:6px }
label.check { display:flex; gap:10px; align-items:center; color:var(--ink); font-size:14px; cursor:pointer; margin:12px 0 0 }
button, .btn { background:var(--brand); color:var(--brand-ink); border:0; border-radius:10px; padding:9px 16px; font:inherit; font-weight:600; cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; gap:8px; transition:filter .12s, transform .05s; white-space:nowrap }
button:hover, .btn:hover { filter:brightness(1.08) } button:active { transform:translateY(1px) }
button:disabled { opacity:.5; cursor:not-allowed }
button.sec, .btn.sec { background:var(--surface); color:var(--ink); border:1px solid var(--line) } button.sec:hover { background:var(--surface-2); filter:none }
button.ghost { background:transparent; color:var(--muted); padding:6px 8px } button.ghost:hover { background:var(--surface-2); color:var(--ink); filter:none }
button.small { padding:6px 12px; font-size:13px }
button svg, .btn svg { width:17px; height:17px }
.actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center }
.del { background:transparent; color:var(--muted); padding:6px; border-radius:8px } .del:hover { background:var(--err-soft); color:var(--err); filter:none } .del svg { width:16px; height:16px }
.grip { cursor:grab; color:var(--muted); user-select:none; display:inline-grid; place-items:center; width:20px; vertical-align:middle } .grip svg { width:16px; height:16px }
.seg { display:inline-flex; gap:3px; padding:3px; background:var(--surface-2); border:1px solid var(--line); border-radius:11px; flex-wrap:wrap }
.seg button { background:transparent; color:var(--muted); padding:6px 12px; font-size:13px; border-radius:8px; font-weight:550 }
.seg button:hover { color:var(--ink); filter:none } .seg button.on { background:var(--surface); color:var(--brand); box-shadow:var(--shadow) }
.tabs { display:flex; gap:4px; border-bottom:1px solid var(--line); margin:0 0 18px; overflow-x:auto }
.tabs button { background:transparent; color:var(--muted); border-radius:0; padding:10px 14px; border-bottom:2px solid transparent; font-weight:550 }
.tabs button:hover { color:var(--ink); filter:none } .tabs button.on { color:var(--brand); border-bottom-color:var(--brand) }

/* ---------- progress / bars ---------- */
.bar { height:10px; border-radius:99px; background:var(--surface-2); border:1px solid var(--line); overflow:hidden }
.bar i { display:block; height:100%; border-radius:99px; background:linear-gradient(90deg,var(--brand),var(--brand-2)) }
.bar.ok i { background:var(--ok) } .bar.warn i { background:var(--warn) } .bar.err i { background:var(--err) }
.bar.nick i { background:var(--nick) } .bar.stam i { background:var(--stam) }
.kv { display:flex; justify-content:space-between; gap:12px; padding:8px 0; border-bottom:1px solid var(--line); font-size:14px } .kv:last-child { border:0 }
.kv b { font-weight:650 } .kv.big { font-size:16px } .kv.big b { font-size:20px }
.result { border-radius:14px; padding:18px 20px; display:flex; flex-direction:column; gap:4px }
.result.debit { background:var(--err-soft); color:var(--err) } .result.credit { background:var(--ok-soft); color:var(--ok) } .result.zero { background:var(--surface-2) }
.result .n { font-size:30px; font-weight:700; letter-spacing:-.02em } .result .l { font-size:13px; font-weight:550 }

/* ---------- months strip (annual expenses) ---------- */
.months { display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); gap:6px; align-items:end; height:150px; margin-top:6px }
.months .m { display:flex; flex-direction:column; align-items:stretch; justify-content:flex-end; height:100%; gap:4px; text-align:center }
.months .m i { display:block; border-radius:8px 8px 3px 3px; background:var(--brand-soft); border:1px solid color-mix(in srgb, var(--brand) 30%, transparent); min-height:4px }
.months .m.now i { background:var(--brand); }
.months .m span { font-size:11.5px; color:var(--muted); font-weight:600; text-transform:uppercase }
.months .m b { font-size:11.5px }

/* ---------- timeline (trips) ---------- */
.tl { border-left:2px solid var(--line); margin:6px 0 0 8px; padding-left:20px; display:grid; gap:14px }
.tl-item { position:relative }
.tl-item::before { content:""; position:absolute; left:-27px; top:6px; width:12px; height:12px; border-radius:50%; background:var(--brand); box-shadow:0 0 0 4px var(--brand-soft) }
.tl-date { color:var(--muted); text-transform:capitalize; margin-bottom:6px; font-size:13px; font-weight:600 }
.tl-card { border:1px solid var(--line); border-radius:12px; padding:12px 14px; background:var(--surface-2) }
.tl-title { display:flex; justify-content:space-between; margin-bottom:8px }
.tl-p { display:grid; grid-template-columns:110px 1fr 190px; gap:12px; align-items:center; padding:3px 0 }
.tl-nums { text-align:right; white-space:nowrap; font-size:14px }

/* ---------- shopping ---------- */
.shop { display:grid; gap:6px }
.shop-row { display:flex; align-items:center; gap:10px; padding:6px 8px; border-radius:10px } .shop-row:hover { background:var(--surface-2) }
.shop-row.done input[type=text] { text-decoration:line-through; opacity:.55 }
.shop-row input[type=text] { flex:1; border-color:transparent; background:transparent } .shop-row input[type=text]:focus { border-color:var(--brand); background:var(--surface) }
.dot { display:inline-block; width:14px; height:14px; border-radius:50%; cursor:pointer; flex:none; box-shadow:0 0 0 3px var(--surface-2) }
.dot.red { background:#e53935 } .dot.green { background:#43a047 } .dot.blue { background:#1e88e5 }

/* ---------- news / docs ---------- */
.feed { display:grid; gap:2px }
.feed a { display:block; padding:11px 12px; border-radius:10px; text-decoration:none; color:var(--ink) } .feed a:hover { background:var(--surface-2) }
.feed a small { display:block; color:var(--muted); font-size:12.5px; margin-top:2px }
.doclist { display:grid; gap:4px } .doc { display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:10px; cursor:pointer; color:var(--ink) } .doc:hover { background:var(--surface-2) }
.doc svg { width:18px; height:18px; color:var(--brand); flex:none } .doc small { color:var(--muted); margin-left:auto }
.codes td:first-child { font-variant-numeric:tabular-nums; font-weight:650; color:var(--brand) }

/* ---------- chart ---------- */
.chart-wrap { position:relative; max-width:880px }
#chartSvg { display:block; width:100%; height:auto; cursor:crosshair; user-select:none; -webkit-user-select:none; touch-action:pan-y }
#chartSvg .grid { stroke:var(--line); stroke-width:1 }
#chartSvg .ref { stroke:var(--muted); stroke-width:1; stroke-dasharray:2 4 }
#chartSvg .avg { stroke:var(--ink); stroke-width:1.2; stroke-dasharray:6 4; opacity:.7 }
#chartSvg .cursor { stroke:var(--muted); stroke-width:1 }
#chartSvg text { font:12px Inter,system-ui,sans-serif } #chartSvg .axis, #chartSvg .ref-label { fill:var(--muted) } #chartSvg .avg-label { fill:var(--ink); opacity:.8 }
#chartSvg .sel { fill:var(--muted); opacity:.18 } #chartSvg .sel.up { fill:var(--ok) } #chartSvg .sel.down { fill:var(--err) }
.chart-tip { position:absolute; transform:translate(-50%,calc(-100% - 10px)); background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:3px 9px; font-size:13px; white-space:nowrap; pointer-events:none; box-shadow:var(--shadow) }
.chart-sel { margin:6px 0 0; font-size:13px; min-height:1.4em }
.chart-price { display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; margin:4px 0 10px } .chart-price b { font-size:24px; letter-spacing:-.02em }

/* ---------- login ---------- */
.login { min-height:100vh; display:grid; place-items:center; padding:24px }
.login .card { width:100%; max-width:380px }

/* ---------- toast ---------- */
.toast { position:fixed; bottom:20px; right:20px; z-index:60; background:var(--ink); color:var(--bg); padding:10px 16px; border-radius:10px; font-weight:550; box-shadow:0 10px 30px rgba(0,0,0,.25); opacity:0; transform:translateY(10px); transition:all .18s; pointer-events:none }
.toast.show { opacity:1; transform:none }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns:1fr }
  .side { position:fixed; inset:0 auto 0 0; width:268px; z-index:20; transform:translateX(-100%); transition:transform .18s; box-shadow:var(--shadow) }
  body.menu-open .side { transform:none } body.menu-open::after { content:''; position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:10 }
  .menu-btn { display:grid } .topbar { padding:12px 16px } .content { padding:4px 16px 40px }
  .tl-p { grid-template-columns:90px 1fr } .tl-nums { grid-column:1/-1; text-align:left }
  .save-state span { display:none }
}

/* ---------- income tax: steps ---------- */
.step { display:flex; gap:14px; align-items:flex-start; margin-bottom:16px }
.step h2 { display:flex; align-items:center; gap:8px } .step h2 svg { width:20px; height:20px; color:var(--brand) }
.step-n { flex:none; width:32px; height:32px; border-radius:50%; display:grid; place-items:center; font-weight:700; color:#fff; background:linear-gradient(135deg,var(--brand),var(--brand-2)); box-shadow:0 4px 12px rgba(79,70,229,.3) }
.choice { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px }
.choice button { background:var(--surface); color:var(--ink); border:1.5px solid var(--line); padding:10px 18px }
.choice button:hover { border-color:var(--brand); filter:none } .choice button.on { border-color:var(--brand); background:var(--brand-soft); color:var(--brand) }
.jobcard { border:1px solid var(--line); border-radius:14px; padding:16px; margin-bottom:12px; background:var(--surface-2) }
.jobhead { display:flex; align-items:center; gap:8px; margin-bottom:12px }
.jobname { font-weight:650; font-size:16px; background:transparent; border-color:transparent; padding:6px 8px; max-width:360px }
.jobname:hover, .jobname:focus { background:var(--surface); border-color:var(--line) }
.raises { display:grid; gap:8px; margin:8px 0 0 28px }
.raise { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:14px; color:var(--muted) }
.raise input[type=date] { width:170px } .raise input[type=number] { width:120px }
.pills { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px }
.pill { margin:0; display:inline-flex } .pill input { display:none }
.pill span { padding:6px 12px; border-radius:99px; border:1px solid var(--line); font-size:13px; font-weight:550; color:var(--muted); cursor:pointer; background:var(--surface) }
.pill input:checked + span { background:var(--brand-soft); color:var(--brand); border-color:color-mix(in srgb, var(--brand) 40%, transparent) }
.pill input:checked + span::before { content:'✓ ' }
.jobtable td { vertical-align:middle } .jobtable td .muted { font-size:12px }
input.ov { width:120px; text-align:right; color:var(--muted); background:transparent; border-style:dashed }
input.ov::placeholder { color:var(--muted); opacity:.9 }
input.ov.set { color:var(--violet); border-style:solid; border-color:color-mix(in srgb, var(--violet) 55%, transparent); background:var(--violet-soft); font-weight:600 }
details.more { margin-top:14px; border-top:1px solid var(--line); padding-top:12px }
details.more summary { cursor:pointer; color:var(--brand); font-weight:600; list-style:none }
details.more summary::before { content:'▸ '; } details.more[open] summary::before { content:'▾ ' }
details.more[open] summary { margin-bottom:10px }
.big-input { font-size:20px; font-weight:650; padding:12px 14px }
.ok-text { color:var(--violet); font-weight:650 }
.equation { margin-top:14px; border:1px solid var(--line); border-radius:12px; overflow:hidden }
.equation div { display:flex; justify-content:space-between; padding:10px 14px; border-bottom:1px solid var(--line) }
.equation div:last-child { border:0 } .equation .eq-total { background:var(--surface-2); font-size:17px }
.result-step.debit { border-color:color-mix(in srgb, var(--err) 35%, var(--line)) } .result-step.credit { border-color:color-mix(in srgb, var(--ok) 35%, var(--line)) }

/* ---------- 30% card goal bar ---------- */
.goal { margin-top:16px }
.goal-top { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:8px }
.goal-top b { font-size:18px }
.goal-track { position:relative; height:28px; border-radius:99px; background:repeating-linear-gradient(135deg, var(--surface-2) 0 8px, color-mix(in srgb, var(--line) 70%, transparent) 8px 16px); border:1px solid var(--line); overflow:visible }
.goal-fill { position:absolute; inset:0 auto 0 0; border-radius:99px; background:linear-gradient(90deg, var(--brand), var(--violet)); transition:width .45s cubic-bezier(.2,.8,.2,1); min-width:0 }
.goal-mark { position:absolute; top:4px; bottom:4px; width:2px; margin-left:-1px; background:var(--surface); opacity:.7; border-radius:2px }
.goal-tick { position:absolute; right:-6px; top:50%; width:40px; height:40px; margin-top:-20px; border-radius:50%; display:grid; place-items:center; color:#fff;
  background:var(--violet); box-shadow:0 0 0 4px var(--surface), 0 6px 18px color-mix(in srgb, var(--violet) 55%, transparent);
  transform:scale(0); opacity:0; transition:transform .35s cubic-bezier(.3,1.6,.5,1), opacity .2s }
.goal-tick svg { width:22px; height:22px; stroke-width:3 }
.goal.done .goal-tick { transform:scale(1); opacity:1 }
.goal.done .goal-fill { background:linear-gradient(90deg, var(--brand-2), var(--violet)) }
.goal-scale { display:flex; justify-content:space-between; margin-top:6px; font-size:11.5px; color:var(--muted); font-weight:600 }
.goal-msg { margin:12px 0 0; font-size:14px }

/* ---------- styled pickers (date / month / select) ---------- */
.native-hidden { position:absolute !important; width:1px !important; height:1px !important; opacity:0 !important; pointer-events:none !important; padding:0 !important; border:0 !important }
.picker { width:100%; justify-content:space-between; gap:10px; background:var(--surface); color:var(--ink); border:1px solid var(--line); border-radius:10px; padding:9px 12px; font-weight:500; text-align:left }
.picker:hover { border-color:color-mix(in srgb, var(--brand) 45%, var(--line)); filter:none } .picker[aria-expanded="true"] { border-color:var(--brand); box-shadow:0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent) }
.picker.date, .picker.month { justify-content:flex-start }
.picker-v { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap } .picker-v.ph { color:var(--muted); font-weight:400 }
.picker-ic { display:grid; place-items:center; color:var(--muted) } .picker-ic svg { width:17px; height:17px } .picker[aria-expanded="true"] .chev { transform:rotate(180deg) }
td .picker { padding:6px 10px; border-radius:8px; font-size:14px; width:auto; min-width:150px }
.monthpick .picker { border:0; box-shadow:none; background:transparent; padding:6px 8px; font-weight:600; min-width:170px }
.popover { position:fixed; z-index:80; background:var(--surface); border:1px solid var(--line); border-radius:16px; box-shadow:0 16px 40px rgba(0,0,0,.28); padding:12px; animation:popin .12s ease-out }
@keyframes popin { from { opacity:0; transform:translateY(-4px) } to { opacity:1; transform:none } }
.popover.date, .popover.month { width:308px }
.popover .mhead { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px } .popover .mhead b { font-size:15px }
.popover .mhead .iconbtn { width:32px; height:32px; box-shadow:none } .popover .mhead .iconbtn:disabled { opacity:.3 }
.popover .mgrid { display:grid; grid-template-columns:repeat(7,1fr); gap:3px } .popover .mdow { text-align:center; font-size:11px; color:var(--muted); font-weight:650; padding:4px 0 }
.popover .mmonths { display:grid; grid-template-columns:repeat(3,1fr); gap:6px }
.popover .mday { background:transparent; color:var(--ink); padding:0; height:36px; border-radius:10px; font-weight:500; font-size:13.5px; justify-content:center }
.popover .mmonths .mday { height:42px }
.popover .mday:hover:not(:disabled) { background:var(--brand-soft); color:var(--brand); filter:none }
.popover .mday.we { color:var(--muted) } .popover .mday.today { box-shadow:inset 0 0 0 1.5px var(--brand); font-weight:700 }
.popover .mday.sel { background:linear-gradient(135deg,var(--brand),var(--brand-2)); color:#fff; font-weight:700 }
.popover .mday:disabled { opacity:.25; cursor:not-allowed }
.popover .mfoot { display:flex; justify-content:space-between; margin-top:8px; padding-top:8px; border-top:1px solid var(--line) }
.linkbtn { background:none; color:var(--brand); padding:4px 6px; font-size:13px; font-weight:550 } .linkbtn:hover { text-decoration:underline; filter:none }
.popover.select { padding:6px; max-width:min(420px, calc(100vw - 24px)) }
.optlist { display:grid; gap:2px; max-height:320px; overflow:auto }
.opt { background:transparent; color:var(--ink); justify-content:flex-start; padding:9px 12px; border-radius:8px; font-weight:500; white-space:normal; text-align:left }
.opt:hover, .opt:focus { background:var(--surface-2); filter:none; outline:none } .opt.sel { background:var(--brand-soft); color:var(--brand); font-weight:650 }
.opt.sel::after { content:'\2713'; margin-left:auto; padding-left:12px }

/* ---------- income tax: step tiles + modal ---------- */
.stepper { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:12px; margin-bottom:16px }
.steptile { background:var(--surface); color:var(--ink); border:1px solid var(--line); border-radius:var(--radius); padding:16px; text-align:left; flex-direction:column; align-items:flex-start; gap:8px; box-shadow:var(--shadow); white-space:normal; min-height:132px; position:relative; font-weight:500 }
.steptile:hover { border-color:var(--brand); filter:none; transform:translateY(-1px) }
.steptile b { font-size:15px } .steptile .muted { font-size:13px }
.steptile .st { position:absolute; top:14px; right:14px; width:24px; height:24px; border-radius:50%; display:grid; place-items:center; font-size:13px; font-weight:700 }
.steptile.ok .st { background:var(--violet-soft); color:var(--violet) } .steptile.warn .st { background:var(--warn-soft); color:var(--warn) }
.steptile.warn { border-color:color-mix(in srgb, var(--warn) 40%, var(--line)) }
.hero-result { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; cursor:pointer }
.modal-backdrop { position:fixed; inset:0; z-index:60; background:rgba(8,12,24,.55); backdrop-filter:blur(3px); display:grid; place-items:center; padding:24px }
.modal-backdrop.enter { animation:fadein .15s } .modal-backdrop.enter .modal { animation:popin .18s ease-out }
h1 svg, h2 svg, h3 svg { width:20px; height:20px; flex:none; vertical-align:-3px; color:var(--brand) }
.modal-head h2 { display:flex; align-items:center; gap:8px }
@keyframes fadein { from { opacity:0 } }
.modal { width:min(980px, 100%); max-height:calc(100vh - 48px); display:flex; flex-direction:column; background:var(--surface); border:1px solid var(--line); border-radius:20px; box-shadow:0 30px 80px rgba(0,0,0,.4) }
.modal-head { display:flex; align-items:center; gap:14px; padding:18px 22px; border-bottom:1px solid var(--line) }
.modal-head .grow { flex:1 } .modal-head .muted { margin:2px 0 0 }
.modal-dots { display:flex; gap:6px } .modal-dots i { width:8px; height:8px; border-radius:50%; background:var(--line) } .modal-dots i.on { background:var(--brand); width:22px; border-radius:99px }
.modal-body { padding:20px 22px; overflow:auto }
.modal-foot { display:flex; justify-content:space-between; gap:10px; padding:14px 22px; border-top:1px solid var(--line); background:var(--surface-2); border-radius:0 0 20px 20px }
body.modal-open { overflow:hidden }
@media (max-width: 700px) { .modal-backdrop { padding:0; place-items:end stretch } .modal { max-height:92vh; border-radius:20px 20px 0 0 } }

.popover .mtitle { background:transparent; color:var(--ink); font-weight:650; font-size:15px; padding:6px 10px; border-radius:10px; gap:4px }
.popover .mtitle:hover { background:var(--brand-soft); color:var(--brand); filter:none }
.popover .mtitle-ic svg { width:15px; height:15px }
.popover .mfoot .muted { font-size:12.5px; align-self:center }
.yearpick { display:inline-flex; align-items:center; gap:8px } .yearpick span { color:var(--muted); font-size:13px; font-weight:500; white-space:nowrap }
.yearpick .picker { min-width:120px; font-weight:650 }

/* ---------- person filter chips (top-right) & stretchy text inputs ---------- */
.people-filter { box-shadow:var(--shadow); background:var(--surface) }
.people-filter[hidden] { display:none }
.people-filter button { font-weight:650; letter-spacing:.02em }
.people-filter button.on { color:#fff; background:linear-gradient(135deg,var(--brand),var(--brand-2)) }
.people-filter button[data-id="nick"].on { background:var(--nick) } .people-filter button[data-id="stam"].on { background:var(--stam) }
:root[data-theme="dark"] .people-filter button.on { color:#0b1020 }
td input.grow-input { width:calc(100% - 28px); min-width:160px; display:inline-block }

/* ---------- piggyWallet wordmark ---------- */
.wordmark { font-family:Outfit, Inter, system-ui, sans-serif; font-weight:600; letter-spacing:-.035em; text-decoration:none; line-height:1; white-space:nowrap }
.brand.wordmark { font-size:27px; padding:8px 12px 20px; gap:0 }
.wm-a { color:var(--ink) } .wm-b { color:#b49cf5 }
:root[data-theme="dark"] .wm-b { color:#c4b0ff }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wm-b { color:#c4b0ff } }
.topbar-mark { display:none; font-size:22px }

/* ---------- subscriptions ---------- */
.sub-link { color:var(--muted); display:inline-grid; place-items:center; vertical-align:middle; margin-left:4px } .sub-link:hover { color:var(--brand) } .sub-link svg { width:16px; height:16px }
.sub-next { font-size:12px; margin-top:4px; white-space:nowrap }
.cat-row { display:grid; grid-template-columns:140px 1fr 90px; gap:12px; align-items:center; padding:7px 0 } .cat-row b { text-align:right }
details.more-card summary { cursor:pointer; color:var(--brand); font-weight:600 } details.more-card[open] summary { margin-bottom:12px }
.picker.status-active { color:var(--ok) } .picker.status-paused { color:var(--warn) } .picker.status-cancelled { color:var(--muted) }

/* ---------- mobile (phones, Capacitor Android/iOS, installed PWA) ---------- */
body { padding-left:env(safe-area-inset-left); padding-right:env(safe-area-inset-right) }
.side { padding-top:max(18px, env(safe-area-inset-top)) }
.toast { bottom:max(20px, calc(env(safe-area-inset-bottom) + 12px)) }
@media (max-width: 900px) {
  .topbar-mark { display:inline-flex }
  .topbar { padding-top:max(12px, env(safe-area-inset-top)) }
}
@media (max-width: 700px) {
  html { -webkit-tap-highlight-color:transparent }
  body { font-size:15px }
  input, select, textarea, .picker { font-size:16px }            /* iOS: no zoom on focus */
  td input, td select, td .picker { font-size:15px }
  .topbar { flex-wrap:wrap; row-gap:8px; gap:8px; padding:max(10px, env(safe-area-inset-top)) 12px 10px }
  .topbar .spacer { display:none }
  .topbar-mark { font-size:20px; margin-right:auto }
  .monthpick { order:5 } .monthpick .picker { min-width:0; padding:6px 4px }
  .people-filter { order:6; margin-left:auto }
  .people-filter button { padding:6px 10px }
  .save-state { order:3 } #themeToggle { order:4 }
  .iconbtn { width:40px; height:40px }
  .content { padding:4px 12px calc(32px + env(safe-area-inset-bottom)) }
  h1 { font-size:22px } .sub { margin-bottom:14px; font-size:14px }
  .pagehead { flex-direction:column; align-items:stretch; gap:10px }
  .pagehead .actions { justify-content:flex-start }
  .stats { grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px; grid-auto-rows:auto }
  .stat { padding:14px; min-height:0 } .stat .n { font-size:21px } .stat .l { font-size:12px }
  .card { padding:14px; border-radius:12px; margin-bottom:12px }
  .card-head { margin-bottom:10px }
  .grid { gap:12px } .g2, .g3 { grid-template-columns:1fr }
  th, td { padding:7px 6px }
  td input[type=number] { width:86px }
  td input.grow-input { min-width:120px }
  .tabs { margin-bottom:12px; scrollbar-width:none } .tabs::-webkit-scrollbar { display:none }
  .tabs button { padding:10px 11px; font-size:14px }
  .fields { grid-template-columns:1fr 1fr; gap:10px }
  .stepper { grid-template-columns:1fr 1fr; gap:10px } .steptile { min-height:0; padding:12px }
  .hero-result { flex-direction:column; align-items:stretch } .hero-result button { justify-content:center }
  .modal-backdrop { padding:0; place-items:end stretch }
  .modal { width:100%; max-height:calc(100dvh - env(safe-area-inset-top)); border-radius:18px 18px 0 0 }
  .modal-head { padding:14px 16px } .modal-dots { display:none }
  .modal-body { padding:14px 16px }
  .modal-foot { padding:12px 16px calc(12px + env(safe-area-inset-bottom)); border-radius:0 }
  .modal-foot button { flex:1; justify-content:center }
  .popover { max-width:calc(100vw - 16px) } .popover.date, .popover.month { width:min(320px, calc(100vw - 16px)) }
  .jobcard { padding:12px } .raise input[type=date], .raise .picker { width:150px }
  .choice button { flex:1; justify-content:center; padding:10px 8px }
  .cat-row { grid-template-columns:100px 1fr 74px }
  .goal-tick { width:34px; height:34px; margin-top:-17px }
  .result .n { font-size:24px }
}
@media (max-width: 420px) {
  .stats { grid-template-columns:1fr }
  .fields { grid-template-columns:1fr }
  .stepper { grid-template-columns:1fr }
}

/* ---------- phones: no sideways scrolling anywhere; tables become cards ---------- */
html, body { overflow-x:hidden; overflow-x:clip; max-width:100% }
.app, .main, .content { max-width:100vw; min-width:0 }
img, svg, canvas, video { max-width:100% }
@media (max-width: 700px) {
  .tablewrap { overflow-x:visible; margin:0 }
  table.cardable, table.cardable tbody, table.cardable tr, table.cardable td { display:block; width:100% }
  table.cardable tr.head-row { display:none }
  table.cardable tr { border:1px solid var(--line); border-radius:12px; padding:6px 12px; margin:0 0 10px; background:var(--surface) }
  table.cardable tr:hover td, table.cardable tr:focus-within td { background:transparent }
  table.cardable tr.total { background:var(--surface-2); border-color:color-mix(in srgb, var(--brand) 25%, var(--line)) }
  table.cardable tr.total td { background:transparent }
  table.cardable td { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:7px 0; border:0;
    border-bottom:1px dashed var(--line); text-align:right; white-space:normal; min-height:40px; overflow-wrap:anywhere }
  table.cardable td:last-child { border-bottom:0 }
  table.cardable td::before { content:attr(data-label); flex:0 1 auto; text-align:left; color:var(--muted); font-size:12.5px; font-weight:600; letter-spacing:.02em }
  table.cardable td[data-label=""]::before { content:none }
  table.cardable td:first-child { justify-content:flex-start; font-weight:650; font-size:15px; text-align:left }
  table.cardable td:first-child::before { content:none }
  table.cardable td:empty { display:none }
  table.cardable td > input:not([type=checkbox]), table.cardable td > .picker, table.cardable td > select { width:min(58%, 220px) !important; min-width:0 !important; max-width:58% }
  table.cardable td:first-child > input.grow-input, table.cardable td:first-child > input[type=text] { width:auto !important; flex:1; max-width:none; min-width:0 !important }
  table.cardable td .del { margin-left:auto }
  /* the delete button sits in the card's top-right corner instead of taking a row of its own */
  table.cardable tr { position:relative }
  table.cardable td:last-child:has(> .del:only-child) { position:absolute; top:8px; right:6px; width:auto; min-height:0; padding:0; border:0 }
  table.cardable tr:has(> td:last-child > .del:only-child) > td:first-child { padding-right:42px }
  table.cardable td.wrap, table.cardable td .muted { text-align:left }
  .grip { display:none }
  .jobtable td > input.ov { width:min(50%, 160px) !important }
  .chart-wrap { max-width:100% }
  .raise { flex-wrap:wrap } .raise .picker, .raise input { width:auto !important; flex:1 1 140px }
  .shop-row { flex-wrap:nowrap } .shop-row input[type=text] { min-width:0 }
  .kv { flex-wrap:wrap } .kv b { text-align:right; margin-left:auto }
  .tl-card { padding:10px } .tl-p { grid-template-columns:1fr; gap:4px } .tl-nums { text-align:left }
  .pagehead .actions, .card-head .actions { flex-wrap:wrap }
  .seg { max-width:100%; flex-wrap:wrap }
  .tabs { flex-wrap:wrap; overflow:visible; border-bottom:0; gap:6px }
  .tabs button { border:1px solid var(--line); border-radius:99px; padding:7px 12px; font-size:13.5px; background:var(--surface) }
  .tabs button.on { border-color:var(--brand); background:var(--brand-soft) }
  .yearpick { flex-wrap:wrap }
  .months { gap:3px; height:120px } .months .m b { font-size:10px } .months .m span { font-size:10px }
  .feed a { overflow-wrap:anywhere }
  .equation div { gap:10px } .equation span { text-align:left }
}

@media (max-width: 900px) { .app { grid-template-columns:minmax(0,1fr) } /* phone width lock */ }

.stat.hero .pos, .stat.hero .neg { color:#fff; font-weight:700 } .stat.hero .neg::before { content:'' }

/* modals never wider than the screen (grid item would otherwise grow to its longest button) */
.modal-backdrop { grid-template-columns:minmax(0, 1fr) }
.modal { min-width:0; max-width:100% }
.modal-head .grow, .modal-body { min-width:0 }
@media (max-width: 700px) {
  .modal-foot button { min-width:0; white-space:normal; line-height:1.25; text-align:center }
  .modal-foot button:first-child { flex:0 0 auto }
  .modal .stats { grid-template-columns:repeat(2, minmax(0, 1fr)) }
  .modal .stats .stat.hero { grid-column:1 / -1 }
  .modal .stat .v, .modal .stat b { overflow-wrap:anywhere }
}

/* ---------- subscriptions → notifications ---------- */
.auto-box { border:1px solid var(--line); border-radius:12px; padding:12px 14px; background:var(--surface-2); min-width:0 }
.auto-box p { margin:4px 0 8px }

/* ---------- subscriptions: cards, presets, pop-up, notification banner ---------- */
.sub-list { display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:10px }
.sub-card { display:flex; align-items:center; gap:12px; width:100%; min-width:0; padding:12px 14px; border:1px solid var(--line); border-radius:14px;
  background:var(--surface); color:inherit; font:inherit; text-align:left; cursor:pointer; transition:border-color .15s, transform .15s, box-shadow .15s }
.sub-card:hover { border-color:color-mix(in srgb, var(--brand) 45%, var(--line)); box-shadow:0 6px 18px rgba(0,0,0,.08); transform:translateY(-1px) }
.sub-card.paused, .sub-card.cancelled { opacity:.6 }
.sub-logo { flex:none; display:inline-grid; place-items:center; width:38px; height:38px; border-radius:11px; background:var(--c); color:#fff; font-weight:750; font-size:16px; vertical-align:middle }
.kv .sub-logo, h2 .sub-logo { width:26px; height:26px; border-radius:8px; font-size:12.5px; margin-right:4px }
.sub-main { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px }
.sub-main b { white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.sub-main .muted { font-size:12.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.sub-side { flex:none; display:flex; flex-direction:column; align-items:flex-end; gap:4px; white-space:nowrap }
.sub-side .muted { font-size:12px }
.kv-btn { width:100%; border:0; background:transparent; color:inherit; font:inherit; cursor:pointer; text-align:left; padding:8px 4px; border-radius:10px }
.kv-btn:hover { background:var(--surface-2) }
.kv-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.linkbtn { margin-top:12px; border:0; background:none; color:var(--brand); font:inherit; font-weight:600; cursor:pointer; padding:4px 0 }
.preset-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(130px, 1fr)); gap:8px }
.preset { display:flex; align-items:center; gap:10px; padding:10px; border:1px solid var(--line); border-radius:12px; background:var(--surface); color:inherit; font:inherit; font-weight:600; cursor:pointer; text-align:left; min-width:0 }
.preset span:last-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.preset .sub-logo { width:30px; height:30px; border-radius:9px; font-size:13px }
.preset:hover { border-color:var(--brand) }
.sub-modal { width:min(640px, 100%) }
.sub-modal h2 { display:flex; align-items:center; gap:8px }
.sub-status { margin:14px 0 4px }
.small-hint { font-size:12px; margin-top:4px }
.sec-link { display:inline-flex; align-items:center; gap:6px; margin-top:10px; color:var(--brand); font-weight:600 }
.sec-link svg { width:16px; height:16px }
button.danger { color:var(--err) }
.sub-empty { text-align:center; padding:36px 20px }
.sub-empty-icon svg { width:44px; height:44px; color:var(--brand) }
.sub-empty h2 { margin:8px 0 6px } .sub-empty p { margin:0 0 16px }
.notif-banner { display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; margin:0 0 16px; padding:14px 16px; border-radius:14px;
  background:color-mix(in srgb, var(--brand) 12%, var(--surface)); border:1px solid color-mix(in srgb, var(--brand) 35%, var(--line)) }
.notif-banner.warn { background:var(--warn-soft) }
.notif-banner > div, .notif-banner > summary { display:flex; flex-direction:column; gap:2px; min-width:0 }
details.notif-banner { display:block } details.notif-banner > summary { cursor:pointer; list-style:none } details.notif-banner > summary::-webkit-details-marker { display:none }
@media (max-width: 700px) {
  .sub-list { grid-template-columns:minmax(0, 1fr) }
  .notif-banner button { width:100% }
  .preset-grid { grid-template-columns:repeat(2, minmax(0, 1fr)) }
}
/* month pickers inside tables: always room for "Σεπτέμβριος 2027" */
th.left { text-align:left; padding-left:12px }
td .picker.month { min-width:205px }
td .picker.month .picker-v { overflow:visible }
@media (max-width: 700px) { td .picker.month { min-width:0 } }

/* ---------- investment / savings calculator ---------- */
.page-tabs { margin:0 0 16px }
.page-tabs button { padding:8px 18px; font-size:15px }
.years-pick { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:4px 0 18px }
.years-pick .seg button { min-width:42px }
.years-input { width:80px !important }
.calc-fields { margin-bottom:6px }
.calc-result { display:flex; flex-direction:column; gap:4px; padding:18px 20px; border-radius:16px; color:#fff;
  background:linear-gradient(135deg, var(--brand), #8b5cf6) }
.calc-result b { font-size:34px; line-height:1.1; letter-spacing:-.02em }
.calc-result .muted { color:rgba(255,255,255,.85) } .calc-result .who { color:#fff } .calc-result .pos { color:#fff }
.calc-break { display:flex; flex-wrap:wrap; gap:10px; margin:12px 0 4px }
.calc-break > div { display:flex; flex-wrap:wrap; gap:6px 14px; align-items:center; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:var(--surface-2); flex:1 1 260px }
.ybars { display:flex; align-items:flex-end; gap:4px; height:170px; margin:18px 0 6px; padding-top:6px }
.ybar { flex:1; display:flex; flex-direction:column; align-items:center; gap:4px; height:100%; min-width:0 }
.ybar-col { flex:1; width:100%; max-width:46px; display:flex; flex-direction:column; justify-content:flex-end }
.ybar-col i { display:block; width:100% } .ybar-col i.top { border-radius:6px 6px 0 0; background:var(--brand) } .ybar-col i.base { background:color-mix(in srgb, var(--brand) 35%, var(--surface-2)) }
.ybar span { font-size:11px; color:var(--muted); height:14px }
.ylegend { display:flex; gap:16px; font-size:12.5px; color:var(--muted) } .ylegend i { display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:6px; vertical-align:-1px }
.ylegend i.top { background:var(--brand) } .ylegend i.base { background:color-mix(in srgb, var(--brand) 35%, var(--surface-2)) }
@media (max-width: 700px) { .calc-result b { font-size:28px } .ybars { height:130px; gap:2px } }
.ext-badge { margin-top:4px; font-size:11.5px; font-weight:650; white-space:nowrap; text-align:right }
.ext-badge.up { color:var(--ok) } .ext-badge.down { color:var(--err) }
@media (max-width: 700px) {
  table.cardable td::before { flex-shrink:0 }
  table.cardable td:has(.ext-badge) { flex-wrap:wrap }
  table.cardable td .ext-badge { flex-basis:100%; margin-top:0 }
}

/* ---------- household: emergency fund, shared expenses, tax notices ---------- */
.ef-row { padding:6px 0 4px } .ef-row + .ef-row { border-top:1px solid var(--line); padding-top:10px }
.ef-top { display:flex; justify-content:space-between; gap:10px; flex-wrap:wrap; font-size:14px; margin-bottom:8px }
.ef-row .note { margin:6px 0 0 }
.card details > summary { cursor:pointer; color:var(--brand); font-weight:600; margin-top:12px }
.card details[open] > summary { margin-bottom:12px }
.owe { display:flex; flex-direction:column; align-items:flex-start; gap:8px; padding:4px 0 }
.owe + .owe { border-top:1px solid var(--line); padding-top:12px; margin-top:8px }
.owe-line { display:flex; align-items:center; flex-wrap:wrap; gap:8px; font-size:18px }
.owe-line b { font-size:28px; letter-spacing:-.02em; margin-left:6px }
.owe-arrow { color:var(--muted) }
.sh-list { display:flex; flex-direction:column }
.sh-item { display:grid; grid-template-columns:52px minmax(0,1fr) auto auto; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--line) }
.sh-item:last-child { border:0 }
.sh-item.settle .sh-name { color:var(--muted) }
.sh-date { color:var(--muted); font-size:13px; font-variant-numeric:tabular-nums }
.sh-name { min-width:0; display:flex; flex-direction:column; overflow:hidden }
.sh-name small { font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.sh-form .seg { width:100% } .sh-form .seg button { flex:1 }
label.chk { display:inline-flex; align-items:center; gap:6px; font-size:14px; margin:0; color:var(--ink) }
label.chk input { width:auto }
.muted.small, span.small { font-size:12px }

/* ---------- chat «Ρώτα με» ---------- */
.chat-fab { position:fixed; right:18px; bottom:calc(18px + env(safe-area-inset-bottom)); z-index:60; width:56px; height:56px; border-radius:50%; padding:0; font-size:24px;
  background:linear-gradient(135deg,var(--brand),var(--brand-2)); color:#fff; border:0; box-shadow:0 10px 28px rgba(0,0,0,.28) }
.chat-panel { position:fixed; right:18px; bottom:18px; z-index:70; width:min(400px, calc(100vw - 36px)); height:min(620px, calc(100dvh - 36px)); display:flex; flex-direction:column;
  background:var(--surface); border:1px solid var(--line); border-radius:20px; box-shadow:0 20px 60px rgba(0,0,0,.35); overflow:hidden }
.chat-head { display:flex; align-items:center; gap:8px; padding:12px 12px 12px 16px; border-bottom:1px solid var(--line) }
.chat-head .muted { font-size:12px; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.chat-msgs { flex:1; overflow-y:auto; padding:14px; display:flex; flex-direction:column; gap:10px; overscroll-behavior:contain }
.chat-hello { color:var(--muted); font-size:14px }
.msg { max-width:88%; padding:10px 13px; border-radius:16px; font-size:14.5px; line-height:1.45; overflow-wrap:anywhere }
.msg.me { align-self:flex-end; background:var(--brand); color:#fff; border-bottom-right-radius:5px }
.msg.bot { align-self:flex-start; background:var(--surface-2); border:1px solid var(--line); border-bottom-left-radius:5px }
.msg .linkbtn { display:block; margin-top:8px; padding:0; font-size:13.5px }
.msg small { display:block; margin-top:4px; font-size:11px }
.msg.typing { display:flex; gap:4px } .msg.typing i { width:7px; height:7px; border-radius:50%; background:var(--muted); animation:chatdot 1s infinite }
.msg.typing i:nth-child(2) { animation-delay:.15s } .msg.typing i:nth-child(3) { animation-delay:.3s }
@keyframes chatdot { 0%,100% { opacity:.3 } 50% { opacity:1 } }
.chat-sugg { display:flex; flex-direction:column; gap:8px }
.chat-sugg button { text-align:left; background:var(--surface-2); color:var(--ink); border:1px solid var(--line); border-radius:12px; padding:9px 12px; font-size:14px; font-weight:500 }
.chat-form { display:flex; gap:8px; padding:10px 12px calc(10px + env(safe-area-inset-bottom)); border-top:1px solid var(--line) }
.chat-form input { flex:1; min-width:0; font-size:16px }
.chat-form button { width:44px; padding:0; border-radius:12px }
@media (max-width:640px) {
  .chat-panel { right:0; left:0; bottom:0; width:100%; height:min(82dvh, 100dvh); border-radius:20px 20px 0 0; border-bottom:0 }
  .chat-fab { right:14px; bottom:calc(14px + env(safe-area-inset-bottom)) }
}

/* chat v2: app logo instead of emoji, answers as cards */
.chat-fab { width:58px; height:58px; border-radius:18px; background:none; padding:0; overflow:hidden; box-shadow:0 10px 28px rgba(0,0,0,.32), 0 0 0 1px rgba(255,255,255,.08) }
.chat-fab img { width:100%; height:100%; display:block }
.chat-logo { width:26px; height:26px; border-radius:8px; flex:none }
.chat-head b { white-space:nowrap }
.chat-form button svg { width:20px; height:20px }
.msg.card-ans { width:88%; padding:12px 14px }
.ans-title { font-size:12.5px; font-weight:650; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; margin-bottom:6px }
.ans-big { display:flex; flex-direction:column; gap:3px; padding:2px 0 10px }
.ans-big > b { font-size:26px; line-height:1.15; letter-spacing:-.02em; font-weight:700 }
.ans-big .muted { font-size:13px }
.ans-flow { display:flex; align-items:center; gap:6px; font-size:13px }
.ans-row { padding:9px 0; border-top:1px solid var(--line) }
.ans-row-top { display:flex; justify-content:space-between; align-items:baseline; gap:10px }
.ans-row-top b { font-size:16px; white-space:nowrap }
.ans-row small { display:block; margin-top:3px; color:var(--muted); font-size:12.5px; line-height:1.4 }
.ans-name { font-weight:600; font-size:13.5px }
.ans-items { border-top:1px solid var(--line); padding-top:4px }
.ans-item { display:grid; grid-template-columns:44px minmax(0,1fr) auto; gap:8px; padding:6px 0; font-size:14px; align-items:baseline }
.ans-item .d { color:var(--muted); font-size:12.5px; font-variant-numeric:tabular-nums }
.ans-item .l { overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.ans-note { margin:8px 0 0; color:var(--muted); font-size:12.5px; line-height:1.45 }
.msg .chat-sugg { margin-top:8px }
.msg .pos { color:var(--ok) } .msg .neg { color:var(--err) }

/* chat v3: smaller button, centred send arrow, growing text box, header icon buttons */
.chat-fab { width:46px; height:46px; border-radius:14px }
.chat-head .chat-iconbtn { width:32px; height:32px; padding:0; display:inline-flex; align-items:center; justify-content:center; flex:none }
.chat-head .chat-iconbtn svg { width:17px; height:17px }
.chat-form { align-items:flex-end }
.chat-form textarea { flex:1; min-width:0; font-size:16px; line-height:1.4; resize:none; overflow-y:auto; min-height:44px; max-height:130px; padding:11px 12px; font-family:inherit }
.chat-form button { width:44px; height:44px; flex:none; display:inline-flex; align-items:center; justify-content:center; padding:0 }
.chat-form button svg { width:20px; height:20px; display:block; margin:0 }
@media (max-width:640px) { .chat-fab { right:12px; bottom:calc(12px + env(safe-area-inset-bottom)) } }

/* ---------- sidebar open / close ---------- */
.menu-btn { display:grid }
.side-head { display:flex; align-items:center; justify-content:space-between; gap:8px }
.side-close { width:34px; height:34px; flex:none }
.scrim { display:none }
body.side-collapsed .app { grid-template-columns:minmax(0,1fr) }
body.side-collapsed .side { display:none }
body.side-collapsed .topbar-mark { display:inline-flex }
@media (max-width: 900px) {
  body.side-collapsed .side { display:flex }
  body.menu-open::after { content:none }
  body.menu-open .scrim { display:block; position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:15 }
  .side { z-index:20 }
}

/* ---------- home: feature tiles ---------- */
.home-group { margin-bottom:22px }
.home-label { font-size:12px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); font-weight:650; margin:0 0 10px 2px }
.ftiles { display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:14px }
.ftile { display:flex; flex-direction:column; gap:4px; padding:16px 16px 15px; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); color:inherit; text-decoration:none; min-width:0; transition:transform .12s, border-color .12s }
.ftile:hover { transform:translateY(-2px); border-color:color-mix(in srgb, var(--brand) 45%, var(--line)) }
.ftile:active { transform:scale(.985) }
.ftop { display:flex; align-items:center; gap:10px; margin-bottom:6px; min-width:0 }
.ficon { width:34px; height:34px; border-radius:10px; display:grid; place-items:center; background:var(--brand-soft); color:var(--brand); flex:none }
.ficon svg { width:18px; height:18px }
.flabel { font-weight:600; font-size:14.5px; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.fgo { color:var(--muted); display:grid } .fgo svg { width:16px; height:16px }
.fval { font-size:22px; font-weight:700; letter-spacing:-.02em; line-height:1.2; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.fsub { color:var(--muted); font-size:13px; line-height:1.4; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden }
@media (max-width: 640px) {
  .ftiles { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px }
  .ftile { padding:13px 12px }
  .fval { font-size:18px }
  .flabel { font-size:13.5px } .ficon { width:30px; height:30px }
  .fgo { display:none }
}

/* people of the public edition (ids p1, p2) use the same two colours */
.who.p1 { --pc:var(--nick) } .who.p2 { --pc:var(--stam) }
th.p1 { color:var(--nick) } th.p2 { color:var(--stam) }
.bar.p1 i { background:var(--nick) } .bar.p2 i { background:var(--stam) }
.people-filter button[data-id="p1"].on { background:var(--nick) } .people-filter button[data-id="p2"].on { background:var(--stam) }

/* ---------- public edition: welcome / unlock screens, password dialog ---------- */
body.locked .side, body.locked .topbar, body.locked #chat { display:none }
body.locked .app { grid-template-columns:minmax(0,1fr) }
.vault-screen { min-height:100dvh; display:grid; place-items:center; padding:24px 16px }
.vault-card { width:min(460px,100%); background:var(--surface); border:1px solid var(--line); border-radius:20px; box-shadow:var(--shadow); padding:26px 24px }
.vault-card h1 { font-size:24px; margin:10px 0 6px } .vault-card h2 { font-size:19px; margin:0 0 8px }
.vault-logo { width:52px; height:52px; border-radius:15px; display:block }
.vault-promise { margin:14px 0 16px }
.vault-form { display:flex; flex-direction:column; gap:12px }
.vault-form > label:not(.chk) { display:flex; flex-direction:column; gap:6px; font-weight:550; font-size:14px }
.vault-form .hint { margin:0 } .vault-form button { width:100% }
.err-line { color:var(--err); font-size:14px; min-height:1em; margin:0 }
.vault-strength { font-weight:400 }
.vault-forgot { margin-top:16px } .vault-forgot summary { cursor:pointer; color:var(--brand); font-weight:600 }
.vault-forgot .actions button { flex:1 }
.vault-dialog { position:fixed; inset:0; z-index:100; display:grid; place-items:center; padding:16px; background:rgba(8,12,24,.6); backdrop-filter:blur(3px) }
.vault-dialog .actions { display:flex; gap:8px } .vault-dialog .actions button { flex:1 }
.backup-hint { margin:0 0 16px }
.vault-form > label:not(.chk) { display:block } .vault-form > label:not(.chk) > input { margin-top:6px; width:100% } .vault-form > label small { display:block; margin-top:4px }
