/* Drag n Book – Stylesheet (ohne Build-Schritt, ohne externe Ressourcen) */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #627d98;
  --line: #e4e9f0;
  --primary: #2f5bea;
  --primary-dark: #2148c4;
  --primary-soft: #eaf0ff;
  --ok: #1f8a5b;
  --ok-soft: #e6f6ee;
  --warn: #b7791f;
  --warn-soft: #fff6e5;
  --danger: #c53030;
  --danger-soft: #fdecec;
  --info: #2b6cb0;
  --info-soft: #e8f1fb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 42, 67, .06), 0 4px 16px rgba(16, 42, 67, .05);
  --border: #cdd6e1;
  --border-strong: #a8b8d8;
  --subtle: #f5f7fa;
  --suggest-soft: #fffbea;
  --warn-text: #7a5a10;
  --ok-text: #145c3d;
  --danger-text: #8f2424;
  --info-text: #1f4f85;
  --warn-line: #f0c36d;
  --ok-line: #9ad5b7;
  --info-line: #bcd6f2;
  --danger-line: #f2b8b8;
  color-scheme: light;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .6rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }
.center { text-align: center; }

/* Layout */
.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .65rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.mainnav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.mainnav a { padding: .4rem .75rem; border-radius: 8px; color: var(--muted); font-weight: 500; }
.mainnav a:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.mainnav a.active { background: var(--primary-soft); color: var(--primary); }
.usermenu { display: flex; align-items: center; gap: .75rem; }
.who { display: flex; align-items: center; gap: .5rem; color: var(--text); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.5rem; flex: 1; }
.footer { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; padding: 1rem; color: var(--muted); font-size: .8rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.crumbs { margin: 0 0 .2rem; font-size: .85rem; color: var(--muted); }
.actions { display: flex; gap: .5rem; align-items: center; }
.actions.wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.align-start { align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.card.narrow { max-width: 480px; margin: 2rem auto; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.card-warn { border-color: var(--warn-line); background: var(--warn-soft); }
.card-ok { border-color: var(--ok-line); background: var(--ok-soft); }
.card-info { background: var(--info-soft); border-color: var(--info-line); }
.card-suggest { background: var(--suggest-soft); border-color: var(--warn-line); }
.side .card { margin-bottom: 1rem; }
details.card > summary { cursor: pointer; font-weight: 600; }
details.card[open] > summary { margin-bottom: .75rem; }
.count { display: inline-block; min-width: 1.6em; padding: 0 .45em; border-radius: 99px; background: var(--primary); color: #fff; font-size: .8rem; text-align: center; vertical-align: middle; }

/* Formulare */
label { display: block; font-size: .88rem; font-weight: 500; margin-bottom: .75rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=month], input[type=tel], select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem .7rem; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
input:disabled, select:disabled, textarea:disabled { background: var(--subtle); color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0; display: contents; }
fieldset:disabled .form-actions { display: none; }
textarea { resize: vertical; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.filters { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; padding: 1rem; }
.filters label { margin: 0; min-width: 150px; }
.inline-form { display: inline-flex; gap: .5rem; align-items: center; margin: 0; }
.inline-form label { margin: 0; }
.inline-form select { margin: 0; width: auto; }
.inline-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .75rem; }
.inline-actions form { margin: 0; }
.input-sm { padding: .3rem .5rem !important; width: 140px !important; display: inline-block !important; margin: 0 !important; }
.seg { grid-column: 1 / -1; display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: .75rem; width: max-content; }
.seg label { margin: 0; display: flex; align-items: center; gap: .35rem; padding: .4rem .9rem; cursor: pointer; font-weight: 500; }
.seg label:has(input:checked) { background: var(--primary-soft); color: var(--primary); }
.seg input { margin: 0; }
.copy-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.copy-row input { flex: 1; min-width: 240px; margin: 0; font-family: ui-monospace, monospace; font-size: .85rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .5rem .95rem; font: inherit; font-weight: 600; font-size: .9rem;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #18704a; }
.btn-ok-ghost { color: var(--ok); border-color: var(--ok-line); }
.btn-warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-text); }
.btn-danger { color: var(--danger); border-color: var(--danger-line); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; }
.btn-block { width: 100%; }

/* Badges */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 600; vertical-align: middle; }
.badge-neutral { background: var(--subtle); color: var(--muted); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.pill { display: inline-block; padding: 0 .45rem; border-radius: 6px; background: var(--subtle); color: var(--muted); font-size: .75rem; margin-left: .25rem; vertical-align: middle; }
.pill-warn { background: var(--warn-soft); color: var(--warn); }

/* Hinweise */
.flashes { margin-bottom: 1rem; display: grid; gap: .5rem; }
.flash { padding: .65rem .9rem; border-radius: 8px; border: 1px solid; font-size: .92rem; }
.flash-ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-text); }
.flash-error { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-text); }
.flash-info { background: var(--info-soft); border-color: var(--info-line); color: var(--info-text); }
.notice { background: var(--warn-soft); padding: .5rem .75rem; border-radius: 8px; }

/* Tabellen */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card .table-wrap { border: 0; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: var(--subtle); }
.table tbody tr:hover { background: var(--subtle); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .empty { text-align: center; color: var(--muted); padding: 2rem; }
.table.compact th, .table.compact td { padding: .4rem .6rem; }
.table tr.zero td { color: var(--muted); }
.table tr.group td { background: var(--subtle); font-weight: 600; font-size: .82rem; }
.table tfoot td { border-top: 2px solid var(--line); font-weight: 600; }
.row-income td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.w-check { width: 2rem; }
tr[draggable=true] { cursor: grab; }
.suggest { color: var(--warn-text); font-size: .88rem; }
.pager { display: flex; gap: .5rem; justify-content: center; margin: 1rem 0; }

/* Upload & Drag-and-Drop */
.upload-area { margin-bottom: 1.25rem; }
.dropzone { position: relative; display: flex; align-items: center; gap: 1rem; padding: 1.5rem; border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface);
  cursor: pointer; transition: background .15s, border-color .15s; margin-bottom: .5rem; }
