/* App-Muster: Auth, Shell, Listen, Drawer, Belege.
   Farbe trägt Bedeutung – alles andere bleibt monochrom. */

/* ---------------------------------------------------------------- Auth (Setup + Login) */

.auth-zentriert {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-karte {
  width: 100%;
  max-width: 380px;
  padding: 32px;
}

.wortmarke { font-size: 17px; color: var(--ink); white-space: nowrap; }
.wortmarke strong { font-weight: 600; }
.wortmarke span { color: var(--gray-500); font-weight: 400; }

.auth-karte .claim {
  color: var(--gray-500);
  margin: 4px 0 28px;
  font-size: 13px;
}

.formular-stapel { display: flex; flex-direction: column; gap: 16px; }
.formular-stapel .btn { margin-top: 8px; }

.formular-zeile {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
/* Gleiche Höhe für nebeneinanderstehende Felder. */
.formular-zeile .field .input:not(textarea) { height: 40px; }

.formular-fehler {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
}

.formular-hinweis {
  background: var(--success-bg);
  color: var(--success-text);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
}

.auth-titel { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.auth-untertitel { color: var(--gray-500); font-size: 13px; margin: -12px 0 16px; }

/* ---------------------------------------------------------------- Shell */

.shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.seitenleiste {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px 12px 16px;
}

.seitenleiste .wortmarke { font-size: 14px; padding: 0 10px 18px; }
.seitenleiste .wortmarke span { display: block; font-size: 11px; margin-top: 1px; }

/* Kopf und Fuß bleiben stehen; reicht die Höhe nicht, rollt das Menü dazwischen. */
.seitenleiste > * { flex-shrink: 0; }
.seitenleiste nav {
  display: flex; flex-direction: column; gap: 2px; flex: 1 1 0; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #D2D2D7 transparent;
  margin: 0 -12px; padding: 0 12px 8px;
}
.seitenleiste nav > * { flex-shrink: 0; }

.nav-punkt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--gray-600);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
}
.nav-punkt .icon { color: var(--gray-500); flex-shrink: 0; }
.nav-gruppe { font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray-400); padding: 14px 12px 4px; }
.nav-punkt:hover { background: rgba(0, 0, 0, 0.04); text-decoration: none; color: var(--ink); }
.nav-punkt.aktiv { background: var(--accent-bg); color: var(--accent); }
.nav-punkt.aktiv .icon { color: var(--accent); }

.seitenleiste-fuss {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.seitenleiste-fuss .benutzer {
  min-width: 0;
  font-size: 12.5px;
  color: var(--gray-500);
  padding-left: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-leise {
  background: none;
  border: none;
  color: var(--gray-500);
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
}
.btn-leise:hover { background: rgba(0, 0, 0, 0.05); color: var(--ink); }

.inhalt { flex: 1; min-width: 0; }
.inhalt-innen {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 40px 96px;
}

.seiten-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.seiten-kopf h1 { font-size: 19px; letter-spacing: -0.01em; }
.seiten-kopf .unterzeile,
.beleg-kopf .unterzeile { color: var(--gray-500); font-size: 13px; margin-top: 2px; }
.seiten-kopf > div:first-child { min-width: 0; }
.seiten-kopf h1 { overflow-wrap: anywhere; }
.seiten-kopf .aktionen { display: flex; gap: 8px; flex-shrink: 0; }

/* Beleg-Vollseite: Navigation tritt zurück */
.beleg-kopf {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.beleg-kopf .zurueck {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--gray-600);
  cursor: pointer;
}
.beleg-kopf .zurueck:hover { border-color: var(--gray-400); text-decoration: none; }
.beleg-kopf h1 { font-size: 19px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.beleg-kopf .zurueck { flex-shrink: 0; }

/* Telefon: Aktionen rutschen unter den Titel statt ihn zu quetschen. */
@media (max-width: 560px) {
  .seiten-kopf { flex-wrap: wrap; }
  .seiten-kopf .aktionen { flex-wrap: wrap; }
  .beleg-kopf { flex-wrap: wrap; row-gap: 10px; }
  .beleg-kopf h1 { flex-basis: calc(100% - 46px); }
}

/* ---------------------------------------------------------------- Abschnitte & Tabellen */

.abschnitt { margin-bottom: 32px; }
.abschnitt-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  margin-bottom: 8px;
}

.tabelle-karte { overflow: hidden; }
.tabelle-scroll { overflow-x: auto; }

table.tabelle { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabelle th {
  text-align: left;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-400);
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tabelle td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tabelle th:first-child, .tabelle td:first-child { padding-left: 20px; }
.tabelle th:last-child, .tabelle td:last-child { padding-right: 20px; }
.tabelle tbody tr:last-child td { border-bottom: none; }
.tabelle tbody tr.klickbar { cursor: pointer; }
.tabelle tbody tr.klickbar:hover { background: rgba(0, 0, 0, 0.02); }
.tabelle tbody tr.klickbar:focus-visible,
.tabelle tbody tr.klickbar:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.tabelle th.num, .tabelle td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle .neben { color: var(--gray-500); font-size: 12.5px; margin-top: 1px; white-space: normal; }
.tabelle .gedimmt { opacity: 0.55; }
/* Kurze Angaben wie die Dokumentart brechen nicht mitten im Wort um; der Titel nimmt den Rest. */
.tabelle td.fest, .tabelle th.fest { white-space: nowrap; }

/* Sekundärspalten treten auf dem Telefon zurück statt die Tabelle zu quetschen;
   .nur-mobil holt die wichtigste davon als Nebenzeile zurück. */
.nur-mobil { display: none; }
@media (max-width: 560px) {
  .tabelle .mobil-weg { display: none; }
  .tabelle .nur-mobil { display: block; }
  .tabelle th, .tabelle td { padding-left: 8px; padding-right: 8px; }
  .tabelle th:first-child, .tabelle td:first-child { padding-left: 14px; }
  .tabelle th:last-child, .tabelle td:last-child { padding-right: 14px; }
  /* 27 px hohe Knöpfe trifft man mit dem Daumen schlecht. */
  .btn-klein { padding: 9px 14px; }
}

.leer {
  padding: 44px 24px;
  text-align: center;
  color: var(--gray-500);
  font-size: 13.5px;
}
.leer a { font-weight: 500; }

/* ---------------------------------------------------------------- Stammdaten (Kundendetail) */

.stammdaten-zeile {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 16px;
  padding: 6px 0;
}
.stammdaten-zeile .micro-label { padding-top: 2px; }
@media (max-width: 560px) {
  .stammdaten-zeile { grid-template-columns: 1fr; gap: 2px; padding: 8px 0; }
}

/* ---------------------------------------------------------------- Drawer */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 29, 31, 0.32);
  z-index: 40;
  animation: einblenden 140ms ease;
}
/* Zentrierter Dialog (Anlegen/Bearbeiten) */
.drawer {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
  z-index: 50;
  display: flex;
  flex-direction: column;
  animation: aufsteigen 160ms cubic-bezier(0.25, 0.8, 0.4, 1);
}
@keyframes aufsteigen { from { transform: translate(-50%, calc(-50% + 12px)); opacity: 0; } }
@keyframes einblenden { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-overlay { animation: none; }
}
@keyframes aufsteigen-mobil { from { transform: translateY(16px); opacity: 0; } }
@media (max-width: 560px) {
  /* Auf dem Telefon als Bottom-Sheet */
  .drawer {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: auto;
    max-height: calc(100dvh - 40px);
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
    animation-name: aufsteigen-mobil;
  }
  /* Der Home-Indicator des iPhones liegt sonst auf den Knöpfen. */
  .drawer-fuss { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}

.drawer-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line);
}
.drawer-kopf h2 { font-size: 15px; }
.drawer-koerper { flex: 1; overflow-y: auto; padding: 20px 24px; }
.drawer-fuss {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------------- Formulare */

select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236E6E73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
textarea.input { resize: vertical; min-height: 72px; line-height: 1.45; }

.schalter { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; user-select: none; }
.schalter input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }

