/* ─────────────────────────────────────────────────────────────
   Plán faktúr — a private pay ledger.
   Warm paper, iron-gall ink, one banknote green for money.
   ───────────────────────────────────────────────────────────── */

:root {
  --paper: #f3eee4;
  --paper-raised: #fbf8f2;
  --paper-sunk: #e9e2d4;
  --ink: #1d1b17;
  --ink-2: #57524a;
  --ink-3: #8a8378;
  --rule: #d6cdbb;
  --rule-strong: #b9ae98;
  --money: #1d5b48;          /* bars, primary actions */
  --money-soft: #d7e4dc;
  --money-ink: #17493a;
  --fixed: #a8611d;          /* months with a pinned amount */
  --fixed-soft: #f1e0cc;
  --danger: #a33a2c;
  --danger-soft: #f4dcd6;
  --focus: #1d5b48;
  --shadow: 0 1px 0 rgba(60, 45, 20, .06), 0 12px 32px -18px rgba(60, 45, 20, .35);
  --grain-opacity: .35;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Hanken Grotesk", "Segoe UI", sans-serif;
  --radius: 10px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171512;
    --paper-raised: #201d19;
    --paper-sunk: #110f0d;
    --ink: #eee7da;
    --ink-2: #b5ac9d;
    --ink-3: #847c70;
    --rule: #34302a;
    --rule-strong: #4a443b;
    --money: #6fb89a;
    --money-soft: #1f3a30;
    --money-ink: #9fd6bd;
    --fixed: #e0a263;
    --fixed-soft: #3b2a19;
    --danger: #ec8a7a;
    --danger-soft: #3d1f1a;
    --focus: #6fb89a;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 16px 36px -20px rgba(0, 0, 0, .8);
    --grain-opacity: .18;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Paper grain — an SVG noise tile, fixed so it doesn't scroll like wallpaper. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--grain-opacity);
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .22 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { body::before { mix-blend-mode: screen; } }

body > * { position: relative; z-index: 1; }

a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; line-height: 1.1; margin: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Masthead ─────────────────────────────────────────────── */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--gutter);
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  white-space: nowrap;
}
.brand-mark {
  width: 22px; height: 22px;
  align-self: center;
  flex: none;
}
.brand small {
  font: 500 11px/1 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav a, .nav button {
  font: 500 14px/1 var(--sans);
  color: var(--ink-2);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 999px;
  border: 0;
  background: none;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.nav a:hover, .nav button:hover { background: var(--paper-sunk); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.nav .who { color: var(--ink-3); font-size: 13px; padding: 0 8px; }
@media (max-width: 640px) { .nav .who { display: none; } .brand small { display: none; } }

/* ── Page frame ───────────────────────────────────────────── */

.page { max-width: 1180px; margin: 0 auto; padding: clamp(24px, 5vw, 56px) var(--gutter) 80px; }
.page-narrow { max-width: 760px; }

.eyebrow {
  font: 600 11.5px/1 var(--sans);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 12px;
}

.flash {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  font-size: 15px;
  background: var(--money-soft);
  color: var(--money-ink);
  animation: rise .4s ease both;
}
.flash svg { flex: none; margin-top: 3px; }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash ul { margin: 0; padding-left: 18px; }

/* ── Year switcher ────────────────────────────────────────── */

.years { display: flex; gap: 2px; padding: 3px; background: var(--paper-sunk); border-radius: 999px; width: max-content; max-width: 100%; overflow-x: auto; }
.years a {
  font: 600 14px/1 var(--sans);
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-2);
}
.years a:hover { color: var(--ink); }
.years a[aria-current="true"] { background: var(--paper-raised); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ── Hero figure ──────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: end;
  margin-bottom: clamp(32px, 5vw, 48px);
}
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; align-items: start; } }

.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }

.hero-figure {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(52px, 10vw, 104px);
  line-height: .9;
  letter-spacing: -.035em;
  font-variant-numeric: lining-nums tabular-nums;
  margin: 0;
  animation: rise .6s cubic-bezier(.2,.7,.2,1) both;
}
.hero-figure .cur { font-size: .5em; color: var(--ink-3); margin-left: .12em; letter-spacing: 0; }
.hero-sub { margin: 14px 0 0; color: var(--ink-2); font-size: 17px; max-width: 34ch; }
.hero-sub strong { color: var(--ink); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.stat { padding: 14px 12px 0 0; animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
.stat:nth-child(2) { animation-delay: .06s; }
.stat:nth-child(3) { animation-delay: .12s; }
.stat dt { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.stat dd { margin: 0; font: 500 clamp(18px, 2.4vw, 24px)/1.1 var(--serif); letter-spacing: -.01em; }

/* ── Year chart: 12 bars around the flat line ─────────────── */

.chart-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 24px clamp(14px, 3vw, 28px) 18px;
  margin-bottom: 40px;
}
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.chart-head h2 { font-size: 22px; }
.chart-key { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.chart-key span { display: inline-flex; align-items: center; gap: 7px; }
.key-line { width: 18px; border-top: 2px dashed var(--ink-2); }
.key-fixed { width: 10px; height: 10px; border-radius: 2px; background: var(--fixed); }

.chart {
  --h: 220px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 2px;
  height: calc(var(--h) + 44px);
  padding-top: 8px;
}
@media (max-width: 560px) { .chart { --h: 160px; } }

.chart .grid-line {
  position: absolute; left: 0; right: 0;
  border-top: 1px solid var(--rule);
  pointer-events: none;
}
.chart .baseline { bottom: 44px; border-top-color: var(--rule-strong); }

.chart .flat-line {
  position: absolute; left: 0; right: 0;
  bottom: calc(44px + var(--flat, 0) * var(--h));
  border-top: 2px dashed var(--ink-2);
  pointer-events: none;
  z-index: 2;
  transition: bottom .45s cubic-bezier(.2,.7,.2,1);
}
.chart .flat-line span {
  position: absolute; right: 0; bottom: 5px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  background: var(--paper-raised); padding: 1px 6px; border-radius: 4px;
}

.bar {
  position: relative;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  height: 100%;
  padding-bottom: 44px;
  border: 0; background: none; color: inherit; font: inherit;
  cursor: default;
  outline-offset: -2px;
}
.bar-fill {
  width: min(70%, 44px);
  height: calc(var(--v, 0) * var(--h));
  background: var(--money);
  border-radius: 4px 4px 0 0;
  transform-origin: bottom;
  animation: grow .7s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(var(--i, 0) * 35ms + 120ms);
  transition: height .45s cubic-bezier(.2,.7,.2,1), background-color .15s, opacity .15s;
}
.bar.is-fixed .bar-fill {
  background: repeating-linear-gradient(135deg, var(--fixed) 0 5px, color-mix(in srgb, var(--fixed) 72%, var(--paper-raised)) 5px 8px);
}
.bar.is-current .bar-fill { box-shadow: 0 0 0 2px var(--paper-raised), 0 0 0 4px var(--ink); }
.chart:hover .bar-fill, .chart:focus-within .bar-fill { opacity: .55; }
.chart .bar:hover .bar-fill, .chart .bar:focus-visible .bar-fill { opacity: 1; }

.bar-label {
  position: absolute; bottom: 20px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  text-transform: capitalize;
}
.bar-delta { position: absolute; bottom: 2px; font-size: 11px; color: var(--ink-3); white-space: nowrap; }
@media (max-width: 720px) { .bar-delta { display: none; } .bar-label { font-size: 11px; } }

.bar-tip {
  position: absolute;
  bottom: calc(44px + var(--v, 0) * var(--h) + 10px);
  left: 50%;
  transform: translate(-50%, 4px);
  background: var(--ink); color: var(--paper);
  padding: 8px 10px; border-radius: 8px;
  font-size: 13px; line-height: 1.35; text-align: left;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s, transform .12s;
  z-index: 5;
}
.bar-tip strong { display: block; font: 500 17px/1.2 var(--serif); }
.bar:first-child .bar-tip, .bar:nth-child(2) .bar-tip { left: 0; transform: translate(0, 4px); }
.bar:nth-last-child(1) .bar-tip, .bar:nth-last-child(2) .bar-tip { left: auto; right: 0; transform: translate(0, 4px); }
.bar:hover .bar-tip, .bar:focus-visible .bar-tip { opacity: 1; transform: translate(-50%, 0); }
.bar:first-child:hover .bar-tip, .bar:nth-child(2):hover .bar-tip,
.bar:first-child:focus-visible .bar-tip, .bar:nth-child(2):focus-visible .bar-tip,
.bar:nth-last-child(1):hover .bar-tip, .bar:nth-last-child(2):hover .bar-tip,
.bar:nth-last-child(1):focus-visible .bar-tip, .bar:nth-last-child(2):focus-visible .bar-tip { transform: translate(0, 0); }

/* ── Ledger table ─────────────────────────────────────────── */

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; }
.section-title h2 { font-size: 26px; }
.section-title p { margin: 0; color: var(--ink-3); font-size: 14px; }

.table-wrap { position: relative; overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); }

.ledger { width: 100%; border-collapse: collapse; font-size: 15px; }
.ledger th {
  text-align: left;
  font: 600 11.5px/1.2 var(--sans);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}
.ledger td { padding: 13px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ledger .num { text-align: right; white-space: nowrap; }
.ledger th.num { text-align: right; }
.ledger tbody tr { transition: background-color .15s; }
.ledger tbody tr:hover { background: color-mix(in srgb, var(--paper-sunk) 55%, transparent); }
.ledger tfoot td { border-bottom: 0; border-top: 1px solid var(--ink); font-weight: 600; padding-top: 14px; }
.ledger .month { font-family: var(--serif); font-size: 18px; text-transform: capitalize; white-space: nowrap; }
.ledger .amount { font: 500 18px/1.2 var(--serif); letter-spacing: -.01em; }
.ledger .muted { color: var(--ink-3); }
.ledger .holidays { display: block; margin-top: 3px; font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.ledger tr.is-current td:first-child { box-shadow: inset 3px 0 0 var(--ink); }
.ledger tr.is-past { color: var(--ink-3); }
.ledger tr.is-past .amount { color: var(--ink-2); }

.delta { font-size: 14px; }
.delta.up { color: var(--money-ink); }
.delta.down { color: var(--ink-2); }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font: 600 11px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 7px; border-radius: 999px;
  background: var(--paper-sunk); color: var(--ink-2);
  vertical-align: 2px;
  white-space: nowrap;
}
.tag-fixed { background: var(--fixed-soft); color: var(--fixed); }
.tag-live { background: var(--money-soft); color: var(--money-ink); }
.tag-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-draft { background: var(--paper-sunk); color: var(--ink-2); border: 1px dashed var(--rule-strong); }
.tag-off { background: var(--danger-soft); color: var(--danger); }

/* ── Notes & explainers ───────────────────────────────────── */

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); margin-top: 48px; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }

.note {
  background: var(--paper-raised);
  border-left: 3px solid var(--money);
  padding: 18px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  white-space: pre-line;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
}
.explain h3 { font-size: 20px; margin-bottom: 10px; }
.explain ol { margin: 0; padding-left: 20px; color: var(--ink-2); }
.explain li { margin-bottom: 8px; padding-left: 4px; }
.explain li::marker { font-family: var(--serif); color: var(--ink); }

.empty {
  text-align: center;
  padding: clamp(48px, 10vw, 96px) 16px;
  border: 1px dashed var(--rule-strong);
  border-radius: 14px;
}
.empty h2 { font-size: 30px; margin-bottom: 10px; }
.empty p { color: var(--ink-2); margin: 0 auto; max-width: 42ch; }

/* ── Forms ────────────────────────────────────────────────── */

.field { display: grid; gap: 6px; margin-bottom: 18px; }
.field label, .field .label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 13px; color: var(--ink-3); margin: 0; }

.input {
  width: 100%;
  font: 500 16px/1.2 var(--sans);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  padding: 11px 12px;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.input::placeholder { color: var(--ink-3); opacity: .8; }
.input:hover { border-color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--money); box-shadow: 0 0 0 3px color-mix(in srgb, var(--money) 22%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }

.input-affix { position: relative; }
.input-affix .input { padding-right: 34px; }
.input-affix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; font-weight: 500; }