.dropzone:hover, .dropzone:focus { border-color: var(--primary); background: var(--primary-soft); outline: none; }
.dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone-icon { font-size: 2rem; }
.dropzone-fallback input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-top: .75rem; }
.tile { display: flex; flex-direction: column; gap: .15rem; padding: .7rem .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-height: 76px;
  transition: transform .1s, border-color .15s, background .15s; user-select: none; }
.tile-icon { font-size: 1.2rem; }
.tile[data-drop-category] { cursor: pointer; }
.tile:hover { border-color: var(--border-strong); }
.tile-label { font-size: .85rem; font-weight: 600; line-height: 1.2; }
.tile-sum { font-size: .78rem; color: var(--muted); }
.tile.is-over { border-color: var(--primary); background: var(--primary-soft); transform: scale(1.03); }
body.dragging .tile { border-style: dashed; border-color: var(--border-strong); }
.drop-overlay { position: fixed; inset: 0; background: rgba(47, 91, 234, .12); backdrop-filter: blur(1px); z-index: 50; display: grid; place-items: center; pointer-events: none; }
.drop-overlay[hidden] { display: none; }
.drop-overlay-inner { background: var(--surface); border: 2px dashed var(--primary); border-radius: 16px; padding: 2rem 3rem; text-align: center; box-shadow: var(--shadow); }
.drop-icon { font-size: 2.5rem; color: var(--primary); }
.upload-panel { position: fixed; right: 1rem; bottom: 1rem; width: min(420px, calc(100vw - 2rem)); max-height: 60vh; overflow: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 8px 32px rgba(16, 42, 67, .18); z-index: 60; }
.upload-panel[hidden] { display: none; }
.upload-panel-head { display: flex; justify-content: space-between; align-items: center; padding: .6rem .9rem; border-bottom: 1px solid var(--line); }
.upload-panel ul { list-style: none; margin: 0; padding: .4rem .9rem; }
.upload-panel li { padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.upload-panel li:last-child { border-bottom: 0; }
.upload-panel .st { font-size: .8rem; color: var(--muted); display: block; }
.upload-panel .st.ok { color: var(--ok); }
.upload-panel .st.err { color: var(--danger); }
.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: .3rem; }
.progress > span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }

