/* ==========================================================================
   Kassenbuch · „Kontobuch“-Ästhetik
   Papier, Tinte, Siegelrot. Fraunces / Alegreya Sans / IBM Plex Mono.
   ========================================================================== */

@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/fraunces-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: italic; font-weight: 100 900; font-display: swap; src: url("fonts/fraunces-latin-wght-italic.woff2") format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/alegreya-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/alegreya-sans-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/alegreya-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/alegreya-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); }

:root {
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Alegreya Sans", "Gill Sans", "Trebuchet MS", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --paper: #f5efe3;
  --paper-2: #ede5d4;
  --paper-3: #e4dac5;
  --sheet: #fbf8f1;
  --ink: #1c2b4b;
  --ink-2: #3a4a70;
  --ink-soft: #62708f;
  --muted: #7d7f8a;
  --rule: rgba(28, 43, 75, 0.16);
  --rule-strong: rgba(28, 43, 75, 0.38);
  --seal: #a9322b;
  --seal-soft: rgba(169, 50, 43, 0.10);
  --moss: #3c6b3a;
  --moss-soft: rgba(60, 107, 58, 0.12);
  --gold: #b3862c;
  --gold-soft: rgba(179, 134, 44, 0.14);
  --info-soft: rgba(28, 43, 75, 0.08);
  --shadow: 0 1px 0 rgba(28, 43, 75, 0.06), 0 12px 30px -18px rgba(28, 43, 75, 0.35);
  --shadow-lift: 0 2px 0 rgba(28, 43, 75, 0.05), 0 22px 40px -20px rgba(28, 43, 75, 0.45);
  --radius: 4px;
  --spine-w: 236px;
  --spine-bg: #1c2b4b;
  --spine-bg-2: #16223d;
  --spine-fg: #efe8d8;
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15181f;
    --paper-2: #1c2029;
    --paper-3: #252a35;
    --sheet: #1b1f28;
    --ink: #e9e2d2;
    --ink-2: #cfc7b4;
    --ink-soft: #a39c8b;
    --muted: #8a8578;
    --rule: rgba(233, 226, 210, 0.14);
    --rule-strong: rgba(233, 226, 210, 0.36);
    --seal: #d9564d;
    --seal-soft: rgba(217, 86, 77, 0.16);
    --moss: #7fb377;
    --moss-soft: rgba(127, 179, 119, 0.14);
    --gold: #d4a64a;
    --gold-soft: rgba(212, 166, 74, 0.16);
    --info-soft: rgba(233, 226, 210, 0.08);
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 12px 30px -18px rgba(0,0,0,.8);
    --shadow-lift: 0 2px 0 rgba(0,0,0,.3), 0 22px 40px -20px rgba(0,0,0,.9);
    --spine-bg: #0f131b;
    --spine-bg-2: #0b0e14;
    --spine-fg: #e9e2d2;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(179,134,44,.10), transparent 60%),
    radial-gradient(900px 500px at -10% 100%, rgba(28,43,75,.08), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
}
body::before {
  /* feine Papierkörnung */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--ink); text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--seal); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.15; margin: 0; letter-spacing: -0.01em; font-variation-settings: "opsz" 72; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 .8em; }
small, .small { font-size: .88rem; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 1.15em; height: 1.15em; vertical-align: -0.22em; flex: none; }
.mono, .amount, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.amount { white-space: nowrap; }
.amount.neg { color: var(--seal); }
.amount.pos { color: var(--moss); }
.amount.zero { color: var(--muted); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- Layout: Buchrücken + Seite ---------- */
.app { display: grid; grid-template-columns: var(--spine-w) 1fr; min-height: 100vh; position: relative; z-index: 1; }
.spine {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--spine-bg) 0%, var(--spine-bg-2) 100%);
  color: var(--spine-fg); padding: 26px 0 18px;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.06);
}
.spine::after {
  /* Lesebändchen */
  content: ""; position: absolute; top: 0; right: 22px; width: 6px; height: 140px;
  background: var(--seal); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 85%, 0 100%);
  box-shadow: 0 6px 10px -4px rgba(0,0,0,.5);
}
.brand { padding: 0 26px 22px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 14px; }
.brand a { color: inherit; text-decoration: none; display: block; }
.brand .club { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 1.35rem; line-height: 1.15; font-variation-settings: "opsz" 48, "SOFT" 60; }
.brand .app-name { display: block; margin-top: 6px; font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; opacity: .6; }
.nav { list-style: none; margin: 0; padding: 0 14px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 3px;
  color: rgba(239,232,216,.78); text-decoration: none; font-weight: 500; font-size: .98rem;
  transition: background .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; transform: translateX(2px); }
