/* Kreimer Buchhaltung – ruhiges «Kassabuch»-Design */
:root {
  --paper: #f4f1ea;
  --card: #fffdf8;
  --ink: #1d2421;
  --muted: #6b716c;
  --line: #e4ded1;
  --green: #1f3a34;
  --green-2: #2e5a4e;
  --accent: #c7a35a;
  --red: #c2412d;
  --red-bg: #fbe9e5;
  --amber: #b97a06;
  --amber-bg: #fdf3dc;
  --blue: #2f6fb0;
  --blue-bg: #e6f0fa;
  --ok: #2f7d52;
  --ok-bg: #e5f3ea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(29, 36, 33, .06), 0 4px 16px rgba(29, 36, 33, .05);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: var(--green-2); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0 0 .6em; }
h1 { font-size: 1.9rem; line-height: 1.15; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; margin-top: 1.2em; }
small { display: block; color: var(--muted); font-size: .8rem; font-weight: normal; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.mono { font-family: var(--mono); font-size: .92em; }
.num, .right.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--red) !important; }
.pos { color: var(--ok); }
.hidden { display: none !important; }

/* ── Layout ── */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 236px; background: var(--green); color: #e9efe9;
  display: flex; flex-direction: column; padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--serif); font-size: 1.2rem; margin: 0 6px 26px; }
