/* Rechnung – Designsystem
   Kühles Grau-Grün als Grund, Petrol für Aktionen, Plex Sans mit Tabellenziffern. */

@font-face { font-family: "Plex"; src: url("fonts/IBMPlexSans-Regular-Latin1.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/IBMPlexSans-Medium-Latin1.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/IBMPlexSans-SemiBold-Latin1.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --paper: #f3f5f4;
  --surface: #ffffff;
  --sunken: #eaeeec;
  --ink: #18272b;
  --ink-2: #56676c;
  --ink-3: #8a9a9e;
  --line: #d9e0de;
  --line-strong: #b9c4c1;
  --accent: #0e6b66;
  --accent-hover: #0a5753;
  --accent-ink: #ffffff;
  --accent-soft: #e2efed;
  --warn: #9a5b06;
  --warn-soft: #fbf0dc;
  --danger: #b3261e;
  --danger-soft: #fbe6e4;
  --ok: #2c7a4b;
  --ok-soft: #e1f2e7;
  --focus: #2d8cff;
  --radius: 6px;
  --radius-lg: 10px;
  --rail: 236px;
  --shadow-sheet: 0 1px 2px rgba(24, 39, 43, .06), 0 8px 28px rgba(24, 39, 43, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1719;
    --surface: #152024;
    --sunken: #1b282c;
    --ink: #e4ecea;
    --ink-2: #9fb0b3;
    --ink-3: #6f8287;
    --line: #25363b;
    --line-strong: #36494f;
    --accent: #4fb3aa;
    --accent-hover: #6cc4bc;
    --accent-ink: #0b1d1c;
    --accent-soft: #17312f;
    --warn: #e2a748;
    --warn-soft: #33270f;
    --danger: #f08a80;
    --danger-soft: #3a1d1b;
    --ok: #6cc28c;
    --ok-soft: #173023;
    --shadow-sheet: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15px/1.5 "Plex", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 1;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 17px; line-height: 1.3; }
h3 { font-size: 15px; }
p { margin: 0 0 .75em; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Gerüst ---------- */
.app { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 18px 14px; border-right: 1px solid var(--line); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 600; font-size: 15px; color: var(--ink); text-decoration: none; }
.brand svg { color: var(--accent); }
.company-switch { margin: 0 0 18px; }
.company-switch summary {
  list-style: none; cursor: pointer; display: grid; gap: 1px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--sunken);
}
.company-switch summary::-webkit-details-marker { display: none; }
.company-switch .summary-static { display: grid; gap: 1px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sunken); }
.company-switch .summary-static strong { font-weight: 600; font-size: 14px; }
.company-switch .summary-static span { font-size: 12px; color: var(--ink-2); }
.company-switch summary strong { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-switch summary span { font-size: 12px; color: var(--ink-2); }
.company-switch[open] summary { border-color: var(--accent); }
.company-switch form { margin-top: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 4px; }
.company-switch button {
  width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 4px; background: none; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer;
}
.company-switch button:hover { background: var(--accent-soft); }
.company-switch button[aria-current] { font-weight: 600; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius);
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14.5px;
}
.nav a svg { flex: none; color: var(--ink-3); }
.nav a:hover { background: var(--sunken); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); }
.nav a[aria-current="page"] svg { color: var(--accent); }
.rail-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.rail-foot form { display: inline; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.main { min-width: 0; padding: 28px clamp(16px, 4vw, 48px) 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { margin-top: 4px; color: var(--ink-2); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wrap { max-width: 1180px; }
.narrow { max-width: 760px; }

.mobile-bar { display: none; }

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .rail .brand { padding-bottom: 8px; }
  .rail-desktop-brand { display: none !important; }
  .rail-body { display: none; }
  .rail-toggle:checked ~ .rail-body { display: block; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; }
  .mobile-bar label { cursor: pointer; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; }
  .rail-foot { margin-top: 12px; }
  .main { padding-top: 20px; }
}

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  font: 500 14.5px/1 "Plex", system-ui, sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--sunken); }
.btn-small { min-height: 30px; padding: 0 10px; font-size: 13.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Formulare ---------- */
.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field > span, .label { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.field small, .hint { font-size: 12.5px; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], input:not([type]), select, textarea {
  width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: 400 15px/1.4 "Plex", system-ui, sans-serif; font-feature-settings: "tnum" 1;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[aria-invalid=true] { border-color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.grid-zip { display: grid; grid-template-columns: 120px 1fr; gap: 0 12px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
fieldset { border: 0; padding: 0; margin: 0 0 6px; }
legend { font-weight: 600; font-size: 15px; margin-bottom: 10px; padding: 0; }
.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; margin-bottom: 18px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.segmented label { padding: 7px 12px; font-size: 14px; cursor: pointer; border-left: 1px solid var(--line-strong); }
.segmented label:first-child { border-left: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span { font-weight: 600; color: var(--accent); }
.segmented label:has(input:checked) { background: var(--accent-soft); }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; }
.check input { margin-top: 4px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }

/* ---------- Meldungen ---------- */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14.5px; border: 1px solid; }
.flash-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.flash-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.flash strong { font-weight: 600; }

/* ---------- Tabellen ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.list th { text-align: left; font-weight: 500; font-size: 13px; color: var(--ink-2); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
table.list a.row-link { color: var(--ink); text-decoration: none; font-weight: 500; }
/* Ganze Zeile anklickbar: per JavaScript (app.js), nicht per Überlagerung –
   position:relative auf <tr> wird nicht von allen Browsern unterstützt (Safari). */
table.list tr.row-click { cursor: pointer; }
table.list .num { text-align: right; }
table.list td.sub { color: var(--ink-2); font-size: 13.5px; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-2); }
.empty h2 { color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 10px; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 6px 12px; border-radius: 99px; text-decoration: none; color: var(--ink-2); font-size: 14px; font-weight: 500; border: 1px solid transparent; }
.tabs a:hover { background: var(--sunken); color: var(--ink); }
.tabs a[aria-current] { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.tabs .count { color: var(--ink-3); margin-left: 4px; }
.toolbar { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar form { display: flex; gap: 8px; }
.toolbar input[type=search] { width: 260px; }

/* ---------- Status ---------- */
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 2px 9px 2px 8px; border-radius: 99px; white-space: nowrap; background: var(--sunken); color: var(--ink-2); }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.state-open { background: var(--accent-soft); color: var(--accent); }
.state-partial { background: var(--accent-soft); color: var(--accent); }
.state-overdue { background: var(--warn-soft); color: var(--warn); }
.state-paid { background: var(--ok-soft); color: var(--ok); }
.state-cancelled, .state-storno { background: var(--danger-soft); color: var(--danger); }
.state-draft { background: var(--sunken); color: var(--ink-2); }
.state-draft::before { background: transparent; border: 1.5px dashed currentColor; width: 5px; height: 5px; }

/* ---------- Übersicht ---------- */
.figures { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 18px; }
.figure { padding: 18px 22px; border-left: 1px solid var(--line); }
.figure:first-child { border-left: 0; }
a.figure { color: inherit; text-decoration: none; }
a.figure:hover { background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }
.figure:first-child { border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.figure .label { color: var(--ink-2); font-weight: 400; font-size: 14px; }
.figure .value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 2px 0; }
.figure .meta { font-size: 13.5px; color: var(--ink-2); }
.figure.warn .value { color: var(--warn); }
@media (max-width: 720px) { .figures { grid-template-columns: 1fr; } .figure { border-left: 0; border-top: 1px solid var(--line); } .figure:first-child { border-top: 0; } }
.two-col { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }
.limit { margin-top: 6px; }
.limit progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.limit progress::-webkit-progress-bar { background: var(--sunken); border-radius: 99px; }
.limit progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
.limit progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
.limit.high progress::-webkit-progress-value { background: var(--warn); }
.limit.high progress::-moz-progress-bar { background: var(--warn); }
.limit-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--ink-2); margin-top: 6px; }
.bars { display: block; width: 100%; height: 92px; margin-top: 10px; }
.bars rect.bar { fill: var(--accent); }
.bars rect.bar.now { fill: var(--accent-hover); }
.bars rect.track { fill: var(--sunken); }
.bars text { fill: var(--ink-3); font-size: 10px; font-family: "Plex", sans-serif; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.plain-list li:last-child { border-bottom: 0; }
.plain-list a { color: var(--ink); text-decoration: none; font-weight: 500; }
.plain-list a:hover { color: var(--accent); }

/* ---------- Rechnungseditor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: 24px; align-items: start; }
@media (max-width: 1180px) { .editor { grid-template-columns: 1fr; } .sheet-col { display: none; } }
.lines { width: 100%; border-collapse: collapse; }
.lines th { text-align: left; font-weight: 500; font-size: 13px; color: var(--ink-2); padding: 0 6px 6px; }
.lines td { padding: 4px 6px; vertical-align: top; }
.lines td.pos { color: var(--ink-3); font-size: 13px; padding-top: 13px; width: 26px; }
.lines .c-desc { min-width: 220px; }
.lines .c-qty { width: 84px; }
.lines .c-unit { width: 92px; }
.lines .c-price { width: 120px; }
.lines .c-total { width: 110px; padding-top: 13px; text-align: right; font-weight: 500; white-space: nowrap; }
.lines .c-del { width: 38px; }
.lines input.qty, .lines input.price { text-align: right; }
.lines select.pick { margin-top: 4px; min-height: 30px; padding: 3px 8px; font-size: 13px; color: var(--ink-2); background: var(--sunken); border-color: var(--line); }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 0; background: none; color: var(--ink-3); border-radius: var(--radius); cursor: pointer; }
.icon-btn:hover { background: var(--danger-soft); color: var(--danger); }
.lines-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); margin-top: 8px; }
.sum { font-size: 15px; }
.sum strong { font-size: 22px; font-weight: 600; margin-left: 10px; letter-spacing: -0.01em; }
@media (max-width: 760px) {
  .lines thead { display: none; }
  .lines, .lines tbody, .lines tr, .lines td { display: block; width: 100% !important; }
  .lines tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .lines td.pos { display: none; }
  .lines td.c-desc { grid-column: 1 / -1; }
  .lines td.c-total { text-align: left; }
}

/* Das Blatt: die Rechnung, wie sie gedruckt wird */
.sheet-col { position: sticky; top: 24px; }
.sheet-caption { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.sheet {
  position: relative; aspect-ratio: 210 / 297; background: #fff; color: #1d2a2e; border-radius: 3px; box-shadow: var(--shadow-sheet);
  padding: 7% 9.5% 6% 11.9%; font-size: 7.4px; line-height: 1.45; overflow: hidden;
}
.sheet::before, .sheet::after { content: ""; position: absolute; left: 0; width: 2.4%; border-top: 1px solid #aab3b1; }
.sheet::before { top: 35.35%; }
.sheet::after { top: 70.7%; }
.sheet .s-head { text-align: right; }
.sheet .s-name { font-size: 12px; font-weight: 600; }
.sheet .s-mut { color: #66767a; }
.sheet .s-addr { position: absolute; left: 11.9%; top: 17%; width: 40%; }
.sheet .s-back { font-size: 5px; color: #66767a; border-bottom: .5px solid #66767a; margin-bottom: 4px; padding-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet .s-rcpt { white-space: pre-line; }
.sheet .s-rcpt.empty { color: #9aa6a9; font-style: italic; }
.sheet .s-info { position: absolute; right: 9.5%; top: 17.5%; width: 36%; display: grid; grid-template-columns: auto 1fr; gap: 1px 6px; }
.sheet .s-info dt { color: #66767a; }
.sheet .s-info dd { margin: 0; text-align: right; font-weight: 600; }
.sheet .s-title { position: absolute; left: 11.9%; right: 9.5%; top: 33.5%; font-size: 11px; font-weight: 600; }
.sheet .s-table { position: absolute; left: 11.9%; right: 9.5%; top: 38%; }
.sheet table { width: 100%; border-collapse: collapse; }
.sheet th { text-align: left; color: #66767a; font-weight: 600; border-bottom: .8px solid #1d2a2e; padding: 0 2px 2px; }
.sheet td { padding: 2px; border-bottom: .5px solid #d4dbd9; vertical-align: top; }
.sheet .r { text-align: right; white-space: nowrap; }
.sheet .s-total td { border-bottom: .8px solid #1d2a2e; border-top: 0; font-weight: 600; font-size: 8.5px; padding-top: 4px; }
.sheet .s-note { margin-top: 8px; color: #1d2a2e; }
.sheet .s-foot { position: absolute; left: 11.9%; right: 9.5%; bottom: 4%; border-top: .5px solid #c8d0cd; padding-top: 3px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; font-size: 5px; color: #66767a; }
.sheet .s-draft { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.sheet .s-draft span { transform: rotate(-38deg); font-size: 58px; font-weight: 600; color: rgba(14, 107, 102, .06); letter-spacing: .04em; }

/* ---------- Rechnungsansicht ---------- */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
@media (max-width: 1000px) { .doc-layout { grid-template-columns: 1fr; } }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 14.5px; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; text-align: right; }
.facts dd.total { font-size: 20px; font-weight: 600; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.timeline li { padding: 8px 0 8px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.timeline time { display: block; color: var(--ink-2); font-size: 12.5px; }
.pdf-frame { width: 100%; aspect-ratio: 210 / 297; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.stack > * + * { margin-top: 18px; }
dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; max-width: 460px; width: calc(100% - 32px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sheet); }
dialog::backdrop { background: rgba(10, 20, 22, .45); }
dialog h2 { margin-bottom: 8px; }

/* ---------- Anmeldung ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-side { background: var(--accent); color: var(--accent-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side .brand { color: var(--accent-ink); padding: 0; }
.auth-side .brand svg { color: var(--accent-ink); }
.auth-side .receipt { align-self: flex-start; width: min(320px, 80%); background: #fff; color: #1d2a2e; border-radius: 3px; padding: 22px 22px 26px; font-size: 13px; box-shadow: 0 20px 50px rgba(0,0,0,.25); transform: rotate(-2.5deg); }
.receipt .r-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed #c8d0cd; }
.receipt .r-total { display: flex; justify-content: space-between; padding-top: 10px; font-weight: 600; font-size: 16px; }
.receipt .r-title { font-weight: 600; margin-bottom: 8px; }
.auth-side p { max-width: 34ch; opacity: .9; font-size: 15px; margin: 0; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .lead { color: var(--ink-2); margin-bottom: 22px; }
.auth-card .btn { width: 100%; min-height: 42px; margin-top: 6px; }
.code-input { font-size: 22px !important; letter-spacing: .3em; text-align: center; }
.qr-box { display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; margin-bottom: 14px; }
.qr-box img { width: 200px; height: 200px; image-rendering: pixelated; }
.secret { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; word-break: break-all; background: var(--sunken); padding: 8px 10px; border-radius: var(--radius); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } }
.company-list { display: grid; gap: 8px; }
.company-list button { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; text-align: left; }
.company-list button:hover { border-color: var(--accent); background: var(--accent-soft); }
.company-list span { color: var(--ink-2); font-size: 13px; }

@media (prefers-reduced-motion: no-preference) {
  .sheet .s-total td { transition: color .2s; }
  .sheet.bump .s-total td { color: var(--accent); }
}
@media print {
  .rail, .page-head .actions, .toolbar, .tabs { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}

.input-suffix { display: flex; align-items: center; gap: 8px; }
.input-suffix input { width: 96px; }
.input-suffix span { color: var(--ink-2); font-size: 14px; }
.narrow-field { max-width: 360px; }
[hidden] { display: none !important; }
.section-title { margin-bottom: 14px; }
.toolbar .field { margin: 0; display: flex; gap: 8px; align-items: center; }
.toolbar .field input { width: auto; }
.table-wrap-inline { overflow-x: auto; }
.page-head .actions form { display: contents; }

/* Feinschliff Editor */
.field { align-content: start; }
.editor { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 1280px) { .editor { grid-template-columns: 1fr; } .sheet-col { display: none; } }
.lines { table-layout: fixed; }
.lines th.num { text-align: right; }
.lines th:first-child, .lines td.pos { width: 24px; }
.lines .c-qty { width: 72px; }
.lines .c-unit { width: 78px; }
.lines .c-price { width: 104px; }
.lines .c-total { width: 104px; }
.lines .c-del { width: 36px; }
.lines .c-desc { min-width: 0; }
.lines input { padding: 7px 8px; }
.lines td { padding: 4px 4px; }
.lines th.c-total { padding-top: 0; font-weight: 500; }
.sheet-large { font-size: 10.2px; max-width: 760px; }
.sheet-large .s-name { font-size: 17px; }
.sheet-large .s-title { font-size: 15px; }
.sheet-large .s-back { font-size: 7px; }
.sheet-large .s-foot { font-size: 7px; }
.sheet-large .s-total td { font-size: 11.5px; }
.sheet .s-qr { position: absolute; right: 0; margin-top: -2px; width: 17%; image-rendering: pixelated; }
.sheet .s-note { padding-right: 22%; }
.sheet-caption a { font-size: 13px; }
.section > h2 { margin-bottom: 12px; }
.segmented { justify-self: start; width: max-content; max-width: 100%; }
@media (max-width: 760px) {
  .lines td[data-label]::before { content: attr(data-label); display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 3px; text-align: left; }
  .lines tr { grid-template-columns: 1fr 1fr 1fr; }
  .lines td.c-total { grid-column: 1 / 3; padding-top: 4px; font-size: 16px; }
  .lines td.c-del { grid-column: 3; justify-self: end; align-self: end; }
  .lines td.c-desc { grid-column: 1 / -1; }
}

/* Rabatte im Editor */
.line-extra { display: flex; gap: 6px; margin-top: 4px; align-items: center; }
.line-extra .pick { flex: 1; margin-top: 0; min-width: 0; }
.line-disc { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.lines .line-disc input { width: 52px; min-height: 30px; padding: 3px 6px; font-size: 13px; text-align: right; }
.totals { display: grid; gap: 6px; justify-items: end; }
.discount-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.discount-row .label { color: var(--ink-2); font-weight: 400; }
.discount-row input { width: 84px; min-height: 32px; padding: 4px 8px; text-align: right; }
.segmented-small label { padding: 4px 10px; font-size: 13px; }
.sub-row { display: flex; gap: 24px; font-size: 14px; color: var(--ink-2); }
.sub-row span:last-child { min-width: 96px; text-align: right; color: var(--ink); }
.lines-foot { align-items: flex-end; }

.settings-tabs { margin: -6px 0 18px; }
.warn-text { color: var(--warn); }
.error-text { color: var(--danger); display: block; }
.stack-tight > * + * { margin-top: 8px; }
.dialog-wide { max-width: 620px; }
.mail-log { margin-top: 12px; }
.sheet .s-mut { color: #66767a; }
.grid-host { grid-template-columns: 1fr 120px; }
.inline-check { display: inline-flex; gap: 4px; align-items: center; font-weight: 400; }
.dunning-table { margin-bottom: 16px; }
.dunning-table td { vertical-align: top; }
.dunning-table .input-suffix input { width: 90px; }
.section-attention { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.section-attention h2 { color: var(--warn); }
.nav-group { font-size: 12px; color: var(--ink-3); padding: 14px 10px 4px; }

/* Ausgaben und Bank */
.filter-bar .filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-bar select { width: auto; }
.upload { display: block; position: relative; }
.upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-box { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 22px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--sunken); }
.upload:hover .upload-box, .upload input:focus-visible + .upload-box { border-color: var(--accent); background: var(--accent-soft); }
.upload-list { font-size: 13px; color: var(--accent); }
.paid-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.paid-row .field { margin: 0; }
.receipt-img { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.ok-text { color: var(--ok); }
.bank-list { display: grid; gap: 10px; }
.bank-line { margin: 0; padding: 14px 16px; }
.bank-head { display: flex; justify-content: space-between; gap: 12px; }
.bank-amount { font-size: 18px; font-weight: 600; color: var(--ok); }
.bank-purpose { margin: 6px 0 10px; color: var(--ink-2); word-break: break-word; }
.bank-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bank-assign { display: flex; gap: 8px; flex: 1; min-width: 260px; }
.bank-assign select { flex: 1; min-width: 0; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.link-box { border-color: var(--accent); }
.member-list li { align-items: center; }
.role-form select { width: auto; min-height: 34px; padding: 4px 8px; font-size: 14px; }
.grid-invite { grid-template-columns: 1fr 180px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.row-actions form { display: inline; }
.problem-list { margin: 6px 0; padding-left: 18px; }
.total-row td { font-weight: 600; border-top: 1px solid var(--line-strong); }
.report-bars { display: block; width: 100%; height: auto; margin: 4px 0 16px; }
.report-bars .b1 { fill: color-mix(in srgb, var(--accent) 35%, var(--surface)); }
.report-bars .b2 { fill: var(--accent); }
.report-bars text { fill: var(--ink-3); font-size: 8.5px; font-family: "Plex", sans-serif; }
.report-bars .axis { stroke: var(--line-strong); stroke-width: 1; }
.legend { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-2); }
.legend .key { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-left: 8px; }
.legend .key-1 { background: color-mix(in srgb, var(--accent) 35%, var(--surface)); }
.legend .key-2 { background: var(--accent); }

/* ---- E-Rechnung: lesbare Ansicht ---- */
.einv-hint { margin: -6px 0 16px; max-width: 760px; }
.einv { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 26px; }
.einv-parties { display: grid; grid-template-columns: 1fr 1fr minmax(240px, 300px); gap: 24px; font-size: 14.5px; line-height: 1.5; }
.einv-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 6px; }
.einv-name { font-weight: 600; font-size: 16px; }
.einv-facts { font-size: 14px; align-self: start; background: var(--sunken); border-radius: 10px; padding: 14px 16px; }
.einv-lines td, .einv-lines th { padding-left: 0; }
.einv-bottom { display: grid; grid-template-columns: 1fr minmax(260px, 320px); gap: 32px; align-items: start; font-size: 14.5px; }
.einv-bottom p { margin: 0 0 6px; }
.einv-bottom .einv-label { margin-top: 14px; }
.einv-bottom .einv-label:first-child { margin-top: 0; }
.einv-tax { border-collapse: collapse; font-size: 14px; }
.einv-tax td { padding: 3px 18px 3px 0; }
.einv-tax .num { text-align: right; font-variant-numeric: tabular-nums; }
.einv-note { white-space: pre-line; color: var(--ink-2); }
.einv-sum { border-top: 1px solid var(--line); padding-top: 12px; }
.einv-sum .einv-total { font-weight: 600; color: var(--ink); align-self: end; }
.einv-tech summary { cursor: pointer; color: var(--ink-2); font-size: 14px; }
.einv-tech .facts { margin-top: 12px; font-size: 13.5px; max-width: 680px; }
.einv-tech .facts dd { text-align: left; }
.einv-break { word-break: break-all; }
.receipt-einv { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); }
.receipt-einv svg { flex: 0 0 auto; color: var(--accent); }
.receipt-einv .btn { margin-left: auto; }
.einv-notice { display: none; margin-top: 12px; }
.einv-notice.show { display: flex; }
@media (max-width: 900px) {
  .einv { padding: 18px; }
  .einv-parties, .einv-bottom { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 600px) { .einv-lines .einv-opt { display: none; } .einv-lines td, .einv-lines th { padding-right: 8px; } }

/* ---- Prüfkette ---- */
.anchor-box { display: grid; gap: 10px; padding: 16px; border-radius: 12px; background: var(--sunken); }
.anchor-code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; letter-spacing: .02em; word-break: break-all; }
.anchor-meta { font-size: 13px; color: var(--ink-2); }
.anchor-list { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.anchor-list li { display: flex; gap: 12px; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.anchor-list li:last-child { border-bottom: 0; }
.anchor-list code { color: var(--ink-2); }
