/* Muster Metallbau – Oberfläche. Ruhig, gut lesbar, Werkstatt-tauglich. */
@font-face { font-family: Jost; src: url(fonts/jost-400.ttf) format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: Jost; src: url(fonts/jost-500.ttf) format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: Jost; src: url(fonts/jost-600.ttf) format("truetype"); font-weight: 600 700; font-display: swap; }

:root {
  --bg: #f3f2f5; --flaeche: #ffffff; --flaeche-2: #f9f8fb; --linie: #e1dfe6; --linie-stark: #c6c3cd;
  --text: #2b2a2e; --text-2: #55535b; --text-3: #6a6871;
  --akzent: #5b4590; --akzent-hover: #4a3877; --akzent-text: #ffffff; --akzent-weich: #eeeaf6; --logo-grau: #3d3c3f; --lila: #5b4590;
  --gut: #1f7a4d; --gut-weich: #e5f3ea; --warn: #8a5a00; --warn-weich: #fdf3dc; --schlecht: #b42318; --schlecht-weich: #fdecea;
  --info-weich: #eceef1; --fokus: #2f6fde;
  --radius: 8px; --radius-gross: 12px;
  --schatten: 0 1px 2px rgb(20 20 20 / .06), 0 2px 8px rgb(20 20 20 / .04);
  --schrift: Jost, "Century Gothic", Futura, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --mono: var(--schrift);
  color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #161519; --flaeche: #1f1e23; --flaeche-2: #242329; --linie: #322f39; --linie-stark: #4a4653;
    --text: #ecebef; --text-2: #b9b6c1; --text-3: #9d9aa6;
    --akzent: #b6a4e4; --akzent-hover: #c9bbec; --akzent-text: #1b1528; --akzent-weich: #2e2640;
    --gut: #5cc48d; --gut-weich: #18301f; --warn: #f2bd4b; --warn-weich: #33290f; --schlecht: #f2766b; --schlecht-weich: #3a1c1a;
    --info-weich: #262a30; --fokus: #7aa7ff;
    --schatten: 0 1px 2px rgb(0 0 0 / .4);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.5 var(--schrift); }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: inherit; }