.nav a.is-active { background: var(--paper); color: var(--ink); box-shadow: 0 1px 0 rgba(0,0,0,.2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nav a.is-active { background: var(--sheet); border: 1px solid var(--rule-strong); padding: 8px 11px; } }
.nav a.is-active .ico { color: var(--seal); }
.nav .count { margin-left: auto; font-family: var(--font-mono); font-size: .78rem; background: var(--seal); color: #fff; border-radius: 10px; padding: 1px 7px; }
.nav .divider { margin: 10px 12px 8px; border-top: 1px solid rgba(255,255,255,.12); }
.spine-foot { margin-top: auto; padding: 16px 26px 0; font-size: .86rem; opacity: .75; display: flex; flex-direction: column; gap: 6px; }
.spine-foot form { display: inline; }
.spine-foot button { background: none; border: 0; color: inherit; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.page { padding: 34px 44px 80px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); position: relative; }
.page-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; border-bottom: 1px solid var(--ink); }
.page-head .kicker { font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 4px; }
.page-head .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.year-switch select { font-family: var(--font-mono); font-weight: 500; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius);
  font: inherit; font-weight: 500; font-size: .95rem; line-height: 1; cursor: pointer; text-decoration: none;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), background .15s;
  box-shadow: 0 1px 0 rgba(0,0,0,.15);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -8px rgba(28,43,75,.6); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--rule-strong); box-shadow: none; }