.segment {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}
.segment button {
  border: none;
  background: none;
  padding: 7px 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
}
.segment button + button { border-left: 1px solid var(--line); }
.segment button.aktiv { background: var(--accent-bg); color: var(--accent); }

/* Eingabefelder zeigen den Fokus über Rand und Ring (base.css) – eine zusätzliche Kontur
   doppelte den Rahmen nur. */
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- Mobile: Kopfleiste + einschiebbare Navigation */

.mobil-kopf { display: none; }
.nav-overlay { display: none; }

@media (max-width: 820px) {
  .mobil-kopf {
    display: flex;
    align-items: center;
    gap: 4px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: calc(4px + env(safe-area-inset-top)) 12px 4px;
  }
  .mobil-kopf .wortmarke { font-size: 14px; }
  .mobil-kopf .btn-leise { padding: 10px; }

  .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(29, 29, 31, 0.32);
    z-index: 58;
    animation: einblenden 140ms ease;
  }
  .nav-overlay[hidden] { display: none; }

  /* Die Seitenleiste wird zum einschiebbaren Menü */
  .seitenleiste {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: min(280px, 84vw);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 200ms cubic-bezier(0.25, 0.8, 0.4, 1);
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .seitenleiste.offen {
    transform: translateX(0);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  }
  body.nav-offen { overflow: hidden; }

  .inhalt-innen { padding: calc(62px + env(safe-area-inset-top)) 16px calc(48px + env(safe-area-inset-bottom)); }
  .formular-zeile { grid-template-columns: 1fr; }

  /* iOS zoomt bei Eingabefeldern unter 16px automatisch in die Seite –
     auf dem Telefon bekommen Felder deshalb exakt 16px. */
  .input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .seitenleiste { transition: none; }
  .nav-overlay { animation: none; }
}

/* ---- Archiv */

/* Betrieb (Name oder Logo) unter der Wortmarke */
.seitenleiste .betrieb {
  padding: 0 10px 16px;
  margin-top: -8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--gray-600);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seitenleiste .betrieb img { max-height: 32px; max-width: 100%; display: block; }

.auth-spalte { width: 100%; max-width: 380px; }
.auth-spalte .auth-karte { max-width: none; }
.auth-betrieb {
  margin-bottom: 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.auth-betrieb img { max-height: 48px; max-width: 100%; display: block; }
.auth-karte .wortmarke { margin-bottom: 24px; }
/* Mit Claim rückt er dicht an die Wortmarke und hält selbst den Abstand zum Formular. */
.auth-karte .wortmarke:has(+ .claim) { margin-bottom: 0; }

/* Formularkarten der Einstellungen */
.karte-formular { padding: 20px 24px 24px; }
.formular-aktionen { display: flex; justify-content: flex-end; gap: 8px; }
.abgesetzt { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }

.logo-zeile {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.logo-vorschau {
  width: 120px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--surface);
}
.logo-vorschau img { max-width: 100%; max-height: 52px; display: block; }
.logo-zeile label.btn { cursor: pointer; }
.karte-formular > .neben { color: var(--gray-500); font-size: 12.5px; margin: 12px 0 0; }

.karte-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 20px;
  color: var(--ink);
}
.karte-link:hover { text-decoration: none; border-color: var(--gray-400); }