/* Links im Inhalt: Lila ohne Unterstrich, Unterstrich erst beim Darüberfahren (nicht auf dem Rechnungsblatt) */
main a:not(.btn):not(.papier a) { color: var(--akzent); text-decoration: none; font-weight: 500; }
main a:not(.btn):not(.papier a):hover { text-decoration: underline; text-underline-offset: 3px; }
.mono, .num { font-variant-numeric: tabular-nums; }
body { font-variant-numeric: tabular-nums; }
.num { text-align: right; white-space: nowrap; }
.leise { color: var(--text-2); }
.klein { font-size: .875rem; }
.laden { padding: 3rem; text-align: center; color: var(--text-2); }
:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--flaeche); padding: 8px 12px; z-index: 50; border-radius: var(--radius); }
.skip:focus { left: 8px; }
.sr { position: absolute; left: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Rahmen ---------- */
.rahmen { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.seite { background: var(--flaeche); border-right: 1px solid var(--linie); padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; height: 100dvh; }
.marke { display: block; padding: 2px 6px 18px; text-decoration: none; color: var(--text); }
.marke svg { width: 100%; max-width: 190px; height: auto; display: block; }
.marke .marke-text { display: block; letter-spacing: .42em; font-weight: 500; font-size: .82rem; margin-top: 6px; padding-left: 22%; color: var(--logo-grau, var(--text)); }
.oben-band { height: 6px; background: var(--lila); position: fixed; top: 0; left: 0; right: 0; z-index: 30; }
.marke-zeichen { width: 32px; height: 32px; border-radius: 7px; background: var(--text); color: var(--bg); display: grid; place-items: center; font: 600 .78rem var(--mono); letter-spacing: .02em; }
.eingang .marke { padding: 0 0 8px; } .eingang .marke svg { max-width: 220px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius); text-decoration: none; color: var(--text-2); font-weight: 500; min-height: 40px; }
.nav a:hover { background: var(--flaeche-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--akzent-weich); color: var(--text); }
.nav a[aria-current="page"] svg { color: var(--akzent); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .zahl { margin-left: auto; font: 500 .75rem var(--mono); background: var(--info-weich); color: var(--text-2); padding: 1px 7px; border-radius: 99px; }
.seite-fuss { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--linie); font-size: .875rem; color: var(--text-2); }
.seite-fuss button { margin-top: 6px; }
main { padding: 28px 32px 64px; max-width: 1240px; width: 100%; min-width: 0; }
.kopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.kopf p { color: var(--text-2); margin-top: 4px; }
.knoepfe { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.banner { background: var(--warn-weich); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); padding: 10px 14px; border-radius: var(--radius); margin-bottom: 18px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ---------- Knöpfe und Felder ---------- */
button, .btn { font: inherit; font-weight: 600; font-size: .9375rem; border-radius: var(--radius); border: 1px solid var(--linie-stark); background: var(--flaeche); color: var(--text);
  padding: 0 14px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease; }
button:hover, .btn:hover { background: var(--flaeche-2); border-color: var(--text-3); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.primaer:hover { background: var(--akzent-hover); border-color: var(--akzent-hover); }
.gefahr { color: var(--schlecht); border-color: color-mix(in srgb, var(--schlecht) 45%, transparent); }
.gefahr:hover { background: var(--schlecht-weich); border-color: var(--schlecht); }
.flach { border-color: transparent; background: transparent; }
.flach:hover { background: var(--info-weich); border-color: transparent; }
.ikon { width: 40px; padding: 0; }
button svg, .btn svg { width: 17px; height: 17px; flex: none; }
.gross { min-height: 46px; padding: 0 20px; font-size: 1rem; }

label { display: block; font-weight: 500; font-size: .875rem; margin-bottom: 4px; color: var(--text-2); }
input, select, textarea { font: inherit; font-size: 1rem; color: var(--text); background: var(--flaeche); border: 1px solid var(--linie-stark); border-radius: var(--radius); padding: 8px 10px; min-height: 40px; width: 100%; }
input:hover, select:hover, textarea:hover { border-color: var(--text-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--fokus); outline-offset: 0; border-color: var(--fokus); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--akzent); margin: 0; flex: none; }
textarea { min-height: 72px; resize: vertical; }
.feld { margin-bottom: 14px; }
.hilfe { font-size: .8125rem; color: var(--text-3); margin-top: 4px; }
.haken { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; color: var(--text); font-size: .9375rem; margin: 6px 0 14px; cursor: pointer; }
.haken input { margin-top: 3px; }
.reihe { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 14px; }
.reihe-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.reihe-plz { display: grid; grid-template-columns: 110px 1fr; gap: 0 14px; }

/* ---------- Karten, Kennzahlen ---------- */
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius-gross); }
.karte-kopf { padding: 14px 18px; border-bottom: 1px solid var(--linie); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.karte-inhalt { padding: 18px; }
.raster { display: grid; gap: 16px; }
.raster-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.raster-3 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-bottom: 20px; background: var(--linie); border: 1px solid var(--linie); border-radius: var(--radius-gross); overflow: hidden; }
.kpis > .karte { border: 0; border-radius: 0; }
.kpi { padding: 18px 20px; }
.kpi span { color: var(--text-2); font-size: .875rem; font-weight: 500; }
.kpi strong { display: block; font: 500 1.6rem/1.3 var(--schrift); margin-top: 4px; letter-spacing: -.01em; }
.kpi small { color: var(--text-3); font-size: .8125rem; }
.kpi.warn strong { color: var(--schlecht); }
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--linie); }
.liste li:last-child { border-bottom: 0; }
.liste .wer { min-width: 0; }
.liste .wer strong { display: block; font-weight: 600; }
.liste .wer span { color: var(--text-2); font-size: .875rem; }
/* Beträge in Listen: rechtsbündige Zahl statt Knopf; die ganze Zeile reagiert */
.liste li > a.btn { border-color: transparent; background: none; padding: 0 2px; min-height: 32px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.liste li:has(> a.btn) { position: relative; transition: background-color .15s ease; }
.liste li:has(> a.btn):hover { background: var(--flaeche-2); }
.liste li > a.btn::after { content: ""; position: absolute; inset: 0; }
.liste li > a.btn:hover { background: none; color: var(--akzent); }
.leer { padding: 28px 18px; text-align: center; color: var(--text-2); }
.leer strong { display: block; color: var(--text); margin-bottom: 4px; }
.leer button { margin-top: 12px; }
.schritte-start { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.schritte-start li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--linie); }
.schritte-start li:last-child { border-bottom: 0; }
.schritte-start .punkt { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--linie-stark); flex: none; display: grid; place-items: center; }
.schritte-start .erledigt .punkt { background: var(--gut); border-color: var(--gut); color: #fff; }
.schritte-start .erledigt span { text-decoration: line-through; color: var(--text-3); }
.schritte-start li > span { flex: 1; }

/* ---------- Tabellen ---------- */
.tabelle-huelle { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
th { text-align: left; font-weight: 500; font-size: .8125rem; color: var(--text-2); padding: 10px 14px; border-bottom: 1px solid var(--linie); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--linie); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tr.klick { cursor: pointer; }
tr.klick:hover td { background: var(--flaeche-2); }
th.num, td.num { text-align: right; }
th.num { font-family: inherit; font-size: .8125rem; }
.zelle-titel { font-weight: 600; }
.zelle-unter { font-size: .8125rem; color: var(--text-2); }
.rot { color: var(--schlecht); font-weight: 600; }

/* ---------- Status ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; background: var(--info-weich); color: var(--text-2); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.offen { background: var(--warn-weich); color: var(--warn); }
.status.bezahlt { background: var(--gut-weich); color: var(--gut); }
.status.ueberfaellig { background: var(--schlecht-weich); color: var(--schlecht); }
.status.entwurf { background: var(--info-weich); color: var(--text-2); }
.status.storniert, .status.storno { background: var(--info-weich); color: var(--text-3); }
.status.angenommen, .status.abgeschlossen { background: var(--gut-weich); color: var(--gut); }
.status.abgelehnt, .status.abgelaufen { background: var(--info-weich); color: var(--text-3); }
.status.art { background: var(--akzent-weich); color: var(--akzent); margin-left: 6px; }
.status.art::before { display: none; }

/* ---------- Aufträge ---------- */
.fortschritt { height: 6px; border-radius: 99px; background: var(--info-weich); overflow: hidden; margin-top: 8px; }
.fortschritt > span { display: block; height: 100%; background: var(--akzent); border-radius: inherit; }

/* ---------- Verfahrensdokumentation ---------- */
.vd { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius-gross); padding: 32px 40px; max-width: 900px; line-height: 1.55; }
.vd h1 { font-size: 1.5rem; margin: 0 0 4px; }
.vd h2 { font-size: 1.12rem; margin: 28px 0 8px; padding-top: 14px; border-top: 1px solid var(--linie); }
.vd h3 { font-size: .98rem; margin: 16px 0 4px; }
.vd p, .vd li { font-size: .94rem; }
.vd ul { margin: 4px 0 8px; padding-left: 20px; }
.vd table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: .88rem; }
.vd th, .vd td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--linie); vertical-align: top; }
.vd th { color: var(--text-2); font-weight: 600; background: var(--flaeche-2); }
.vd .kopfdaten th { width: 34%; }
.vd .fehlt { color: var(--warn); font-style: italic; }
.vd .unterschrift { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 48px; }
.vd .unterschrift div { border-top: 1px solid var(--text-3); padding-top: 6px; font-size: .85rem; color: var(--text-2); }

