/* Gestaltung aus der alten HTML-Vorlage: Arbeitsfläche links, rechts das Blatt wie auf Papier. Ziffern in Mono. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Serif"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-serif-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --bg: #f1f4f1; --panel: #ffffff; --ink: #1d2721; --ink-2: #56625a; --line: #d3dbd5;
  --accent: #2c6652; --accent-ink: #ffffff; --accent-soft: #e1ede7;
  --warn: #8a5300; --warn-soft: #fbefd9; --bad: #a3352b; --bad-soft: #f8e3e0;
  --paper: #ffffff; --paper-ink: #1d2721; --paper-line: #c9d1cb; --focus: #2c6652;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --serif: "IBM Plex Serif", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #141a17; --panel: #1c2420; --ink: #e5ece7; --ink-2: #a3b0a8; --line: #33403a;
    --accent: #6fbf9f; --accent-ink: #0f1a15; --accent-soft: #23372e;
    --warn: #f0b562; --warn-soft: #3a2c15; --bad: #ef8a80; --bad-soft: #3b1f1c;
    --paper: #fbfcfb; --paper-ink: #1d2721; --paper-line: #c9d1cb; --focus: #6fbf9f;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: 12px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); padding: 0 16px 48px;
  padding-top: env(safe-area-inset-top, 0px); }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); }
.wrap { max-width: 1240px; margin: 0 auto; }
.narrow { max-width: 760px; }
header.top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; padding-block: 28px 18px; }
h1 { font: 500 1.7rem/1.15 var(--serif); margin: 0; text-wrap: balance; }
h1 a { color: inherit; text-decoration: none; }
.sub { color: var(--ink-2); margin: 4px 0 0; font-size: 0.92rem; }
.userbox { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; color: var(--ink-2); }
nav.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
nav.tabs a { border-bottom: 2px solid transparent; color: var(--ink-2); font: 500 0.95rem var(--sans); padding: 10px 14px;
  min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }
nav.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; cursor: pointer; min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); line-height: 1.2; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.ghost { border-color: transparent; background: none; color: var(--ink-2); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 34px; padding: 5px 10px; font-size: 0.88rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
label, .label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
input[type=text], input[type=date], input[type=number], input[type=password], input[type=email], input[type=search], select, textarea {
  width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; min-height: 40px; }
textarea { min-height: 64px; resize: vertical; }
input.num { font-variant-numeric: tabular-nums; text-align: right; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel h2 { font: 500 1.1rem var(--serif); margin: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 980px) { .cols { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stack.tight { gap: 6px; }
.note { font-size: 0.85rem; color: var(--ink-2); margin: 0; }
.banner { background: var(--warn-soft); color: var(--ink); border-radius: 8px; padding: 12px 14px; font-size: 0.88rem; }
.banner b { color: var(--warn); }
.banner.ok { background: var(--accent-soft); }
.banner.ok b { color: var(--accent); }
.banner.error { background: var(--bad-soft); }
.banner.error b { color: var(--bad); }
.ziffer { font-family: var(--mono); font-weight: 500; font-size: 0.85rem; }
.chip { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 1px 7px; border-radius: 99px; white-space: nowrap; }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.ok { background: var(--accent-soft); color: var(--accent); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.mute { background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.row.end { align-items: end; }
.grow { flex: 1 1 200px; min-width: 0; }
.w-s { width: 110px; flex: 0 0 110px; }
.w-m { width: 160px; flex: 0 0 160px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 8px; }

/* Termine */
.termin { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.termin-head { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.termin-head .tplpick { display: flex; gap: 8px; align-items: end; }
.termin-head .tplpick > div { flex: 1; min-width: 0; }
@media (max-width: 560px) { .termin-head { grid-template-columns: 1fr; } }
.lines { display: flex; flex-direction: column; }
.line { display: grid; grid-template-columns: 28px 52px minmax(0, 1fr) 58px 92px 34px; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.line:first-child { border-top: 0; }
.line .txt { font-size: 0.88rem; min-width: 0; margin: 0; color: inherit; font-weight: 400; }
.line .txt small { display: block; color: var(--ink-2); font-size: 0.78rem; }
.line.off .txt, .line.off .ziffer { color: var(--ink-2); text-decoration: line-through; }
.line input[type=text] { min-height: 36px; padding: 6px 8px; }
.line .x { min-height: 34px; padding: 0; width: 34px; }
.line details { grid-column: 3 / -1; font-size: 0.82rem; }
.line details summary { cursor: pointer; color: var(--ink-2); width: fit-content; }
.line details .more { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding-top: 6px; }
.colhead { display: grid; grid-template-columns: 28px 52px minmax(0, 1fr) 58px 92px 34px; gap: 8px; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-2); font-weight: 600; }
@media (max-width: 560px) {
  .colhead { display: none; }
  .line { grid-template-columns: 28px minmax(0, 1fr) 58px 88px 30px; }
  .line .txt { grid-row: 2; grid-column: 1 / -1; }
  .line details { grid-row: 3; grid-column: 1 / -1; }
  .line details .more { grid-template-columns: 1fr; }
}
.addline { display: flex; gap: 8px; align-items: end; }
.addline > div { flex: 1; min-width: 0; }
.expense { display: grid; grid-template-columns: 140px minmax(0, 1fr) 64px 100px 34px; gap: 8px; align-items: end; padding: 6px 0; border-top: 1px solid var(--line); }
.expense:first-child { border-top: 0; }
@media (max-width: 560px) { .expense { grid-template-columns: 1fr 1fr; } .expense .wide { grid-column: 1 / -1; } }
.sumrow { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; font-size: 0.88rem; }
.sumrow strong { font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.status { font-size: 0.85rem; color: var(--ink-2); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; font-weight: 400; color: var(--ink); margin: 0; }
.check input { margin-top: 2px; }
ul.plain { margin: 0; padding-left: 18px; font-size: 0.85rem; color: var(--ink-2); }
ul.plain li { margin: 2px 0; }

/* Blatt (Vorschau) */
.sheet-wrap { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 12px); }
.sheet { background: var(--paper); color: var(--paper-ink); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06); padding: 36px 34px; font-size: 12.5px; line-height: 1.45;
  aspect-ratio: 210 / 297; overflow: auto; max-width: 100%; position: relative; }
.sheet.draft::before { content: "ENTWURF"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font: 600 64px var(--sans); color: rgba(0,0,0,.05); transform: rotate(-35deg); pointer-events: none; }
.sheet .s-head { display: flex; justify-content: space-between; gap: 16px; }
.sheet .s-praxis { text-align: right; font-size: 11.5px; }
.sheet .s-praxis b { font-family: var(--serif); font-weight: 500; font-size: 14px; display: block; }
.sheet .s-sender { font-size: 9.5px; color: #56625a; border-bottom: 1px solid var(--paper-line); padding-bottom: 2px; margin-bottom: 6px; display: inline-block; }
.sheet .s-addr { margin-top: 26px; min-height: 70px; }
.sheet .s-meta { display: grid; grid-template-columns: auto auto; gap: 0 12px; justify-content: end; font-size: 11.5px; margin-top: -60px; min-height: 60px; align-content: start; }
.sheet h3 { font: 500 18px var(--serif); margin: 28px 0 8px; }
.sheet .s-pat { font-size: 11.5px; margin-bottom: 12px; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.sheet th { text-align: left; font-weight: 600; border-bottom: 1.5px solid var(--paper-ink); padding: 4px 6px 4px 0; }
.sheet td { border-bottom: 1px solid var(--paper-line); padding: 4px 6px 4px 0; vertical-align: top; }
.sheet td.n, .sheet th.n { text-align: right; padding-right: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheet td.z { font-family: var(--mono); white-space: nowrap; }
.sheet th.c-date { width: 68px; }
.sheet th.c-z { width: 52px; }
.sheet tr.sub td { font-weight: 600; border-bottom: 0; padding-top: 10px; }
.sheet tr.subtotal td { border-bottom: 0; padding-bottom: 0; }
.sheet tr.total td { border-bottom: 0; border-top: 1.5px solid var(--paper-ink); font-weight: 600; padding-top: 6px; }
.sheet .s-foot { margin-top: 16px; font-size: 10.5px; color: #3c4740; display: flex; flex-direction: column; gap: 4px; }
.placeholder { background: #fff3cd; color: #6b4a00; padding: 0 3px; border-radius: 2px; }

/* Tabellen */
.tablewrap { overflow-x: auto; }
table.list { border-collapse: collapse; width: 100%; min-width: 620px; }
table.list th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 600;
  padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list td.n, table.list th.n { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; white-space: nowrap; }
table.list tr:last-child td { border-bottom: 0; }
table.list a.main { font-weight: 600; text-decoration: none; }
table.list tr.grp td { background: var(--bg); font-weight: 600; font-size: 0.85rem; padding: 8px; }
table.list input[type=text], table.list select { min-height: 36px; padding: 6px 8px; }
.hint { display: block; font-size: 0.78rem; color: var(--ink-2); margin-top: 2px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column;
  gap: 2px; min-height: 44px; text-decoration: none; color: var(--ink); }
.tile b { font: 500 1.4rem/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.tile span { font-size: 0.82rem; color: var(--ink-2); }
.tile[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); }
.tile.mine b { color: var(--accent); }
.tile.alert b { color: var(--bad); }
table.list.compact { min-width: 0; }
.check .hint { margin-top: 4px; }
svg.qr { width: 190px; height: 190px; border-radius: 4px; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr 0.8fr auto; gap: 10px; align-items: end; }
@media (max-width: 860px) { .filters { grid-template-columns: 1fr 1fr; } }
.gap { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 0.88rem; align-items: center; }
.gap span { font-variant-numeric: tabular-nums; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; font-size: 0.88rem; }
.login { max-width: 400px; margin: 12vh auto 0; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 18px; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 0.9rem; }
dl.kv dt { color: var(--ink-2); }
dl.kv dd { margin: 0; }
code.cmd { display: block; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font: 500 0.82rem var(--mono); overflow-x: auto; white-space: pre; }
.js .nojs-only { display: none; }
@media print {
  body { background: #fff; padding: 0; }
  header.top, nav.tabs, .noprint { display: none !important; }
  .cols { display: block; }
  .sheet-wrap { position: static; }
  .sheet { border: 0; box-shadow: none; aspect-ratio: auto; overflow: visible; padding: 0; font-size: 11pt; }
}
@media (prefers-reduced-motion: no-preference) { .btn, nav.tabs a { transition: border-color .15s, color .15s; } }