/* Einstellungen „Dieser Rechner“: je Zeile Aufgabe, Erklärung, Knopf */
.rechner-zeile { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; border-top: 1px solid var(--line); }
.rechner-zeile:first-child { border-top: 0; padding-top: 0; }
.rechner-zeile:last-child { padding-bottom: 0; }
.rechner-zeile .btn { flex-shrink: 0; min-width: 140px; justify-content: center; }
@media (max-width: 560px) {
  .rechner-zeile { flex-direction: column; align-items: stretch; gap: 10px; }
}
.auth-rechner { margin: 16px 0 0; text-align: center; color: var(--gray-500); font-size: 12.5px; }
.karte-link .neben { color: var(--gray-500); font-size: 12.5px; }

/* Suchleiste über Listen */
.suchleiste {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.suchfeld { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.suchfeld svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; }
.suchfeld .input { padding-left: 36px; width: 100%; }
.suchfeld .input::-webkit-search-cancel-button { cursor: pointer; }
.tabelle .nummer { color: var(--gray-500); font-variant-numeric: tabular-nums; white-space: nowrap; }

.stammdaten-karte { padding: 16px 20px; }
.stammdaten-karte > .neben { color: var(--gray-500); font-size: 13px; }
.drawer-fuss .btn-gefahr { margin-right: auto; color: var(--danger-text); }

/* CSV-Import */
.import-summe { font-size: 15px; font-weight: 600; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.import-meldungen { border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.import-meldungen ul { margin: 6px 0 0; padding-left: 0; list-style: none; max-height: 220px; overflow-y: auto; }
.import-meldungen li { padding: 2px 0; }
.import-meldungen .nummer { color: inherit; opacity: 0.75; margin-right: 6px; font-variant-numeric: tabular-nums; }
.import-fehler { background: var(--danger-bg); color: var(--danger-text); }
.import-warnung { background: var(--muted-bg); color: var(--gray-600); }
.pflicht { font-size: 11px; color: var(--accent); margin-left: 6px; }
.tabelle-kompakt td, .tabelle-kompakt th { white-space: nowrap; }
.karte-formular .neben { color: var(--gray-500); font-size: 12.5px; margin: 0; }
.formular-stapel > .segment { align-self: flex-start; }

/* ---------------------------------------------------------------- Erfassen */

.erfassen-knoepfe { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.gross-knopf {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 112px; padding: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  font-weight: 600; font-size: 15px; color: var(--ink); cursor: pointer; text-align: center;
}
.gross-knopf .icon { width: 28px; height: 28px; color: var(--accent); }
.gross-knopf:hover { border-color: var(--gray-400); }
.gross-knopf:active { background: var(--accent-bg); }
.ablage-flaeche {
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 22px;
  text-align: center; color: var(--gray-500); font-size: 13px; margin-bottom: 12px;
}
.ablage-flaeche.aktiv { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.stapel-karte { margin-bottom: 12px; }
.stapel-karte .abschnitt-kopf { margin-bottom: 12px; }
.stapel-karte label.btn { cursor: pointer; }
.foto-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.foto-kachel { position: relative; aspect-ratio: 3 / 4; border-radius: 6px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.foto-kachel img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-ersatz { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 12px; color: var(--gray-500); }
.foto-weg {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%;
  border: none; background: rgba(0, 0, 0, 0.55); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.datei-zeile { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.datei-zeile:first-of-type { border-top: none; }
.datei-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.datei-zeile .neben, .ergebnis-zeile .neben { color: var(--gray-500); font-size: 12.5px; }

.chip-liste { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; min-height: 34px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  font: inherit; font-size: 13px; color: var(--ink); cursor: pointer;
}
.chip:hover { border-color: var(--gray-400); }
.chip.aktiv { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--accent); font-weight: 500; }
.chip-neben { color: var(--gray-500); font-size: 11.5px; }
.chip-titel { margin: 12px 0 6px; }
.titel-feld { margin-top: 16px; }

.zuordnung .segment { margin-bottom: 14px; }
.gewaehlt { display: flex; align-items: center; gap: 8px; }
.gewaehlt .btn-leise { font-size: 13px; color: var(--accent); }

.erfassen-fuss { display: flex; justify-content: flex-end; margin: -8px 0 24px; }
.btn-gross { min-height: 48px; padding: 0 28px; font-size: 15px; }
.ergebnis-karte { padding: 4px 20px; margin-bottom: 32px; }
.ergebnis-zeile { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ergebnis-zeile:first-child { border-top: none; }
.ergebnis-status { text-align: right; font-size: 13px; }
.fortschritt { width: 160px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.fortschritt div { height: 100%; background: var(--accent); transition: width 0.2s; }
.fehler-text { color: var(--danger-text); }
.hinweis-doppelt { color: var(--gray-600); font-size: 12.5px; margin-top: 2px; }

/* Runder Erfassen-Knopf – nur mobil, nicht auf der Erfassen-Seite selbst */
.erfassen-fab { display: none; }
@media (max-width: 820px) {
  .erfassen-fab {
    display: flex; position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
    bottom: calc(18px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border-radius: 50%;
    background: var(--ink); color: #fff; align-items: center; justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  }
  .erfassen-fab .icon { width: 26px; height: 26px; color: #fff; }
  .auf-erfassen .erfassen-fab, .nav-offen .erfassen-fab { display: none; }
  .inhalt-innen { padding-bottom: 96px; }
  .nur-desktop { display: none; }
}
@media (max-width: 560px) {
  .erfassen-knoepfe { gap: 8px; }
  .erfassen-fuss .btn-gross { width: 100%; }
}
.ablegen-overlay {
  position: fixed; inset: 0; z-index: 70; background: rgba(44, 62, 107, 0.12);
  border: 3px dashed var(--accent); display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.ablegen-overlay div { background: var(--card); padding: 14px 22px; border-radius: var(--radius); font-weight: 600; color: var(--accent); }
.ablegen-overlay[hidden] { display: none; }

/* ---------------------------------------------------------------- Posteingang & Dokument */

.nav-zahl {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
}
.nav-zahl[hidden] { display: none; }
.seiten-hinweis { margin-bottom: 20px; }
.hinweis-neutral { background: var(--muted-bg); color: var(--gray-600); }
.posteingang-titel { font-weight: 500; }
.tabelle td .neben { color: var(--gray-500); font-size: 12.5px; }
.pfeil { color: var(--gray-400); font-size: 20px; }

.vorschau-rahmen {
  width: 100%; height: 78vh; min-height: 480px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); display: block;
}
.btn-gefahr-text { color: var(--danger-text); }
.karte-formular > .neben:first-child { margin-top: 0; }
.protokoll-eintrag { padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.protokoll-eintrag:first-child { border-top: none; padding-top: 0; }
.protokoll-eintrag .neben { color: var(--gray-500); margin-left: 6px; }
.protokoll-details { color: var(--gray-600); margin-top: 2px; line-height: 1.6; }
.beleg-kopf .aktionen { display: flex; gap: 8px; }

.vorschau-bilder { display: flex; flex-direction: column; gap: 12px; max-height: none; }
.vorschau-bilder img { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: block; }
.mehr-laden { display: flex; justify-content: center; margin-top: 12px; }
.karten-hinweis { color: var(--gray-500); font-size: 12.5px; margin: 8px 2px 0; }
.zuordnung { display: flex; flex-direction: column; gap: 18px; }
.zuordnung-teil { display: flex; flex-direction: column; gap: 8px; }
.zuordnung-teil .chip-titel { margin: 2px 0 0; color: var(--gray-500); font-size: 12px; }

/* ---------------------------------------------------------------- Suche */

.seiten-suche { position: relative; margin: 0 2px 14px; }
.seiten-suche .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--gray-400); width: 15px; height: 15px; pointer-events: none; }
.seiten-suche .input { width: 100%; padding-left: 32px; height: 34px; font-size: 13px; background: var(--card); }
.mobil-suche { margin-left: auto; }

.start-suche { display: flex; gap: 8px; margin: 8px 0 24px; }
.start-suche .input { flex: 1; height: 52px; font-size: 16px; padding: 0 18px; }
.start-suche .btn { height: 52px; padding: 0 22px; }
.such-kopf { margin-bottom: 12px; }

.such-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.such-filter .input { height: 36px; width: auto; min-width: 0; font-size: 13px; }
.such-datum { display: inline-flex; align-items: center; gap: 6px; }
.such-datum .neben { color: var(--gray-500); font-size: 12.5px; }
.such-zahl { color: var(--gray-500); font-size: 12.5px; margin: 0 2px 10px; min-height: 18px; }

.treffer-karte { padding: 0; overflow: hidden; }
.treffer { display: flex; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); color: var(--ink); }
.treffer:first-child { border-top: none; }
.treffer:hover { background: var(--surface); text-decoration: none; }
.treffer-bild { width: 56px; height: 72px; flex-shrink: 0; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.treffer-ohne { display: flex; align-items: center; justify-content: center; color: var(--gray-400); }
.treffer-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.treffer-titel { font-weight: 500; }
.treffer-meta { color: var(--gray-500); font-size: 12.5px; }
.treffer-ausschnitt { color: var(--gray-600); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.treffer-ausschnitt mark { background: #fff1b8; color: inherit; padding: 0 1px; border-radius: 2px; }

.ocr-hinweis { margin-bottom: 16px; padding: 10px 14px; border-radius: var(--radius); background: var(--muted-bg); color: var(--gray-600); font-size: 13px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ocr-fehler { background: var(--danger-bg); color: var(--danger-text); }
.vorschau-seiten img { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }

@media (max-width: 820px) {
  .seiten-suche { display: none; }
  .start-suche .btn { display: none; }
}
@media (max-width: 560px) {
  .such-filter .input { flex: 1 1 140px; }
  .such-datum { flex: 1 1 140px; }
  .such-datum .input { flex: 1; }
  .treffer { padding: 12px 14px; gap: 12px; }
}
/* iOS vergrößert die Seite, sobald ein Feld unter 16 px angetippt wird. */
@media (max-width: 820px) {
  .such-filter .input, .seiten-suche .input { font-size: 16px; }
  .such-datum { flex: 1 1 100%; }
}

/* ---------------------------------------------------------------- Vorschläge */

.vorschlag-hinweis { font-size: 12.5px; color: var(--danger-text); background: var(--danger-bg); border-radius: 6px; padding: 6px 10px; }

/* ---------------------------------------------------------------- Verknüpfungen, Aufteilen */

.verknuepfungen { padding: 12px 16px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.verknuepfung { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.verknuepfung .micro-label { min-width: 90px; }
.verknuepfung-liste { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.trenn-liste { display: flex; flex-direction: column; gap: 6px; }
.trenn-seite { width: 100%; border: 1px solid var(--line); border-radius: 6px; display: block; }
.trennstelle { border: 1.5px dashed var(--line); background: none; border-radius: 6px; padding: 8px; color: var(--gray-500); font: inherit; font-size: 12.5px; cursor: pointer; }
.trennstelle:hover { border-color: var(--gray-400); color: var(--ink); }
.trennstelle.aktiv { border-style: solid; border-color: var(--accent); background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.integritaet-liste { margin: 0; padding-left: 18px; font-size: 13px; }
.loeschen-fuss { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.loeschen-fuss .neben { color: var(--gray-500); font-size: 12.5px; }

/* ---------------------------------------------------------------- Original | Text, Inhalt */

.ocr-text-karte { padding: 14px 18px; }
.ocr-text-kopf { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.ocr-text-kopf .neben { color: var(--gray-500); font-size: 12.5px; }
.ocr-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55; color: var(--ink); max-height: 75vh; overflow-y: auto; }
.ocr-text mark { background: #fff1b8; color: inherit; padding: 0 1px; border-radius: 2px; }
.positionen-eingabe { display: flex; flex-direction: column; gap: 8px; }
.position-zeile { display: grid; grid-template-columns: 1fr 2.2fr 0.8fr 0.8fr 1fr 1fr auto; gap: 6px; align-items: center; }
.position-zeile .input { padding: 7px 8px; font-size: 13px; min-width: 0; }
@media (max-width: 720px) {
  .position-zeile { grid-template-columns: 1fr 1fr 1fr auto; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .position-zeile [data-p=text] { grid-column: 1 / -1; order: -1; }
  .position-zeile .input { font-size: 16px; } /* iOS zoomt sonst beim Antippen hinein */
}

/* ---------------------------------------------------------------- Dokumentseite
   Links die Angaben als Karten, rechts die Vorschau: Sie bleibt beim Scrollen stehen und blättert in sich.
   Am Handy steht die Vorschau oben (zum Wischen), die Aktionen als Leiste unten. */

.beleg-titel { flex: 1; min-width: 0; }
.beleg-titel h1 { font-size: 19px; overflow-wrap: anywhere; }
.btn-text { border: none; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.btn-text:hover { text-decoration: underline; }
.btn-text:disabled { color: var(--gray-400); cursor: default; text-decoration: none; }

.dok-raster { display: grid; grid-template-columns: minmax(340px, 460px) minmax(0, 1fr); gap: 24px; align-items: start; }
.dok-angaben { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dok-angaben > [data-meldung]:empty, .dok-angaben > [data-aufgaben]:empty { display: none; }
.dok-karte-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 18px 0; }
.dok-karte-kopf h2 { font-size: 13.5px; font-weight: 600; margin: 0; }
.dok-karte-kopf .neben { color: var(--gray-500); font-size: 12px; text-align: right; }
.dok-karte-inhalt { padding: 12px 18px 16px; }
.dok-karte-inhalt.formular-stapel { gap: 14px; }
.dok-karte .stammdaten-zeile { grid-template-columns: 132px minmax(0, 1fr); gap: 12px; }
.dok-karte .aufgaben-liste { margin-top: 6px; }
.dok-karte .aufgabe-zeile { padding: 12px 18px; }
.verknuepfungen.dok-karte { padding: 12px 18px; margin: 0; }
.notiz-auf { align-self: flex-start; font-size: 13px; }

/* Menü „Mehr“ */
.mehr { position: relative; }
.mehr-menue {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 240px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}
.mehr-menue[hidden] { display: none; }
.mehr-menue hr { border: none; border-top: 1px solid var(--line); margin: 6px 4px; }
.mehr-eintrag {
  display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 9px 10px; border: none; border-radius: 6px;
  background: none; font: inherit; font-size: 14px; color: var(--ink); text-align: left; cursor: pointer;
}
.mehr-eintrag:hover, .mehr-eintrag:focus-visible { background: var(--sidebar); outline: none; }
.mehr-eintrag .neben { margin-left: auto; color: var(--gray-400); font-size: 12px; }
.mehr-eintrag.gefahr { color: var(--danger-text); }

/* Vorschläge stehen im Feld */
.input.ist-vorschlag { border-color: #C9D1E3; background: #FBFCFE; }
.vorschlag-markierung { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--accent); }
.vorschlag-markierung::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.vorschlag-markierung .neben { color: var(--gray-500); }
.vorschlag-neu-anlegen { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.vorschlag-neu-anlegen .neben { color: var(--gray-500); }
[data-vorschlag-extra] .vorschlag-hinweis { margin-top: 12px; }

/* Zuordnung kompakt: Liste erst beim Klick ins Feld */
.zuordnung-suche { position: relative; }
.zuordnung-auswahl {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; max-height: 300px; overflow-y: auto; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
}
.zuordnung-auswahl[hidden] { display: none; }
.auswahl-titel { padding: 6px 10px 4px; font-size: 12px; color: var(--gray-500); }
.auswahl-eintrag {
  display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 8px 10px; border: none; border-radius: 6px;
  background: none; font: inherit; font-size: 14px; color: var(--ink); text-align: left; cursor: pointer;
}
.auswahl-eintrag:hover, .auswahl-eintrag:focus-visible { background: var(--sidebar); outline: none; }
.auswahl-eintrag .neben { color: var(--gray-400); font-size: 12px; }

/* Inhalt: Kacheln, Zeilen, aufklappbare Positionen */
.eckdaten { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.eckdaten > div { background: var(--card); padding: 10px 12px; min-width: 0; }
.eckdaten > .breit { grid-column: 1 / -1; }
.eckwert { margin-top: 3px; font-weight: 500; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.eckdaten-betrag { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.eckdaten-betrag .eckwert { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.eckdaten-betrag .neben { color: var(--gray-500); font-size: 12px; text-align: right; line-height: 1.45; }
.inhalt-zeilen { margin-top: 10px; }
.aufklapper { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 12px 0 0; border: none; background: none; font: inherit; font-size: 13.5px; color: var(--gray-600); cursor: pointer; }
.aufklapper:hover { color: var(--ink); }
.aufklapper-pfeil { color: var(--gray-400); transition: transform 150ms ease; }
.aufklapper[aria-expanded="true"] .aufklapper-pfeil { transform: rotate(90deg); }
.positionen-liste { margin-top: 8px; }
.positionen-liste[hidden] { display: none; }
.position { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.position-text { min-width: 0; overflow-wrap: anywhere; }
.position-text .neben { margin-top: 1px; color: var(--gray-500); font-size: 12px; }
.position-betrag { white-space: nowrap; font-weight: 500; font-variant-numeric: tabular-nums; }
.inhalt-hinweis { margin-top: 10px; font-size: 12px; color: var(--gray-500); }
.inhalt-fuss { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; }
.inhalt-fuss .neben { color: var(--gray-400); }
.inhalt-aktionen { display: flex; gap: 18px; align-items: center; }

/* Verlauf: Dateien und Protokoll, eingeklappt */
details.verlauf > summary { list-style: none; cursor: pointer; justify-content: flex-start; padding-bottom: 14px; }
details.verlauf > summary::-webkit-details-marker { display: none; }
details.verlauf > summary .neben { margin-left: auto; }
details.verlauf > summary::after {
  content: ""; width: 7px; height: 7px; margin: 0 2px 2px 4px; flex-shrink: 0; align-self: center;
  border-right: 1.5px solid var(--gray-400); border-bottom: 1.5px solid var(--gray-400); transform: rotate(-45deg); transition: transform 150ms ease;
}
details.verlauf[open] > summary::after { transform: rotate(45deg); }
details.verlauf[open] > summary { padding-bottom: 0; }
.verlauf .micro-label { margin: 4px 0 2px; }
.verlauf .dateien { margin-bottom: 14px; }

/* Vorschau */
.dok-vorschau {
  position: sticky; top: 20px; height: calc(100dvh - 40px); min-height: 420px; min-width: 0; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.dok-vorschau-leiste { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 10px; border-bottom: 1px solid var(--line); }
.dok-vorschau-leiste .segment button { padding: 5px 12px; }
.dok-vorschau-leiste [data-seitenzahl] { color: var(--gray-500); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dok-vorschau-tab { margin-left: auto; }
.dok-vorschau .ocr-hinweis { margin: 0; border-radius: 0; padding: 8px 14px; font-size: 12.5px; }
.dok-vorschau-flaeche { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; background: #F2F2F5; }
.dok-vorschau-flaeche > [data-ansicht-original]:has(.vorschau-rahmen), .dok-vorschau .vorschau-flaeche:has(.vorschau-rahmen) { height: 100%; }
.dok-vorschau-flaeche:has(.vorschau-rahmen) { padding: 0; }
.dok-vorschau .vorschau-bilder { gap: 14px; }
.dok-vorschau .vorschau-bilder img { max-width: 820px; margin: 0 auto; border: none; border-radius: 2px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.dok-vorschau .vorschau-rahmen { height: 100%; min-height: 0; border: none; border-radius: 0; }
.dok-vorschau .ocr-text-karte { max-width: 820px; margin: 0 auto; padding: 14px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.dok-vorschau .ocr-text { max-height: none; overflow: visible; }

@media (max-width: 980px) {
  .dok-raster { grid-template-columns: minmax(0, 1fr); }
  .dok-vorschau { order: -1; position: static; height: auto; min-height: 0; }
  .dok-vorschau-flaeche { overflow: visible; padding: 12px 0; }
  .dok-vorschau-flaeche:has(.vorschau-rahmen) { padding: 0; }
  /* Seiten nebeneinander zum Wischen */
  .dok-vorschau .vorschau-bilder { flex-direction: row; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; padding: 0 16px; scrollbar-width: none; }
  .dok-vorschau .vorschau-bilder::-webkit-scrollbar { display: none; }
  .dok-vorschau .vorschau-bilder img { width: auto; height: auto; max-height: 56vh; max-width: 86%; flex-shrink: 0; align-self: center; scroll-snap-align: center; }
  .dok-vorschau .vorschau-bilder img:only-child { margin: 0 auto; }
  .dok-vorschau .vorschau-rahmen { height: 56vh; }
  .dok-vorschau .ocr-text-karte { margin: 0 12px; }
  .dok-vorschau .ocr-text { max-height: 56vh; overflow-y: auto; }
}
@media (max-width: 820px) {
  /* Die Aktionen als Leiste unten – mit dem Daumen erreichbar */
  .dok-aktionen {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; gap: 8px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  }
  .dok-aktionen .btn { min-height: 46px; }
  .dok-aktionen #archivieren, .dok-aktionen #bearbeiten { flex: 1; }
  .dok-aktionen .mehr-menue { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; }
  .dok-karte .stammdaten-zeile { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------------------------------------------------------------- Dashboard */

.uebersicht-kopf { align-items: flex-end; margin-bottom: 20px; }
.uebersicht-kopf h1 { font-size: 22px; letter-spacing: -0.015em; }
.uebersicht-kopf .unterzeile { color: var(--gray-500); font-size: 13px; margin-top: 4px; }
.kacheln { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 32px; }
.kachel { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; color: var(--ink); min-width: 0; }
a.kachel:hover { text-decoration: none; border-color: var(--gray-400); }
.kachel-zahl { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kachel-warn { color: var(--accent); }
.kachel-rot { color: var(--danger-text); }
.kachel .neben { color: var(--gray-500); font-size: 12.5px; overflow-wrap: anywhere; }
.dash-zeile { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
.dash-zeile:last-child { border-bottom: 0; }
a.dash-zeile:hover { text-decoration: none; background: var(--surface); }
.dash-gross { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dash-gross .neben, .dash-zeile > .neben { color: var(--gray-500); font-size: 12.5px; }
.dash-zeile > .neben { text-align: right; }
.hinweise-leer { padding: 14px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hinweise-leer .neben { color: var(--gray-500); font-size: 13px; }

/* Heute zu tun */
.tun-liste { padding: 0; overflow: hidden; }
.tun-zeile { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.tun-zeile:last-child { border-bottom: 0; }
a.tun-zeile:hover { text-decoration: none; background: var(--surface); }
.tun-zahl { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.tun-zahl.navy { color: var(--accent); }
.tun-zahl.rot { color: var(--danger-text); }
.tun-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tun-text strong { font-weight: 600; font-size: 14px; }
.tun-text span { color: var(--gray-500); font-size: 12.5px; overflow-wrap: anywhere; }
.tun-gruppe { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray-400); padding: 12px 18px 5px; border-bottom: 1px solid var(--line); background: var(--surface); }

/* Zuletzt */
.umschalter { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--card); }
.umschalter button { font: inherit; font-size: 12px; padding: 4px 10px; color: var(--gray-500); background: none; border: 0; cursor: pointer; }
.umschalter button.aktiv { background: var(--accent-bg); color: var(--accent); font-weight: 500; }
.zuletzt-karte { padding: 0; overflow: hidden; }
.zuletzt-kopf, .zuletzt-zeile { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 96px; gap: 14px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.zuletzt-kopf { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray-400); }
.zuletzt-zeile { color: var(--ink); font-size: 13px; }
.zuletzt-zeile:last-child { border-bottom: 0; }
a.zuletzt-zeile:hover { text-decoration: none; background: var(--surface); }
.zuletzt-zeile > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zuletzt-titel { font-weight: 500; }
.zuletzt-titel .neben { display: block; font-weight: 400; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.zuletzt-zeile .neben { color: var(--gray-500); }
.zuletzt-kopf span:last-child, .zuletzt-datum { text-align: right; font-variant-numeric: tabular-nums; }
.abschnitt-mehr { margin-top: 8px; }

/* Abgelegt je Monat: eine Reihe, Aufteilung nach Art im Tooltip */
.diagramm-karte { padding: 18px 20px 12px; }
.diagramm-kopf { margin-bottom: 14px; }
.diagramm-summe { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.diagramm-kopf .neben { color: var(--gray-500); font-size: 12.5px; }
.diagramm { position: relative; height: 190px; margin-left: 36px; }
.diagramm-raster { position: absolute; inset: 0 0 22px 0; }
.diagramm-raster div { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.diagramm-raster div:first-child { border-top-color: #D2D2D7; }
.diagramm-raster span { position: absolute; left: -36px; top: -7px; width: 30px; text-align: right; font-size: 11px; line-height: 1; color: var(--gray-400); font-variant-numeric: tabular-nums; }
.diagramm-balken { position: absolute; inset: 0 0 22px 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.balken-spalte { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; outline: none; cursor: default; min-width: 0; }
.balken { width: 58%; max-width: 44px; background: var(--accent); border-radius: 4px 4px 0 0; transition: opacity 0.1s; }
.balken-spalte.laufend .balken { background: repeating-linear-gradient(135deg, var(--accent) 0 3px, #8D9BBB 3px 6px); }
.diagramm.hat-auswahl .balken { opacity: 0.45; }
.diagramm.hat-auswahl .balken-spalte.aktiv .balken, .balken-spalte:focus-visible .balken { opacity: 1; }
.balken-monat { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--gray-500); }
.balken-spalte.aktiv .balken-monat { color: var(--ink); font-weight: 600; }
.abschnitt-neben { color: var(--gray-500); font-size: 12px; }
.diagramm-tipp { position: absolute; top: 4px; z-index: 5; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.08); padding: 10px 12px; font-size: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 180px; pointer-events: none; }
.diagramm-tipp strong { margin-bottom: 4px; font-size: 12.5px; }
.diagramm-tipp span { display: flex; justify-content: space-between; gap: 14px; color: var(--gray-600); }
.diagramm-tipp b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.diagramm-karte [data-tabelle] { margin-top: 12px; }
.diagramm-tabelle { font-size: 12.5px; margin-top: 8px; }
.diagramm-tabelle .zahl { text-align: right; font-variant-numeric: tabular-nums; }

/* System (nur Admins) */
.system-leiste { padding: 0; display: flex; flex-wrap: wrap; overflow: hidden; }
.system-leiste > * { flex: 1 1 0; min-width: 170px; padding: 13px 18px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; color: var(--ink); }
.system-leiste > *:last-child { border-right: 0; }
.system-leiste > a:hover { text-decoration: none; background: var(--surface); }
.system-wert { font-size: 13px; }
.ampel { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.ampel-ok { background: var(--success-text); }
.ampel-warn { background: #C08A00; }
.ampel-rot { background: var(--danger-text); }

.seiten-hinweis-text { color: var(--gray-500); font-size: 13.5px; margin: -4px 0 16px; }
@media (max-width: 1100px) {
  .kacheln { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .kachel-zahl { font-size: 24px; }
  .balken { width: 70%; }
  .balken-monat { font-size: 9.5px; }
  .uebersicht-kopf .btn-primary { display: none; } /* mobil: runder Erfassen-Knopf */
  .zuletzt-kopf, .zuletzt-zeile { grid-template-columns: minmax(0, 1fr) 84px; }
  .zuletzt-kopf span:nth-child(2), .zuletzt-zeile > span:nth-child(2) { display: none; }
  .system-leiste > * { border-right: 0; border-bottom: 1px solid var(--line); min-width: 50%; }
}
.diagramm-tipp[hidden], .ocr-text-karte[hidden] { display: none; }
@media (max-width: 560px) {
  .tun-zeile { grid-template-columns: 32px minmax(0, 1fr); }
  .tun-zeile .btn { display: none; }
}

/* ---------------------------------------------------------------- Akten-Kopf, Suche in Akten */

.akte-kopf { margin: -14px 0 22px; display: flex; flex-direction: column; gap: 10px; }
.akte-unterzeile { color: var(--gray-500); font-size: 13px; }
.akte-unterzeile a { color: var(--accent); }
.akte-kontakt { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14px; color: var(--ink); }
.akte-kontakt a { color: var(--accent); overflow-wrap: anywhere; display: inline-flex; align-items: center; gap: 6px; }
.akte-kontakt .icon { color: var(--gray-500); flex-shrink: 0; }
.akte-notiz { background: #fff8e5; border: 1px solid #f3e3b5; border-radius: var(--radius); padding: 10px 14px; font-size: 13.5px; color: var(--ink); white-space: pre-line; }
a.chip { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
a.chip:hover { text-decoration: none; }
/* Suchfeld und Auswahl (Dokumentart, Jahr) in einer Zeile; schmal brechen die Auswahlen um. */
.akte-werkzeuge { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.akte-werkzeuge .akte-suche { flex: 1 1 240px; width: auto; }
.akte-werkzeuge .akte-auswahl { flex: 0 1 auto; width: auto; min-width: 170px; }
@media (max-width: 560px) {
  .akte-werkzeuge .akte-auswahl { flex: 1 1 140px; min-width: 0; }
}
.such-dokumente-kopf { margin-top: 4px; }
.such-dokumente-kopf .such-zahl { margin: 0; min-height: 0; }
.such-arten { margin-bottom: 10px; }
.akten-zeichen { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-bg); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px; flex-shrink: 0; }
.akten-oeffnen { color: var(--accent); font-size: 12.5px; white-space: nowrap; }
.such-akten mark, .dash-zeile mark { background: #fff1b8; color: inherit; padding: 0 1px; border-radius: 2px; }
.vorschau-jahre { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 12px; }
.vorschau-jahre > div { background: var(--surface); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.vorschau-jahre strong { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.vorschau-jahre .neben { color: var(--gray-500); font-size: 12px; line-height: 1.35; }
@media (max-width: 560px) { .vorschau-jahre { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Gespeicherte Ansichten: eingerückt unter „Alle Dokumente“ */
.nav-punkt.nav-ansicht { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 38px; font-size: 13px; color: var(--gray-600); min-height: 0; padding-top: 5px; padding-bottom: 5px; }
.nav-punkt.nav-ansicht.aktiv { color: var(--ink); }
.dokumente-filter .akte-auswahl { flex: 1 1 160px; }
.such-zahl:empty { display: none; }

/* Datensicherung */
.sicherung-karte { padding: 16px 20px; margin-bottom: 12px; }
.sicherung-kopf { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.sicherung-aktionen { display: flex; gap: 8px; flex-wrap: wrap; }
.sicherung-stand { margin-top: 10px; font-size: 13px; }
.sicherung-fehler { color: var(--danger-text); margin-top: 4px; font-size: 12.5px; word-break: break-word; }
.sicherung-anleitung ol { margin: 4px 0 0 18px; padding: 0; line-height: 1.6; }
.sicherung-hilfe { line-height: 1.6; }
.hinweis-warnung { background: var(--warning-bg, #fff8e5); color: var(--ink); border-color: #f3e3b5; }
#ziel-formular [hidden] { display: none; }
#verfahren-formular [hidden] { display: none; }
#verfahren-formular .formular-aktionen { flex-wrap: wrap; }

/* Aufgaben */
.aufgaben-liste { padding: 0; }
.aufgabe-zeile { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-top: 1px solid var(--line); }
.aufgabe-zeile:first-child { border-top: none; }
.aufgabe-haken { flex-shrink: 0; width: 22px; height: 22px; margin-top: 1px; border: 1.5px solid var(--gray-400); border-radius: 6px;
  background: var(--card); color: var(--card); font-size: 13px; line-height: 1; cursor: pointer; padding: 0; }
.aufgabe-haken:hover { border-color: var(--accent); }
.aufgabe-zeile.erledigt .aufgabe-haken { background: var(--accent); border-color: var(--accent); }
.aufgabe-haupt { min-width: 0; flex: 1; }
.aufgabe-text { overflow-wrap: anywhere; white-space: pre-line; }
.aufgabe-zeile.erledigt .aufgabe-text { color: var(--gray-500); text-decoration: line-through; }
.aufgabe-haupt .neben { color: var(--gray-500); font-size: 12.5px; margin-top: 2px; }
.aufgabe-haupt .neben a { color: var(--accent); }
.aufgabe-ueberfaellig { color: var(--danger-text); }
.aufgabe-bearbeiten { flex-shrink: 0; font-size: 13px; }
details.aufgaben-erledigt summary { cursor: pointer; margin-bottom: 8px; }
@media (max-width: 560px) {
  .aufgabe-haken { width: 26px; height: 26px; } /* Daumen */
}

/* Eingänge: Postfächer */
#postfach-formular [hidden] { display: none; }
.postfach-erweitert summary { cursor: pointer; margin-bottom: 8px; }
.microsoft-code { font-size: 18px; letter-spacing: 0.08em; font-family: ui-monospace, monospace; }
#eingaenge > .card + .card { margin-top: 12px; }

/* ---------------------------------------------------------------- Feinschliff */

/* Formularseiten: Auf breiten Fenstern liefen Felder und Textzeilen sonst über die ganze Breite. */
.inhalt-schmal { max-width: 920px; }

/* Rollbalken in Listen und Dialogen schmal wie in der Seitenleiste */
.drawer-koerper, .zuordnung-auswahl, .dok-vorschau-flaeche, .ocr-text, .tabelle-scroll { scrollbar-width: thin; scrollbar-color: #D2D2D7 transparent; }
.drawer-koerper { overscroll-behavior: contain; }

/* Solange ein Dialog offen ist, rollt die Seite dahinter nicht mit. */
body.fenster-offen { overflow: hidden; }

/* Neben der Seitenleiste wird es eng: Die Dokumentnummer steht dann nur auf der Dokumentseite. */
@media (max-width: 1100px) {
  .tabelle .schmal-weg { display: none; }
}

/* Umschalter mit dem Daumen treffbar */
@media (max-width: 820px) {
  .umschalter button { padding: 8px 12px; font-size: 13px; }
  .dok-vorschau-leiste .segment button { padding: 8px 14px; }
}

/* Lizenztext im Dialog */
.lizenz-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; line-height: 1.55; color: var(--ink); }
.drawer:has(.lizenz-text) { width: min(760px, calc(100vw - 32px)); }
