:root {
  --bg: #f4f1ea;
  --ink: #1c1917;
  --muted: #78716c;
  --card: #fffdf8;
  --line: #e7e0d5;
  --accent: #1d4ed8;
  --ok: #166534;
  --err: #b91c1c;
  --radius: 14px;
  font-family: "Segoe UI", "PT Root UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #dde7ff 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #d7f3ea 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 85%, white);
}
.brand { font-weight: 750; text-decoration: none; color: var(--ink); font-size: 1.15rem; }
nav { display: flex; gap: .75rem; align-items: center; }
nav a { color: var(--ink); text-decoration: none; }
main { max-width: 1280px; margin: 0 auto; padding: 1.25rem; }
.year-matrix { font-size: .82rem; white-space: nowrap; }
.year-matrix th, .year-matrix td { padding: .28rem .4rem; border: 1px solid var(--line); text-align: center; }
.year-matrix .period { color: var(--muted); font-variant-numeric: tabular-nums; }
.year-matrix .amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.year-matrix .totals td { background: #f8fafc; }
.dyn-head { display: flex; justify-content: space-between; gap: 1rem; align-items: end; flex-wrap: wrap; margin-bottom: .75rem; }
.dyn-head h2 { margin: 0; }
.dyn-stats { width: 100%; font-size: .92rem; margin-bottom: .9rem; }
.dyn-stats.compact td, .dyn-stats.compact th { padding: .35rem .45rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dyn-stats th { text-align: left; color: var(--muted); font-weight: 600; }
.dyn-stats td { font-variant-numeric: tabular-nums; }
.charts-stack { display: grid; gap: .35rem; }
.charts-frame {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.charts-rail {
  flex: 0 0 48px;
  width: 48px;
  padding: .25rem 0 .45rem;
  border-right: 1px solid var(--line);
  background: #fff;
  z-index: 2;
  display: grid;
  gap: .1rem;
  align-content: start;
}
.chart-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: .25rem .5rem .45rem 0;
  background: #fff;
}
.charts-synced { display: grid; gap: .1rem; }
.chart-heading {
  position: sticky;
  left: 0;
  z-index: 2;
  width: max-content;
  margin: .4rem 0 .05rem;
  padding: .2rem .5rem .15rem .35rem;
  font-size: .95rem;
  font-weight: 650;
  white-space: nowrap;
  line-height: 1.2;
  background: #fff;
  box-shadow: 12px 0 10px -8px #fff;
}
.chart-heading-spacer {
  height: 0;
}
.y-pin {
  position: relative;
  width: 100%;
  background: #fff;
}
.y-pin-tick {
  position: absolute;
  right: 4px;
  transform: translateY(-50%);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  line-height: 1;
  white-space: nowrap;
  background: #fff;
  padding: 0 1px;
}
.chart-inner { position: relative; height: 300px; }
.dyn-points { font-size: .78rem; white-space: nowrap; margin-top: .6rem; }
.dyn-points th, .dyn-points td {
  padding: .28rem .35rem;
  border: 1px solid var(--line);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.dyn-points thead th { background: #f8fafc; font-weight: 600; }
.dyn-points tbody th { text-align: left; background: #f8fafc; position: sticky; left: 0; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.narrow { max-width: 420px; margin: 3rem auto; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.muted { color: var(--muted); font-size: .9rem; }
.big { font-size: 1.6rem; font-weight: 700; margin-top: .2rem; }
.big.small { font-size: 1.1rem; }
.stack { display: grid; gap: .75rem; }
label { display: grid; gap: .35rem; font-size: .92rem; }
input, select, textarea, button {
  font: inherit;
  padding: .55rem .7rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: white;
}
button, .button {
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
button:disabled { opacity: .5; cursor: not-allowed; }
.button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.inline { display: inline; margin: 0; }
.inline button { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .45rem .35rem; border-bottom: 1px solid var(--line); }
.error { color: var(--err); }
.ok { color: var(--ok); }
h1, h2 { margin: 0 0 .8rem; }
