:root {
  color-scheme: dark;
  --base: #32111f;
  --wine: #873b59;
  --burgundy: #571c34;
  --ink: #eddee2;
  --muted: #c8aeb7;
  --line: #80516577;
  --gold: #f2ce70;
  --rose: #e39fbd;
  --clay: #d8ae94;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #29101a;
  color: var(--ink);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at top, #491b30, var(--base) 42rem, #29101a); min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; color: inherit; border: 1px solid var(--line); background: #422030; border-radius: .7rem; min-height: 44px; padding: .58rem .85rem; transition: background .16s, border-color .16s; }
button:hover { background-color: #69344b; border-color: #a77a87; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; }
svg { width: 1.2rem; height: 1.2rem; flex: none; vertical-align: middle; }
.shell { width: min(100% - 2rem, 74rem); margin-inline: auto; }
header { border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); background: #30111fe8; }
.brand { display: flex; align-items: center; gap: .7rem; min-height: 64px; font-family: Georgia, serif; font-size: 1.6rem; letter-spacing: .015em; }
.brand img { width: 38px; height: 38px; border-radius: 10px; border: 1px solid #b0a1a56b; }
main { padding-block: 1.75rem calc(6.5rem + env(safe-area-inset-bottom)); }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: Georgia, serif; font-weight: 500; }
h1 { font-size: clamp(1.6rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.65rem); }
small, .subtle { color: var(--muted); }
.hero { padding: clamp(1rem,3vw,2rem); border-radius: 1.35rem; background: linear-gradient(116deg, #571c34, #3c1929 68%); border: 1px solid #9c63797d; box-shadow: 0 15px 45px #1e0b1555; }
.hero-top, .section-title, .month-heading, .record-head { display: flex; justify-content: space-between; align-items: center; gap: .65rem; }
.section-title { margin: 1.5rem 0 .9rem; flex-wrap: wrap; }
main > .section-title:first-child { margin-top: 0; }
.arrows { display: flex; gap: .25rem; align-items: center; flex: none; }
.arrows button { padding: 0 .35rem; min-width: 44px; }
.arrows .year { background: transparent; border-color: transparent; font-variant-numeric: tabular-nums; }
.amount { min-width: 0; display: grid; align-content: start; gap: .35rem; }
.amount > span { color: var(--muted); font-size: .875rem; }
.amount strong, .record-money { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hero-number { margin: 1.4rem 0; }
.hero-number strong { font-family: Georgia, serif; font-weight: 500; font-size: clamp(2.3rem, 7vw, 4.5rem); line-height: 1.04; }
.hero-totals, .month-summary { display: grid; gap: .8rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.hero-totals { grid-template-columns: repeat(2,minmax(0,1fr)); }
.hero-totals strong { font-size: clamp(1rem, 2.4vw, 1.45rem); }
.month-summary { grid-template-columns: repeat(3,minmax(0,1fr)); border: 0; margin: .5rem 0 1rem; }
.panel { border: 1px solid var(--line); background: linear-gradient(145deg,#472031,#381726); border-radius: 1rem; }
.analytics-kpis, .records { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .9rem; }
.year-overview .hero-number { margin: .8rem 0 .65rem; }
.year-expected { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; margin-bottom: .85rem; }
.year-overview .hero-totals { grid-template-columns: minmax(0,1fr); gap: .45rem; padding-top: .65rem; }
.year-overview .hero-totals .amount { grid-template-columns: minmax(0,1fr) minmax(0,auto); align-items: baseline; }
.year-overview .hero-totals strong { text-align: right; }
.months-title { margin: .75rem 0 .5rem; }
.months-title + .legend { margin-bottom: .5rem; }
.months { display: grid; gap: .4rem; }
.month-card { text-align: left; display: grid; padding: .36rem .65rem; gap: .2rem; min-width: 0; }
.month-card:hover { background: #512639; }
.month-card.current { border-color: #e39fbd; }
.month-heading { gap: .3rem; }
.month-heading strong { font-size: .88rem; flex: none; }
.month-figures { min-width: 0; display: flex; align-items: center; gap: .2rem; }
.month-figures svg { width: .8rem; height: .8rem; color: var(--muted); }
.month-values { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .1rem .45rem; min-width: 0; }
.month-values > span { min-width: 0; text-align: right; overflow-wrap: anywhere; font-size: .78rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.month-card .bar { height: .2rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.bar { height: .43rem; border-radius: 999px; display: flex; overflow: hidden; background: #29131e; }
.bar i { height: 100%; }
.s0 { background: var(--gold); }
.s1 { background: var(--rose); }
.s2 { background: var(--clay); }
.text-s0 { color: var(--gold); }
.text-s1 { color: var(--rose); }
.text-s2 { color: var(--clay); }
.dot { width: .47rem; height: .47rem; border-radius: 50%; display: inline-block; margin-right: .35rem; vertical-align: .07em; }
.legend { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; margin-bottom: .75rem; color: var(--muted); font-size: .8rem; }
.primary { background: var(--wine); border-color: #b47a90; font-weight: 650; }
.primary svg { margin-right: .35rem; }
.secondary { background: #3b1928; }
.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.back { margin-bottom: .55rem; padding-left: 0; }
.records { grid-template-columns: repeat(2,minmax(0,1fr)); }
.record { padding: 1rem; min-width: 0; display: grid; gap: .5rem; }
.record-head { align-items: flex-start; flex-wrap: wrap; overflow-wrap: anywhere; }
.record h3 { font-size: 1rem; margin-bottom: .3rem; }
.record-money { font-size: 1.25rem; }
.record p, .report p, dialog p { line-height: 1.5; overflow-wrap: anywhere; }
.note { white-space: pre-wrap; }
.status { color: var(--muted); font-size: .8rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.record .actions { gap: .15rem; align-self: end; }
.record .quiet { padding-inline: .35rem; }
.empty { grid-column: 1/-1; padding: 1.5rem; color: var(--muted); }
.filters, .field-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; margin-bottom: .85rem; }
label { display: block; min-width: 0; font-size: .88rem; }
input:not([type="file"]), select, textarea { display: block; width: 100%; min-width: 0; min-height: 44px; margin-top: .35rem; color: var(--ink); background: #301522; border: 1px solid #9a6c7e; border-radius: .55rem; padding: .5rem; font-size: 16px; }
textarea { min-height: 4.3rem; resize: vertical; }
.analytics-kpis .panel, .report { padding: 1rem; }
.report { margin-top: 1rem; }
.report h2 { margin-bottom: .65rem; }
.report p { margin-bottom: .75rem; color: var(--muted); }
.chart-row { display: grid; grid-template-columns: 5.5rem minmax(0,1fr); align-items: start; gap: .55rem; padding: .42rem 0; font-size: .88rem; }
.chart-value small, .project-values { display: flex; flex-wrap: wrap; gap: .2rem .75rem; margin-top: .25rem; }
.chart-row .bar { margin-top: .3rem; }
.project-row { border-top: 1px solid var(--line); padding: .75rem 0; overflow-wrap: anywhere; }
.project-row .bar { margin-top: .45rem; }
.project-values { font-size: .82rem; }
nav { position: fixed; inset: auto 0 0; z-index: 2; background: #2b101ced; backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: .35rem env(safe-area-inset-right) calc(.35rem + env(safe-area-inset-bottom)) env(safe-area-inset-left); }
.nav { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); width: min(100%,42rem); }
.nav button { background: transparent; border-color: transparent; display: grid; justify-items: center; align-content: center; gap: .25rem; color: var(--muted); font-size: clamp(.62rem,2.8vw,.82rem); min-height: 53px; padding: .25rem .05rem; }
.nav button[aria-current] { color: var(--rose); background: #571c3466; }
.nav button[data-action="plus"] svg { background: var(--wine); border-radius: .48rem; width: 1.5rem; height: 1.5rem; padding: .12rem; color: var(--ink); }
dialog { width: min(calc(100% - 1rem),30rem); max-height: min(calc(100% - 1rem),calc(100dvh - 1rem)); padding: 1rem; color: var(--ink); border: 1px solid #a77a87; background: #462031; border-radius: 1rem; overscroll-behavior: contain; }
dialog::backdrop { background: #180811bd; }
dialog h2 { margin-bottom: .85rem; }
dialog label, dialog p { margin-bottom: .7rem; }
dialog .field-pair { margin-bottom: 0; }
.form-actions { justify-content: flex-end; }
.form-error, .warning { color: #ffbbcd; }
.warning { margin-bottom: 1rem; line-height: 1.5; }
#message:not(:empty) { position: fixed; z-index: 3; bottom: calc(4.7rem + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 2rem); background: var(--burgundy); border: 1px solid var(--rose); border-radius: .75rem; padding: .7rem 1rem; box-shadow: 0 8px 26px #170711a0; }
@media (min-width: 801px) {
  .months { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 540px) {
  .shell:not(.nav) { width: calc(100% - 1.25rem - env(safe-area-inset-left) - env(safe-area-inset-right)); }
  main { padding-top: .9rem; }
  .analytics-kpis, .records { grid-template-columns: minmax(0,1fr); }
  .hero-top { flex-wrap: wrap; }
  .month-summary .amount > span, .hero-totals .amount > span { font-size: .78rem; }
  .chart-row { grid-template-columns: 4.75rem minmax(0,1fr); }
  .section-title .primary { font-size: .86rem; max-width: 100%; overflow-wrap: anywhere; }
  .year-overview .hero-top { gap: .25rem; }
  .year-overview .arrows { gap: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
