/* Fakturdilettant: Anpassungen auf der gemeinsamen Basis (basis.css, Quelle ~/dev/Apps/horch-basis).
   Farbrollen stehen in farben.css. Hier nur Projektspezifisches. */
@import url("basis.css");
@import url("technik.css");

/* Text-Links in der Farbe des Themes (hell/dunkel, Standard/Technik), auch besuchte. :where() hält die Spezifität niedrig:
   Knöpfe, Reiter, Menü (haben eine Klasse) und Meldungen (.meldung a) behalten ihre eigene Farbe. */
a:where(:not([class])), a:where(:not([class])):visited { color: var(--md-primary-text); }
a:where(:not([class])):hover { text-decoration-thickness: 2px; }

main > .seite { max-width: 1100px; margin: 0 auto; }
.sch-kopf .name { font-size: 15px; }
.sch-kopf .zusatz { font-size: 12px; line-height: 16px; }
.sch-kopf img { border-radius: 10px; }

/* Kacheln auf der Übersicht */
.kacheln { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 16px; }
.kacheln .card { margin-top: 0; }

/* Meldungen: Farbe nie allein, immer mit Stichwort davor */
.meldung { margin: 16px 0 0; padding: 12px 16px; border-radius: var(--shape-sm); background: var(--md-surface-container-high); color: var(--md-on-surface); border-left: 6px solid var(--md-outline); }
.meldung::before { font-weight: 700; margin-right: .4em; }
.meldung a { color: inherit; font-weight: 700; }
.meldung-ok     { border-left-color: var(--ok); }
.meldung-ok::before     { content: "Erledigt –"; }
.meldung-warn   { background: var(--warn-bg); color: var(--warn); border-left-color: var(--warn); }
.meldung-warn::before   { content: "Hinweis –"; }
.meldung-error  { background: var(--md-error-container); color: var(--md-on-error-container); border-left-color: var(--md-error); }
.meldung-error::before  { content: "Fehler –"; }

/* Formularformen und Listen */
.liste { margin: 8px 0; padding-left: 20px; }
.liste li { margin: 4px 0; }

/* Tabellen: auf dem Handy scrollbar, später als Karten */
.tabellenrahmen { overflow-x: auto; }
table.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th, .tabelle td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--md-outline-variant); }
.tabelle th { font: 500 14px/20px var(--font); color: var(--md-on-surface-variant); }
.tabelle td.zahl, .tabelle th.zahl { text-align: right; font-variant-numeric: tabular-nums; }

