:root{
  --bg:#F6F7F5; --surface:#FFFFFF; --ink:#1C3B34; --muted:#5E6E68;
  --border:#E4E8E4; --border-soft:#EEF1EE;
  --tulip:#C8537A; --tulip-soft:#F7E7EE;
  --in:#2F7D5B; --in-soft:#E8F3ED;
  --out:#B4543A; --out-soft:#F6E9E4;
  --shadow:0 1px 2px rgba(28,59,52,.04), 0 6px 20px rgba(28,59,52,.05);
  --radius:14px;
}
*{box-sizing:border-box}
html,body{margin:0}
body{background:var(--bg); color:var(--ink); font-family:"Inter",system-ui,-apple-system,Segoe UI,Roboto,sans-serif; font-size:15px; line-height:1.5; -webkit-font-smoothing:antialiased;}
h1,h2,h3{margin:0; font-weight:600}
a{color:inherit}
[hidden]{display:none !important}
.topbar{display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px clamp(16px,4vw,40px); background:var(--surface); border-bottom:1px solid var(--border); position:sticky; top:0; z-index:20;}
.brand{display:flex; align-items:center; gap:11px}
.tulip{width:24px; height:32px; fill:none; stroke:var(--in); stroke-width:1.6; stroke-linejoin:round; stroke-linecap:round}
.tulip .petal-top{fill:var(--tulip-soft); stroke:var(--tulip)}
.tulip .petal-mid{fill:var(--in-soft)}
.brand-text{display:flex; flex-direction:column; line-height:1.1}
.brand-text strong{font-family:"Fraunces",serif; font-size:18px; font-weight:600; letter-spacing:.1px}
.brand-text span{font-size:11px; text-transform:uppercase; letter-spacing:.16em; color:var(--muted)}
.topbar-right{display:flex; align-items:center; gap:12px; flex-wrap:wrap; justify-content:flex-end}
.period{display:flex; flex-direction:column; font-size:10px; text-transform:uppercase; letter-spacing:.12em; color:var(--muted); gap:3px}
.period input{font:inherit; font-size:13px; text-transform:none; letter-spacing:0; padding:6px 8px; border:1px solid var(--border); border-radius:9px; background:var(--surface); color:var(--ink)}
.who{font-size:12px; color:var(--tulip); background:var(--tulip-soft); border:1px solid transparent; padding:5px 10px; border-radius:999px; white-space:nowrap}
.wrap{max-width:1040px; margin:0 auto; padding:clamp(16px,3vw,28px) clamp(16px,4vw,40px) 60px}
.hero{display:flex; gap:28px; flex-wrap:wrap; justify-content:space-between; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); padding:26px 28px; margin-bottom:22px;}
.hero-main{min-width:240px}
.eyebrow{margin:0 0 4px; font-size:11px; text-transform:uppercase; letter-spacing:.16em; color:var(--muted)}
.balance{font-family:"Fraunces",serif; font-weight:500; font-size:clamp(38px,7vw,56px); line-height:1; letter-spacing:-.5px; position:relative; display:inline-block;}
.balance::after{content:""; display:block; width:46px; height:3px; background:var(--tulip); border-radius:2px; margin-top:12px}
.accounts-strip{display:flex; flex-wrap:wrap; gap:8px; margin-top:18px}
.acc-chip{display:flex; flex-direction:column; gap:1px; background:var(--bg); border:1px solid var(--border); border-radius:11px; padding:8px 13px}
.acc-chip .nm{font-size:11px; color:var(--muted)}
.acc-chip .vl{font-weight:600; font-variant-numeric:tabular-nums}
.acc-chip.cash{border-left:3px solid var(--tulip)}
.acc-chip.bank{border-left:3px solid var(--in)}
.hero-flow{display:flex; flex-direction:column; gap:10px; min-width:200px; justify-content:center}
.flow{display:flex; align-items:baseline; justify-content:space-between; gap:18px; padding:9px 14px; border-radius:11px; background:var(--bg)}
.flow-label{font-size:12px; color:var(--muted)} .flow-label em{font-style:normal}
.flow-amt{font-weight:600; font-variant-numeric:tabular-nums}
.flow.in .flow-amt{color:var(--in)} .flow.in{background:var(--in-soft)}
.flow.out .flow-amt{color:var(--out)} .flow.out{background:var(--out-soft)}
.flow.net .flow-amt{color:var(--ink)}
.flow.fc{background:var(--tulip-soft)} .flow.fc .flow-amt{color:var(--tulip)}
.fc-grid{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:6px}
.fc-grid .acc-chip{flex:1;min-width:130px}
.fc-warn{background:var(--out-soft);color:var(--out);border-radius:10px;padding:10px 14px;font-size:13px;margin:8px 0 0}
.navbar{position:relative; margin-bottom:22px}
.add-cta{display:flex; justify-content:center; margin-bottom:14px}
.ac-box{position:absolute; top:100%; left:0; right:0; background:var(--surface); border:1px solid var(--border); border-radius:10px; box-shadow:var(--shadow); z-index:60; max-height:210px; overflow-y:auto; margin-top:4px}
.ac-item{padding:11px 13px; cursor:pointer; font-size:14px; border-bottom:1px solid var(--border)}
.ac-item:last-child{border-bottom:none}
.ac-item:active, .ac-item.sel{background:var(--tulip-soft)}
.ac-empty{padding:11px 13px; font-size:13px; color:var(--muted)}
.donor-summary{margin:6px 0 16px}
.ds-row{display:flex; justify-content:space-between; gap:12px; font-size:13px; color:var(--muted); margin-bottom:6px; flex-wrap:wrap}
.ds-bar{display:flex; height:9px; border-radius:6px; overflow:hidden; background:var(--bg); min-width:90px}
.ds-bar.sm{height:7px; max-width:120px}
.add-cta .btn{padding:11px 28px; font-weight:600}
.nav-toggle{display:flex; align-items:center; justify-content:space-between; gap:10px; width:100%; font:inherit; font-weight:600; color:var(--ink); background:var(--surface); border:1px solid var(--border); border-radius:11px; padding:11px 16px; cursor:pointer}
.nav-toggle .ham{font-size:18px; color:var(--muted)}
.nav-menu{display:none; flex-direction:column; gap:2px; position:absolute; top:calc(100% + 6px); left:0; right:0; background:var(--surface); border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow); padding:6px; z-index:30}
.nav-menu.open{display:flex}
.nav-item{font:inherit; font-weight:500; color:var(--muted); background:none; border:none; padding:11px 14px; cursor:pointer; text-align:left; border-radius:8px}
.nav-item:hover{color:var(--ink); background:var(--bg)}
.nav-item.is-active{color:var(--ink); background:var(--tulip-soft)}
@media(min-width:720px){
  .navbar{border-bottom:1px solid var(--border)}
  .nav-toggle{display:none}
  .nav-menu{display:flex!important; flex-direction:row; gap:4px; position:static; background:none; border:none; box-shadow:none; padding:0}
  .nav-item{border-radius:0; border-bottom:2px solid transparent; margin-bottom:-1px; padding:11px 16px}
  .nav-item:hover{background:none}
  .nav-item.is-active{background:none; border-bottom-color:var(--tulip)}
}
.tabs{display:flex; gap:4px; border-bottom:1px solid var(--border); margin-bottom:22px}
.tab{font:inherit; font-weight:500; color:var(--muted); background:none; border:none; padding:11px 16px; cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px;}
.tab:hover{color:var(--ink)}
.tab.is-active{color:var(--ink); border-bottom-color:var(--tulip)}
.panel{display:none} .panel.is-active{display:block}
.card{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); padding:20px 22px; margin-bottom:18px}
.card h2{font-family:"Fraunces",serif; font-size:19px; font-weight:600}
.card-sub{margin:3px 0 16px; color:var(--muted); font-size:13px}
.grid-2{display:grid; grid-template-columns:1fr 1fr; gap:18px}
@media(max-width:760px){.grid-2{grid-template-columns:1fr}}
.chart-box{position:relative; height:230px}
.chart-box.tall{height:280px}
.legend{display:flex; flex-wrap:wrap; gap:8px 16px; margin-top:14px}
.legend span{display:flex; align-items:center; gap:7px; font-size:12.5px; color:var(--muted)}
.legend i{width:10px; height:10px; border-radius:3px; display:inline-block}
.table-scroll{overflow-x:auto}
table.data{width:100%; border-collapse:collapse; font-size:13.5px}
table.data th{text-align:left; font-weight:500; color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.08em; padding:8px 10px; border-bottom:1px solid var(--border)}
table.data td{padding:11px 10px; border-bottom:1px solid var(--border-soft); vertical-align:top}
table.data tr:last-child td{border-bottom:none}
.num{text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap}
.amt-in{color:var(--in); font-weight:600} .amt-out{color:var(--out); font-weight:600} .amt-tr{color:var(--muted); font-weight:600}
.pill{display:inline-block; font-size:11px; padding:2px 9px; border-radius:999px; background:var(--bg); color:var(--muted); border:1px solid var(--border)}
.pill.income{background:var(--in-soft); color:var(--in); border-color:transparent}
.pill.expense{background:var(--out-soft); color:var(--out); border-color:transparent}
.pill.transfer{background:var(--tulip-soft); color:var(--tulip); border-color:transparent}
.sub{display:block; color:var(--muted); font-size:12px; margin-top:2px}
.row-edit{background:none; border:1px solid var(--border); border-radius:8px; padding:5px 10px; font:inherit; font-size:12px; cursor:pointer; color:var(--muted)}
.row-edit:hover{color:var(--ink); border-color:var(--muted)}
.empty{text-align:center; color:var(--muted); padding:30px; font-size:14px}
.toolbar{display:flex; gap:12px; justify-content:space-between; align-items:center; flex-wrap:wrap; margin-bottom:14px}
.filters{display:flex; gap:8px; flex-wrap:wrap}
.filters select,.filters input,.add-row input,.add-row select,.field input,.field select{font:inherit; padding:8px 10px; border:1px solid var(--border); border-radius:9px; background:var(--surface); color:var(--ink)}
.filters input[type=search]{min-width:170px}
.btn{font:inherit; font-weight:500; padding:9px 16px; border-radius:10px; border:1px solid var(--border); background:var(--surface); color:var(--ink); cursor:pointer; text-decoration:none; display:inline-block}
.btn:hover{border-color:var(--muted)}
.btn.primary{background:var(--ink); color:#fff; border-color:var(--ink)}
.btn.primary:hover{background:#16302a}
.btn.ghost{border-color:transparent; color:var(--out)}
.btn.ghost:hover{background:var(--out-soft)}
.editable{list-style:none; margin:0 0 14px; padding:0}
.editable li{display:flex; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--border-soft)}
.editable li .grow{flex:1}
.editable li .nm{font-weight:500}
.editable li .meta{color:var(--muted); font-size:12px}
.editable li.archived{opacity:.5}
.mini{font-size:12px; text-transform:uppercase; letter-spacing:.1em; margin-bottom:6px}
.mini.income{color:var(--in)} .mini.expense{color:var(--out)}
.add-row{display:flex; gap:8px; flex-wrap:wrap; margin-top:6px}
.add-row input{flex:1; min-width:120px}
.link-btn{background:none; border:none; color:var(--muted); cursor:pointer; font:inherit; font-size:12px; padding:4px 6px; border-radius:6px}
.link-btn:hover{color:var(--out); background:var(--out-soft)}
.modal-backdrop{position:fixed; inset:0; background:rgba(20,40,35,.42); display:flex; align-items:flex-start; justify-content:center; padding:24px; z-index:40; overflow-y:auto}
.modal{background:var(--surface); border-radius:18px; width:100%; max-width:540px; box-shadow:0 24px 60px rgba(20,40,35,.25); margin:auto}
.modal-head{display:flex; align-items:center; justify-content:space-between; padding:20px 22px 0}
.modal-head h2{font-family:"Fraunces",serif; font-size:20px}
.icon-btn{background:none; border:none; font-size:16px; cursor:pointer; color:var(--muted); padding:6px}
.seg{display:flex; gap:4px; margin:16px 22px 0; background:var(--bg); padding:4px; border-radius:11px}
.seg button{flex:1; font:inherit; font-weight:500; padding:8px; border:none; background:none; border-radius:8px; cursor:pointer; color:var(--muted)}
.seg button.is-active{background:var(--surface); color:var(--ink); box-shadow:var(--shadow)}
form#entryForm{padding:18px 22px 22px}
.field{display:flex; flex-direction:column; gap:5px; margin-bottom:13px; flex:1}
.field>span{font-size:11px; text-transform:uppercase; letter-spacing:.1em; color:var(--muted)}
.field-row{display:flex; gap:12px}
@media(max-width:520px){.field-row{flex-direction:column; gap:0}}
.form-error{color:var(--out); background:var(--out-soft); padding:9px 12px; border-radius:9px; font-size:13px; margin:4px 0 12px}
.modal-actions{display:flex; align-items:center; gap:10px; margin-top:6px}
.modal-actions .spacer{flex:1}
.toast{position:fixed; bottom:22px; left:50%; transform:translateX(-50%); background:var(--ink); color:#fff; padding:11px 18px; border-radius:11px; font-size:13.5px; box-shadow:var(--shadow); z-index:60}
.demo-banner{max-width:1040px; margin:14px auto 0; padding:0 clamp(16px,4vw,40px)}
.demo-banner div{background:var(--tulip-soft); color:#8a3358; border:1px solid #efc9d8; border-radius:11px; padding:9px 14px; font-size:13px}
:focus-visible{outline:2px solid var(--tulip); outline-offset:2px}
@media(prefers-reduced-motion:no-preference){
  .panel.is-active{animation:fade .2s ease}
  @keyframes fade{from{opacity:0; transform:translateY(4px)}to{opacity:1; transform:none}}
}
