/* Oberfläche (SPA): Farben, Schriften und Bausteine */

@font-face { font-family: 'Manrope'; src: url('../fonts/Manrope-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('../fonts/Manrope-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('../fonts/Manrope-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('../fonts/Fraunces-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('../fonts/Fraunces-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }

:root {
  --ink: #0A1628; --ink-soft: #1A2942; --paper: #FAF8F4; --paper-deep: #F1ECE2;
  --gold: #C9A961; --gold-soft: #E8DCC0; --gold-deep: #8A6D2E; --line: #E5DFD3; --muted: #5A6B82;
  --success: #2D7A5F; --success-soft: #E4F0EB; --danger: #B4462E; --danger-soft: #F7E6E1; --warn: #8A6412; --warn-soft: #F6EDD6;
  --white: #FFFFFF;
  --font: 'Manrope', -apple-system, 'Segoe UI', sans-serif; --display: 'Fraunces', Georgia, serif;
  --radius: 14px; --radius-sm: 9px; --shadow: 0 12px 40px rgba(10, 22, 40, .07); --shadow-sm: 0 2px 8px rgba(10, 22, 40, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 17px; font-family: var(--font); font-weight: 700; letter-spacing: 0; }
p { margin: 0 0 .8em; }
a { color: var(--ink); text-decoration-color: var(--gold); text-underline-offset: 3px; }
code, pre, .mono { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 13px; }
small, .muted { color: var(--muted); }
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; color: var(--muted); gap: 18px; }
.noscript { padding: 24px; text-align: center; }

/* ---------- Grundlayout ---------- */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side { background: var(--white); border-right: 1px solid var(--line); padding: 26px 18px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: block; padding: 0 8px 18px; border-bottom: 1px solid var(--line); margin-bottom: 12px; text-decoration: none; }
.side .brand .tagline { display: block; margin-top: 10px; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-deep); font-weight: 600; }
.nav-group { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 14px 10px 4px; font-weight: 600; }
.nav a, .nav button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font: inherit; font-size: 14.5px; border: 0; background: none; cursor: pointer; border-left: 3px solid transparent; }
.nav a:hover, .nav button:hover { background: var(--paper); }
.nav a.active { background: var(--paper-deep); border-left-color: var(--gold); font-weight: 600; }
.nav a.disabled { color: #8C98A9; cursor: default; }
.nav a.disabled:hover { background: none; }
.nav .soon { font-size: 10.5px; color: var(--gold-deep); background: #F6F0E3; border-radius: 99px; padding: 1px 8px; font-weight: 600; white-space: nowrap; }
.side .foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.main { padding: 36px 44px 60px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 0; max-width: 680px; }
.eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-deep); font-weight: 600; margin-bottom: 6px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
  .side .brand { border: 0; padding: 0; margin: 0 auto 0 0; }
  .side .brand .wordmark-side { font-size: 24px; } .side .brand .tagline, .nav-group, .side .foot { display: none; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
  .nav a, .nav button { width: auto; border-left: 0; padding: 7px 10px; }
  .nav .soon { display: none; }
  .main { padding: 22px 16px 48px; }
}

/* ---------- Bausteine ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 26px; box-shadow: var(--shadow-sm); margin-bottom: 20px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; } }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat .label { font-size: 12.5px; color: var(--muted); }
.stat .value { font-family: var(--display); font-size: 24px; font-weight: 600; margin-top: 4px; }
.stat .hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; font: inherit; font-weight: 600; font-size: 14.5px; border: 1px solid var(--ink); background: var(--ink); color: var(--white); cursor: pointer; text-decoration: none; transition: background .15s, transform .05s; }
.btn:hover { background: var(--ink-soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn.gold:hover { background: #BF9D52; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--paper); }
.btn.small { padding: 6px 13px; font-size: 13.5px; }
.btn.link { background: none; border: 0; color: var(--ink); padding: 0; text-decoration: underline; text-decoration-color: var(--gold); font-weight: 500; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
label.field > small { display: block; margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], input[type=tel], input[type=date], select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--white); border: 1px solid #D9D2C3; border-radius: var(--radius-sm); padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 169, 97, .25); }
input.code { font-size: 26px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; max-width: 260px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 700px) { .row { grid-template-columns: 1fr; } }

.alert { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px; border: 1px solid; font-size: 14.5px; }
.alert.error { background: var(--danger-soft); border-color: #E7C2B8; color: #7A2A18; }
.alert.ok { background: var(--success-soft); border-color: #BFD9CE; color: #1D5A45; }
.alert.warn { background: var(--warn-soft); border-color: #E6D3A4; color: #5F440A; }
.alert.info { background: #EEF2F7; border-color: #D5DEEA; color: var(--ink-soft); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: var(--paper-deep); color: var(--ink-soft); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--gold-soft); color: var(--gold-deep); }

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 2px solid var(--gold-soft); }
table.list td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist .mark { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; margin-top: 1px; }
.checklist .mark.ok { background: var(--success-soft); color: var(--success); }
.checklist .mark.err { background: var(--danger-soft); color: var(--danger); }
.checklist .mark.warn { background: var(--warn-soft); color: var(--warn); }
.checklist .mark.run { background: var(--paper-deep); color: var(--muted); }
.checklist .detail { color: var(--muted); font-size: 13px; }

/* ---------- Anmeldung ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-art { background: var(--ink); color: var(--paper); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px; border: 1px solid rgba(201, 169, 97, .35); border-radius: 50%; }
.auth-art::before { content: ''; position: absolute; right: -40px; bottom: -40px; width: 200px; height: 200px; border: 1px solid rgba(201, 169, 97, .25); border-radius: 50%; }
.auth-art h1 { font-size: 42px; color: var(--paper); max-width: 420px; }
.auth-art h1 em { font-style: normal; color: var(--gold); }
.auth-art p { color: rgba(250, 248, 244, .72); max-width: 400px; }
.auth-art .mono-mark { font-family: var(--display); font-size: 15px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 420px; }
.auth-box .wordmark { margin-bottom: 30px; }
/* Wortmarke: Produktname in der Auszeichnungsschrift mit goldenem Strich */
.wordmark { font-family: var(--display); font-weight: 600; color: var(--ink); line-height: 1; letter-spacing: -.02em; display: inline-block; }
.wordmark span::after { content: ''; display: block; width: 38%; height: 3px; background: var(--gold); margin-top: 8px; border-radius: 2px; }
.wordmark-auth { font-size: 40px; }
.wordmark-side { font-size: 30px; }
.wordmark-boot { font-size: 46px; }
pre.cmd { background: var(--paper-deep); border-radius: var(--radius-sm); padding: 10px 12px; white-space: pre-wrap; word-break: break-all; margin: 12px 0; }
.auth-box h2 { font-size: 26px; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-art { display: none; } }
.qr-box { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; margin: 18px 0; }
.qr-box svg { width: 190px; height: 190px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 14px; letter-spacing: .08em; background: var(--paper-deep); border-radius: 8px; padding: 8px 10px; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.codes code { font-size: 15px; background: var(--paper-deep); border-radius: 8px; padding: 8px 10px; text-align: center; letter-spacing: .06em; }

/* ---------- Belegkern ---------- */
.preview { width: 100%; height: 860px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #EDEAE3; }
pre.xml { max-height: 640px; overflow: auto; background: #0F1B2E; color: #E8E3D6; padding: 16px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.45; }
.msg-list { margin: 0; padding-left: 18px; }
.msg-list li { margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-variant-numeric: tabular-nums; }

#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.toast { background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); max-width: 380px; font-size: 14px; animation: in .2s ease-out; }
.toast.error { background: #7A2A18; }
.toast.ok { background: #1D5A45; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.ghost .spinner, .btn.gold .spinner { border-color: rgba(10, 22, 40, .2); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ---------- Stammdaten (Etappe 2) ---------- */
textarea { min-height: 78px; resize: vertical; line-height: 1.5; }
label.field.invalid input, label.field.invalid select, label.field.invalid textarea { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(180, 70, 46, .12); }
.field-error { display: block; color: var(--danger); font-size: 12.5px; margin-top: 4px; }
label.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 12px; cursor: pointer; font-size: 14.5px; }
label.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--gold-deep); flex: none; }
label.check small { display: block; color: var(--muted); font-size: 12.5px; }
.row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row.addr { grid-template-columns: 130px minmax(0, 1fr) 220px; }
.row.person { grid-template-columns: 170px 150px minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 900px) { .row.person { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .row.three, .row.addr, .row.person { grid-template-columns: 1fr; } }
.sal-preview { font-size: 13px; margin: -4px 0 12px; }
.sal-preview code { background: var(--paper-deep); padding: 1px 5px; border-radius: 4px; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type=search] { max-width: 460px; }
.toolbar .spacer { flex: 1; }
.tabs, .seg { display: inline-flex; background: var(--paper-deep); border-radius: 99px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.tabs button, .seg button { border: 0; background: none; font: inherit; font-size: 13.5px; padding: 6px 14px; border-radius: 99px; cursor: pointer; color: var(--ink-soft); }
.tabs button.active, .seg button.active { background: var(--white); box-shadow: var(--shadow-sm); font-weight: 600; color: var(--ink); }
.tabs .count { font-size: 11.5px; color: var(--muted); margin-left: 4px; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--paper); }
table.list tr.click:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
table.list td .sub { display: block; font-size: 12.5px; color: var(--muted); }
table.list .badge { margin: 0 4px 2px 0; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 12px; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding: 12px 0; margin-top: 4px; background: rgba(250, 248, 244, .95); border-top: 1px solid var(--line); }
.savebar .state { margin-right: auto; font-size: 13.5px; color: var(--muted); }
.savebar .state.dirty { color: var(--warn); font-weight: 600; }
.btn.danger { background: var(--white); color: var(--danger); border-color: #E7C2B8; }
.btn.danger:hover { background: var(--danger-soft); }
.preview-line { font-size: 13px; color: var(--ink-soft); white-space: pre-line; background: var(--paper); border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; margin: -6px 0 16px; }
.preview-line::before { content: 'Vorschau: '; color: var(--muted); font-weight: 600; }
.placeholders { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; margin: 0 0 16px; }
.placeholders dt code { background: var(--paper-deep); padding: 1px 6px; border-radius: 6px; }
.placeholders dd { margin: 0; color: var(--muted); }
.check-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.check-list li { padding: 5px 0 5px 24px; position: relative; }
.check-list li::before { position: absolute; left: 0; top: 5px; font-weight: 700; }
.check-list li.err::before { content: '✕'; color: var(--danger); }
.check-list li.warn::before { content: '!'; color: var(--warn); left: 5px; }
.check-list li.ok::before { content: '✓'; color: var(--success); }
dialog.modal { border: 0; border-radius: var(--radius); padding: 0; width: min(960px, calc(100% - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 30px 80px rgba(10, 22, 40, .25); color: var(--ink); }
dialog.modal::backdrop { background: rgba(10, 22, 40, .38); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-body { padding: 20px 24px; overflow: auto; max-height: calc(100vh - 210px); }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--paper); }
.mapping { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 14px; }
.mapping span { font-size: 12.5px; border-radius: 99px; padding: 2px 10px; background: var(--success-soft); color: var(--success); }
.mapping span.ignored { background: var(--paper-deep); color: var(--muted); text-decoration: line-through; }
table.list.compact td, table.list.compact th { padding: 5px 8px; font-size: 13px; }
table.list tr.bad td { background: var(--danger-soft); }
input[type=file] { font: inherit; font-size: 14px; }
.hint-box { font-size: 13.5px; color: var(--ink-soft); background: #EEF2F7; border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 14px; }

/* ---------- Belege (Etappe 3) ---------- */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.editor-side { position: sticky; top: 16px; }
.editor-side .card { margin-bottom: 0; }
@media (max-width: 1150px) { .editor-grid { grid-template-columns: 1fr; } .editor-side { position: static; } }
.picker .picked { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14.5px; line-height: 1.45; }
.picker .picked .actions { flex-direction: column; align-items: flex-end; gap: 6px; }
.suggest-wrap { position: relative; flex: 1; max-width: 520px; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 320px; overflow: auto; }
.suggest.static { position: static; box-shadow: none; margin-top: 6px; max-height: 260px; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit; font-size: 14px; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover, .suggest button:focus { background: var(--paper); outline: none; }
/* Position: Zeile 1 = Bezeichnung und Werkzeuge, Zeile 2 = Menge, Einheit, Preis, Rabatt, USt., Gesamt */
.lines .line { display: grid; grid-template-columns: 26px 88px minmax(0, 1.3fr) minmax(0, 1.1fr) 96px minmax(0, 1.3fr) minmax(96px, 1fr); gap: 6px 8px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lines .line > .line-pos { grid-column: 1; grid-row: 1 / span 2; }
.lines .line > .line-main { grid-column: 2 / 7; grid-row: 1; }
.lines .line > .line-tools { grid-column: 7; grid-row: 1; }
.lines .line > .line-f { display: block; margin: 0; }
.lines .line > .line-f > span { display: block; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.lines .line input, .lines .line select { padding: 7px 8px; font-size: 14px; }
.lines .line input.num { text-align: right; font-variant-numeric: tabular-nums; }
.lines .line-pos { padding-top: 9px; font-weight: 700; color: var(--muted); font-size: 13px; }
.lines .line-main { padding-top: 0; }
.lines .line-name { font-weight: 600; }
.lines .line-meta { display: flex; gap: 10px; align-items: center; font-size: 12.5px; margin-top: 3px; }
.lines .line-desc { margin-top: 6px; font-size: 13.5px; min-height: 52px; }
.lines .line-total { padding: 8px 0 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.lines .line-tools { display: flex; gap: 3px; padding-top: 4px; justify-content: flex-end; }
.lines .line-add { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.lines.locked .line-tools, .lines.locked .line-add { display: none; }
button.icon { border: 1px solid var(--line); background: var(--white); border-radius: 8px; width: 24px; height: 28px; font-size: 13px; cursor: pointer; color: var(--ink-soft); padding: 0; }
button.icon:hover { background: var(--paper); }
button.icon.danger { color: var(--danger); }
.btn.link.small { font-size: 12.5px; }
@media (max-width: 800px) { .lines .line { grid-template-columns: 1fr 1fr; } .lines .line > .line-pos { display: none; } .lines .line > .line-main { grid-column: 1 / -1; } .lines .line > .line-tools { grid-column: 1 / -1; grid-row: auto; justify-content: flex-start; } }
.stat.alert-stat .value { color: var(--danger); }
.legal-preview { font-size: 12.5px; background: var(--paper); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; color: var(--ink-soft); margin: 0; }
.tpl { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px; }
details summary { cursor: pointer; font-size: 13.5px; color: var(--muted); margin: 8px 0; }
.stat-link { text-decoration: none; color: inherit; display: block; } .stat-link:hover .stat { border-color: var(--gold); }
/* Textbausteine: Auswahl rechts neben der Feldbeschriftung */
.with-picker { position: relative; }
.with-picker > select.block-pick { position: absolute; right: 0; top: -6px; width: auto; max-width: 60%; padding: 4px 28px 4px 8px; font-size: 12.5px; z-index: 1; }
.block-list .block { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 4px; margin-bottom: 12px; }
.block-list .block .row { align-items: end; }
.sig-preview { white-space: pre-wrap; font-size: 13px; background: var(--paper, #FAF8F4); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin: 0 0 12px; }
.runs li { font-size: 13.5px; }
.cron-url { display: flex; gap: 8px; align-items: center; }
.cron-url input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
/* Weitere Angaben (zugeklappt) */
details.card.more { padding: 16px 26px; }
details.card.more > summary { cursor: pointer; list-style: none; font-size: 15px; }
details.card.more > summary::-webkit-details-marker { display: none; }
details.card.more > summary::before { content: '▸'; display: inline-block; width: 16px; color: var(--gold-deep); transition: transform .15s; }
details.card.more[open] > summary::before { transform: rotate(90deg); }
details.card.more .more-body { margin-top: 16px; }

/* ---------- Eingangsrechnungen, Übergabe (Etappe 5) ---------- */
.dropzone { border: 2px dashed var(--gold-soft); border-radius: var(--radius); background: var(--paper); padding: 26px 20px; text-align: center; cursor: pointer; display: grid; gap: 4px; justify-items: center; transition: background .15s, border-color .15s; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.over { border-color: var(--gold); background: #F6F0E3; outline: none; }
.dropzone strong { font-size: 16px; } .dropzone span { color: var(--ink-soft); } .dropzone small { color: var(--muted); font-size: 12.5px; }
.upload-results { margin-top: 14px; }
.inbox-bar { margin-top: 12px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.6; }
.inbox-bar:empty { display: none; }
.inbox-addr { font-weight: 600; color: var(--ink); }
.inbox-addr::before { content: '✉'; margin-right: 6px; color: var(--gold); }
.err-text { color: var(--danger); }
.mail-origin { font-size: 13px; color: var(--ink-soft); margin: 0 0 14px; }
.rec-low input { border-color: var(--gold); background: var(--warn-soft); }
.plain-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-soft); font-size: 14px; }
.hosp-grid { display: grid; gap: 12px; margin-top: 12px; }
.card.quiet { background: transparent; box-shadow: none; border: 1px dashed var(--line); }
.card.quiet h2 { font-size: 18px; }
.card.rec-low { border-left: 3px solid var(--gold); }
.check-list li.info::before { content: 'i'; color: var(--ink-soft); left: 5px; font-style: italic; }
.check-list li.run { padding-left: 0; }
.ok-line { color: var(--success); font-weight: 600; margin: 0; }
.incoming-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.incoming-side { position: sticky; top: 16px; }
.incoming-side .viewer { margin-bottom: 0; max-height: calc(100vh - 110px); overflow: auto; }
@media (max-width: 1250px) { .incoming-grid { grid-template-columns: 1fr; } .incoming-side { position: static; } .incoming-side .viewer { max-height: none; } }
.viewer .preview { height: calc(100vh - 230px); min-height: 520px; }
.viewer img.scan { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.split-table { display: grid; gap: 6px; margin-bottom: 10px; }
.split-head, .split-row { display: grid; gap: 6px; align-items: start; }
.split-row.booking { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr) 64px minmax(0, 1fr); grid-template-areas: 'acc tax key gross' 'cc text text rm'; gap: 6px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.split-row.booking .c-acc { grid-area: acc; } .split-row.booking .c-tax { grid-area: tax; } .split-row.booking .c-key { grid-area: key; } .split-row.booking .c-gross { grid-area: gross; }
.split-row.booking .c-cc { grid-area: cc; } .split-row.booking .c-text { grid-area: text; } .split-row.booking .c-rm { grid-area: rm; align-self: end; justify-self: end; margin-bottom: 6px; }
.split-row .sf { display: block; margin: 0; min-width: 0; }
.split-row .sf > span { display: block; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.split-head.tax, .split-row.tax { grid-template-columns: minmax(150px, 1.4fr) minmax(100px, 1fr) minmax(100px, 1fr) 70px; }
.split-head span { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.split-row input, .split-row select { padding: 7px 8px; font-size: 14px; width: 100%; }
.split-row input.num { text-align: right; font-variant-numeric: tabular-nums; }
.split-row .acc-name { display: block; font-size: 11.5px; margin-top: 2px; line-height: 1.3; }
@media (max-width: 800px) { .split-head { display: none; } .split-row.tax { grid-template-columns: 1fr 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--line); } .split-row.booking { grid-template-columns: 1fr 1fr; grid-template-areas: 'acc tax' 'key gross' 'cc text' 'rm rm'; } }
.balance { font-size: 13.5px; font-weight: 600; padding: 8px 12px; border-radius: var(--radius-sm); }
.balance.ok { background: var(--success-soft); color: var(--success); }
.balance.err { background: var(--warn-soft); color: var(--warn); }
.einvoice h3 { margin: 20px 0 8px; font-size: 15px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.einvoice h3:first-child { margin-top: 0; font-family: var(--display); font-size: 19px; border: 0; }
.einvoice .grid.two { gap: 12px; font-size: 14px; }
.einvoice .kv.totals dd { text-align: right; }
.pre { white-space: pre-line; }
details.more > summary { cursor: pointer; margin-top: 14px; color: var(--ink-soft); font-size: 14px; }
details.more[open] > summary { margin-bottom: 12px; }
.export-sum td.num { white-space: nowrap; }
.acc-table .split-row { grid-template-columns: 110px minmax(0, 1fr) 70px; }

/* ---------- Formate, Zustellung, Links, Stripe (Etappe 6) ---------- */
.format-box .format-sels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.format-box .format-sels select { width: 100%; }
.format-box small.muted { display: block; margin-top: 4px; font-size: 12.5px; }
.format-kind { padding: 14px 0; border-top: 1px solid var(--line); }
.format-kind:first-of-type { border-top: 0; padding-top: 4px; }
.format-kind-head h3 { margin: 0 0 2px; font-size: 15.5px; }
.format-kind-head p { margin: 0 0 10px; font-size: 13px; }
.format-kind .row { margin-bottom: 0; }
.format-attach { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; font-size: 14px; }
.format-attach .check { margin: 0; }
.format-kind .field-error { display: block; margin-top: 6px; }
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.link-list li { display: grid; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.link-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.link-list input { width: 100%; font-size: 12.5px; padding: 6px 8px; }
.link-list .actions { gap: 6px; }
ol.steps { margin: 0; padding-left: 20px; font-size: 14px; display: grid; gap: 8px; }
ol.steps .toolbar input { flex: 1; min-width: 220px; font-size: 13px; }
.online-check small { display: block; }
td.row-actions { white-space: nowrap; text-align: right; }
td.row-actions .btn { margin-left: 4px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-soft); }
label.inline input { padding: 6px 8px; }
.modal-body h3 { font-size: 15.5px; margin: 6px 0 10px; }
.delivery-mode { display: grid; gap: 6px; justify-items: start; margin: 4px 0 16px; }
.delivery-mode > span { font-size: 13px; font-weight: 600; }
.delivery-mode p { margin: 0; }
.link-list input.mono { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; }
/* Rabatt: Umschalter Prozent / Betrag */
.line-f.disc .disc-box { display: flex; align-items: stretch; }
.line-f.disc .disc-box input { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; }
.disc-unit { border: 1px solid var(--line); border-left: 0; background: var(--paper-deep); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 0 8px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.disc-unit:hover { background: var(--gold-soft); }
/* Aktionen je Zeile (Kopieren, Umwandeln) */
td.row-menu-cell { width: 44px; text-align: right; padding-left: 0; }
details.row-menu { position: relative; display: inline-block; }
details.row-menu > summary { list-style: none; cursor: pointer; width: 32px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 18px; line-height: 1; color: var(--ink-soft); }
details.row-menu > summary::-webkit-details-marker { display: none; }
details.row-menu > summary:hover, details.row-menu[open] > summary { background: var(--paper-deep); }
.row-menu-list { position: fixed; z-index: 40; min-width: 230px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px; display: grid; }
.row-menu-list a, .row-menu-list button { display: block; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; white-space: nowrap; }
.row-menu-list a:hover, .row-menu-list button:hover { background: var(--paper); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Angebotsvorlagen und freie Abschnitte */
.tpl-grid { grid-template-columns: minmax(240px, 0.8fr) minmax(0, 2fr); align-items: start; }
@media (max-width: 1000px) { .tpl-grid { grid-template-columns: 1fr; } }
.tpl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tpl-list button { width: 100%; text-align: left; background: none; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; cursor: pointer; display: grid; gap: 2px; }
.tpl-list button:hover { background: var(--paper); }
.tpl-list li.active button { background: var(--paper-deep); border-color: var(--gold-soft); }
.tpl-list .muted { font-size: 12.5px; }
.sections-editor { display: grid; gap: 10px; margin-bottom: 10px; }
.section-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; background: var(--paper); display: grid; gap: 8px; }
.section-head { display: flex; gap: 6px; align-items: center; }
.section-head input { flex: 1; }
.section-item textarea { width: 100%; }
.tpl-pick { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.tpl-pick select { min-width: 240px; }
.card.inset { box-shadow: none; background: var(--paper); margin: 12px 0 0; padding: 16px 18px; }
.card.inset h3 { margin-top: 0; }

/* Stripe: Live- und Testmodus */
.stripe-status { border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 14px; font-size: 14px; line-height: 1.5; }
.stripe-status.live { background: var(--success-soft); color: var(--success); border: 1px solid #BFDCCF; }
.stripe-status.test { background: var(--warn-soft); color: var(--warn); border: 1px solid #E9D6A6; }
.stripe-status strong { letter-spacing: .02em; }
.stripe-modes { margin-bottom: 14px; gap: 16px; }
.stripe-mode { margin: 0; }
.stripe-mode .stripe-mode-head { margin-top: 0; display: flex; align-items: center; gap: 8px; }
.stripe-mode.active-mode { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.stripe-mode.active-mode .stripe-mode-head::after { content: 'aktiv für Rechnungen'; font: 600 11px var(--font); letter-spacing: .04em; text-transform: uppercase; color: var(--gold-deep); background: var(--gold-soft); padding: 2px 8px; border-radius: 99px; }
@media (max-width: 900px) { .stripe-modes { grid-template-columns: 1fr; } }

/* Schnittstelle (Etappe 8) */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.copy-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.copy-row input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.secret-once { border: 2px solid var(--gold); background: #FFFBEF; border-radius: var(--radius); padding: 14px 16px; margin: 10px 0 16px; }
.secret-once .muted { margin: 6px 0 0; font-size: 13px; }
.scope-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; margin: 4px 0 12px; }
.event-head { display: flex; gap: 10px; align-items: baseline; margin: 6px 0 4px; }
.event-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; margin-bottom: 12px; }
.event-group { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; margin: 0; }
.event-group legend { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.event-group .check { margin: 4px 0; }
td.actions-cell { text-align: right; white-space: nowrap; }
td.actions-cell .btn + .btn { margin-left: 6px; }
pre.json { background: var(--paper-deep); border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.5; overflow: auto; max-height: 60vh; white-space: pre; }
.page-actions { display: flex; gap: 8px; }
@media (max-width: 900px) { .scope-list, .event-groups { grid-template-columns: 1fr; } }

/* Go-live (Etappe 9): Datensicherung, Inbetriebnahme, Verfahrensdokumentation, Wiederherstellung */
.test-badge { display: inline-block; align-self: flex-start; margin: -4px 10px 10px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft); border: 1px solid #E9D6A6; border-radius: 99px; padding: 2px 10px; text-decoration: none; }
.test-badge:hover { border-color: var(--warn); }
.checklist .mark.info { background: var(--paper-deep); color: var(--muted); font-style: italic; font-family: var(--display); }
.golive-checks li { align-items: center; }
.golive-finish { border-color: #E8C7BD; }
.golive-finish h3 { margin-top: 6px; }
table.backups .badge { margin: 0 4px 2px 0; }
.procedure { align-items: start; }
td.actions-cell.versions-actions { white-space: normal; }
td.actions-cell.versions-actions .btn { margin: 2px 0 2px 6px; }
.procedure textarea { min-height: 84px; resize: vertical; }
iframe.doc-preview { width: 100%; height: 68vh; min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper-deep); }
.progress { height: 10px; background: var(--paper-deep); border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.progress > span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s ease; }
.restore-files { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.restore-files label { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.restore-files input:checked + span { font-weight: 600; }
.restore-summary { margin: 10px 0 14px; }
.suggest button.active { background: var(--paper-deep); }
.suggest-more { padding: 8px 12px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }

/* 0.9.2: weitere Anmeldewege, Geräte, Passkeys */
.auth-alt { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line, #e6e1d6); }
.auth-alt > .muted:first-child { font-size: 13px; }
.auth-alt small { font-size: 12px; }
.device-list td .badge { margin-left: 6px; }
.security-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.security-row .field { min-width: 180px; }
.auth-alt .btn.link { text-align: left; }

/* Symbol im Browser (Favicon) */
.logo-preview { min-height: 72px; display: flex; align-items: center; padding: 14px 18px; background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius-sm); margin-top: 6px; }
.logo-preview img { max-width: 320px; max-height: 90px; width: auto; height: auto; display: block; }
.icon-preview { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 6px; }
.icon-preview .icon-big { width: 64px; height: 64px; border-radius: 14px; border: 1px solid var(--line); background: var(--white); object-fit: contain; }
.icon-tab { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--paper); font-size: 13px; min-width: 200px; }
.icon-tab img { width: 16px; height: 16px; }

/* Ladeanzeige: Drehkreis im Inhalt, dünner Balken oben bei längeren Anfragen */
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 64px 16px; color: var(--muted); font-size: 15px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--gold-soft); border-top-color: var(--gold-deep); animation: af-spin .8s linear infinite; flex: none; }
#activity { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100; overflow: hidden; background: var(--gold-soft); }
#activity::before { content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: var(--gold); animation: af-bar 1.1s ease-in-out infinite; }
#activity[hidden] { display: none; }
@keyframes af-spin { to { transform: rotate(360deg); } }
@keyframes af-bar { to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .spinner, #activity::before { animation-duration: 3s; } }

/* Abo über Stripe (Serie) */
.autopay-box { margin: 12px 0; }
.copy-line code { display: block; word-break: break-all; font-size: 12.5px; background: var(--paper-deep); padding: 6px 8px; border-radius: 6px; margin: 4px 0 8px; }
/* 0.9.5: Formatierungsleiste über E-Mail-Vorlagen */
.fmt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 6px; }
.fmt-bar .spacer { flex: 1; }
.fmt-bar .btn.small { min-width: 34px; }
.fmt-bar select.small { width: auto; padding: 5px 8px; font-size: 13px; }
