/* Helle Seitenleiste, weißer Arbeitsbereich, dunkles Marineblau für Hauptaktionen, Violett für Einnahmen, Koralle für Ausgaben.
   Schrift: Inter (lokal in fonts/, SIL Open Font License). */
@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --bg: #fff; --sidebar: #fbf9f9; --surface: #fff; --surface-2: #f7f7f7; --hover: rgb(6 3 20 / 5%);
  --text: #100b2d; --muted: #5e5e74; --subtle: #777787;
  --border: rgb(6 3 20 / 17%); --border-card: rgb(6 3 20 / 12%); --border-soft: rgb(6 3 20 / 6%);
  --primary: #212144; --primary-hover: #33335f; --on-primary: #fff; --focus: rgb(84 72 214 / 45%);
  --in: #4b3fcf; --out: #c4462f; --in-bar: #5b4fe0; --out-bar: #e8664f;
  --ok-bg: #d7f6e6; --ok: #006054; --open-bg: #fdf0d2; --open: #7a4f00; --late-bg: #fde3df; --late: #a8261a;
  --draft-bg: #ecebfb; --draft: #4136b5; --neutral-bg: rgb(6 3 20 / 6%); --neutral: #6a6a78;
  --row-warn: #fff6f4;
  --radius: 12px; --radius-sm: 8px;
  --shadow-card: 0 1px 6px rgb(6 3 20 / 8%); --shadow-button: 0 1px 1px rgb(6 3 20 / 7%); --shadow-dialog: 0 16px 48px rgb(6 3 20 / 22%);
  --logo-tile: #f0eee6; --logo-ink: #191919;
  --danger: #c4321f; --danger-hover: #a92a19; --toast-bg: #1d1b33; --toast-text: #fff; --skeleton: rgb(6 3 20 / 7%);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14141b; --sidebar: #181820; --surface: #1d1d26; --surface-2: #24242f; --hover: rgb(255 255 255 / 6%);
    --text: #ececf3; --muted: #a6a6ba; --subtle: #8b8b9f;
    --border: rgb(255 255 255 / 16%); --border-card: rgb(255 255 255 / 10%); --border-soft: rgb(255 255 255 / 7%);
    --primary: #e4e2ff; --primary-hover: #cfccff; --on-primary: #100b2d; --focus: rgb(164 156 255 / 55%);
    --in: #aea6ff; --out: #ff9b88; --in-bar: #786cf5; --out-bar: #d9654f;
    --ok-bg: #12382c; --ok: #7fe0b9; --open-bg: #3a2e12; --open: #f3cd7a; --late-bg: #43201c; --late: #ffa69a;
    --draft-bg: #2a2850; --draft: #c4bfff; --neutral-bg: rgb(255 255 255 / 8%); --neutral: #b4b4c4;
    --row-warn: #2c1d1d;
    --logo-tile: #2c2b27; --logo-ink: #f0eee6;
    --danger: #e0533f; --danger-hover: #ef6b58; --toast-bg: #ecebf7; --toast-text: #100b2d; --skeleton: rgb(255 255 255 / 8%);
    --shadow-card: none; --shadow-button: none; --shadow-dialog: 0 16px 48px rgb(0 0 0 / 60%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
h1 { font-size: 24px; font-weight: 500; margin: 0; letter-spacing: -0.015em; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.005em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Seitenaufbau */
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 20px 12px 16px; background: var(--sidebar); border-right: 1px solid var(--border-soft); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark { width: 28px; height: 28px; }
.nav-count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--draft-bg); color: var(--draft); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.nav-count[hidden] { display: none; }
.sidebar nav ul { display: grid; gap: 2px; list-style: none; margin: 0; padding: 0; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-radius: var(--radius-sm); color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none; transition: background-color 0.15s, color 0.15s; }
.sidebar nav a:hover { background: var(--hover); color: var(--text); }
.sidebar nav a[aria-current="page"] { color: var(--text); font-weight: 600; background: var(--hover); }
.sidebar nav a[aria-current="page"] svg { stroke-width: 2.1; }
.nav-section { padding: 22px 8px 6px; color: var(--subtle); font-size: 10px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.sidebar svg, .quick svg { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 10px 8px; border-radius: var(--radius-sm); color: var(--subtle); font-size: 12px; line-height: 1.4; text-decoration: none; }
.sidebar-foot::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.sidebar-foot.warn::before { background: var(--late); }
.sidebar-foot:empty { display: none; }
.sidebar-foot:hover { background: var(--hover); color: var(--text); }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.content { width: 100%; max-width: 1240px; padding: 36px 40px 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }

/* Kennzahlen und Schnellzugriff (Übersicht) */
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.quick a { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 0.5px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; text-decoration: none; transition: border-color 0.15s, background-color 0.15s; }
.quick a:hover { background: var(--surface-2); border-color: var(--text); }
.quick svg { width: 16px; height: 16px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { margin: 0; padding: 18px 20px; }
a.tile { color: inherit; text-decoration: none; transition: border-color 0.15s; }
a.tile:hover { border-color: var(--border); box-shadow: 0 4px 14px rgb(6 3 20 / 10%); }
a.tile .label::after { content: " ›"; color: var(--subtle); }
.tile .value:empty::before { content: ""; display: block; width: 60%; height: 1em; margin: 0.15em 0; border-radius: 6px; background: var(--skeleton); animation: pulse 1.2s ease-in-out infinite; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.tile .value { margin-top: 6px; font-size: 28px; font-weight: 500; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }

/* Karten und Tabellen */
.card { position: relative; margin-bottom: 20px; padding: 18px 20px; overflow: hidden; background: var(--surface); border: 1px solid var(--border-card); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.card > .scroll { margin: 0 -20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card > .scroll:last-child { margin-bottom: -18px; }
.card > .scroll + p { margin-top: 14px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--border-soft); text-align: right; white-space: nowrap; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
th:first-child, td:first-child, td.text, th.text { text-align: left; }
thead th { padding-top: 12px; padding-bottom: 12px; background: var(--surface-2); border-bottom: 0; color: var(--text); font-size: 12px; font-weight: 500; }
.card > .scroll tbody tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; min-width: 160px; }
td .muted { margin-top: 1px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
tr.overdue td { background: var(--row-warn); }
.in { color: var(--in); }
.out { color: var(--out); }
.empty { padding: 14px 0; color: var(--muted); }
td.label { white-space: normal; min-width: 260px; }
tr.depth-0 td { font-weight: 600; }
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
svg.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
td.attachment { width: 36px; color: var(--subtle); }
tr.clickable:hover td.attachment { color: var(--text); }

.alert { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 20px; padding: 12px 16px; background: var(--late-bg); color: var(--late); border-radius: var(--radius-sm); }
ul.alert { display: block; }
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; padding: 14px 18px; border: 1px solid var(--border-card); border-left: 4px solid var(--open); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.banner .muted { margin-top: 2px; }
details.collapsible { padding: 0; }
details.collapsible > summary { display: flex; align-items: center; gap: 10px; padding: 16px 20px; cursor: pointer; list-style: none; }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary::before { content: "›"; display: inline-block; width: 12px; color: var(--muted); font-size: 18px; line-height: 1; transition: transform 0.15s; }
details.collapsible[open] > summary::before { transform: rotate(90deg); }
details.collapsible > summary h2 { margin: 0; }
details.collapsible > .scroll { margin: 0; border-top: 1px solid var(--border-soft); }
td.row-go { width: 28px; color: var(--subtle); font-size: 18px; }
tr.clickable:hover td.row-go { color: var(--text); }

/* Leere Listen und Ladeplatzhalter */
td.empty-state { padding: 36px 20px; text-align: center; white-space: normal; }
td.empty-state > * { display: block; margin: 0 auto; }
td.empty-state strong { font-size: 15px; font-weight: 600; }
td.empty-state .muted { max-width: 420px; margin-top: 4px; }
td.empty-state .button, td.empty-state button { display: inline-flex; margin-top: 14px; }
tr.skeleton td span { display: block; height: 10px; border-radius: 5px; background: var(--skeleton); animation: pulse 1.2s ease-in-out infinite; }
tr.skeleton td:nth-child(2) span { width: 70%; }
@keyframes pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { tr.skeleton td span, .tile .value:empty::before { animation: none; } }

/* Einblendungen */
.toasts { position: fixed; inset: auto 20px 20px auto; z-index: 50; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); margin: 0; padding: 0; border: 0; background: none; overflow: visible; color: inherit; }
.toasts:empty { display: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 11px 10px 11px 16px; border-radius: var(--radius-sm); background: var(--toast-bg); color: var(--toast-text); box-shadow: var(--shadow-dialog); font-size: 13.5px; animation: toast-in 0.18s ease-out; }
.toast > span { flex: 1; }
.toast.ok > span::before { content: "✓"; margin-right: 8px; color: #6ee7b7; font-weight: 700; }
.toast.error { background: var(--late-bg); color: var(--late); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }
.toast button { padding: 2px 8px; border: 0; background: none; box-shadow: none; color: inherit; font-size: 13px; }
.toast .toast-action { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.toast .toast-close { opacity: 0.6; }
.toast button:hover { background: rgb(127 127 127 / 18%); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* Fehler am Feld */
.invalid, input.invalid, select.invalid { border-color: var(--late) !important; }
.position.invalid, .line.invalid { box-shadow: inset 3px 0 0 var(--late); background: var(--row-warn); }
/* Auch innerhalb von label.field, dessen Kind-Regel sonst Farbe und Schriftstärke überschreibt */
.field-error, label.field > .field-error { grid-column: 1 / -1; margin: 2px 0 0; color: var(--late); font-size: 12px; font-weight: 500; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

/* Statusmarken */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; background: var(--neutral-bg); color: var(--neutral); font-size: 12px; font-weight: 500; line-height: 16px; }
.chip.ok, .chip.open, .chip.late { padding-left: 7px; }
.chip.ok::before, .chip.open::before, .chip.late::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.open { background: var(--open-bg); color: var(--open); }
.chip.late { background: var(--late-bg); color: var(--late); }
.chip.draft { background: var(--draft-bg); color: var(--draft); }

/* Bedienelemente */
button[hidden], .button[hidden] { display: none; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 0.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-button); font: inherit; font-size: 14px; font-weight: 500; line-height: 22px; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s; }
button:hover, .button:hover { background: var(--surface-2); }
button:active, .button:active { transform: translateY(0.5px); }
button.primary, .button.primary { background: var(--primary); border-color: transparent; color: var(--on-primary); }
button.primary:hover, .button.primary:hover { background: var(--primary-hover); }
button.small { padding: 4px 10px; font-size: 13px; line-height: 18px; }
button:disabled { opacity: 0.45; cursor: default; transform: none; }
button.danger { background: var(--danger); border-color: transparent; color: #fff; }
button.danger:hover { background: var(--danger-hover); }
/* Laufende Aktion: Kreisel im Knopf, Knopf bleibt gut lesbar */
.busy { pointer-events: none; }
button.busy:disabled { opacity: 0.85; }
.busy::before { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@media (prefers-reduced-motion: reduce) { .busy::before { animation: none; } }
.button { position: relative; }
input[type="file"] { padding: 6px; border-style: dashed; background: var(--surface-2); color: var(--muted); font-size: 13px; cursor: pointer; }
input[type="file"]:hover { border-color: var(--text); }
input[type="file"]::file-selector-button { margin-right: 10px; padding: 4px 12px; border: 0.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-button); font: inherit; font-weight: 500; cursor: pointer; }
input[type="file"]:hover::file-selector-button { background: var(--surface-2); }
.button input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
a.button { text-decoration: none; }
button.link { padding: 0; border: 0; background: none; box-shadow: none; color: inherit; font-weight: inherit; text-align: left; text-decoration: underline dotted; text-underline-offset: 3px; }
input, select, textarea { padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); border-color: var(--border-soft); color: var(--text); opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--text); outline: 3px solid var(--focus); outline-offset: 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
input.amount { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
input.short { width: 64px; }
label.field { display: grid; align-content: start; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 500; }
label.field > * { min-width: 0; max-width: 100%; color: var(--text); font-weight: 400; }
fieldset { min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.form-grid .wide { grid-column: 1 / -1; }

/* Dialog */
dialog { width: min(1120px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow-dialog); }
dialog::backdrop { background: rgb(16 11 45 / 40%); }
dialog[open] { animation: dialog-in 0.16s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(0.99); } }
@media (prefers-reduced-motion: reduce) { dialog[open] { animation: none; } }
.dialog-close { position: absolute; top: 12px; right: 12px; z-index: 3; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; box-shadow: none; color: var(--muted); font-size: 14px; }
.dialog-close:hover { background: var(--hover); color: var(--text); }
.editor > form > h2:first-child, .editor .card-head, .assign-body .picker-head { padding-right: 40px; }
dialog.confirm { width: min(440px, calc(100vw - 32px)); }
.confirm-body { padding: 22px 24px 18px; }
.confirm-body h2 { margin: 0 0 6px; font-size: 17px; }
.confirm-body p { margin: 0; line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.dialog-body { display: grid; grid-template-columns: minmax(0, var(--split, 1fr)) minmax(0, 1.1fr); min-height: 70vh; }
/* Breite und Aufteilung ziehen (resize.js); --dialog-width und --split setzt das Skript */
dialog.resizable { width: min(var(--dialog-width, 1120px), calc(100vw - 32px)); }
.width-grip, .split-grip { position: absolute; top: 0; bottom: 0; z-index: 4; width: 8px; cursor: col-resize; touch-action: none; }
.width-grip.left { left: 0; }
.width-grip.right { right: 0; }
.split-grip { right: -8px; }
.width-grip::after, .split-grip::after { content: ""; position: absolute; top: 50%; left: 50%; width: 4px; height: 40px; border-radius: 2px; background: var(--border); transform: translate(-50%, -50%); transition: height 0.15s, background-color 0.15s; }
.width-grip:hover::after, .split-grip:hover::after, .width-grip.dragging::after, .split-grip.dragging::after { height: 72px; background: var(--primary); }
.width-grip:focus-visible, .split-grip:focus-visible { outline: none; }
.width-grip:focus-visible::after, .split-grip:focus-visible::after { height: 72px; background: var(--primary); outline: 3px solid var(--focus); }
@media (prefers-reduced-motion: reduce) { .width-grip::after, .split-grip::after { transition: none; } }
.preview { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--surface-2); border-right: 1px solid var(--border-soft); }
.preview-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border-soft); }
.preview-bar[hidden] { display: none; }
.preview-content { display: grid; flex: 1; place-items: center; min-height: 0; }
.preview .einvoice { align-self: start; width: 100%; padding: 20px; }
.drop-overlay { position: absolute; inset: 0; z-index: 1; display: none; place-items: center; padding: 24px; border-radius: 4px; outline: 2px dashed var(--draft); outline-offset: -12px;
  background: var(--draft-bg); color: var(--draft); font-weight: 600; text-align: center; }
.preview.dragging .drop-overlay { display: grid; }
.ai-status { margin-bottom: 14px; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; }
.ai-status.busy { background: var(--draft-bg); color: var(--draft); }
.ai-status.busy::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -1px; animation: spin 0.8s linear infinite; }
.ai-status.done { background: var(--ok-bg); color: var(--ok); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ai-status.busy::before { animation: none; } }
.input-clear { position: relative; display: flex; width: min(440px, 100%); margin-top: 5px; }
.input-clear input { flex: 1; min-width: 0; padding-right: 36px; }
.input-clear-button { position: absolute; top: 50%; right: 4px; width: 28px; height: 28px; padding: 0; transform: translateY(-50%); border: 0; border-radius: 50%;
  background: transparent; box-shadow: none; color: var(--muted); font-size: 12px; }
.input-clear-button:hover { background: var(--hover); color: var(--text); }
.input-clear-button:active { transform: translateY(-50%); }
.input-clear-button[hidden] { display: none; }
.dropzone { display: grid; justify-items: center; gap: 8px; padding: 32px 24px; text-align: center; }
.dropzone .button { margin-top: 8px; }
.preview iframe, .preview img { width: 100%; height: 100%; min-height: 70vh; border: 0; object-fit: contain; }
.frame { position: relative; display: grid; place-items: center; width: 100%; height: 100%; min-height: 70vh; }
.frame iframe { position: absolute; inset: 0; transition: opacity 0.2s; }
.frame.loading iframe { opacity: 0; }
.frame.loading::after { content: ""; width: 22px; height: 22px; border: 2.5px solid var(--muted); border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
.frame.loading > p { position: absolute; top: calc(50% + 24px); margin: 0; }
/* PDF-Viewer (pdf-viewer.js): Seiten bleiben weiß, auch im Dunkelmodus */
.pdf-viewer { position: relative; display: flex; flex: 1; flex-direction: column; min-height: 70vh; max-height: calc(100vh - 34px); }
.pdf-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.pdf-bar .spacer { flex: 1; }
.pdf-page-info, .pdf-zoom-info { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pdf-zoom-info { min-width: 44px; text-align: center; }
.pdf-note { margin: 0; padding: 8px 12px; background: var(--open-bg); color: var(--open); font-size: 13px; }
/* relative: Bezug für offsetTop der Seiten; stabile Scrollleiste, sonst pendelt „Breite einpassen“ zwischen mit und ohne Scrollbalken */
.pdf-pages { position: relative; flex: 1; min-height: 0; padding: 12px; overflow: auto; scrollbar-gutter: stable; }
.pdf-pages:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.pdf-page { width: fit-content; margin: 0 auto 12px; background: #fff; box-shadow: 0 1px 4px rgb(6 3 20 / 18%); }
.pdf-page canvas { display: block; }
.pdf-viewer.loading .pdf-pages { display: grid; place-items: center; }
.pdf-viewer.loading .pdf-pages::after { content: ""; width: 22px; height: 22px; border: 2.5px solid var(--muted); border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
.preview-content > .pdf-viewer { align-self: stretch; justify-self: stretch; min-width: 0; }
.pdf-print { display: none; }
@media print {
  body.printing-pdf > :not(.pdf-print) { display: none !important; }
  body.printing-pdf > .pdf-print { display: block; }
  body.printing-pdf dialog, body.printing-pdf dialog::backdrop { visibility: hidden; } /* Modalfenster liegen in der obersten Ebene, display: none reicht dort nicht */
  .pdf-print canvas { display: block; width: 100%; height: auto; break-after: page; }
  .pdf-print canvas:last-child { break-after: auto; }
}
.editor { max-height: calc(100vh - 34px); padding: 22px 24px 0; overflow: auto; }
.editor h2 { font-size: 20px; font-weight: 500; }
.category-button { justify-content: space-between; width: 100%; min-width: 120px; max-width: 220px; padding: 7px 10px; border-width: 1px; box-shadow: none; font-weight: 400; text-align: left; }
.category-button > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-button .chevron { color: var(--muted); font-size: 11px; }
.line-list { border: 1px solid var(--border-soft); border-radius: var(--radius-sm); overflow: hidden; }
.line-head, .line { display: grid; grid-template-columns: minmax(0, 1fr) 76px 104px 32px; gap: 6px 8px; align-items: center; padding: 8px 10px; }
.line-head { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 500; }
.line-head span:nth-child(3) { text-align: right; }
.line + .line { border-top: 1px solid var(--border-soft); }
.line .category-button { max-width: none; }
.editor .line input.amount { width: 100%; }
.line-remove { width: 32px; padding-left: 0; padding-right: 0; }
.line-note { grid-column: 1 / -1; width: 100%; font-size: 13px; }
.editor textarea { width: 100%; resize: vertical; }
.editor table th, .editor table td { padding-left: 6px; padding-right: 6px; }
.editor input.amount { width: 96px; }
.editor table th:first-child, .editor table td:first-child { padding-left: 8px; }
.editor table th:last-child, .editor table td:last-child { padding-right: 8px; }
.editor-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
/* Im Fenster bleibt die Knopfleiste unten sichtbar, auch wenn der Inhalt scrollt */
.editor .editor-actions, .assign-body .editor-actions { position: sticky; bottom: 0; z-index: 2; margin: 20px -24px 0; padding: 14px 24px 16px; background: var(--surface); }

/* Kategorie-Auswahl */
dialog.picker { width: min(600px, calc(100vw - 32px)); height: min(680px, calc(100vh - 32px)); }
dialog.picker[open] { display: flex; flex-direction: column; }
.picker-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border-soft); }
.picker-head h2 { margin: 0; font-size: 18px; font-weight: 500; }
.picker-head input { grid-column: 1 / -1; width: 100%; }
.picker-list { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.picker-list h3 { position: sticky; top: -6px; margin: 0; padding: 12px 10px 6px; background: var(--surface); color: var(--subtle); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.picker-item { display: grid; grid-template-columns: 1fr auto; gap: 1px 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; box-shadow: none; font-weight: 500; text-align: left; }
.picker-item:hover, .picker-item:focus-visible { background: var(--hover); outline: none; }
.picker-item[aria-current="true"] { background: var(--draft-bg); }
.picker-number { color: var(--subtle); font-size: 12px; font-variant-numeric: tabular-nums; }
.picker-desc { grid-column: 1 / -1; color: var(--muted); font-size: 12px; font-weight: 400; }
.picker-empty { padding: 16px 10px; }

/* Steuern */
table.tax td:nth-child(2), table.tax th:nth-child(2), table.items td:nth-child(2) { text-align: left; white-space: normal; }
tr.total td { font-weight: 600; background: var(--surface-2); }
table.items td { padding: 4px 8px; border: 0; font-size: 13px; }
ul.alert { padding-left: 32px; }
tr.candidate td { background: var(--open-bg); }

/* Rechnungen */
.positions { display: grid; gap: 10px; }
.position { display: grid; gap: 6px; padding: 12px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.position-head { display: flex; gap: 8px; }
.position-head input { flex: 1; font-weight: 600; }
.position-numbers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.position-numbers input.amount { width: 90px; }
.position-numbers .line-total { margin-left: auto; font-variant-numeric: tabular-nums; }
.form-grid.recurring { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border-soft); }

/* Abschluss */
td.changes { min-width: 280px; white-space: pre-line; font-size: 13px; }

/* Schmale Fenster: Seitenleiste wird zur Leiste oben */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; z-index: 2; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border-soft); }
  .brand { padding: 0 4px; }
  .brand span:last-child, .nav-section, .sidebar-foot { display: none; }
  .sidebar nav { display: flex; gap: 2px; min-width: 0; overflow-x: auto; }
  .sidebar nav ul { display: flex; }
  .sidebar nav a { padding: 6px 10px; white-space: nowrap; }
  .content { padding: 20px 16px 48px; }
  .card > .scroll { margin: 0 -16px; }
  .card { padding: 16px; }
  .card > .scroll:last-child { margin-bottom: -16px; }
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }
  .dialog-body { grid-template-columns: 1fr; }
  .split-grip { display: none; }
  .preview iframe, .preview img { min-height: 40vh; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Zeitraum-Auswahl */
.period { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.period-range { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 100%; }
.period button.small { min-width: 30px; padding: 6px 8px; font-size: 15px; line-height: 18px; }
.period input[aria-invalid="true"] { border-color: var(--late); }

/* Zuordnen-Fenster einer Bankbewegung */
dialog.assign { width: min(820px, calc(100vw - 32px)); }
.assign-body { display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 34px); padding: 22px 24px 0; overflow: auto; }
.assign-body h3 { margin: 4px 0 8px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.assign-tx { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); }
.assign-amounts { display: grid; justify-items: end; gap: 4px; white-space: nowrap; }
.assign-amounts > div:first-child { font-size: 18px; font-weight: 600; }
.assign-pick input[type="search"] { width: 100%; margin-bottom: 8px; }
.assign-list { max-height: 46vh; overflow: auto; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.assign-list tr.suggested { background: var(--draft-bg); }
.assign-reasons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.assign-body .editor-actions { margin-top: 0; }
.assign-body .editor-actions .spacer { flex: 1; }

/* Einstellungen: Anbindungen */
.settings-nav { width: fit-content; max-width: 100%; margin-bottom: 16px; }
/* Einstellungen → Benutzer */
.user-roles { margin: 0 0 8px; }
.user-list { margin: 0 0 12px; padding: 0; list-style: none; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.user-main { flex: 1; min-width: 0; }
.user-main p { margin: 2px 0 0; }
.user-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.user-name strong { overflow-wrap: anywhere; font-weight: 600; }
.avatar { display: inline-grid; flex: none; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--draft-bg); color: var(--draft); font-size: 13px; font-weight: 600; }
button.icon-only { flex: none; padding: 6px; }
.user-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.user-head h2 { margin: 0 0 4px; }
.user-action { margin-top: 10px; }
.user-action button { width: 100%; }
.user-action p { margin: 4px 0 0; font-size: 12px; }
.section-title { margin: 0 0 12px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.integration { max-width: 760px; padding: 22px 24px; }
.integration-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; }
.integration-head h2 { margin: 0 0 2px; font-size: 17px; }
.integration-head p { margin: 0; font-size: 13px; }
.integration-head .chip { align-self: start; }
.integration-logo { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--logo-tile); color: var(--logo-ink); }
.integration-logo svg { width: 26px; height: 26px; fill: currentColor; }
.integration-fills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 20px 0 14px; font-size: 13px; }
.integration-head + .integration-note { margin-top: 20px; }
ul.integration-note { padding-left: 32px; }
ul.integration-note li + li { margin-top: 2px; }
.integration-logo.plain { background: #fff; box-shadow: inset 0 0 0 1px var(--border-soft); }
.integration-logo.plain svg { width: 30px; height: 30px; }
.integration-note { margin: 0 0 20px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font-size: 13px; line-height: 1.5; }
.integration-form .input-clear { width: 100%; }
.integration-hint { margin: 6px 0 0; color: var(--subtle); font-size: 12px; }
/* Anbindungen: Übersicht als anklickbare Karten, Details als nummerierte Anleitung */
a.integration-item { display: block; color: inherit; text-decoration: none; transition: border-color 0.15s; }
a.integration-item:hover { border-color: var(--border); }
a.integration-item .integration-fills { margin: 16px 0 0; }
.integration-open { margin-left: auto; color: var(--muted); font-weight: 500; white-space: nowrap; }
a.integration-item:hover .integration-open { color: var(--text); }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: none; }
.back-link:hover { color: var(--text); }
ol.guide { margin: 4px 0 0; padding: 0; list-style: none; counter-reset: guide; }
ol.guide > li { position: relative; padding: 0 0 22px 44px; counter-increment: guide; }
ol.guide > li::before { content: counter(guide); position: absolute; top: -3px; left: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--draft-bg); color: var(--draft); font-size: 13px; font-weight: 600; }
ol.guide > li:not(:last-child)::after { content: ""; position: absolute; top: 30px; bottom: 4px; left: 14px; width: 1px; background: var(--border-soft); }
ol.guide > li:last-child { padding-bottom: 0; }
ol.guide h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
ol.guide p { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
ol.guide .integration-form { margin-top: 10px; }
ol.guide .card-foot { margin: 12px 0 0; padding: 0; border: 0; background: none; }
.step-actions { display: flex; justify-content: flex-end; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 20px -24px -22px; padding: 14px 24px; border-top: 1px solid var(--border-soft); background: var(--surface-2); }
.card-foot a { color: var(--muted); font-size: 13px; }
.card-foot a:hover { color: var(--text); }
@media (max-width: 560px) {
  .integration-head { grid-template-columns: auto minmax(0, 1fr); }
  .integration-head .chip { grid-column: 2; justify-self: start; }
}
.card-foot button { margin-left: auto; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Einstellungen: Firmendaten */
.company-logo-row { display: flex; align-items: center; gap: 16px; margin: 18px 0; }
.company-logo { width: 64px; height: 64px; border-radius: 14px; object-fit: contain; background: #fff; border: 1px solid var(--border-soft); }
.company-logo-row .integration-hint { margin-top: 6px; }

/* Listen: Statusreiter, Suche, Sortierung, Summenzeile */
.list-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: -4px 0 14px; }
.segmented { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-2); }
.segmented button { padding: 4px 10px; border: 0; border-radius: 6px; background: transparent; box-shadow: none; color: var(--muted); font-size: 13px; line-height: 20px; }
.segmented button:hover { background: var(--hover); color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(6 3 20 / 12%); }
.segmented-count { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--neutral-bg); color: var(--muted); font-size: 11px; font-weight: 600; line-height: 16px; text-align: center; }
.list-search { width: min(260px, 100%); }
th button.sort { display: inline-flex; gap: 4px; padding: 0; border: 0; background: none; box-shadow: none; color: inherit; font: inherit; font-size: 12px; font-weight: 500; line-height: inherit; }
th button.sort:hover, th button.sort.active { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
th button.sort .sort-arrow { color: var(--subtle); }
th button.sort.active .sort-arrow { color: var(--text); }
table.list tfoot td { border-top: 1px solid var(--border-card); border-bottom: 0; background: var(--surface-2); font-weight: 600; }
table.list tfoot td.muted { font-weight: 500; }

/* KI-Vorschläge */
.ai-filled { background-color: color-mix(in srgb, var(--draft-bg) 70%, var(--surface)) !important; box-shadow: inset 3px 0 0 var(--draft); }
.ai-uncertain { background-color: var(--open-bg) !important; box-shadow: inset 3px 0 0 var(--open); }
.ai-status.done { display: flex; align-items: flex-start; gap: 8px; }
.ai-status.done svg.icon { flex: none; margin-top: 2px; }

/* Datei ins Fenster ziehen */
.page-drop { position: fixed; inset: 0; z-index: 40; display: none; place-items: center; padding: 24px; background: rgb(16 11 45 / 30%); pointer-events: none; }
.page-drop.active { display: grid; }
.page-drop-box { max-width: 520px; padding: 36px 40px; border: 2px dashed var(--draft); border-radius: var(--radius); background: var(--surface); color: var(--draft); box-shadow: var(--shadow-dialog); font-size: 16px; font-weight: 600; text-align: center; }

/* Erklärungen zum Aufklappen, Prüflisten, Schritte */
details.help { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
details.help summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; color: var(--muted); }
details.help summary::-webkit-details-marker { display: none; }
details.help summary:hover { color: var(--text); }
details.help p { margin: 8px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); line-height: 1.5; }
details.help .help-body { margin-top: 8px; padding: 10px 12px 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); line-height: 1.5; }
details.help .help-body ol { margin: 0; padding-left: 18px; }
details.help .help-body li + li { margin-top: 4px; }
details.help .help-body p { margin: 8px 0 0; padding: 0; background: none; }
.subhead { margin: 20px 0 6px; font-size: 14px; font-weight: 600; }
ul.checks { display: grid; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; font-size: 13px; }
ul.checks li { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; border-radius: var(--radius-sm); }
ul.checks li.todo { background: var(--open-bg); color: var(--open); }
ul.checks li.done { background: var(--ok-bg); color: var(--ok); }
ul.checks svg.icon { flex: none; margin-top: 1px; }
p.note { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--open-bg); color: var(--open); font-size: 13px; }
ol.steps { display: grid; gap: 0; margin: 8px 0 0; padding: 0; list-style: none; counter-reset: step; }
ol.steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border-soft); }
.step-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; }
.step.done .step-mark { background: var(--ok-bg); color: var(--ok); }
.step.todo .step-mark { background: var(--open-bg); color: var(--open); }
.step.final .step-mark { background: var(--draft-bg); color: var(--draft); }
ol.steps li .muted { margin-top: 1px; }