/* Druck: Bedienelemente aus, Inhalt fließt über mehrere Seiten */
@media print {
  html, body { height: auto; overflow: visible; }
  #app { display: block; height: auto; }
  #kopf, #schublade, #scrim, #snackbar { display: none !important; }
  main { overflow: visible; padding: 0; }
  body { background: #fff; color: #000; }
}

/* Einstellungen: Bereichs-Reiter, Textfelder, Haken, Fehlertexte */
a.chip { text-decoration: none; }
.feld textarea { width: 100%; padding: 12px 16px; font: 400 16px/24px var(--font); color: var(--md-on-surface); background: none; border: 1px solid var(--md-outline); border-radius: var(--shape-xs); resize: vertical; }
.feld textarea:focus { outline: 2px solid var(--md-primary); border-color: var(--md-primary); }
.feld [aria-invalid="true"] { border-color: var(--md-error); border-width: 2px; }
.haken { display: flex; align-items: center; gap: 12px; min-height: 48px; margin-top: 12px; cursor: pointer; }
.haken input { width: 24px; height: 24px; accent-color: var(--md-primary); flex: none; }
.fehlertext { margin: 4px 16px 0; font-size: 13px; line-height: 18px; color: var(--md-error); font-weight: 500; }
.kleintext { margin: 6px 16px 0; font-size: 13px; line-height: 18px; }
form.card + .hint, .hint code { overflow-wrap: anywhere; }

/* Listen, Suche, Marken */
.suche { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 16px; }
.suche .feld { flex: 1 1 260px; margin-top: 12px; }
.suche .haken { margin-top: 12px; }
.suche .btn { margin-top: 12px; }
.seiten { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.marke { display: inline-block; padding: 0 8px; border-radius: var(--shape-sm); font: 500 12px/20px var(--font); background: var(--md-surface-container-high); color: var(--md-on-surface-variant); border: 1px solid var(--md-outline); }
.marke-new   { border-color: var(--ok); color: var(--ok); }
.marke-error { border-color: var(--md-error); color: var(--md-error); }
.nebenform { margin-top: 24px; }
.nebenform.versandform .btn { margin: 12px 0 0 16px; }
#zahlung > h2:not(:first-child) { margin-top: 28px; }
.tabelle a { color: var(--md-primary-text); }
input[type="search"], input[type="file"] { max-width: 100%; }
.feld input[type="file"] { padding: 14px 16px; min-height: 56px; }

a.btn { text-decoration: none; }

/* Rechnungen: Positionen, Summen */
.pos { border: 1px solid var(--md-outline-variant); border-radius: var(--shape-md); padding: 12px 16px 16px; margin-top: 16px; background: var(--md-surface-container); }
.pos-kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.pos-tasten { display: flex; flex-wrap: wrap; gap: 4px; }
.pos-summe { display: flex; flex-direction: column; justify-content: flex-end; flex: 1 1 140px; min-height: 48px; text-align: right; }
.pos .feld > span { background: var(--md-surface-container); }
.pos-ek[hidden] { display: none; }
.feld-rein { flex: 1 1 120px; padding-top: 20px; }
.kleintext0 { margin: 0; font-size: 13px; line-height: 18px; }
.summen .sz { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; font-variant-numeric: tabular-nums; }
.summen .gesamt { font-weight: 700; font-size: 18px; border-top: 1px solid var(--md-outline); margin-top: 8px; padding-top: 10px; }
.textblock { white-space: pre-line; }
.inline { display: inline; }
details.loeschen { margin-top: 24px; }
details.loeschen summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; color: var(--md-on-surface-variant); }
.marke-draft { border-style: dashed; }
.marke-paid { border-color: var(--ok); color: var(--ok); }
.marke-cancelled { text-decoration: line-through; }
.marke-accepted { border-color: var(--ok); color: var(--ok); }
.marke-declined { border-color: var(--md-error); color: var(--md-error); }

.kundezeile { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 12px; }
.kundezeile .feld { flex: 1 1 260px; }
.kundezeile .btn { margin-top: 20px; min-height: 48px; flex: 0 0 auto; }
#kundeDialog .inhalt { padding: 24px 16px; }

.logo-vorschau { max-width: 240px; max-height: 120px; background: #fff; padding: 8px; border-radius: var(--shape-sm); }

@media print { .aktionen, details.loeschen, .meldung { display: none !important; } .card { background: none; border: 1px solid #999; } }

/* Werkzeugleiste: Symbole mit kurzen Beschriftungen */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.leiste { align-items: center; gap: 8px; }
.leiste .btn { padding: 0 12px; gap: 6px; }
.btn .icon { width: 20px; height: 20px; }
.btn.ico { padding: 0; min-width: 48px; }
.leiste .btn.ico { padding: 0; }
.leiste .rechts { margin-left: auto; }
@media (max-width: 599px) { .leiste .rechts { margin-left: 0; } }

.gross { font: 500 28px/36px var(--font); margin: 0; font-variant-numeric: tabular-nums; }
.zahlungsform { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kurz-tabelle td, .kurz-tabelle th { padding: 6px 8px; }
.saldo { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.saldo.offen { font-weight: 700; border-top: 1px solid var(--md-outline); margin-top: 6px; padding-top: 8px; }

/* Schmalere Schaltflächen */
.btn { padding: 0 16px; }
.btn.text { padding: 0 8px; }
.btn.ico, .leiste .btn.ico { padding: 0; }

/* Reiter (Tabs) statt Knopfleiste: Unterstrich am aktiven Reiter, auf schmalen Schirmen seitlich wischbar */
.tabs { display: flex; flex-wrap: nowrap; gap: 0; margin-top: 12px; overflow-x: auto; border-bottom: 1px solid var(--md-outline-variant); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs .chip { flex: none; min-height: 44px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background-color: transparent; color: var(--md-on-surface-variant); white-space: nowrap; text-decoration: none; }
.tabs .chip[aria-current="page"] { color: var(--md-primary-text); border-bottom-color: var(--md-primary); font-weight: 700; background-color: transparent; }
.tabs .chip:focus-visible { outline-offset: -3px; }

/* Ansicht: Schriftgröße pro Gerät (Stufen aus Einstellungen, Ansicht), auf dem Handy zusätzlich 80 % */
:root { --skala: 1; --mobil: 1; }
:root[data-skala="80"]  { --skala: .8; }
:root[data-skala="90"]  { --skala: .9; }
:root[data-skala="110"] { --skala: 1.1; }
:root[data-skala="120"] { --skala: 1.2; }
:root[data-skala="130"] { --skala: 1.3; }
html { zoom: calc(var(--skala) * var(--mobil)); }
.aktionen.mitte { align-items: center; }
#ansicht .feld { max-width: 480px; }
.card h3.title-md { margin: 20px 0 0; }
.card h3.title-md:first-of-type { margin-top: 8px; }

/* Handy: kleiner und enger, um Platz zu gewinnen */
@media (max-width: 599px) {
  :root { --mobil: .8; --kopf-h: 52px; }
  main { padding: 0 10px 12px; }
  .card { padding: 14px 12px; margin-top: 12px; }
  .feld { margin-top: 16px; }
  .aktionen, .suche, .seiten { margin-top: 12px; }
  .kacheln { gap: 12px; margin-top: 12px; }
  .btn { padding: 0 12px; }
  .tabelle th, .tabelle td { padding: 7px 8px; }
  .kurz-tabelle td, .kurz-tabelle th { padding: 5px 6px; }
  .meldung { padding: 10px 12px; margin-top: 12px; }
  .pos { padding: 10px 12px 12px; margin-top: 12px; }
  dialog .inhalt, #kundeDialog .inhalt { padding: 16px; }
  .tabs .chip { padding: 0 12px; }
  /* Filterzeile bleibt eine Zeile: Neu-Knopf feste Breite, Felder teilen sich den Rest, lange Feldnamen werden gekürzt */
  .suche { flex-wrap: nowrap; gap: 4px 8px; }
  .suche .feld { flex: 1 1 0; min-width: 0; }
  .suche .feld > span { max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .suche .btn { flex: none; }
  .suche .haken { flex: 0 1 auto; min-width: 0; line-height: 18px; }
}

/* Seitenleiste: schmalere Einträge */
.sch-eintrag { min-height: 44px; padding: 0 12px; gap: 10px; }

/* Eingabefelder: weniger Padding */
.feld input, .feld select { min-height: 48px; padding: 0 12px; }
.feld textarea { padding: 10px 12px; }
.feld > span { left: 8px; }
.feld input[type="file"] { padding: 10px 12px; min-height: 48px; }

/* Tabellen: Zellen oben ausgerichtet, leichter Zebra-Effekt */
.tabelle th, .tabelle td { vertical-align: top; }
.tabelle tbody tr:nth-child(even) { background: color-mix(in srgb, var(--md-on-surface) 5%, transparent); }
@media (hover: hover) { .tabelle tbody tr:hover { background: color-mix(in srgb, var(--md-primary) 9%, transparent); } }
@media print { html { zoom: 1; } }

/* Unterschriftsfeld (Angebot, Lieferschein) */
.sign-rahmen { position: relative; border: 1px solid var(--md-outline); border-radius: var(--shape-sm); background: #fff; margin: 12px 0; }
.sign-rahmen canvas { display: block; width: 100%; height: 200px; touch-action: none; cursor: crosshair; }
.sign-rahmen::after { content: "Hier unterschreiben"; position: absolute; left: 16px; right: 16px; bottom: 34px; border-top: 1px solid #999; padding-top: 2px; font-size: 12px; color: #777; pointer-events: none; }
.sign-bild { background: #fff; border: 1px solid var(--md-outline-variant, var(--md-outline)); border-radius: var(--shape-sm); padding: 8px; max-width: 420px; }
.sign-bild img { display: block; max-width: 100%; height: auto; }
@media print { dialog { display: none !important; } }

/* Eingang: Prüfergebnis (immer mit Symbol und Text, nie nur Farbe) */
.marke-ok, .marke-filed { border-color: var(--ok); color: var(--ok); }
.marke-info { }
.marke-warn, .marke-clarify { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.marke-review { border-style: dashed; }
.marke-rejected { text-decoration: line-through; }
.pruef { list-style: none; margin: 0; padding: 0; }
.pruef li { display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--md-outline-variant, var(--md-outline)); }
.pruef li:last-child { border-bottom: 0; }
.pruef .sym { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 1.5px solid currentColor; border-radius: 50%; font-weight: 700; font-size: 13px; }
.pruef .l-ok { color: var(--ok); } .pruef .l-warn { color: var(--warn); } .pruef .l-error { color: var(--md-error); } .pruef .l-info { color: var(--md-on-surface-variant); }
.pruef .t { color: var(--md-on-surface); }
.qr-bild { background: #fff; padding: 8px; border-radius: var(--shape-sm); display: inline-block; }
.qr-bild img { display: block; width: 180px; height: 180px; }
.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fotos a { display: block; border: 1px solid var(--md-outline); border-radius: var(--shape-sm); background: #fff; overflow: hidden; }
.fotos img { display: block; width: 100%; height: 190px; object-fit: contain; background: #fff; }

/* Log */
.nowrap { white-space: nowrap; }
.logtext { overflow-wrap: anywhere; max-width: 60ch; }
.logstelle { overflow-wrap: anywhere; font-size: 12px; }
/* Nummern in der ersten Spalte (K-0001, RE-2026-0010) nicht am Bindestrich umbrechen */
.tabelle td:first-child a { white-space: nowrap; }

/* Berichte */
.bericht h3 { font-size: 16px; line-height: 22px; margin: 24px 0 8px; }
.bericht h3:first-child { margin-top: 8px; }
.bericht table { width: 100%; border-collapse: collapse; }
.bericht th, .bericht td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--md-outline-variant, var(--md-outline)); }
.bericht th { font-size: 12px; color: var(--md-on-surface-variant); }
.bericht .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bericht tr.summe td { font-weight: 700; border-top: 2px solid var(--md-on-surface); }
.bericht ul { margin: 0; padding-left: 20px; } .bericht li { margin-bottom: 6px; }
.bericht { overflow-x: auto; }
.bericht .leer { color: var(--md-on-surface-variant); }

/* Hell/Dunkel-Schalter: zeigt das Ziel des Klicks. Im hellen Modus der Mond (-> dunkel), im dunklen die Sonne (-> hell). Ohne Wahl folgt es dem System. */
#btnTheme .ic-sonne { display: none; }
:root[data-theme="dark"] #btnTheme .ic-sonne { display: block; }
:root[data-theme="dark"] #btnTheme .ic-mond { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) #btnTheme .ic-sonne { display: block; }
  :root:not([data-theme]) #btnTheme .ic-mond { display: none; }
}
#hilfeDialog { max-width: min(780px, calc(100vw - 32px)); }

/* Seitenleiste: etwas schmaler, Logo größer */
:root { --schublade-b: 256px; }
.sch-kopf { gap: 10px; padding: 6px 8px 14px; }
.sch-kopf img { width: 48px; height: 48px; }
.sch-kopf .name { font-size: 15px; letter-spacing: .06em; }
.sch-kopf .zusatz { font-size: 12px; line-height: 1.25; }

/* Seite "Über" */
.ueber-kopf { display: flex; align-items: center; gap: 20px; }
.ueber-kopf img { width: 88px; height: 88px; flex: none; }
.ueber-kopf h2, .ueber-kopf p { margin: 0; }
.ueber-kopf h2 { font-family: "Montserrat Alt1", var(--font); font-weight: 500; font-variant: small-caps; letter-spacing: .08em; }
.ueber-kopf p { margin-top: 6px; color: var(--md-on-surface-variant); }
.ueber-daten { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; }
.ueber-daten dt { color: var(--md-on-surface-variant); }
.ueber-daten dd { margin: 0; font-weight: 500; }
.card h3 { margin: 20px 0 8px; font-size: 1rem; }
@media (max-width: 600px) { .ueber-kopf { flex-direction: column; align-items: flex-start; } }

/* Hilfe: Text, Hinweisfelder, Verzeichnis */
.hilfe-text h2 { margin-top: 0; }
.hilfe-text h3 { margin: 22px 0 8px; font-size: 1.05rem; }
.hilfe-text h4 { margin: 16px 0 6px; font-size: .95rem; }
.hilfe-text p, .hilfe-text .liste { margin: 8px 0; }
.hilfe-text .tabellenrahmen { margin: 10px 0; }
.hilfe-text .tabelle td:first-child { white-space: nowrap; font-weight: 500; vertical-align: top; }
@media (max-width: 700px) { .hilfe-text .tabelle td:first-child { white-space: normal; min-width: 7em; } .hilfe-text .tabelle td, .hilfe-text .tabelle th { padding-left: 6px; padding-right: 6px; } }
.hilfe-text blockquote.hinweis { margin: 12px 0; padding: 10px 14px; border-left: 4px solid var(--md-primary); background: var(--md-surface-container); border-radius: 0 var(--shape-m, 8px) var(--shape-m, 8px) 0; }
.hilfe-text blockquote.hinweis p { margin: 4px 0; }
.hilfe-text blockquote.hinweis-achtung { border-left-color: var(--md-error, #b3261e); }
.hilfe-text blockquote.hinweis-steuerberater { border-left-style: dashed; }
.hilfe-text code { font-family: "Roboto Mono", monospace; font-size: .92em; }
.hilfe-pfad { margin: 0 0 8px; color: var(--md-on-surface-variant); }
.hilfe-inhalt { display: flex; flex-wrap: wrap; gap: 6px; }
.hilfe-verzeichnis { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 28px; }
.hilfe-verzeichnis h3 { margin: 14px 0 4px; font-size: 1rem; }
.hilfe-treffer li { margin-bottom: 10px; }
.hilfe-knopf { width: 32px; height: 32px; vertical-align: middle; }
.hilfe-knopf .icon { width: 20px; height: 20px; }
#hilfeDialog .hilfe-text { font-size: .95rem; }
#hilfeDialog .inhalt { max-height: min(80vh, 720px); }
@media print {
  #hilfeDialog, .hilfe-pfad { display: none !important; }
  .hilfe-druck { break-inside: auto; border: 0; page-break-before: always; }
  .hilfe-druck:first-of-type { page-break-before: auto; }
}
.dlg-titelzeile { display: flex; align-items: center; gap: 4px; padding-right: 48px; }
.dlg-titelzeile h2 { margin: 0; padding-right: 0 !important; }