.btn.secondary:hover { background: var(--info-soft); }
.btn.danger { background: transparent; color: var(--seal); border-color: var(--seal); box-shadow: none; }
.btn.danger:hover { background: var(--seal); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); box-shadow: none; padding: 6px 8px; }
.btn.ghost:hover { background: var(--info-soft); transform: none; }
.btn.small { padding: 5px 10px; font-size: .86rem; }
.btn.seal { background: var(--seal); border-color: var(--seal); color: #fff; }
.btn.moss { background: var(--moss); border-color: var(--moss); color: #fff; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* ---------- Karten (Blätter) ---------- */
.card {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; position: relative;
  animation: rise .5s var(--ease) both;
}
.card + .card, .grid + .card, .card + .grid { margin-top: 20px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-weight: 500; }
.card-head .more { font-size: .9rem; color: var(--ink-soft); }
.card.flush { padding: 0; }
.card.flush .card-head { padding: 18px 24px 0; }
.card.flush .ledger { border-top: 0; }
.card.warn { border-color: var(--seal); box-shadow: inset 4px 0 0 var(--seal), var(--shadow); }
.card.notice { background: var(--gold-soft); border-color: var(--gold); }
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.sidebar { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid > .card { margin-top: 0; }
.grid > * { min-width: 0; }
.card { min-width: 0; }
.grid .card:nth-child(2) { animation-delay: .06s; }
.grid .card:nth-child(3) { animation-delay: .12s; }
.grid .card:nth-child(4) { animation-delay: .18s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card, .nav a, .btn { animation: none !important; transition: none !important; } }

/* ---------- Kennzahlen ---------- */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { font-family: var(--font-display); font-style: italic; font-size: 1rem; color: var(--ink-soft); font-variation-settings: "opsz" 24; }
.stat .value { font-family: var(--font-mono); font-size: 1.75rem; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.stat .sub { font-size: .86rem; color: var(--muted); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); box-shadow: var(--shadow); overflow: hidden; animation: rise .5s var(--ease) both; }
.stat-row .stat { padding: 18px 22px; border-right: 1px solid var(--rule); }
.stat-row .stat:last-child { border-right: 0; }
.stat-row .stat.accent { background: linear-gradient(135deg, rgba(28,43,75,.06), transparent); }

/* ---------- Hauptbuch-Tabellen ---------- */
.ledger { width: 100%; border-collapse: collapse; font-size: .95rem; }
.ledger th, .ledger td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.ledger th { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: .92rem; color: var(--ink-soft); border-bottom: 1px solid var(--rule-strong); white-space: nowrap; font-variation-settings: "opsz" 24; }
.ledger th.right, .ledger td.right { text-align: right; }
.ledger td.amount, .ledger th.amount { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; border-left: 1px solid var(--seal-soft); }
.ledger td.amount { border-left-color: rgba(169,50,43,.28); }
.ledger tbody tr { transition: background .12s; }
.ledger tbody tr:hover { background: var(--info-soft); }
.ledger tbody tr.is-link { cursor: pointer; }
.ledger tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
.ledger .num { color: var(--ink-soft); font-size: .86rem; }
.ledger .desc { font-weight: 500; }
.ledger .sub { display: block; font-size: .84rem; color: var(--muted); font-weight: 400; }
.ledger td.compact { padding-top: 6px; padding-bottom: 6px; }
.ledger .empty td { text-align: center; color: var(--muted); padding: 34px; font-style: italic; font-family: var(--font-display); font-size: 1.05rem; }
.ledger tr.depth-1 td:first-child { padding-left: 32px; }
.ledger tr.is-parent td { font-weight: 700; background: var(--paper-2); }
.ledger tr.inactive td { opacity: .5; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.row-actions { white-space: nowrap; display: flex; gap: 4px; justify-content: flex-end; }
.row-actions form { display: inline; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 3px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1.5; border: 1px solid transparent; }
.badge-warn { background: var(--gold-soft); color: var(--gold); border-color: var(--gold); }
.badge-ok { background: var(--moss-soft); color: var(--moss); border-color: var(--moss); }
.badge-info { background: var(--info-soft); color: var(--ink-2); border-color: var(--rule-strong); }
.badge-muted { background: transparent; color: var(--muted); border-color: var(--rule); }
.badge-seal { background: var(--seal-soft); color: var(--seal); border-color: var(--seal); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 3px; background: var(--paper-2); font-size: .8rem; color: var(--ink-2); margin-right: 4px; }
.sphere { font-size: .76rem; color: var(--muted); letter-spacing: .04em; }

/* ---------- Meldungen ---------- */
.flashes { margin: -6px 0 20px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 14px; border-radius: var(--radius); border: 1px solid; display: flex; gap: 10px; align-items: flex-start; animation: rise .35s var(--ease) both; }
.flash.success { background: var(--moss-soft); border-color: var(--moss); color: var(--moss); }
.flash.error { background: var(--seal-soft); border-color: var(--seal); color: var(--seal); }
.flash.info { background: var(--info-soft); border-color: var(--rule-strong); }
.errors { margin: 0 0 16px; padding: 12px 16px 12px 34px; background: var(--seal-soft); border: 1px solid var(--seal); border-radius: var(--radius); color: var(--seal); }
.errors li { margin: 2px 0; }

/* ---------- Formulare ---------- */
form { margin: 0; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field > label:not(.check), .legend { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.field .hint { font-size: .84rem; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], input[type="search"], select, textarea {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--sheet);
  border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 8px 11px; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--info-soft); }
input.money { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
input[type="date"] { font-family: var(--font-mono); font-size: .95rem; }
textarea { min-height: 80px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237d7f8a' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.form-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.form-row .field { margin-bottom: 14px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; }
.check { display: flex; gap: 8px; align-items: center; font-size: .95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden; }
.seg label { padding: 8px 14px; cursor: pointer; font-weight: 500; display: flex; gap: 6px; align-items: center; user-select: none; }
.seg input { position: absolute; opacity: 0; }
.seg label:has(input:checked) { background: var(--ink); color: var(--paper); }
.seg label.income:has(input:checked) { background: var(--moss); }
.seg label.expense:has(input:checked) { background: var(--seal); }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 140px; }
.filters .field input, .filters .field select { padding: 6px 9px; font-size: .95rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 20px; border: 1px solid var(--rule-strong); font-size: .88rem; text-decoration: none; color: var(--ink-2); background: transparent; }
.chip:hover { background: var(--info-soft); }
.chip.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .n { font-family: var(--font-mono); opacity: .7; margin-left: 4px; }

/* ---------- Positionen (Kostenteile) ---------- */
.items { border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden; }
.items-head, .item { display: grid; grid-template-columns: 2.4fr 1.6fr 2fr 130px 40px; gap: 8px; align-items: center; padding: 8px 10px; }
.items-head { background: var(--paper-2); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.item { border-top: 1px solid var(--rule); }
.item input, .item select { padding: 6px 9px; font-size: .95rem; }
.item .remove { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 3px; }
.item .remove:hover { color: var(--seal); background: var(--seal-soft); }
.items-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px; background: var(--paper-2); border-top: 1px solid var(--rule-strong); gap: 12px; flex-wrap: wrap; }
.items-foot .sum { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.items-foot .rest { font-family: var(--font-mono); font-weight: 600; }
.items-foot .rest.ok { color: var(--moss); }
.items-foot .rest.bad { color: var(--seal); }

/* ---------- Budget-Balken ---------- */
.bar { height: 10px; background: var(--paper-3); border-radius: 2px; overflow: hidden; position: relative; }
.bar > i { display: block; height: 100%; background: var(--ink); border-radius: 2px; transition: width .6s var(--ease); }
.bar > i.over { background: var(--seal); }
.bar > i.warn { background: var(--gold); }
.bar-label { display: flex; justify-content: space-between; font-size: .84rem; color: var(--muted); margin-top: 4px; font-family: var(--font-mono); }
.budget-list { display: flex; flex-direction: column; gap: 14px; }
.budget-list .name { font-weight: 500; display: flex; justify-content: space-between; gap: 10px; }

/* ---------- Monatsverlauf ---------- */
.chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 150px; padding-top: 10px; border-bottom: 1px solid var(--rule-strong); }
.chart .col { display: flex; gap: 2px; align-items: end; height: 100%; position: relative; }
.chart .col i { flex: 1; display: block; border-radius: 2px 2px 0 0; min-height: 1px; transition: height .6s var(--ease); }
.chart .col i.in { background: var(--moss); }
.chart .col i.out { background: var(--seal); }
.chart .col:hover i { filter: brightness(1.15); }
.chart .col .tip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); font-family: var(--font-mono); font-size: .72rem; padding: 4px 6px; border-radius: 3px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 2; }
.chart .col:hover .tip { opacity: 1; }
.chart-x { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; font-family: var(--font-mono); font-size: .72rem; color: var(--muted); text-align: center; margin-top: 5px; }
.legend-row { display: flex; gap: 14px; font-size: .84rem; color: var(--muted); margin-top: 8px; }
.legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 5px; }

/* ---------- Schlüssel-Wert-Listen ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: .95rem; margin: 0; }
.kv dt { color: var(--ink-soft); font-family: var(--font-display); font-style: italic; font-variation-settings: "opsz" 24; }
.kv dd { margin: 0; }

/* ---------- Dateien ---------- */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.file { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-2); overflow: hidden; display: flex; flex-direction: column; position: relative; transition: transform .15s var(--ease), box-shadow .15s; }
.file:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.file .thumb { display: block; aspect-ratio: 1 / 1.2; background: var(--paper-3) center / cover no-repeat; text-decoration: none; }
.file .thumb.pdf { display: flex; align-items: center; justify-content: center; color: var(--seal); font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; }
.file .meta { padding: 6px 9px; font-size: .78rem; line-height: 1.3; }
.file .meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file form { position: absolute; top: 5px; right: 5px; }
.file .remove { background: rgba(255,255,255,.9); border: 0; color: var(--seal); border-radius: 50%; width: 24px; height: 24px; cursor: pointer; display: grid; place-items: center; }
.dropzone { border: 2px dashed var(--rule-strong); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--ink-soft); cursor: pointer; transition: background .15s, border-color .15s; position: relative; }
.dropzone:hover, .dropzone.is-over { background: var(--info-soft); border-color: var(--ink); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone .big { font-family: var(--font-display); font-size: 1.15rem; color: var(--ink); }
.dropzone-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: .86rem; text-align: left; display: flex; flex-wrap: wrap; gap: 6px; }
.dropzone-list li { background: var(--paper-2); padding: 3px 8px; border-radius: 3px; }