/* ---------- Suche und Filter ---------- */
.werkzeug { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.suche { position: relative; flex: 1 1 280px; max-width: 460px; }
.suche svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-3); pointer-events: none; }
.suche input { padding-left: 36px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 0 12px; font-weight: 500; font-size: .875rem; border-radius: 99px; background: var(--flaeche); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .n { font-family: var(--mono); font-size: .75rem; opacity: .75; }

/* ---------- Schrittfolge (Rechnung erstellen) ---------- */
.stepper { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 20px; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-weight: 500; font-size: .9375rem; }
.stepper li + li::before { content: ""; width: 28px; height: 1px; background: var(--linie-stark); }
.stepper .nr { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--linie-stark); font: 500 .8rem var(--mono); }
.stepper .aktiv { color: var(--text); }
.stepper .aktiv .nr { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.stepper .fertig .nr { background: var(--text); border-color: var(--text); color: var(--bg); }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.summe-box { position: sticky; top: 16px; }
.summe-box dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.summe-box dt { color: var(--text-2); }
.summe-box dd { margin: 0; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.summe-box .gesamt { font-weight: 700; font-size: 1.1rem; padding-top: 8px; border-top: 1px solid var(--linie); }
.pos-tab td, .pos-tab th { padding: 6px 8px; } .pos-tab th { padding-top: 10px; padding-bottom: 10px; }
.pos-tab input { min-height: 36px; padding: 6px 8px; }
.pos-tab td:first-child { min-width: 280px; } .pos-tab .m { width: 84px; } .pos-tab .p { width: 104px; } .pos-tab .e { width: 124px; }
.pos-typ { font-size: .8125rem; font-weight: 500; color: var(--text-3); margin-bottom: 2px; }
.quellen { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-top: 1px solid var(--linie); background: var(--flaeche-2); border-radius: 0 0 var(--radius-gross) var(--radius-gross); }
.pruefliste { list-style: none; margin: 0; padding: 0; }
.pruefliste li { display: flex; gap: 10px; padding: 6px 0; align-items: flex-start; font-size: .9375rem; }
.pruefliste svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.pruefliste .ok svg { color: var(--gut); } .pruefliste .nein svg { color: var(--schlecht); } .pruefliste .hinweis svg { color: var(--warn); }
.speicherstand { font-size: .8125rem; color: var(--text-3); }

/* ---------- Dialog, Meldungen ---------- */
dialog { border: 1px solid var(--linie); border-radius: var(--radius-gross); padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--flaeche); color: var(--text); box-shadow: 0 20px 60px rgb(0 0 0 / .25); }
dialog::backdrop { background: rgb(15 17 20 / .45); }
dialog form > header { padding: 18px 20px 0; }
dialog form > .inhalt { padding: 16px 20px; max-height: 70vh; overflow: auto; }
dialog .fehlerbox { position: sticky; top: 0; z-index: 2; }
.fehlerbox { white-space: pre-line; }
dialog form > footer { padding: 14px 20px; border-top: 1px solid var(--linie); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
dialog.breit { width: min(860px, calc(100vw - 32px)); }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.meldung { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: var(--radius); font-weight: 500; box-shadow: 0 8px 24px rgb(0 0 0 / .2); max-width: min(520px, calc(100vw - 32px)); animation: rein .2s ease-out; }
.meldung.fehler { background: var(--schlecht); color: #fff; }
@keyframes rein { from { opacity: 0; transform: translateY(8px); } }
.fehlerbox { background: var(--schlecht-weich); color: var(--text); border: 1px solid color-mix(in srgb, var(--schlecht) 35%, transparent); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; font-size: .9375rem; }

/* ---------- Anmeldung ---------- */
.eingang { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.eingang .karte { width: min(420px, 100%); padding: 28px; }
.eingang h1 { margin: 16px 0 6px; }
.eingang > div > p { color: var(--text-2); margin-bottom: 20px; }
.vertrauen { display: flex; gap: 8px; color: var(--text-3); font-size: .8125rem; margin-top: 16px; align-items: flex-start; }
.vertrauen svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

/* ---------- Rechnung auf dem Briefbogen (Maße in mm wie A4) ---------- */
.papier-huelle { overflow-x: auto; padding-bottom: 8px; }
.papier, .papier * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.papier { position: relative; background: #fff; color: #222; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 0 18mm 16mm 25mm;
  font: 400 10pt/1.45 var(--schrift); font-variant-numeric: tabular-nums; box-shadow: var(--schatten); border: 1px solid var(--linie); }
.papier .b-band { position: absolute; left: 0; top: 18.2mm; width: 143mm; height: 9.15mm; background: #5b4590; }
.papier .b-logo { position: absolute; left: 142mm; top: 14mm; width: 58mm; }
.papier .b-logo svg { width: 100%; height: auto; display: block; }
.papier .b-firma { position: absolute; left: 136mm; top: 33.5mm; width: 70mm; text-align: center; text-transform: uppercase; color: #333; font-size: 7.4pt; line-height: 1.35; }
.papier .b-firma .b-mb { font-size: 13.5pt; letter-spacing: .38em; font-weight: 500; line-height: 1.1; margin-right: -.38em; }
.papier .b-firma .b-inh { font-size: 8.6pt; letter-spacing: .02em; margin-bottom: 3.5mm; }
.papier .b-firma .b-zus { margin-bottom: 3mm; }
.papier .b-absender { position: absolute; left: 25mm; top: 50mm; width: 90mm; font-size: 6.4pt; text-transform: uppercase; letter-spacing: .02em; color: #333; }
.papier .b-empf { position: absolute; left: 25mm; top: 56mm; width: 90mm; font-size: 10.5pt; line-height: 1.4; }
.papier .b-falz { position: absolute; left: 6mm; width: 4mm; border-top: .3mm solid #888; }
.papier .b-inhalt { padding-top: 91mm; }
.papier .b-meta { display: flex; flex-wrap: wrap; gap: 2mm 6mm; font-size: 8.6pt; margin-bottom: 6mm; }
.papier .b-meta:has(+ .b-meta2) { margin-bottom: 2.5mm; }
.papier .b-meta span { display: block; color: #666; font-size: 7.4pt; text-transform: uppercase; letter-spacing: .06em; }
.papier .b-meta b { font-weight: 500; }
.papier h2 { font-size: 14pt; font-weight: 500; text-transform: uppercase; letter-spacing: .12em; margin: 0 0 1mm; color: #222; }
.papier .b-betreff { font-size: 10.5pt; margin-bottom: 5mm; }
.papier table { font-size: 9pt; margin: 2mm 0 3mm; border-collapse: collapse; }
.papier tr { break-inside: avoid; }
.papier th { background: none; color: #fff; background-color: #5b4590; padding: 1.6mm 2mm; font-size: 7.6pt; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; border: 0; }
.papier th.num { font-size: 7.6pt; }
.papier td { border-bottom: .2mm solid #d9d6df; padding: 1.4mm 2mm; color: #222; vertical-align: top; }
.papier .d-summen { margin: 0 0 0 auto; width: 78mm; display: grid; grid-template-columns: 1fr auto; gap: 1mm 0; font-size: 10pt; }
.papier .d-summen dd { padding-left: 4mm; }
.papier .d-summen dd { margin: 0; text-align: right; }
.papier .d-summen .g { font-weight: 600; border-top: .5mm solid #5b4590; padding-top: 1.5mm; font-size: 11pt; }
.papier .d-text { break-inside: avoid; margin-top: 5mm; font-size: 9.4pt; }
.papier .d-text p + p { margin-top: 2mm; }
.papier .d-hinweis { margin-top: 3mm; padding: 2mm 3mm; border-left: .8mm solid #5b4590; background: #f4f2f8; font-size: 8.6pt; }
.papier .d-abzug { width: 100%; margin-top: 5mm; }
.papier .d-abzug th { background-color: #3d3c3f; }
.papier .d-abzug tr.summe td { font-weight: 600; border-bottom: 0; }
.papier .d-storno { color: #b42318; font-weight: 500; margin-bottom: 4mm; }
.papier .d-gruss { margin-top: 6mm; }
.papier .d-fuss { break-inside: avoid; margin-top: 8mm; padding-top: 2.5mm; border-top: .3mm solid #5b4590; font-size: 7.4pt; color: #444; display: flex; flex-wrap: wrap; gap: 1mm 6mm; }
.papier td.num { color: #222; }

.papier .d-einl { margin-bottom: 4mm; font-size: 9.6pt; }
/* ---------- Textbausteine (ab 1.4) ---------- */
.feld-kopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.feld-kopf label { margin: 0; }
button.klein, .btn.klein { min-height: 30px; padding: 0 8px; font-size: .8125rem; gap: 5px; }
button.klein svg { width: 15px; height: 15px; }
textarea[data-wachsen] { overflow: hidden; }
.bausteine { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.baustein { display: block; width: 100%; text-align: left; height: auto; min-height: 0; padding: 9px 12px; border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche); white-space: normal; }
.baustein:hover, .baustein:focus-visible { border-color: var(--akzent); background: var(--akzent-weich); }
.baustein strong { display: block; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.baustein span:not(.leise) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; color: var(--text-2); font-size: .875rem; font-weight: 400; white-space: pre-line; overflow: hidden; }
.baustein .leise { font-weight: 400; }
.bs-gruppe { font-size: .875rem; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; }
#bs-liste { max-height: 56vh; overflow: auto; }
.bs-pos { margin-top: 2px; color: var(--text-3); min-height: 26px; }
.bs-pos:hover { color: var(--text); }

#druck { display: none; }

/* ---------- Ab 1.4: Kundensuche, Postanschrift, mehrere E-Mail-Adressen ---------- */
.schnellsuche { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 8px; padding: 8px 10px; min-height: 40px; border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche-2); color: var(--text-2); font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.schnellsuche:hover { border-color: var(--linie-stark); color: var(--text); }
.schnellsuche svg { width: 17px; height: 17px; flex: none; }
.schnellsuche span { flex: 1; }
kbd { font: 500 .72rem var(--schrift); color: var(--text-3); border: 1px solid var(--linie); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; background: var(--flaeche); white-space: nowrap; }
.schnell-liste { border: 1px solid var(--linie); border-radius: var(--radius); }
.schnell-liste .liste li { padding: 10px 14px; flex-wrap: wrap; }
.schnell-liste .knoepfe { flex-wrap: nowrap; }
.feld-titel { display: block; font-weight: 500; font-size: .875rem; color: var(--text-2); margin-bottom: 6px; }
fieldset.gruppe { border: 1px solid var(--linie); border-radius: var(--radius); padding: 12px 14px 4px; margin: 4px 0 14px; }
fieldset.gruppe > legend { font-weight: 600; padding: 0 6px; margin-left: -6px; }
fieldset.gruppe > button { margin-bottom: 12px; }
.mail-liste { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.mail-zeile { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto 40px; gap: 8px; align-items: center; }
.mail-zeile .m-standard { font-size: .75rem; font-weight: 600; color: var(--akzent); background: var(--akzent-weich); border-radius: 99px; padding: 3px 9px; display: none; }
.mail-zeile:first-child .m-standard { display: inline-block; }
.mail-zeile:first-child .m-hoch { display: none; }
.mail-zeile .m-hoch { font-size: .8rem; min-height: 0; padding: 4px 6px; color: var(--text-2); }
.versand { display: flex; align-items: center; gap: 8px; color: var(--text-2); margin: -6px 0 14px; font-size: .9rem; }
.versand svg { width: 17px; height: 17px; flex: none; color: var(--akzent); }
.versand b { color: var(--text); font-weight: 600; }
@media (max-width: 860px) {
  .schnellsuche { width: auto; margin: 0 4px 0 0; flex: none; } .schnellsuche span, .schnellsuche kbd { display: none; }
  .mail-zeile { grid-template-columns: 1fr 40px; } .mail-zeile .m-bez { grid-column: 1; } .mail-zeile .m-standard, .mail-zeile .m-hoch { grid-column: 1; justify-self: start; }
  .mail-zeile .m-weg { grid-column: 2; grid-row: 1; }
}
@media print {
  @page { size: A4; margin: 12mm 0 14mm 0; }
  @page :first { margin-top: 0; }
  html, body { background: #fff !important; }
  #app, #toast, dialog, .skip { display: none !important; }
  #druck { display: block; }
  #druck .papier-huelle { overflow: visible; padding: 0; }
  #druck .papier { box-shadow: none; border: 0; min-height: 0; margin: 0; padding-bottom: 0; }
  #druck .d-hinweis { background: none; }
  #druck tr { break-inside: avoid; }
  #druck .vd { border: 0; border-radius: 0; padding: 0 16mm; max-width: none; color: #222; background: #fff; font-size: 10pt; }
  #druck .vd h2 { break-after: avoid; }
  #druck .vd th { background: #f1eff5; color: #333; }
}

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .editor { grid-template-columns: 1fr; } .summe-box { position: static; } }
@media (max-width: 860px) {
  .rahmen { grid-template-columns: minmax(0, 1fr); }
  .seite { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--linie); overflow-x: auto; gap: 2px; }
  .marke { padding: 0 8px 0 0; } .marke > span:last-child { display: none; }
  .nav { display: flex; gap: 2px; }
  .nav a { padding: 8px 10px; white-space: nowrap; }
  .seite { scrollbar-width: none; } .seite::-webkit-scrollbar { display: none; }
  .nav .zahl { display: none; }
  .seite-fuss { display: none; }
  main { padding: 20px 16px 48px; }
  .raster-2 { grid-template-columns: 1fr; }
  .reihe-2 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .kpi { padding: 14px 16px; } .kpi strong { font-size: 1.3rem; }
  h1 { font-size: 1.35rem; }
  .kopf > .knoepfe { width: 100%; } .kopf > .knoepfe > .btn { flex: 1 1 0; padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* 1.4: Artikelbeschreibung */
.pos-lang { display: block; width: 100%; margin-top: 6px; font-size: .85rem; line-height: 1.4; resize: vertical; min-height: 2.6em; }
.pos-lang-auf { margin-top: 4px; padding: 2px 6px; font-size: .78rem; }
.art-lang { white-space: pre-line; max-width: 60ch; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.papier .d-lang { white-space: pre-line; font-size: 8.6pt; color: #444; margin-top: 1mm; line-height: 1.35; }

/* ---------- Anlagen und Scannen (ab 1.5) ---------- */
.anlagen { margin-bottom: 16px; }
.editor .anlagen { margin-bottom: 0; }
.anlagen.ziehen { outline: 2px dashed var(--akzent); outline-offset: -4px; background: var(--flaeche-2); }
.anlagen .liste li { flex-wrap: wrap; padding: 10px 18px; }
.anlagen .knoepfe { display: flex; gap: 4px; align-items: center; }
.anl-zeile { display: flex; gap: 12px; align-items: center; min-width: 0; flex: 1; }
.anl-zeile .wer strong { overflow-wrap: anywhere; }
.anl-ikon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: var(--radius); background: var(--flaeche-2); color: var(--text-2); }
.anl-ikon svg { width: 20px; height: 20px; }
.anl-hilfe { margin: 0 0 0 auto; align-self: center; }
.anl-zahl { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; font-size: .75rem; color: var(--text-3); vertical-align: middle; }
.anl-zahl svg { width: 13px; height: 13px; }
.anl-bild { display: block; max-width: 100%; height: auto; margin: 0 auto; border: 1px solid var(--linie); }
.scan-seiten { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin: 4px 0 10px; }
.scan-seiten:empty { display: none; }
.scan-seiten figure { margin: 0; border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche-2); overflow: hidden; }
.scan-seiten img { display: block; width: 100%; aspect-ratio: 210 / 297; object-fit: contain; background: #fff; }
.scan-seiten figcaption { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 2px 10px; font-size: .8125rem; color: var(--text-2); }
@media (max-width: 640px) { .anl-hilfe { margin: 0; flex-basis: 100%; } }
.scan-panel:empty { display: none; }
.scan-panel { margin-bottom: 12px; }
.scan-geraet { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche-2); margin-bottom: 12px; }
.scan-geraet > svg { width: 22px; height: 22px; flex: none; color: var(--akzent); }
.scan-geraet > div { flex: 1; min-width: 0; }
.scan-geraet strong { display: block; }
.scan-geraet span { color: var(--text-2); font-size: .875rem; overflow-wrap: anywhere; }
.scan-adresse { display: flex; gap: 8px; }
.scan-adresse input { flex: 1; }
.scan-treffer { border: 1px solid var(--linie); border-radius: var(--radius); margin-top: 10px; max-height: 280px; overflow: auto; }
.scan-treffer li { padding: 8px 12px; }
[hidden] { display: none !important; }
.scan-start { width: 100%; margin-top: 4px; }
.anl-wahl { list-style: none; margin: 4px 0 0; padding: 8px 12px; border: 1px solid var(--linie); border-radius: var(--radius); display: grid; gap: 6px; }
