@import url("/static/fonts.css");
/* Fibix: Marineblau, warmes Papierweiss, Gold als Akzent (Funken) */
:root {
  --bg: #f6f5f1; --panel: #ffffff; --panel-2: #faf9f6; --text: #1a1d24; --muted: #5a606e; --line: #e3e0d7; --line-2: #eeece6;
  --field-bg: #fcfbf8; --field-line: #cdc8ba; --field-line-hover: #9fa4b1; --label: #3d4250; --logo: #0d1b3d;
  --accent: #243f8f; --accent-soft: #e8ecf6; --accent-text: #ffffff; --accent-ink: #14265c;
  --brand: #0d1b3d; --brand-text: #ffffff; --brand-muted: #c3cbe0; --gold: #f5c518; --gold-ink: #1a1d24;
  --ok: #1f6b45; --ok-bg: #e6f3ec; --ok-text: #ffffff; --warn: #8a4b08; --warn-line: #f0c27a; --warn-bg: #fef3e2;
  --err: #b42318; --err-line: #f3a39b; --err-bg: #fdecea; --dark: #0d1b3d; --dark-text: #ffffff;
  --mark: #fff0a8; --hl: rgba(36, 63, 143, .18); --shadow: 0 1px 2px rgba(26, 29, 36, .05);
  --shadow-lg: 0 10px 30px rgba(13, 27, 61, .16); --radius: 12px; --head: 60px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c1120; --panel: #151b2c; --panel-2: #1a2134; --text: #e8eaf0; --muted: #a3aabb; --line: #2a3247; --line-2: #222a3d;
    --field-bg: #0f1526; --field-line: #3c4762; --field-line-hover: #66718c; --label: #c4cad8; --logo: #f2f4f8;
    --accent: #8fb0ff; --accent-soft: #1c2a4d; --accent-text: #0b1220; --accent-ink: #c2d3ff;
    --brand: #080e1f; --brand-text: #ffffff; --brand-muted: #a9b3cc;
    --ok: #5fd39a; --ok-bg: #11301f; --ok-text: #0b1a12; --warn: #f2c063; --warn-line: #6b5520; --warn-bg: #2f2510;
    --err: #ff8a80; --err-line: #6d2a25; --err-bg: #3a1714; --dark: #e8eaf0; --dark-text: #0c1120;
    --mark: #5a4a00; --hl: rgba(143, 176, 255, .28); --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5); }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* sonst gewinnt z. B. .banner { display: flex } */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }  /* Platz für den Scrollbalken immer frei: Kopfzeile springt nicht */
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: 12.5px; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kopfzeile: Marineblau mit Wortmarke */
header { background: var(--brand); color: var(--brand-text); position: sticky; top: 0; z-index: 20; }
header .wrap { display: flex; gap: 20px; align-items: center; min-height: var(--head); }
.brand { display: flex; align-items: baseline; gap: 10px; color: var(--brand-text); white-space: nowrap; }
.brand-ver { font-size: 11px; font-weight: 500; color: var(--brand-muted); }
.brand:hover { text-decoration: none; }
.logo { display: inline-flex; align-items: baseline; font-weight: 700; font-size: 26px; letter-spacing: -.04em; line-height: 1; }
.logo-i { position: relative; }
.logo-i svg { position: absolute; left: 50%; top: -.12em; width: .34em; height: .34em; transform: translateX(-50%); }
.spark-a { fill: #8fb0ff; } .spark-b { fill: var(--gold); }
.brand:hover .logo-i svg { animation: twinkle 1.6s ease-in-out infinite; }
@keyframes twinkle { 50% { transform: translateX(-50%) scale(.7) rotate(45deg); } }
header nav { display: flex; gap: 2px; }
header nav a { color: var(--brand-muted); padding: 8px 12px; border-radius: 8px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; position: relative; }
header nav a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; color: var(--brand-text); }
header nav a.active { color: var(--brand-text); background: rgba(255, 255, 255, .1); }
header nav a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--gold); }
.nav-count { font-size: 12px; font-variant-numeric: tabular-nums; background: var(--gold); color: var(--gold-ink); font-weight: 600; border-radius: 999px; padding: 0 7px; line-height: 18px; }
header .right { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: 13px; white-space: nowrap; }
.pill-test { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); padding: 3px 10px; border-radius: 999px; font-weight: 600; font-size: 12px; }
header .me, header .company-name { color: var(--brand-text); }
header .me-text small, header .logout { color: var(--brand-muted); }
header .logout:hover { color: var(--brand-text); }
header .avatar { background: var(--gold); color: var(--gold-ink); }
header .company-switch select { background-color: rgba(255, 255, 255, .08); color: var(--brand-text); border-color: rgba(255, 255, 255, .22); }
header .company-switch select option { color: #1a1d24; background: #ffffff; }
.me { display: flex; align-items: center; gap: 8px; color: var(--text); }
.me:hover { text-decoration: none; }
.me-text { display: flex; flex-direction: column; line-height: 1.2; }
.me-text b { font-weight: 600; } .me-text small { color: var(--muted); font-size: 12px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--dark); color: var(--dark-text); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: 0 0 32px; }
.avatar.off { background: var(--line); color: var(--muted); }
.logout { color: var(--muted); }

