:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1b2330;
  --muted: #6b7686;
  --line: #e6e9ee;
  --accent: #2f4b7c;
  --accent-soft: #eef2f8;
  --ok: #1f9d63;
  --ok-soft: #e7f5ee;
  --warn: #b9791b;
  --warn-soft: #fbf1de;
  --red: #c1422f;
  --red-soft: #fbe9e6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,30,50,.06), 0 2px 8px rgba(20,30,50,.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
}

/* Keine Monospace-Schrift in AIG – auch nicht bei <code>/<pre>/<kbd>/<samp>. */
code, pre, kbd, samp, tt { font-family: inherit; }

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; height: 58px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 600; letter-spacing: .2px; }
.brand-tag { font-size: 11px; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  padding: 8px 14px; border-radius: 8px; text-decoration: none;
  color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--accent-soft); color: var(--accent); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
/* Auf breiten Schirmen liegen die Hauptlinks inline in der Leiste; der Menü-Knopf
   ist nur auf schmalen Schirmen sichtbar (siehe @media unten). */
.nav-links { display: contents; }
.nav-burger { display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 1px solid var(--line); background: var(--card);
  color: var(--muted); cursor: pointer; border-radius: 10px;
  transition: background .12s, color .12s, border-color .12s; }
.nav-burger:hover, .nav-burger.open { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.nav-burger svg { display: block; }

/* Zahnrad-Menü (Einstellungen) */
.nav-gear { position: relative; display: inline-flex; }
.gear-btn { display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 1px solid var(--line); background: var(--card);
  font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer;
  border-radius: 10px; transition: background .12s, color .12s, border-color .12s; }
.gear-btn:hover, .gear-btn.open { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
/* Hinweislämpchen (nur Admin): Belege an allgemeiner Adresse warten auf Zuordnung */
.nav-lampe { display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 1px solid #f2dfb0; background: #fff6e6;
  border-radius: 10px; margin-right: 8px; position: relative; text-decoration: none;
  transition: background .12s, border-color .12s; }
.nav-lampe:hover { background: #ffedc7; border-color: #e0a82e; }
.lampe-dot { width: 12px; height: 12px; border-radius: 50%; background: #f0a800;
  box-shadow: 0 0 0 0 rgba(240,168,0,.55); animation: lampe-puls 2s infinite; }
.lampe-zahl { position: absolute; top: 3px; right: 5px; font-size: 10px;
  font-weight: 700; color: #a8730a; line-height: 1; }
@keyframes lampe-puls {
  0% { box-shadow: 0 0 0 0 rgba(240,168,0,.55); }
  70% { box-shadow: 0 0 0 8px rgba(240,168,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(240,168,0,0); }
}

/* Lupe „Belegsuche" – Icon-Button in der Titelleiste (wie das Zahnrad) */
.nav-search { display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 1px solid var(--line); background: var(--card);
  color: var(--muted); border-radius: 10px; margin-right: 8px;
  transition: background .12s, color .12s, border-color .12s; }
.nav-search:hover, .nav-search.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.nav-search svg { display: block; }
.gear-menu { position: absolute; right: 0; top: 112%; min-width: 180px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 20px rgba(20,30,50,.16);
  padding: 6px; z-index: 50;
  /* Ragt das Menü über den unteren Bildschirmrand hinaus (viele Admin-Punkte),
     wird IM Menü gescrollt – sonst wären die untersten Punkte unerreichbar. */
  max-height: calc(100vh - 90px); overflow-y: auto; overscroll-behavior: contain; }
.gear-menu a { display: block; padding: 8px 12px; border-radius: 7px; text-decoration: none;
  color: var(--ink); font-weight: 500; font-size: 13.5px; }
.gear-menu a:hover { background: var(--accent-soft); color: var(--accent); }
.gear-menu form { margin: 0; }
.gear-menu button.gear-login, .gear-menu button.gear-toggle { display: block; width: 100%; text-align: left; padding: 8px 12px;
  border: 0; border-radius: 7px; background: none; color: var(--ink); font-weight: 500;
  font-size: 13.5px; font-family: inherit; cursor: pointer; }
.gear-menu button.gear-login:hover, .gear-menu button.gear-toggle:hover { background: var(--accent-soft); color: var(--accent); }
.gear-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* Kostenarten (Werbungskosten) */
.ka-block { margin-bottom: 22px; }
.ka-title { font-size: 16px; margin: 2px 0 14px; color: var(--ink); }
.ka-grid-head, .ka-row {
  display: grid; grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 1fr) auto;
  gap: 10px; align-items: center;
}
.ka-grid-head { padding: 0 2px 6px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); }
.ka-row { padding: 6px 2px; border-bottom: 1px solid var(--line); margin: 0; }
.ka-input { width: 100%; padding: 7px 9px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; font-size: 13.5px; background: var(--card); color: var(--ink); }
.ka-input:focus { outline: none; border-color: var(--accent); }
.ka-hinweis { color: var(--muted); }
.ka-act { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.ka-add { margin-top: 12px; border-bottom: none; }
.btn.small.danger { color: var(--red); border-color: var(--red-soft); }
.btn.small.danger:hover { background: var(--red-soft); }

/* Einkunftsart-Tabs auf der Werbungskosten-Seite */
.ek-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.ek-tab { padding: 6px 14px; border: 1px solid var(--line); border-radius: 20px;
  text-decoration: none; color: var(--muted); font-size: 13px; background: var(--card); }
.ek-tab:hover { border-color: var(--accent); color: var(--accent); }
.ek-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ek-subtabs { display: flex; gap: 6px; margin: -4px 0 16px; flex-wrap: wrap; padding-left: 2px; }
.ek-subtab { padding: 4px 11px; border: 1px solid var(--line); border-radius: 7px;
  text-decoration: none; color: var(--muted); font-size: 12.5px; background: var(--card); }
.ek-subtab:hover { border-color: var(--accent); color: var(--accent); }
.ek-subtab.active { background: #eef2f8; color: var(--ink); border-color: var(--accent); font-weight: 600; }

/* Einkunftsarten-Haken im Betrieb */
.bs-ek { margin: 14px 0 2px; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px 12px; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.bs-ek legend { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 0 6px; }

/* Layout */
.container { max-width: 1080px; margin: 0 auto; padding: 26px 28px 80px; }
/* Breitere Variante für dichte Tabellen (Kontierungs-Detailseite). */
.container.wide { max-width: 1320px; }
/* Volle Breite für Seiten mit sehr breiten Tabellen (z. B. Mandantenverwaltung):
   der Inhalt bestimmt die Breite, die Seite scrollt notfalls als Ganzes. */
.container.full { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
h1 { font-size: 20px; margin: 0; font-weight: 650; }
.betrieb-switch { font: inherit; font-size: 20px; font-weight: 650; color: var(--accent);
  border: none; background: transparent; padding: 0 2px; cursor: pointer; }
.betrieb-switch:focus { outline: none; }
.subtitle { color: var(--muted); margin: 4px 0 0; }

/* Stats */
.stats { display: flex; gap: 10px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 16px; text-align: center; min-width: 78px;
}
.stat .num { display: block; font-size: 20px; font-weight: 700; }
.stat .lbl { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.stat.ok .num { color: var(--ok); }
.stat.warn .num { color: var(--warn); }
.stat.bad .num { color: var(--red); }

/* Intro / Hilfe */
.intro { padding: 16px 18px; margin-bottom: 16px; }
.intro-lead { margin: 0 0 8px; font-size: 14px; }
.intro-steps { margin: 0 0 14px; padding-left: 20px; color: var(--ink); }
.intro-steps li { margin: 3px 0; }
.legend { list-style: none; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; }
.legend li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.bar-key { display: inline-block; width: 4px; height: 16px; border-radius: 2px; background: var(--warn); flex: none; }
.table-help { margin: 14px 0 0; padding: 8px 10px; background: var(--accent-soft); border-radius: 8px;
  color: var(--muted); font-size: 12px; }
.table-help b { color: var(--ink); }

/* Footer */
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 0 36px; }
.foot .sep { margin: 0 6px; }

/* Toolbar (Sortierung & Filter) */
.toolbar {
  display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 12px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.tool { display: flex; flex-direction: column; gap: 4px; }
.tool label { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; }
.tool select { min-width: 140px; }
.tool-result { margin-left: auto; align-self: center; color: var(--muted); font-size: 12.5px; }
.tool-result .reset { margin-left: 10px; color: var(--accent); text-decoration: none; }
.tool-result .reset:hover { text-decoration: underline; }
.center { text-align: center; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; }
/* Karten, die direkt eine Tabelle umschließen, bleiben randlos – die Zellen-Innenabstände
   sorgen dort für den Abstand (sonst doppelter Rand). Eigene .padding-Klassen gewinnen ohnehin.
   GESTALTUNGSREGEL (Nutzer): der WEISSE HINTERGRUND passt sich dem Inhalt an – nie
   umgekehrt (kein Abschneiden, kein Scrollen im Kasten). Breite Tabellen lassen die
   Karte mitwachsen (width: max-content); ist die Seite dann breiter als das Fenster,
   scrollt die SEITE als Ganzes und der Kasten umschließt weiterhin alles. */
.card:has(> table) { padding: 0; width: max-content; min-width: 100%; max-width: none; }
.orders { display: flex; flex-direction: column; gap: 12px; }
.order { padding: 14px 16px; transition: border-color .15s; }
.order.is-open { border-left: 3px solid var(--warn); }

.order-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.order-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.order-meta .date { font-weight: 600; }
.order-meta .oid { font-family: inherit; color: var(--muted); font-size: 12.5px; }
.order-meta .ord-lief { font-weight: 600; color: var(--ink); }
.order-meta .total { font-weight: 600; }
.order-leistung { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.order-docs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.doc {
  font-size: 12.5px; text-decoration: none; color: var(--accent);
  border: 1px solid var(--line); background: var(--accent-soft);
  padding: 4px 10px; border-radius: 7px;
}
.doc:hover { border-color: var(--accent); }

/* Artikel-Liste in der Bestellkarte (Bild + Titel, Amazon-ähnlich) */
.item-list { list-style: none; margin: 12px 0 0; padding: 0; }
.item-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.item-row:first-child { border-top: none; }
.item-list .item-thumb { width: 50px; height: 50px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 3px; flex: none; }
.item-thumb.empty { background: repeating-linear-gradient(45deg, #f4f5f7, #f4f5f7 6px, #eceef1 6px, #eceef1 12px); }
.item-title-link { color: var(--ink); text-decoration: none; font-size: 13.5px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-title-link[href]:hover { color: var(--accent); text-decoration: underline; }

/* Fußzeile der Bestellkarte (Betrieb-Zuordnung) */
.order-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.foot-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* Hilfe-Button mit Tooltip */
.help {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); border: 1px solid #d8e0ec;
  font-size: 11px; font-weight: 700; cursor: help; position: relative; flex: none;
}
.help::after {
  content: attr(data-tip);
  position: absolute; bottom: 138%; left: 0; width: 280px;
  background: #1b2330; color: #fff; padding: 9px 11px; border-radius: 8px;
  font-size: 12px; font-weight: 400; line-height: 1.45; text-align: left;
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .12s, transform .12s; z-index: 30;
  box-shadow: 0 6px 20px rgba(20, 30, 50, .18);
}
.help:hover::after, .help:focus::after { opacity: 1; visibility: visible; transform: translateY(0); }
.split-note { color: var(--muted); font-size: 12.5px; font-style: italic; }

/* Badges */
.badge { font-size: 11.5px; padding: 3px 9px; border-radius: 20px; font-weight: 600; }
.badge.gray { background: #eef0f3; color: #5b6573; }
.badge.amber { background: var(--warn-soft); color: var(--warn); }
.badge.red { background: var(--red-soft); color: var(--red); }

/* Buttons */
.btn {
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: #fff; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
form.inline { display: inline; }

/* Inputs / selects */
select, input[type="text"], input:not([type]) {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px;
  transition: border-color .12s, box-shadow .12s;
}
select:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sel-purpose { min-width: 150px; }

/* Saved flash */
.js-save.saved { animation: savedFlash 1s ease; }
.js-save.error { border-color: var(--red) !important; box-shadow: 0 0 0 3px var(--red-soft); }
@keyframes savedFlash {
  0% { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
  100% { border-color: var(--line); box-shadow: none; }
}

/* Items table */
table.items { width: 100%; border-collapse: collapse; margin-top: 14px; border-top: 1px solid var(--line); }
table.items th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); font-weight: 600; padding: 10px 8px 6px; border-bottom: 1px solid var(--line);
}
table.items td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.items tr:last-child td { border-bottom: none; }
.item-cell { display: flex; align-items: center; gap: 10px; }
.item-thumb { width: 34px; height: 34px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; padding: 2px; background: #fff; flex: none; }
.item-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; color: var(--ink); text-decoration: none; }
a.item-title:hover { color: var(--accent); text-decoration: underline; }
.col-art { width: 38%; }
.col-menge { text-align: center; white-space: nowrap; }
table.kontierung td.col-menge { font-weight: 600; color: var(--ink); }
/* Drei-Punkte-Zeilenmenü (Kontierung): Retoure + Zweck ändern einklappen. */
.row-menu { position: relative; display: inline-block; }
.rm-toggle { padding: 4px 9px; line-height: 1; font-size: 17px; }
.rm-pop { position: absolute; right: 0; top: 100%; z-index: 40; margin-top: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 6px 22px rgba(0,0,0,.13); padding: 6px; display: flex;
  flex-direction: column; gap: 3px; min-width: 150px; }
.rm-pop button, .rm-pop .js-change-betrieb { text-align: left; padding: 7px 10px; border: 0;
  background: none; border-radius: 7px; cursor: pointer; font: inherit; color: var(--ink); }
.rm-pop button:hover { background: var(--soft, #eef2f8); }
.rm-pop .js-flag.active { color: var(--accent); font-weight: 600; }
.rm-pop select { margin-top: 2px; }
/* BU-Feld: Dropdown nur Nummer·Satz; Bezeichnung grau rechtsbündig darunter. */
.bu-field { display: flex; flex-direction: column; }
.bu-name { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px;
  line-height: 1.25; overflow-wrap: anywhere; }
/* S/H-Spalte (Soll/Haben des Kontos) – schmal, zentriert. */
.col-sh { width: 34px; text-align: center; }
.sh-cell { text-align: center; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; }
.sh-cell:hover { background: var(--soft, #eef2f8); }
.sh-cell.sh-manuell { color: var(--accent); }
/* Ausgleichszeile (Fall 3 Privateinlage / Fall 4 Verrechnung) – Anzeige, nicht editierbar. */
.ausgleich-row { background: #f5f7fb; color: var(--ink); font-size: 13px; }
.ausgleich-row .aus-label { font-style: italic; color: var(--muted); }
.ausgleich-row .aus-warn { color: var(--red, #c0392b); font-weight: 600; }
.inp-konto { width: 92px; }
.inp-kost1 { width: 68px; }
.inp-kontonr { width: 92px; }
.inp-amount { width: 84px; text-align: right; }
.inp-text { width: 100%; min-width: 130px; }
/* Kontierzeile: ALLE Eingabefelder stehen auf DERSELBEN Hoehe (Nils, 2026-07-27).
   Vorher waren Feld + grauer Text darunter gemeinsam vertikal zentriert - ein
   mehrzeiliger Text ("Vorsteuer 19 %", Kontobezeichnung, "netto ...") schob damit die
   Box nach oben, und die Zeile wirkte ausgefranst. Jetzt oben ausgerichtet: die Boxen
   fluchten, der graue Text waechst nach UNTEN. */
.eb-buchung tr.eb-line > td { vertical-align: top; }
.eb-buchung tr.eb-line > td > input,
.eb-buchung tr.eb-line .bu-field,
.eb-buchung tr.eb-line .konto-field { margin-top: 0; }
/* Zellen ohne Eingabefeld (S/H) auf die Grundlinie der Boxen bringen. */
.eb-buchung tr.eb-line > td.sh-cell { padding-top: 11px; }

/* BU-Feld: eingeklappt nur der Schluessel, die volle Bezeichnung erscheint beim
   Aufklappen (Skript in kontierung_betrieb.html). Die Breite MUSS hart begrenzt werden -
   sonst zieht der Langtext der Optionen die Spalte auf (Nils, 2026-07-27, zweiter Anlauf).
   Hoehere Spezifitaet als `.sel-bu`, damit keine andere Regel gewinnt. */
.sel-bu, .bu-field .sel-bu, td.col-bu .sel-bu {
  width: 62px; min-width: 62px; max-width: 62px; box-sizing: border-box; flex: none;
}
/* Die Bezeichnung darunter darf die Spalte ebenfalls nicht aufziehen. */
.bu-field { max-width: 118px; }
.bu-field .bu-name { max-width: 118px; white-space: normal; overflow-wrap: anywhere; }
td.col-bu, th.col-bu { width: 118px; max-width: 118px; }

/* Artikel-Zeile: Titel füllt, Betrieb-Auswahl rechts (Zuordnung bei Aufteilung) */
.item-row .item-title-link { flex: 1; }
.item-assign { margin-left: auto; flex: none; }
.item-assign .sel-purpose { min-width: 160px; }

/* Kontierungs-Tabelle */
.badge.soft { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nowrap, table.kontierung .col-date { white-space: nowrap; }
table.kontierung td, table.kontierung th { font-size: 12.5px; }
table.kontierung tr.is-open td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
table.kontierung tr.is-done td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.col-change { white-space: nowrap; }

/* Gegenkonto-Feld mit Marker, Namensanzeige und Suchliste */
.konto-field { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.konto-field .inp-konto { order: 2; }
.konto-field .js-confirm-konto { order: 3; padding: 4px 8px; line-height: 1; }
.konto-name { order: 4; flex-basis: 100%; margin-top: 1px; font-size: 11px; line-height: 1.2; color: var(--muted);
  max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Ampel-Marker neben dem Gegenkonto */
.konto-marker { order: 1; display: inline-grid; place-items: center; flex: none;
  width: 18px; height: 18px; border-radius: 50%; font-size: 12px; font-weight: 800;
  cursor: help; user-select: none; }
.konto-marker.mk-gruen { background: var(--ok-soft); color: var(--ok); }
.konto-marker.mk-gelb { background: var(--warn-soft); color: var(--warn); }
.konto-marker.mk-rot { background: var(--red-soft); color: var(--red); }
.konto-marker.mk-retour { background: #e7eaf0; color: #5b6573; }
.konto-marker.mk-gebucht { background: var(--accent-soft); color: var(--accent); }
/* Leerer Kontoname soll keine zweite Zeile erzeugen → Felder bleiben auf gleicher Höhe */
.konto-name:empty { display: none; }
.items.kontierung td { vertical-align: middle; }

/* Statt eines Marker-Icons (das das Feld verschob) wird das Feld farbig umrahmt:
   rosa = Pflichtfeld auszufüllen, grün = bestätigt. Gelb (Vorschlag) siehe .is-vorschlag. */
.konto-field.marker-rot .inp-konto { border-color: var(--red); background: var(--red-soft); }
.konto-field.marker-gruen .inp-konto { border-color: var(--ok); }

/* Legenden-Muster: kleines umrahmtes Kästchen statt Icon-Badge. */
.konto-swatch { display: inline-block; width: 22px; height: 15px; border-radius: 5px;
  border: 2px solid var(--line); background: #fff; flex: none; }
.konto-swatch.sw-rot { border-color: var(--red); background: var(--red-soft); }
.konto-swatch.sw-gelb { border-color: #e8c98b; background: #fffaf0; }
.konto-swatch.sw-gruen { border-color: var(--ok); }

/* Werbungskosten: Kostenart als Pulldown */
.sel-kostenart { width: 100%; max-width: 240px; padding: 6px 9px; font: inherit; font-size: 13px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
.sel-kostenart:focus { outline: none; border-color: var(--accent); }
.sel-kostenart.marker-rot { border-color: var(--red); background: var(--red-soft); }
.sel-kostenart.marker-gruen { border-color: var(--ok); }

/* Retoure / bereits gebucht */
.stat.retour .num { color: #5b6573; }
.stat.gebucht .num { color: var(--accent); }
table.kontierung tr.is-retour, table.kontierung tr.is-gebucht { opacity: .72; }
table.kontierung tr.is-retour td:first-child { box-shadow: inset 3px 0 0 #9aa3b2; }
table.kontierung tr.is-gebucht td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.js-flag.active { background: #e7eaf0; color: #3a414d; border-color: #c4cbd6; font-weight: 600; }
.kc-retour { font-size: 12px; color: #5b6573; }

/* Noch nicht bestätigter Vorschlag im Feld: dezent gelb, kursiv */
.inp-konto.is-vorschlag, .inp-kontonr.is-vorschlag { background: #fffaf0; border-color: #e8c98b; color: var(--warn); font-style: italic; }
.inp-konto.is-vorschlag:focus, .inp-kontonr.is-vorschlag:focus { color: var(--ink); font-style: normal; }
/* Kreditor aus sicherer Quelle (Plattform-Download) – bestätigt, nicht gelb. */
.inp-kontonr.is-sicher { border-color: var(--ok); background: #f0f9f3; color: var(--ink); }

/* BU-Feld bei Automatikkonten (AV/AM): "auto"-Badge statt Steuerschlüssel */
.bu-auto { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700;
  padding: 5px 9px; border-radius: 7px; background: var(--accent-soft); color: var(--accent);
  border: 1px solid #d8e0ec; cursor: help; letter-spacing: .3px; }

/* Marker-Legende unter der Überschrift */
.marker-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0; padding: 0; }
.marker-legend li { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.marker-legend .konto-marker { cursor: default; }
.konto-suggest { position: absolute; top: 100%; left: 0; margin-top: 4px; z-index: 40;
  min-width: 280px; max-height: 280px; overflow-y: auto; background: #fff;
  border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(20, 30, 50, .16); }
.ks-item { display: flex; gap: 10px; align-items: baseline; padding: 7px 10px; cursor: pointer; font-size: 12.5px; }
.ks-item.active, .ks-item:hover { background: var(--accent-soft); }
.ks-num { font-family: inherit; color: var(--accent); min-width: 40px; flex: none; }
.ks-name { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ks-art { margin-left: auto; flex: none; font-size: 10px; color: var(--muted); }
.ks-leer { padding: 10px; font-size: 12px; color: var(--muted); }
/* Aufklapp-Pfeil neben dem Konto-Eingabefeld: erscheint erst, wenn das Feld aktiv
   ist (Nils, 2026-08-02: normales Eingabefeld zuerst, Liste nur auf Wunsch). */
.ks-toggle { display: none; flex: none; width: 22px; height: 24px; padding: 0;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  color: var(--muted); font-size: 11px; line-height: 1; cursor: pointer; }
.ks-toggle:hover { background: var(--accent-soft); color: var(--accent); }
.konto-field:focus-within .ks-toggle,
.gh-konto-feld:focus-within .ks-toggle { display: inline-grid; place-items: center; }
/* Im Gegenkonto-Feld (flex mit order-Werten): Pfeil direkt HINTER das Eingabefeld,
   vor den Bestätigungshaken (Marker=1, Feld=2, Haken=3, Name=4). */
.konto-field .ks-toggle { order: 2; }
.ks-foot { position: sticky; bottom: 0; display: flex; gap: 14px; padding: 6px 10px;
  background: #fafbfc; border-top: 1px solid var(--line); font-size: 12px; }
.ks-foot a { color: var(--accent); text-decoration: none; }
.ks-foot a:hover { text-decoration: underline; }
table.kontierung .item-cell { min-width: 200px; }
table.kontierung .item-title { font-size: 12.5px; }
.col-doc { white-space: nowrap; }
.col-doc .doc { padding: 2px 7px; font-size: 11.5px; margin-right: 2px; }
/* Fehlende Rechnung: Anfordern-Button bzw. Hinweis statt falscher 0 */
.col-doc .btn.request { padding: 4px 9px; font-size: 11.5px; white-space: nowrap;
  background: var(--warn-soft); color: var(--warn); border-color: #e8c98b; }
.col-doc .btn.request:hover { filter: brightness(.98); }
.col-doc .no-invoice { font-size: 11.5px; color: var(--muted); font-style: italic; }
.empty-row { text-align: center; color: var(--muted); padding: 26px; }

/* Gruppen-Kopfzeile (Ansicht nach Rechnung/Bestellung) */
table.kontierung tr.group-head td { background: var(--accent-soft); padding: 9px 12px;
  border-top: 2px solid #d8e0ec; }
.gh-date { font-weight: 600; color: var(--muted); margin-right: 10px; }
.gh-title { font-weight: 650; color: var(--ink); }
.gh-lieferant { margin-left: 10px; font-size: 12.5px; color: var(--muted); }
.gh-lieferant::before { content: "· "; }
table.kontierung tr.group-head .doc { margin-left: 10px; }
.gh-order { margin-left: 10px; font-size: 12px; font-weight: 600; color: var(--accent); text-decoration: none; }
.gh-order:hover { text-decoration: underline; }
.gh-sum { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.group-head td.gh-sum-cell { text-align: right; white-space: nowrap; }
.gh-sum-cell .gh-sum { float: none; }
.group-head td:first-child .gh-sum { float: right; }
.group-head td.gh-konto-cell { padding-top: 4px; padding-bottom: 4px; }
/* Konto-Spalte breit genug halten (Zeilen zeigen nur noch kurzen Text → Spalte würde sonst schrumpfen). */
table.kontierung th.col-kontonr, table.kontierung td.col-kontonr { width: 110px; min-width: 110px; }
.gh-konto-inp { width: 96px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; font: inherit; font-size: 13px; text-align: center; }
.gh-konto-inp.is-vorschlag { background: #fffaf0; border-color: #e8c98b; color: var(--warn); font-style: italic; }
.gh-konto-inp.is-vorschlag:focus { color: var(--ink); font-style: normal; }
.gh-konto-inp.is-sicher { border-color: var(--ok); background: #f0f9f3; color: var(--ink); }
.kontonr-ro { color: var(--muted); font-variant-numeric: tabular-nums; }
.gh-warn { margin-left: 10px; font-size: 12px; font-weight: 600; color: #b9791b;
  background: #fbf1de; border: 1px solid #ecd6a8; border-radius: 999px; padding: 1px 9px; }
/* Datenherkunft-Plakette (woher die Buchungsdaten stammen). */
.herkunft { display: inline-block; font-size: 10px; font-weight: 600; line-height: 1.5;
  border-radius: 999px; padding: 0 7px; margin-left: 6px; vertical-align: middle;
  color: var(--muted); background: var(--soft, #eef2f8); border: 1px solid var(--line); }
.herkunft[data-h="E-Rechnung"] { color: #1f7a4d; background: #e7f5ee; border-color: #bfe6cf; }
.herkunft[data-h="OCR"] { color: #b9791b; background: #fbf1de; border-color: #ecd6a8; }
.herkunft[data-h="KI"] { color: #3a4cb1; background: #eaecfb; border-color: #cdd2f4; }
/* „Scan" = Bild-PDF ohne Textebene, noch nicht lesbar → rötlich (Handlungsbedarf/-hinweis). */
.herkunft[data-h="Scan"] { color: #b3474d; background: #fdecec; border-color: #f2c6c9; }
a.herkunft-link { text-decoration: none; cursor: pointer; }
a.herkunft-link:hover { filter: brightness(0.96); text-decoration: underline; }

/* Kontierung-Übersicht (Kacheln je Betrieb) */
.kont-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.kont-card { display: block; padding: 16px; text-decoration: none; color: var(--ink);
  border-left: 3px solid var(--line); transition: box-shadow .12s, transform .12s; }
.kont-card:hover { box-shadow: 0 4px 16px rgba(20, 30, 50, .10); transform: translateY(-1px); }
.kont-card.status-fertig { border-left-color: var(--ok); }
.kont-card.status-offen { border-left-color: var(--warn); }
.kont-card.status-differenzen { border-left-color: var(--red); }
.kont-card.status-leer { border-left-color: var(--line); }
.kc-pill.differenzen { background: var(--red-soft); color: var(--red); }
.kont-card.status-differenzen .kc-bar span { background: var(--red); }
.kc-diff { color: var(--red); font-weight: 600; }
.kc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.kc-name { font-weight: 650; font-size: 15px; }
.kc-pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
/* Klickbare Plakette („Differenzen – prüfen" → gefilterte Kontieransicht). */
.kc-pill[role="link"] { cursor: pointer; }
.kc-pill[role="link"]:hover { filter: brightness(.94); text-decoration: underline; }
.kc-pill.fertig { background: var(--ok-soft); color: var(--ok); }
.kc-pill.offen { background: var(--warn-soft); color: var(--warn); }
.kc-pill.leer { background: #eef0f3; color: #5b6573; }
.kc-bar { height: 7px; background: var(--line); border-radius: 5px; overflow: hidden; }
.kc-bar span { display: block; height: 100%; background: var(--ok); border-radius: 5px; }
.kont-card.status-offen .kc-bar span { background: var(--warn); }
.kc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.kc-count { font-size: 12.5px; color: var(--muted); }
.kc-go { font-size: 12.5px; color: var(--accent); font-weight: 600; }

.crumb { margin: 0 0 4px; }
.crumb a { color: var(--muted); text-decoration: none; font-size: 12.5px; }
.crumb a:hover { color: var(--accent); }
.hidden { display: none !important; }

/* Fehlende Rechnungen */
.stat.bad .num { color: var(--red); }
.miss-list { display: flex; flex-direction: column; gap: 12px; }
.miss-card { padding: 16px; }
.miss-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.miss-head .date { font-weight: 600; }
.miss-head .oid { font-family: inherit; color: var(--muted); font-size: 12px; margin-left: auto; }
.miss-items { list-style: none; margin: 10px 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.miss-items li { display: flex; align-items: center; gap: 10px; }
.miss-items .item-thumb { width: 30px; height: 30px; }
.miss-items .item-title { font-size: 13px; -webkit-line-clamp: 1; }
.miss-actions { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end;
  border-top: 1px solid var(--line); padding-top: 12px; }
.miss-step label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); font-weight: 600; margin-bottom: 5px; }
.gmail-row, .upload-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gmail-q { font-family: inherit; font-size: 12px;
  background: var(--accent-soft); color: var(--ink); padding: 6px 9px; border-radius: 7px;
  max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.miss-upload input[type="file"] { font: inherit; font-size: 12px; max-width: 220px; }
.miss-step .btn.request { background: var(--warn-soft); color: var(--warn); border-color: #e8c98b; }

/* Rechnung-Prüfen (Plausibilität) */
.pruef-card { padding: 20px; max-width: 620px; }
/* Bestellseite (Nils, 2026-07-28): Karten mit GEMISCHTEM Inhalt (Tabelle + Hinweis-
   text) bleiben in der Seitenbreite – der Text bricht um. Die Mitwachs-Regel
   (.card:has(> table), width:max-content) gilt weiter für reine Tabellen-Karten. */
.card.pruef-card { width: auto; min-width: 0; padding: 20px; }
/* Opt-out von der Mitwachs-Regel für einzelne Tabellen-Karten (z. B. Artikel auf der
   Bestellseite): Karte bleibt in der Seitenbreite, der Inhalt bricht um. */
.card.seitenbreit { width: auto; min-width: 0; max-width: 100%; }
/* Artikel-Spalte: der 2-zeilig geklemmte Titel (line-clamp) meldet der Tabelle als
   Mindestbreite die VOLLE Einzelzeilenbreite – die Karte wuchs dadurch auf ~3000 px
   (Seite überbreit). Zelle hart begrenzen; der Titel bricht/klemmt dann sauber. */
table.items td.item-cell { max-width: 0; min-width: min(38vw, 560px); }
.pruef-verdict { font-size: 15px; font-weight: 600; padding: 12px 14px; border-radius: 9px; margin-bottom: 16px; }
.pruef-verdict.verdict-ok { background: var(--ok-soft); color: var(--ok); }
.pruef-verdict.verdict-abweichung { background: var(--red-soft); color: var(--red); }
.pruef-verdict.verdict-unbekannt { background: var(--warn-soft); color: var(--warn); }
.pruef-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.pruef-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line); }
.pruef-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.pruef-table td.num { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.pruef-item { color: var(--muted); font-size: 13px; margin: 4px 0 14px; }
.pruef-hint { background: var(--red-soft); color: var(--ink); border-radius: 8px; padding: 10px 12px;
  font-size: 13px; margin: 0 0 16px; }
.pruef-actions { display: flex; gap: 10px; }
.pruef-actions form { display: inline; }

/* Dashboard / Start */
.dash-metrics { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 18px; min-width: 120px; }
.metric .num { display: block; font-size: 24px; font-weight: 700; color: var(--accent); }
.metric .lbl { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.dash-h2 { font-size: 15px; margin: 26px 0 12px; }
.dash-steps { list-style: none; margin: 0; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.dash-step { display: flex; gap: 12px; align-items: flex-start; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.dash-step.todo { opacity: .65; }
.step-no { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.step-body { min-width: 0; }
.step-title { font-weight: 650; font-size: 14px; color: var(--ink); text-decoration: none; }
a.step-title:hover { color: var(--accent); text-decoration: underline; }
.step-info { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
table.items td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.items td.oid { font-family: inherit; font-size: 12px; color: var(--muted); }
.dash-download { padding: 16px 18px; }
.dash-download code { background: var(--accent-soft); padding: 2px 6px; border-radius: 6px;
  font-family: inherit; font-size: 12.5px; }
.dash-download ol { margin: 10px 0; padding-left: 20px; }
.dash-download li { margin: 6px 0; }

/* Betriebe (gestaffelt) */
.betriebe-list { display: flex; flex-direction: column; gap: 12px; }
.betrieb-sektion { padding: 16px 18px; }
/* Name oben, ALLE Aktionsknöpfe in einer eigenen Zeile darunter (umbrechend). */
.bs-head { display: flex; flex-direction: column; align-items: stretch; gap: 10px;
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.bs-name { font-size: 16px; font-weight: 650; width: 340px; max-width: 100%; padding: 8px 10px; }
.bs-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bs-grid { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 18px; }
/* Felder nur so breit wie nötig (statt über die ganze Zeile zu strecken). */
.bs-grid label.bs-kind { width: 230px; }
.bs-grid label.bs-skr { width: 92px; }
.bs-grid label.bs-kind select, .bs-grid label.bs-skr select { width: 100%; }
.bs-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11px;
  text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 600; }
.bs-grid label input, .bs-grid label select { font-weight: 400; color: var(--ink); text-transform: none; letter-spacing: 0; }
.bs-grid label.bs-check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink);
  font-weight: 500; font-size: 13px; text-transform: none; letter-spacing: 0; align-self: end; }

/* Purposes page */
table.purposes { width: 100%; border-collapse: collapse; }
table.purposes th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 12px 12px 8px; }
table.purposes td { padding: 8px 12px; border-top: 1px solid var(--line); }
.row-actions { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.add-card { margin-top: 16px; padding: 18px; }
.add-card h2 { font-size: 15px; margin: 0 0 12px; }
.add-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.add-form input { min-width: 180px; }

/* ---- Benutzerkonten: Anmelden / Registrieren / Konto ---- */
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.auth-wrap { max-width: 640px; margin: 24px auto; }
.auth-card { padding: 26px 28px; }
.auth-card h1 { margin: 0 0 6px; }
.auth-card.auth-wide { max-width: 640px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.auth-form > label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px;
  color: var(--muted); font-weight: 600; }
.auth-form input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 14px; color: var(--ink); background: var(--card); }
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-form input:disabled { background: #f3f5f8; color: var(--muted); }
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.auth-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px;
  color: var(--muted); font-weight: 600; }
.auth-col2 { grid-column: 1 / -1; }
.auth-check { display: flex; flex-direction: row; align-items: flex-start; gap: 8px;
  font-size: 13px; color: var(--ink); font-weight: 500; }
.auth-check input { margin-top: 2px; }
.auth-inline { flex-direction: row !important; align-items: center; gap: 8px !important; }
.auth-inline input { max-width: 200px; }
.auth-error { background: var(--red-soft); color: var(--red); border: 1px solid #f3c6bf;
  padding: 9px 12px; border-radius: 8px; font-size: 13px; margin: 6px 0; }
.auth-ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #bfe6cf;
  padding: 9px 12px; border-radius: 8px; font-size: 13px; margin: 6px 0; }
.auth-alt { margin-top: 16px; font-size: 13px; color: var(--muted); }

/* Status-Tags in Admin-Tabellen */
.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11px;
  font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-off { background: #e7eaf0; color: #5b6573; }
.tag-ent { background: #eaecfb; color: #3a4cb1; border: 1px solid #cdd2f4; }
td.adm-actions { white-space: nowrap; }
td.adm-actions form { margin-right: 6px; }
tr.is-inactive { opacity: .55; }
.tc-code { font-family: inherit; font-size: 13px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); padding: 2px 7px; border-radius: 6px; }

/* Rechtsseiten */
.legal h2 { font-size: 15px; margin: 18px 0 6px; }
.legal p { line-height: 1.55; color: var(--ink); }
.legal-todo { background: var(--warn-soft); color: var(--warn); border: 1px solid #ecd6a8;
  padding: 9px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--accent); text-decoration: underline; }

/* ---- Rechtstexte: Anzeige + Editor ---- */
.legal-content { white-space: pre-wrap; line-height: 1.62; color: var(--ink); font-size: 14px; }
.legal-edit { margin-bottom: 18px; }
.legal-edit form { display: flex; flex-direction: column; gap: 10px; }
.le-titel, .le-inhalt { display: flex; flex-direction: column; gap: 4px; font-size: 12px;
  text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; }
.le-titel input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 15px; font-weight: 600; text-transform: none; color: var(--ink); }
.le-inhalt textarea { padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 13.5px; line-height: 1.55; color: var(--ink); text-transform: none;
  font-weight: 400; resize: vertical; }
.le-inhalt textarea:focus, .le-titel input:focus { outline: none; border-color: var(--accent); }
.le-foot { display: flex; align-items: center; justify-content: space-between; }

/* ---- Admin: Preismodelle ---- */
.pm-head, .pm-row { display: grid; gap: 10px; align-items: center;
  grid-template-columns: 1.2fr .7fr .7fr 1.6fr auto auto; }
.pm-head { padding: 0 2px 6px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); }
.pm-row { padding: 6px 2px; border-bottom: 1px solid var(--line); margin: 0; }
.pm-row input[type=text], .pm-row input:not([type]) { width: 100%; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13px; }
.pm-row input:focus { outline: none; border-color: var(--accent); }
.pm-check { display: flex; justify-content: center; }
.pm-add { margin-top: 12px; border-bottom: none; }

/* ---- Mein Konto: Tarifauswahl ---- */
.pm-select { display: block; }
.pm-cards { display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 8px; }
.pm-card { display: flex; flex-direction: column; gap: 3px; min-width: 150px; cursor: pointer;
  border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; position: relative; }
.pm-card:hover { border-color: var(--accent); }
.pm-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.pm-card input { position: absolute; opacity: 0; }
.pm-name { font-weight: 700; font-size: 14px; color: var(--ink); }
.pm-preis { font-size: 13px; color: var(--accent); font-weight: 600; }
.pm-desc { font-size: 12px; color: var(--muted); }

/* ============ Werbe-Startseite (Landing) ============ */
.container.landing { max-width: 1120px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 10px; }

.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; align-items: center;
  padding: 28px 0 36px; }
.hero-text { animation: fadeUp .7s ease both; }
.hero-eyebrow { display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-soft);
  padding: 5px 12px; border-radius: 20px; }
/* Eigener „Störer" zwischen Eyebrow und Titel – amberfarbene Pille auf eigener Zeile. */
.hero-stoerer { display: block; width: max-content; max-width: 100%; margin: 12px 0 2px;
  padding: 6px 15px; border-radius: 999px; background: #fbf1de; border: 1px solid #e6c98a;
  color: #8a6d00; font-size: 13px; font-weight: 700; transform: rotate(-1.5deg);
  box-shadow: 0 2px 6px rgba(138, 109, 0, .10); }
.hero-title { font-size: 40px; line-height: 1.12; margin: 16px 0 0; font-weight: 750; letter-spacing: -.5px; }
.hero-accent { color: var(--accent); }
.hero-sub { font-size: 16.5px; line-height: 1.55; color: var(--muted); margin: 16px 0 24px; max-width: 30em; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-note { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); }
.hero-art { animation: fadeUp .7s .12s ease both; }
.hero-art svg { width: 100%; height: auto; }

/* Animationen im Hero-Bild */
.float-a { animation: floaty 4.5s ease-in-out infinite; }
.float-b { animation: floaty 5.2s ease-in-out .6s infinite; transform-box: fill-box; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.pulse { animation: pulse 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.ring { animation: ring 3s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ring { 0% { transform: scale(.85); opacity: .5; } 70% { transform: scale(1.25); opacity: 0; } 100% { opacity: 0; } }
.row { transform-box: fill-box; transform-origin: left center; animation: grow 3s ease-in-out infinite; }
.row.r2 { animation-delay: .25s; } .row.r3 { animation-delay: .5s; }
@keyframes grow { 0%,100% { transform: scaleX(.4); opacity: .6; } 50% { transform: scaleX(1); opacity: 1; } }
.svg-check { stroke-dasharray: 22; stroke-dashoffset: 22; animation: draw 3s ease-in-out infinite; }
@keyframes draw { 0%,40% { stroke-dashoffset: 22; } 60%,100% { stroke-dashoffset: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* Vorteile */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 6px 0 40px; }
.feat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px 20px;
  box-shadow: var(--shadow); animation: fadeUp .6s ease both; }
.features .feat:nth-child(2) { animation-delay: .08s; }
.features .feat:nth-child(3) { animation-delay: .16s; }
.feat-ic { width: 44px; height: 44px; display: grid; place-items: center; font-size: 22px;
  background: var(--accent-soft); border-radius: 11px; margin-bottom: 12px; }
.feat h3 { margin: 0 0 6px; font-size: 16px; }
.feat p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }

/* Abschluss-Band */
.cta-band { text-align: center; background: linear-gradient(135deg, #3a5a92, #2f4b7c);
  color: #fff; border-radius: 18px; padding: 34px 24px; margin: 0 0 30px; }
.cta-band h2 { margin: 0 0 18px; font-size: 23px; font-weight: 700; }
.cta-band .btn.primary { background: #fff; color: var(--accent); border-color: #fff; }
.cta-band .btn.primary:hover { filter: brightness(.96); }

/* Menü-Einträge, die nur im Handy-Aufklapp-Menü erscheinen (Mandantenwähler,
   Info-Startseite, Trennlinien) – auf breiten Schirmen ausgeblendet. */
.ctx-in-menu, .only-phone, .nav-sep { display: none; }

/* „Auf dem Handy einklappbar": Erläuterungstexte u. Ä. werden auf schmalen
   Schirmen hinter einem kleinen Aufklapp-Knopf versteckt (Standard: zu).
   Am PC ist der Knopf unsichtbar und der Inhalt immer sichtbar. */
.mklapp-toggle { display: none; align-items: center; gap: 7px;
  margin: 4px 0 2px; padding: 5px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--accent); font: inherit; font-size: 12.5px;
  font-weight: 600; cursor: pointer; }
.mklapp-toggle .mk-arrow { display: inline-block; transition: transform .15s; font-size: 11px; }

/* ---- Tablet (z. B. iPad) und schmaler: Hauptmenü als Aufklapp-Panel (☰),
   sonst überlaufen die Links die Kopfleiste. PC-Ansicht (>1080px) unverändert. */
@media (max-width: 1080px) {
  .nav { position: relative; gap: 6px; }
  .nav-burger { display: inline-flex; }
  .nav-links {
    display: none; position: absolute; top: calc(100% + 8px); right: 0;
    flex-direction: column; min-width: 230px; max-width: 86vw;
    max-height: calc(100vh - 90px); overflow: auto;
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 6px 20px rgba(20,30,50,.16); padding: 6px; z-index: 50;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 11px 12px; border-radius: 8px; }
  .nav-sep { display: block; height: 1px; background: var(--line); margin: 6px 4px; }
  /* Trennlinien im Panel nur zeigen, wenn ihr Nachbar-Eintrag sichtbar ist. */
  .nav-sep.only-phone, .nav-sep.ctx-in-menu { display: none; }
}

/* ---- Handy: Kopfleiste kompakt, Mandantenwähler wandert ins ☰-Menü. */
@media (max-width: 760px) {
  /* Startseite: kleines animiertes Bild OBEN RECHTS, Überschrift links daneben. */
  .hero { grid-template-columns: minmax(0, 1fr) 104px; gap: 12px;
    align-items: start; padding: 16px 0 24px; }
  .hero-text { min-width: 0; }
  .hero-art { order: 0; max-width: none; margin-top: 4px; }
  .hero-title { font-size: 25px; margin-top: 10px; }
  .hero-sub { font-size: 14.5px; }
  .features { grid-template-columns: 1fr; }

  /* Einklappbare Erläuterungen: Knopf zeigen, Inhalt nur wenn aufgeklappt. */
  .mklapp-toggle { display: inline-flex; }
  .mklapp:not(.open) > .mklapp-body { display: none; }
  .mklapp.open > .mklapp-toggle .mk-arrow { transform: rotate(180deg); }

  .topbar { padding: 0 12px; }
  .brand-tag { display: none; }
  /* Haus-Symbol und Mandantenwähler raus aus der Leiste – beides steht im ☰-Menü. */
  .nav .nav-home { display: none; }
  .nav > .ctx-switch { display: none; }
  .nav-lampe { margin-right: 2px; }
  .nav-search { margin-right: 2px; }
  .only-phone { display: block; }
  .nav-sep.only-phone { display: block; }
  /* Mandantenwähler im Menü: Beschriftung + Auswahl in voller Breite. */
  .ctx-in-menu { display: block; }
  form.ctx-switch.ctx-in-menu { margin: 4px 4px 6px; }
  .ctx-in-menu .ctx-label { display: block; font-size: 11px; text-transform: uppercase;
    letter-spacing: .4px; color: var(--muted); font-weight: 600; margin: 2px 2px 4px; }
  .ctx-in-menu select { width: 100%; max-width: none; }
  .nav-sep.ctx-in-menu { display: block; }
}

/* Sehr schmale Geräte: nur das AIG-Zeichen, der Schriftzug braucht zu viel Platz. */
@media (max-width: 360px) {
  .brand-text { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .float-a,.float-b,.pulse,.ring,.row,.check,.hero-text,.hero-art,.feat { animation: none !important; }
}

/* Home-Symbol in der Navigation */
.nav-home { display: inline-flex; align-items: center; padding: 6px 12px; }
.nav-home svg { display: block; }
.cta-trust { margin: 14px 0 0; font-size: 12.5px; color: rgba(255,255,255,.85); }

/* Rechtsseiten – Feinschliff */
.legal-intro { font-size: 14px; color: var(--muted); line-height: 1.6; margin: 0 0 6px; }
.legal-stand { margin-top: 18px; font-size: 12px; color: var(--muted); font-style: italic; }
.legal ul { line-height: 1.6; }
.legal-cookie-table { margin: 12px 0; }
.legal-cookie-table th, .legal-cookie-table td { font-size: 13px; }

/* Cookie-Hinweis-Banner */
.cookie-note { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 200;
  max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(20,30,50,.18); padding: 12px 16px; font-size: 13px; color: var(--ink); }
.cookie-note a { color: var(--accent); }
.cookie-note .btn { white-space: nowrap; }
/* hidden-Attribut muss die display:flex-Regel überstimmen können */
.cookie-note[hidden] { display: none; }
.cookie-actions { display: flex; gap: 8px; white-space: nowrap; }

/* Konto löschen */
.danger-zone { margin-top: 20px; padding: 20px 22px; border-color: #f1c9c2; }
.danger-zone h2 { margin: 0 0 8px; font-size: 16px; color: var(--red); }
.danger-zone p { color: var(--muted); font-size: 13.5px; line-height: 1.55; margin: 0 0 12px; }
.danger-zone .auth-check { margin-bottom: 12px; }

/* Kontenrahmen & BU-Schlüssel */
.bu-head, .bu-row { display: grid; grid-template-columns: 110px 110px 1fr auto; gap: 10px; align-items: center; }
.bu-head { padding: 0 2px 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); border-bottom: 1px solid var(--line); }
.bu-row { padding: 6px 2px; border-bottom: 1px solid var(--line); }
.bu-row input { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 13px; }
.bu-row input:focus { outline: none; border-color: var(--accent); }
.bu-row input:disabled { background: #f3f5f8; color: var(--ink); border-color: transparent; }
.bu-add { margin-top: 12px; border-bottom: none; }
.kr-count { font-size: 12px; font-weight: 500; color: var(--muted); }
.kr-meta { font-size: 12px; font-weight: 500; color: var(--muted); }
.regel-def { padding: 8px 0; border-bottom: 1px solid var(--border); }
.regel-def:last-child { border-bottom: none; }
.regel-stufe { font-size: 11px; font-weight: 600; color: var(--accent); background: #eef2ff;
  padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.regel-indiv { font-size: 11px; font-weight: 600; color: #8a5a00; background: #fdf2dc;
  padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.regel-buchend { font-size: 11px; font-weight: 600; color: #155e75; background: #e0f2fe;
  padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.regel-key { font-size: 11px; color: var(--muted); margin-left: 6px; }
.regel-desc { font-size: 12px; color: var(--muted); margin: 2px 0 0; line-height: 1.35; }
.regel-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.regel-row:last-child { border-bottom: none; }
.regel-row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.regel-betriebe { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; }
.regel-betrieb { display: flex; flex-direction: column; gap: 3px; }
.regel-betrieb .rb-name { font-size: 11px; color: var(--muted); }
.regel-betrieb select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 13px; background: #fff; color: var(--ink); }
.regel-betrieb.rb-an select { border-color: #1f9d57; background: #eef9f1; }
.regel-betrieb.rb-aus select { border-color: #d0d4da; background: #f3f4f6; color: var(--muted); }
.ka-title-row { display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.ka-title-row .ka-title { margin: 0; }
.kr-search { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; min-width: 240px; background: #fff; color: var(--ink); }
.kr-search:focus { outline: none; border-color: var(--accent); }
.kr-scroll { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.kr-scroll table { margin: 0; }
.kr-scroll thead th { position: sticky; top: 0; background: var(--card); z-index: 1; }
.kr-no { white-space: nowrap; font-variant-numeric: tabular-nums; width: 90px; }

/* Kontext-Umschalter (Mitarbeiter/Berater) + acting-Banner */
.ctx-switch { margin: 0 6px 0 4px; }
.ctx-switch select { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit;
  font-size: 13px; background: #fff; max-width: 200px; }
.acting-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 16px;
  padding: 10px 14px; border: 1px solid #ecd6a8; border-left: 4px solid #b9791b; background: #fbf1de;
  border-radius: 10px; font-size: 14px; color: #5a4a2a; }
.acting-banner form { margin-left: auto; }
/* Vorschau-Leiste (sieht NUR der Berater): eine schlanke Zeile, der Knopf sitzt
   direkt neben dem Namen. Vorher nahm der Kasten am Handy ein Drittel der Seite
   und verdrängte das, was der Mandant sehen soll (Nils, 2026-08-03). */
.vorschau-leiste { padding: 8px 12px; font-size: 13.5px; line-height: 1.35; margin-bottom: 12px; }
.vorschau-leiste .vl-text { flex: 1 1 auto; min-width: 0; }
.vorschau-leiste form { margin-left: 0; flex: 0 0 auto; }

/* Testzugang-Hinweis (Limit / nur Vorschau) */
.testabo-note { margin: 0 0 16px; padding: 10px 14px; border: 1px solid #cfe0f5; border-left: 4px solid #2f4b7c;
  background: #eef4fc; border-radius: 10px; font-size: 13.5px; line-height: 1.5; color: #28405f; }

/* Hervorgehobener Rechtshinweis (AGB/Doku): kein Ersatz für Steuerberatung */
.legal-disclaimer { background: #fbf1de; border: 1px solid #ecd6a8; border-left: 4px solid #b9791b;
  border-radius: 10px; padding: 13px 16px; margin: 14px 0 6px; font-size: 14px; line-height: 1.55; color: #5a4a2a; }
.legal-disclaimer strong { color: #92611a; }

/* ---- Hilfe-System: Hilfeknopf (Sprechblase + Fragezeichen), Overlay, Willkommen ---- */
.help-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  padding: 0; border: 0; border-radius: 50%; background: var(--accent-soft, #eef2f8); color: var(--accent);
  cursor: pointer; vertical-align: middle; flex: none; transition: box-shadow .15s, background .15s; }
.help-btn svg { width: 20px; height: 20px; display: block; }
.help-btn:hover { box-shadow: 0 0 0 2px var(--accent); }
/* Kopf-Symbol im Hilfe-/Willkommens-Overlay (statt Foto). */
.help-head-ic { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft, #eef2f8);
  color: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.help-head-ic svg { width: 24px; height: 24px; display: block; }
.help-inline-ic { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border-radius: 50%; background: var(--accent-soft, #eef2f8); color: var(--accent); vertical-align: middle; }
.help-inline-ic svg { width: 11px; height: 11px; display: block; }
/* „lernen"-Button neben dem Zahler-Feld (erscheint nur bei manueller Änderung). */
.zlern-btn { margin-left: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--accent);
  background: #fff; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer;
  vertical-align: middle; white-space: nowrap; }
.zlern-btn:hover { background: var(--accent-soft, #eef2f8); }
.zlern-btn.done { border-color: var(--ok, #127a3a); color: var(--ok, #127a3a);
  background: var(--ok-soft, #eaf7ef); cursor: default; }
.help-overlay { position: fixed; inset: 0; background: rgba(20,28,45,.5); display: flex; align-items: center;
  justify-content: center; padding: 20px; z-index: 1000; }
/* WICHTIG: hidden-Attribut respektieren – sonst zeigt das Overlay dauerhaft (Author-CSS
   schlägt sonst die Standard-[hidden]-Regel). */
.help-overlay[hidden] { display: none; }
.help-card { background: #fff; border-radius: 16px; max-width: 520px; width: 100%; max-height: 86vh; overflow: auto;
  box-shadow: 0 24px 60px rgba(10,20,40,.35); padding: 22px 24px; position: relative; }
.welcome-card { max-width: 560px; }
.help-x { position: absolute; top: 8px; right: 12px; border: 0; background: none; font-size: 26px; line-height: 1;
  color: var(--muted); cursor: pointer; }
.help-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.help-head img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid #fff;
  box-shadow: 0 4px 12px rgba(20,30,60,.2); flex: none; }
.help-head strong { display: block; font-size: 16px; }
.help-head span { font-size: 12px; color: var(--muted); }
.help-body { font-size: 14px; line-height: 1.55; color: var(--ink); }
.help-body p { margin: 0 0 10px; }
.help-body ul, .help-body ol { margin: 0 0 10px; padding-left: 20px; }
.help-body li { margin: 4px 0; }
.help-body code { background: var(--soft,#eef2f8); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.help-body .help-note { background: var(--accent-soft,#eef2f8); border-radius: 8px; padding: 9px 11px;
  font-size: 13px; color: #3a4250; }
.help-inline-face { width: 18px; height: 18px; border-radius: 50%; vertical-align: middle; object-fit: cover; }
.help-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
/* gesperrte Profiloption (juristische Person → kein „Arbeitnehmer") */
.bs-check.is-disabled, label.is-disabled { opacity: .45; }
.bs-check small { color: var(--muted); font-weight: 400; }
.profil-set legend { display: flex; align-items: center; gap: 7px; }
/* Kleiner, unaufdringlicher Hilfeknopf neben Überschriften */
h1 .help-btn, h2 .help-btn, legend .help-btn, .page-head .help-btn { width: 26px; height: 26px; }

/* Sammel-Bearbeitung von Einstellungs-Listen (data-bulk) */
.bulk-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center;
  gap: 12px; justify-content: flex-end; margin-top: 14px; padding: 10px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 -2px 10px rgba(0,0,0,.06); }
.bulk-bar .bulk-info { margin-right: auto; font-size: 13px; color: var(--amber, #b9791b); font-weight: 600; }
.row-dirty { position: relative; }
.row-dirty::before { content: ""; position: absolute; left: -10px; top: 4px; bottom: 4px;
  width: 3px; border-radius: 2px; background: var(--amber, #b9791b); }
.bs-name.row-dirty::before, .row-dirty.src-row::before { left: 0; }

/* § 14 UStG – „USt prüfen"-Link am Rechnungskopf + Prüf-Checkliste */
.ust-warn { margin-left: 10px; font-size: 12px; font-weight: 700; color: var(--red, #c0392b);
  text-decoration: none; border-bottom: 1px dashed var(--red, #c0392b); }
.ust-warn:hover { opacity: .8; }
.ust-ok { margin-left: 10px; font-size: 12px; font-weight: 700; color: #1e7a39;
  text-decoration: none; border-bottom: 1px dashed #1e7a39; }
.ust-ok:hover { opacity: .8; }
.ust-pruef-card { background: #fff; border: 1px solid var(--line, #e3e3e3); border-radius: 12px;
  padding: 22px 24px; max-width: 900px; }
.ust-pruef-meta { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 14px; }
.ust-pruef-meta .lbl { display: block; font-size: 12px; color: var(--muted, #777); margin-bottom: 2px; }
.ust-pruef-meta strong { font-size: 15px; }
.ust-pruef-hint { background: #f3f7ff; border: 1px solid #d3e1fb; border-radius: 8px;
  padding: 10px 14px; font-size: 13px; color: #2c3e6b; }
.ust-pruef-status { border-radius: 8px; padding: 11px 14px; font-size: 14px; margin: 12px 0 16px; }
.ust-pruef-status.fehlt { background: #fdeceb; border: 1px solid #f3c2bd; color: #a3271b; }
.ust-pruef-status.ok { background: #ecf8ef; border: 1px solid #bfe6c8; color: #1e7a39; }
.ust-pruef-tab { width: 100%; border-collapse: collapse; }
.ust-pruef-tab th { text-align: left; font-size: 12px; color: var(--muted, #777);
  border-bottom: 2px solid var(--line, #e3e3e3); padding: 8px 10px; }
.ust-pruef-tab td { padding: 10px; border-bottom: 1px solid var(--line, #eee); vertical-align: top; font-size: 14px; }
.ust-pruef-tab .p14-label { width: 46%; }
.ust-pruef-tab .p14-wert { color: #333; }
.ust-pruef-tab tr.ist-fehlt { background: #fdf3f2; }
.ust-pruef-tab tr.nicht-pflicht td { color: var(--muted, #999); }
.p14-opt { font-size: 11px; color: var(--muted, #999); font-weight: normal; }
.hak { font-weight: 700; font-size: 13px; white-space: nowrap; }
.hak.ok { color: #1e7a39; }
.hak.fehlt { color: var(--red, #c0392b); }
.hak.opt { color: var(--muted, #999); font-weight: 500; }
.p14-btnform { display: inline; margin-left: 8px; }
.p14-geprueft { display: block; font-size: 11px; color: var(--muted, #777); margin-top: 3px; }
.ust-pruef-disclaimer { margin-top: 16px; font-size: 12px; color: var(--muted, #777); line-height: 1.5; }
.ust-pruef-meta .ust-pruef-doc { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ust-pruef-ig { background: #fbf3e2; border-color: #ecd6a8; color: #7a5310; }
/* Beleg-Vorschau zum Aufklappen (auch außerhalb des Posteingangs nutzbar) */
.ust-pruef-card .pe-preview { margin: 6px 0 2px; }
.pe-preview > summary { cursor: pointer; font-size: 13px; color: var(--accent, #2f4b7c); font-weight: 600; width: max-content; }
.pe-frame { margin-top: 10px; border: 1px solid var(--line, #e6e9ee); border-radius: 8px; overflow: hidden; }
.pe-frame iframe { display: block; width: 100%; height: 520px; border: 0; background: #fff; }

/* Kanonische Rückmeldungen (einheitlich für alle Seiten): grüne Erfolgs- bzw. rote
   Fehlermeldung. Löst nach und nach die verschiedenen Ad-hoc-Varianten ab
   (.pe-ok/.pe-fehler/.flash-ok/.auth-ok/.import-feedback …) – gleiche Optik überall. */
.flash { display: block; margin: 0 0 14px; padding: 10px 14px; border-radius: 8px; font-size: 14px; }
.flash.ok { background: var(--ok-soft, #eaf7ef); color: var(--ok, #127a3a); border: 1px solid #bfe6cf; }
.flash.err { background: var(--err-soft, #fdecec); color: var(--err, #b00020); border: 1px solid #f3c2c2; }

/* ============ Responsiv: Tablet & Handy ============ */

/* Tablet und schmaler: breite Tabellen scrollen IM weißen Kasten statt die ganze
   Seite quer zu schieben (auf Touch-Geräten deutlich angenehmer; die Kopfleiste
   bleibt so immer im Bild). Am PC (>1080px) gilt weiter: der Kasten wächst mit. */
@media (max-width: 1080px) {
  .card:has(> table) { width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; }
  /* Knopfleiste am Betriebs-Kopf (Betriebe-Seite): darf schrumpfen und umbrechen –
     das feste flex:none der PC-Ansicht würde sonst über den Rand laufen. */
  .bs-head { flex-wrap: wrap; }
  .bs-head-actions { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
  /* Hilfe-Tooltip: auf dem PC ist er nur per visibility:hidden versteckt und
     nimmt trotzdem Layoutbreite ein → erzeugt auf Handy/iPad Querscroll.
     Deshalb hier komplett ausblenden, erst bei Berührung/Fokus einblenden,
     und nie breiter als der Schirm. */
  .help::after { display: none; width: min(280px, 76vw); }
  .help:hover::after, .help:focus::after { display: block; }
}

/* Handy: Innenabstände, Raster und Formulare auf schmale Schirme anpassen. */
@media (max-width: 760px) {
  .container { padding: 16px 14px 60px; }
  h1 { font-size: 18px; }

  /* Kennzahlen (Dashboard) und Zähler-Boxen (Zuordnung/Kontierung …) einheitlich:
     kompakte Chips (Zahl und Beschriftung nebeneinander), alle GLEICH BREIT im
     2-Spalten-Raster über die volle Seitenbreite; eine letzte ungerade Box
     bekommt die ganze Zeile. Die Farben der Zahlen bleiben erhalten. */
  .dash-metrics, .stats { display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 6px; width: 100%; }
  .dash-metrics .metric, .stats .stat { display: flex; align-items: baseline;
    justify-content: center; gap: 7px; min-width: 0; padding: 7px 10px; }
  .dash-metrics .metric:last-child:nth-child(odd),
  .stats .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .dash-metrics .metric .num, .stats .stat .num { font-size: 17px; white-space: nowrap; }
  .dash-metrics .metric .lbl, .stats .stat .lbl { font-size: 10px; letter-spacing: .3px; white-space: nowrap; }

  /* Eingaben mit 16px Schrift: verhindert das automatische Heranzoomen von iOS
     beim Antippen eines Feldes (zoomt bei Schriften unter 16px). */
  select, input[type="text"], input:not([type]), input[type="email"],
  input[type="password"], input[type="number"], input[type="date"], textarea {
    font-size: 16px;
  }

  /* Zweispaltige Raster werden einspaltig. */
  .auth-grid { grid-template-columns: 1fr; }
  .legend { grid-template-columns: 1fr; }

  /* Einstellungs-Listen (Kostenarten, Kontenrahmen/BU, Preismodelle): Zeilen
     stapeln sich, die Spaltenkopfzeile entfällt. */
  .ka-grid-head, .pm-head, .bu-head { display: none; }
  .ka-row, .pm-row { grid-template-columns: 1fr; gap: 6px; padding: 10px 2px; }
  .bu-row { grid-template-columns: 90px 90px 1fr; gap: 8px; padding: 10px 2px; }
  .ka-act { justify-content: flex-start; }

  /* Artikelzeile in der Bestellkarte: Betrieb-Auswahl rutscht unter den Titel
     (62px Einzug = Bildbreite + Abstand, damit sie bündig zum Titel steht). */
  .item-row { flex-wrap: wrap; }
  .item-assign { flex-basis: calc(100% - 62px); margin-left: 62px; }
  .item-assign .sel-purpose { width: 100%; }


  /* Cookie-Hinweis: Knöpfe dürfen unter den Text rutschen. */
  .cookie-note { flex-wrap: wrap; }
  .cookie-actions { margin-left: auto; }

  /* Karten und Formulare: etwas kompaktere Innenabstände. */
  .auth-card { padding: 20px 16px; }
  .ust-pruef-card { padding: 16px 14px; }
  .bs-name { min-width: 0; width: 100%; }
  .bs-head { flex-wrap: wrap; }

  /* Werkzeugleiste (Filter/Sortierung): Felder in voller Breite stapeln. */
  .toolbar { gap: 10px; }
  .tool { flex: 1 1 45%; }
  .tool select { min-width: 0; width: 100%; }
  .tool-result { flex-basis: 100%; margin-left: 0; }

  /* Beleg-Vorschau (eingebettete PDF-Ansicht) etwas niedriger. */
  .pe-frame iframe { height: 60vh; }
}

/* Wiedererkennungs-Foto im Seitenkopf (gleiches Bild wie die Landing-Karte) */
.seitenbild { width: 200px; height: 76px; object-fit: cover; border-radius: 12px;
  border: 1px solid var(--line); box-shadow: var(--shadow); flex: none; align-self: center; }
@media (max-width: 900px) { .seitenbild { display: none; } }

/* Kopf-Banner: Wiedererkennungs-Foto vollflächig HINTER Titel/Untertitel/Kennzahlen
   (Nils, 2026-07-19). Heller Verlaufs-Schleier (links stärker) hält den Text lesbar. */
.page-head.mit-banner { position: relative; border-radius: 14px; overflow: hidden;
  padding: 22px 24px 18px; border: 1px solid var(--line); background: var(--card); }
.page-head.mit-banner > * { position: relative; z-index: 2; }
.page-head.mit-banner .seitenbild { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border: 0; border-radius: 0; box-shadow: none; z-index: 0; display: block; }
.page-head.mit-banner::after { content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg, rgba(246,247,249,.95) 0%, rgba(246,247,249,.85) 45%, rgba(246,247,249,.45) 100%); }
@media (max-width: 900px) { .page-head.mit-banner .seitenbild { display: block; } }

/* Nachricht des Mandanten aus einer Beleg-Mail (Nils, 2026-08-02): muss auffallen
   und ausdrücklich zur Kenntnis genommen werden – deshalb Warnfarbe, ganz oben. */
.mitteilung { border-left: 4px solid var(--warn); background: var(--warn-soft); }
.mt-kopf { display: flex; gap: 10px; align-items: flex-start; }
.mt-icon { font-size: 18px; line-height: 1.2; color: var(--warn); }
.mt-meta { font-size: 12px; color: var(--muted); }
.mt-kurz { margin: 10px 0 6px; font-size: 15px; }
.mt-hinweise { margin: 6px 0 10px 18px; font-size: 13.5px; }
.mt-hinweise li { margin: 3px 0; }
.mt-original { margin: 6px 0 10px; font-size: 13px; }
.mt-original summary { cursor: pointer; color: var(--muted); }
.mt-original pre { margin: 6px 0 0; padding: 8px 10px; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; white-space: pre-wrap; font-family: inherit; font-size: 13px; }
.mt-form { margin: 0; }

/* Bearbeitungsstand je Rechnung in der Kontierung (Nils, 2026-08-02): grüne
   „fertig"- bzw. bernsteinfarbene „offen"-Plakette am Rechnungskopf; dazu der
   Filter „Bearbeitungsstand" in der Werkzeugleiste. */
.grp-fertig { color: var(--ok, #127a3a); font-weight: 600; font-size: 12px; white-space: nowrap; }
.grp-offen { color: var(--warn, #b7791f); font-weight: 600; font-size: 12px; white-space: nowrap; }

/* Wegweiser auf leerer Kontierungsseite: Belege warten in der Zuordnung auf die
   Übernahme (Nils, 2026-08-02). Freundlicher grüner Akzent statt „leer". */
.uebernahme-hinweis { border-left: 4px solid var(--ok, #1f9d63); background: #f2f9f4; }
.uebernahme-hinweis p { margin: 0; }
