/* ==========================================================================
   Leseansicht eingelesener Rechnungen, Stapelliste, Fehler- und Ladeanzeige, „Zuletzt geöffnet“.
   Gilt in der App und im Druckfenster (print.html → PDF der Leseansicht) — deshalb getrennt vom
   App-Rahmen (styles.css). Der Rahmen lädt diese Datei zuerst; seine Farbwerte gewinnen.
   ========================================================================== */

:root {
  --cream: #F4F0E8;
  --ink: #16150F;
  --orange: #E85A1A;
  --orange-tief: #B03D0C; /* Orange als Schrift (WCAG AA); das Druckfenster lädt styles.css nicht */
  --paper: #FFFFFF;
  --muted: #6B665C;
  --line: #D9D3C7;
  --font-kopf: 'Archivo Black', 'Helvetica Neue', Arial, sans-serif;
}

.fehlt { color: var(--muted); }
.code { color: var(--muted); font-size: 0.86em; }
.klein { font-size: 12px; color: var(--muted); }
.zahl { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fett { font-weight: 600; }

/* ---------- Rechnungsblatt (Bildschirm) ---------- */

.blatt { background: var(--paper); border: 1px solid var(--line); max-width: 920px; margin: 0 auto; padding: 40px 44px 32px; }
.rechnung h1, .rechnung h2, .rechnung h3 { font-family: var(--font-kopf); font-weight: 400; margin: 0; line-height: 1.15; letter-spacing: -0.01em; }

.rechnung .warnung { border: 2px solid var(--orange); border-left-width: 10px; padding: 12px 16px; margin-bottom: 28px; }
.warnung-titel { margin: 0 0 6px; font-weight: 600; }
.warnung ul { margin: 0 0 0 18px; padding: 0; }

.rechnung .kopf { display: flex; justify-content: space-between; gap: 32px; align-items: flex-start; margin-bottom: 32px; }
.typ { font-size: 34px; }
.nummer { font-size: 18px; margin: 6px 0 0; }
.dokumentname { margin: 4px 0 0; color: var(--muted); }
dl.daten { display: grid; grid-template-columns: auto auto; gap: 3px 18px; margin: 4px 0 0; font-size: 14px; }
dl.daten dt { color: var(--muted); }
dl.daten dd { margin: 0; text-align: right; font-weight: 600; white-space: nowrap; }

.parteien { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 40px; margin-bottom: 8px; }
.parteien.weitere { margin-top: 26px; }
.partei h3 { font-size: 13px; padding-bottom: 6px; border-bottom: 2px solid var(--ink); margin-bottom: 10px; }
.partei-name { font-weight: 700; font-size: 15px; margin: 0 0 2px; }
.handelsname { margin: 0 0 2px; }
.adresse { margin: 0 0 8px; }
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 0; font-size: 13px; }
dl.details dt { color: var(--muted); white-space: nowrap; }
dl.details dd { margin: 0; overflow-wrap: anywhere; }
dl.details.spalten { grid-template-columns: max-content 1fr max-content 1fr; column-gap: 14px; }
@media (max-width: 760px) { dl.details.spalten { grid-template-columns: max-content 1fr; } .parteien { grid-template-columns: 1fr; } }

.abschnitt { margin-top: 30px; }
.abschnitt h3, .steuern h3 { font-size: 13px; margin-bottom: 10px; }
.hinweis-leer { margin: 0; color: var(--muted); }

