/* Rechnungsapp: schlicht, eine Akzentfarbe. Die Schrift liegt lokal (keine Abrufe bei Dritten, DSGVO). */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/IBMPlexSans-Medium.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/IBMPlexSans-SemiBold.woff2") format("woff2"); }

:root {
  --bg: #F3F4F6;
  --flaeche: #FFFFFF;
  --text: #16181D;
  --leise: #5A606B;
  --linie: #E1E3E8;
  --rand: #C9CCD3;
  --akzent: #0B6170;   /* einzige Akzentfarbe: Links, aktive Navigation, Fokus */
  --dunkel: #16181D;   /* Hauptaktionen */
  --kopf: #FAFAFB;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 0; font-weight: 600; }
p { margin: 0 0 12px; }
small, .leise { color: var(--leise); }
small { font-size: 13px; }
.rechts { text-align: right; }
.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.fett { font-weight: 600; }
[hidden] { display: none !important; }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Grundaufbau: Menü links, Inhalt rechts. Auf schmalen Bildschirmen rutscht das Menü nach oben. */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.seitenleiste { flex: 1 0 220px; background: var(--flaeche); border-right: 1px solid var(--linie); padding: 24px 16px; display: flex; flex-direction: column; gap: 20px; }
.marke { display: block; padding: 0 10px; color: var(--text); font-weight: 600; font-size: 17px; }
.marke:hover { text-decoration: none; }
.marke small { display: block; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { color: var(--text); padding: 12px 10px; line-height: 20px; border-radius: 6px; }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.aktiv { color: var(--akzent); font-weight: 600; background: var(--bg); }
.nav .trenner { height: 1px; background: var(--linie); margin: 8px 0; }
.konto { margin-top: auto; padding: 0 10px; font-size: 14px; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.konto .name { color: var(--text); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inhalt { flex: 999 1 560px; min-width: 0; padding: 32px 40px 56px; }
.inhalt > * { max-width: 1040px; }
.kopfzeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.kopfzeile .aktionen { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.untertitel { color: var(--leise); margin: -12px 0 20px; }

/* Karten */
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: 20px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 14px; }
.karte.eng { padding: 0; overflow: hidden; display: block; }
.karte > p { margin: 0; }
.karte > * { min-width: 0; max-width: 100%; }
.reihe { display: flex; flex-wrap: wrap; gap: 14px 16px; align-items: flex-end; }
.reihe > .feld { flex: 1 1 150px; }
.reihe > .feld.lang { flex: 2 1 280px; }
.reihe > .feld.kurz { flex: 0 1 150px; }
.raster { display: grid; gap: 14px 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.s2 { grid-column: span 2; } .s3 { grid-column: span 3; } .s4 { grid-column: span 4; }
.s6 { grid-column: span 6; } .s8 { grid-column: span 8; } .s12 { grid-column: span 12; }
.kennzahlen { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.kennzahl { flex: 1 1 200px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: 16px 18px; }
.kennzahl .wert { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kennzahl .name { color: var(--leise); font-size: 13px; }

/* Formulare */
.feld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.feld label { font-size: 13px; color: var(--leise); }
.pflicht { color: var(--text); }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=file], select, textarea {
  width: 100%; min-height: 44px; padding: 0 12px; background: #fff; border: 1px solid var(--rand); border-radius: 6px;
}
textarea { padding: 10px 12px; resize: vertical; line-height: 1.45; }
input[type=file] { padding: 9px 12px; }
input:disabled { background: var(--kopf); color: var(--leise); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }
.feld.haken label, label.haken { display: flex; gap: 10px; align-items: center; min-height: 44px; color: var(--text); font-size: 15px; }
input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--akzent); flex: none; }
.formfuss { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* Knöpfe: Hauptaktion dunkel gefüllt, alles andere zurückhaltend */
.knopf { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 6px; border: 1px solid var(--dunkel); background: var(--dunkel); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.knopf:hover { background: #000; text-decoration: none; }
.knopf.zweit { background: #fff; color: var(--text); border-color: var(--rand); font-weight: 500; }
.knopf.zweit:hover { background: var(--bg); }
.knopf:disabled { opacity: .45; cursor: not-allowed; }
.knopf.klein { min-height: 36px; padding: 0 12px; font-size: 14px; }
.textknopf { background: none; border: 0; padding: 0; color: var(--akzent); cursor: pointer; }
.textknopf:hover { text-decoration: underline; }
.symbolknopf { width: 44px; height: 44px; border: 0; background: none; color: var(--leise); padding: 0; cursor: pointer; border-radius: 6px; }
.symbolknopf:hover { background: var(--bg); color: var(--text); }

/* Tabellen: Status steht als normaler Text in der Farbe der übrigen Spalten */
.tabellenrahmen { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { padding: 12px 16px; font-size: 12px; font-weight: 600; color: var(--leise); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; background: var(--kopf); }
tbody tr:last-child td { border-bottom: 0; }
td.zahl, th.zahl { text-align: right; }
.status { white-space: nowrap; }
.leer { padding: 36px 20px; text-align: center; color: var(--leise); }
.beschreibung { color: var(--leise); font-size: 13px; white-space: pre-line; }

/* Filterleiste */
.filter { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.reiter { display: flex; gap: 2px; flex-wrap: wrap; }
.reiter a { padding: 11px 12px; line-height: 20px; border-radius: 6px; color: var(--text); border: 1px solid transparent; }
.reiter a.aktiv { background: var(--flaeche); border-color: var(--linie); color: var(--akzent); font-weight: 600; }
.filter form { display: flex; gap: 8px; flex: 1 1 240px; max-width: 340px; }
.filter form input { flex: 1 1 auto; min-width: 0; }
.blaettern { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; color: var(--leise); font-size: 13px; margin-bottom: 20px; }

/* Meldungen */
.meldung { border: 1px solid var(--linie); border-left: 3px solid var(--akzent); background: var(--flaeche); border-radius: 6px; padding: 12px 14px; margin-bottom: 20px; }
.meldung.fehler { border-left-color: var(--dunkel); }
.meldung ul { margin: 0; padding-left: 18px; }

/* Rechnungsformular */
.einschub { border: 1px solid var(--rand); border-radius: 6px; padding: 16px; background: var(--kopf); display: flex; flex-direction: column; gap: 14px; }
.positionsrahmen { overflow-x: auto; position: relative; border: 1px solid var(--linie); border-radius: 6px; }
.positionen { min-width: 900px; }
.positionen th { padding: 12px 8px; }
.positionen td { padding: 10px 8px; }
.positionen th:first-child, .positionen td:first-child { padding-left: 14px; }
.positionen input, .positionen select { padding: 0 10px; }
.positionen textarea { margin-top: 6px; min-height: 44px; font-size: 14px; color: var(--leise); }
.positionen .spalte_menge { width: 84px; } .positionen .spalte_einheit { width: 128px; } .positionen .spalte_preis { width: 112px; }
.positionen .spalte_rabatt { width: 84px; } .positionen .spalte_satz { width: 92px; } .positionen .spalte_summe { width: 110px; } .positionen .spalte_weg { width: 52px; }
.positionen .preis, .positionen .rabatt { text-align: right; }
.positionen .zeilensumme { padding-top: 20px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.positionen .gedimmt { color: var(--leise); }
.unter_positionen { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; justify-content: space-between; }
.summenblock { flex: 0 1 380px; display: flex; flex-direction: column; gap: 8px; font-variant-numeric: tabular-nums; }
.summenblock > div { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.summenblock .rabattzeile { gap: 8px; }
.summenblock .rabattzeile label { flex: 1 1 auto; }
.summenblock .rabattzeile input { width: 76px; text-align: right; padding: 0 10px; }
.summenblock .rabattzeile select { width: 66px; padding: 0 8px; }
.summenblock .rabattzeile span { width: 96px; text-align: right; white-space: nowrap; }
.summenblock .gesamt { border-top: 2px solid var(--text); padding-top: 8px; font-weight: 600; font-size: 17px; }
#summe_steuer { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
#summe_steuer > div { display: flex; justify-content: space-between; gap: 16px; }

/* Vorschau und Rechnungsansicht */
.vorschau { width: 100%; height: 78vh; min-height: 520px; border: 1px solid var(--linie); border-radius: 8px; background: #fff; display: block; margin-bottom: 12px; }
dl.daten { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
dl.daten dt { color: var(--leise); }
dl.daten dd { margin: 0; }
.zwei { display: flex; flex-wrap: wrap; gap: 20px; }
.zwei > * { flex: 1 1 280px; min-width: 0; }
.summen_ansicht { margin-left: auto; width: min(100%, 360px); display: flex; flex-direction: column; gap: 6px; font-variant-numeric: tabular-nums; padding: 16px; }
.summen_ansicht > div { display: flex; justify-content: space-between; gap: 16px; }
.summen_ansicht .gesamt { border-top: 2px solid var(--text); padding-top: 8px; font-weight: 600; font-size: 17px; }
.logofeld { width: 227px; height: 83px; border: 1.5px dashed #8A909C; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: var(--leise); font-size: 13px; overflow: hidden; background: #fff; flex: none; }
.logofeld img { max-width: 100%; max-height: 100%; }

.katalogfeld { max-width: 420px; }
.reihe.mittig { align-items: center; }
.logoseite { flex: 1 1 280px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.logoseite input[type=file] { flex: 1 1 220px; width: auto; min-width: 0; }

/* Anmeldung, Einrichtung, Fehlerseiten */
.schmal { max-width: 432px; margin: 0 auto; padding: 96px 16px 48px; display: flex; flex-direction: column; gap: 20px; }
.schmal.breit { max-width: 672px; padding-top: 48px; }
.schmal .karte { margin-bottom: 0; gap: 16px; }
.schmal .meldung { margin-bottom: 0; }
.pruefliste { list-style: none; padding: 0; margin: 0; }
.pruefliste li { padding: 3px 0; }

/* Tablet und Handy */
@media (max-width: 900px) {
  .seitenleiste { flex-basis: 100%; min-width: 0; max-width: 100%; border-right: 0; border-bottom: 1px solid var(--linie); padding: 12px; gap: 8px; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .marke { padding: 0 6px; }
  .marke small { display: none; }
  .nav { flex-direction: row; overflow-x: auto; order: 3; width: 100%; min-width: 0; }
  .nav a { white-space: nowrap; }
  .nav .trenner { width: 1px; height: auto; margin: 6px 6px; flex: none; }
  .konto { margin: 0 0 0 auto; flex-direction: row; gap: 14px; align-items: center; }
  .inhalt { padding: 20px 14px 48px; }
  .s2, .s3, .s4 { grid-column: span 6; }
  .s6, .s8 { grid-column: span 12; }
  .filter form { max-width: none; }
  .vorschau { height: 70vh; }
}
/* Positionen auf schmalen Bildschirmen: jede Position als Block statt als breite Tabelle */
@media (max-width: 760px) {
  .positionen { min-width: 0; display: block; }
  .positionen thead { display: none; }
  .positionen tbody { display: block; }
  .positionen tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; padding: 14px 12px; border-bottom: 1px solid var(--linie); }
  .positionen tbody tr:last-child { border-bottom: 0; }
  .positionen td, .positionen td:first-child { display: block; padding: 0; border: 0; }
  .positionen td:first-child { grid-column: 1 / -1; }
  .positionen td[data-titel]::before { content: attr(data-titel); display: block; font-size: 12px; color: var(--leise); margin-bottom: 2px; }
  .positionen td.zeilensumme { grid-column: 1 / 3; text-align: left; padding-top: 0; font-weight: 600; align-self: center; }
  .positionen td.zelle_weg { grid-column: 3; justify-self: end; align-self: end; }
  .positionen .preis, .positionen .rabatt { text-align: left; }
}
@media (max-width: 520px) {
  .s2, .s3, .s4 { grid-column: span 12; }
  .schmal { padding-top: 40px; }
}
@media print { .seitenleiste, .aktionen { display: none; } }