.input-big { font: 400 34px/1.1 var(--serif); letter-spacing: -.02em; padding: 10px 44px 10px 14px; }
.input-affix .input-big + span { font: 400 24px/1 var(--serif); }

/* Segmented radio group — replaces a native <select>. */
.segmented { display: flex; padding: 3px; background: var(--paper-sunk); border-radius: 10px; gap: 2px; }
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: block; text-align: center;
  padding: 8px 6px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  transition: background-color .15s, color .15s;
}
.segmented input:checked + span { background: var(--paper-raised); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Switch */
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--rule); background: var(--paper-raised); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  flex: none; position: relative;
  width: 40px; height: 24px; border-radius: 999px;
  background: var(--rule-strong);
  transition: background-color .2s;
  margin-top: 1px;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--paper-raised);
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: transform .2s cubic-bezier(.3,.7,.3,1);
}
.switch input:checked + .switch-track { background: var(--money); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .5; }
.switch strong { display: block; font-size: 15px; font-weight: 600; }
.switch small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 15px/1 var(--sans);
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--ink); color: var(--paper);
  text-decoration: none;
  cursor: pointer;
  transition: transform .1s, background-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { box-shadow: 0 6px 16px -8px rgba(0,0,0,.5); }
.btn:active { transform: translateY(1px); }
.btn-money { background: var(--money); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-money { color: #0d1d17; } }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn-ghost:hover { background: var(--paper-sunk); box-shadow: none; }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger:hover { background: var(--danger-soft); box-shadow: none; }
.btn-sm { font-size: 13.5px; padding: 8px 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── Login ────────────────────────────────────────────────── */

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } }
.login-art {
  position: relative; overflow: hidden;
  background: var(--money);
  color: #f3eee4;
  padding: clamp(32px, 6vw, 72px);
  display: flex; flex-direction: column; justify-content: space-between;
}
@media (prefers-color-scheme: dark) { .login-art { background: #12352a; } }
.login-art h1 { font-size: clamp(40px, 5vw, 68px); font-weight: 400; line-height: 1; max-width: 12ch; letter-spacing: -.03em; }
.login-art h1 em { font-style: italic; color: #cfe3d8; }
.login-art p { max-width: 38ch; color: #cfe3d8; font-size: 16px; margin: 20px 0 0; }
.login-art .wave { position: absolute; left: 0; right: 0; bottom: 20%; height: 180px; opacity: .9; }
.login-art .foot { font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: #a9c9b9; position: relative; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px var(--gutter); }
.login-form form { width: 100%; max-width: 360px; }
.login-form h2 { font-size: 34px; margin-bottom: 6px; }
.login-form .lede { color: var(--ink-2); margin: 0 0 28px; }
.login-form .btn { width: 100%; margin-top: 8px; padding: 14px; }

/* ── Admin: overview matrix ───────────────────────────────── */

.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.admin-head h1 { font-size: clamp(34px, 5vw, 52px); letter-spacing: -.025em; }
.admin-head p { margin: 8px 0 0; color: var(--ink-2); max-width: 60ch; }

.matrix { font-size: 14px; min-width: 1100px; }
.matrix td, .matrix th { padding: 11px 8px; }
.matrix .person { min-width: 190px; }
.matrix .person a { font-weight: 600; text-decoration: none; }
.matrix .person a:hover { text-decoration: underline; }
.matrix .person small { display: block; color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.matrix td.num { font-variant-numeric: tabular-nums; }
.matrix .cell-fixed { color: var(--fixed); font-weight: 600; }
.matrix .total { font-weight: 700; }
.matrix tr.is-empty td { color: var(--ink-3); }
.matrix .heat { position: relative; }
.matrix .heat::before {
  content: ""; position: absolute; inset: 5px 3px; border-radius: 5px;
  background: var(--money);
  opacity: calc(var(--t, 0) * .3);
  z-index: -1;
}
.matrix tbody td { position: relative; z-index: 0; }
.matrix th.days { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-3); font-size: 12px; padding-top: 0; border-bottom: 1px solid var(--ink); }
.matrix thead tr:first-child th { border-bottom: 0; padding-bottom: 2px; }

/* ── Admin: forecast editor ───────────────────────────────── */

.editor { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: clamp(24px, 4vw, 44px); align-items: start; }
@media (max-width: 980px) { .editor { grid-template-columns: minmax(0, 1fr); } }
.editor-side { position: sticky; top: 20px; }
@media (max-width: 980px) { .editor-side { position: static; } }

.check-sum {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 16px; border-radius: 10px;
  background: var(--money-soft); color: var(--money-ink);
  font-size: 14px; margin-bottom: 18px;
  transition: background-color .2s, color .2s;
}
.check-sum strong { font: 500 20px/1 var(--serif); }
.check-sum.is-bad { background: var(--danger-soft); color: var(--danger); }

.grid-edit td { padding: 8px 8px; vertical-align: middle; }
.grid-edit .input { padding: 8px 9px; font-size: 15px; border-radius: 7px; }
.grid-edit .w-days { width: 84px; }
.grid-edit .w-weight { width: 84px; }
.grid-edit .w-override { width: 128px; }
.grid-edit .out { font: 500 18px/1.2 var(--serif); min-width: 110px; }
.grid-edit tr.is-fixed .out { color: var(--fixed); }
.grid-edit .input.is-set { border-color: var(--fixed); background: var(--fixed-soft); }
.grid-edit .eff { color: var(--ink-3); font-size: 13px; }

.live-errors { min-height: 0; }
.live-errors:empty { display: none; }

.danger-zone { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--ink-3); font-size: 14px; }

/* ── Admin: team & calendar ───────────────────────────────── */

.card { background: var(--paper-raised); border: 1px solid var(--rule); border-radius: 14px; padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .span-2 { grid-column: 1 / -1; }

.cal-add { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto auto; gap: 10px; align-items: end; }
@media (max-width: 760px) { .cal-add { grid-template-columns: 1fr; } }
.cal-add .field { margin: 0; }

.inline-form { display: inline; margin: 0; }

/* ── Motion ───────────────────────────────────────────────── */

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.reveal > * { animation: rise .55s cubic-bezier(.2,.7,.2,1) both; }
.reveal > *:nth-child(2) { animation-delay: .05s; }
.reveal > *:nth-child(3) { animation-delay: .1s; }
.reveal > *:nth-child(4) { animation-delay: .15s; }
.reveal > *:nth-child(5) { animation-delay: .2s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  body::before, .masthead, .years, .no-print { display: none !important; }
  .chart-card { box-shadow: none; }
}

/* ── Fixes after visual review ────────────────────────────── */
.admin-head .eyebrow { margin: 0 0 14px; }

/* On a phone the invoice amount must stay in view: drop the secondary columns. */
@media (max-width: 640px) {
  .ledger-member .col-vac, .ledger-member .col-delta { display: none; }
  .ledger-member td, .ledger-member th { padding-left: 6px; padding-right: 6px; }
  .ledger-member .month { font-size: 17px; }
}

/* ── Admin: team weights ──────────────────────────────────── */
.weights-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: clamp(24px, 4vw, 44px); align-items: start; }
@media (max-width: 980px) { .weights-layout { grid-template-columns: minmax(0, 1fr); } }
.weights-table td { vertical-align: middle; padding-top: 9px; padding-bottom: 9px; }
.weights-table .input { padding: 8px 9px; font-size: 15px; border-radius: 7px; width: 84px; }
.weights-table .input.is-set, .grid-edit .w-weight.is-set { border-color: var(--money); background: var(--money-soft); }
.share-col { min-width: 170px; white-space: nowrap; }
.share { display: inline-block; width: 110px; height: 8px; border-radius: 4px; background: var(--paper-sunk); vertical-align: middle; overflow: hidden; }
.share-fill { display: block; height: 100%; background: var(--money); border-radius: 4px; transition: width .3s cubic-bezier(.2,.7,.2,1); }
.share-pct { display: inline-block; width: 52px; text-align: right; font-size: 13px; color: var(--ink-2); margin-left: 8px; }
.overrides-list { display: flex; gap: 4px; flex-wrap: wrap; }
.overrides .tag { text-transform: none; letter-spacing: 0; font-size: 12px; }
.grid-edit .team-hint { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.matrix th.weights { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--money-ink); font-size: 12px; padding-top: 0; }
.matrix thead tr:has(+ tr .weights) th { border-bottom: 0; }
.matrix th.weights { border-bottom: 1px solid var(--ink); }

/* ── Reporting (ended, locked months) vs predikcia ────────── */
.bar.is-reported .bar-fill { background: var(--ink-3); }
.key-reported, .key-predicted { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--ink-3); }
.key-predicted { background: var(--money); }
.tag-reported { background: var(--paper-sunk); color: var(--ink-2); border: 1px solid var(--rule-strong); }
.hero-split { display: flex; gap: 20px; flex-wrap: wrap; margin: 14px 0 0; font-size: 14.5px; color: var(--ink-2); }
.hero-split span { display: inline-flex; align-items: center; gap: 7px; }
.hero-split strong { color: var(--ink); font-weight: 600; }
.grid-edit tr.is-reported .input { background: transparent; border-style: dashed; color: var(--ink-3); cursor: not-allowed; }
.grid-edit tr.is-reported .out { color: var(--ink-2); }
.matrix .cell-reported, .cell-reported { color: var(--ink-3); font-style: italic; }
.matrix .cell-reported.heat::before { opacity: .06; }

/* ── Admin: closing months ────────────────────────────────── */
.timeline { list-style: none; margin: 0 0 28px; padding: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
@media (max-width: 720px) { .timeline { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.timeline li { padding: 10px 6px; border-radius: 8px; text-align: center; background: var(--paper-sunk); border: 1px solid transparent; }
.timeline .tl-month { display: block; font: 500 16px/1.1 var(--serif); text-transform: capitalize; }
.timeline .tl-state { display: block; font-size: 11px; color: var(--ink-3); margin-top: 3px; letter-spacing: .02em; }
.timeline .tl-closed { background: transparent; border-color: var(--rule-strong); }
.timeline .tl-closed .tl-month { color: var(--ink-3); font-style: italic; }
.timeline .tl-next { background: var(--money); color: #fff; }
.timeline .tl-next .tl-state { color: rgba(255,255,255,.8); }
@media (prefers-color-scheme: dark) { .timeline .tl-next { color: #0d1d17; } .timeline .tl-next .tl-state { color: rgba(13,29,23,.75); } }
.close-card h2 { font-size: 26px; }
.close-table td { vertical-align: middle; }
.close-table .input-affix { width: 150px; }
.close-table .input { width: 100%; padding: 9px 30px 9px 10px; font-size: 15px; }
.row-error { display: block; color: var(--danger); font-size: 13px; margin-top: 4px; }
.muted-p { color: var(--ink-3); font-size: 14px; margin: 6px 0 0; }
.reminder { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius); border: 1px dashed var(--rule-strong); margin-bottom: 20px; font-size: 15px; }
.member-note { margin-top: 48px; max-width: 640px; }
.timeline li { padding: 0; }
.timeline li > a, .timeline li > .tl-month { display: block; }
.timeline li > a { padding: 10px 6px; border-radius: 7px; text-decoration: none; color: inherit; transition: background-color .15s; }
.timeline li:not(:has(a)) { padding: 10px 6px; }
.timeline .tl-closed a:hover { background: var(--paper-sunk); }
.timeline li.is-active { box-shadow: 0 0 0 2px var(--ink); }
.timeline .tl-closed.is-active { background: var(--paper-raised); }
.timeline .tl-closed.is-active .tl-month { color: var(--ink); font-style: normal; }
