/* RR Cockpit — mobile Arbeitsoberfläche für den Inhaber.
   Externes CSS wegen CSP style-src 'self'; PII-Seiten werden weiterhin nicht gecacht. */
:root {
  --bg: #14181d;
  --bg-tief: #0e1216;
  --flaeche: #1b2229;
  --flaeche-2: #222b34;
  --rand: #34404b;
  --rand-hell: #465563;
  --text: #f2f5f7;
  --sub: #a9b5c0;
  --gruen: #35a66b;
  --gruen-hell: #83d8a8;
  --gruen-dunkel: #217449;
  --orange: #e49a3a;
  --rot: #df5a4c;
  --blau: #68a9de;
  --violett: #b49ae7;
  --schatten: 0 8px 24px rgba(0, 0, 0, .22);
  --druck: 0 2px 0 rgba(0, 0, 0, .36);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Avenir Next", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overflow-wrap: break-word;
}
[hidden] { display: none !important; }
a, button, summary { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid #8cc7f2;
  outline-offset: 2px;
}
h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 6px;
  font-family: ui-rounded, "Arial Rounded MT Bold", -apple-system, sans-serif;
  font-size: clamp(23px, 6vw, 30px);
  line-height: 1.16;
  letter-spacing: -.35px;
}
.sub { color: var(--sub); font-size: 14px; margin: 0 0 18px; }
.eyebrow, .arbeitsauftrag-label {
  display: block;
  color: var(--gruen-hell);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  line-height: 1.2;
  margin-bottom: 7px;
  text-transform: uppercase;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Formulare und fühlbare Bedienelemente */
form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
label { display: flex; flex-direction: column; gap: 7px; color: var(--sub); font-size: 14px; font-weight: 650; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--rand);
  border-radius: 12px;
  background: var(--bg-tief);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  padding: 13px 14px;
}
input::placeholder, textarea::placeholder { color: #788693; }
input:focus, select:focus, textarea:focus { border-color: var(--gruen); }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
button, .btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  margin-top: 6px;
  padding: 13px 16px;
  border: 1px solid #4fc184;
  border-radius: 12px;
  background: linear-gradient(180deg, #3bac72, #2d915f);
  box-shadow: var(--druck);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
  transition: transform 90ms ease, filter 90ms ease, box-shadow 90ms ease;
}
button:active, .btn:active, .feed-link:active, .tab:active, .auftrag-link:active {
  transform: translateY(2px) scale(.985);
  filter: brightness(.9);
  box-shadow: none;
}
button:disabled { cursor: wait; filter: saturate(.4); opacity: .7; }
.btn-sekundaer {
  border-color: var(--rand-hell);
  background: linear-gradient(180deg, #2c3741, #242d35);
  color: var(--text);
}
/* Zweiter „Zurück" unten auf Detailseiten (Daumenzone) — etwas Abstand zum Inhalt darüber. */
.fuss-zurueck { margin-top: 22px; }
/* Abmelden ist eine Low-Emphasis-Aktion: sekundärer Button, aber gedämpfter Text. */
.abmelden-btn { color: var(--sub); }

/* Login und Fehlerseiten */
.auth {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 22px calc(40px + env(safe-area-inset-bottom));
}
.marke {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  border: 1px solid #4ac27e;
  border-radius: 17px 17px 17px 5px;
  background: linear-gradient(145deg, var(--gruen), var(--gruen-dunkel));
  box-shadow: var(--schatten);
  color: #fff;
  font-family: ui-rounded, "Arial Rounded MT Bold", sans-serif;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: .03em;
}
.auth h1, .auth > .sub { text-align: center; }
.hinweis {
  margin-bottom: 10px;
  padding: 13px 14px;
  border: 1px solid var(--rand);
  border-radius: 12px;
  background: var(--flaeche-2);
  font-size: 14px;
}
.fehler { border-color: #8e3c36; background: rgba(223, 90, 76, .13); color: #ffc1ba; }
.karte { padding: 18px; border: 1px solid var(--rand); border-radius: 14px; background: var(--flaeche); }
.ok { margin: 0 0 8px; color: var(--gruen-hell); font-size: 17px; font-weight: 800; }

/* Fester App-Rahmen */
.app { min-height: 100dvh; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.top {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(58px + env(safe-area-inset-top));
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
  border-bottom: 1px solid rgba(70, 85, 99, .65);
  background: rgba(20, 24, 29, .96);
  backdrop-filter: blur(14px);
}
.top .titel {
  display: flex;
  align-items: center;
  min-width: 0;
  font-family: ui-rounded, "Arial Rounded MT Bold", sans-serif;
  font-size: 17px;
  font-weight: 850;
  white-space: nowrap;
}
.kopf-seite {
  max-width: 150px;
  overflow: hidden;
  color: var(--sub);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
}
.kopf-seite::before { content: "/"; margin: 0 7px; color: #61717e; }
.kopf-rechts { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.reload-wrap { position: relative; display: flex; align-items: center; }
.reload, .kopf-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 11px;
  background: transparent;
  box-shadow: none;
  color: var(--sub);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  text-decoration: none;
}
.reload:active, .kopf-icon:active { background: var(--flaeche-2); transform: scale(.92); }
.reload-symbol { display: block; transform-origin: 50% 50%; }
.reload.is-loading .reload-symbol { animation: drehen .65s linear infinite; color: var(--gruen-hell); }
.reload.is-done { color: var(--gruen-hell); }
.reload-status {
  position: absolute;
  top: 42px;
  right: -6px;
  width: max-content;
  max-width: 150px;
  padding: 5px 8px;
  border: 1px solid var(--rand);
  border-radius: 7px;
  background: var(--flaeche-2);
  box-shadow: var(--schatten);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease;
}
.reload-wrap.hat-status .reload-status { opacity: 1; transform: translateY(0); }
.kopf-icon.aktiv { color: var(--gruen-hell); }
.abmelden {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 6px;
  color: var(--sub);
  font-size: 12px;
  text-decoration: none;
}
.zurueck {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-left: -7px;
  padding: 0 7px;
  color: var(--text);
  font-family: -apple-system, sans-serif;
  font-size: 15px;
  font-weight: 750;
  text-decoration: none;
}
.zurueck span { margin-right: 3px; font-size: 29px; font-weight: 400; line-height: 0; }
.zaehler {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  margin-left: 5px;
  padding: 0 7px;
  border-radius: 8px 8px 8px 3px;
  background: var(--gruen);
  color: #fff;
  font-family: -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 850;
}
.zaehler-neutral { background: var(--flaeche-2); color: var(--text); }
.inhalt { max-width: 720px; margin: 0 auto; padding: 18px 14px 28px; }
.offline-band {
  display: none;
  padding: 9px 18px;
  border-bottom: 1px solid #8e3c36;
  background: rgba(223, 90, 76, .15);
  color: #ffc1ba;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.offline-band.sichtbar { display: block; }

/* Tab-Leiste in der Daumenzone */
.tabbar {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  min-height: calc(64px + env(safe-area-inset-bottom));
  padding: 4px max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
  border-top: 1px solid var(--rand);
  background: rgba(20, 27, 33, .98);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, .18);
}
.tab {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  gap: 2px;
  border-radius: 10px;
  color: var(--sub);
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
  transition: background .12s ease, color .12s ease, transform .08s ease;
}
.tab-icon { height: 19px; color: #73818d; font-size: 13px; line-height: 19px; }
.tab-icon-check, .tab-icon-grid { font-size: 18px; }
.tab.aktiv { background: rgba(53, 166, 107, .1); color: var(--gruen-hell); }
.tab.aktiv .tab-icon { color: var(--gruen-hell); }

/* Arbeitsstand, Sprungmarken und Suche */
.arbeitsstand {
  position: relative;
  overflow: hidden;
  margin: -2px 0 18px;
  padding: 18px;
  border: 1px solid var(--rand);
  border-radius: 16px 16px 16px 5px;
  background: linear-gradient(145deg, #202a32, #192027);
  box-shadow: var(--schatten);
}
.arbeitsstand::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  background: var(--gruen);
  content: "";
}
.arbeitsstand h1 { font-size: 25px; }
.arbeitsstand p { margin: 0; color: var(--sub); font-size: 13px; }
.arbeitsstand-kompakt { box-shadow: none; }
/* Kategorie-Chips (Posteingang-Filter, AP13). Setzen die globalen button-Regeln (width:100%,
   min-height:50px, margin-top, gruener Gradient, Schatten, font-weight:800) bewusst zurueck —
   sonst wirken sie wie primaere Aktionen. Aktiver Zustand ueber Rand + hellere Flaeche + Textfarbe
   (nicht nur Farbton); aria-pressed traegt die Semantik fuer Screenreader. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.chip {
  display: inline-flex;
  align-items: baseline;
  width: auto;
  min-height: 44px;
  margin: 0;
  gap: 6px;
  padding: 10px 13px;
  border: 1px solid var(--rand);
  border-radius: 10px;
  background: rgba(14, 18, 22, .52);
  box-shadow: none;
  color: var(--sub);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
}
.chip b { color: var(--text); font-size: 19px; font-weight: 900; }
.chip[aria-pressed="true"] { border-color: var(--gruen); background: rgba(53, 166, 107, .16); color: var(--text); }
.chip[aria-pressed="true"] b { color: var(--gruen-hell); }
.chip-dringend[aria-pressed="true"] { border-color: var(--rot); background: rgba(223, 90, 76, .16); }
.chip-dringend[aria-pressed="true"] b { color: var(--rot); }

/* AP15 Umsatz-Kachel (echte lexoffice-Summen, lazy nachgeladen) + Termine-Verweis */
.umsatz-kachel {
  margin: -2px 0 12px;
  padding: 15px 17px;
  border: 1px solid var(--rand);
  border-radius: 16px 16px 16px 5px;
  background: linear-gradient(145deg, #202a32, #192027);
  box-shadow: var(--schatten);
}
.umsatz-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.umsatz-stand { flex: 0 0 auto; color: var(--sub); font-size: 11px; text-align: right; }
.umsatz-toepfe { display: flex; flex-direction: column; }
.umsatz-topf {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.umsatz-topf:last-child { border-bottom: none; }
.umsatz-label { display: flex; flex-direction: column; color: var(--sub); font-size: 13px; }
.umsatz-label small { color: #7e8c98; font-size: 10px; }
.umsatz-topf b { color: var(--gruen-hell); font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.umsatz-hinweis { margin: 9px 0 0; color: var(--orange); font-size: 11px; }
.umsatz-hinweis:empty { display: none; }
.uebersicht-verweis {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 44px; margin: 0 0 18px; padding: 11px 14px;
  border: 1px solid var(--rand); border-radius: 12px;
  background: rgba(14, 18, 22, .4); color: var(--text); text-decoration: none;
}
.uebersicht-verweis span:first-child { display: flex; flex-direction: column; gap: 1px; }
.uebersicht-verweis b { font-size: 14px; font-weight: 600; }
.uebersicht-verweis small { color: var(--sub); font-size: 11px; }
.listen-suche { margin: 0 0 4px; }
.listen-suche input {
  min-height: 50px;
  padding-left: 43px;
  border-color: var(--rand);
  border-radius: 14px;
  background-color: var(--bg-tief);
  background-image: radial-gradient(circle at 20px 20px, transparent 7px, #7e8c98 8px, #7e8c98 9px, transparent 10px), linear-gradient(45deg, transparent 48%, #7e8c98 49%, #7e8c98 57%, transparent 58%);
  background-position: 0 0, 27px 28px;
  background-repeat: no-repeat;
  background-size: 40px 40px, 10px 10px;
}
.filter-status { min-height: 18px; margin: 3px 2px 6px; color: var(--sub); font-size: 12px; }

/* Gruppierte Feed-Stapel */
.arbeitsstapel { display: flex; flex-direction: column; gap: 24px; }
.feed-gruppe { scroll-margin-top: 82px; }
.gruppen-kopf {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  margin-bottom: 9px;
  padding: 0 2px;
}
.gruppen-kopf > div { display: flex; align-items: center; min-width: 0; gap: 9px; }
.gruppen-kopf h2 { margin: 0; font-size: 16px; line-height: 1.2; }
.gruppen-kopf p { grid-column: 1 / -1; margin: 2px 0 0 37px; color: var(--sub); font-size: 12px; }
.gruppen-signal, .gruppen-anzahl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 8px 8px 8px 3px;
  background: var(--flaeche-2);
  color: var(--gruen-hell);
  font-family: ui-rounded, "Arial Rounded MT Bold", sans-serif;
  font-size: 12px;
  font-weight: 900;
}
.gruppen-anzahl { width: auto; min-width: 28px; padding: 0 8px; color: var(--text); }
.feed-gruppe-dringend .gruppen-signal { background: var(--rot); color: #fff; }
.feed { display: flex; flex-direction: column; gap: 9px; margin: 0; padding: 0; list-style: none; }
.karte-feed {
  position: relative;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--rand);
  border-radius: 14px 14px 14px 5px;
  background: var(--flaeche);
  box-shadow: 0 3px 12px rgba(0, 0, 0, .13);
}
.karte-feed::before {
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--gruen);
  content: "";
}
.karte-typ-mehraufwand::before, .karte-typ-bewertung::before { background: var(--orange); }
.karte-typ-umplan::before { background: var(--blau); }
.karte-typ-aufgabe::before { background: #c58b59; }
.karte-feed.ist-fehler { border-color: #914239; background: linear-gradient(90deg, rgba(223, 90, 76, .11), var(--flaeche) 38%); }
.karte-feed.ist-fehler::before { width: 5px; background: var(--rot); }
.feed-link {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  min-height: 76px;
  gap: 10px;
  padding: 12px 11px 12px 15px;
  color: var(--text);
  text-decoration: none;
  transition: transform 90ms ease, filter 90ms ease, background 90ms ease;
}
.feed-link:active { background: #161c22; }
.feed-link.ohne-link { opacity: .8; }
.feed-mitte { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 3px; }
.feed-kopfzeile { display: flex; align-items: center; justify-content: space-between; min-width: 0; gap: 8px; }
.feed-wer {
  display: -webkit-box;
  max-height: 2.5em;
  overflow: hidden;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}
.feed-kontext { overflow: hidden; color: #c7d0d7; font-size: 13px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.feed-betreff {
  display: -webkit-box;
  max-height: 2.6em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}
.feed-ort { color: var(--sub); font-size: 12px; }
.feed-status { color: var(--sub); font-size: 12px; line-height: 1.35; }
.feed-status b { color: var(--text); font-weight: 750; }
.karte-feed.ist-fehler .feed-status, .karte-feed.ist-fehler .feed-status b { color: #ffc1ba; }
.feed-zeit { flex-shrink: 0; color: var(--sub); font-size: 11px; white-space: nowrap; }
.feed-pfeil { flex-shrink: 0; margin-left: 1px; color: #84929e; font-size: 24px; font-weight: 300; }
.feed-rechts { display: flex; align-items: center; gap: 8px; }
.feed-snooze {
  display: flex;
  flex: 0 0 auto;
  margin: 0;
  border-left: 1px solid var(--rand);
}
.feed-snooze button {
  width: auto;
  min-width: 67px;
  min-height: 100%;
  margin: 0;
  padding: 8px 9px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--sub);
  font-size: 11px;
  font-weight: 750;
}
.feed-snooze button:active { background: rgba(255, 255, 255, .05); transform: scale(.94); }
.feed-erledigt button { color: var(--gruen-hell); }
.feed-erledigt button span { display: block; font-size: 17px; }

/* Badges */
.badge {
  display: inline-block;
  max-width: 170px;
  overflow: hidden;
  flex-shrink: 1;
  padding: 4px 7px;
  border-radius: 7px;
  background: #293542;
  color: #c3cfda;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .035em;
  line-height: 1.25;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-freigabe { background: rgba(53, 166, 107, .18); color: var(--gruen-hell); }
.badge-mehraufwand { background: rgba(228, 154, 58, .17); color: #f1bd77; }
.badge-bewertung { background: rgba(180, 154, 231, .16); color: #cab8ee; }
.badge-umplan, .badge-eingehend { background: rgba(104, 169, 222, .16); color: #9ac9ed; }
.badge-fehldaten { background: rgba(222, 194, 76, .16); color: #e7d77e; }
.badge-pause_ende, .badge-status { background: #2b3540; color: #c0cbd4; }
.badge-aufgabe { background: #382c22; color: #e1b78e; }
.badge-erledigt, .badge-ausgehend { background: rgba(53, 166, 107, .16); color: var(--gruen-hell); }

/* Leerzustände und Nebenlinks */
.leer { padding: 58px 16px; text-align: center; }
.leer-gross { margin: 0 0 7px; color: var(--gruen-hell); font-size: 21px; font-weight: 850; }
.feed-fuss { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 24px; }
.feed-fuss form { margin: 0; }
.fuss-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--sub);
  font-size: 13px;
  font-weight: 650;
  text-decoration: underline;
}

/* Detailseiten: Handlungsauftrag vor Akte */
.detail-kopf { margin: 1px 2px 15px; }
.detail-kopf h1 { font-size: 25px; }
.arbeitsauftrag {
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
  padding: 17px 17px 17px 20px;
  border: 1px solid #397b59;
  border-radius: 14px 14px 14px 5px;
  background: linear-gradient(120deg, rgba(53, 166, 107, .16), var(--flaeche) 58%);
}
.arbeitsauftrag::before, .block.offen::before, .primaeraktion::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  background: var(--gruen);
  content: "";
}
.arbeitsauftrag h2 { margin: 0; color: var(--text); font-size: 18px; line-height: 1.28; }
.arbeitsauftrag p { margin: 7px 0 0; color: var(--sub); font-size: 13px; }
.arbeitsauftrag-erledigt, .arbeitsauftrag-ruhig { border-color: var(--rand); background: var(--flaeche); }
.arbeitsauftrag-erledigt::before, .arbeitsauftrag-ruhig::before { background: #71808c; }
.naechste-schritte { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.naechste-schritte a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--rand);
  border-radius: 9px;
  background: rgba(14, 18, 22, .5);
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}
.block {
  position: relative;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--rand);
  border-radius: 14px;
  background: var(--flaeche);
}
.block.offen { overflow: hidden; border-color: #397b59; }
.block h2 { margin: 0 0 9px; color: var(--text); font-size: 16px; font-weight: 850; }
.block > p:last-child { margin-bottom: 0; }
.block-einleitung { margin: -4px 0 4px; color: var(--sub); font-size: 13px; }
.detail-hauptinfo { border-color: var(--rand-hell); }
.entwurf-block { background: linear-gradient(145deg, #1e2925, var(--flaeche)); }
.primaeraktion { overflow: hidden; padding: 18px; border-color: #397b59; }
.primaeraktion form { margin: 0; }
.primaeraktion h2 { font-size: 17px; }
.mailtext { font-size: 15px; line-height: 1.58; white-space: pre-wrap; word-wrap: break-word; }
.mini-warn { margin: 8px 0 0; color: #efbd78; font-size: 13px; }
.quarantaene-hinweis { border-color: #73582e; background: rgba(228, 154, 58, .12); color: #efd0a1; }
.aktion-hinweis {
  margin-top: 16px;
  padding: 14px;
  border: 1px dashed var(--rand);
  border-radius: 12px;
  color: var(--sub);
  font-size: 14px;
  text-align: center;
}
.aktionen { display: flex; flex-direction: column; gap: 11px; margin-top: 14px; }
.aktionen form { margin: 0; }
.aendern { overflow: hidden; border: 1px solid var(--rand); border-radius: 12px; }
.aendern > summary { margin: 0; border: 0; border-radius: 0; box-shadow: none; cursor: pointer; list-style: none; }
.aendern > summary::-webkit-details-marker { display: none; }
.aendern[open] > summary { border-bottom: 1px solid var(--rand); }
.aendern-inhalt { display: flex; flex-direction: column; gap: 14px; padding: 14px; }
.aendern-inhalt form { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.aendern-feld { background: var(--bg-tief); font-family: inherit; }
.feld-form { margin-top: 12px; }

/* Auftragsakte und kompakte Fakten */
.auftrag-kompakt {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--rand);
  border-radius: 13px;
  background: var(--rand);
}
.auftrag-kompakt > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 62px;
  padding: 10px 12px;
  background: var(--flaeche);
}
.auftrag-kompakt small { color: var(--sub); font-size: 10px; text-transform: uppercase; }
.auftrag-kompakt b { overflow: hidden; font-size: 13px; line-height: 1.3; text-overflow: ellipsis; }
.auftrag-statuszeile { flex-direction: row !important; align-items: center; gap: 8px; }
.auftrag-statuszeile > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.statuspunkt { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--gruen); box-shadow: 0 0 0 4px rgba(53, 166, 107, .12); }
.statuspunkt-pause { background: var(--orange); box-shadow: 0 0 0 4px rgba(228, 154, 58, .12); }
.detail-gruppe { padding: 0; }
.detail-gruppe > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 13px 15px;
  cursor: pointer;
  list-style: none;
}
.detail-gruppe > summary::-webkit-details-marker { display: none; }
.detail-gruppe summary span:first-child { display: flex; flex-direction: column; }
.detail-gruppe summary small { color: var(--sub); font-size: 10px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.detail-gruppe summary b { font-size: 15px; }
.details-pfeil { color: var(--sub); font-size: 20px; transition: transform .15s ease; }
.detail-gruppe[open] .details-pfeil { transform: rotate(180deg); }
.detail-gruppe-inhalt { padding: 0 15px 15px; border-top: 1px solid var(--rand); }
.detail-gruppe-inhalt > .feed, .detail-gruppe-inhalt > dl { margin-top: 14px; }
.kontakt dl { display: grid; grid-template-columns: minmax(78px, auto) 1fr; gap: 8px 13px; margin-bottom: 14px; font-size: 14px; }
.kontakt dt { color: var(--sub); }
.kontakt dd { min-width: 0; margin: 0; }
.kontakt a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 7px 3px;
  color: var(--gruen-hell);
}
.auftrag-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--rand);
  border-radius: 11px;
  background: var(--flaeche-2);
  color: var(--text);
  text-decoration: none;
  transition: transform 90ms ease, filter 90ms ease;
}
.auftrag-link > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.auftrag-link small { margin-top: 2px; color: var(--sub); font-size: 12px; }
.auftrag-link > span:last-child { color: var(--sub); font-size: 24px; }
.auftrag-link-kompakt { margin: 4px 0 12px; }

/* Auftragsübersicht und erledigte Vorgänge */
.kennzahlen-klein { display: flex; gap: 8px; margin-top: 14px; }
.kennzahlen-klein span { padding: 7px 10px; border: 1px solid var(--rand); border-radius: 9px; color: var(--sub); font-size: 12px; }
.kennzahlen-klein b { margin-right: 3px; color: var(--text); font-size: 16px; }
.auftragsgruppen { gap: 22px; }
.auftrags-feed > li, .erledigt-feed > li, .verlauf > li {
  overflow: hidden;
  border: 1px solid var(--rand);
  border-radius: 13px;
  background: var(--flaeche);
}
.auftrag-karte { min-height: 88px; padding-left: 14px; }
.auftrag-karte.ist-pausiert { opacity: .76; }
.terminzeile { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.terminzeile span { padding: 3px 6px; border-radius: 6px; background: var(--bg-tief); color: var(--sub); font-size: 10px; }
.seiten-intro { margin: 1px 2px 17px; }
.seiten-intro h1 { font-size: 25px; }
.seiten-intro p { margin: 0; color: var(--sub); font-size: 13px; }
.erledigt-feed .feed-link, .verlauf .feed-link { min-height: 72px; }

/* Overflow schneidet den normalen Aussen-Fokus ab: Container spiegeln ihn innen sichtbar. */
.karte-feed:focus-within,
.arbeitsstand:focus-within,
.arbeitsauftrag:focus-within,
.block:focus-within,
.auftrag-kompakt:focus-within,
.auftrags-feed > li:focus-within,
.erledigt-feed > li:focus-within,
.verlauf > li:focus-within,
.termin-karte:focus-within,
details:focus-within {
  box-shadow: inset 0 0 0 3px #8cc7f2;
}

/* Push-Status, Flash und Audio */
.push-status { margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.push-meldung { min-height: 1em; margin: 0 0 8px; color: var(--gruen-hell); font-size: 14px; }
.push-zuletzt { margin: 14px 0 0; color: var(--sub); font-size: 12px; }
.push-hinweis { margin: 0; color: var(--sub); font-size: 14px; }
#push-aus { margin-top: 10px; }
.flash { margin-bottom: 12px; }
.flash-ok { border-color: #397b59; background: rgba(53, 166, 107, .13); color: var(--gruen-hell); }
.flash-warn { border-color: #73582e; background: rgba(228, 154, 58, .12); color: #efd0a1; }
#reinsprechen { display: flex; flex-direction: column; gap: 8px; }
.btn-mic { border-color: var(--rand-hell); background: #293642; color: var(--text); }
.btn-mic.aufnahme { border-color: #f0786b; background: var(--rot); color: #fff; }
.mic-status { min-height: 1em; margin: 0; color: var(--sub); font-size: 13px; }
.mic-ergebnis { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--rand); border-radius: 12px; }
.mic-transkript { margin: 0; color: var(--sub); font-size: 13px; font-style: italic; }
.mic-hinweis { margin: 0; color: var(--sub); font-size: 12px; }
.mic-frage { margin: 0; color: #efbd78; font-size: 15px; font-weight: 700; }
.mic-vorschlag { padding: 12px; border: 1px solid var(--rand); border-radius: 10px; background: var(--bg-tief); font-size: 14px; line-height: 1.55; white-space: pre-wrap; }

@keyframes drehen { to { transform: rotate(360deg); } }

@media (min-width: 640px) {
  .inhalt { padding: 24px 22px 34px; }
  .auftrag-kompakt { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .aktionen.aktionen-kompakt { flex-direction: row; }
}

@media (max-width: 390px) {
  .inhalt { padding-right: 10px; padding-left: 10px; }
  .feed-snooze button { min-width: 58px; padding-right: 6px; padding-left: 6px; }
  .feed-link { padding-right: 8px; padding-left: 12px; }
  .feed-wer { font-size: 15px; }
  .kopf-seite { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* --- Termine (AP14 v1): Agenda-Karten mit Art-Farbkante (Design-Konzept Codex) --- */
.termin-leer-hinweis { margin: 2px 2px 12px; }
.termin-feed { gap: 9px; }
.termin-karte {
  position: relative; overflow: hidden; min-height: 88px; padding-left: 16px;
  border: 1px solid var(--rand); border-radius: 14px 14px 14px 5px;
  background: var(--flaeche); box-shadow: 0 3px 12px rgba(0, 0, 0, .13);
}
.termin-karte::before {
  content: ""; position: absolute; z-index: 1; inset: 0 auto 0 0; width: 4px;
  background: var(--termin-farbe, var(--rand-hell));
}
.termin-rt { --termin-farbe: var(--gruen); }
.termin-bt { --termin-farbe: var(--blau); }
.termin-wunsch { --termin-farbe: var(--violett); }
.badge-termin { font-weight: 700; }
.badge-rt { background: rgba(53, 166, 107, .18); color: var(--gruen-hell); }
.badge-bt { background: rgba(104, 169, 222, .16); color: #9ac9ed; }
.badge-wunsch { background: rgba(180, 154, 231, .16); color: #cab8ee; }
.termin-wann { flex-shrink: 0; white-space: nowrap; font-weight: 750; }
.termin-status { font-size: 12px; color: var(--sub); }
.termin-status b { color: var(--orange); }
/* "Vergangen"-Aufklapper: 44px-Tippziel + sichtbarer, drehender Chevron statt nativem Marker. */
.vergangen-kopf {
  display: flex; align-items: center; gap: 9px; min-height: 44px;
  margin-bottom: 9px; padding: 0 2px; cursor: pointer; list-style: none;
}
.vergangen-kopf::-webkit-details-marker { display: none; }
.vergangen-kopf h2 { flex: 1; min-width: 0; margin: 0; font-size: 16px; line-height: 1.2; }
.vergangen-chevron { flex-shrink: 0; color: #84929e; font-size: 22px; font-weight: 300; transition: transform 150ms ease; }
.termin-vergangen[open] .vergangen-chevron { transform: rotate(90deg); }
.tab-icon-kalender svg { display: block; }
/* Adress-Deeplink in die Karten-App (Auftragsakte) */
.karten-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--blau); font-weight: 650; text-decoration: none; }
.karten-link:active { opacity: .7; }

/* --- Termine: Umschalter Liste|Kalender + Monatsraster (Design-Konzept Codex) --- */
.termine-ansichtswahl {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-bottom: 14px; padding: 3px;
  border: 1px solid var(--rand); border-radius: 12px 12px 12px 4px; background: var(--bg-tief);
}
.termine-ansichtswahl button {
  min-height: 44px; border: 0; border-radius: 9px; background: transparent;
  color: var(--sub); font-weight: 700; font-size: 14px; cursor: pointer;
}
.termine-ansichtswahl button[aria-pressed="true"] { background: rgba(53, 166, 107, .16); color: var(--gruen-hell); }
.kalender-nav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin-bottom: 8px; }
.kalender-nav h2 { margin: 0; font-size: 16px; text-align: center; }
.kalender-navbtn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  color: var(--text); font-size: 22px; text-decoration: none; border-radius: 9px;
}
.kalender-navbtn:active { background: var(--druck); }
.kalender-grid {
  display: flex; flex-direction: column; gap: 1px; overflow: hidden;
  width: calc(100% + 8px); margin-left: -4px;   /* schmales iPhone: fast randlos -> ~44px-Zellen */
  border: 1px solid var(--rand); border-radius: 10px; background: var(--rand);
}
.kalender-wochentage, .kalender-woche { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; }
.kalender-wochentage span { padding: 5px 0; background: var(--bg-tief); color: var(--sub); font-size: 11px; text-align: center; }
.kalender-tagbtn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 100%; min-height: 54px; margin: 0; padding: 4px 0; border: 0; border-radius: 0;
  box-shadow: none; background: var(--flaeche); color: var(--text); cursor: pointer;
}
.kalender-zelle.ausser-monat .kalender-tagbtn { color: var(--sub); background: var(--bg-tief); }
.kalender-tagbtn.ohne-termine { color: var(--sub); }
.kalender-zelle[aria-selected="true"] .kalender-tagbtn { background: rgba(53, 166, 107, .2); box-shadow: inset 0 0 0 2px var(--gruen); }
.kalender-tagbtn[aria-current="date"] .kalender-zahl { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 2px; }
.kalender-zahl { font-size: 15px; font-weight: 700; line-height: 1; }
.kalender-anzahl { font-size: 10px; font-weight: 800; line-height: 1; color: var(--gruen-hell); }
.kalender-arten { display: flex; gap: 2px; }
.kal-art { width: 5px; height: 5px; border-radius: 50%; }
.kal-art-rt { background: var(--gruen); } .kal-art-bt { background: var(--blau); } .kal-art-wunsch { background: var(--violett); }
.kalender-tag { margin-top: 16px; }
.kalender-tag h2 { margin: 0 0 8px; font-size: 15px; }
.termine-ansichtswahl button:focus-visible, .kalender-navbtn:focus-visible, .kalender-tagbtn:focus-visible { outline: 2px solid #8cc7f2; outline-offset: -2px; }

/* --- App-Belegansicht (beleg_ansicht.html): Rechnung als SEITENBILD(er) in normalem HTML -> auf der
   iOS-Standalone-PWA loest ein <img> nie eine Vollbild-Navigation aus, der Zurueck-Weg (Kopf sticky +
   Knopf unten) bleibt IMMER sichtbar (Codex-Empfehlung 15.07.). --- */
.beleg-block { padding-top: 6px; }
.beleg-seite {
  display: block; width: 100%; height: auto; margin: 0 0 10px;
  border: 1px solid var(--rand); border-radius: 8px; background: #fff;
}
.beleg-fuss { margin: 18px 0 6px; }
.beleg-fuss .btn { width: 100%; text-align: center; }
.beleg-fuss .btn span { margin-right: 3px; }

/* Welle 2: Sprung zur Belege-Gruppe (steht sonst ganz unten) + Anker-Versatz gegen den sticky Kopf. */
.beleg-sprung {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 0 0 14px; padding: 11px 14px; min-height: 44px;
  border: 1px solid var(--rand); border-radius: 12px; background: var(--flaeche);
  color: var(--text); text-decoration: none;
}
.beleg-sprung > span:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.beleg-sprung b { font-size: 15px; font-weight: 750; }
.beleg-sprung small { color: var(--sub); font-size: 13px; }
.beleg-sprung-pfeil { flex: none; color: var(--gruen-hell); font-size: 18px; font-weight: 800; }
.beleg-sprung:active { background: var(--druck); }
#belege { scroll-margin-top: calc(66px + env(safe-area-inset-top)); }