.brand-mark {
  display: inline-block; width: 40px; height: 40px; border-radius: 11px; object-fit: cover;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25), inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.auth-card .brand-mark { width: 52px; height: 52px; border-radius: 14px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: #cfdbd3; text-decoration: none; font-size: .95rem;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar nav a.active { background: rgba(255, 255, 255, .12); color: #fff; }
.sidebar .ico { width: 18px; text-align: center; opacity: .8; }
.pill { margin-left: auto; font-size: .72rem; padding: 1px 7px; border-radius: 99px; font-weight: 700; }
.pill.red { background: var(--red); color: #fff; }
.logout { margin: 10px 12px 0; }
.linkish { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; font: inherit; text-decoration: underline; opacity: .8; }
.content { margin-left: 236px; padding: 28px 36px 60px; max-width: 1280px; }
.bottombar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: .85rem; }
.eyebrow a { color: var(--muted); text-decoration: none; }
.head-actions { display: flex; gap: 8px; }

/* ── Karten & Kennzahlen ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card.subtle { background: transparent; box-shadow: none; }
.card.highlight { border-color: var(--accent); background: #fffaf0; }
.pad { padding: 18px 22px 0; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.grid-cards .card { margin: 0; }
.grid-cards + * { margin-top: 18px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stats.one { grid-template-columns: minmax(240px, 420px); }
.stat {
  display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  border-top: 4px solid var(--line);
}
.stat .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat strong { font: 600 1.6rem/1.2 var(--serif); font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.stat.balance { border-top-color: var(--green-2); background: linear-gradient(160deg, #fffdf8, #f3f6f1); }
.stat.red { border-top-color: var(--red); }
.stat.red.alarm { background: var(--red-bg); }
.stat.red.alarm strong { color: var(--red); }
.stat.amber { border-top-color: var(--amber); }
.stat.blue { border-top-color: var(--blue); }
a.stat:hover { transform: translateY(-1px); }

.projection { padding: 14px 22px; }
.proj-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-variant-numeric: tabular-nums; }
.proj-row.minus { color: var(--muted); }
.proj-row.total { border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 10px; font-weight: 700; font-size: 1.05rem; }

/* ── Status-Farben ── */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 600; white-space: nowrap; text-decoration: none; border: 1px solid transparent; }
.s-overdue { background: var(--red-bg); color: var(--red); border-color: #f2c9c0; }
.s-soon { background: var(--amber-bg); color: var(--amber); border-color: #f1dca8; }
.s-open { background: #efede6; color: #4c524e; }
.s-transmitted { background: var(--blue-bg); color: var(--blue); border-color: #c8dbef; }
.s-paid { background: var(--ok-bg); color: var(--ok); border-color: #c4e2cf; }
.tag { font-size: .7rem; padding: 1px 6px; border-radius: 4px; background: #eee9dc; font-family: var(--sans); }

/* ── Listen ── */
.inv-list { list-style: none; margin: 0 0 12px; padding: 0; }
.inv-list li a {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 14px;
  padding: 11px 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink);
  border-left: 4px solid transparent;
}
.inv-list li a:hover { background: #faf7f0; }
.inv-list li:last-child a { border-bottom: 0; }
.inv-list .date { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; min-width: 86px; }
.inv-list .who { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.inv-list .amt { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.inv-list.compact li a { grid-template-columns: auto 1fr auto; padding: 7px 10px; }
.inv-list li:not(:has(.date)) a { grid-template-columns: 1fr auto; }
.row-overdue a, tr.row-overdue td:first-child { border-left-color: var(--red) !important; }
.row-overdue a { background: #fdf4f2; }
.row-soon a, tr.row-soon td:first-child { border-left-color: var(--amber) !important; }
.row-transmitted a, tr.row-transmitted td:first-child { border-left-color: var(--blue) !important; }
.row-paid a, tr.row-paid td:first-child { border-left-color: var(--ok) !important; }
.empty { color: var(--muted); }

/* ── Tabelle ── */
.table-wrap { overflow-x: auto; }
.inv-table { width: 100%; border-collapse: collapse; }
.inv-table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #faf7f0; }
.inv-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.inv-table td:first-child { border-left: 4px solid transparent; }
.inv-table tbody tr:last-child td { border-bottom: 0; }
.inv-table tr[data-href] { cursor: pointer; }
.inv-table tbody tr:hover { background: #faf7f0; }
.inv-table tr.row-overdue { background: #fdf4f2; }
.inv-table tr.row-overdue .date { color: var(--red); font-weight: 600; }
.inv-table tr.row-soon .date { color: var(--amber); font-weight: 600; }
.inv-table tr.row-new { background: #fffaf0; }
.inv-table .who a { color: var(--ink); font-weight: 600; text-decoration: none; }
.inv-table .chk { width: 36px; }
.inv-table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green-2); }
.right { text-align: right; }

.tabs { display: flex; gap: 4px; margin-bottom: 14px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; font-size: .93rem; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--green-2); font-weight: 600; }
.tabs a.has-alarm { color: var(--red); }
.search { margin-bottom: 14px; }
.search input { max-width: 420px; }

/* ── Zahlleiste ── */
.paybar {
  position: fixed; left: 236px; right: 0; bottom: 0; z-index: 20; background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 36px;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .15); flex-wrap: wrap;
}
.paybar[hidden] { display: none; }
.paybar .muted { color: #b9cbc1; }
.paybar a { color: #fff; }
.paybar .proj { display: flex; gap: 14px; flex-wrap: wrap; font-size: .9rem; margin-top: 3px; font-variant-numeric: tabular-nums; }
.paybar .proj .after b { color: #bfe8cd; }
.paybar .proj .neg, .paybar .proj .neg b { color: #ffb4a6 !important; }
.paybar-actions { display: flex; gap: 8px; align-items: center; }
.paybar select { width: auto; background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .25); }
.paybar select option { color: var(--ink); }
.paybar .btn.primary { background: var(--accent); color: var(--green); border-color: var(--accent); }
body.has-paybar .content { padding-bottom: 140px; }

/* ── Formulare ── */
label { display: block; font-size: .85rem; font-weight: 600; color: #3c433f; margin-bottom: 12px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 11px; font: 15px var(--sans); color: var(--ink);
  background: #fff; border: 1px solid #d6cfbf; border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(46, 90, 78, .35); border-color: var(--green-2); }
input.autofilled, select.autofilled { background: #fff8dd; border-color: #e3c56b; }
input[type=checkbox], input[type=radio] { display: inline-block; width: auto; margin: 0 6px 0 0; }
label.radio, label.check { font-weight: normal; display: flex; align-items: center; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font: 600 1rem var(--serif); margin-bottom: 10px; color: var(--green); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid-addr { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0 12px; }
.grid-addr label:nth-child(1) { grid-column: span 5; }
.grid-addr label:nth-child(2) { grid-column: span 1; }
.grid-addr label:nth-child(3) { grid-column: span 2; }
.grid-addr label:nth-child(4) { grid-column: span 3; }
.grid-addr label:nth-child(5) { grid-column: span 1; }
.hint { font-size: .82rem; margin: -6px 0 12px; color: var(--muted); }
.hint.ok { color: var(--ok); }
.hint.warn { color: var(--amber); font-weight: 600; }
.warnbox { background: var(--amber-bg); padding: 10px; border-radius: 8px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input, .inline-form select { width: auto; margin: 0; }
.link-form { display: flex; gap: 6px; }
.link-form select { margin: 0; padding: 5px 8px; font-size: .85rem; max-width: 260px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 9px;
  border: 1px solid #cfc7b5; background: #fff; color: var(--ink); font: 600 .92rem var(--sans); text-decoration: none; cursor: pointer;
}
.btn:hover { background: #f7f3ea; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #e9b9ae; }
.btn.big { padding: 12px 22px; font-size: 1rem; }
.btn.small { padding: 5px 10px; font-size: .82rem; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Erfassen / Detail ── */
.split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr); gap: 22px; align-items: start; }
.split-right.card { margin: 0; }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 28px 18px; border: 2px dashed #cbbf9f; border-radius: var(--radius); background: #fbf8f1; cursor: pointer; margin-bottom: 12px;
}
.dropzone.small { padding: 18px; }
.dropzone.over { background: #f3eedd; border-color: var(--green-2); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.dz-icon { font-size: 1.8rem; color: var(--green-2); }
.dz-title { font-weight: 600; }
.dz-sub { font-size: .82rem; color: var(--muted); font-weight: normal; }
.scan-status { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-size: .9rem; background: var(--blue-bg); color: #1d4b78; }
.scan-status.ok { background: var(--ok-bg); color: #1f5a39; }
.scan-status.warn { background: var(--amber-bg); color: #7a5205; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.split-left { min-width: 0; }
.doc-viewer { max-width: 100%; background: #e9e4d8; border-radius: var(--radius); padding: 10px; max-height: 80vh; overflow: auto; }
.doc-viewer canvas, .doc-viewer img { display: block; width: 100%; height: auto; max-width: none; background: #fff; margin: 0 auto 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.doc-viewer.zoomed canvas, .doc-viewer.zoomed img { margin-left: 0; }
.doc-zoom { display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 6px; }
.doc-zoom button { min-width: 38px; height: 34px; padding: 0 10px; border: 1px solid var(--line, #d8d2c4); background: #fff; border-radius: 8px; font: inherit; font-size: .9rem; cursor: pointer; }
.doc-zoom button:hover { background: #f4f0e6; }
.doc-zoom .z-fit { min-width: 92px; }
.doc-toolbar .doc-zoom { margin: 0 auto 0 0; }
.doc-loading { padding: 40px; text-align: center; color: var(--muted); }
.doc-toolbar { display: flex; gap: 14px; align-items: center; justify-content: flex-end; margin-bottom: 8px; font-size: .88rem; flex-wrap: wrap; }
.doc-toolbar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-doc { text-align: center; color: var(--muted); padding: 50px; }

.status-card { border-top: 5px solid var(--line); }
.status-card.s-overdue { border-top-color: var(--red); background: #fffaf8; }
.status-card.s-soon { border-top-color: var(--amber); }
.status-card.s-transmitted { border-top-color: var(--blue); }
.status-card.s-paid { border-top-color: var(--ok); }
.status-card.s-soon, .status-card.s-paid, .status-card.s-transmitted, .status-card.s-open { color: var(--ink); border-color: var(--line); background: var(--card); }
.status-card.s-overdue { color: var(--ink); border-color: #f2c9c0; background: #fffaf8; }
.status-line { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.big-amount { font: 600 2.2rem/1.2 var(--serif); margin: 10px 0 2px; font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 0; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-direction: column; gap: 10px; }
.actions form { margin: 0; }

/* ── Hilfe, Codes ── */
.howto { padding-left: 20px; }
.howto li { margin-bottom: 10px; }
details.help { margin-top: 14px; font-size: .9rem; }
details.help summary { cursor: pointer; color: var(--green-2); font-weight: 600; }
code.copy { display: block; padding: 10px; background: #f1ede2; border-radius: 8px; overflow-wrap: anywhere; cursor: pointer; font-size: .8rem; }
code.copy.copied { background: var(--ok-bg); }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; list-style: none; padding: 0; }
.codes code { display: block; padding: 8px; background: #f1ede2; border-radius: 6px; text-align: center; font-size: 1rem; letter-spacing: .05em; }
.devices { list-style: none; padding: 0; margin: 0 0 10px; }
.devices li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.quicklinks { display: none; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.quicklinks a { padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; text-decoration: none; color: var(--ink); }

/* ── Auswertung ── */
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; height: 200px; align-items: end; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar .fill { width: 100%; max-width: 44px; background: var(--green-2); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bar .val { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar .lbl { font-size: .75rem; color: var(--muted); }
.share { display: block; height: 8px; background: #efe9db; border-radius: 4px; width: 120px; overflow: hidden; }
.share span { display: block; height: 100%; background: var(--accent); }

/* ── Meldungen ── */
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .92rem; border: 1px solid transparent; }
.alert.ok { background: var(--ok-bg); color: #1f5a39; border-color: #c4e2cf; }
.alert.warn { background: var(--amber-bg); color: #7a5205; border-color: #f1dca8; }
.alert.error { background: var(--red-bg); color: #8f2a1a; border-color: #f2c9c0; }
.alert.floating { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 50; }

/* ── Anmeldung ── */
body.plain { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 20% -10%, #e5eadf, transparent), var(--paper); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 620px; }
.auth-card .brand-mark { margin-bottom: 14px; }
.auth-card .btn.big { width: 100%; margin-top: 6px; }
.code-input { font: 600 1.6rem var(--mono); letter-spacing: .3em; text-align: center; }
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 18px; counter-reset: s; }
.steps li { flex: 1; padding: 6px; text-align: center; font-size: .8rem; border-radius: 6px; background: #efebe1; color: var(--muted); }
.steps li.active { background: var(--green); color: #fff; }
.steps li.done { background: var(--ok-bg); color: var(--ok); }
.checklist { list-style: none; padding: 0; columns: 2; font-size: .88rem; }
.checklist .ok { color: var(--ok); }
.checklist .bad { color: var(--red); font-weight: 600; }
.qr-box { width: 230px; margin: 12px auto; background: #fff; padding: 6px; border-radius: 10px; border: 1px solid var(--line); }
.qr-box svg { display: block; width: 100%; height: auto; }
code.secret { font-size: .95rem; letter-spacing: .08em; }

/* ── Mobil ── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .content { margin: 0; padding: 18px 14px 96px; }
  h1 { font-size: 1.5rem; }
  .bottombar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; align-items: center;
  }
  .bottombar a { position: relative; display: flex; flex-direction: column; align-items: center; font-size: .68rem; color: var(--muted); text-decoration: none; padding: 4px 8px; }
  .bottombar a span { font-size: 1.25rem; line-height: 1.2; }
  .bottombar a.active { color: var(--green); font-weight: 700; }
  .bottombar a.fab span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--green); color: #fff; font-size: 1.5rem; margin-top: -18px; box-shadow: var(--shadow); }
  .bottombar .dot { position: absolute; top: 2px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .paybar { left: 0; bottom: calc(62px + env(safe-area-inset-bottom)); padding: 12px 14px; }
  .paybar-actions { width: 100%; }
  .paybar-actions select { flex: 1; }
  .hide-s, .inv-table .col-status { display: none; }
  .inv-table .who { min-width: 0; }
  .inv-table td, .inv-table th { padding: 10px 8px; }
  .grid2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat.balance { grid-column: 1 / -1; }
  .quicklinks { display: flex; }
  .inv-list li a { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .inv-list li a .date { grid-column: 1 / -1; min-width: 0; font-size: .8rem; }
  .inv-list li a .badge { display: none; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 8px; }
  .doc-viewer { max-height: 70vh; }
  .doc-toolbar { gap: 10px; font-size: .8rem; }
  .doc-zoom { gap: 4px; }
  .doc-zoom button { min-width: 32px; height: 32px; padding: 0 8px; font-size: .8rem; }
  .doc-zoom .z-fit { min-width: 0; }
  .grid-cards { grid-template-columns: 1fr; }
}

/* ── Regelmässige Zahlungen ── */
.inv-table tr.row-paused { opacity: .55; }
.empty-block { padding-bottom: 18px; }
.danger-zone { margin-top: 18px; text-align: right; }
.paybar .btn:not(.primary) { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
@media (max-width: 900px) {
  .paybar-actions { flex-wrap: wrap; }
  .paybar-actions .btn { flex: 1; }
}

/* ── eBill ── */
.s-ebill { background: #f1ebfa; color: #6a3fa0; border-color: #ddd0ee; }
.ebill-check { align-items: flex-start; gap: 4px; background: #f8f5fc; border: 1px solid #e6dcf3; padding: 10px 12px; border-radius: 9px; margin-bottom: 14px; }
.ebill-check input { margin-top: 3px; }
.ebill-check span { font-weight: normal; }
.ebill-note { background: #f8f5fc; border: 1px solid #e6dcf3; border-radius: 10px; padding: 12px 14px; font-size: .92rem; display: flex; flex-direction: column; gap: 10px; }

/* ── Mehrfach-Import ── */
.batch-table { min-width: 980px; }
.batch-table input:not([type=checkbox]), .batch-table select { margin: 0; padding: 6px 8px; font-size: .9rem; width: 100%; }
.batch-table td.wide { min-width: 220px; }
.batch-table td:nth-child(3) { width: 125px; }
.batch-table td:nth-child(4) { width: 150px; }
.batch-table td:nth-child(5) { width: 140px; }
.batch-table td { vertical-align: top; }
.batch-table .file { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.batch-table .state { font-size: .82rem; min-width: 150px; }
.batch-table .state.ok { color: var(--ok); }
.batch-table .state.warn { color: var(--amber); }
.batch-table .state.err { color: var(--red); }
.batch-table tr.saved { background: #f3faf5; }
.batch-table .src { font-size: .75rem; color: var(--muted); margin-top: 3px; }
.batch-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
@media (max-width: 900px) {
  .batch-table { min-width: 0; }
  .batch-table thead { display: none; }
  .batch-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
  .batch-table td { border: 0; padding: 0; }
  .batch-table td.file, .batch-table td.wide { grid-column: 1 / -1; max-width: none; }
}
.howto.compact li { margin-bottom: 4px; }

/* ── Freigegeben ── */
.s-released { background: #e3eefb; color: #1f5f9e; border-color: #b9d2ef; }
.row-released a, tr.row-released td:first-child { border-left-color: #1f5f9e !important; }
.status-card.s-released { border-top-color: #1f5f9e; color: var(--ink); border-color: var(--line); background: var(--card); }
.howto .inline-form { display: inline-flex; margin: 6px 0; }

/* ── Platzhalter ── */
.s-missing { background: #fff1e0; color: #a0520b; border-color: #f3cf9f; border-style: dashed; }
.placeholder-card { border: 2px dashed #e7b871; background: #fffaf2; }
.placeholder-card h2 { color: #a0520b; }

/* ── Wiederholung ── */
.rec-icon { font-size: .8em; margin-left: 4px; opacity: .85; cursor: help; }
.rec-box { background: #f6f3ec; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.rec-box legend { padding: 0 4px; }
.rec-box p { margin: 0 0 10px; font-size: .9rem; }

/* Etiketten als Gruppe – Betrag bleibt immer rechts */
.badges { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.inv-list li a .amt { min-width: 110px; }
@media (max-width: 900px) {
  .inv-list li a .badges { display: none; }
}

/* ── Monatsansicht ── */
.month-pills { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 14px; scrollbar-width: thin; }
.month-pills a { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; min-width: 62px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); text-decoration: none; font-weight: 600; }
.month-pills a small { font-weight: normal; font-size: .72rem; color: var(--muted); }
.month-pills a.now { border-color: var(--accent); }
.month-pills a.active { background: var(--green); border-color: var(--green); color: #fff; }
.month-pills a.active small { color: #cfe0d6; }
.stat.month-total { border-top-color: var(--accent); background: linear-gradient(160deg, #fffdf8, #fbf4e4); }
.month-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 18px; align-items: start; }
.month-grid .card { margin: 0; }
.row-planned a { background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(31, 95, 158, .035) 10px 20px); border-left: 4px dashed #8fb3d9 !important; }
.row-planned .who { font-weight: 500; color: #2a4f75; }
.s-planned { background: #eef4fb; color: #2a5f94; border: 1px dashed #9cbde0; }
.cat-bars { list-style: none; margin: 0 0 10px; padding: 0; }
.cat-bars li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin-bottom: 10px; font-size: .9rem; }
.cat-bars .cat-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.cat-bars .cat-bar { grid-column: 1 / -1; height: 7px; background: #efe9db; border-radius: 4px; overflow: hidden; }
.cat-bars .cat-bar span { display: block; height: 100%; background: var(--green-2); border-radius: 4px; }
@media (max-width: 900px) {
  .month-grid { grid-template-columns: 1fr; }
  .stat.month-total { grid-column: 1 / -1; }
  .month-list li a .badges { display: none; }
}
@media (max-width: 900px) {
  .month-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .month-stats .stat { padding: 10px; }
  .month-stats .stat:not(.month-total) strong { font-size: 1rem; }
  .month-stats .stat:not(.month-total) .label { font-size: .64rem; }
  .month-stats .stat:not(.month-total) .sub { display: none; }
}

/* ── Kontostand-Prognose (laufender Monat) ── */
.forecast { border-top: 4px solid var(--green-2); background: linear-gradient(160deg, #fffdf8, #f3f6f1); }
.forecast h2 { margin-bottom: 8px; }
.fc-row { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.fc-row small { display: block; }
.fc-row.minus { color: #4c524e; }
.fc-row .fc-now { font-weight: 700; font-size: 1.1rem; }
.fc-row.total { border-bottom: 0; border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 12px; font-weight: 700; font-size: 1.15rem; }
.fc-row.total.neg .num { color: var(--red); }

/* ── Rechnungsliste als Karten im Hochformat (Handy) ── */
@media (max-width: 700px) {
  .head-actions { flex-wrap: wrap; gap: 6px; }
  .head-actions .btn { padding: 7px 11px; font-size: .84rem; }
  .table-wrap:has(.inv-cards) { overflow: visible; }
  .inv-cards, .inv-cards tbody { display: block; width: 100%; }
  .inv-cards thead { display: none; }
  .inv-cards tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "chk who amt" "chk date amt";
    column-gap: 10px; row-gap: 2px; align-items: center;
    padding: 11px 12px 11px 10px; border-bottom: 1px solid var(--line); border-left: 4px solid transparent;
  }
  .inv-cards td { display: block; padding: 0 !important; border: 0 !important; }
  .inv-cards td.chk { grid-area: chk; width: 22px; }
  .inv-cards td.who { grid-area: who; min-width: 0; }
  .inv-cards td.who a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .inv-cards td.who small { display: inline; margin-left: 4px; }
  .inv-cards td.date { grid-area: date; font-size: .82rem; }
  .inv-cards td.date small { display: inline; margin-left: 6px; }
  .inv-cards td.num { grid-area: amt; font-weight: 700; text-align: right; white-space: nowrap; }
  .inv-cards td.col-status, .inv-cards td.hide-s { display: none; }
  .inv-cards tr.row-overdue { border-left-color: var(--red); }
  .inv-cards tr.row-soon { border-left-color: var(--amber); }
  .inv-cards tr.row-transmitted { border-left-color: var(--blue); }
  .inv-cards tr.row-released { border-left-color: #1f5f9e; }
  .inv-cards tr.row-paid { border-left-color: var(--ok); }
}

/* Zahlungsart & automatischer Abzug */
.pay-method { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; margin: 0 0 14px; display: grid; gap: 8px; }
.pay-method legend { font-weight: 600; padding: 0 4px; }
.pm-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-weight: normal; }
.pm-opt input { margin-top: 4px; }
.pm-opt span { display: flex; flex-direction: column; gap: 2px; }
.pm-opt small { color: var(--muted, #6b6b6b); font-size: .82rem; }
.pm-opt:has(input:checked) { border-color: #1f3a34; background: #f2f7f4; }
.pm-ebill:has(input:checked) { border-color: #6a3fa0; background: #f8f5fc; }
.pm-auto:has(input:checked) { border-color: #1d6b57; background: #eef8f4; }
.auto-icon { font-size: .85em; margin-left: 3px; }
.s-auto { background: #e3f3ee; color: #1d6b57; border-color: #bfe2d6; }
.row-auto a, tr.row-auto td:first-child { border-left-color: #3fa58a !important; }
.inv-cards tr.row-auto { border-left-color: #3fa58a; }
.auto-note { background: #eef8f4; border: 1px solid #bfe2d6; border-radius: 10px; padding: 12px 14px; font-size: .92rem; display: flex; flex-direction: column; gap: 6px; }

.warn-note { margin: 8px 0 0; padding: 8px 10px; background: #fff6e5; border: 1px solid #f0d9a8; border-radius: 8px; font-size: .88rem; }

.help-2fa { margin-top: 14px; text-align: center; }
.help-2fa .linkish { font-size: .9rem; }
code.secret { word-break: break-all; }
#zwei-faktor .qr-box { max-width: 220px; margin: 10px 0; background: #fff; padding: 6px; border-radius: 8px; }