/* ---------- Timeline / Protokoll ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--rule); position: relative; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.timeline .when { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); }
.changes { margin: 4px 0 0; padding: 0; list-style: none; font-size: .82rem; color: var(--ink-soft); font-family: var(--font-mono); }
.changes li { padding: 1px 0; }

/* ---------- Links / Copy ---------- */
.copy-box { display: flex; gap: 8px; align-items: center; }
.copy-box input { font-family: var(--font-mono); font-size: .86rem; }
.copied { color: var(--moss); font-size: .86rem; }

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.pager a, .pager span { padding: 5px 10px; border: 1px solid var(--rule); border-radius: 3px; text-decoration: none; font-family: var(--font-mono); font-size: .86rem; }
.pager span.is-active { background: var(--ink); color: var(--paper); }

/* ---------- Leere Zustände ---------- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-soft); }
.empty-state h3 { font-style: italic; font-weight: 400; font-size: 1.4rem; margin-bottom: 6px; }
.stamp {
  display: inline-block; padding: 6px 12px; border: 3px double var(--seal); color: var(--seal); font-family: var(--font-display); font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; transform: rotate(-4deg); font-size: .9rem; opacity: .9;
}
.stamp.ok { border-color: var(--moss); color: var(--moss); }

/* ---------- Auth / Public (Blatt in der Mitte) ---------- */
.bare { min-height: 100vh; display: grid; place-items: center; padding: 30px 16px; position: relative; z-index: 1; }
.sheet { width: 100%; max-width: 480px; background: var(--sheet); border: 1px solid var(--rule); box-shadow: var(--shadow-lift); padding: 36px 38px 30px; border-radius: var(--radius); position: relative; animation: rise .6s var(--ease) both; }
.sheet::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--seal); border-radius: var(--radius) 0 0 var(--radius); }
.sheet.wide { max-width: 640px; }
.sheet .kicker { font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); }
.sheet h1 { font-size: 1.9rem; margin: 4px 0 18px; }
.sheet h1 em { font-style: italic; font-weight: 400; color: var(--seal); }
.sheet .foot { margin-top: 20px; font-size: .84rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 12px; }