/* Schnellsuche */
.search-trigger { justify-content: flex-start; gap: 10px; margin: 0 0 14px; padding: 7px 10px; border: 1px solid var(--border-soft); background: var(--surface); box-shadow: none; color: var(--muted); font-weight: 400; }
.search-trigger svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.search-trigger span { flex: 1; text-align: left; }
.search-trigger:hover { color: var(--text); }
kbd { padding: 0 6px; border: 1px solid var(--border-soft); border-radius: 5px; background: var(--surface-2); color: var(--subtle); font: 11px/18px var(--font); }
dialog.palette { width: min(640px, calc(100vw - 32px)); margin-top: 12vh; }
.palette-head { display: flex; align-items: center; gap: 10px; padding: 14px 52px 14px 18px; border-bottom: 1px solid var(--border-soft); color: var(--muted); }
.palette-head svg.icon { width: 18px; height: 18px; }
.palette-head input { flex: 1; padding: 4px 0; border: 0; outline: 0; background: none; font-size: 16px; }
.palette-head input:focus { outline: 0; border: 0; }
.palette-head input::-webkit-search-cancel-button { display: none; }
.palette-list { max-height: min(420px, 55vh); overflow-y: auto; padding: 6px; }
.palette-group { padding: 10px 10px 4px; color: var(--subtle); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.palette-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.palette-item[aria-selected="true"] { background: var(--draft-bg); }
.palette-title { display: grid; min-width: 0; }
.palette-title strong { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.palette-title .muted { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.palette-meta { flex: none; font-size: 12px; font-variant-numeric: tabular-nums; }
.palette-status:empty { display: none; }
.palette-status { padding: 4px 18px 10px; }
.palette-foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--border-soft); font-size: 12px; }

/* „Mehr“ gibt es nur auf dem Handy */
.nav-more { display: none; }
.more-menu { inset: auto 8px calc(72px + env(safe-area-inset-bottom)) auto; margin: 0; min-width: 220px; padding: 6px; border: 1px solid var(--border-card); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow-dialog); }
.more-menu a, .more-menu button { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--radius-sm); background: none; box-shadow: none; color: var(--text); font: inherit; font-weight: 500; text-decoration: none; }
.more-menu a:hover, .more-menu button:hover { background: var(--hover); }
.more-menu svg, .more-menu svg.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Handy: Navigation unten, Listen als Karten, Fenster im Vollbild */
@media (max-width: 640px) {
  .content { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 16px; }
  h1 { font-size: 22px; }
  .sidebar { position: fixed; inset: auto 0 0 0; top: auto; z-index: 20; justify-content: space-around; gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border-soft); border-bottom: 0; background: var(--sidebar); }
  .brand, .search-trigger { display: none; }
  /* Fünf gleich breite Spalten: vier Hauptbereiche und „Mehr“ */
  .sidebar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .sidebar nav, .sidebar nav ul { display: contents; }
  .sidebar li.secondary { display: none; }
  .sidebar nav a, .nav-more { position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 4px; border: 0; border-radius: var(--radius-sm); background: none; box-shadow: none; color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap; }
  .nav-more svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
  /* Aktueller Bereich: Farbe, Schriftstärke und Strich oben (nicht nur über die Farbe erkennbar) */
  .sidebar nav a[aria-current="page"], .nav-more.current { background: none; color: var(--text); font-weight: 700; box-shadow: inset 0 2px 0 var(--text); border-radius: 0; }
  .nav-count { position: absolute; top: 0; right: 2px; margin: 0; min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 15px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 14px; }
  .tile .value { font-size: 21px; }
  .period:not(.custom) .period-range input, .period:not(.custom) .period-range > .muted { display: none; }
  .list-tools { flex-direction: column; align-items: stretch; }
  .segmented { flex-wrap: nowrap; overflow-x: auto; }
  .segmented button { flex: none; }
  .list-search { width: 100%; }
  table.list thead { display: none; }
  table.list tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title amount" "sub1 status" "sub2 status"; gap: 2px 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
  table.list tbody tr td { padding: 0; border: 0; white-space: normal; text-align: left; min-width: 0; background: none; }
  table.list td.m-hide { display: none; }
  table.list td.m-title { grid-area: title; font-weight: 600; }
  table.list td.m-title .muted { font-weight: 400; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  table.list td.m-amount { grid-area: amount; text-align: right; font-weight: 600; white-space: nowrap; }
  table.list td.m-sub1, table.list td.m-sub2 { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  table.list td.m-sub1 { grid-area: sub1; }
  table.list td.m-sub2 { grid-area: sub2; }
  table.list td[data-prefix]::before { content: attr(data-prefix); }
  table.list td.m-status { grid-area: status; align-self: start; justify-self: end; }
  table.list tr.overdue { background: var(--row-warn); }
  table.list tbody tr td.empty-state { grid-column: 1 / -1; padding: 24px 0; text-align: center; }
  table.list tbody tr:has(td.empty-state) { display: block; }
  table.list tfoot tr { display: flex; justify-content: space-between; padding: 10px 16px; background: var(--surface-2); }
  table.list tfoot td { padding: 0; border: 0; background: none; }
  table.list tfoot td:empty { display: none; }
  table.list tr.skeleton { display: grid; grid-template-columns: 1fr 1fr; }
  dialog:not(.confirm):not(.palette) { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  dialog[open]:not(.confirm):not(.palette) { animation: none; }
  .width-grip { display: none; }
  .dialog-body { display: block; height: 100dvh; overflow-y: auto; }
  .editor { max-height: none; overflow: visible; padding: 18px 16px 0; }
  .editor .editor-actions, .assign-body .editor-actions { margin: 20px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .preview, .frame { min-height: 46vh; }
  .pdf-viewer { min-height: 60dvh; max-height: 80dvh; }
  .pdf-bar { padding-right: 52px; } /* Platz für das Schließen-Kreuz */
  .assign-body { height: 100dvh; max-height: none; padding: 18px 16px 0; }
  dialog.palette { width: calc(100vw - 16px); margin-top: 8px; }
  .toasts { inset: auto 8px calc(80px + env(safe-area-inset-bottom)) 8px; width: auto; }
  .nav-more { display: grid; }
}

/* Diagramme (app/chart.js) und Übersicht. Säulenfarben --in-bar/--out-bar sind auf Farbfehlsichtigkeit geprüft. */
.chart { margin: 0; }
.chart-sub { margin: -8px 0 12px; font-size: 13px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
.chart-legend li, .chart-tip-row { display: flex; align-items: center; gap: 6px; }
.chart .key { flex: none; width: 10px; height: 10px; border-radius: 3px; }
.chart .key.line, .chart-tip .key { width: 12px; height: 2px; border-radius: 1px; }
.chart-plot { position: relative; }
.chart-plot svg { display: block; overflow: visible; }
.chart-plot svg:focus-visible { outline-offset: 4px; border-radius: var(--radius-sm); }
.chart-plot text { fill: var(--subtle); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-grid { stroke: var(--border-soft); }
.chart-base { stroke: var(--border); }
.chart-hover { fill: var(--hover); }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { opacity: 0.1; }
.chart-dot { stroke: var(--surface); stroke-width: 2; }
.chart-tip { position: absolute; top: 0; z-index: 2; min-width: 160px; padding: 8px 10px; border: 1px solid var(--border-card); border-radius: var(--radius-sm); background: var(--surface); box-shadow: 0 4px 14px rgb(6 3 20 / 12%); font-size: 13px; pointer-events: none; }
.chart-tip[hidden] { display: none; }
.chart-tip-title { margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.chart-tip-row strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip-row span:last-child { color: var(--muted); }
.chart-table { margin-top: 10px; }
.chart-table summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.chart-table summary:hover { color: var(--text); }
.chart-table .scroll { margin-top: 8px; }
.overview-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; align-items: start; }
@media (max-width: 1100px) { .overview-pair { grid-template-columns: minmax(0, 1fr); } }

/* Anmeldeseite */
.login { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; min-height: 100vh; padding: 24px 16px; box-sizing: border-box; }
.login .brand { padding: 0; }
.login-card { display: grid; gap: 14px; width: 100%; max-width: 360px; margin: 0; padding: 28px; box-sizing: border-box; }
.login-card .muted { margin: -8px 0 4px; }
.login-card .alert { margin: 0; }
.login-card button { margin-top: 6px; }
.login-links { margin: 0; color: var(--subtle); font-size: 12px; }
.login-links a { color: inherit; }

/* Angemeldeter Benutzer in der Seitenleiste */
.sidebar-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; color: var(--muted); font-size: 12px; }
.sidebar-user:empty { display: none; }
.sidebar-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.confirm-body .field { margin-top: 14px; }
