:root {
  color-scheme: light;
  --ink: #1d302b;
  --muted: #718078;
  --paper: #f5f7f3;
  --white: #fff;
  --line: #e3e9e3;
  --green: #176b51;
  --green-dark: #12543f;
  --green-light: #e5f3ec;
  --gold: #a66b18;
  --gold-light: #fff3df;
  --red: #b44b43;
  --shadow: 0 10px 28px rgba(24, 51, 39, .055);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 1500px; margin: 0 auto; padding: 22px 32px 28px; }
.topbar { display:flex; align-items:center; justify-content:space-between; gap:20px; padding: 7px 0 25px; }
.brand { display:flex; align-items:center; gap:12px; }
.brand img { display:block; }
.eyebrow { margin:0 0 2px; color:var(--green); font-size:10px; font-weight:800; letter-spacing:.13em; }
h1 { margin:0; font-size:24px; line-height:1.15; letter-spacing:-.045em; }
h2,h3,p { margin-top:0; }
h2 { margin-bottom:5px; font-size:17px; letter-spacing:-.02em; }
h3 { margin:0; font-size:15px; letter-spacing:-.02em; }
.local-badge { display:flex; align-items:center; gap:8px; border:1px solid #d9e9de; border-radius:999px; padding:8px 12px; background:var(--green-light); color:var(--green); font-size:11px; font-weight:700; white-space:nowrap; }
.status-dot { width:7px; height:7px; border-radius:50%; background:#2a966f; box-shadow:0 0 0 3px rgba(42,150,111,.12); }
.intro-row { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; padding:10px 2px 20px; }
.intro-row h2 { margin:0 0 4px; font-size:20px; }
.intro-row p { margin:0; color:var(--muted); }
.intro-note { max-width:250px; color:var(--muted); font-size:11px; text-align:right; }
.tab-nav { display:flex; gap:6px; margin:0 0 14px; padding:4px; border:1px solid var(--line); border-radius:11px; background:#eef2ed; }
.tab-button { min-height:37px; padding:8px 14px; border:0; border-radius:8px; background:transparent; color:var(--muted); font-size:11px; font-weight:750; }
.tab-button.active { background:#fff; color:var(--green); box-shadow:0 2px 7px rgba(24,51,39,.08); }
.tab-button:focus-visible { outline:3px solid rgba(23,107,81,.25); outline-offset:2px; }
.tab-panel[hidden] { display:none; }
.panel { border:1px solid var(--line); border-radius:15px; background:var(--white); box-shadow:var(--shadow); }
.import-panel { padding:18px 20px 15px; }
.panel-heading { display:flex; align-items:center; gap:11px; }
.panel-heading p,.section-title p,.panel-title-row p { margin:2px 0 0; color:var(--muted); font-size:11px; }
.step-icon { display:flex; align-items:center; justify-content:center; width:30px; height:30px; flex:0 0 30px; border-radius:10px; background:var(--green-light); color:var(--green); font-size:12px; font-weight:800; }
.step-icon-small { width:27px; height:27px; flex-basis:27px; }
.import-controls { display:grid; grid-template-columns:minmax(280px,1.4fr) minmax(170px,.7fr) auto auto; align-items:end; gap:10px; margin-top:15px; }
.file-drop { display:flex; align-items:center; gap:11px; min-height:47px; padding:7px 10px; border:1px dashed #bfd2c5; border-radius:10px; background:#fbfdfb; cursor:pointer; }
.file-drop:hover { border-color:var(--green); background:#f7fbf8; }
.upload-icon { display:flex; align-items:center; justify-content:center; width:30px; height:30px; border-radius:8px; background:var(--green-light); color:var(--green); font-size:20px; font-weight:600; }
.file-drop strong,.file-drop small { display:block; }
.file-drop strong { font-size:12px; }
.file-drop small { max-width:350px; overflow:hidden; color:var(--muted); font-size:10px; text-overflow:ellipsis; white-space:nowrap; }
.file-drop input { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
.fx-field>span:first-child { display:block; margin:0 0 5px 2px; color:var(--muted); font-size:10px; font-weight:700; }
.fx-input-wrap { display:flex; align-items:center; gap:8px; height:47px; padding:0 10px; border:1px solid var(--line); border-radius:10px; color:var(--muted); font-size:11px; }
.fx-input-wrap input { width:100%; min-width:0; padding:7px 0; border:0; outline:0; color:var(--ink); }
.button { display:inline-flex; align-items:center; justify-content:center; min-height:40px; padding:9px 13px; border:1px solid transparent; border-radius:9px; font-size:11px; font-weight:750; white-space:nowrap; transition:background .15s, transform .15s; }
.button:active { transform:translateY(1px); }
.button-primary { background:var(--green); color:#fff; }
.button-primary:hover { background:var(--green-dark); }
.button-quiet { border-color:var(--line); background:#f5f7f4; color:#41564c; }
.button-quiet:hover { background:#edf2ed; }
.button-small { min-height:34px; padding:7px 10px; font-size:10px; }
.status-message { min-height:17px; margin-top:9px; color:var(--green); font-size:11px; font-weight:650; }
.status-message.error { color:var(--red); }
.import-help { padding-top:8px; border-top:1px solid #eef1ed; color:var(--muted); font-size:10px; }
.manual-panel { margin-top:11px; padding:16px 20px; }
.manual-form { display:grid; grid-template-columns:125px 145px 145px minmax(190px,1.4fr) minmax(155px,1fr) minmax(160px,1fr) 140px auto; align-items:end; gap:9px; margin-top:13px; }
.manual-field>span { display:block; margin:0 0 5px 2px; color:var(--muted); font-size:10px; font-weight:700; }
.manual-field input,.manual-field select { width:100%; height:39px; padding:8px 9px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--ink); font-size:10px; }
.manual-submit { min-height:39px; }
.owner-summary { display:flex; align-items:center; justify-content:space-between; gap:20px; margin:0 0 13px; padding:13px 16px; border:1px solid var(--line); border-radius:12px; background:#fff; box-shadow:var(--shadow); }
.owner-summary h3 { margin:0; font-size:12px; }
.owner-summary p { margin:3px 0 0; color:var(--muted); font-size:10px; }
.owner-total-grid { display:flex; gap:9px; }
.owner-total { display:flex; align-items:center; justify-content:space-between; gap:20px; min-width:175px; padding:8px 11px; border-radius:9px; background:#f5f8f5; }
.owner-total span { color:var(--muted); font-size:10px; font-weight:650; }
.owner-total strong { color:var(--ink); font-size:15px; font-variant-numeric:tabular-nums; }
.settlement-panel { margin-bottom:13px; padding:14px 16px 10px; border:1px solid var(--line); border-radius:12px; background:#fff; box-shadow:var(--shadow); }
.settlement-heading { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:11px; }
.settlement-heading h3 { margin:0; font-size:13px; }
.settlement-heading p { margin:3px 0 0; color:var(--muted); font-size:10px; }
.share-controls { display:flex; align-items:center; gap:8px; }
.share-controls label { display:flex; align-items:center; gap:6px; color:var(--muted); font-size:10px; font-weight:700; white-space:nowrap; }
.share-controls label span { display:flex; align-items:center; gap:3px; color:var(--ink); }
.share-controls input { width:54px; padding:5px 4px; border:1px solid var(--line); border-radius:6px; text-align:right; font-size:11px; }
.settlement-table-frame { overflow:auto; border:1px solid var(--line); border-radius:8px; }
.settlement-table { min-width:600px; }
.settlement-table th { position:static; background:#f6f8f5; }
.settlement-table td,.settlement-table tbody th,.settlement-table tfoot th { padding:8px; border-top:1px solid #edf0ec; font-size:11px; }
.settlement-table td { text-align:right; font-variant-numeric:tabular-nums; }
.settlement-table tbody th,.settlement-table tfoot th { text-align:left; }
.settlement-table tfoot th,.settlement-table tfoot td { background:#f6f8f5; font-weight:800; }
.settlement-note { margin:8px 0 0; color:var(--muted); font-size:9px; }
.budget-editor-panel { padding:16px; }
.budget-editor-heading { align-items:flex-start; }
.budget-editor-heading>div>p { margin:3px 0 0; color:var(--muted); font-size:10px; }
.budget-grid-frame { max-height:72vh; overflow:auto; border:1px solid var(--line); border-radius:9px; }
.budget-grid { width:max-content; min-width:100%; border-collapse:separate; border-spacing:0; }
.budget-grid th { position:sticky; top:0; z-index:2; min-width:96px; padding:9px 7px; border-bottom:1px solid var(--line); background:#f6f8f5; text-align:center; white-space:nowrap; }
.budget-grid th:first-child { left:0; z-index:4; min-width:230px; text-align:left; }
.budget-grid tbody th { position:sticky; left:0; z-index:1; padding:7px 9px; border-right:1px solid var(--line); border-bottom:1px solid #edf0ec; background:#fff; font-size:10px; letter-spacing:0; text-transform:none; }
.budget-grid td { min-width:96px; padding:4px; border-bottom:1px solid #edf0ec; border-left:1px solid #f0f2ef; }
.budget-cell { width:100%; min-width:85px; padding:7px 6px; border:1px solid transparent; border-radius:6px; background:transparent; color:var(--ink); text-align:right; font-size:10px; font-variant-numeric:tabular-nums; }
.budget-cell:hover { border-color:#d8e4da; background:#fbfdfb; }
.budget-cell:focus { border-color:#8ebca0; outline:2px solid rgba(23,107,81,.14); background:#fff; }
.budget-annual-total { min-width:120px; color:var(--ink); text-align:right; font-weight:750; font-variant-numeric:tabular-nums; white-space:nowrap; }
.budget-grid tfoot th,.budget-grid tfoot td { position:sticky; bottom:0; z-index:2; padding:9px 7px; border-top:1px solid var(--line); background:#f6f8f5; font-size:10px; font-weight:800; white-space:nowrap; }
.budget-grid tfoot th { left:0; z-index:3; text-align:left; }
.budget-grid tfoot td { text-align:right; font-variant-numeric:tabular-nums; }
.budget-editor-note { margin:9px 0 0; color:var(--muted); font-size:10px; }
.story-page { display:grid; gap:13px; }
.story-header { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; padding:19px 20px; border:1px solid var(--line); border-radius:14px; background:#fff; box-shadow:var(--shadow); }
.story-header h2 { margin:0 0 8px; font-size:20px; }
.story-header .eyebrow { margin-bottom:5px; }
.story-header p { margin:0; color:var(--muted); font-size:11px; }
.story-header #storyHeadline { margin:6px 0 4px; color:var(--ink); font-size:15px; font-weight:800; }
.story-month-badge { padding:7px 10px; border:1px solid #d9e9de; border-radius:999px; background:var(--green-light); color:var(--green); font-size:10px; font-weight:750; white-space:nowrap; }
.story-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:11px; }
.story-metric { min-height:94px; padding:14px 16px; border:1px solid var(--line); border-radius:12px; background:#fff; box-shadow:var(--shadow); }
.story-metric>span { display:block; color:var(--muted); font-size:10px; font-weight:700; }
.story-metric strong { display:block; margin-top:8px; color:var(--ink); font-size:20px; font-variant-numeric:tabular-nums; }
.story-progress { height:8px; margin-top:10px; overflow:hidden; border-radius:99px; background:#edf1ed; }
.story-progress>div { width:0; height:100%; border-radius:99px; background:var(--green); transition:width .2s; }
.story-progress>div.over { background:var(--red); }
.story-content-grid { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(280px,.75fr); gap:13px; align-items:start; }
.story-chart-panel,.story-insight-panel { padding:17px; }
.story-chart-panel h3,.story-insight-panel h3 { margin:0; font-size:13px; }
.story-chart-panel>p,.story-insight-panel>p { margin:4px 0 12px; color:var(--muted); font-size:10px; }
.story-category-chart { display:grid; gap:13px; }
.story-category-row { display:grid; gap:5px; }
.story-category-head { display:flex; align-items:baseline; justify-content:space-between; gap:10px; font-size:10px; }
.story-category-head strong { font-size:10px; }
.story-category-head span { color:var(--muted); font-size:9px; white-space:nowrap; }
.story-category-track { height:8px; overflow:hidden; border-radius:99px; background:#edf1ed; }
.story-category-fill { height:100%; border-radius:99px; background:var(--green); }
.story-category-row.over .story-category-fill { background:var(--red); }
.story-category-row.unbudgeted .story-category-fill { background:var(--gold); }
.story-empty { padding:20px 5px; color:var(--muted); font-size:11px; }
.story-insight-panel { display:flex; flex-direction:column; align-items:flex-start; }
.story-insight-panel>p { color:var(--ink); font-size:11px; line-height:1.65; }
.story-pending-notice { width:100%; padding:9px 10px; border:1px solid #f2dfb9; border-radius:8px; background:var(--gold-light); color:#805418 !important; }
.story-insight-panel .button { margin-top:auto; }
.story-pending-notice[hidden] { display:none; }
.dashboard-section { margin-top:19px; }
.section-bar { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:11px; }
.section-title { display:flex; align-items:center; gap:10px; }
.section-title h2 { margin:0; }
.filters { display:flex; gap:8px; }
.select-control { min-height:36px; padding:7px 30px 7px 10px; border:1px solid var(--line); border-radius:9px; background:#fff; color:var(--ink); font-size:11px; }
.kpi-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:11px; margin-bottom:13px; }
.kpi-card { min-height:107px; padding:15px 16px 12px; border:1px solid var(--line); border-radius:13px; background:#fff; box-shadow:var(--shadow); }
.kpi-action { display:block; width:100%; color:var(--ink); text-align:left; cursor:pointer; transition:border-color .15s, box-shadow .15s, transform .15s; }
.kpi-action:hover,.kpi-action[aria-pressed="true"] { border-color:#9bc6ad; box-shadow:0 8px 24px rgba(23,107,81,.12); }
.kpi-action:active { transform:translateY(1px); }
.kpi-action:focus-visible { outline:3px solid rgba(23,107,81,.25); outline-offset:2px; }
.kpi-action .kpi-label,.kpi-action .kpi-value,.kpi-action .kpi-note { display:block; }
.kpi-label { color:var(--muted); font-size:10px; font-weight:700; }
.kpi-value { margin-top:8px; font-size:22px; font-weight:800; letter-spacing:-.045em; font-variant-numeric:tabular-nums; }
.kpi-note { margin-top:3px; color:var(--muted); font-size:10px; }
.content-grid { display:grid; grid-template-columns:minmax(285px,.7fr) minmax(0,1.7fr); gap:13px; align-items:start; }
.chart-panel,.review-panel { padding:16px; }
.panel-title-row { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:13px; }
.panel-title-row p { margin-top:3px; }
.panel-title-row>div>p { color:var(--muted); font-size:10px; }
.legend { display:flex; align-items:center; gap:6px; color:var(--muted); font-size:10px; white-space:nowrap; }
.legend i { width:7px; height:7px; border-radius:50%; background:var(--green); }
.chart-list { max-height:465px; overflow:auto; padding-right:4px; }
.bar-row { margin:12px 0 15px; }
.bar-head { display:flex; justify-content:space-between; gap:8px; margin-bottom:5px; }
.bar-name-button { padding:0; border:0; background:transparent; color:var(--ink); font-size:10px; font-weight:700; text-align:left; cursor:pointer; }
.bar-name-button:hover { color:var(--green); text-decoration:underline; }
.bar-name-button:focus-visible { outline:2px solid rgba(23,107,81,.35); outline-offset:2px; }
.bar-values { color:var(--muted); font-size:9px; text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
.bar-track { position:relative; height:8px; overflow:hidden; border-radius:99px; background:#edf1ed; }
.bar-fill { height:100%; border-radius:99px; background:var(--green); }
.bar-row.over .bar-fill { background:var(--red); }
.bar-row.adjustment .bar-fill { background:var(--gold); }
.bar-empty { padding:30px 5px; color:var(--muted); font-size:11px; }
.chart-footnote,.table-footnote { margin:10px 0 0; color:var(--muted); font-size:9px; }
.movement-heading { align-items:center; }
.movement-actions { display:flex; align-items:center; justify-content:flex-end; gap:6px; flex-wrap:wrap; }
.search-box { display:flex; align-items:center; gap:5px; width:155px; min-height:33px; padding:0 8px; border:1px solid var(--line); border-radius:8px; color:var(--muted); }
.search-box span { font-size:16px; }
.search-box input { width:100%; min-width:0; border:0; outline:0; font-size:10px; }
.table-frame { max-height:580px; overflow:auto; border:1px solid var(--line); border-radius:9px; }
.category-filter-notice { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:0 0 8px; padding:7px 9px; border:1px solid #d9e9de; border-radius:8px; background:var(--green-light); color:var(--green-dark); font-size:10px; font-weight:700; }
.category-filter-notice[hidden] { display:none; }
table { width:100%; min-width:850px; border-collapse:collapse; }
th { position:sticky; top:0; z-index:2; padding:9px 8px; background:#f6f8f5; color:var(--muted); text-align:left; font-size:9px; font-weight:750; letter-spacing:.045em; text-transform:uppercase; }
td { padding:7px 8px; border-top:1px solid #edf0ec; vertical-align:middle; font-size:10px; }
tr.pending { background:#fffcf5; }
.align-right { text-align:right; }
.date-cell { min-width:83px; color:var(--muted); white-space:nowrap; }
.merchant-cell { min-width:150px; max-width:210px; font-weight:700; }
.location-cell { overflow:hidden; color:var(--muted); font-size:9px; text-overflow:ellipsis; white-space:nowrap; }
.amount-cell { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
.cell-select { width:100%; min-width:135px; padding:6px 20px 6px 7px; border:1px solid #e1e8e1; border-radius:7px; background:#fff; color:var(--ink); font-size:10px; }
.owner-cell-select { min-width:95px; }
.other-detail-input { display:block; width:100%; min-width:135px; margin-top:5px; padding:6px 7px; border:1px solid #e1e8e1; border-radius:7px; background:#fff; color:var(--ink); font-size:10px; }
.scope-select { min-width:85px; }
.tag { display:inline-block; margin-top:3px; padding:2px 6px; border-radius:99px; background:var(--gold-light); color:var(--gold); font-size:8px; font-weight:800; }
.tag.ready { background:var(--green-light); color:var(--green); }
.empty-state { display:flex; min-height:180px; align-items:center; justify-content:center; flex-direction:column; gap:4px; padding:22px; color:var(--muted); text-align:center; font-size:11px; }
.empty-state img { margin-bottom:5px; opacity:.75; }
.empty-state strong { color:var(--ink); font-size:12px; }
footer { padding:20px 2px 0; color:var(--muted); font-size:9px; text-align:center; }
.visually-hidden { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
code { padding:2px 4px; border-radius:4px; background:#f0f3f0; font-size:.95em; }
@media(max-width:1050px) {
  .app-shell { padding:18px 18px 25px; }
  .content-grid { grid-template-columns:1fr; }
  .chart-list { display:grid; grid-template-columns:1fr 1fr; column-gap:18px; }
  .manual-form { grid-template-columns:repeat(4,minmax(120px,1fr)); }
  .manual-description { grid-column:span 2; }
}
@media(max-width:780px) {
  .import-controls { grid-template-columns:1fr 1fr; }
  .kpi-grid { grid-template-columns:1fr 1fr; }
  .section-bar { align-items:flex-start; flex-direction:column; }
  .filters { width:100%; }
  .filters select { flex:1; }
  .movement-heading { align-items:flex-start; flex-direction:column; }
  .movement-actions { justify-content:flex-start; width:100%; }
  .owner-summary { align-items:flex-start; flex-direction:column; }
  .owner-total-grid { width:100%; }
  .owner-total { flex:1; }
  .settlement-heading { align-items:flex-start; flex-direction:column; }
  .share-controls { flex-wrap:wrap; }
  .story-content-grid { grid-template-columns:1fr; }
}
@media(max-width:560px) {
  .app-shell { padding:14px 12px 22px; }
  .topbar { align-items:flex-start; flex-direction:column; padding-bottom:17px; }
  .intro-row { align-items:flex-start; flex-direction:column; gap:9px; }
  .intro-note { text-align:left; }
  .import-controls { grid-template-columns:1fr; }
  .import-controls>.button { width:100%; }
  .chart-list { display:block; }
  .kpi-card { min-height:98px; padding:12px; }
  .kpi-value { font-size:19px; }
  .search-box { flex:1; }
  .manual-form { grid-template-columns:1fr 1fr; }
  .manual-description { grid-column:span 2; }
  .manual-submit { grid-column:span 2; width:100%; }
  .owner-total-grid { flex-direction:column; }
  .story-header { flex-direction:column; }
  .story-metrics { grid-template-columns:1fr; }
}