/* ---------- Druck ---------- */
.print-body { background: #fff; color: #000; font-size: 12pt; padding: 0; }
.print-body::before { display: none; }
.print-page { max-width: 900px; margin: 0 auto; padding: 24px; }
.print-page .card { box-shadow: none; animation: none; break-inside: avoid; }
.print-page h1 { font-size: 1.8rem; }
@media print {
  .spine, .page-head .actions, .filters, .no-print, .flashes { display: none !important; }
  body { background: #fff; }
  body::before { display: none; }
  .app { display: block; }
  .page { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; animation: none; border-color: #999; }
  .ledger th, .ledger td { padding: 5px 8px; font-size: 10.5pt; }
  a { text-decoration: none; color: inherit; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.sidebar { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .spine { position: relative; height: auto; padding: 14px 0 0; flex-direction: column; min-width: 0; }
  .spine::after { height: 60px; right: 14px; }
  .brand { padding: 0 16px 12px; margin-bottom: 8px; }
  .brand .club { font-size: 1.15rem; }
  .nav { flex-direction: row; overflow-x: auto; padding: 0 10px 10px; gap: 4px; scrollbar-width: none; min-width: 0; max-width: 100vw; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 7px 10px; font-size: .9rem; }
  .nav .divider { display: none; }
  .spine-foot { display: none; }
  .page { padding: 20px 16px 60px; }
  .page-head { margin-bottom: 18px; }
  h1 { font-size: 1.7rem; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .items-head { display: none; }
  .item { grid-template-columns: 1fr 1fr; }
  .item .cat { grid-column: 1 / -1; }
  .item .money-cell { grid-column: 1 / 2; }
  .sheet { padding: 26px 22px 22px; }
  .stat .value { font-size: 1.4rem; }
  .card { overflow-x: auto; }
  .card.flush .card-head { padding: 16px 16px 0; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row .stat:nth-child(2n) { border-right: 0; }
  .stat-row .stat { border-bottom: 1px solid var(--rule); }
  .page-head .actions { width: 100%; }
}