.wrap { max-width: 1440px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 20px; padding-bottom: 48px; }
h1 { font-size: 26px; margin: 0; letter-spacing: -.025em; }
h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
h2 .muted { font-weight: 500; }
.lead { margin: 4px 0 0; font-size: 15px; }
.page-head { display: flex; gap: 12px 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.narrow { max-width: 860px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card .pad, .pad { padding: 14px 18px; }
.card-head { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.card-head .push, .card-head > :last-child.push { margin-left: auto; }
.card-head.pad { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.err { color: var(--err); } .warn { color: var(--warn); } .ok { color: var(--ok); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.struck { color: var(--muted); text-decoration: line-through; }

/* Meldungen */
.flash, .banner { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.warn, .banner { background: var(--warn-bg); color: var(--warn); }
.flash.error { background: var(--err-bg); color: var(--err); }
.banner.block { display: block; } .banner ul { margin: 6px 0 0; padding-left: 18px; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--panel-2); }
tbody tr:hover { background: var(--panel-2); }
td.num, th.num { white-space: nowrap; }
.table-scroll { overflow-x: auto; }

/* Status */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); white-space: nowrap; border: 1px solid var(--line); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.plain.err { color: var(--err); }
.badge.review { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.vorschlag { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.badge.freigegeben { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.fehler { background: var(--err-bg); color: var(--err); border-color: transparent; }
.badge.neu, .badge.in-arbeit { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.src { font-size: 10.5px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); padding: 0 6px; border-radius: 999px; font-weight: 500; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; display: inline-block; background: transparent; }
.dot.warn { background: #c2410c; } .dot.accent { background: var(--accent); } .dot.ok { background: var(--ok); } .dot.todo { background: #9ca3af; }

/* Buttons und Felder */
button, .btn { font: inherit; font-size: 14px; font-weight: 500; border: 1px solid var(--line); background: var(--panel); color: var(--text); min-height: 40px; padding: 0 15px; border-radius: 9px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; justify-content: center; white-space: nowrap; }
button:hover, .btn:hover { background: var(--panel-2); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.primary:hover, .btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
button.success { background: var(--ok); color: var(--ok-text); border-color: var(--ok); }
button.success:hover { filter: brightness(1.08); background: var(--ok); }
button.danger { color: var(--err); }
button:disabled, .btn[aria-disabled=true] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn.icon { padding: 0; width: 40px; font-size: 18px; }
.small-btn { min-height: 34px; font-size: 13px; padding: 0 12px; }
kbd { font: 11px ui-monospace, monospace; padding: 1px 5px; border-radius: 4px; border: 1px solid currentColor; opacity: .7; }
.field { min-width: 0; }
select { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
/* WebKit rechnet den abgeschnittenen Text langer Auswahlfelder zur Seitenbreite - nie seitlich verschiebbar */
main.wrap { overflow-x: clip; }
input, select, textarea { font: inherit; color: var(--text); background: var(--field-bg); border: 1px solid var(--field-line); border-radius: 9px; padding: 8px 11px; width: 100%; min-height: 40px; transition: border-color .12s, box-shadow .12s, background .12s; }
input:hover, select:hover, textarea:hover { border-color: var(--field-line-hover); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background-color: var(--panel); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, select:disabled, textarea:disabled, input[readonly], textarea[readonly] { background-color: var(--panel-2); border-color: var(--line); border-style: dashed; color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; padding: 0; flex: 0 0 18px; accent-color: var(--accent); margin: 0; box-shadow: none; }
label.check input[type=radio] { margin-top: 1px; }
label.check:has(input:disabled) { cursor: default; }
label.check:has(input:disabled:not(:checked)) { color: var(--muted); }
input[type=file] { min-height: 0; }
label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--label); margin-bottom: 5px; font-weight: 600; }
label.check { color: var(--text); font-size: 14px; font-weight: 400; margin: 0; cursor: pointer; gap: 8px; min-height: 32px; }
label.check.small { font-size: 13px; }
.field { margin-bottom: 12px; }
.field-note { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; align-items: end; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-actions { margin-top: 6px; }
.with-unit { display: flex; gap: 6px; align-items: center; }
.with-unit .unit { flex: 0 0 auto; width: 62px; text-align: center; }
.with-unit.right .unit { width: auto; color: var(--muted); }
details.tech { margin: 4px 0 10px; }
details summary { cursor: pointer; color: var(--muted); font-weight: 500; }
details.tech[open] summary { margin-bottom: 10px; }
.empty { text-align: center; padding: 28px; color: var(--muted); }
.test-result { font-size: 13px; margin-left: 4px; white-space: normal; }
pre { background: var(--panel-2); border: 1px solid var(--line); padding: 12px; border-radius: 9px; overflow-x: auto; font-size: 12px; margin: 0; }

/* Suchauswahl */
.combo { position: relative; }
.combo-native { display: none !important; }
.combo-input { padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; text-overflow: ellipsis; }
.combo.open .combo-input { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.combo-list { display: none; width: max-content; position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow-y: auto; min-width: 100%;
  max-width: min(520px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; }
.combo.open .combo-list { display: block; }
.combo-opt { padding: 8px 10px; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 14px; }
.combo-opt small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.combo-opt.active { background: var(--accent-soft); }
.combo-opt.selected span { font-weight: 600; }
.combo-opt.selected::after { content: "✓"; color: var(--accent); margin-left: auto; order: 1; }
.combo-opt mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.combo-opt:has(.combo-guide) { flex-wrap: wrap; }
.combo-opt small.combo-guide { flex-basis: 100%; white-space: normal; line-height: 1.35; order: 2; }
.combo-group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px 4px; font-weight: 600; }
.combo-empty { padding: 8px 10px; color: var(--muted); font-size: 13px; }
.combo-opt.combo-create { color: var(--accent-ink); font-weight: 600; border-top: 1px solid var(--line); border-radius: 0 0 7px 7px; margin-top: 4px; }
.new-supplier { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: 14px; }
.new-supplier small { display: block; margin-top: 2px; }
.new-supplier .small-btn { flex: none; }
.paid-with { display: flex; gap: 8px; flex-wrap: wrap; } .paid-with select { flex: 1 1 220px; } .paid-with input { width: auto; }
.booking-info { margin: 8px 0 0; }

/* --- Eingang ----------------------------------------------------------- */
.inbox-head .actions input[type=search] { width: 280px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel); }
.seg a { padding: 0 14px; min-height: 40px; display: inline-flex; align-items: center; color: var(--text); font-size: 14px; }
.seg a:hover { text-decoration: none; background: var(--panel-2); }
.seg a.on { background: var(--dark); color: var(--dark-text); }
.drop { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 12px 16px; background: var(--panel); color: var(--muted); font-size: 14px; cursor: pointer; margin: 0 0 18px; transition: border-color .15s, background .15s; }
.drop b { color: var(--accent); font-weight: 600; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input[type=file] { display: none; }
.group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; box-shadow: var(--shadow); overflow: hidden; }
.group-head { display: flex; align-items: center; gap: 10px 12px; padding: 14px 18px; flex-wrap: wrap; }
.group-head h2 { margin: 0; font-size: 16px; }
.group-head > .btn, .group-head > .actions { margin-left: auto; }
.rows { border-top: 1px solid var(--line-2); }
.row { display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(0, 2fr) 120px 130px 52px; gap: 6px 16px; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid var(--line-2); color: var(--text); }
#batch .row { grid-template-columns: 28px minmax(180px, 1.1fr) minmax(0, 2fr) 120px 130px 52px; }
.rows .row:last-child { border-bottom: 0; }
a.row:hover { background: var(--panel-2); text-decoration: none; }
.row b { font-weight: 600; }
.row a { color: var(--text); }
.c-sup { min-width: 0; display: flex; flex-direction: column; }
.c-sup b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-sup > a { min-width: 0; max-width: 100%; }
.c-sup small, .c-why small { font-size: 12px; color: var(--muted); }
.c-why { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; font-size: 14px; }
#batch .c-why { flex-direction: column; gap: 0; }
.chip-err, .chip-warn, .chip-more { font-size: 13px; padding: 2px 10px; border-radius: 999px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-err { background: var(--err-bg); color: var(--err); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-more { background: var(--panel-2); color: var(--muted); }
.c-due { font-size: 13px; color: var(--muted); white-space: nowrap; }
.c-due.soon { color: var(--err); font-weight: 600; }
.c-amt { font-weight: 500; white-space: nowrap; }
.who { display: inline-grid; place-items: center; min-width: 34px; height: 28px; padding: 0 8px; border-radius: 999px; background: var(--line-2); color: var(--muted); font-size: 12px; font-weight: 600; }
.who.me { background: var(--dark); color: var(--dark-text); }
.c-who { text-align: right; }
.conf-bar { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; color: var(--text); }
.conf-bar i { width: 44px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; display: inline-block; position: relative; }
.conf-bar i b { position: absolute; inset: 0 auto 0 0; background: var(--ok); }
.empty-line { margin: 0; padding: 14px 18px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 14px; }
.group-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.small-group { padding: 14px 18px; margin-bottom: 0; }
.small-group h2 { font-size: 14px; margin: 0 0 6px; display: inline-flex; }
.small-group summary { list-style: none; } .small-group summary::-webkit-details-marker { display: none; }
.small-group summary h2::after { content: "▸"; margin-left: 6px; } .small-group details[open] summary h2::after { content: "▾"; }
.mini { display: flex; gap: 12px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line-2); color: var(--text); font-size: 14px; }
.mini .ellipsis { flex: 1; }
.mini:hover { text-decoration: none; background: var(--panel-2); }
.small-group .note { margin: 10px 0 0; }
.show-sm-inline { display: none; }

/* --- Prüfen ------------------------------------------------------------ */
body.has-actionbar main.wrap { padding-bottom: 110px; }
.review-head { align-items: center; flex-wrap: nowrap; }
.review-head .title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.review-head h1 { font-size: 21px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: relative; }
.menu summary { list-style: none; width: 40px; padding: 0; font-size: 18px; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 6px; min-width: 260px; display: flex; flex-direction: column; }
.menu-list a, .menu-list button { display: flex; justify-content: flex-start; width: 100%; border: 0; background: transparent; padding: 0 12px; min-height: 40px; align-items: center; border-radius: 6px; color: var(--text); font-size: 14px; }
.menu-list a:hover, .menu-list button:hover { background: var(--panel-2); text-decoration: none; }
.menu-list .danger { color: var(--err); }

.review-grid { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 18px; align-items: start; }
.pdf-pane { position: sticky; top: calc(var(--head) + 12px); background: var(--line-2); border-radius: var(--radius); padding: 10px; }
.pdf-toggle > summary { display: none; }
.pdf-tools { display: flex; justify-content: space-between; gap: 10px; padding: 0 4px 8px; }
.pages { max-height: calc(100vh - var(--head) - 150px); overflow: auto; display: flex; flex-direction: column; gap: 10px; border-radius: 6px; scroll-behavior: smooth; }
.page { position: relative; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .14); border-radius: 3px; width: 100%; flex: 0 0 auto; }
.page img { display: block; width: 100%; height: 100%; border-radius: 3px; }
.hl { position: absolute; background: var(--hl); outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; pointer-events: none; animation: hl-in .25s ease-out; }
@keyframes hl-in { from { outline-offset: 8px; opacity: 0; } }

.beleg { min-width: 0; }
.general { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.general li { font-size: 13px; padding: 4px 12px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); }
.general li.err { background: var(--err-bg); color: var(--err); font-weight: 500; }

/* Felder: immer als Feld erkennbar (Rahmen + leichte Füllung); farbig, wenn etwas zu tun ist */
.fld { display: flex; flex-direction: column; min-width: 0; }
.fld > label { margin: 0 0 3px 2px; }
.fld input::placeholder { color: var(--muted); opacity: .7; }
.fld.st-warn input:not([type=checkbox]), .fld.st-warn select, .fld.st-warn .combo-input { border-color: var(--warn-line); background-color: var(--warn-bg); }
.fld.st-err input:not([type=checkbox]), .fld.st-err select, .fld.st-err .combo-input { border-color: var(--err-line); background-color: var(--err-bg); }
.note { font-size: 12px; color: var(--muted); margin: 2px 0 0 8px; min-height: 0; line-height: 1.35; }
.note:empty { display: none; }
.note.ok { color: var(--ok); } .note.warn { color: var(--warn); font-weight: 500; } .note.err { color: var(--err); font-weight: 500; }
.head-card { padding: 12px; }
.head-card .fld.wide { margin-bottom: 6px; }
.head-card #supplier + .combo .combo-input, .head-card .combo .combo-input { font-weight: 600; font-size: 16px; }
.facts { display: block; font-size: 12.5px; color: var(--muted); margin: 3px 0 0 8px; }
.facts b.err { color: var(--err); } .facts b.warn { color: var(--warn); }
.recode { margin: 4px 0 0 6px; color: var(--muted); }
.head-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 8px; margin-top: 8px; }
.head-grid .wide { grid-column: 1 / -1; }
.head-grid .wide2 { grid-column: span 2; }
.head-grid .amount input[name=total_amount] { font-weight: 600; font-size: 16px; text-align: right; }
.head-grid .amount .unit { width: 58px; }

.pos-table { container-type: inline-size; }
.pos-row { display: grid; grid-template-columns: 26px minmax(0, 1.3fr) minmax(0, 1.5fr) minmax(0, 1.3fr) minmax(0, .9fr) 104px 72px; gap: 4px 8px; align-items: start; padding: 8px 4px; }
.with-cc2 .pos-row { grid-template-columns: 26px minmax(0, 1.2fr) minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, .9fr) 104px 72px; }
/* Firma ohne Kostenstellen und/oder ohne MWST: Spalten fallen weg */
.no-cc .pos-row, .no-tax .pos-row { grid-template-columns: 26px minmax(0, 1.5fr) minmax(0, 1.7fr) minmax(0, 1.1fr) 104px 72px; }
.no-cc.no-tax .pos-row { grid-template-columns: 26px minmax(0, 1.6fr) minmax(0, 2fr) 104px 72px; }
.with-cc2.no-tax .pos-row { grid-template-columns: 26px minmax(0, 1.3fr) minmax(0, 1.5fr) minmax(0, 1.2fr) minmax(0, 1fr) 104px 72px; }
.pos-th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--panel-2); border-radius: 8px; padding: 6px 4px; }
.pos-th span { padding-left: 8px; } .pos-th span:first-child { padding-left: 0; }
.pos { border-top: 1px solid var(--line-2); }
.pos.removed { opacity: .4; }
.pos-no { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 8px; }
.sm-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.c-amt input { text-align: right; }
.c-tools { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding-top: 4px; }
.why-btn { width: 32px; min-height: 32px; height: 32px; padding: 0; border-radius: 50%; color: var(--accent); font-weight: 700; }
.why-btn[aria-expanded=true] { background: var(--accent-soft); border-color: var(--accent-soft); }
.del { margin: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--muted); border: 1px solid transparent; }
.del:hover { border-color: var(--line); color: var(--err); }
.del input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.del:has(input:checked) { background: var(--err-bg); color: var(--err); }
.del:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-soft); }
.why { margin: 0 4px 10px 34px; padding: 10px 14px; background: var(--accent-soft); border-radius: 8px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; font-size: 13px; line-height: 1.45; }
.why b { display: block; font-size: 12px; color: var(--accent-ink); margin-bottom: 2px; }
.why .err, .why .warn { grid-column: 1 / -1; font-weight: 500; }
.sumline { display: flex; justify-content: flex-end; gap: 14px; align-items: center; padding: 10px 6px 0; font-size: 14px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.sumline #sum { font-weight: 600; }
.sumline .diff { color: var(--err); font-weight: 600; }
.sumline .okay { color: var(--ok); font-weight: 500; }
/* Neben dem PDF ist die Spalte schmal: Text und Betrag oben, Konto/KST/MWST darunter */
@container (max-width: 979px) {
  .pos-th { display: none; }
  .pos-row { grid-template-columns: 26px minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, .6fr) 110px 72px; grid-template-areas: "no text text text amt tools" ". acc cc1 tax tax tax"; padding: 10px 2px; }
  .with-cc2 .pos-row { grid-template-areas: "no text text text amt tools" ". acc cc1 cc2 tax tax"; }
  .no-cc .pos-row, .no-tax .pos-row, .no-cc.no-tax .pos-row, .with-cc2.no-tax .pos-row { grid-template-columns: 26px minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, .6fr) 110px 72px; }
  .no-cc .pos-row { grid-template-areas: "no text text text amt tools" ". acc acc tax tax tax"; }
  .no-tax .pos-row { grid-template-areas: "no text text text amt tools" ". acc cc1 cc1 cc1 cc1"; }
  .with-cc2.no-tax .pos-row { grid-template-areas: "no text text text amt tools" ". acc cc1 cc2 cc2 cc2"; }
  .no-cc.no-tax .pos-row { grid-template-areas: "no text text text amt tools" ". acc acc acc acc acc"; }
  .pos-no { grid-area: no; } .c-text { grid-area: text; } .c-acc { grid-area: acc; } .c-cc1 { grid-area: cc1; } .c-cc2 { grid-area: cc2; }
  .c-tax { grid-area: tax; } .c-amt { grid-area: amt; } .c-tools { grid-area: tools; padding-top: 22px; }
  .sm-label { position: static; width: auto; height: auto; clip: auto; overflow: visible; margin: 0 0 1px 2px; }
  .why { margin-left: 30px; }
}
@container (max-width: 560px) {
  .pos-row { grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: "no text tools" ". acc acc" ". cc1 cc1" ". tax tax" ". amt amt"; }
  .with-cc2 .pos-row { grid-template-areas: "no text tools" ". acc acc" ". cc1 cc1" ". cc2 cc2" ". tax tax" ". amt amt"; }
  .no-cc .pos-row, .no-tax .pos-row, .no-cc.no-tax .pos-row, .with-cc2.no-tax .pos-row { grid-template-columns: 26px minmax(0, 1fr) auto; }
  .no-cc .pos-row { grid-template-areas: "no text tools" ". acc acc" ". tax tax" ". amt amt"; }
  .no-tax .pos-row { grid-template-areas: "no text tools" ". acc acc" ". cc1 cc1" ". amt amt"; }
  .with-cc2.no-tax .pos-row { grid-template-areas: "no text tools" ". acc acc" ". cc1 cc1" ". cc2 cc2" ". amt amt"; }
  .no-cc.no-tax .pos-row { grid-template-areas: "no text tools" ". acc acc" ". amt amt"; }
  .c-amt input { text-align: left; }
  .why { grid-template-columns: minmax(0, 1fr); }
}
.tabs-card { padding: 0 0 4px; }
.tabs { display: flex; gap: 2px 18px; flex-wrap: wrap; padding: 0 18px; border-bottom: 1px solid var(--line-2); }
.tabs [role=tab] { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 0 2px; min-height: 46px; color: var(--muted); }
.tabs [role=tab]:hover { color: var(--text); background: transparent; }
.tabs [role=tab][aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { padding: 12px 18px; }
.tab-panel p:first-child { margin-top: 0; }
.guide-text { line-height: 1.5; }
table.log td { padding: 5px 8px; } table.log td:first-child { white-space: nowrap; width: 1%; }
.flow-card .card-head { margin-bottom: 8px; }
.assign { margin: 0 0 0 auto; gap: 8px; }
.assign select { width: auto; min-width: 180px; }
.flow { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.flow li { padding: 5px 12px; border-radius: 999px; }
.flow li.done { background: var(--ok-bg); color: var(--ok); }
.flow li.now { background: var(--dark); color: var(--dark-text); }
.flow li.later { border: 1px dashed var(--line); color: var(--muted); }
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 18; background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0, 0, 0, .06); }
.actionbar .wrap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.actionbar .spacer { flex: 1; }
.blocker { font-size: 14px; font-weight: 500; margin-left: 6px; min-width: 0; }
.blocker.err { color: var(--err); } .blocker.warn { color: var(--warn); } .blocker.ok { color: var(--ok); }

/* --- Einrichtung ------------------------------------------------------- */
.setup { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.setup-nav { flex: 1 1 210px; max-width: 250px; display: flex; flex-direction: column; gap: 2px; }
.setup-nav .nav-head { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px 4px; }
.setup-nav a { display: flex; align-items: center; gap: 10px; padding: 0 12px; min-height: 42px; border-radius: 8px; color: var(--text); font-size: 14px; }
.setup-nav a:hover { background: var(--line-2); text-decoration: none; }
.setup-nav a.on { background: var(--panel); box-shadow: 0 0 0 1px var(--line); font-weight: 600; }
.setup-main { flex: 999 1 560px; min-width: 0; }
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.step-badge { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: 0 0 36px; background: var(--panel-2); color: var(--muted); }
.step-badge.ok { background: var(--ok-bg); color: var(--ok); } .step-badge.warn { background: var(--warn-bg); color: #c2410c; }
.step-body { flex: 1 1 300px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.step-body b { font-size: 16px; }
.step-issue { margin-top: 6px; font-size: 13px; color: var(--warn); background: var(--warn-bg); padding: 5px 10px; border-radius: 6px; align-self: flex-start; }
.step-issue.soft { background: var(--panel-2); color: var(--muted); }
.plain-list { margin: 0; padding-left: 18px; font-size: 14px; } .plain-list li { margin: 4px 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--text); }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile.static:hover { border-color: var(--line); }
.tile.on { border: 2px solid var(--accent); padding: 11px 13px; }
.tile span { font-size: 13px; color: var(--muted); } .tile b { font-size: 20px; } .tile small { font-size: 12px; }
.card-head input.push { width: 280px; max-width: 100%; margin-left: auto; }
.guide-choose { display: flex; gap: 8px 16px; align-items: flex-end; flex-wrap: wrap; }
.guide-choose .field { margin: 0; flex: 0 1 300px; }
.guide-choose > span { padding-bottom: 10px; }
.guide-load { display: grid; grid-template-columns: 180px 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 14px; }
.guide-load .field { margin: 0; }
.guide-row summary, .guide-hits summary { cursor: pointer; color: var(--text); font-weight: 400; }
.guide-row p, .guide-hits p { margin: 6px 0 2px; color: var(--muted); line-height: 1.45; }
.guide-hits details { padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.guide-link { width: 84px; text-align: right; padding: 5px 8px; min-height: 34px; }
.guide-link.invalid { border-color: var(--err); }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input:not([type=checkbox]) { width: 280px; }
.user-row { border-bottom: 1px solid var(--line-2); }
.user-row:last-child { border-bottom: 0; }
.user-row > summary { display: flex; gap: 14px; align-items: center; padding: 12px 18px; list-style: none; color: var(--text); flex-wrap: wrap; }
.user-row > summary::-webkit-details-marker { display: none; }
.user-row > summary:hover { background: var(--panel-2); }
.user-row .avatar { width: 40px; height: 40px; flex-basis: 40px; font-size: 13px; }
.user-name { flex: 1 1 200px; display: flex; flex-direction: column; min-width: 0; }
.user-edit { padding: 4px 18px 14px 72px; display: grid; gap: 4px; }
.user-row.inactive .user-name b { color: var(--muted); }
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.role-cards .card { margin: 0; } .role-cards p { margin: 4px 0 0; }
.role-cards .later { border-style: dashed; box-shadow: none; }
.facts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; margin: 0; }
.facts-grid dt { font-size: 12.5px; color: var(--muted); font-weight: 500; } .facts-grid dd { margin: 2px 0 0; font-size: 14px; }
.note-line { font-size: 13px; margin: 0 0 10px; padding: 6px 10px; border-radius: 6px; }
.note-line.warn { background: var(--warn-bg); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }

/* --- Schmale Bildschirme ----------------------------------------------- */
@media (max-width: 1100px) {
  .review-grid { grid-template-columns: minmax(0, 1fr); }
  .pdf-pane { position: static; }
  .pdf-toggle > summary { display: flex; gap: 8px; align-items: center; padding: 4px 6px 8px; color: var(--text); font-weight: 600; }
  .pages { max-height: 75vh; }
  .row, #batch .row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "sup amt" "why why" "due who"; gap: 6px 12px; }
  #batch .row { grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: "chk sup amt" "chk why why" "chk due who"; }
  .c-sup { grid-area: sup; } .c-why { grid-area: why; } .c-due { grid-area: due; } .c-amt { grid-area: amt; } .c-who { grid-area: who; } .c-check { grid-area: chk; align-self: start; padding-top: 2px; }
  .show-sm-inline { display: inline; }
  /* Name bis zwei Zeilen statt über den Betrag; Hinweise umbrechen statt abschneiden */
  .c-sup b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
  #batch .c-why { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .c-why .chip-err, .c-why .chip-warn, .c-why .chip-more { white-space: normal; border-radius: 8px; line-height: 1.35; padding: 3px 9px; }
}
@media (max-width: 1000px) {
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .hide-sm { display: none; }
  input, .combo-input, select, textarea { font-size: 16px; }  /* iOS zoomt sonst beim Antippen */
  kbd { display: none; }
  .setup-nav { max-width: none; flex-direction: row; flex-wrap: wrap; flex-basis: 100%; }
  .setup-nav .nav-head { display: none; }
  .setup-nav a { min-height: 38px; background: var(--panel); border: 1px solid var(--line); }
  .setup-nav a.on { box-shadow: none; border-color: var(--accent); }
  .guide-load { grid-template-columns: 1fr; }
  .user-edit { padding-left: 18px; }
}
@media (max-width: 700px) {
  .wrap { padding: 0 14px; }
  main.wrap { padding-top: 14px; }
  .hide-xs { display: none !important; }
  header { position: static; }
  header .wrap { gap: 6px 12px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .brand-name, .me-text, .pill-test { display: none; }
  header nav a { padding: 8px 10px; }
  header .right { gap: 10px; }
  h1 { font-size: 20px; }
  .inbox-head .actions, .inbox-head .actions input[type=search] { width: 100%; }
  .group-head { padding: 12px 14px; }
  .group-head > .btn, .group-head > .actions { margin-left: 0; width: 100%; }
  .group-head > .btn { justify-content: center; }
  .group-head > .actions button { flex: 1; }
  .row { padding: 12px 14px; }
  .group-pair { grid-template-columns: minmax(0, 1fr); }
  .review-head h1 { font-size: 17px; white-space: normal; }
  .head-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .head-grid .wide2 { grid-column: 1 / -1; }
  .actionbar .wrap { padding-top: 8px; padding-bottom: 8px; gap: 6px; }
  .blocker { order: -1; flex-basis: 100%; margin: 0 0 2px; font-size: 13px; }
  .actionbar .spacer { display: none; }
  .actionbar button { flex: 1; }
  body.has-actionbar main.wrap { padding-bottom: 140px; }
  .card { padding: 14px; }
  .card-head input.push { width: 100%; }
  .assign { margin-left: 0; width: 100%; } .assign select { flex: 1; }
}

/* --- Firmen und Buchhaltung --------------------------------------------- */
.company-switch select { min-height: 34px; padding: 4px 28px 4px 10px; font-size: 13px; width: auto; max-width: 220px; }
.company-name { font-weight: 600; font-size: 13px; color: var(--text); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.nav-btn { margin-top: 10px; justify-content: center; }
.period { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.period input[type=date] { width: auto; }
.period select { width: auto; }
.period .q { width: 220px; }
.card-head .q { max-width: 260px; }
.nowrap { white-space: nowrap; }
table.novat .vatcol { display: none !important; }
.plain-link { color: inherit; }
.struck-row td { color: var(--muted); }
.struck-row td:nth-child(3) a { text-decoration: line-through; }
tr.reversed .j-no > a:first-child, tr.reversed .nr > a:first-child { text-decoration: line-through; }
.storno-ref { display: inline-block; margin-left: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; padding: 0 6px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); text-decoration: none; }
.storno-ref:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
tr.grp td { font-weight: 600; background: var(--panel-2); }
tr.grp-1 td, tr.grp-0 td { border-top: 1px solid var(--line); }
table.report td, table.report th { padding: 7px 14px; }
table.report tfoot th { background: var(--panel-2); color: var(--text); font-size: 14px; text-transform: none; letter-spacing: 0; }
table.report tr.result th { font-size: 15px; }
table.report.staged tbody th { background: none; color: var(--text); font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 700;
  border-top: 2px solid var(--text); }
table.report.staged tr.result th { font-size: 16px; border-top: 2px solid var(--text); border-bottom: 3px double var(--text); }
table.report.staged .pct-col { width: 70px; color: var(--muted); }
table.lines td { padding: 6px 6px; }
table.lines input.num { text-align: right; }
tfoot td { border-bottom: 0; }
.report-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form input[name=name] { flex: 1 1 220px; width: auto; }
.inline-form select { width: auto; }
td.form-row { padding: 10px 14px; }
.grid3.tight { gap: 0 10px; grid-template-columns: 1fr 2fr; }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.grid3.tight .span2 { grid-column: auto; }
@media (max-width: 800px) { .report-pair { grid-template-columns: 1fr; } }
@media print {
  header, .setup-nav, .page-head .actions, .period, .flash, .banner { display: none !important; }
  body { background: #fff; } .card { box-shadow: none; border: 0; }
}
.roles { display: flex; gap: 6px 22px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; padding: 10px 12px; background: var(--panel-2); border-radius: 9px; }
fieldset.role-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 12px; margin: 0 0 12px; min-width: 0; }
fieldset.role-box legend { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 4px; }
fieldset.role-box:disabled { opacity: .45; }
.hint { max-width: 640px; line-height: 1.35; margin-top: 2px; }
.uid-lookup { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.uid-lookup .inline-form input { flex: 1 1 260px; width: auto; }
.uid-results { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.uid-results:empty { display: none; }
.uid-hit { display: flex; flex-direction: column; align-items: flex-start; text-align: left; white-space: normal; min-height: 0; padding: 7px 10px; gap: 1px; }
table.quick td { padding: 6px 5px; vertical-align: top; }
table.quick input[type=date] { padding: 8px 6px; }
table.quick .taxinfo, table.quick small.err { display: block; font-size: 11.5px; margin-top: 2px; text-align: right; }
table.quick small.err { text-align: left; }
tr.row-err td { background: var(--err-bg); }
tr.subline td { border-bottom: 0; padding-top: 2px; padding-bottom: 2px; }
.actions .spacer { flex: 1; }
/* Zeilenerfassung: Auswahllisten dürfen über die Tabelle hinausragen */
.quick-wrap { overflow: visible; }
@media (max-width: 1000px) { .quick-wrap { overflow-x: auto; } }
#quick.card.flush { overflow: visible; }

/* --- Scannen (aus paperless-jev) --- */
svg.i { width: 1.1em; height: 1.1em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -.18em; }
.rv-close { width: 2.2rem; height: 2.2rem; border-radius: .6rem; display: grid; place-items: center; flex: none; }
.rv-headtext { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rv-headtext strong { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.rv-headtext small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-link { all: unset; cursor: pointer; color: var(--accent); text-decoration: underline; text-underline-offset: .2em; }
.rv-btn.primary { display: flex; gap: .45rem; justify-content: center; align-items: center; font-weight: 700; background: var(--accent); border: 1px solid var(--accent); color: var(--accent-text); border-radius: 10px; min-height: 48px; cursor: pointer; font: inherit; font-weight: 700; }
/* --- Scannen ---------------------------------------------------------------------------- */
.sc-view { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; max-width: 46rem; margin: 0 auto; display: flex; flex-direction: column; }
.sc-view[hidden] { display: none; }
.sc-head { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; background: var(--accent); color: #fff; }
.sc-head .rv-close { background: rgba(255, 255, 255, .15); border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; text-decoration: none; margin: 0; padding: 0; width: 2.2rem; }
.sc-head .rv-headtext small { color: rgba(255, 255, 255, .8); }
.sc-head .rv-headtext strong { font-size: 1.1rem; }
.sc-body { padding: .8rem 1.1rem 1rem; }
.sc-empty { display: grid; gap: .8rem; margin: .4rem 0 .6rem; }
.sc-big { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; padding: 1.4rem 1rem; border-radius: var(--radius); background: var(--accent); color: #fff; }
.sc-big .i { width: 2rem; height: 2rem; }
.sc-big span { font-weight: 700; font-size: 1.05rem; }
.sc-big small { opacity: .85; font-size: .8rem; }
.sc-big.secondary { background: var(--accent-soft); color: var(--accent-ink); }
.sc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: .8rem; margin-bottom: .6rem; }
.sc-page { position: relative; aspect-ratio: 3 / 4; border-radius: .4rem; background: #fff; box-shadow: 0 4px 12px -6px rgba(0, 0, 0, .45); border: 1px solid var(--line); }
.sc-page img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: .4rem; cursor: pointer; display: block; }
.sc-page > b { position: absolute; left: .35rem; bottom: .3rem; background: rgba(0, 0, 0, .6); color: #fff; font-size: .72rem; padding: 0 .4rem; border-radius: .6rem; }
.sc-x { all: unset; cursor: pointer; position: absolute; top: -.5rem; right: -.5rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; font-size: .75rem; color: var(--muted); }
.sc-move { position: absolute; right: .3rem; bottom: .3rem; display: flex; gap: .25rem; }
.sc-move button { all: unset; cursor: pointer; width: 1.6rem; height: 1.6rem; border-radius: .4rem; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; font-size: 1.1rem; }
.sc-file { display: flex; align-items: center; justify-content: center; padding: .5rem; font-size: .75rem; color: var(--muted); text-align: center; word-break: break-all; }
.sc-add { all: unset; box-sizing: border-box; cursor: pointer; aspect-ratio: 3 / 4; border-radius: .4rem; border: 2px dashed var(--line); display: grid; place-items: center; font-size: 2rem; color: var(--accent-ink); }
.sc-hidden { display: none; }
.sc-foot { padding: .7rem 1.1rem 1rem; border-top: 1px solid var(--line); background: var(--panel); }
.sc-upload { width: 100% !important; }
.sc-upload:disabled { opacity: .45; }
.sc-alt { text-align: center; font-size: .82rem; color: var(--muted); margin-top: .6rem; }
.sc-alt label { display: inline; margin: 0; }
/* Dateien hineinziehen: der Hinweis steht nur in der Desktop-Ansicht */
.sc-drophint { text-align: center; font-size: .8rem; color: var(--muted); }
.sc-paid { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.sc-paid > label { font-weight: 600; font-size: 14px; }
.sc-paidrow { display: flex; flex-wrap: wrap; gap: 8px; }
.sc-paidrow select { flex: 1 1 220px; width: auto; }
.sc-paidrow input[type=date] { flex: 0 1 170px; width: auto; }
.sc-view[data-drop] { position: relative; }
.sc-dropping .sc-view[data-drop]::after { content: attr(data-drop); position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; pointer-events: none; border: 3px dashed var(--accent-ink); border-radius: var(--radius); background: color-mix(in srgb, var(--accent-soft) 92%, transparent); color: var(--accent-ink); font-weight: 700; font-size: 1.2rem; }
/* Kamera */
.sc-dark { background: #0b0d12; color: #fff; border-color: #0b0d12; }
.sc-cam { position: relative; background: #000; height: 62vh; }
.sc-cam video, .sc-cam canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.sc-hint { position: absolute; left: 50%; top: 1rem; transform: translateX(-50%); background: rgba(0, 0, 0, .6); color: #fff; font-size: .85rem; font-weight: 600; padding: .35rem .8rem; border-radius: 1rem; white-space: nowrap; }
.sc-hint.ok { background: rgba(22, 163, 74, .92); }
.sc-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.sc-flash.on { animation: sc-flash .35s ease-out; }
@keyframes sc-flash { from { opacity: .8; } to { opacity: 0; } }
.sc-camfoot { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.1rem .5rem; }
.sc-thumbs { display: flex; gap: .4rem; min-width: 5rem; }
.sc-thumbs div { width: 2.2rem; height: 3rem; border-radius: .25rem; border: 2px solid #fff; background: #fff center / cover; position: relative; }
.sc-thumbs span { position: absolute; top: -.55rem; right: -.55rem; background: #16a34a; color: #fff; font-size: .68rem; font-weight: 700; width: 1.2rem; height: 1.2rem; border-radius: 50%; display: grid; place-items: center; }
.sc-shutter { all: unset; cursor: pointer; width: 4.4rem; height: 4.4rem; border-radius: 50%; border: 4px solid #fff; display: grid; place-items: center; }
.sc-shutter i { width: 3.5rem; height: 3.5rem; border-radius: 50%; background: #fff; display: block; }
.sc-shutter:active i { transform: scale(.9); }
.sc-shutter:disabled { opacity: .3; }
.sc-done { all: unset; cursor: pointer; background: #16a34a; color: #fff; font-weight: 700; border-radius: 1.2rem; padding: .55rem 1rem; min-width: 5rem; text-align: center; }
.sc-nocam { display: flex; gap: .4rem; align-items: center; justify-content: center; text-align: center; padding: 0 1rem calc(.9rem + env(safe-area-inset-bottom, 0px)); color: #94a3b8; font-size: .82rem; cursor: pointer; text-decoration: underline; text-underline-offset: .2em; }
.sc-nocam.prominent { color: #fff; font-size: 1rem; text-decoration: none; background: #16a34a; margin: 0 1rem 1rem; padding: .8rem; border-radius: .8rem; }
.sc-torch { all: unset; cursor: pointer; position: absolute; right: .8rem; bottom: .8rem; display: flex; align-items: center; gap: .35rem; background: rgba(0, 0, 0, .55); color: #fff; font-size: .82rem; font-weight: 600; padding: .45rem .8rem; border-radius: 1.2rem; }
.sc-torch[aria-pressed="true"] { background: #facc15; color: #1a1a1a; }
.sc-torch[hidden] { display: none; }
/* Bearbeiten */
.sc-editarea { position: relative; height: 60vh; display: grid; place-items: center; background: #1a1d24; touch-action: none; }
.sc-editarea canvas, .sc-editarea svg { grid-area: 1 / 1; }
#sc-quad polygon { fill: rgba(34, 197, 94, .12); stroke: #22c55e; stroke-width: 2.5; }
#sc-quad .knob { fill: rgba(22, 163, 74, .35); stroke: #22c55e; stroke-width: 3; pointer-events: none; }
#sc-quad .hit { fill: transparent; cursor: grab; }
.sc-editbar { padding: .8rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); }
.sc-tools { display: flex; justify-content: space-around; margin-bottom: .8rem; }
.sc-tools button { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .25rem; font-size: .75rem; color: #cbd5e1; }
.sc-tools button.pulse { color: #22c55e; }
.sc-filters { display: flex; gap: .5rem; justify-content: center; margin-bottom: .8rem; }
.sc-filters button { all: unset; cursor: pointer; border: 1.5px solid #475569; border-radius: 1rem; padding: .3rem .8rem; font-size: .82rem; font-weight: 600; color: #cbd5e1; }
.sc-filters button.on { background: #fff; color: #0b0d12; border-color: #fff; }
.sc-btnrow { display: flex; gap: .5rem; }
.sc-btn { all: unset; cursor: pointer; flex: 1; text-align: center; border-radius: .75rem; padding: .7rem; font-weight: 700; border: 1.5px solid #475569; color: #e2e8f0; }
.sc-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
/* Status */
.sc-steps { list-style: none; padding: .4rem 0 0; margin: 0 0 1rem; }
.sc-steps li { display: flex; gap: .9rem; align-items: flex-start; margin-bottom: 1.1rem; list-style: none; }
.sc-steps b { display: block; }
.sc-steps small { color: var(--muted); }
.sc-dot { width: 1.9rem; height: 1.9rem; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--line-2); color: var(--muted); font-weight: 800; }
.sc-steps li.ok .sc-dot { background: var(--ok-bg); color: var(--ok); }
.sc-steps li.ok .sc-dot::before { content: "✓"; }
.sc-steps li.run .sc-dot { background: var(--warn-bg); color: var(--warn); box-shadow: 0 0 0 4px rgba(240, 165, 58, .2); }
.sc-steps li.run .sc-dot::before { content: "…"; }
.sc-steps li.err .sc-dot { background: var(--err-bg); color: var(--err); }
.sc-steps li.err .sc-dot::before { content: "!"; }
.sc-steps li.err small { color: var(--err); }
.sc-result { border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .9rem; margin-bottom: 1rem; }
.sc-row { display: flex; justify-content: space-between; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.sc-row:last-child { border-bottom: 0; }
.sc-row > span:first-child { color: var(--muted); }
@media (max-width: 760px) {
  .page-scan header { display: none; }
  
  .page-scan main.wrap { padding: 0; }
  .sc-view { border: 0; border-radius: 0; min-height: 100vh; min-height: 100dvh; }
  .sc-drophint { display: none; }
  .sc-head { padding-top: calc(.7rem + env(safe-area-inset-top, 0px)); }
  .sc-body { flex: 1; }
  .sc-cam, .sc-editarea { flex: 1; height: auto; min-height: 55vh; }
}

.upload-row { display: flex; gap: 10px; align-items: stretch; margin: 0 0 18px; }
.upload-row .drop { flex: 1; margin: 0; }
.scan-btn { min-height: 48px; gap: 8px; font-weight: 600; }
.page-scan main.wrap { max-width: 900px; }

/* --- Handy: Menüs wischbar, Tabellen als Karten -------------------------- */
@media (max-width: 700px) {
  header .wrap { flex-wrap: wrap; }
  header nav { order: 3; flex-basis: calc(100% + 28px); margin: 0 -14px; padding: 0 14px 2px; overflow-x: auto; flex-wrap: nowrap;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  header nav::-webkit-scrollbar { display: none; }
  header nav a { white-space: nowrap; flex: none; }
  .company-name, .company-switch select { max-width: 160px; }
  .setup-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px 2px; flex-basis: calc(100% + 28px); }
  .setup-nav::-webkit-scrollbar { display: none; }
  .setup-nav a { flex: none; white-space: nowrap; }
  .setup-nav .nav-btn { display: none; }
  .setup { gap: 14px; }
  select, input, textarea { max-width: 100%; }
  .card-head .actions, .card-head .push.actions { margin-left: 0; width: 100%; }
  .card-head .actions > *, .period > * { flex: 1 1 auto; }
  .page-head .actions { width: 100%; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-pair { grid-template-columns: minmax(0, 1fr); }

  table.stack thead { display: none; }
  table.stack, table.stack tbody { display: block; }
  table.stack tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); position: relative; }
  table.stack td { border: 0; padding: 0; min-width: 0; }
  table.stack td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
  table.stack td.full { grid-column: 1 / -1; }
  table.stack td.num { text-align: left; }
  table.stack td.del { position: absolute; top: 28px; right: 14px; }
  table.stack tr:has(td.del) td:nth-child(2) { padding-right: 48px; }
  table.stack tfoot { display: block; }
  table.stack tfoot tr { grid-template-columns: 1fr auto; }
  table.lines.stack td:empty { display: none; }
  #quick .quick-wrap, .table-scroll:has(table.stack) { overflow: visible; }

  /* Journal: Datum · Nr. | Betrag / Soll → Haben | MWST / Text */
  table.journal.stack tr { grid-template-columns: auto auto 1fr auto; gap: 2px 10px; padding: 10px 14px; }
  table.journal.stack td { font-size: 14px; }
  table.journal.stack .j-date { grid-column: 1; }
  table.journal.stack .j-no { grid-column: 2; }
  table.journal.stack .j-ref { grid-column: 3; color: var(--muted); }
  table.journal.stack .j-amt { grid-column: 4; text-align: right; font-weight: 600; }
  table.journal.stack .j-d { grid-column: 1; }
  table.journal.stack .j-d[colspan] { grid-column: 1 / span 3; }
  table.journal.stack .j-c { grid-column: 2; }
  table.journal.stack .j-d::before, table.journal.stack .j-c::before { display: inline; margin: 0 4px 0 0; font-size: 10px; }
  table.journal.stack .j-vat { grid-column: 3 / span 2; text-align: right; }
  table.journal.stack .j-text { grid-column: 1 / -1; }
  /* Zeilen einer Sammelbuchung: «Soll 2000» / «Haben 1020» | Betrag | Text */
  table.journal.stack tr.subline { padding: 4px 14px; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0 10px; border-bottom: 0; }
  table.journal.stack tr.subline .sub-d, table.journal.stack tr.subline .sub-c { grid-column: 1; grid-row: 1; }
  table.journal.stack tr.subline .sub-vat { grid-column: 2; grid-row: 1; color: var(--muted); }
  table.journal.stack tr.subline .sub-amt { grid-column: 3; grid-row: 1; }
  table.journal.stack tr.subline .sub-text { grid-column: 1 / -1; }
  table.journal.stack tr.subline .sub-text:empty, table.journal.stack tr.subline .sub-vat:empty { display: none; }
  table.journal.stack tr.subline:has(+ tr:not(.subline)), table.journal.stack tr.subline:last-child { padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
  table.journal.stack tr.subline .j-pad, table.journal.stack tr.subline .sub-d:empty, table.journal.stack tr.subline .sub-c:empty { display: none; }
  table.journal.stack tr.subline .sub-d::before, table.journal.stack tr.subline .sub-c::before { font-family: var(--font, inherit); font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-right: 5px; }
  table.journal.stack tr.subline .sub-d::before { content: "Soll"; }
  table.journal.stack tr.subline .sub-c::before { content: "Haben"; }
  table.journal.stack tr.subline td.num { text-align: right; }
  table.cred.stack tr td.sel { position: absolute; top: 12px; right: 14px; }  /* nur das Auswahl-Häkchen, nicht Lieferant/Datum */
}
@media (max-width: 700px) {
  .inline-form input, .inline-form select { min-width: 0; flex: 1 1 140px; width: auto !important; }
  .inline-form button, .inline-form .btn { flex: 1 1 auto; }
  table.stack tfoot tr td[colspan], table.stack tfoot tr th[colspan] { grid-column: 1; }
}
.actions > form.card { flex: 1 1 100%; min-width: 0; margin-bottom: 0; }
@media (max-width: 700px) {
  table.stack tfoot th { background: none; color: var(--text); font-size: 15px; text-transform: none; letter-spacing: 0; padding: 0; }
  table.stack tfoot tr { padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
  .inline-form > b { flex-basis: 100%; }
}
@media (max-width: 700px) {
  table.report.vat td, table.report.vat th { padding: 6px 6px; font-size: 13px; }
  table.report.vat td:first-child, table.report.vat th:first-child { padding-left: 12px; width: 38px; }
  table.report.vat td:last-child, table.report.vat th:last-child { padding-right: 12px; }
  /* feste Spalten: Bezeichnung bricht um, Beträge passen ohne seitliches Scrollen */
  table.report.vat { table-layout: fixed; width: 100%; }
  table.report.vat td:nth-child(n+3), table.report.vat th:nth-child(n+3) { width: 92px; white-space: nowrap; }
  table.years.stack td.num { text-align: left; }
  table.report.vat th { font-size: 10px; letter-spacing: .02em; }
  table.report.vat td:nth-child(2), table.report.vat th:nth-child(2) { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
  table.report.vat td:first-child, table.report.vat th:first-child { width: 44px !important; padding-right: 4px; }
  table.report.vat td:nth-child(n+3), table.report.vat th:nth-child(n+3) { width: 84px; }
  table.stack td:empty { display: none; }
}

/* --- Navigation Handy: Tab-Leiste unten, «Mehr» als Blatt ------------------ */
.tabbar, dialog.sheet:not([open]) { display: none; }
dialog.sheet { margin: auto 0 0; width: 100%; max-width: 100%; max-height: 85vh; border: 0; border-radius: 16px 16px 0 0; padding: 6px 8px calc(12px + env(safe-area-inset-bottom));
  background: var(--panel); color: var(--text); box-shadow: 0 -8px 30px rgba(0, 0, 0, .18); }
dialog.sheet::backdrop { background: rgba(15, 20, 30, .4); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; }
.sheet-head .me-text { flex: 1; min-width: 0; } .sheet-head .me-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-close { border: 0; background: none; box-shadow: none; min-height: 40px; width: 40px; padding: 0; display: grid; place-items: center; color: var(--muted); }
dialog.sheet a { display: flex; align-items: center; gap: 14px; padding: 0 14px; min-height: 50px; border-radius: 10px; color: var(--text); font-size: 15.5px; }
dialog.sheet a:hover { text-decoration: none; background: var(--panel-2); }
dialog.sheet a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
dialog.sheet a .i { color: var(--muted); } dialog.sheet a.on .i { color: var(--accent); }

@media (max-width: 900px) {
  header .wrap { flex-wrap: nowrap; min-height: 54px; padding-top: 6px; padding-bottom: 6px; gap: 10px; }
  header nav, header .me, header .logout, .brand-ver { display: none; }
  .logo { font-size: 24px; }
  header .right { flex: 1; min-width: 0; justify-content: flex-end; gap: 8px; }
  .company-switch { flex: 1; min-width: 0; max-width: 360px; } .company-switch select { width: 100%; }
  .company-name { overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 14px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 19; background: var(--panel); border-top: 1px solid var(--line);
    padding: 0 4px env(safe-area-inset-bottom); box-shadow: 0 -2px 12px rgba(0, 0, 0, .05); }
  .tabbar a, .tabbar button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 56px; padding: 6px 2px; margin: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--muted);
    font: inherit; font-size: 11px; font-weight: 500; position: relative; cursor: pointer; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .i { width: 23px; height: 23px; }
  .tabbar .on { color: var(--accent); }
  .tabbar .on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
  .tabbar .nav-count { position: absolute; top: 4px; left: calc(50% + 7px); font-size: 10.5px; line-height: 17px; padding: 0 5px; max-width: none; }
  body main.wrap { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  body.has-actionbar .tabbar, body.page-scan .tabbar { display: none; }
  body.has-actionbar main.wrap { padding-bottom: 140px; }
}
@media (max-width: 700px) {
  /* Unternavigation: ein Streifen, der seitlich weiterläuft (Rand blendet aus) */
  .setup-nav { position: relative; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  .setup-nav.at-end { -webkit-mask-image: none; mask-image: none; }
  .page-head .actions .seg.subnav { order: -1; }
}
.sheet-head .me-text { display: flex !important; }
/* Tablet quer / kleiner Laptop: Kopfzeile kompakt, damit alles in eine Zeile passt */
@media (min-width: 901px) and (max-width: 1180px) {
  .brand-ver, header .me-text, header .logout { display: none; }
  header .wrap { gap: 12px; }
  header nav a { padding: 8px 9px; }
  .company-switch select { max-width: 170px; }
}

/* Belege im Journal und in der Buchung */
.doclinks { display: inline-flex; gap: 2px; margin-left: 4px; vertical-align: middle; }
.doclink { display: inline-flex; align-items: center; gap: 2px; min-width: 24px; min-height: 24px; justify-content: center; border-radius: 6px; color: var(--accent); text-decoration: none; font-size: 11px; font-weight: 600; }
.doclink:hover { background: var(--panel-2); text-decoration: none; }
.doclink svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.doc-tile { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.doc-thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1.3; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.doc-thumb:hover { border-color: var(--accent); }
.doc-ph { font: 600 14px var(--mono, ui-monospace, monospace); color: var(--muted); }
.doc-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.doc-acts { font-size: 13px; }
form.inline { display: inline; }
button.linkish { background: none; border: 0; padding: 0; min-height: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.doc-up label.btn { cursor: pointer; }
.doc-up label.btn:focus-within, .attach:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.attach { position: relative; cursor: pointer; color: var(--muted); gap: 2px; }
.attach svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.attach.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.attach-n { font-size: 11px; font-weight: 600; }
.doc-field { margin-top: 12px; }

/* Belegbetrachter */
.hidden-doc { display: none !important; }
html.dv-open { overflow: hidden; }
dialog.docview { width: min(980px, 100vw - 32px); height: calc(100vh - 32px); max-width: none; max-height: none; padding: 0; border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--text); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); display: none; flex-direction: column; overflow: hidden; }
dialog.docview[open] { display: flex; }
dialog.docview::backdrop { background: rgba(10, 16, 32, .6); }
.dv-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.dv-title { display: flex; flex-direction: column; min-width: 0; flex: 1 1 220px; }
.dv-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dv-acts [hidden] { display: none !important; }
.dv-count { font: 600 12.5px var(--mono, ui-monospace, monospace); color: var(--muted); margin-right: 4px; }
.dv-acts .icon { min-width: 36px; font-size: 18px; line-height: 1; }
.dv-acts [aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.dv-body { flex: 1 1 auto; overflow: auto; padding: 18px; background: var(--panel-2); display: flex; flex-direction: column; align-items: center; gap: 14px; outline: none; }
.dv-page { margin: 0; width: 100%; max-width: 860px; background: #fff; border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.18); flex: 0 0 auto; }
.dv-page img { display: block; width: 100%; height: 100%; }
dialog.docview.zoom .dv-body { align-items: flex-start; }
dialog.docview.zoom .dv-page { width: 180%; max-width: none; }
.dv-msg { margin: 40px auto; color: var(--muted); text-align: center; }
@media (max-width: 640px) {
  dialog.docview { width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .dv-body { padding: 10px; }
  .dv-bar { padding: 8px 10px; }
  .dv-bar { position: relative; padding-right: 56px; }
  .dv-acts { width: 100%; }
  .dv-close { position: absolute; top: 8px; right: 10px; }
  .dv-acts [data-zoom] { display: none; }  /* auf dem Handy mit zwei Fingern zoomen */
  .dv-acts { gap: 5px; }
}
@media (prefers-reduced-motion: no-preference) { dialog.docview[open] { animation: dv-in .16s ease-out; } }
@keyframes dv-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }

/* Kontoauszug */
.eyebrow-sm { margin: 0 0 2px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
table.sheet td.nr { white-space: nowrap; }
.stmt-grid { display: grid; grid-template-columns: 2fr 2fr 1fr 1fr; gap: 12px; align-items: end; }
@media (max-width: 900px) { .stmt-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .stmt-grid { grid-template-columns: 1fr; } }
@media print {
  .stmt-form, .doclinks, .storno-ref, nav.bottom-nav, .tabbar { display: none !important; }
  .stmt { break-inside: auto; page-break-before: auto; margin-bottom: 18px; }
  .stmt + .stmt { break-before: page; }
  table.sheet { font-size: 10.5px; }
  table.sheet a { color: inherit; text-decoration: none; }
  .table-scroll { overflow: visible !important; }
}

/* Eingang: Belegart (Kreditor / FiBu / Debitor) */
.kind-tabs { margin: 0 0 12px; flex-wrap: wrap; }
.kind-tabs .count { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 12px; font-weight: 600; align-items: center; justify-content: center; }
.kind-tabs a.on .count { background: var(--dark-text); color: var(--dark); }
.kind-pick { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 0 4px; }
.kind-pick select { min-height: 40px; }
.kind-tag { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; letter-spacing: .02em; vertical-align: 1px; background: var(--accent-soft); color: var(--accent-ink); white-space: nowrap; }
.kind-tag.debitor { background: var(--ok-bg); color: var(--ok); }
.kind-tag.kreditor { background: var(--panel-2); color: var(--muted); }
.review-head .kind-tag { font-size: 12px; padding: 3px 9px; }
.sc-kind { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 0; }
.sc-kind > label { font-weight: 600; font-size: 14px; }
.doc-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.doc-form .card { margin: 0; }
.doc-form h2 { margin: 0 0 4px; font-size: 17px; }
.doc-form .small-h { font-size: 14px; }
.doc-form table.lines th { min-width: 0 !important; width: auto !important; }
.doc-form table.lines th:first-child { min-width: 200px !important; }
.doc-form table.lines input.num { min-width: 88px; }
.c-sup .kind-tag, .mini .kind-tag { align-self: flex-start; }
.issues-card ul { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 14px; }
@media (max-width: 760px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Buchungszeilen im Beleg als Karten statt breiter Tabelle */
  .doc-form .table-scroll { overflow: visible; }
  .doc-form table.lines, .doc-form table.lines tbody, .doc-form table.lines tfoot { display: block; }
  .doc-form table.lines thead { display: none; }
  .doc-form table.lines tbody tr { display: grid; gap: 6px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .doc-form table.lines td { padding: 0; border: 0; min-width: 0; }
  .doc-form table.lines tfoot tr { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding-top: 10px; }
  .doc-form table.lines tfoot td:empty { display: none; }
  #entry table.lines tbody tr { grid-template-columns: 1fr 1fr 44px; grid-template-areas: "acc acc del" "deb cre ." "vat txt txt"; }
  #entry table.lines.novat tbody tr { grid-template-areas: "acc acc del" "deb cre ." "txt txt txt"; }
  #entry table.lines td:nth-child(1) { grid-area: acc; } #entry table.lines td:nth-child(2) { grid-area: deb; }
  #entry table.lines td:nth-child(3) { grid-area: cre; } #entry table.lines td:nth-child(4) { grid-area: vat; }
  #entry table.lines td:nth-child(5) { grid-area: txt; } #entry table.lines td:nth-child(6) { grid-area: del; }
  #deb table.lines tbody tr { grid-template-columns: 1fr 1fr 44px; grid-template-areas: "txt txt del" "net vat ." "acc acc acc"; }
  #deb table.lines.novat tbody tr { grid-template-areas: "txt txt del" "net net ." "acc acc acc"; }
  #deb table.lines td:nth-child(1) { grid-area: txt; } #deb table.lines td:nth-child(2) { grid-area: net; }
  #deb table.lines td:nth-child(3) { grid-area: vat; } #deb table.lines td:nth-child(4) { grid-area: acc; }
  #deb table.lines td:nth-child(5) { grid-area: del; }
  .upload-row { flex-wrap: wrap; }
  .kind-pick { flex-direction: row; align-items: center; gap: 8px; }
}

/* --- Bereiche: Finanz-, Debitoren-, Kreditorenbuchhaltung ---------------- */
.nav-short { display: none; }
@media (max-width: 1380px) { header nav .nav-long:has(+ .nav-short) { display: none; } header nav .nav-short { display: inline; } }
.setup-nav .nav-title { font-size: 15px; font-weight: 700; color: var(--text); padding: 4px 12px 2px; }
.setup-nav .nav-title + .nav-head { padding-top: 12px; }
.module .setup-nav .nav-head:not(:first-of-type) { margin-top: 6px; }
@media (max-width: 1000px) {
  .setup-nav .nav-title { display: none; }
}

/* --- Konten: Benutzer, öffentliche Seiten --------------------------------- */
.user-line { display: flex; gap: 14px; align-items: center; padding: 12px 18px; flex-wrap: wrap; }
.user-role select { width: auto; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.public-box { max-width: 460px; margin: 6vh auto 40px; }
.public-box .card { padding: 24px 26px; }
.public-box h1 { font-size: 24px; margin-bottom: 8px; }
.public-logo { display: block; text-align: center; margin-bottom: 18px; color: var(--logo); font-size: 34px; text-decoration: none; }
.public-logo:hover { text-decoration: none; }
.public-logo .logo { font-size: 34px; }
.public-foot { text-align: center; }
.public-box .field { margin-bottom: 12px; }
.public-box.legal { max-width: 820px; }
.public-box.legal h2 { font-size: 16px; margin: 22px 0 6px; }
.public-box.legal p, .public-box.legal li { line-height: 1.55; }
.public-box.legal ul { padding-left: 20px; }
.legal-table td { vertical-align: top; font-size: 14px; }
.check.terms { margin: 6px 0 14px; align-items: flex-start; }
.fx-box { background: var(--warn-soft, #fff6e0); border: 1px solid #f0d58c; border-radius: 10px; padding: 12px 14px; margin: 4px 0 14px; font-size: 14px; }
.fx-box p { margin: 0 0 8px; }
.section-h { font-size: 15px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.vat-row { padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.vat-row:last-child { border-bottom: 0; }
.vat-row.inactive { opacity: .6; }
.vat-head { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.vat-code { flex: 0 0 56px; font-weight: 700; color: var(--accent); }
.vat-name { display: flex; flex-direction: column; min-width: 0; flex: 1 1 300px; }
.vat-hint { margin: 6px 0 0 70px; font-size: 14px; line-height: 1.5; max-width: 90ch; }
.vat-edit { margin: 8px 0 0 70px; }
.vat-edit summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.vat-edit form { margin-top: 8px; }
@media (max-width: 700px) { .vat-hint, .vat-edit { margin-left: 0; } }

/* Eingang: Auswahl und Aktionsleiste */
.link-row { cursor: pointer; }
.link-row:hover { background: var(--panel-2); }
.bulk-bar { position: sticky; bottom: 12px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 12px 0; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px -12px rgba(13,27,61,.35); }
.bulk-bar[hidden] { display: none; }
.bulk-bar b { margin-right: auto; }
.link-btn { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; padding: 0 4px; }
@media (max-width: 900px) { .bulk-bar { bottom: calc(72px + env(safe-area-inset-bottom)); } .bulk-bar b { flex-basis: 100%; } }
.guide-opt { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; } .guide-opt input { margin-top: 4px; }
.fx-fld .with-unit { display: flex; align-items: center; gap: 10px; }
.fx-fld .with-unit input { max-width: 150px; }
.fx-fld .with-unit span { white-space: nowrap; }

/* Seitenmenü: Gruppentitel (Buchen, Reporting, Stammdaten) klar abgesetzt, Punkte darunter eingerückt */
@media (min-width: 1001px) {
  .setup-nav .nav-head { color: var(--accent-ink); font-weight: 700; letter-spacing: .08em; padding: 14px 12px 6px;
    margin-top: 10px; border-top: 1px solid var(--line); }
  .setup-nav .nav-title + .nav-head, .setup-nav > .nav-head:first-child { margin-top: 0; border-top: 0; padding-top: 10px; }
  .module .setup-nav .nav-head:not(:first-of-type) { margin-top: 10px; }
  .setup-nav .nav-head ~ a { padding-left: 24px; }
  .setup-nav .nav-head ~ a.nav-btn { padding-left: 12px; }
  .setup-nav .nav-title { font-size: 16px; padding-bottom: 6px; }
}

/* --- Reporting (Cockpit, Bilanz, Erfolgsrechnung, Kontoauszug) --------------------------------------
   Farben geprüft auf Farbenblindheit; Aufwand (Bernstein) hat wenig Kontrast -> immer Legende und Werte. */
:root { --c-in: #2f55c4; --c-out: #d0891a; --c-good: #1f6b45; }
@media (prefers-color-scheme: dark) { :root { --c-in: #6f93f2; --c-out: #e0a53a; --c-good: #5fd39a; } }
.gain { color: var(--c-good); } .warn-text { color: var(--warn); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); color: var(--text); min-width: 0; }
.kpi:hover { text-decoration: none; border-color: var(--accent); }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.kpi-sub { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.kpi-sub.warn-text { color: var(--warn); }
.spark { width: 100%; height: 30px; display: block; margin-top: 2px; }
.dash { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash .card { margin: 0; }
.dash h2, .sheet-top h2 { font-size: 17px; margin: 0 0 10px; }
.dash .card-head h2 { margin: 0; }
@media (max-width: 900px) { .dash { grid-template-columns: minmax(0, 1fr); } }
.legend { display: inline-flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart .grid { stroke: var(--line-2); } svg.chart .axis { stroke: var(--line); }
svg.chart .link { stroke: var(--muted); stroke-dasharray: 3 3; opacity: .6; }
svg.chart text { font-family: "JetBrains Mono", ui-monospace, monospace; }
svg.chart .tick { font-size: 11px; fill: var(--muted); }
svg.chart .lbl { font-size: 12px; fill: var(--muted); font-family: "Instrument Sans", system-ui, sans-serif; }
svg.chart .val { font-size: 12px; fill: var(--text); }
svg.chart .lbl.strong { fill: var(--text); font-weight: 600; }
svg.chart .val.res { fill: var(--c-good); font-weight: 600; }
svg.chart path:hover, svg.chart rect:hover { opacity: .82; }
svg.chart .hit { cursor: crosshair; } svg.chart .hit:hover { fill: var(--hl); }
.spend { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }
.spend-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 5px; }
.spend-bar { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.spend-bar i { display: block; height: 100%; background: var(--c-out); border-radius: 4px; }
.todo { display: flex; flex-direction: column; }
.todo-row { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-2); color: var(--text); font-size: 14px; }
.todo-row:first-child { border-top: 0; }
.todo-row:hover { text-decoration: none; background: var(--panel-2); }
.todo-text { display: flex; flex-direction: column; min-width: 0; } .todo-text small { font-size: 12.5px; }
.todo-date { font-size: 12.5px; color: var(--muted); padding-top: 2px; }
.todo-row.late .todo-date { color: var(--warn); font-weight: 600; }
/* Bilanz */
.segrows { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 10px 14px; align-items: center; margin: 6px 0 10px; font-size: 14px; }
.segbar { display: flex; gap: 2px; height: 34px; border-radius: 8px; overflow: hidden; }
.segbar span { display: flex; align-items: center; padding: 0 10px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; min-width: 3px; }
.ratios { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 16px; }
.ratio { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-2); }
.ratio span { font-size: 13px; color: var(--muted); font-weight: 600; } .ratio b { font-size: 21px; font-weight: 600; } .ratio small { font-size: 12.5px; color: var(--muted); }
.ratio small.gain { color: var(--c-good); } .ratio small.warn-text { color: var(--warn); }
.rep-side { overflow: hidden; }
.rep-head { display: flex; align-items: baseline; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.rep-head h2 { margin: 0; font-size: 17px; } .rep-head .mono { font-size: 17px; font-weight: 600; margin-left: auto; }
.rep-group { border-bottom: 1px solid var(--line-2); }
.rep-group summary { display: flex; align-items: center; gap: 8px; padding: 12px 18px; cursor: pointer; font-weight: 700; list-style: none; min-height: 44px; }
.rep-group summary::-webkit-details-marker { display: none; }
.rep-group summary .push { margin-left: auto; }
.rep-group .chev { transition: transform .15s; color: var(--muted); flex: none; }
.rep-group[open] .chev { transform: rotate(90deg); }
.rep-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 110px; gap: 12px; align-items: center; padding: 8px 18px 8px 40px; color: var(--text); font-size: 14px; border-top: 1px solid var(--line-2); }
a.rep-row:hover { background: var(--panel-2); text-decoration: none; }
.rep-row .num { text-align: right; }
.rep-empty { margin: 0; padding: 6px 18px 12px 40px; }
.rep-foot { padding: 12px 18px; }
.share { display: block; height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.share i { display: block; height: 100%; border-radius: 3px; }
@media (max-width: 560px) { .rep-row { grid-template-columns: minmax(0, 1fr) auto; padding-left: 24px; } .rep-row .share { display: none; } }
/* Erfolgsrechnung */
table.report.staged .pct-col { width: 150px; white-space: nowrap; }
table.report.staged td.pct-col { display: table-cell; }
.pctbar { display: inline-block; vertical-align: middle; width: 80px; height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; margin-right: 8px; }
.pctbar i { display: block; height: 100%; border-radius: 3px; }
table.report.staged.wide td, table.report.staged.wide th { white-space: nowrap; }
table.report.staged tr.subtotal th { background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; text-transform: none; letter-spacing: 0; }
table.report.staged tr.result th { color: var(--c-good); }
table.report.staged tr.result.loss th { color: var(--err); }
/* Kontoauszug */
.sheet-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: stretch; margin-bottom: 16px; }
.sheet-top .card { margin: 0; }
@media (max-width: 900px) { .sheet-top { grid-template-columns: minmax(0, 1fr); } }
.sheet-facts { display: flex; flex-direction: column; gap: 14px; }
.sheet-facts > div { display: flex; flex-direction: column; gap: 2px; }
.sheet-facts dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; margin: 0; font-size: 14px; }
.sheet-facts dt { color: var(--muted); } .sheet-facts dd { margin: 0; text-align: right; }
.sheet-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.sheet-filter h2 { margin: 0 8px 0 0; font-size: 16px; }
.sheet-filter input.push { margin-left: auto; width: 260px; max-width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px; padding: 6px 14px; font-size: 13px; min-height: 34px; display: inline-flex; align-items: center; }
.chip:hover { text-decoration: none; border-color: var(--accent); }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
table.sheet-new tr.month-row td { background: var(--panel-2); font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; padding-top: 8px; padding-bottom: 8px; }
table.sheet-new td.num.gain { color: var(--c-good); }
table.sheet-new td:first-child { white-space: nowrap; }
@media print { .kpis, .dash, .sheet-top svg, .sheet-filter .chips, .sheet-filter input { break-inside: avoid; } .rep-group:not([open]) > :not(summary) { display: block; } }

/* Zwei-Faktor-Anmeldung */
.public-box.wide { max-width: 520px; }
.mfa-code { font-size: 22px; letter-spacing: .18em; text-align: center; max-width: 220px; }
.mfa-help { margin: 14px 0 10px; } .mfa-help summary { cursor: pointer; color: var(--accent); }
.mfa-steps { padding-left: 22px; margin: 16px 0; display: grid; gap: 16px; }
.mfa-steps li > b { display: block; margin-bottom: 2px; }
.mfa-steps li > span { display: block; }
.mfa-qr { width: 196px; margin: 8px 0; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.mfa-qr svg { display: block; width: 100%; height: auto; }
.mfa-secret { display: inline-block; margin-top: 4px; padding: 4px 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; user-select: all; word-break: break-all; }
.mfa-confirm { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.mfa-confirm .mfa-code { flex: 0 1 200px; }
.mfa-list { list-style: none; padding: 12px 16px; margin: 14px 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px;
  background: var(--panel-2); border: 1px dashed var(--field-line); border-radius: 10px; font-size: 15px; }
.mfa-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
@media print { .mfa-list { border-color: #000; } }
.mfa-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; } .mfa-row input { flex: 0 1 180px; }

/* iOS: Datumsfelder haben eine feste Mindestbreite und ragen sonst aus schmalen Spalten */
@supports (-webkit-touch-callout: none) {
  input[type=date], input[type=time], input[type=datetime-local] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; display: block; text-align: left; }
  input[type=date]::-webkit-date-and-time-value { text-align: left; margin: 0; }
}

/* --- Protokoll ---------------------------------------------------------- */
.audit-filter .actions { flex-wrap: wrap; }
.audit-target { margin-bottom: 14px; }
.audit-group { padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.audit-group:last-child { border-bottom: 0; }
.audit-head { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.audit-head b { color: var(--text); font-weight: 600; }
.audit-item > summary { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; cursor: pointer; padding: 4px 0; list-style: none; }
.audit-item > summary::-webkit-details-marker { display: none; }
.audit-item > summary::before { content: "▸"; color: var(--muted); font-size: 11px; width: 10px; }
.audit-item[open] > summary::before { content: "▾"; }
.audit-what { font-weight: 600; min-width: 150px; }
.audit-item.warn .audit-what { color: var(--warn); }
.audit-obj { min-width: 0; overflow-wrap: anywhere; }
.audit-chg { width: 100%; margin: 4px 0 6px 20px; max-width: calc(100% - 20px); font-size: 13px; border-collapse: collapse; table-layout: fixed; }
.audit-chg th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 2px 8px 2px 0; }
.audit-chg td { padding: 3px 8px 3px 0; vertical-align: top; overflow-wrap: anywhere; border-top: 1px solid var(--line-2); }
.audit-chg th:first-child, .audit-chg td:first-child { width: 28%; color: var(--muted); }
.audit-chg td.old { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.audit-chg td.new { font-weight: 500; }
.audit-ev { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 4px 0 6px 20px; font-size: 13px; }
.audit-ev dt { color: var(--muted); }
.audit-ev dd { margin: 0; overflow-wrap: anywhere; }
.audit-item > p { margin: 0 0 6px 20px; }
@media (max-width: 700px) {
  .audit-group { padding: 10px 14px; }
  .audit-what { min-width: 0; }
  .audit-chg { margin-left: 0; max-width: 100%; }
  .audit-ev, .audit-item > p { margin-left: 0; }
}
.audit-filters > summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; display: none; }
@media (max-width: 700px) {
  .audit-filters > summary { display: list-item; }
  .audit-filters:not([open]) { margin-bottom: 4px; }
}

/* Kontenplan Privathaushalt (öffentliche Dokumentseite, handytauglich) */
body.page-doc main.wrap { max-width: none; padding: 0 !important; overflow-x: visible; }
.page-doc { --kp-max: 1040px; }
.kp-wrap { max-width: var(--kp-max); margin: 0 auto; padding: 0 24px; }
.kp-hero { background: radial-gradient(1200px 400px at 85% -10%, rgba(143, 176, 255, .22), transparent 60%), var(--brand); color: var(--brand-text); padding: 22px 0 34px; }
.kp-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 30px; }
.kp-logo .logo { font-size: 30px; color: #fff; }
.kp-pill { font-size: 12.5px; font-weight: 600; color: var(--gold-ink); background: var(--gold); border-radius: 999px; padding: 4px 12px; white-space: nowrap; }
.kp-hero h1 { font-size: clamp(30px, 5.2vw, 48px); line-height: 1.08; letter-spacing: -.025em; margin: 0 0 12px; font-weight: 700; }
.kp-lead { font-size: clamp(16px, 2.2vw, 19px); color: var(--brand-muted); max-width: 640px; margin: 0; line-height: 1.5; }
.kp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 26px 0 0; max-width: 480px;
  background: rgba(255, 255, 255, .14); border-radius: 12px; overflow: hidden; }
.kp-stats > div { background: rgba(8, 14, 31, .35); padding: 12px 14px; }
.kp-stats dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--brand-muted); }
.kp-stats dd { margin: 2px 0 0; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kp-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.kp-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; font-weight: 600;
  color: #fff; border: 1px solid rgba(255, 255, 255, .35); }
.kp-btn:hover { background: rgba(255, 255, 255, .08); }
.kp-btn.primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.kp-btn.primary:hover { filter: brightness(1.05); background: var(--gold); }
.kp-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.kp-nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.kp-nav-in { display: flex; gap: 6px; overflow-x: auto; padding-top: 10px; padding-bottom: 10px; scrollbar-width: none; }
.kp-nav-in::-webkit-scrollbar { display: none; }
.kp-nav-in { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); padding-right: 36px; }
.kp-nav a { flex: 0 0 auto; font-size: 13.5px; color: var(--text); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); white-space: nowrap; }
.kp-nav a b { color: var(--accent); font-variant-numeric: tabular-nums; margin-right: 2px; }
.kp-nav a:hover, .kp-nav a.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }

.kp-main { padding-top: 8px; padding-bottom: 40px; }
.kp-sec { padding: 40px 0 8px; scroll-margin-top: 64px; }
.kp-sec + .kp-sec { border-top: 1px solid var(--line); }
.kp-eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--accent); margin: 0 0 6px; }
.kp-sec h2 { font-size: clamp(22px, 3.2vw, 28px); line-height: 1.2; letter-spacing: -.015em; margin: 0 0 16px; max-width: 760px; }
.kp-h3 { font-size: 16px; margin: 28px 0 12px; }
.kp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 32px; }
.kp-cols p, .kp-p { margin: 0 0 10px; line-height: 1.65; color: var(--text); max-width: 72ch; }
.kp-rules, .kp-q { list-style: none; counter-reset: kp; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.kp-rules li, .kp-q li { counter-increment: kp; position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 16px 54px; box-shadow: var(--shadow); line-height: 1.55; }
.kp-rules li::before, .kp-q li::before { content: counter(kp); position: absolute; left: 16px; top: 15px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--accent-soft); color: var(--accent-ink); }
.kp-rules b, .kp-q b { display: block; margin-bottom: 3px; }
.kp-rules span, .kp-q span { color: var(--muted); font-size: 14.5px; }
.kp-q li::before { background: var(--gold); color: var(--gold-ink); }

.kp-plan-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.kp-plan-head h2 { margin-bottom: 12px; }
.kp-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.kp-search { position: relative; display: block; }
.kp-search svg { position: absolute; left: 11px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.kp-search input { width: 290px; max-width: 100%; padding-left: 36px; border-radius: 10px; }
.kp-toggle { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.kp-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.kp-legend .kp-tag { margin-left: 8px; } .kp-legend .kp-tag:first-child { margin-left: 0; }
.kp-tag { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; line-height: 1.3; padding: 2px 9px; border-radius: 999px;
  color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.kp-tag.ded { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.kp-empty { padding: 30px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }

.kp-group { margin-top: 26px; scroll-margin-top: 64px; }
.kp-group-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.kp-gno { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; font-weight: 700;
  background: var(--brand); color: #fff; }
.kp-group-head h3 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.kp-group-head p { margin: 1px 0 0; font-size: 14px; color: var(--muted); }
.kp-accts { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.kp-acct { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 0 14px; padding: 14px 18px; border-top: 1px solid var(--line-2); scroll-margin-top: 64px; }
.kp-acct:first-child { border-top: 0; }
.kp-acct:target { background: var(--accent-soft); }
.kp-no { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 14px; font-weight: 600; color: var(--accent); padding-top: 2px; }
.kp-name { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.kp-name b { font-size: 15.5px; }
.kp-body p { margin: 4px 0 0; line-height: 1.55; font-size: 14.5px; }
.kp-body p.kp-not { display: flex; gap: 7px; align-items: flex-start; color: var(--muted); font-size: 13.5px; }
.kp-not svg { flex: 0 0 14px; width: 14px; height: 14px; margin-top: 3px; fill: none; stroke: currentColor; stroke-width: 2; }

.kp-ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 12px; }
.kp-ex { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kp-ex-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.kp-ex-top b { font-size: 14.5px; }
.kp-amt { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13.5px; white-space: nowrap; color: var(--text); }
.kp-ex-flow { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; margin-top: 10px; font-size: 13.5px; }
.kp-ex-flow > div { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; line-height: 1.35; }
.kp-ex-flow small { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.kp-an { align-self: center; font-size: 12.5px; font-style: italic; color: var(--muted); }
.kp-note { font-size: 13px; color: var(--muted); margin: 12px 0 0; }

.kp-tax { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-top: 6px; }
.kp-tax-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 14px; padding: 12px 18px; border-top: 1px solid var(--line-2); align-items: baseline; }
.kp-tax-row:first-child { border-top: 0; }
.kp-tax-acc { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; color: var(--accent); }
.kp-tax-row b { display: block; font-size: 14.5px; }
.kp-tax-row span { font-size: 14px; color: var(--muted); }

.kp-foot { border-top: 1px solid var(--line); padding: 22px 0 calc(28px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 13px; }
.kp-foot p { margin: 0 0 6px; max-width: 80ch; }
@media (prefers-color-scheme: dark) { .kp-gno { background: var(--accent-soft); color: var(--accent-ink); } }
@media (max-width: 720px) {
  .kp-wrap { padding: 0 16px; }
  .kp-hero { padding: 16px 0 26px; }
  .kp-top { margin-bottom: 22px; }
  .kp-logo .logo { font-size: 26px; }
  .kp-stats { margin-top: 20px; }
  .kp-stats > div { padding: 10px 12px; }
  .kp-stats dd { font-size: 20px; }
  .kp-stats dt { font-size: 10.5px; }
  .kp-actions .kp-btn { flex: 1 1 auto; justify-content: center; }
  .kp-cols { grid-template-columns: 1fr; }
  .kp-sec { padding-top: 30px; }
  .kp-tools, .kp-search, .kp-search input { width: 100%; }
  .kp-acct { grid-template-columns: 1fr; padding: 14px 15px; }
  .kp-no { padding: 0 0 2px; font-size: 13px; }
  .kp-tax-row { grid-template-columns: 1fr; gap: 2px; padding: 12px 15px; }
  .kp-ex-grid { grid-template-columns: 1fr; }
  .kp-rules li, .kp-q li { padding: 14px 14px 14px 50px; }
}
@media print {
  .kp-nav, .kp-tools, .kp-actions { display: none; }
  .kp-hero { background: none; color: #000; padding: 0; } .kp-lead, .kp-stats dt { color: #444; }
  .kp-acct, .kp-ex, .kp-rules li { break-inside: avoid; }
}

/* --- Bankimport: Kontoauszüge ------------------------------------------------------------------ */
.bank-drop { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.bank-file { flex: 1 1 320px; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1.5px dashed var(--line); border-radius: 12px; cursor: pointer; min-width: 0; }
.bank-file:hover, .bank-file:focus-within { border-color: var(--accent); }
.bank-file input { max-width: 46%; }
.bank-file span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bank-tip { flex-basis: 100%; margin: 0; }
.bank-wait { display: flex; gap: 14px; align-items: flex-start; }
.bank-wait p { margin: 2px 0 0; }
.spin { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); animation: bank-spin .9s linear infinite; margin-top: 2px; }
@keyframes bank-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }
.bank-assign h2 { margin-top: 0; }
.bank-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin: 10px 0; }
.bank-opt:has(input[type=radio]:checked) { border-color: var(--accent); background: var(--accent-soft); }
.bank-opt > span { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.bank-opt select { max-width: 100%; }
.bank-new { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px; }
.bank-kpis .kpi-value { font-size: 22px; }
.amt-in { color: var(--ok); }
.bank-recon { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: -6px 0 16px; }
.bank-lines td { vertical-align: top; }
.bank-lines td.pick { padding-top: 14px; }
.bank-what { display: flex; flex-direction: column; gap: 3px; min-width: 200px; }
.bank-what small { display: block; line-height: 1.35; }
.bank-what .err { color: var(--err); }
.bank-act { white-space: nowrap; }
.bank-act .btn + .btn { margin-left: 4px; }
.bank-row.st-gebucht, .bank-row.st-doppelt, .bank-row.st-entfernt, .bank-row.st-ignoriert { color: var(--muted); }
.bank-row.st-entfernt .bank-what b { text-decoration: line-through; }
.bank-add td { padding-top: 12px; border-top: 1px dashed var(--line); }
@media (max-width: 720px) {
  .bank-file input { max-width: 100%; }
  .bank-what { min-width: 0; }
  .bank-lines td.pick { position: absolute; top: 12px; right: 14px; padding: 0; }
  .bank-act { grid-column: 1 / -1; white-space: normal; }
  .bank-lines td[data-l=Datum] { order: 1; } .bank-lines td[data-l=Betrag] { order: 2; }
  .bank-lines td:not([data-l=Datum]):not([data-l=Betrag]) { order: 3; }
  .bank-lines tr:has(td.pick input) td[data-l=Betrag] { padding-right: 34px; }
  .bank-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .bank-kpis .kpi { padding: 12px 14px; }
  .bank-kpis .kpi-value { font-size: 18px; }
}
/* Rechnung mit Zahlung aus dem Bankimport verknüpfen */
.head-grid .bank-link { grid-column: 1 / -1; }
.bank-link .note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0; padding: 8px 10px;
  border: 1px solid var(--line, #ddd); border-radius: 8px; font-size: 13px; color: inherit; }

/* Eröffnungsbilanz */
.opening .rep-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
@media (max-width: 900px) { .opening .rep-cols { grid-template-columns: minmax(0, 1fr); } }
.opening .open-row { grid-template-columns: minmax(0, 1fr) 140px; }
.opening .open-row label { font-weight: 400; margin: 0; font-size: 14px; color: var(--text); }
.opening .open-row small.block { display: block; margin-top: 2px; }
.opening .open-row input { width: 100%; text-align: right; }
.opening .open-row[hidden], .opening .rep-group[hidden] { display: none; }
.opening-sum { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; box-shadow: 0 -4px 14px rgba(0,0,0,.06); }
.opening-sum > div:not(.actions) { display: grid; gap: 2px; }
.opening-sum b { font-size: 17px; }
.opening-sum .actions { margin-left: auto; align-items: center; }
@media (max-width: 560px) { .opening .open-row { grid-template-columns: minmax(0, 1fr) 120px; padding-left: 16px; } .opening-sum .actions { margin-left: 0; } }