/* KPIs, Listen, Balken */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .15rem; }
.kpi span { font-size: .8rem; color: var(--muted); font-weight: 500; }
.kpi strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.meter { height: 8px; background: var(--line); border-radius: 8px; overflow: hidden; margin: .35rem 0 .15rem; }
.meter-bar { height: 100%; background: var(--ok); width: 0; }
.meter-bar.meter-warn { background: var(--warn); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: .65rem 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list.compact > li { padding: .4rem 0; }
.suggestions li { display: flex; gap: 1rem; justify-content: space-between; align-items: center; cursor: grab; }
.sugg-main { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.reason { font-size: .85rem; color: var(--warn-text); }
.quote { font-size: .88rem; color: var(--warn-text); margin-top: .2rem; font-style: italic; }
.bars { list-style: none; padding: 0; margin: 0 0 .75rem; display: grid; gap: .5rem; }
.bars li { display: grid; grid-template-columns: minmax(120px, 1.3fr) 2fr auto; gap: .6rem; align-items: center; font-size: .88rem; }
.bar { height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 6px; width: 0; }
.bar-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.user-row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.user-row .inline-actions { margin: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* Belegdetail */
.detail { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.preview { position: sticky; top: 76px; }
.preview iframe { width: 100%; height: 72vh; border: 1px solid var(--line); border-radius: 8px; background: var(--subtle); }
.preview img { max-width: 100%; max-height: 72vh; display: block; margin: 0 auto; border-radius: 8px; border: 1px solid var(--line); }
.thread { list-style: none; padding: 0; margin: 0 0 .75rem; display: grid; gap: .5rem; }
.msg { padding: .55rem .75rem; border-radius: 10px; max-width: 92%; }
.msg-firm { background: var(--primary-soft); }
.msg-client { background: var(--subtle); margin-left: auto; }
.msg-head { font-size: .8rem; margin-bottom: .15rem; }
.msg-body { white-space: pre-wrap; }
.history { list-style: none; padding: 0; margin: 0; font-size: .85rem; display: grid; gap: .4rem; }
.ocr-text { white-space: pre-wrap; background: var(--subtle); border: 1px solid var(--line); padding: 1rem; border-radius: 8px; font-size: .85rem; max-height: 70vh; overflow: auto; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--primary); }
.prose { max-width: 780px; }
.prose h2 { margin-top: 1.25rem; }
.invite-box h2 { margin-bottom: .4rem; }

/* Login */
.auth { display: grid; grid-template-columns: 1.2fr 1fr; gap: 2.5rem; align-items: center; max-width: 980px; margin: 3rem auto; }
.auth-intro h1 { font-size: 2.2rem; }
.auth-intro p { font-size: 1.05rem; color: var(--muted); }
.auth-card h2 { margin-bottom: 1rem; }
.checklist { list-style: none; padding: 0; }
.checklist li { padding: .25rem 0 .25rem 1.6rem; position: relative; }
.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }

.skip { position: absolute; left: -999px; top: .5rem; background: var(--surface); padding: .5rem .8rem; border-radius: 8px; z-index: 100; }
.skip:focus { left: .5rem; }
:focus-visible { outline: 3px solid #8fb0ff; outline-offset: 2px; }
main:focus { outline: none; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.steps li { counter-increment: step; padding-left: 2.4rem; position: relative; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; display: grid; place-items: center; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (max-width: 900px) {
  input, select, textarea { font-size: 16px; }
  .grid-2, .detail, .auth { grid-template-columns: 1fr; }
  .preview { position: static; }
  .preview iframe { height: 60vh; }
  .who-name { display: none; }
  .topbar { gap: .75rem; padding: .6rem 1rem; flex-wrap: wrap; }
  .container { padding: 1rem; }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .bars li { grid-template-columns: 1fr auto; }
  .bars .bar { grid-column: 1 / -1; grid-row: 2; }
  .mainnav { order: 3; width: 100%; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; }
  .tile { min-height: 64px; padding: .5rem; }
  .tile-label { font-size: .75rem; }
}

/* ---------------------------------------------------------------- Finanzmodule */
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 600; color: var(--primary); margin: 0 0 4px; }
.subnav { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 18px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.subnav a { padding: 6px 12px; border-radius: 8px; color: var(--text); font-size: 14px; }
.subnav a:hover { background: var(--bg); text-decoration: none; }
.subnav a.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.seg a.active { background: var(--primary); color: #fff; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.list.compact li { padding: 4px 0; }
fieldset.box, .form-grid > fieldset.span-2 { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0 0 .75rem; min-width: 0; }
fieldset[hidden] { display: none; }
legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.form-grid.cols-4 { grid-template-columns: 2fr 1fr 1.3fr 1fr; gap: 0 .5rem; margin-bottom: 6px; }
.form-grid.cols-4 > * { min-width: 0; margin-bottom: .4rem; }
.items-table input, .items-table select, .items-table textarea { width: 100%; }
.items-table textarea { resize: vertical; min-height: 38px; font: inherit; }
.items-table .w-qty { width: 90px; } .items-table .w-unit { width: 110px; } .items-table .w-price { width: 140px; } .items-table .w-vat { width: 100px; }
.invoice-doc { font-size: 14px; }
.inv-frame { width: 100%; aspect-ratio: 210 / 297; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: block; }
.inv-preview p { margin: 8px 0 0; }
.inv-head { display: flex; justify-content: flex-end; text-align: right; color: var(--muted); font-size: 13px; }
.inv-recipient { margin: 18px 0; }
.inv-meta h2 { margin: 0 0 6px; }
.inv-items tfoot td { border-bottom: none; }
.inv-total td { border-top: 2px solid var(--text); }
.inv-foot { margin-top: 18px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; }
.tx-list { display: flex; flex-direction: column; gap: 10px; }
.tx { padding: 14px 16px; border-left: 4px solid var(--line); }
.tx-in { border-left-color: var(--ok); } .tx-out { border-left-color: var(--warn); }
.tx-main { display: flex; justify-content: space-between; gap: 16px; }
.tx-amount { text-align: right; font-weight: 700; font-size: 16px; white-space: nowrap; }
.tx-sugg { margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.sugg-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--ok-soft); border-radius: 8px; padding: 6px 10px; }
.tx details { display: inline-block; }
.tx details[open] { display: block; width: 100%; margin-top: 8px; }
.tx details summary { list-style: none; cursor: pointer; }
.tx details summary::-webkit-details-marker { display: none; }
.aging { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 8px 0 14px; }
.aging-cell { background: var(--bg); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; font-size: 12px; }
.aging-cell strong { font-size: 14px; }
.aging-bad { background: var(--danger-soft); }
.row-warn td { background: var(--warn-soft); }
.perspectives { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0 0 18px; }
.persp h2 { margin: 0 0 8px; font-size: 18px; }
.persp .kv { margin-bottom: 10px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--muted); stroke-width: 1; }
.chart .threshold { stroke: var(--danger); stroke-width: 1.2; stroke-dasharray: 5 4; }
.chart .line-exp { stroke: var(--primary); stroke-width: 2.5; }
.chart .line-cons { stroke: var(--warn); stroke-width: 2; stroke-dasharray: 6 4; }
.chart .dot { fill: var(--primary); }
.chart .tick { fill: var(--muted); font-size: 11px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.key { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--primary); vertical-align: middle; margin-right: 4px; }
.key-cons { border-top: 3px dashed var(--warn); } .key-thr { border-top: 2px dashed var(--danger); }
@media (max-width: 900px) {
  .perspectives { grid-template-columns: 1fr; }
  .aging { grid-template-columns: repeat(2, 1fr); }
  .form-grid.cols-4 { grid-template-columns: 1fr 1fr; }
  .tx-main { flex-direction: column; }
  .tx-amount { text-align: left; }
}
.seg a { padding: .4rem .9rem; color: var(--text); font-weight: 500; border-right: 1px solid var(--border); }
.seg a:last-child { border-right: none; }
.seg a:hover { text-decoration: none; background: var(--bg); }
.seg a.active:hover { background: var(--primary-dark); }
.invoice-doc .kv dd, .letter .kv dd { text-align: left; }
.booking-line { margin-top: 4px; color: var(--text); }
.ai-wait { color: var(--primary); }
.vst { border-radius: 8px; padding: 8px 10px; margin: 8px 0; background: var(--bg); }
.vst-ja { background: var(--ok-soft); } .vst-nein { background: var(--danger-soft); } .vst-pruefen { background: var(--warn-soft); }
.afa { background: var(--bg); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.card.narrow.wide-form { max-width: 720px; }
.form-grid h2.span-2 { margin: .6rem 0 .4rem; font-size: 1.05rem; }
.konto-form input[name=konto] { flex: 1; min-width: 180px; }
.input-with-btn { display: flex; gap: .4rem; align-items: center; }
.input-with-btn input { flex: 1; min-width: 0; }
[data-owner-fields][hidden] { display: none; }
details.vst summary { cursor: pointer; font-weight: 600; }
details.vst[open] summary { margin-bottom: 6px; }
.treatment { background: var(--info-soft, var(--bg)); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }

/* ---------------------------------------------------------------- Dunkles Design */
:root[data-theme="dark"] {
  --bg: #0f1720;
  --surface: #17212b;
  --text: #e3e9ef;
  --muted: #95a7ba;
  --line: #2a3744;
  --primary: #7193ff;
  --primary-dark: #5a7cf0;
  --primary-soft: #1f2b4d;
  --ok: #3cc386;
  --ok-soft: #10291c;
  --warn: #e0a84a;
  --warn-soft: #2f2410;
  --danger: #f07a7a;
  --danger-soft: #361a1a;
  --info: #6aa7ec;
  --info-soft: #14243a;
  --border: #364657;
  --border-strong: #4d6074;
  --subtle: #1c2733;
  --suggest-soft: #2c2712;
  --warn-text: #ecd18f;
  --ok-text: #91e2bc;
  --danger-text: #f6aaaa;
  --info-text: #a9c9f2;
  --warn-line: #6b5524;
  --ok-line: #24573f;
  --info-line: #2b4a70;
  --danger-line: #6b2f2f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0f1720;
    --surface: #17212b;
    --text: #e3e9ef;
    --muted: #95a7ba;
    --line: #2a3744;
    --primary: #7193ff;
    --primary-dark: #5a7cf0;
    --primary-soft: #1f2b4d;
    --ok: #3cc386;
    --ok-soft: #10291c;
    --warn: #e0a84a;
    --warn-soft: #2f2410;
    --danger: #f07a7a;
    --danger-soft: #361a1a;
    --info: #6aa7ec;
    --info-soft: #14243a;
    --border: #364657;
    --border-strong: #4d6074;
    --subtle: #1c2733;
    --suggest-soft: #2c2712;
    --warn-text: #ecd18f;
    --ok-text: #91e2bc;
    --danger-text: #f6aaaa;
    --info-text: #a9c9f2;
    --warn-line: #6b5524;
    --ok-line: #24573f;
    --info-line: #2b4a70;
    --danger-line: #6b2f2f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
.theme-switch, .lang-switch { display: inline-flex; gap: 2px; align-items: center; font-size: .8rem; }
.theme-switch a, .lang-switch a { padding: .2rem .45rem; border-radius: 6px; color: var(--muted); }
.theme-switch a.active, .lang-switch a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
:root[data-theme="dark"] .preview iframe, :root[data-theme="dark"] .preview img { background: #fff; }
.prefs { display: flex; gap: .6rem; align-items: center; margin-left: .5rem; }
@media (max-width: 760px) { .prefs { order: 3; } }
/* Rechnungslayout-Auswahl */
.layout-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.layout-choice { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13px; }
.layout-choice:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft, rgba(37, 99, 235, .2)); }
.layout-choice input { position: absolute; opacity: 0; pointer-events: none; }
.layout-thumb { display: block; position: relative; height: 92px; background: #fff; border: 1px solid #d4d4d8; border-radius: 4px; padding: 10px; }
.layout-thumb i { display: block; height: 10px; width: 36%; background: #1f4e79; border-radius: 2px; margin-bottom: 12px; }
.layout-thumb b { display: block; height: 5px; background: #d4d4d8; border-radius: 2px; margin-bottom: 6px; }
.layout-thumb-klassisch i { margin-left: auto; }
.layout-thumb-modern { padding-top: 0; } .layout-thumb-modern i { width: auto; height: 20px; margin: 0 -10px 12px; border-radius: 3px 3px 0 0; }
.layout-thumb-kompakt i { width: 22%; height: 7px; background: #555; margin-bottom: 8px; }
.logo-preview { max-height: 56px; max-width: 220px; background: #fff; padding: 4px; border: 1px solid var(--line); border-radius: 6px; display: block; margin-bottom: 6px; }
.form-grid input[type="color"], input[type="color"] { width: 72px; height: 38px; padding: 2px; cursor: pointer; }
.heading-row input[type="text"] { font-weight: 700; } .actions-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 16px; }
.layout-group { font-size: 14px; margin: 14px 0 4px; }
.layout-choice a { align-self: flex-start; }
.layout-thumb-v-klassisch i { background: #202933; } .layout-thumb-v-gruppiert { border-top: 4px solid #354b35; } .layout-thumb-v-gruppiert i { background: #354b35; }
.layout-thumb-v-handel i { background: #008b87; } .layout-thumb-v-modern i { background: #5d7079; } .layout-thumb-v-modern b { background: #e3e9ed; }
.layout-thumb-v-studio { border-top: 5px solid #4fb8fa; } .layout-thumb-v-studio i { background: #4e535c; }
.layout-thumb-v-dienstleistung i { background: #282828; margin-left: auto; } .layout-thumb-v-kompakt i { background: #202933; width: 26%; }

/* ---------------------------------------------------------------- Zahlen & Karten (1.4.2)
   Ruhige Farben: Beschriftungen Schiefergrau, Zahlen Anthrazit, Überschriften Dunkelblau, Blau nur für Links,
   negative Beträge gedecktes Rot; Summenzeilen mit Linie darüber und fett; gleich breite Ziffern. */
:root {
  --heading: #1b2f55; --label: #5b6b7d; --num: #1f2933; --neg-text: #a3363c; --neg-soft: #fcf1f1;
  --sum-line: #8796a8; --accent-top: #1f3a6b; --shadow: 0 1px 2px rgba(16, 42, 67, .05);
}
:root[data-theme="dark"] {
  --heading: #cdd9ee; --label: #93a4b6; --num: #e3e9ef; --neg-text: #ec9a9a; --neg-soft: #2e1c1e;
  --sum-line: #5a6b7d; --accent-top: #5a80c8; --shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --heading: #cdd9ee; --label: #93a4b6; --num: #e3e9ef; --neg-text: #ec9a9a; --neg-soft: #2e1c1e;
    --sum-line: #5a6b7d; --accent-top: #5a80c8; --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  }
}
.neg { color: var(--neg-text); }
.num, td.num, .kv dd, .kpi strong, .fig .v, .aging-cell strong, .amount { font-variant-numeric: tabular-nums; }
h1, h2 { color: var(--heading); }
.card, .kpi { border-radius: var(--radius); box-shadow: var(--shadow); }
.eyebrow { color: var(--label); letter-spacing: .1em; font-size: 11.5px; }

/* Perspektiven-Karten auf der Übersicht */
.persp { border-top: 3px solid var(--accent-top); display: flex; flex-direction: column; padding: 1.1rem 1.25rem 1rem; }
.persp-head { border-bottom: 1px solid var(--line); padding-bottom: .6rem; margin-bottom: .15rem; }
.persp-head h2 { margin: 0; font-size: 1.2rem; font-weight: 700; }
.persp .more { margin-top: auto; padding-top: .7rem; }
.figures { display: flex; flex-direction: column; }
.fig { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.fig > span:first-child { color: var(--label); }
.fig .v { color: var(--num); font-weight: 500; text-align: right; white-space: nowrap; }
.fig .v.neg { color: var(--neg-text); }
.fig small { color: var(--label); font-weight: 400; font-size: .82em; }
.fig.total { border-top: 1.5px solid var(--sum-line); border-bottom: 0; margin-top: -1px; }
.fig.total > span:first-child { color: var(--heading); font-weight: 700; }
.fig.total .v { font-weight: 700; }
.fig.total.first { margin-top: .35rem; }
.fig.crit { background: var(--neg-soft); margin-left: -.6rem; margin-right: -.6rem; padding-left: .6rem; padding-right: .6rem; }
.fig .pill { font-size: .72rem; vertical-align: 1px; }

/* Warnhinweis */
.alert { display: flex; gap: .6rem; align-items: flex-start; padding: .65rem .8rem; border-radius: 8px; margin: .75rem 0 0; font-size: .9rem; color: var(--text); }
.alert p { margin: 0; }
.alert-warn { background: var(--warn-soft); border-left: 3px solid var(--warn); }
.alert-info { background: var(--info-soft); border-left: 3px solid var(--info); }
.alert-info .alert-icon { background: var(--info); }
.alert-icon { flex: none; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: var(--warn); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .78rem; margin-top: .1rem; }
div.alert + div.alert { margin-top: .5rem; }
.page-head + .alert, .alert + .kpis { margin-bottom: 1rem; }

/* Kennzahlen-Kacheln */
.kpi span { color: var(--label); }
.kpi strong { color: var(--num); font-weight: 600; }
.kpi strong.pos { color: var(--num); }
.kpi strong.neg { color: var(--neg-text); }
.kpi-total { border-top: 3px solid var(--accent-top); }
.kpi-total strong { font-weight: 700; }
.kpi.crit { background: var(--neg-soft); }
.kv dt { color: var(--label); }
.kv dd { color: var(--num); }
.kv dd.pos { color: var(--num); }

/* Summenzeilen in Tabellen */
.table tfoot td { border-top: 1.5px solid var(--sum-line); border-bottom: 0; font-weight: 700; color: var(--heading); }
.table tfoot td.num { color: var(--num); }
.warn-list { list-style: none; padding: 0; margin: 0; }
.warn-list li { padding: .35rem 0 .35rem 1.4rem; position: relative; }
.warn-list li::before { content: "!"; position: absolute; left: 0; top: .45rem; width: 1rem; height: 1rem; border-radius: 50%; background: var(--warn); color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center; }
.fig small.sub { display: block; margin-top: .1rem; }
.table td.num, .table th.num { white-space: nowrap; }

/* ---------------------------------------------------------------- Einstellungen (1.5) */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; position: sticky; top: 76px; box-shadow: var(--shadow); }
.settings-nav a { padding: .5rem .75rem; border-radius: 8px; color: var(--text); font-size: .92rem; }
.settings-nav a:hover { background: var(--bg); text-decoration: none; }
.settings-nav a.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.settings-main > .card:first-child, .settings-main > form > .card:first-of-type { margin-top: 0; }
.form-section { margin: .75rem 0 .1rem; font-size: 1rem; color: var(--heading); border-top: 1px solid var(--line); padding-top: .9rem; }
.bank-row { border-bottom: 1px solid var(--line); padding: .25rem 0 .9rem; margin-bottom: .9rem; }
.bank-row:last-of-type { border-bottom: 0; margin-bottom: 0; }
.bank-row .actions { margin-top: .2rem; }
.spacer { flex: 1; }
.add-year { margin-top: 1rem; display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.add-year label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
.field-value { display: block; padding: .5rem 0; }
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
}
.bank-grid { grid-template-columns: 1.2fr 1.7fr .8fr 1fr; gap: 0 .6rem; }
.bank-grid > * { min-width: 0; margin-bottom: .4rem; }
.gear { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); padding: .35rem .55rem; border-radius: 8px; font-size: .9rem; font-weight: 500; }
.gear:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.gear.active { background: var(--primary-soft); color: var(--primary); }
@media (max-width: 1400px) { .gear-label { display: none; } }
@media (max-width: 900px) { .bank-grid { grid-template-columns: 1fr 1fr; } }
/* Lerngedächtnis */
.badge-memory { background: #efe9fb; color: #5b3fa8; }
:root[data-theme="dark"] .badge-memory { background: #2d2547; color: #c9b8f5; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .badge-memory { background: #2d2547; color: #c9b8f5; } }
.memory-line { display: flex; align-items: center; gap: .45rem; color: var(--label); margin: .25rem 0 .5rem; }
.memory-dot { width: .5rem; height: .5rem; border-radius: 50%; background: #7c5cd6; flex: none; }

/* v1.6.1 – Beleg löschen / stornieren */
.w-act { width: 2.5rem; text-align: right; }
.w-act form { margin: 0; display: inline; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--subtle); color: var(--text); }
.icon-btn.icon-danger:hover { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.icon-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.card-danger-zone > summary { color: var(--danger-text); }
.card-danger-zone[open] { border-color: var(--danger-line); }

/* v1.6.1 – Jahresauswahl als dezenter Textlink mit Pfeil (statt Auswahlbox) */
.year-pick { position: relative; display: inline-flex; align-items: center; color: var(--primary); }
.year-pick select, .inline-form .year-pick select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none; width: auto; margin: 0;
  padding: .3rem 1.6rem .3rem .5rem; border: 0; border-radius: 8px; background: transparent; box-shadow: none;
  color: var(--primary); font-weight: 500; font-size: .95rem; cursor: pointer; }
.year-pick select:hover { background: var(--primary-soft); }
.year-pick select:focus { outline: none; }
.year-pick select:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.year-pick select option { color: var(--text); background: var(--surface); font-weight: 400; }
.year-pick::after { content: ""; position: absolute; right: .6rem; top: 50%; width: .42rem; height: .42rem;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: translateY(-70%) rotate(45deg); pointer-events: none; }

/* v1.7 – Kontenstände, BMD-Import */
.w-konto { width: 6rem; }
.accounts-table td.num, .accounts-table th.num { width: 9rem; }
.bmd-mode { display: block; margin-top: .75rem; }
.bmd-mode legend { font-weight: 600; margin-bottom: .25rem; }

/* v1.8 – UVA & ZM */
.alert-error { background: var(--danger-soft); border-left: 3px solid var(--danger); }
.alert-error .alert-icon { background: var(--danger); }
.alert ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.kz-table .w-kz { width: 4rem; }
.kz-table tr.kz-group th { text-align: left; background: var(--subtle); color: var(--heading, var(--text)); font-size: .8rem;
  text-transform: none; letter-spacing: 0; padding-top: .55rem; }
.kz-table tr.kz-sum td { font-weight: 600; border-top: 1px solid var(--sum-line, var(--border)); }
.howto summary { font-weight: 600; }
.howto .steps { margin: .6rem 0 .4rem; padding-left: 1.2rem; }
.howto .steps li { margin-bottom: .3rem; }
.row-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.row-actions form { margin: 0; }
.treat-form select { min-width: 14rem; max-width: 22rem; font-size: .82rem; padding: .3rem .45rem; }
.treat-doc { margin-top: .6rem; }
.treat-doc select { font-size: .85rem; }
.create-form { margin-top: .5rem; }
.fon-table td { vertical-align: middle; }

/* v1.8.1 – Hilfe */
.help-fab { position: fixed; left: 1rem; bottom: 1rem; z-index: 40; display: inline-flex; align-items: center; gap: .45rem;
  padding: .4rem .85rem .4rem .4rem; border-radius: 999px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(16, 42, 67, .14); font-size: .88rem; font-weight: 600;
  text-decoration: none; }
.help-fab:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.help-fab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.help-fab-icon { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 800; font-size: .9rem; }
@media (max-width: 640px) { .help-fab { padding: .35rem; } .help-fab-label { display: none; } main.container { padding-bottom: 4rem; } }
@media print { .help-fab { display: none; } }
.footer { padding-left: 7rem; padding-right: 7rem; }
@media (max-width: 640px) { .footer { padding-left: 3.5rem; padding-right: 1rem; } }

.help-search { padding: .9rem 1rem; }
.help-search input { margin: 0; font-size: 1rem; }
.help-search p { margin: .5rem 0 0; }
.help-layout { display: grid; grid-template-columns: 240px 1fr; gap: 1rem; align-items: start; }
.help-toc { position: sticky; top: 4.75rem; padding: .8rem; max-height: calc(100vh - 6rem); overflow: auto; }
.help-toc ul { list-style: none; margin: 0; padding: 0; }
.help-toc li a { display: block; padding: .35rem .5rem; border-radius: 8px; color: var(--text); font-size: .88rem; }
.help-toc li a:hover, .help-toc li a.active { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.help-toc li[hidden] { display: none; }
.help-topics { display: grid; gap: 1rem; min-width: 0; }
.help-topics .card { margin: 0; }
.help-topic { scroll-margin-top: 5rem; }
.help-topic:target, .help-topic.is-current { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.help-topic[hidden] { display: none; }
.help-body p, .help-body li { line-height: 1.6; }
.help-body ul, .help-body ol { padding-left: 1.2rem; }
.help-body li { margin-bottom: .35rem; }
.help-faq { border-top: 1px solid var(--line); padding: .55rem 0; }
.help-faq summary { cursor: pointer; font-weight: 600; }
.help-faq p { margin: .4rem 0 0; color: var(--muted); }
mark.help-hit { background: var(--warn-soft); color: inherit; padding: 0 .1rem; border-radius: 3px; }
@media (max-width: 860px) { .help-layout { grid-template-columns: 1fr; } .help-toc { position: static; } }

/* v1.9 – Personal */
.nav-badge { display: inline-grid; place-items: center; min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; margin-left: .2rem;
  border-radius: 999px; background: var(--primary); color: #fff; font-size: .7rem; font-weight: 700; vertical-align: 1px; }
.personnel-upload { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem 1rem; align-items: end; }
.personnel-upload label { margin: 0; }
.personnel-upload .span-all { grid-column: 1 / -1; }
.personnel-filters { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; padding: .8rem 1rem; }
.personnel-filters label { margin: 0; min-width: 12rem; }
.personnel-table td:first-child a { font-weight: 600; }
.inline-edit { position: relative; display: inline-block; }
.inline-edit > summary { list-style: none; }
.inline-edit > summary::-webkit-details-marker { display: none; }
.inline-edit[open] .stack-form { position: absolute; right: 0; top: calc(100% + .3rem); z-index: 20; width: 18rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .8rem; box-shadow: var(--shadow, 0 6px 20px rgba(0,0,0,.12)); }
.stack-form { display: grid; gap: .5rem; }
.stack-form label { margin: 0; font-size: .85rem; }
.empty-state { text-align: center; padding: 2rem 1rem; }
@media (max-width: 760px) { .personnel-upload { grid-template-columns: 1fr; } }
.personnel-upload input[type=file] { display: block; width: 100%; margin-top: .3rem; padding: .55rem; border: 1px dashed var(--line);
  border-radius: 10px; background: var(--subtle); font: inherit; color: var(--text); }
.personnel-table { table-layout: fixed; }
.personnel-table th:nth-child(2), .personnel-table td:nth-child(2) { width: 7.5rem; }
.personnel-table th:nth-child(3), .personnel-table td:nth-child(3) { width: 12rem; }
.personnel-table th:nth-child(4), .personnel-table td:nth-child(4) { width: 5.5rem; }
.personnel-table th:nth-child(5), .personnel-table td:nth-child(5) { width: 17rem; }
.personnel-table td:first-child { overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- v1.9.1 – Design-Feinschliff (UI-Playbook)
   1. Kontrast statt Schatten   2. Blau nur für die Hauptaktion, aktive Zustände und Fließtext-Links
   3. Gemeinsame Kanten statt Karten-Stapel   4. Lokale Navigation sichtbar anders als die globale
   5. Kleine, ruhige Rückmeldungen (Hover, Klick, Balken, Kennzahlen) */

/* 1 · Flächen grenzen sich über Hintergrund und feine Linie ab – keine Schlagschatten */
.card, .kpi, .table-wrap, .settings-nav, .subnav { box-shadow: none; }
.card { padding: 1.25rem 1.35rem; }
.side .card, .help-topics .card { box-shadow: none; }

/* 2 · Feuerwehr-Regel */
.row-link { color: var(--text); font-weight: 600; }
.row-link:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
main p a:not(.btn), .alert a, .flash a {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
main p a:not(.btn):hover, .alert a:hover { text-decoration-color: currentColor; }
.count { background: var(--subtle); color: var(--label); border: 1px solid var(--line); font-weight: 600; }
.avatar { background: var(--subtle); color: var(--heading); border: 1px solid var(--line); font-size: .8rem; }
.btn-primary { box-shadow: 0 1px 2px rgba(33, 72, 196, .25); }
.btn:not(.btn-primary):not(.btn-ok):not(.btn-ghost):hover { border-color: var(--border-strong); background: var(--surface); }
.btn-sm { font-weight: 500; }
.help-fab-icon { background: var(--subtle); color: var(--heading); border: 1px solid var(--line); }
.help-fab { box-shadow: 0 1px 3px rgba(16, 42, 67, .12); }
.theme-switch a, .lang-switch a { min-width: 26px; height: 26px; display: inline-grid; place-items: center; padding: 0 .35rem; }
.theme-switch a.active, .lang-switch a.active { background: var(--subtle); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.dropzone-icon { color: var(--primary); display: grid; place-items: center; }
/* Einnahmen nicht grün einfärben – Grün bleibt Erfolgs- und Statusmeldungen vorbehalten */
.row-income td:first-child { box-shadow: inset 3px 0 0 var(--ok-line); }

/* Vorschläge als ruhiger Chip statt Warnfarbe (Gelb/Orange heißt „Achtung“) */
.chip { display: inline-flex; align-items: center; gap: .25rem; padding: .02rem .5rem; border-radius: 6px; background: var(--subtle);
  border: 1px solid var(--line); color: var(--text); font-size: .78rem; font-weight: 500; white-space: nowrap; vertical-align: 1px; }
.suggest, .reason { color: var(--label); font-size: .88rem; }
.suggest .chip { color: var(--label); background: transparent; border-style: dashed; margin-right: .2rem; }
.reason .chip { margin-right: .3rem; }
.suggestions li { padding: .8rem 0; }

/* Personen als Initialen (Zuständigkeit auf einen Blick) */
.avatar-sm { width: 22px; height: 22px; font-size: .66rem; flex: none; }
.people { display: flex; flex-direction: column; gap: .3rem; }
.person { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; }

/* 3 · Kanten statt Karten */
.filters.card { background: transparent; border: 0; padding: 0; margin-bottom: 1rem; }
.filters.card label:not(.check) { font-size: .8rem; color: var(--label); }
.filters.card label.check { align-self: flex-end; padding-bottom: .6rem; }
.surface-list { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.surface-list > .tx { border-left: 0; padding: .9rem 1.2rem .55rem; margin: 0; }
.surface-list > .tx + .tx { border-top: 1px solid var(--line); }
.tx .tx-amount { color: var(--num); font-weight: 600; font-size: 1rem; }
.tx .tx-amount .badge { margin-top: .2rem; }
.tx .inline-actions { margin: .35rem 0 0 -.65rem; }
.tx .sugg-row { background: var(--subtle); border: 1px solid var(--line); }
.card-flush { padding-bottom: .35rem; }
.card-flush > h2 { margin-bottom: .5rem; }
.card-flush .table-wrap { margin: 0 -1.35rem; border-radius: 0; }
.card-flush .table th { background: transparent; }
.card-flush .table th:first-child, .card-flush .table td:first-child { padding-left: 1.35rem; }
.card-flush .table th:last-child, .card-flush .table td:last-child { padding-right: 1.35rem; }
.card-flush .table tbody tr:last-child td { border-bottom: 0; }
.fig-note { margin-top: .7rem; font-size: .85rem; color: var(--label); }
.fig-note-row { display: flex; justify-content: space-between; gap: 1rem; }
.fig-note-row .num { color: var(--num); }
.fig-note small { color: var(--label); }
.tile { min-height: 68px; }
.tile:hover { border-color: var(--primary); }

/* 4 · Lokale Navigation als Reiter mit Unterstrich – klar unterscheidbar von der Hauptnavigation oben */
.subnav { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0; gap: 0 .15rem;
  margin: -.25rem 0 1.5rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
.subnav a { padding: .6rem .7rem; border-radius: 0; color: var(--label); border-bottom: 2px solid transparent; font-size: .9rem; white-space: nowrap; }
.subnav a:hover { background: transparent; color: var(--text); text-decoration: none; }
.subnav a.active { background: transparent; color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }
/* Segment-Schalter: aktiver Teil hebt sich hell ab statt in Vollfarbe */
.seg { background: var(--subtle); border-color: var(--line); padding: 3px; gap: 2px; border-radius: 10px; }
.seg a, .seg label { border-right: 0; border-radius: 7px; color: var(--label); }
.seg a:hover { background: var(--surface); color: var(--text); }
.seg a.active, .seg label:has(input:checked) { background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(16, 42, 67, .08); }
.seg a.active:hover { background: var(--surface); }

/* 5 · Mikro-Interaktionen */
.btn, .icon-btn, .mainnav a, .subnav a, .seg a, .seg label, .gear, .tile, .theme-switch a, .lang-switch a, .help-fab {
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease; }
.btn:active, .icon-btn:active { transform: translateY(1px); }
.meter-bar, .bar-fill { transition: width .7s cubic-bezier(.2, .7, .2, 1); }
@keyframes dnb-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.flash, .alert { animation: dnb-in .25s ease-out both; }
[data-countup] { font-variant-numeric: tabular-nums; }
/* Schmale Bildschirme: nichts darf die Seite seitlich verbreitern */
.reason .chip { white-space: normal; }
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg a, .seg label { white-space: nowrap; flex: none; }
@media (max-width: 900px) {
  .grid-2, .detail, .perspectives { grid-template-columns: minmax(0, 1fr); }
  .suggestions li { flex-wrap: wrap; }
}
.table-wrap { position: relative; } /* hält auch unsichtbare Beschriftungen (sr-only) im Scrollbereich */
@media (max-width: 560px) {
  .mainnav { order: 4; flex: 0 0 calc(100% + 2rem); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem; padding: 0 1rem; }
  .prefs { margin-left: auto; }
  .mainnav a { flex: none; }
  .card { padding: 1rem; }
  .card-flush .table-wrap { margin: 0 -1rem; }
  .card-flush .table th:first-child, .card-flush .table td:first-child { padding-left: 1rem; }
  .card-flush .table th:last-child, .card-flush .table td:last-child { padding-right: 1rem; }
}

/* v1.10.1 – USt automatisch */
.vat-calc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: inherit; column-gap: 1rem; row-gap: .75rem; }
.vat-calc label { margin: 0; }
.vat-calc .vat-hint { grid-column: 1 / -1; margin: -.25rem 0 0; min-height: 1.1em; }
.vat-calc input.is-auto { background: var(--subtle); }
.link-btn { border: 0; background: none; padding: 0; color: var(--primary); font: inherit; cursor: pointer; text-decoration: underline; }
.items-table .w-total { width: 120px; }
.items-table .line-total { color: var(--num, var(--text)); font-variant-numeric: tabular-nums; }
.items-summary { margin: .75rem 0 .5rem auto; max-width: 320px; font-variant-numeric: tabular-nums; }
.items-summary .sum-row { display: flex; justify-content: space-between; gap: 1rem; padding: .2rem 0; }
.items-summary .sum-total { font-weight: 700; border-top: 1px solid var(--sum-line, var(--line)); margin-top: .2rem; padding-top: .35rem; }
.items-summary:empty { display: none; }

/* v1.12 – Sprachmenü (5 Sprachen) */
.lang-menu { position: relative; }
.lang-menu > summary { list-style: none; display: inline-flex; align-items: center; gap: .3rem; height: 28px; padding: 0 .55rem;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--label, var(--muted));
  font-size: .78rem; font-weight: 600; letter-spacing: .02em; cursor: pointer; user-select: none; }
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-menu > summary:hover, .lang-menu[open] > summary { color: var(--text); border-color: var(--border, var(--line)); }
.lang-menu > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.lang-list { position: absolute; right: 0; top: calc(100% + .35rem); z-index: 60; min-width: 11rem; margin: 0; padding: .3rem;
  list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px -12px rgba(16, 42, 67, .35); animation: dnb-in .15s ease-out both; }
.lang-list a { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .45rem .65rem;
  border-radius: 8px; color: var(--text); font-size: .9rem; text-decoration: none; }
.lang-list a:hover { background: var(--subtle); text-decoration: none; }
.lang-list a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.lang-short { font-size: .72rem; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.lang-list a.active .lang-short { color: inherit; }

/* v1.13 – Artikel & Kategorien */
.article-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.article-cats { position: sticky; top: 4.75rem; padding: .8rem; }
.article-cats ul { list-style: none; margin: 0 0 .6rem; padding: 0; }
.article-cats li a { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .4rem .55rem;
  border-radius: 8px; color: var(--text); font-size: .9rem; }
.article-cats li a:hover, .article-cats li a.active { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.article-cats li a .count { font-size: .72rem; }
.article-filters .grow { flex: 1 1 16rem; }
.article-table tr.is-inactive td { opacity: .55; }
.clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; max-width: 32rem; }
.import-box summary { cursor: pointer; }
.import-box[open] summary { margin-bottom: .5rem; }
.article-form .advanced { border-top: 1px solid var(--line); padding-top: .75rem; }
.article-form .advanced summary { cursor: pointer; color: var(--label); font-weight: 600; margin-bottom: .5rem; }
.article-danger .inline-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.category-form { display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(14rem, 1.4fr) auto; gap: .75rem; align-items: end; }
@media (max-width: 860px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); }
  .article-cats { position: static; }
  .article-cats ul { display: flex; flex-wrap: wrap; gap: .3rem; }
  .category-form { grid-template-columns: minmax(0, 1fr); }
}
/* Artikel im Rechnungseditor */
.article-picker { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .25rem 0 .75rem; padding: .6rem .75rem;
  border: 1px dashed var(--line); border-radius: 10px; background: var(--subtle); }
.article-picker input { flex: 1 1 18rem; margin: 0; }
.article-picker [data-article-msg] { flex-basis: 100%; }
.article-picker [data-article-msg]:empty { display: none; }
.article-form [hidden] { display: none !important; }
.article-table th { white-space: nowrap; }
.item-sku { display: block; font-size: .72rem; color: var(--muted); margin-top: .15rem; }