table.tabelle { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tabelle th { text-align: left; font-weight: 600; padding: 6px 8px; border-bottom: 2px solid var(--ink); vertical-align: bottom; }
table.tabelle th.zahl { text-align: right; }
table.tabelle td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tabelle th:first-child, table.tabelle td:first-child { padding-left: 0; }
table.tabelle th:last-child, table.tabelle td:last-child { padding-right: 0; }
table.tabelle.schmal { width: auto; min-width: 60%; }

.positionen-tabelle .pos { width: 44px; color: var(--muted); }
.positionen-tabelle .einheit { color: var(--muted); }
.pos-name { font-weight: 600; }
.pos-beschreibung { margin-top: 2px; }
.pos-kennungen { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pos-notiz { font-size: 12px; margin-top: 2px; }
.unterposition td.bez { padding-left: 28px; }
.pos-abschlag td { color: var(--muted); padding-top: 2px; }
.pos-abschlag td.bez { padding-left: 14px; }

.summen-und-steuern { display: flex; justify-content: space-between; gap: 40px; align-items: flex-start; margin-top: 30px; flex-wrap: wrap; }
.steuern { flex: 1 1 340px; }
.befreiung td { color: var(--muted); font-size: 12px; padding-top: 0; }
.steuern td:first-child, .steuern th:first-child { white-space: nowrap; }
.rechnung .summen { flex: 0 0 340px; margin-left: auto; }
.summe { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.summe.netto, .summe.brutto { font-weight: 600; }
.summe.faellig { border-top: 3px solid var(--ink); border-bottom: 0; margin-top: 6px; padding-top: 10px; font-family: var(--font-kopf); font-size: 20px; }

.zahlung-bloecke { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px 40px; }
.bedingungen { margin: 6px 0 0; grid-column: 1 / -1; }

.notiz { margin-bottom: 10px; }
.notiz-betreff { font-weight: 600; }
.anhaenge ul { margin: 0; padding-left: 18px; }

.technik { margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.technik dl.details { font-size: 12px; }
.technik .hinweise { margin: 10px 0 0 18px; padding: 0; }

/* ---------- Stapel ---------- */

.stapel-tabelle .sortknopf { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: inherit; cursor: pointer; width: 100%; text-align: inherit; }
.stapel-tabelle .sortpfeil { display: inline-block; min-width: 14px; color: var(--orange-tief); margin-left: 4px; font-size: 10px; }
.stapel-tabelle tbody tr.fehler { cursor: default; color: var(--muted); }
.stapel-tabelle { table-layout: fixed; } /* feste Spalten: die Tabelle passt in die Karte, lange Namen kürzen sich */
.stapel-tabelle col.c-absender { width: 20%; }
.stapel-tabelle col.c-nr { width: 128px; }
.stapel-tabelle col.c-datum { width: 96px; }
.stapel-tabelle col.c-betrag { width: 100px; }
.stapel-tabelle col.c-status { width: 118px; }
.stapel-tabelle td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stapel-tabelle td.status { white-space: normal; }
.status-fehler { color: var(--orange-tief); font-weight: 600; }
.status-warnung { color: var(--orange-tief); }
.stapel-lauf { color: var(--muted); margin: 12px 0 0; font-size: 13px; }
.stapel-leer { background: var(--paper); border: 1px solid var(--karte-rand); border-radius: 12px; box-shadow: inset 6px 0 0 var(--orange); padding: 14px 18px 14px 22px; margin: 0 0 18px; max-width: 60em; font-size: 13px; }
.stapel-pfad { color: var(--muted); font-size: 12px; word-break: break-all; margin-top: 2px; }

/* ---------- Fehler ---------- */

.fehlerfeld { margin-bottom: 20px; }
.fehler { background: var(--paper); border: 1px solid var(--karte-rand); border-radius: 14px; box-shadow: inset 6px 0 0 var(--orange); padding: 18px 22px 18px 26px; max-width: 760px; }
.fehler h2 { font-size: 18px; margin-bottom: 4px; font-family: var(--font-kopf); font-weight: 400; }
.fehler-datei { margin: 0 0 10px; color: var(--muted); word-break: break-all; }
.fehler p { margin: 0 0 8px; max-width: 60em; }
.fehler ul { margin: 6px 0 8px 18px; padding: 0; }
.fehler-code { color: var(--muted); font-size: 12px; margin: 0; }

/* ---------- Laden ---------- */

.lade { max-width: 760px; margin: 40px auto; padding: 18px 24px; color: var(--muted); display: flex; gap: 14px; align-items: center; background: var(--paper); border: 1px solid var(--karte-rand); border-radius: 14px; }
.lade-balken { display: inline-block; width: 28px; height: 28px; border: 3px solid var(--ink); border-right-color: var(--orange); border-radius: 50%; animation: dreh 0.9s linear infinite; }
@keyframes dreh { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .lade-balken { animation: none; } }

/* ---------- Zuletzt geöffnet ---------- */

.zuletzt ul { list-style: none; margin: 0; padding: 0; }
.zuletzt-eintrag { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.zuletzt-eintrag:last-child { border-bottom: 0; }
.zuletzt-oeffnen { flex: 1; display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'name art' 'pfad art'; gap: 0 12px; text-align: left; background: none; border: 0; padding: 8px 14px; color: var(--ink); cursor: pointer; min-width: 0; font: inherit; }
.zuletzt-oeffnen:hover { background: var(--cream); }
.zuletzt-name { grid-area: name; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.zuletzt-art { grid-area: art; align-self: center; color: var(--muted); font-size: 12px; }
.zuletzt-pfad { grid-area: pfad; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zuletzt-entfernen { background: none; border: 0; color: var(--muted); font-size: 18px; padding: 0 14px; cursor: pointer; }
.zuletzt-entfernen:hover { color: var(--orange-tief); }
