/* thiesen HUB – Stylesheet. Bausteine: src/hub/web/ui.js, lebende Vorlage: Einstellungen → Template.
   Gestaltung: Farben von thiesen-bremser.de (Blau primär, Weinrot für Seitenleiste und Akzente), eckig, flach.
   Skalen: Abstände 4-px-Raster (--s1 … --s8), Schriftgrößen --fs-*, Kontrollhöhe --control-h. */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f7f8f9;
  --surface-3: #eef0f2;
  --text: #2b2b2b;
  --text-strong: #1a1a1a;
  --muted: #6b7076;
  --muted-2: #9aa0a6;
  --border: #e3e5e8;
  --border-strong: #cfd3d8;
  --primary: #0055a4;
  --primary-hover: #00447f;
  --primary-soft: #e8eff8;
  --primary-text: #ffffff;
  --accent: #7e4455;
  --accent-hover: #653646;
  --accent-soft: #f3e9ec;
  --success: #15803d;
  --success-soft: #e7f6ec;
  --success-strong: #0d5227;
  --warning: #b45309;
  --warning-soft: #fdf1d6;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --info: #0055a4;
  --info-soft: #e8eff8;
  --sidebar: #7e4455;
  --sidebar-2: #6f3a4a;
  --sidebar-text: #f1e4e8;
  --sidebar-muted: #d3b4bd;
  --sidebar-active: #5e3242;
  --sidebar-border: rgba(255,255,255,.14);
  --sidebar-strong: #ffffff;
  --radius: 0;
  --radius-sm: 0;
  --shadow: none;
  --shadow-pop: 0 10px 30px rgba(20, 20, 20, .16);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .3);
  --focus: 0 0 0 3px rgba(0, 85, 164, .28);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px;
  /* Abstandssystem (siehe Block „Abstände“ unten): vier Stufen, überall dieselben */
  --gap-inline: var(--s2);   /* nebeneinander: Buttons, Tags, Badges, Chips */
  --gap-text: var(--s3);     /* Textfluss: Absätze, Listenpunkte, Beschriftung → Feld */
  --gap-block: var(--s4);    /* untereinander: Feld, Karte, Tabelle, Hinweis, Codeblock, Button-Zeile */
  --gap-section: var(--s6);  /* Abschnitte: Seitenkopf, Reiter, Kachelreihe, h2 */
  --pad-box: var(--s5);      /* Innenabstand von Containern: Karte, Dialog, leerer Zustand */
  --fs-xs: 0.75rem; --fs-sm: 0.85rem; --fs-md: 0.95rem; --fs-lg: 1.1rem; --fs-xl: 1.35rem; --fs-2xl: 1.7rem;
  --control-h: 38px;
  --topbar-h: 60px;    /* mobile Kopfzeile (Burger); klebende Elemente darunter nutzen denselben Wert */
  --sidebar-w: 240px;
  --subnav-w: 220px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, input, textarea, select { font: inherit; color: inherit; }
/* hidden-Attribut gewinnt immer, auch gegen display-Regeln für Buttons (Zurück im Assistenten, Standard-Submit im Dialog) */
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); }
a { color: var(--primary); }
img, svg { vertical-align: middle; }

/* ---------- Typografie ---------- */
h1 { margin: 0 0 var(--s4); font-size: var(--fs-2xl); line-height: 1.2; font-weight: 700; color: var(--text-strong); letter-spacing: -0.01em; }
h2 { margin: var(--gap-section) 0 var(--gap-text); font-size: var(--fs-xl); line-height: 1.3; font-weight: 700; color: var(--text-strong); }
h3 { margin: var(--s4) 0 var(--s2); font-size: var(--fs-lg); font-weight: 600; color: var(--text-strong); }
h4 { margin: var(--s3) 0 var(--s1); font-size: var(--fs-md); font-weight: 600; }
p { margin: 0 0 var(--gap-text); }
small, .small { font-size: var(--fs-sm); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.lead { font-size: 1.05rem; color: var(--muted); }
.inactive { color: var(--muted); text-decoration: line-through; }
.eyebrow { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.mono, code, kbd, pre { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.88em; }
code { background: var(--surface-3); border: 1px solid var(--border); padding: 0.05em 0.35em; }
pre { background: #22262b; color: #e6edf7; padding: var(--s3) var(--s4); overflow-x: auto; margin: var(--s2) 0 0; line-height: 1.5; }
pre code { background: none; border: 0; padding: 0; color: inherit; }
kbd { background: var(--surface-2); border: 1px solid var(--border-strong); border-bottom-width: 2px; padding: 0.05em 0.4em; }
hr, .divider { border: 0; border-top: 1px solid var(--border); margin: var(--s5) 0; }
.text-right, .align-right { text-align: right; }

/* ---------- Abstände ----------
   Vier Stufen (Variablen in :root): --gap-inline nebeneinander, --gap-text im Textfluss, --gap-block untereinander,
   --gap-section zwischen Abschnitten; --pad-box ist der Innenabstand von Containern.
   Regeln: Geschwister in einer Zeile stehen in einem Flex-Container mit gap (.btn-row, .row, .card-actions …), nie lose
   nebeneinander. Gestapelte Bausteine tragen margin-bottom: var(--gap-block); das letzte Kind eines Containers verliert
   ihn. Innenabstände liegen auf dem Container, nie als Rand auf den Kindern. Keine festen Pixelwerte in Seiten. */
.row { display: flex; flex-wrap: wrap; gap: var(--gap-inline); align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.card-body > :last-child, .dialog-body > :last-child, .frame > :last-child, .empty-state > :last-child, .alert > div > :last-child,
.tab-panel > :last-child, .wizard-pane > :last-child, .tpl-demo > :last-child, .cell > :last-child { margin-bottom: 0; }
.card-body > :first-child, .dialog-body > :first-child, .tab-panel > :first-child, .alert > div > :first-child, .tpl-demo > :first-child { margin-top: 0; }
/* Listen im Inhalt: Textabstand zwischen Punkten, Blockabstand danach */
/* nur direkte Inhaltslisten, nicht die ul innerhalb von Bausteinen (Combobox-Liste, Reiter) */
.card-body > ul, .card-body > ol, .dialog-body > ul, .dialog-body > ol, .alert > div > ul, .alert > div > ol, ul.list, ol.list { margin: 0 0 var(--gap-block); padding-left: 1.4em; }
.card-body > ul > li, .card-body > ol > li, .dialog-body > ul > li, .dialog-body > ol > li, .alert > div > ul > li, .alert > div > ol > li, .list > li { margin-bottom: var(--s1); }
ul.plain { list-style: none; margin: 0 0 var(--gap-block); padding: 0; }
/* Sicherheitsnetz: Buttons, die ohne Zeilen-Container direkt nebeneinander stehen */
.card-body > button + button, .dialog-body > button + button, .empty-state > button + button, p > button + button, .alert button + button { margin-left: var(--gap-inline); }
/* Ausnahmen, sparsam: kleine Rand-Helfer auf der Skala, Breite, Innenabstand, begrenzte Höhe */
.mt-1 { margin-top: var(--s1); } .mt-2 { margin-top: var(--s2); } .mt-3 { margin-top: var(--s3); } .mt-4 { margin-top: var(--s4); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.w-full { width: 100%; }
.pad { padding: var(--s7); }
.scroll-box { max-height: 220px; overflow: auto; }
/* frühere Fassung eines formatierten Textes (Verlauf): mehr Höhe, Bilder passen sich der Spalte an */
.scroll-box.version-text { max-height: 420px; min-width: 220px; }
.scroll-box.version-text img { max-width: 100%; height: auto; }
/* Längerer Rohtext (ausgelesene Unterlagen, Bemerkungen): Zeilenumbrüche bleiben, scrollt ab einer gewissen Höhe */
.text-box { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-sm); line-height: 1.5; max-height: 320px; overflow: auto; padding: var(--s3); border: 1px solid var(--border); background: var(--surface-2); margin-bottom: var(--gap-block); }
.text-box:last-child, details > .text-box { margin-bottom: 0; }

.app { min-height: 100vh; }
.loading { padding: var(--s7) 0; color: var(--muted); display: flex; align-items: center; gap: var(--s2); }
/* Ladebildschirm beim Start (index.html): Bildzeichen schaukelt auf einer Welle; erscheint erst nach 0,3 s, damit er bei
   schnellem Laden nicht aufblitzt. Farben aus dem Thema, ohne Bewegung bei „weniger Bewegung“. */
.boot-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2); padding: var(--s5); color: var(--sidebar); opacity: 0; animation: boot-in 0.4s ease-out 0.3s forwards; }
.boot-mark { width: 72px; height: 72px; animation: boot-bob 2.4s ease-in-out infinite; }
.boot-wave { width: 120px; height: 16px; overflow: hidden; }
.boot-wave path { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; animation: boot-wave 2.4s linear infinite; }
.boot-screen p { margin: var(--s3) 0 0; color: var(--muted); font-size: var(--fs-sm); }
@keyframes boot-in { to { opacity: 1; } }
@keyframes boot-bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
@keyframes boot-wave { from { transform: translateX(0); } to { transform: translateX(-60px); } }
@media (prefers-reduced-motion: reduce) { .boot-mark, .boot-wave path { animation: none; } .boot-screen { animation-duration: 0.01s; } }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); background: linear-gradient(180deg, var(--sidebar) 0, var(--sidebar) 42%, var(--bg) 42%); }
.login form:not(.consent-form) { background: var(--surface); padding: var(--s7); width: 100%; max-width: 380px; border: 1px solid var(--border); box-shadow: var(--shadow-pop); }
.login h1 { margin: 0 0 var(--s5); font-size: var(--fs-xl); display: flex; align-items: center; gap: var(--s3); }
/* Erlaubnis-Seite (OAuth): Karte statt Login-Formular */
.consent { width: 100%; max-width: 560px; }
.consent .card { box-shadow: var(--shadow-pop); }
.consent .card-title { display: flex; align-items: center; gap: var(--s3); }
.consent .card-title .brand-mark { width: 32px; height: 32px; background: var(--sidebar); color: var(--sidebar-strong); }
.consent .perms { max-height: 220px; overflow: auto; }
.login h1 .brand-mark { width: 40px; height: 40px; background: var(--sidebar); color: var(--sidebar-strong); }
/* Logo von 1ander (UI.brandLogo): Bildzeichen im Markenfeld, Wortmarke auf Anmelde- und Einladungsseite; Farbe = currentColor */
.brand-icon, .brand-wordmark { display: block; flex: none; }
.brand-mark-icon .brand-icon { width: 68%; height: 68%; }
.login h1.brand-title { display: block; margin-bottom: var(--s1); color: var(--sidebar); }
.brand-title .brand-wordmark { width: 180px; height: auto; }
/* Wortmarke mit Zusatz als Einheit (Ops Center, Partnerbereich): der Zusatz steht klein und gesperrt rechtsbündig unter
   dem letzten Buchstaben, so breit wie nötig, dicht an der Grundlinie der Wortmarke */
.brand-lockup { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1; }
.brand-lockup .brand-wordmark { width: 140px; height: auto; }
.brand-descriptor { margin-top: -2px; padding-right: 3px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; white-space: nowrap; opacity: 0.85; }
.sidebar .brand-lockup { color: var(--sidebar-strong); }
.login h1.brand-title .brand-lockup .brand-wordmark { width: 180px; }
.login h1.brand-title .brand-descriptor { font-size: 0.74rem; margin-bottom: var(--s4); }
.tpl-logo { color: var(--sidebar); }
.tpl-logo .brand-wordmark { width: 180px; height: auto; }
.login .brand-claim { margin: 0 0 var(--s5); color: var(--muted); font-size: var(--fs-sm); }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) auto 1fr; min-height: 100vh; align-items: start; }
.topbar { display: none; }
.drawer { display: contents; }
.backdrop { position: fixed; inset: 0; background: rgba(20, 10, 14, .5); z-index: 20; }
.backdrop[hidden] { display: none; }

/* Seitenleiste */
.sidebar { grid-column: 1; position: sticky; top: 0; height: 100vh; height: 100dvh; background: var(--sidebar); color: var(--sidebar-text); padding: var(--s5) var(--s3) var(--s3); display: flex; flex-direction: column; gap: var(--s4); }
.sidebar .brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2) var(--s4); border-bottom: 1px solid var(--sidebar-border); flex: none; color: var(--sidebar-strong); }
/* Logo und Name oben links führen zum Dashboard */
a.brand, .brand-home { color: inherit; text-decoration: none; }
.brand-home { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
/* Doppeltippen zoomt am Handy nicht; kein automatisches Vergrößern der Schrift beim Drehen */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none; background: var(--sidebar-strong); color: var(--sidebar); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.02em; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 1.02rem; font-weight: 700; white-space: nowrap; }
.brand-text small { font-size: var(--fs-xs); color: var(--sidebar-muted); font-weight: 400; }
.icon-btn.drawer-close { display: none; }
.sidebar nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.35) transparent; display: flex; flex-direction: column; gap: var(--s1); padding-right: 2px; }
.nav-label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sidebar-muted); padding: var(--s2) var(--s3) var(--s1); }
.sidebar nav a { display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s3); color: var(--sidebar-text); text-decoration: none; font-weight: 500; border-left: 3px solid transparent; transition: background 0.12s, color 0.12s; }
.sidebar nav a svg { flex: none; opacity: 0.85; }
.sidebar nav a:hover { background: var(--sidebar-2); color: var(--sidebar-strong); }
.sidebar nav a.active { background: var(--sidebar-active); color: var(--sidebar-strong); border-left-color: var(--sidebar-strong); font-weight: 600; }
.sidebar nav a.active svg { opacity: 1; }

.me-bar { position: relative; flex: none; padding-top: var(--s3); border-top: 1px solid var(--sidebar-border); display: flex; justify-content: flex-start; gap: var(--s1); }
.me-bar #logout { margin-left: auto; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; background: transparent; color: var(--sidebar-text); cursor: pointer; transition: background 0.12s, color 0.12s; }
.icon-btn:hover, .icon-btn.active, .icon-btn[aria-expanded="true"] { background: var(--sidebar-active); color: var(--sidebar-strong); }
.dropup { position: absolute; bottom: calc(100% + var(--s1)); left: 0; right: 0; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-pop); padding: var(--s3); font-size: var(--fs-sm); z-index: 10; }
.dropup .name { font-weight: 600; color: var(--text-strong); }
.dropup .roles { color: var(--muted); font-size: var(--fs-xs); margin-bottom: var(--s2); }
.dropup a { display: block; padding: var(--s2) var(--s2); margin: 0 calc(-1 * var(--s1)); color: var(--primary); text-decoration: none; font-weight: 500; }
.dropup a:hover, .dropup a.active { background: var(--primary-soft); }

/* Untermenü */
.subnav { grid-column: 2; position: sticky; top: 0; height: 100vh; height: 100dvh; width: var(--subnav-w); background: var(--surface); border-right: 1px solid var(--border); padding: var(--s5) var(--s3); overflow-y: auto; scrollbar-width: thin; }
.subnav[hidden] { display: none; }
.subnav h2 { margin: 0 0 var(--s3); padding: 0 var(--s3); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
/* Gruppenüberschrift im Untermenü (Einträge mit `group`), ersetzt den Bereichstitel über der Liste */
.subnav h3 { margin: var(--s4) 0 var(--s3); padding: 0 var(--s3); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.subnav h3:first-child { margin-top: 0; }
.subnav nav { display: flex; flex-direction: column; gap: 2px; }
.subnav a { display: block; padding: var(--s2) var(--s3); color: var(--text); text-decoration: none; border-left: 3px solid transparent; transition: background 0.12s; }
.subnav a:hover { background: var(--surface-2); }
.subnav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; border-left-color: var(--accent); }
/* aufklappbare Bäume im Untermenü (app.js subnavTree, z. B. Seiten und Notizen der Wissensdatenbank).
   Tiefe: Ebene 2 und 3 rücken voll ein; ab Ebene 4 nur noch wenig, mit einer Führungslinie, damit auch tiefe Bäume in
   der schmalen Spalte lesbar bleiben (zehnte Ebene: rund 65 px Einzug statt 150 px, es bleiben gut 100 px für den Titel). */
.subnav-tree ul { list-style: none; margin: 0; padding: 0; }
.subnav-tree ul ul { padding-left: var(--s3); }
.subnav-tree ul ul ul ul { padding-left: 3px; margin-left: 2px; border-left: 1px solid var(--border-strong); }
.subnav-tree li:not(.open) > ul { display: none; }
.subnav-tree .tree-row { display: flex; align-items: flex-start; }
.subnav-tree .tree-row a { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* mit Unterebenen sitzt der Text dicht am Pfeil; eine einfache Liste (.flat) steht bündig mit den übrigen Einträgen */
.subnav-tree:not(.flat) .tree-row a { padding-left: var(--s1); }
.subnav-tree .tree-toggle { flex: none; width: 20px; min-width: 0; height: auto; min-height: 0; align-self: stretch; padding: 0; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.subnav-tree button.tree-toggle { cursor: pointer; }
.subnav-tree button.tree-toggle:hover { color: var(--text-strong); background: var(--surface-2); }
.subnav-tree .tree-toggle svg { transition: transform 0.12s; }
.subnav-tree li.open > .tree-row .tree-toggle svg { transform: rotate(90deg); }
/* Ordner ohne eigene Seite (Bereich, Datensatz): die ganze Zeile klappt auf */
.subnav-tree .tree-folder { flex: 1; min-width: 0; height: auto; min-height: 0; display: flex; align-items: flex-start; justify-content: flex-start; gap: 0; line-height: inherit; padding: var(--s2) var(--s3) var(--s2) 0; border: 0; border-left: 3px solid transparent; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.subnav-tree .tree-folder:hover { background: var(--surface-2); }
.subnav-tree .tree-folder > span:last-child { padding-left: var(--s1); min-width: 0; }
.subnav-tree .tree-folder .tree-toggle { align-self: flex-start; height: 1.5em; }
.subnav-tree > p { padding: 0 var(--s3); }
.subnav-tree > nav a { display: flex; align-items: center; gap: var(--s1); }
/* Eintrag, der etwas öffnet statt zu einer Seite zu führen (z. B. „+ Neue Veranstaltung“) */
.subnav a.subnav-action { display: flex; align-items: center; gap: var(--s1); }
/* Überschrift als Link (führt zur Seite mit allem): sieht aus wie die übrigen Überschriften */
.subnav h3 > a { display: inline; padding: 0; border: 0; color: inherit; font: inherit; letter-spacing: inherit; }
.subnav h3 > a:hover { background: none; text-decoration: underline; }
.subnav-tree-all { margin-top: var(--s4); }
/* Abzeichen an einem Eintrag des Untermenüs (Zahl dessen, was dort wartet) */
.subnav nav a:has(> .nav-badge) { display: flex; align-items: center; gap: var(--s2); }
.subnav nav a > .nav-badge { background: var(--accent); color: #fff; }
/* Aktion am unteren Bildschirmrand des Untermenüs (tree.foot): das Untermenü wird zur Spalte, der Fuß rutscht nach unten und bleibt beim Scrollen stehen */
.subnav:has(.subnav-foot) { display: flex; flex-direction: column; padding-bottom: 0; }
.subnav [data-subnav-trees]:has(.subnav-foot) { flex: 1 0 auto; display: flex; flex-direction: column; }
.subnav-foot { margin-top: auto; position: sticky; bottom: 0; padding: var(--s3) 0; background: var(--surface); border-top: 1px solid var(--border); }
[data-subnav-trees] > h3:first-child { margin-top: var(--s4); }

.content { grid-column: 3; padding: var(--s6) var(--s7) var(--s8); min-width: 0; overflow-x: clip; } /* clip statt auto: sonst wird .content zum Scroll-Container und position: sticky (Dokumentvorschau) greift nicht */

/* Seitenkopf: links Titel + Breadcrumbs (Rückweg), rechts Status + Aktionen, Trennlinie zum Inhalt */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); margin: 0 0 var(--gap-section); padding-bottom: var(--s4); border-bottom: 1px solid var(--border); }
.page-title { flex: 1 1 auto; min-width: 0; }
.page-header h1 { margin: 0; }
.page-header .subtitle { margin: var(--s2) 0 0; color: var(--muted); }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); margin-top: var(--s1); font-size: var(--fs-sm); color: var(--muted); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); text-decoration: underline; }
.crumb-sep { display: inline-flex; color: var(--muted-2); }
.page-side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s2); flex: none; }
.page-status { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; justify-content: flex-end; color: var(--muted); font-size: var(--fs-sm); }
.page-actions { display: flex; gap: var(--gap-inline); flex-wrap: wrap; justify-content: flex-end; }
.page-actions[hidden] { display: none; }
.page-menu { position: relative; }
.page-menu-toggle { width: var(--control-h); height: var(--control-h); padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.page-menu-list { position: absolute; right: 0; top: calc(100% + var(--s1)); z-index: 40; min-width: 240px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop); padding: var(--s1) 0; display: flex; flex-direction: column; }
.page-menu-list[hidden] { display: none; }
/* eigenständiges „…“-Menü (UI.moreMenu); steht es links im Bild, klappt es mit .start nach rechts auf */
.more-menu.start .page-menu-list { right: auto; left: 0; }
/* beschriftetes Dropdown („Status ▾“) und kleine Fassung: so hoch wie kleine Knöpfe daneben */
.page-menu-toggle.with-text { width: auto; padding: 0 var(--s3); gap: var(--s1); }
.page-menu-toggle.small { height: 30px; font-size: var(--fs-sm); }
.page-menu-toggle.small:not(.with-text) { width: 30px; }
@media (max-width: 1079px) { .page-menu-toggle.small { height: 36px; } .page-menu-toggle.small:not(.with-text) { width: 36px; } }
/* Löschen im Menü: rote Schrift auf hellem Grund, auch beim Überfahren (sonst rot auf rot) */
.page-menu-list button.btn-danger, .page-menu-list button.btn-danger:hover, .page-menu-list button.danger:hover { background: transparent; border: 0; color: var(--danger); }
.page-menu-list button.btn-danger:hover, .page-menu-list button.danger:hover { background: var(--danger-soft); }
/* Aufgabe: Bearbeiten und Löschen als Symbole am Ende der Zeile */
.task-actions .task-tools { margin-inline-start: auto; }
.page-menu-list button { width: 100%; justify-content: flex-start; border: 0; background: transparent; color: var(--text); padding: var(--s3) var(--s4); white-space: nowrap; height: auto; }
/* Im Menü verlieren Buttons ihre Flächenfarbe (höhere Spezifität als button.primary / .btn-danger) */
.page-menu-list > button, .page-menu-list > button.primary, .page-menu-list > button.btn-danger, .page-menu-list > button.danger { background: transparent; border: 0; }
.page-menu-list > button:hover { background: var(--primary-soft); border: 0; }
.page-menu-list > button.primary { color: var(--primary); font-weight: 600; }
.page-menu-list > button.danger, .page-menu-list > button.btn-danger { color: var(--danger); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); margin-bottom: var(--gap-block); flex-wrap: wrap; }
.list-footer { display: flex; justify-content: flex-end; align-items: center; gap: var(--s3); margin: calc(-1 * var(--s2)) 0 var(--s4); color: var(--muted); font-size: var(--fs-sm); }

/* ---------- Karten, Rahmen, Kacheln, Raster ---------- */
.card { background: var(--surface); border: 1px solid var(--border); margin-bottom: var(--gap-block); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); padding: var(--s3) var(--s5); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.card-title { margin: 0; font-size: var(--fs-md); font-weight: 700; color: var(--text-strong); }
.card-actions { display: flex; gap: var(--gap-inline); align-items: center; }
.card-body { padding: var(--pad-box); }
.card-body > :last-child { margin-bottom: 0; }
.card-footer { padding: var(--s3) var(--s5); border-top: 1px solid var(--border); background: var(--surface-2); display: flex; gap: var(--gap-inline); justify-content: flex-end; }
/* Formulare füllen ihre Karte; Aufteilung über .form-row / .grid-2 statt über Maximalbreiten */
.frame { border: 1px solid var(--border); padding: var(--s3) var(--s4) var(--s2); margin: 0 0 var(--gap-block); min-width: 0; }
.frame legend { padding: 0 var(--s2); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-block); margin-bottom: var(--gap-block); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap-block); margin-bottom: var(--gap-block); }
.stack { display: flex; flex-direction: column; gap: var(--gap-block); margin-bottom: var(--gap-block); }
/* in Rastern und Stapeln regelt der gap den Abstand, nicht der Rand der Kinder */
.grid-2 > *, .grid-3 > *, .stack > * { margin-bottom: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap-block); margin-bottom: var(--gap-section); }
.tile { background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--primary); padding: var(--s4) var(--s5); }
.tile .label { color: var(--muted); font-size: var(--fs-sm); }
.tile .value { font-size: 1.9rem; font-weight: 700; margin-top: var(--s1); line-height: 1.15; color: var(--text-strong); letter-spacing: -0.01em; }
.tile-foot { margin-top: var(--s2); font-size: var(--fs-sm); display: flex; gap: var(--s2); align-items: center; }
.trend.up { color: var(--success); font-weight: 600; }
.trend.down { color: var(--danger); font-weight: 600; }
/* Kachel als Link zu ihren Werten (UI.kpi mit href oder scrollTo): Pfeil am Label, beim Überfahren hinterlegt */
a.tile.tile-link { display: block; color: inherit; text-decoration: none; transition: background 0.12s; }
a.tile.tile-link:hover { background: var(--surface-2); }
.tile-link .label { display: flex; justify-content: space-between; gap: var(--s2); }
.tile-link .label::after { content: "›"; font-weight: 700; color: var(--primary); }
/* Sprungziel (UI.scrollToTarget): Abstand zum oberen Rand und kurzer Rahmen, damit man sieht, wo man gelandet ist */
.jump-flash { scroll-margin-top: var(--s5); animation: jump-flash 1.8s ease-out; }
@keyframes jump-flash { 0%, 35% { outline: 3px solid var(--primary); outline-offset: 3px; } 100% { outline: 3px solid transparent; outline-offset: 3px; } }
@media (prefers-reduced-motion: reduce) { .jump-flash { animation-duration: 0.01s; } }
@media (max-width: 1079px) { .jump-flash { scroll-margin-top: calc(56px + var(--s4)); } } /* mobil unter der festen Kopfzeile */
/* Kachel mit Zustand: nur die Oberkante trägt die Farbe, Zahl und Text bleiben in Textfarbe */
.tile-success { border-top-color: var(--success); }
.tile-warning { border-top-color: var(--warning); }
.tile-danger { border-top-color: var(--danger); }
.tile-neutral { border-top-color: var(--border-strong); }

/* Anteilsbalken (UI.shareBar): Segmente mit 2 px Abstand, Legende mit Wert und Anteil darunter */
.share { margin-bottom: var(--gap-block); }
.share-bar { display: flex; gap: 2px; height: 14px; }
.share-seg { flex: 1 1 0; min-width: 4px; }
.share-success { background: var(--success); }
.share-warning { background: var(--warning); }
.share-danger { background: var(--danger); }
.share-info { background: var(--primary); }
.share-neutral { background: var(--border-strong); }
.share-empty { background: var(--surface-2); border: 1px solid var(--border); }
.share-legend { list-style: none; margin: var(--s3) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s6); font-size: var(--fs-sm); }
.share-legend li { display: flex; align-items: center; gap: var(--s2); }
.share-dot { width: 10px; height: 10px; flex: none; }

/* Dashboard: zwei Spalten, sobald beide mindestens 560 px bekommen (breites Fenster), sonst untereinander. Eine Spalte ohne
   Inhalt verschwindet und die andere füllt die Breite; .keep hält eine Spalte offen, deren Inhalt noch lädt. */
.dash-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); gap: 0 var(--gap-section); align-items: start; }
.dash-cols > div { min-width: 0; }
.dash-cols > div:not(.keep):not(:has(> div:not(:empty))) { display: none; }

/* Zielbalken (UI.goalBar): grüne Füllung bis zum Ziel; darüber voll, mit Marke am Ziel und dunklerem Teil dahinter */
.goal { margin-bottom: var(--gap-block); }
.goal-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--s2) var(--s3); margin-bottom: var(--s2); }
.goal-label { color: var(--muted); font-size: var(--fs-sm); }
.goal-value { font-size: var(--fs-xl); color: var(--text-strong); line-height: 1.15; }
.goal-bar { position: relative; height: 18px; background: var(--surface-3); overflow: hidden; }
.goal-fill { position: absolute; inset: 0 auto 0 0; background: var(--success); }
.goal-over { position: absolute; top: 0; bottom: 0; right: 0; background: var(--success-strong); border-left: 2px solid var(--surface); }
.goal-hint { margin: var(--s2) 0 0; }
/* Fortschrittsbalken (UI.progress): laufender Vorgang; .indeterminate = Dauer unbekannt, .done grün, .error rot */
.progress { margin-bottom: var(--gap-block); }
.progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s2); }
.progress-label { color: var(--text-strong); font-weight: 600; }
.progress-value { color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.progress-bar { position: relative; height: 10px; background: var(--surface-3); overflow: hidden; }
.progress-fill { position: absolute; inset: 0 auto 0 0; background: var(--primary); transition: width .4s ease; }
.progress.indeterminate .progress-fill { width: 35% !important; animation: progress-run 1.4s ease-in-out infinite; }
.progress.done .progress-fill { background: var(--success); }
.progress.error .progress-fill { background: var(--danger); }
.progress-hint { margin: var(--s2) 0 0; min-height: 1.4em; }
@keyframes progress-run { from { left: -35%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } .progress.indeterminate .progress-fill { animation-duration: 4s; } }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); background: var(--surface); margin-bottom: var(--gap-block); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
/* Zellen immer oben links; Zahlen ausnahmsweise rechts (head: { align: "right" }), damit hohe Zellen lesbar bleiben */
th, td { text-align: left; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
tbody tr:hover td { background: #fafbfc; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
td.actions button + button { margin-left: var(--gap-inline); }
/* Knöpfe in einer .row (Flex) stehen in der Aktionsspalte ebenfalls rechts; mehrere Zeilen brechen rechtsbündig um */
td.actions .row { justify-content: flex-end; flex-wrap: wrap; }
td.actions .row button + button { margin-left: 0; }
.table-empty { text-align: center; padding: var(--s6); }
/* Gestapelt (wenn die Tabelle nicht in die Breite passt, auf jeder Bildschirmgröße; ui.js setzt .stacked): jede Zeile eine Karte,
   jede Zelle mit ihrem Spaltenkopf (data-label) als Beschriftung links, Inhalt rechts daneben */
.table-wrap.stacked { overflow: visible; border: 1px solid var(--border); background: var(--surface-3); padding: var(--s3); }
.table-wrap.stacked table, .table-wrap.stacked tbody, .table-wrap.stacked tr, .table-wrap.stacked td { display: block; }
.table-wrap.stacked thead { display: none; }
.table-wrap.stacked tr { border: 1px solid var(--border-strong); background: var(--surface); margin-bottom: var(--s3); }
.table-wrap.stacked tr:last-child { margin-bottom: 0; }
.table-wrap.stacked td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); white-space: normal; text-align: left; }
.table-wrap.stacked td:last-child { border-bottom: 0; }
.table-wrap.stacked tbody tr:hover td { background: var(--surface); }
/* erste Spalte als Kopfzeile der Karte: grauer Streifen, fetter Wert – so ist der Zeilenanfang sofort erkennbar */
.table-wrap.stacked td:first-child, .table-wrap.stacked tbody tr:hover td:first-child { background: var(--surface-2); }
.table-wrap.stacked td:first-child .cell { font-weight: 600; color: var(--text-strong); }
.table-wrap.stacked td.table-empty { background: var(--surface); font-weight: 400; }
.table-wrap.stacked td[data-label] { display: grid; grid-template-columns: minmax(0, min(12em, 35%)) minmax(0, 1fr); column-gap: var(--s3); align-items: start; }
.table-wrap.stacked td[data-label]::before { content: attr(data-label); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding-top: 0.2em; overflow-wrap: anywhere; }
.table-wrap.stacked td.align-right .cell { text-align: right; }
.table-wrap.stacked td.actions .cell { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--gap-inline); }
.table-wrap.stacked td.actions button + button { margin-left: 0; }
.table-wrap.stacked td.table-empty { text-align: center; }

/* ---------- Tags, Badges ---------- */
.tag { display: inline-block; background: var(--primary-soft); color: #23487a; padding: 0.1rem 0.5rem; font-size: var(--fs-xs); font-weight: 500; margin: 0 var(--s1) var(--s1) 0; line-height: 1.5; }
a.tag { text-decoration: none; }
a.tag:hover, a.tag:focus-visible { text-decoration: underline; }
.tag.system { background: var(--accent-soft); color: var(--accent); }
.tag.success { background: var(--success-soft); color: var(--success); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.neutral { background: var(--surface-3); color: #4b5563; }
.badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.1rem 0.55rem; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.01em; line-height: 1.6; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; background: currentColor; flex: none; }
.badge-busy::before { display: none; }
.badge .spinner { width: 10px; height: 10px; --spin-track: currentColor; --spin-arc: transparent; opacity: 0.8; }
.badge-neutral { background: var(--surface-3); color: #4b5563; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }

/* ---------- Hinweise (Alerts) ---------- */
.alert { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border: 1px solid transparent; border-left-width: 4px; margin-bottom: var(--gap-block); }
.alert-icon { flex: none; display: inline-flex; margin-top: 0.15rem; }
.alert-title { font-weight: 700; margin-bottom: 0.15rem; }
/* Hinweise zum Abo ganz oben im Dashboard der Administration (Test endet, mehr Mitglieder als enthalten): bewusst auffällig */
.abo-notice .alert { border-width: 2px; border-left-width: 8px; padding: var(--s4) var(--s5); }
.abo-notice .alert-title { font-family: var(--font-display); font-size: var(--fs-lg); margin-bottom: var(--s1); }
.abo-notice .alert p { margin: 0; }
.alert-info { background: var(--info-soft); border-color: #cfdcf0; border-left-color: var(--info); color: #1e3a66; }
.alert-success { background: var(--success-soft); border-color: #bfe5cb; border-left-color: var(--success); color: #14532d; }
.alert-warning { background: var(--warning-soft); border-color: #f1dca8; border-left-color: var(--warning); color: #713f12; }
.alert-danger { background: var(--danger-soft); border-color: #f3c3bd; border-left-color: var(--danger); color: #7f1d1d; }

/* ---------- Formulare ---------- */
.field { display: block; margin-bottom: var(--gap-block); min-width: 0; }
.field > span { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text); margin-bottom: var(--s1); }
.field .req { color: var(--danger); font-style: normal; }
.field input:not([type=checkbox]):not([type=radio]), .field textarea, .field select {
  width: 100%; min-height: var(--control-h); padding: 0 var(--s3); border: 1px solid var(--border-strong); background: #fff; color: var(--text); transition: border-color 0.12s, box-shadow 0.12s;
}
.field textarea { padding: var(--s2) var(--s3); resize: vertical; min-height: calc(var(--control-h) * 2); line-height: 1.5; }
.field select { appearance: auto; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); box-shadow: var(--focus); outline: none; }
.field input[readonly], .field input:disabled, .field textarea:disabled, .field select:disabled { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); }
.field .help { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: var(--s1); }
.field .field-error { display: none; color: var(--danger); font-size: var(--fs-xs); margin-top: var(--s1); }
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: var(--danger); }
.field.invalid .field-error { display: block; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--gap-block); }
.form-row.align-end { align-items: end; }   /* Button neben einem Feld auf dessen Unterkante */
.check { display: flex; gap: var(--s2); align-items: flex-start; margin: var(--s2) 0; cursor: pointer; }
.check input { margin: 0.3rem 0 0; width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.check .hint, .switch .hint { color: var(--muted); font-size: var(--fs-xs); font-weight: 400; }
.switch { display: flex; align-items: flex-start; gap: var(--s3); margin: var(--s2) 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { flex: none; width: 36px; height: 20px; background: var(--border-strong); position: relative; transition: background 0.15s; margin-top: 0.15rem; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus); }
.perm-group { margin-bottom: var(--s3); break-inside: avoid; }
.perm-group h4 { margin: 0 0 var(--s1); font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.perm-groups { columns: 2; column-gap: var(--s7); }
.error { color: var(--danger); font-size: var(--fs-sm); margin: var(--s2) 0; }
.error:empty { display: none; }

/* ---------- Buttons ---------- */
button { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: var(--control-h); padding: 0 var(--s4); border: 1px solid var(--border-strong); background: #fff; color: var(--text); cursor: pointer; line-height: 1.2; white-space: nowrap; font-weight: 500; transition: background 0.12s, border-color 0.12s, color 0.12s; }
button:hover { background: var(--surface-2); border-color: #b9bfc6; }
button.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
button.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
button.danger { color: var(--danger); }
button.danger:hover { background: var(--danger-soft); border-color: #e7a9a2; }
button.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
button.btn-danger:hover { background: #961c13; border-color: #961c13; }
button.btn-ghost { background: transparent; border-color: transparent; }
button.btn-ghost:hover { background: var(--surface-3); }
button.btn-link { background: none; border: 0; padding: 0; height: auto; color: var(--primary); text-decoration: underline; }
button.small { height: 30px; padding: 0 var(--s3); font-size: var(--fs-sm); }
button.icon-only { width: var(--control-h); padding: 0; }
button.icon-only.small { width: 30px; }
button:disabled { opacity: 0.5; cursor: default; }
/* gesperrter Hauptknopf: grau statt blassem Blau auf Blau (Text sonst kaum lesbar) */
button.primary:disabled { opacity: 1; background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.btn-row { display: flex; gap: var(--gap-inline); justify-content: flex-end; align-items: center; margin-top: var(--gap-block); flex-wrap: wrap; }
.btn-row.start { justify-content: flex-start; }
.btn-row.center { justify-content: center; }
/* Knopf rechtsbündig mit Hinweis darunter (z. B. Sammelaktion in einem Hinweis) */
.btn-stack { display: flex; flex-direction: column; align-items: flex-end; gap: var(--gap-inline); margin-top: var(--gap-block); }
.btn-stack:first-child { margin-top: 0; }
/* „KI Überarbeiten“ direkt unter dem Rich-Text-Feld: rechtsbündig, der Hinweis darunter */
.rte-rewrite { margin-top: calc(-1 * var(--s2)); margin-bottom: var(--gap-block); }
.rte-rewrite [hidden] { display: none; }
/* Massenaktionen über einer Tabelle (Excel-Abgleich): Abstand zur Tabelle darunter */
.sync-bulk { margin-bottom: var(--s4); }
.btn-row:first-child { margin-top: 0; }
/* Abstand nach unten, sobald danach noch etwas kommt: eine Knopfleiste oder ein Formular direkt auf der Seite (nicht in
   einer Karte) hält so Abstand zur nächsten Karte. Als letztes Kind eines Behälters bleibt es bei dessen Innenabstand. */
:where(.btn-row, form):not(:last-child) { margin-bottom: var(--gap-block); }
.btn-group { display: inline-flex; }
.btn-group button { margin-left: -1px; }
.btn-group button:first-child { margin-left: 0; }

/* ---------- Reiter ---------- */
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--border); margin-bottom: var(--gap-section); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; padding: var(--s2) var(--s4); height: auto; color: var(--muted); font-weight: 500; white-space: nowrap; }
.tabs button:hover { color: var(--text); background: none; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
/* Reiter, die nicht nebeneinander passen, werden zum Auswahlfeld in voller Breite (ui.js: installTabsLayout) */
.tabs > select.tabs-select { display: none; }
.tabs.as-select { border-bottom: 0; overflow: visible; }
.tabs.as-select > button { display: none; }
.tabs.as-select { position: relative; }
.tabs.as-select > select.tabs-select {
  display: block; width: 100%; min-height: var(--control-h); padding: 0 2.6rem 0 var(--s3); border: 1px solid var(--border-strong); border-radius: 0; background: var(--surface); color: var(--text-strong); font-weight: 600;
  appearance: none; -webkit-appearance: none; cursor: pointer;
}
/* Pfeil nach unten: ein durchgehender grauer Winkel (zwei Kanten eines gedrehten Quadrats), wie bei der Combobox */
.tabs.as-select::after { content: ""; position: absolute; right: 1rem; top: 50%; width: 0.5rem; height: 0.5rem; margin-top: -0.4rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
.tabs.as-select > select.tabs-select:hover { border-color: var(--primary); }
.tabs.as-select > select.tabs-select:focus { border-color: var(--primary); box-shadow: var(--focus); outline: none; }
.tabs.as-select { margin-bottom: var(--gap-block); }
.tab-badge { display: inline-block; min-width: 1.4em; padding: 0 0.4em; margin-left: 0.3em; font-size: var(--fs-xs); font-weight: 700; background: var(--primary-soft); color: var(--primary); line-height: 1.5; }
.tab-panel[hidden] { display: none; }
.tab-panel > :last-child { margin-bottom: 0; }

/* ---------- Akkordeon ---------- */
.accordion { border: 1px solid var(--border); background: var(--surface); margin-bottom: var(--gap-block); }
.accordion-item + .accordion-item { border-top: 1px solid var(--border); }
.accordion-head { display: flex; width: 100%; align-items: center; gap: var(--gap-inline); height: auto; min-height: var(--control-h); padding: var(--s3) var(--s4); border: 0; background: var(--surface-2); color: var(--text-strong); font-weight: 600; text-align: left; cursor: pointer; }
.accordion-head:hover { background: var(--surface-3); border-color: transparent; }
.accordion-title { flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.accordion-head .tab-badge { flex: none; white-space: nowrap; }
.accordion-chev { flex: none; display: inline-flex; color: var(--muted); transition: transform 0.15s; }
.accordion-item.open > .accordion-head { border-bottom: 1px solid var(--border); }
.accordion-item.open > .accordion-head .accordion-chev { transform: rotate(180deg); }
.accordion-body { padding: var(--pad-box) var(--s4); }
.accordion-body[hidden] { display: none; }
.accordion-body > :first-child { margin-top: 0; }
.accordion-body > :last-child { margin-bottom: 0; }
/* Horizontal: Spalten nebeneinander, zugeklappte als schmale Leiste mit gedrehtem Titel, die offene füllt den Rest */
.accordion.horizontal { display: flex; align-items: stretch; min-height: 240px; }
.accordion.horizontal > .accordion-item { display: flex; flex: 0 0 auto; min-width: 0; }
.accordion.horizontal > .accordion-item + .accordion-item { border-top: 0; border-left: 1px solid var(--border); }
.accordion.horizontal > .accordion-item.open { flex: 1 1 auto; }
.accordion.horizontal > .accordion-item > .accordion-head { writing-mode: vertical-rl; width: auto; height: auto; min-height: 0; align-self: stretch; padding: var(--s4) var(--s3); border-bottom: 0; }
.accordion.horizontal > .accordion-item.open > .accordion-head { border-right: 1px solid var(--border); }
.accordion.horizontal > .accordion-item > .accordion-head .accordion-chev { transform: rotate(-90deg); }
.accordion.horizontal > .accordion-item.open > .accordion-head .accordion-chev { transform: rotate(90deg); }
.accordion.horizontal > .accordion-item > .accordion-body { flex: 1 1 auto; min-width: 0; overflow: auto; }
/* Mobil verhält sich das horizontale Akkordeon wie das vertikale */
@media (max-width: 1079px) {
  .accordion.horizontal { display: block; min-height: 0; }
  .accordion.horizontal > .accordion-item { display: block; }
  .accordion.horizontal > .accordion-item + .accordion-item { border-left: 0; border-top: 1px solid var(--border); }
  .accordion.horizontal > .accordion-item > .accordion-head { writing-mode: horizontal-tb; width: 100%; height: auto; min-height: 44px; padding: var(--s3) var(--s4); border-right: 0; }
  .accordion.horizontal > .accordion-item.open > .accordion-head { border-bottom: 1px solid var(--border); }
  .accordion.horizontal > .accordion-item > .accordion-head .accordion-chev { transform: none; }
  .accordion.horizontal > .accordion-item.open > .accordion-head .accordion-chev { transform: rotate(180deg); }
}

/* ---------- Leere Zustände, Laden ---------- */
.empty-state { text-align: center; padding: var(--s8) var(--s4); color: var(--text); }
.empty-state .btn-row { margin-top: var(--gap-block); }
.empty-icon { color: var(--muted-2); margin-bottom: var(--s2); }
.empty-title { font-weight: 700; margin-bottom: var(--s1); color: var(--text-strong); }
.empty-state .muted { margin: 0 auto; }
/* Ladering ohne Rahmenlinien: ein Ring aus einem Farbverlauf, in der Mitte ausgestanzt. Mit border und border-top-color riss
   der farbige Bogen bei halber Drehung je nach Bildschirm-Skalierung in der Mitte auf (ein heller Strich, bei 150 % deutlich).
   Farben und Stärke über --spin-track, --spin-arc, --spin-w (so färben Abzeichen und Schrittanzeige ihn um). */
.spinner { --spin-track: var(--border); --spin-arc: var(--primary); --spin-w: 2px; width: 18px; height: 18px; flex: none; border-radius: 50%; display: inline-block;
  background: conic-gradient(from -45deg, var(--spin-arc) 0deg 88deg, var(--spin-track) 92deg 358deg, var(--spin-arc) 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--spin-w) - 0.6px), #000 calc(100% - var(--spin-w)));
  mask: radial-gradient(farthest-side, transparent calc(100% - var(--spin-w) - 0.6px), #000 calc(100% - var(--spin-w)));
  animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton-line { height: 0.9rem; background: linear-gradient(90deg, #e9ecf1 25%, #f4f5f7 50%, #e9ecf1 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; margin: var(--s2) 0; }
.skeleton-line:nth-child(2) { width: 85%; }
.skeleton-line:nth-child(3) { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Dialoge ---------- */
dialog { border: 0; padding: 0; width: min(640px, 92vw); box-shadow: var(--shadow-lg); color: var(--text); max-height: 90vh; }
dialog.dialog-sm { width: min(440px, 92vw); }
dialog.dialog-lg { width: min(900px, 94vw); }
/* sehr breit: Formular und Beleg nebeneinander */
dialog.dialog-xl { width: min(1400px, 96vw); }
dialog::backdrop { background: rgba(20, 10, 14, .45); }
/* Dialog über einem Dialog (openDialog mit stack): der untere bleibt offen, ist aber ausgeblendet, bis der obere schließt */
dialog.dialog-under { visibility: hidden; }
dialog.dialog-under::backdrop { background: transparent; }
/* Feld mit Knopf rechts daneben (z. B. Auswahl + „Neu anlegen“): der Knopf steht auf Höhe des Eingabefelds, schmal darunter */
.field-action { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--gap-inline); margin-bottom: var(--gap-block); }
.field-action > :first-child { flex: 1 1 260px; min-width: 0; }
.field-action .field { margin-bottom: 0; }
.card-body > form > .field-action:last-child { margin-bottom: 0; }
/* nur für Vorleser: sichtbar ausgeblendet */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* frühere Male einer wiederkehrenden Aufgabe (im Akkordeon an der Aufgabe) */
.task-earlier + .task-earlier { margin-top: var(--gap-block); padding-top: var(--gap-block); border-top: 1px solid var(--border); }
/* Sterne (UI.stars Eingabe, UI.starRating Anzeige): gefüllt bis zur gewählten Stufe */
.stars { display: inline-flex; gap: 2px; }
.stars label { cursor: pointer; color: var(--border-strong); display: inline-flex; padding: var(--s1); }
.stars label svg { fill: transparent; }
.stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars label:has(input:checked), .stars label:has(~ label > input:checked) { color: var(--warning); }
.stars label:has(input:checked) svg, .stars label:has(~ label > input:checked) svg { fill: currentColor; }
.stars label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }
.stars:hover label { color: var(--warning); }
.stars:hover label svg { fill: currentColor; }
.stars label:hover ~ label { color: var(--border-strong); }
.stars label:hover ~ label svg { fill: transparent; }
/* Griff zum Ziehen (UI.dragHandle): Reihenfolge von Zeilen ändern */
.drag-handle { display: inline-flex; align-items: center; justify-content: center; min-height: 0; height: auto; padding: var(--s1); border: 0; background: none; color: var(--text-muted); cursor: grab; touch-action: none; }
.drag-handle:hover, .drag-handle:focus-visible { color: var(--text); background: var(--surface-2); }
.dragging { opacity: 0.55; outline: 2px dashed var(--primary); outline-offset: -2px; }
body.drag-active, body.drag-active * { cursor: grabbing !important; user-select: none; }
.star-rating { display: inline-flex; gap: 1px; vertical-align: middle; color: var(--border-strong); white-space: nowrap; }
.star-rating span { display: inline-flex; }
.star-rating svg { fill: transparent; }
.star-rating .on { color: var(--warning); }
.star-rating .on svg { fill: currentColor; }
/* Wochentage ankreuzen (Termin eines Kurses): sieben kleine Kästchen in einer Reihe */
.weekday-pick { flex-wrap: wrap; }
.weekday-box { display: inline-flex; align-items: center; gap: var(--s1); min-height: var(--control-h); padding: 0 var(--s3); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; }
.weekday-box:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); font-weight: 600; }
/* Regelzeile (Besetzungsregeln): Zahl, Nachweis, Stufe und Entfernen in einer Reihe; schmal untereinander */
.rule-row { display: grid; grid-template-columns: 150px minmax(0, 2fr) minmax(0, 1.4fr) auto; gap: var(--gap-inline); align-items: end; margin-bottom: var(--gap-block); }
.rule-row .field { margin-bottom: 0; }
.rule-row .rule-none { margin: 0; min-height: var(--control-h); display: flex; align-items: center; }
@media (max-width: 1079px) { .rule-row { grid-template-columns: minmax(0, 1fr); padding-bottom: var(--gap-block); border-bottom: 1px solid var(--border); } }
/* Suchleiste (UI.searchBar): weitere Filter klappen unter „Eingrenzen“ auf */
.search-more { margin-bottom: var(--gap-block); }
.search-bar + .search-more { margin-top: calc(-1 * var(--s2)); }
form > .search-more:last-child, .card-body > form > .search-more:last-child { margin-bottom: 0; }
.search-more > summary { display: inline-block; cursor: pointer; color: var(--primary); font-size: var(--fs-sm); padding: var(--s1) 0; list-style: none; }
.search-more > summary::-webkit-details-marker { display: none; }
.search-more > summary::before { content: "›"; display: inline-block; margin-right: var(--s2); transition: transform 0.12s; }
.search-more[open] > summary::before { transform: rotate(90deg); }
.search-more > summary:hover { text-decoration: underline; }
.search-more-body { margin-top: var(--gap-text); }
.search-more-body > :last-child { margin-bottom: 0; }
.field-action > .btn-slot { flex: none; padding-top: calc(var(--fs-sm) * 1.5 + var(--s1)); }
dialog form { display: flex; flex-direction: column; max-height: 90vh; }
dialog h2 { margin: 0; padding: var(--s4) calc(var(--s6) + 40px) var(--s4) var(--s6); font-size: var(--fs-lg); border-bottom: 1px solid var(--border); background: var(--surface-2); flex: none; position: relative; }
/* Schließen-Kreuz rechts im Dialogkopf (openDialog legt es an) */
dialog .dialog-close { position: absolute; top: 50%; right: var(--s3); transform: translateY(-50%); width: 40px; height: 40px; padding: 0; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
dialog .dialog-close:hover { background: var(--surface); color: var(--text-strong); }
.wizard-steps.jump li { cursor: pointer; }
.wizard-steps.jump li:hover .wizard-label { text-decoration: underline; }
/* Inhalt in eigenem Container mit Innenabstand (kein Rand pro Kind → nichts kann ausscheren); scrollt bei Bedarf */
.dialog-body { padding: var(--pad-box) var(--s6); overflow-y: auto; min-height: 0; }
.dialog-body > :last-child { margin-bottom: 0; }
dialog .btn-row { margin: 0; padding: var(--s3) var(--s6); border-top: 1px solid var(--border); background: var(--surface-2); flex: none; }
/* Dialog mit Markdown-Editor: feste Höhe, der Editor füllt den Rest und ist der einzige Scrollbereich (kein doppelter Scrollbalken) */
dialog.dialog-fill { height: 90vh; }
dialog.dialog-fill form { height: 100%; }
dialog.dialog-fill .dialog-body { display: flex; flex-direction: column; flex: 1 1 auto; overflow: auto; }
dialog.dialog-fill .dialog-body > * { flex: none; }
dialog.dialog-fill .md-editor { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
dialog.dialog-fill .md-editor .md-editor-host { flex: 1 1 auto; min-height: 240px; } /* auf sehr niedrigen Fenstern scrollt dann der Dialog, statt den Editor zu quetschen */
dialog.dialog-fill .md-editor textarea { flex: 1 1 auto; min-height: 0; resize: none; }
/* Rich-Text füllt im Füll-Dialog die Höhe (Beitrag schreiben): das Textfeld bekommt allen Platz, der übrig ist */
dialog.dialog-fill .rte-field { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
dialog.dialog-fill .rte-field > .rte { flex: 1 1 auto; min-height: 200px; display: flex; flex-direction: column; }
/* mindestens 160 px Text: auf kleinen Bildschirmen scrollt dann der Dialog, statt das Textfeld zu quetschen */
dialog.dialog-fill .rte-field .rte-content { flex: 1 1 auto; min-height: 160px !important; max-height: none; overflow-y: auto; }
/* Beitragsdialog: Einstellungen kompakt unter dem Text, ohne Erklärzeilen (die stehen als Tooltip) */
.post-dialog .post-options { margin-top: var(--gap-text); }
.post-dialog .post-options .field, .post-dialog .post-options .check { margin-bottom: var(--s2); }
.post-dialog .post-options .row { gap: var(--s2) var(--gap-section); }
.post-dialog .error:empty { display: none; }
/* „KI Überarbeiten“ links in der Fußzeile eines Dialogs; die übrigen Knöpfe bleiben rechts */
dialog .btn-row .rte-rewrite-footer { margin: 0 auto 0 0; display: inline-flex; gap: var(--gap-inline); }
dialog .btn-row .rte-rewrite-footer [hidden] { display: none; }

/* ---------- Seitliches Overlay (UI.sidePanel) ---------- */
body.panel-open { overflow: hidden; }
.side-panel-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(20, 10, 14, .35); display: flex; justify-content: flex-end; opacity: 0; transition: opacity 0.15s; }
.side-panel-overlay.open { opacity: 1; }
.side-panel { width: min(440px, 100vw); height: 100%; background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.18s ease; }
.side-panel-overlay.open .side-panel { transform: none; }
.side-panel.sm { width: min(340px, 100vw); }
.side-panel.lg { width: min(680px, 100vw); }
.side-panel-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--gap-inline); padding: var(--s3) var(--s3) var(--s3) var(--s5); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.side-panel-head h2 { margin: 0; font-size: var(--fs-lg); }
.side-panel-close { width: 40px; height: 40px; padding: 0; border: 0; background: transparent; color: var(--muted); }
.side-panel-close:hover { background: var(--surface); color: var(--text-strong); border-color: transparent; }
.side-panel-body { flex: 1 1 auto; overflow-y: auto; padding: var(--pad-box) var(--s5); }
.side-panel-body > :last-child { margin-bottom: 0; }
/* Liste im Overlay: Zeilen mit Haupt-Knopf (Titel + Hinweis) und kleinen Aktionen rechts */
ul.panel-list { list-style: none; margin: 0 0 var(--gap-block); padding: 0; border: 1px solid var(--border); }
.panel-list li { display: flex; align-items: center; gap: var(--gap-inline); padding: var(--s2) var(--s2) var(--s2) var(--s3); border-bottom: 1px solid var(--border); border-left: 3px solid transparent; }
.panel-list li:last-child { border-bottom: 0; }
.panel-list li.active { background: var(--accent-soft); border-left-color: var(--accent); }
.panel-list .item-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; height: auto; padding: var(--s1) 0; border: 0; background: none; text-align: left; white-space: normal; color: var(--text); font-weight: 500; }
.panel-list .item-main:hover { background: none; color: var(--primary); border-color: transparent; }
.panel-list .item-main .hint { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
@media (max-width: 1079px) {
  .side-panel, .side-panel.sm, .side-panel.lg { width: 100vw; }
}

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: var(--s6); right: var(--s6); display: flex; flex-direction: column; gap: var(--s2); z-index: 100; max-width: min(400px, calc(100vw - 2rem)); }
.toast { display: flex; gap: var(--s3); align-items: flex-start; background: #22262b; color: #fff; padding: var(--s3) var(--s3) var(--s3) var(--s4); border-left: 4px solid #fff; box-shadow: var(--shadow-pop); animation: toast-in 0.18s ease-out; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity 0.18s, transform 0.18s; }
.toast-icon { flex: none; display: inline-flex; margin-top: 0.05rem; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 700; }
.toast-close { flex: none; background: none; border: 0; color: inherit; opacity: 0.7; padding: 0; height: auto; width: 24px; }
.toast-close:hover { opacity: 1; background: none; }
.toast-success { border-left-color: #4ade80; }
.toast-error { border-left-color: #f87171; }
.toast-warning { border-left-color: #fbbf24; }
.toast-info { border-left-color: #60a5fa; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Combobox mit Suche ---------- */
.combobox { position: relative; }
.combobox .combobox-input { padding-right: 2.2rem; }
.combobox-caret { position: absolute; right: var(--s3); top: 50%; transform: translateY(-50%); color: var(--muted); display: inline-flex; cursor: pointer; }
/* Die Liste liegt fest im Viewport (position: fixed, Koordinaten setzt ui.js beim Öffnen), damit kein scrollender
   Container (Dialoginhalt, Tabelle, Rahmen, Seiteninhalt) sie abschneidet; bei wenig Platz unten öffnet sie nach oben. */
ul.combobox-list { position: fixed; z-index: 60; margin: 0; padding: var(--s1) 0; list-style: none; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); max-height: 260px; overflow-y: auto; }
.combobox-list[hidden] { display: none; }
.combobox-option { margin: 0; padding: var(--s2) var(--s3); cursor: pointer; display: flex; justify-content: space-between; gap: var(--s3); }
.combobox-option small { font-size: var(--fs-xs); }
.combobox-option.active { background: var(--primary-soft); }
.combobox-option.selected { font-weight: 600; color: var(--primary); }
.combobox-empty { padding: var(--s2) var(--s3); }

/* Assistent: Schrittanzeige im Dialog */
.wizard-steps { list-style: none; margin: 0 0 var(--s5); padding: 0 0 var(--s4); display: flex; gap: var(--s2) var(--s4); flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.wizard-steps li { display: flex; align-items: center; gap: var(--s2); color: var(--muted); font-size: var(--fs-sm); }
.wizard-num { width: 26px; height: 26px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border-strong); background: var(--surface); font-weight: 700; font-size: var(--fs-xs); }
.wizard-steps li.active { color: var(--text-strong); font-weight: 600; }
.wizard-steps li.active .wizard-num { background: var(--primary); border-color: var(--primary); color: #fff; }
.wizard-steps li.done .wizard-num { background: var(--success); border-color: var(--success); color: #fff; }
.wizard-pane > :last-child { margin-bottom: 0; }
.wizard-pane h3 { margin: 0 0 var(--s3); font-size: var(--fs-md); }
.wizard-pane > ol, .wizard-pane > ul { margin: 0 0 var(--gap-block); padding-left: 1.4em; }
.wizard-pane > ol > li, .wizard-pane > ul > li { margin-bottom: var(--s2); }
.wizard-wait { display: flex; align-items: center; gap: var(--s3); padding: var(--s4); background: var(--surface-2); border: 1px solid var(--border); margin-bottom: var(--s4); }

.spinner-sm { width: 12px; height: 12px; }

/* Codeblock mit Kopieren */
.code-block { position: relative; margin: 0 0 var(--gap-block); }
.code-block-label { font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--s1); }
.code-block pre { margin: 0; padding-right: 120px; white-space: pre-wrap; word-break: break-all; }
.code-block .code-copy { position: absolute; right: var(--s2); bottom: var(--s2); }

/* ---------- Checkliste (Verbindungstest) ---------- */
.check-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.check-steps li { display: flex; gap: var(--s3); align-items: flex-start; }
.check-steps .step-icon { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: var(--muted-2); margin-top: 0.05rem; }
.check-steps li.ok .step-icon { background: var(--success); }
.check-steps li.fail .step-icon { background: var(--danger); }
.check-steps li.fail { color: var(--danger); }
.check-steps li.skipped { color: var(--muted); }

/* ---------- News / Schwarzes Brett ---------- */
/* Schwarzes Brett: eine Karte mit Titelleiste, die Beiträge darin als Einträge mit Trennlinie (keine Karte in der Karte) */
/* Wisch-Ansicht des Schwarzen Bretts: nur auf dem Dashboard im schmalen Browser (siehe unten); sonst sind die Knöpfe weg */
.news-pager { display: none; }
.news-item + .news-item { margin-top: var(--gap-block); padding-top: var(--gap-block); border-top: 1px solid var(--border); }
.news-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--gap-inline); margin-bottom: var(--gap-text); }
.news-item-title { min-width: 0; }
.news-item-title h4 { margin: 0; font-size: var(--fs-lg); color: var(--text-strong); overflow-wrap: anywhere; }
.news-item .card-actions { flex: none; align-items: center; }
.news-item.pinned { border-left: 4px solid var(--accent); padding-left: var(--s3); }
.news-body { overflow-wrap: anywhere; line-height: 1.6; }
/* Kommentare und „Gefällt mir“ unter einem Beitrag (nur wenn für ihn freigegeben) */
/* Unter einem Beitrag: Daumen und Sprechblase mit Zahl, die neuesten Kommentare, Eingabe erst auf Klick */
.news-social { margin-top: var(--gap-text); }
.news-actions { display: flex; align-items: center; gap: var(--gap-block); margin-bottom: var(--s1); }
.news-act { display: inline-flex; align-items: center; gap: var(--s1); min-height: 0; height: auto; padding: var(--s1) 0; border: 0; background: none; color: var(--text); font-weight: 600; cursor: pointer; }
.news-act:hover { background: none; color: var(--primary); }
.news-act.on { color: var(--primary); }
.news-act span:empty { display: none; }
.news-comment { margin-top: var(--s2); overflow-wrap: anywhere; font-size: var(--fs-sm); line-height: 1.45; }
.news-comment strong { font-weight: 700; color: var(--text-strong); }
.news-comment .muted { margin-top: 1px; }
/* Text-Knöpfe im Kommentarbereich ohne Innenabstand, damit sie bündig mit dem Text stehen */
.news-social .btn-link { padding: 0; min-height: 0; height: auto; border: 0; background: none; font-size: var(--fs-sm); }
.news-comment-form { display: flex; gap: var(--gap-inline); margin-top: var(--gap-text); margin-bottom: 0; }
.news-comment-form input { flex: 1; min-width: 0; min-height: var(--control-h); padding: 0 var(--s3); border: 1px solid var(--border-strong); background: #fff; }
.news-comment-form input:focus { border-color: var(--primary); box-shadow: var(--focus); outline: none; }
/* Gelesen von … als Auge mit Zahl oben rechts am Eintrag */
[data-readers-slot] { display: inline-flex; }
[data-readers-slot]:empty { display: none; }
.read-eye { display: inline-flex; align-items: center; gap: var(--s1); min-height: 0; height: auto; padding: var(--s1); border: 0; background: none; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; }
button.read-eye { cursor: pointer; }
button.read-eye:hover { color: var(--primary); background: none; }

/* ---------- Template-Seite ---------- */
.tpl-section { margin-bottom: var(--s8); scroll-margin-top: var(--s4); }
.tpl-section > h2 { padding-bottom: var(--s2); border-bottom: 1px solid var(--border); }
.tpl-demo { background: var(--surface); border: 1px dashed var(--border-strong); padding: var(--s5); }
.tpl-demo > :last-child { margin-bottom: 0; }
.tpl-row { display: flex; flex-wrap: wrap; gap: var(--gap-inline); align-items: center; }
.tpl-row + .tpl-row { margin-top: var(--gap-text); }
.tpl-toc { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s6); }
.tpl-toc a { font-size: var(--fs-sm); text-decoration: none; background: var(--surface); border: 1px solid var(--border); padding: 0.25rem 0.75rem; color: var(--text); }
.tpl-toc a:hover { border-color: var(--primary); color: var(--primary); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); }
.swatch { border: 1px solid var(--border); overflow: hidden; background: var(--surface); }
.swatch-color { height: 48px; }
.swatch-name { padding: var(--s2) var(--s3); font-size: var(--fs-xs); }
.swatch-name code { display: block; margin-top: 0.1rem; color: var(--muted); border: 0; background: none; padding: 0; }
details.tpl-code { margin-top: var(--s3); }
details.tpl-code summary { cursor: pointer; font-size: var(--fs-sm); color: var(--muted); }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--s2); }
.icon-cell { display: flex; flex-direction: column; align-items: center; gap: var(--s1); padding: var(--s3) var(--s2); border: 1px solid var(--border); font-size: var(--fs-xs); color: var(--muted); background: var(--surface); }
.icon-cell svg { color: var(--text); }
.spacing-scale { margin-bottom: var(--gap-block); }
.spacing-row { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s2); font-size: var(--fs-sm); }
.spacing-bar { height: 14px; background: var(--primary); }

/* ---------- Mobil (eine Stufe: unter 1080 px) ---------- */
@media (max-width: 1079px) {
  .shell { grid-template-columns: 1fr; align-content: start; }
  .sidebar, .subnav, .content { grid-column: auto; }
  .topbar { display: flex; align-items: center; gap: var(--s2); position: sticky; top: 0; z-index: 15; background: var(--sidebar); color: var(--sidebar-strong); padding: 0 var(--s3); height: var(--topbar-h); }
  .topbar .brand { display: flex; align-items: center; gap: var(--s2); font-weight: 700; font-size: 1.05rem; flex: 1 1 auto; min-width: 0; }
  /* Name und Untertitel untereinander; was nicht passt, endet mit „…“ */
  .topbar .brand-text { min-width: 0; }
  .topbar .brand-text strong, .topbar .brand-text small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .brand-text small { font-size: var(--fs-xs); font-weight: 400; color: var(--sidebar-muted); }
  .topbar .topbar-chat { margin-left: auto; color: var(--sidebar-strong); }
  /* mobil steht der Chat oben in der Kopfzeile; unten in der Schublade nicht noch einmal */
  .me-bar a[data-route="nachrichten"] { display: none; }
  /* mobil: „Abmelden“ als weißes Symbol rechts in der Symbolzeile (wie am Desktop nur das Symbol) */
  .me-bar #logout { margin-left: auto; background: #fff; color: var(--sidebar); }
  .me-bar #logout:hover { background: #fff; color: var(--sidebar); opacity: 0.9; }

  .topbar .topbar-chat + #menu-toggle { margin-left: 0; }
  .topbar .topbar-ai + .topbar-chat { margin-left: 0; }
  .topbar #menu-toggle { margin-left: auto; }
  .topbar .brand-mark { width: 32px; height: 32px; font-size: 0.7rem; }
  /* Haupt- und Untermenü fahren gemeinsam als Schublade über dem Inhalt ein, nebeneinander wie auf dem Desktop */
  .drawer { display: flex; position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; max-width: 100vw; z-index: 30; transform: translateX(-100%); transition: transform 0.2s ease; }
  .drawer.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .sidebar { position: static; flex: none; width: min(250px, 58vw); padding-top: var(--s2); }
  .sidebar .brand { padding: 0 0 var(--s3); }
  .icon-btn.drawer-close { display: inline-flex; margin-left: auto; }
  .subnav { position: static; flex: none; width: min(210px, 42vw); height: 100vh; height: 100dvh; padding-left: var(--s2); padding-right: var(--s2); }
  .subnav h2, .subnav h3, .subnav a { padding-left: var(--s2); padding-right: var(--s2); }
  .subnav a { overflow-wrap: anywhere; }
  .subnav[hidden] { display: none; }
  body.drawer-open { overflow: hidden; }
  /* iOS vergrößert die Seite beim Antippen eines Eingabefelds mit weniger als 16 px Schrift; deshalb mobil mindestens 16 px */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea, [contenteditable="true"] { font-size: 16px !important; }
  .dropup { left: auto; right: 0; min-width: 220px; }
  .content { padding: var(--s4) var(--s4) var(--s7); }
  /* Seitenkopf: Status und Aktionen bleiben rechts neben dem Titel; passen die Buttons nicht, werden sie per Script zum Aufklappmenü */
  .page-header { gap: var(--s3); margin-bottom: var(--s5); }
  .page-side { max-width: 60%; }
  .page-header h1 { font-size: var(--fs-xl); }
  .perm-groups { columns: 1; }
  .form-row, .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } /* minmax(0, …): sonst hält eine Tabelle die Spalte auf Mindestbreite und das Stapeln greift nicht */
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
  .tile { padding: var(--s3) var(--s4); }
  .tile .value { font-size: 1.5rem; }
  .card-header, .card-body, .card-footer { padding-left: var(--s4); padding-right: var(--s4); }
  th, td { padding: var(--s2) var(--s3); }
  button, .field input:not([type=checkbox]):not([type=radio]), .field select { min-height: 44px; }
  button.small { height: 36px; }
  button.icon-only.small { width: 36px; }
  dialog, dialog.dialog-sm, dialog.dialog-lg, dialog.dialog-xl { width: calc(100vw - 2 * var(--s3)); max-height: 92vh; }
  dialog.dialog-fill { height: 92vh; }
  dialog h2 { padding: var(--s3) var(--s4); }
  .dialog-body { padding: var(--s4); }
  .wizard-steps li:not(.active) .wizard-label { display: none; }
  .code-block pre { padding-right: var(--s4); padding-bottom: calc(var(--control-h) + var(--s3)); }
  dialog .btn-row { padding: var(--s3) var(--s4); }
  dialog .btn-row button { flex: 1 1 auto; }
  .toasts { left: var(--s3); right: var(--s3); bottom: var(--s3); max-width: none; }
  .tpl-demo { padding: var(--s3); }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .toast, .switch-track, .switch-track::after, button, .sidebar nav a { transition: none; animation: none; }
}

/* Markdown-Editor (UI.markdownEditor): eckig wie der Rest, volle Breite; die Textarea ist nur der Fallback bis der Editor steht */
.md-editor .md-editor-host { width: 100%; }
.md-editor .toastui-editor-defaultUI { border-radius: 0; border-color: var(--border); font-family: inherit; }
.md-editor .toastui-editor-defaultUI .toastui-editor-md-tab-container, .md-editor .toastui-editor-defaultUI-toolbar { border-radius: 0; }
.md-editor .toastui-editor-contents { font-family: inherit; font-size: var(--fs-md); }
.md-editor .toastui-editor-contents table { width: auto; }
/* Die globalen Button-Regeln (Höhe, Innenabstand, Rahmen) würden die Symbolleiste des Editors verzerren */
.md-editor .toastui-editor-defaultUI-toolbar button, .md-editor .toastui-editor-mode-switch button { height: auto; min-height: 0; padding: 0 var(--s2); border: 0; background-color: transparent; white-space: normal; font-weight: 400; line-height: normal; }
.md-editor .toastui-editor-defaultUI-toolbar button.toastui-editor-toolbar-icons { width: 32px; height: 32px; min-height: 0; padding: 0; }

/* Berechnungsplan: Gruppenüberschriften zwischen Steckbrief und Positions-Akkordeons */
.plan-group { font-size: var(--fs-md); margin: var(--gap-section) 0 var(--gap-text); }
.plan-group:first-child { margin-top: 0; }

/* ---------- Zeitstrahl (Ereignisse eines Vorgangs) ---------- */
.timeline { list-style: none; margin: 0 0 var(--gap-block); padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 13px; top: 10px; bottom: 10px; width: 2px; background: var(--border); }
.tl-entry { position: relative; padding-left: 44px; margin-bottom: var(--gap-block); }
.tl-entry:last-child { margin-bottom: 0; }
.tl-dot { position: absolute; left: 0; top: 2px; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--border-strong); background: var(--surface); color: var(--muted); }
.tl-info .tl-dot { border-color: var(--primary); color: var(--primary); }
.tl-dot .spinner { --spin-track: currentColor; --spin-arc: transparent; }
/* Laufender Eintrag: Fortschritt als Hauptzeile, Erklärung klein darunter */
.tl-progress { margin: 0 0 var(--s1); font-weight: 600; color: var(--text-strong); }
.tl-progress:empty { display: none; }
.tl-success .tl-dot { border-color: var(--success); color: var(--success); }
.tl-warning .tl-dot { border-color: var(--warning); color: var(--warning); }
.tl-danger .tl-dot { border-color: var(--danger); color: var(--danger); }
.tl-card { border: 1px solid var(--border); background: var(--surface); min-width: 0; }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); padding: var(--s2) var(--s3); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.tl-title { flex: 1 1 auto; min-width: 0; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-inline); overflow-wrap: anywhere; }
.tl-time { color: var(--muted); font-size: var(--fs-sm); font-weight: 400; white-space: nowrap; }
.tl-actions { display: flex; flex-wrap: wrap; gap: var(--gap-inline); }
@media (max-width: 1079px) {
  .tl-actions { width: 100%; }
}
.tl-body { padding: var(--s3); }
.tl-body > :last-child { margin-bottom: 0; }
.tl-sub { margin: var(--s2) 0 0; padding: 0 0 0 var(--s4); list-style: none; border-left: 2px solid var(--border); }
.tl-sub li { padding: var(--s2) 0; }
.tl-sub li + li { border-top: 1px solid var(--border); }
.timeline:last-child { margin-bottom: 0; }

/* ---------- Ablaufanzeige (Schritte eines festen Ablaufs) ---------- */
.steps { list-style: none; margin: 0 0 var(--gap-block); padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); }
.steps li { display: flex; align-items: center; gap: var(--s2); color: var(--muted); font-size: var(--fs-sm); }
.steps-label { display: flex; flex-direction: column; line-height: 1.25; }
/* Schritt mit laufender Hintergrundarbeit: drehender Kreis im Nummernfeld (gleiche Höhe wie die anderen Schritte) */
.steps li .wizard-num .spinner { --spin-track: currentColor; --spin-arc: transparent; opacity: 0.85; }
.steps-label small { font-size: var(--fs-xs); font-weight: 400; color: var(--muted); }
.steps li.active { color: var(--text-strong); font-weight: 600; }
.steps li.active .wizard-num { background: var(--primary); border-color: var(--primary); color: #fff; }
.steps li.done .wizard-num { background: var(--success); border-color: var(--success); color: #fff; }
.steps li.done { color: var(--text); }
.steps li.open .wizard-num { border-color: var(--primary); color: var(--primary); }
.steps li.open { color: var(--text); }
.steps.jump li.released { cursor: pointer; }
.steps.jump li.released:hover .steps-label, .steps.jump li.released:focus-visible .steps-label { text-decoration: underline; }
.steps.jump li.released:focus-visible { outline: none; box-shadow: var(--focus); }
.steps li.skipped { opacity: .55; }
.steps li.skipped .wizard-num { border-style: dashed; }
.steps:last-child { margin-bottom: 0; }

/* ---------- Ablagefläche (Dropzone) ---------- */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: var(--s1); padding: var(--pad-box); border: 2px dashed var(--border-strong); background: var(--surface-2); color: var(--muted); text-align: center; cursor: pointer; margin-bottom: var(--gap-block); outline: none; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--primary); color: var(--text); }
.dropzone:focus-visible { box-shadow: var(--focus); }
.dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.dropzone-input { display: none; }
.dropzone-title { font-weight: 600; color: var(--text); }
.dropzone-hint { font-size: var(--fs-sm); }
.dropzone-status { font-size: var(--fs-sm); color: var(--primary); }
.dropzone-status.error { color: var(--danger); }
.dropzone .help { color: var(--muted); font-size: var(--fs-xs); }
.dropzone.busy { pointer-events: none; opacity: .7; }

/* ---------- Rich-Text-Editor ---------- */
.rte { border: 1px solid var(--border-strong); background: #fff; }
.rte:focus-within { border-color: var(--primary); box-shadow: var(--focus); }
.rte-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: var(--s1); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.rte-btn { height: 30px; min-width: 30px; padding: 0 var(--s2); border: 1px solid transparent; background: transparent; color: var(--text); }
.rte-btn:hover { background: #fff; border-color: var(--border-strong); }
.rte-txt { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.02em; }
.rte-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 var(--s1); }
.rte-content { padding: var(--s3) var(--s4); outline: none; line-height: 1.6; overflow-wrap: anywhere; max-height: 60vh; overflow-y: auto; }
.rte-content.is-empty::before { content: attr(data-placeholder); color: var(--muted-2); pointer-events: none; display: block; }
.rte-content > :first-child { margin-top: 0; }
.rte-content > :last-child { margin-bottom: 0; }
.rte-content img, .rich-text img { max-width: 100%; height: auto; display: block; margin: var(--s3) 0; border: 1px solid var(--border); }
.rte-content h2, .rich-text h2 { font-size: var(--fs-lg); margin: var(--s4) 0 var(--s2); }
.rte-content h3, .rich-text h3 { font-size: var(--fs-md); margin: var(--s3) 0 var(--s1); }
.rte-content blockquote, .rich-text blockquote { margin: var(--s3) 0; padding: var(--s2) var(--s4); border-left: 3px solid var(--accent); background: var(--accent-soft); color: var(--text); }
.rte-content ul, .rte-content ol, .rich-text ul, .rich-text ol { margin: var(--s2) 0; padding-left: 1.4rem; }
.rte-content a, .rich-text a { color: var(--primary); }
.rte-content pre, .rich-text pre { margin: var(--s2) 0; }
.rte-status { padding: var(--s1) var(--s3); font-size: var(--fs-xs); color: var(--muted); border-top: 1px solid var(--border); background: var(--surface-2); }
.rte-status.error { color: var(--danger); }
.rich-text { line-height: 1.6; overflow-wrap: anywhere; }
.rich-text > :first-child { margin-top: 0; }
.rich-text > :last-child { margin-bottom: 0; }
.rich-text p { margin: 0 0 var(--s2); }

/* ---------- Bereich Projekte ---------- */
/* Schlüssel-Wert-Zeilen auf der Projekt-Detailseite */
.kv { margin-bottom: var(--s3); }
.kv > span { display: block; }
/* Tabellenzeilen, die eine Detailseite öffnen */
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
/* Aufklappbare Feldvergleiche im Excel-Abgleich */
details.small summary { cursor: pointer; color: var(--muted); margin-top: var(--s1); }
details.small .table-wrap { margin-top: var(--s2); }

/* ---------- Dokumentvorschau (Projekte → Dokumentseiten) ---------- */
.doc-preview { background: var(--surface); border: 1px solid var(--border); padding: var(--s7) var(--s7); font-size: var(--fs-sm); line-height: 1.5; color: var(--text-strong); }
.doc-preview .doc-head { display: flex; justify-content: space-between; gap: var(--s6); margin-bottom: var(--s6); }
.doc-preview .doc-address { flex: 1 1 55%; padding-top: var(--s7); }
.doc-preview .doc-return { font-size: var(--fs-xs); color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: 2px; margin-bottom: var(--s2); }
.doc-preview .doc-letterhead { flex: 0 0 38%; font-size: var(--fs-xs); color: var(--muted); }
.doc-preview .doc-letterhead strong { font-size: var(--fs-md); color: var(--primary); }
.doc-preview .doc-meta { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); justify-content: flex-end; margin-bottom: var(--s4); }
.doc-preview .doc-meta em, .doc-preview .doc-reference em { font-style: normal; color: var(--muted); font-size: var(--fs-xs); margin-right: var(--s1); }
.doc-preview .doc-reference { display: grid; grid-template-columns: max-content 1fr; gap: var(--s1) var(--s3); margin-bottom: var(--s4); }
.doc-preview .doc-reference div { display: contents; }
.doc-preview .doc-title { font-weight: 700; margin: var(--s4) 0; }
.doc-preview h3 { font-size: var(--fs-md); margin: var(--s5) 0 var(--s2); }
.doc-preview h4 { font-size: var(--fs-sm); margin: var(--s3) 0 var(--s2); padding-left: var(--s5); }
.doc-preview p { margin: 0 0 var(--s3); }
.doc-preview p.bold { font-weight: 700; }
.doc-preview p.small { font-size: var(--fs-xs); }
.doc-preview .indent-1, .doc-preview ul.indent-1 { padding-left: var(--s5); }
.doc-preview .indent-2, .doc-preview ul.indent-2 { padding-left: var(--s8); }
.doc-preview p.align-justify { text-align: justify; }
.doc-preview ul { margin: 0 0 var(--s3); list-style: "– "; }
.doc-preview ul.indent-0 { padding-left: var(--s4); }
.doc-preview table.kv { border-collapse: collapse; margin: 0 0 var(--s3); }
.doc-preview table.kv th { text-align: left; font-weight: 400; color: var(--muted); padding: 1px var(--s4) 1px 0; vertical-align: top; }
.doc-preview table.kv td { padding: 1px 0; vertical-align: top; }
.doc-preview table.grid { border-collapse: collapse; width: 100%; margin: 0 0 var(--s3); }
.doc-preview table.grid th, .doc-preview table.grid td { border: 1px solid var(--border-strong); padding: var(--s1) var(--s2); text-align: left; vertical-align: top; }
.doc-preview .signature { margin-top: var(--s6); white-space: pre-line; }
/* Dokumentseiten: Formular links, Vorschau rechts (unter 1080 px untereinander) */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
/* Rechte Spalte: bleibt beim Scrollen stehen und füllt die Fensterhöhe; die Vorschau ist ein A4-Blatt (210:297), das
   so hoch wie der verbleibende Platz ist. Längere Dokumente scrollen innerhalb des Blatts. */
.doc-layout .doc-sticky { position: sticky; top: var(--s4); display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.doc-sticky > #doc-result { flex: none; }
.doc-sticky > #doc-result:empty { display: none; } /* sonst erzeugt der leere Container einen Flex-Abstand und das Blatt rutscht unter die Kartenkante */
.doc-sticky > #doc-result .alert { margin-bottom: 0; }
/* Breite = Spaltenbreite, höchstens so breit, dass das Blatt in die Fensterhöhe passt; Höhe folgt aus 210:297.
   Linksbündig, damit die Blattkante mit der Kartenkante der linken Spalte fluchtet. */
.doc-sheet { flex: none; width: min(100%, calc((100vh - 2 * var(--s4)) * 210 / 297)); aspect-ratio: 210 / 297; align-self: flex-start; box-sizing: border-box; background: var(--surface); border: 1px solid var(--border-strong); overflow: auto; }
.doc-sheet .doc-preview { border: 0; min-height: 100%; box-sizing: border-box; padding: 8% 9% 10%; }
.doc-sheet .empty-state { height: 100%; display: flex; flex-direction: column; justify-content: center; }

/* ---------- Dateisymbole (UI.fileIcon): Farbe je Dateiart ---------- */
.file-icon { display: inline-flex; flex: none; vertical-align: middle; color: var(--muted); }
.fi-folder { color: #d9a400; }
.fi-pdf { color: #c0392b; }
.fi-word { color: #2b5797; }
.fi-excel { color: #1f7244; }
.fi-ppt { color: #c55a11; }
.fi-image { color: #7e4455; }
.fi-text { color: #5f6b7a; }
.fi-mail { color: #0f766e; }
.fi-cad { color: #0055a4; }
.fi-archive { color: #8a6d3b; }
.fi-other { color: #6b7280; }
/* Zeile mit Symbol links und Text rechts (Listen von Dateien und Ordnern) */
.file-row { display: flex; align-items: flex-start; gap: var(--gap-inline); min-width: 0; }
.file-row > .file-icon { margin-top: 1px; }
.file-row > div { min-width: 0; flex: 1 1 auto; }
/* Pfadleiste wie im Explorer: Stationen anklickbar, die aktuelle fett */
.path-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); margin-bottom: var(--gap-block); padding: var(--s2) var(--s3); background: var(--surface); border: 1px solid var(--border); font-size: var(--fs-sm); }
.path-bar a { display: inline-flex; align-items: center; gap: var(--s1); text-decoration: none; color: var(--primary); }
.path-bar a:hover { text-decoration: underline; }
.path-bar .current { font-weight: 700; color: var(--text-strong); display: inline-flex; align-items: center; gap: var(--s1); }
.path-bar .crumb-sep { color: var(--muted-2); display: inline-flex; }

/* ---------- Büro: Vorschau eines Dokuments (PDF im Rahmen, Bild in voller Breite) ---------- */
.office-preview { display: block; width: 100%; height: 70vh; border: 1px solid var(--border); background: var(--surface-2); }
.office-preview-image { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s1) var(--s4); }
@media (max-width: 1079px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-layout .doc-sticky { position: static; height: auto; display: block; }
  .doc-sheet { aspect-ratio: auto; width: 100%; overflow: visible; }
  .doc-sheet .doc-preview { padding: var(--s5) var(--s4); }
}
/* Anlagenzeilen im Anschreiben: Unterlage breit, n-fach/von/bis schmal; Beschriftung nur in der ersten Zeile */
.anlage-row { display: grid; grid-template-columns: minmax(0, 3fr) repeat(3, minmax(0, 1fr)); gap: 0 var(--s3); }
.anlage-row .field { margin-bottom: var(--s2); }
.anlage-row + .anlage-row .field > span { display: none; }
@media (max-width: 1079px) { .anlage-row { grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--border); padding-top: var(--s2); } .anlage-row + .anlage-row .field > span { display: inline; } }
/* Links, die wie Schaltflächen aussehen (Downloads erzeugter Dokumente); gleiche Maße wie button */
a.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: var(--control-h); padding: 0 var(--s4); border: 1px solid var(--border-strong); background: #fff; color: var(--text); text-decoration: none; line-height: 1.2; white-space: nowrap; font-weight: 500; }
a.btn:hover { background: var(--surface-2); border-color: #b9bfc6; text-decoration: none; }
a.btn.small { height: 30px; padding: 0 var(--s3); font-size: var(--fs-sm); }

/* ---------- Wochenkalender (UI.weekCalendar) ---------- */
:root {
  --cal-1: #0055a4; --cal-2: #7e4455; --cal-3: #15803d; --cal-4: #b45309; --cal-5: #6d28d9; --cal-6: #0e7490; --cal-7: #9d174d; --cal-8: #4d7c0f;
}
.week-cal { --cal-time-w: 56px; border: 1px solid var(--border); background: var(--surface); overflow-x: auto; margin-bottom: var(--gap-block); }
.week-cal .cal-body { padding-top: 0.7em; } /* Platz für die erste Uhrzeit, die halb über der Linie steht */
.week-cal .cal-head, .week-cal .cal-allday, .week-cal .cal-body { display: grid; grid-template-columns: var(--cal-time-w) repeat(var(--cal-cols, 7), minmax(110px, 1fr)); }
.week-cal .cal-head { border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0; z-index: 2; }
.week-cal .cal-day-head { padding: var(--s2) var(--s2); border-left: 1px solid var(--border); text-align: center; }
.week-cal .cal-day-head.today { background: var(--primary-soft); }
.week-cal .cal-day-label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.week-cal .cal-day-sub { font-size: var(--fs-lg); font-weight: 700; color: var(--text-strong); }
.week-cal .cal-day-total { font-size: var(--fs-xs); color: var(--muted); }
.week-cal .cal-allday { border-bottom: 1px solid var(--border); min-height: 28px; }
.week-cal .cal-allday-cell { border-left: 1px solid var(--border); padding: 2px; display: flex; flex-direction: column; gap: 2px; }
.week-cal .cal-corner { padding: var(--s2); font-size: var(--fs-xs); color: var(--muted); }
.week-cal .cal-times { font-size: var(--fs-xs); color: var(--muted); text-align: right; padding-right: var(--s2); }
.week-cal .cal-hour { box-sizing: border-box; transform: translateY(-0.6em); }
.week-cal .cal-day { position: relative; border-left: 1px solid var(--border); }
.week-cal .cal-day.today { background: color-mix(in srgb, var(--primary-soft) 40%, transparent); }
.week-cal .cal-line { box-sizing: border-box; border-top: 1px solid var(--border); }
.week-cal .cal-block { position: absolute; left: 2px; right: 2px; box-sizing: border-box; overflow: hidden; padding: 2px 4px; font-size: var(--fs-xs); line-height: 1.25; color: var(--text-strong); border: 1px solid; border-left-width: 3px; }
.week-cal .cal-block-label { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-cal .cal-block-hint { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Kursplan: Ansichtswahl rechts in der Navigationszeile, Legende der Farben unter dem Kalender */
.week-nav { margin-bottom: var(--gap-block); }
.week-nav .plan-views { margin-left: auto; }
.week-cal .cal-block[data-block] { cursor: pointer; }
.plan-legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); font-size: var(--fs-sm); color: var(--muted); }
.plan-key { display: inline-flex; align-items: center; gap: var(--s2); }
.cal-dot { width: 10px; height: 10px; display: inline-block; background: var(--cal-1); }
.cal-dot-2 { background: var(--cal-2); } .cal-dot-3 { background: var(--cal-3); } .cal-dot-4 { background: var(--cal-4); } .cal-dot-5 { background: var(--cal-5); } .cal-dot-6 { background: var(--cal-6); } .cal-dot-7 { background: var(--cal-7); } .cal-dot-8 { background: var(--cal-8); }
/* fällt aus (z. B. Schließtag): blass und durchgestrichen */
.cal-off { opacity: 0.55; text-decoration: line-through; }
/* Monatskalender (UI.monthCalendar): sieben Spalten, je Tag die Einträge als farbige Zeilen; schmal eine Liste der Tage */
.month-cal { border: 1px solid var(--border); background: var(--surface); margin-bottom: var(--gap-block); }
.month-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.month-head > div { padding: var(--s2); text-align: center; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-cell { min-height: 112px; padding: var(--s1); border-top: 1px solid var(--border); border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.month-grid > .month-cell:nth-child(7n + 1) { border-left: 0; }
.month-grid > .month-cell:nth-child(-n + 7) { border-top: 0; }
.month-cell.empty { background: var(--surface-2); }
.month-cell.today { background: color-mix(in srgb, var(--primary-soft) 40%, transparent); }
.month-cell-head { display: flex; justify-content: flex-end; align-items: baseline; gap: var(--s2); }
.month-weekday { display: none; font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.month-day { font-size: var(--fs-sm); font-weight: 700; color: var(--text-strong); text-decoration: none; padding: 0 var(--s1); }
a.month-day:hover { text-decoration: underline; }
.month-entry { display: block; font-size: var(--fs-xs); line-height: 1.3; padding: 1px 4px; border: 1px solid; border-left-width: 3px; color: var(--text-strong); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.month-entry:hover { filter: brightness(0.96); }
.month-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.month-entry.cal-off { text-decoration: line-through; }
.month-more { font-size: var(--fs-xs); color: var(--primary); padding: 0 4px; }
.month-cal .cal-c1 { --cal-color: var(--cal-1); } .month-cal .cal-c2 { --cal-color: var(--cal-2); } .month-cal .cal-c3 { --cal-color: var(--cal-3); } .month-cal .cal-c4 { --cal-color: var(--cal-4); }
.month-cal .cal-c5 { --cal-color: var(--cal-5); } .month-cal .cal-c6 { --cal-color: var(--cal-6); } .month-cal .cal-c7 { --cal-color: var(--cal-7); } .month-cal .cal-c8 { --cal-color: var(--cal-8); }
.month-cal .month-entry { background: color-mix(in srgb, var(--cal-color, var(--muted)) 14%, var(--surface)); border-color: color-mix(in srgb, var(--cal-color, var(--muted)) 55%, var(--surface)); }
@media (max-width: 1079px) {
  .month-head { display: none; }
  .month-grid { grid-template-columns: minmax(0, 1fr); }
  .month-cell { min-height: 0; border-left: 0; border-top: 1px solid var(--border); padding: var(--s2); }
  .month-grid > .month-cell:nth-child(-n + 7) { border-top: 1px solid var(--border); }
  .month-cell.empty, .month-cell.none { display: none; }
  .month-cell-head { justify-content: flex-start; }
  .month-weekday { display: inline; }
  .month-entry { white-space: normal; }
}
.week-cal .cal-chip { font-size: var(--fs-xs); padding: 1px 4px; border: 1px solid; border-left-width: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-cal .cal-c1, .week-cal .cal-c2, .week-cal .cal-c3, .week-cal .cal-c4, .week-cal .cal-c5, .week-cal .cal-c6, .week-cal .cal-c7, .week-cal .cal-c8 { background: color-mix(in srgb, var(--cal-color) 14%, var(--surface)); border-color: color-mix(in srgb, var(--cal-color) 45%, var(--surface)); border-left-color: var(--cal-color); }
.week-cal .cal-c1 { --cal-color: var(--cal-1); } .week-cal .cal-c2 { --cal-color: var(--cal-2); } .week-cal .cal-c3 { --cal-color: var(--cal-3); } .week-cal .cal-c4 { --cal-color: var(--cal-4); }
.week-cal .cal-c5 { --cal-color: var(--cal-5); } .week-cal .cal-c6 { --cal-color: var(--cal-6); } .week-cal .cal-c7 { --cal-color: var(--cal-7); } .week-cal .cal-c8 { --cal-color: var(--cal-8); }
.week-cal .cal-muted { background: var(--surface-3); border-color: var(--border-strong); border-left-color: var(--muted); color: var(--muted); }
.week-nav { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.week-nav .week-title { font-weight: 700; font-size: var(--fs-md); margin: 0 var(--s2); }

/* ---------- Zähler im Hauptmenü (offene Anfragen, ungelesene Nachrichten) ---------- */
.nav-badge { margin-left: auto; min-width: 1.5em; padding: 0 0.4em; font-size: var(--fs-xs); font-weight: 700; line-height: 1.6; text-align: center; background: var(--sidebar-strong); color: var(--sidebar); }
.nav-badge[hidden] { display: none; }

/* ---------- Chat (pages/messenger.js): links die Unterhaltungen, rechts der Verlauf; mobil eine Spalte ---------- */
/* ---------- Chat wie ein Messenger (pages/messenger.js): ohne Seitenkopf, Chatliste mit runden Bildern, Sprechblasen ---------- */
/* die Seite steckt in einem Element innerhalb von .content (app.js); dessen Innenabstand fällt beim Chat weg */
.content:has(> .messenger-page) { padding: 0; }
/* solange der Chat offen ist, scrollt nie die Seite, nur Liste und Verlauf */
html:has(.messenger-page), body:has(.messenger-page) { overflow: hidden; height: 100%; }
.messenger-page > * { margin: 0; }
.messenger-page {
  --msg-wall: #efeae2; --msg-own: #d9fdd3; --msg-other: #ffffff; --msg-bar: #f0f2f5; --msg-ink: #111b21; --msg-muted: #667781;
  --msg-green: #00a884; --msg-tick: #53bdeb; --msg-line: #e9edef;
}
/* Höhe genau des Fensters: die Zeile des Rasters darf nicht mit dem Inhalt wachsen (sonst scrollt die Seite statt der Liste) */
.msg-layout { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; background: var(--msg-wall); color: var(--msg-ink); }
.msg-side, .msg-thread { overflow: hidden; }
.msg-search, .msg-side-head, .msg-head, .msg-compose { flex: 0 0 auto; }
.msg-chats { min-height: 0; }
.msg-side { position: relative; display: flex; flex-direction: column; min-height: 0; background: #fff; border-right: 1px solid var(--msg-line); }
.msg-side-head { padding: var(--s4) var(--s4) var(--s2); }
.msg-side-head h1 { margin: 0; font-size: 1.35rem; font-weight: 700; }
.msg-search { display: flex; align-items: center; gap: var(--s2); margin: 0 var(--s3) var(--s2); padding: 0 var(--s3); background: var(--msg-bar); border-radius: 8px; color: var(--msg-muted); }
.msg-search input { flex: 1 1 auto; min-width: 0; height: 36px; border: 0; background: transparent; outline: none; color: var(--msg-ink); }
.msg-chats { list-style: none; margin: 0; padding: 0 0 88px; overflow-y: auto; flex: 1 1 auto; }
.msg-chats a { display: flex; gap: var(--s3); align-items: center; padding: 0 var(--s3); color: var(--msg-ink); text-decoration: none; }
.msg-chats a:hover { background: #f5f6f6; }
.msg-chats a.active { background: #f0f2f5; }
.msg-chat-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: var(--s3) 0; border-bottom: 1px solid var(--msg-line); }
.msg-chat-row { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.msg-chat-title { flex: 1 1 auto; min-width: 0; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-chat-time { flex: 0 0 auto; font-size: var(--fs-xs); color: var(--msg-muted); }
.msg-chat-last { flex: 1 1 auto; min-width: 0; font-size: var(--fs-sm); color: var(--msg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-chats a.unread .msg-chat-time { color: var(--msg-green); font-weight: 600; }
.msg-unread { flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--msg-green); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.msg-empty-list { padding: var(--s5) var(--s4); color: var(--msg-muted); font-size: var(--fs-sm); line-height: 1.5; }
.msg-avatar { flex: 0 0 auto; width: 48px; height: 48px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 1.05rem; letter-spacing: 0.02em; }
.msg-avatar.sm { width: 40px; height: 40px; font-size: 0.95rem; }
.av-0 { background: #00a884; } .av-1 { background: #53bdeb; } .av-2 { background: #a5b337; } .av-3 { background: #e26ab6; }
.av-4 { background: #fc9775; } .av-5 { background: #7f66ff; } .av-6 { background: #1fa855; } .av-7 { background: #d6a43a; }
.msg-author.av-0, .msg-author.av-1, .msg-author.av-2, .msg-author.av-3, .msg-author.av-4, .msg-author.av-5, .msg-author.av-6, .msg-author.av-7 { background: none; }
.msg-author.av-0 { color: #008069; } .msg-author.av-1 { color: #027eb5; } .msg-author.av-2 { color: #7a8423; } .msg-author.av-3 { color: #c13a90; }
.msg-author.av-4 { color: #d2603a; } .msg-author.av-5 { color: #5e47de; } .msg-author.av-6 { color: #1b8a47; } .msg-author.av-7 { color: #a8751c; }
.msg-fab { position: absolute; right: var(--s4); bottom: var(--s4); width: 56px; height: 56px; padding: 0; border: 0; border-radius: 16px; background: var(--msg-green); color: #fff; box-shadow: 0 2px 6px rgba(11, 20, 26, 0.26); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.msg-fab:hover { background: #008f72; }
.msg-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.msg-welcome { margin: auto; max-width: 420px; padding: var(--s6); text-align: center; color: var(--msg-muted); }
.msg-welcome h2 { margin: var(--s3) 0 var(--s2); color: var(--msg-ink); font-weight: 400; }
.msg-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s4); min-height: 60px; background: var(--msg-bar); border-bottom: 1px solid var(--msg-line); }
.msg-head-text { display: flex; flex-direction: column; min-width: 0; }
.msg-head-text strong { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-head-text span { font-size: var(--fs-xs); color: var(--msg-muted); }
.msg-back { display: none; height: 40px; width: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--msg-ink); }
.msg-scroll { flex: 1 1 auto; overflow-y: auto; padding: var(--s3) 6%; display: flex; flex-direction: column; gap: 2px; }
.msg-day { align-self: center; margin: var(--s3) 0 var(--s2); }
.msg-day span { display: inline-block; padding: 5px 12px; border-radius: 8px; background: #fff; color: var(--msg-muted); font-size: var(--fs-xs); box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13); }
.msg { position: relative; align-self: flex-start; max-width: min(75%, 560px); padding: 6px 9px 4px; background: var(--msg-other); border-radius: 8px; box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13); font-size: 0.95rem; line-height: 1.4; }
.msg.first { margin-top: var(--s2); border-top-left-radius: 0; }
.msg.first::before { content: ""; position: absolute; top: 0; left: -8px; border-top: 0 solid transparent; border-right: 8px solid var(--msg-other); border-bottom: 13px solid transparent; }
.msg.mine { align-self: flex-end; background: var(--msg-own); }
.msg.mine.first { border-top-left-radius: 8px; border-top-right-radius: 0; }
.msg.mine.first::before { left: auto; right: -8px; border-right: 0; border-left: 8px solid var(--msg-own); }
.msg.deleted .msg-body { color: var(--msg-muted); font-style: italic; display: inline-flex; align-items: center; gap: 4px; }
.msg-author { font-size: var(--fs-sm); font-weight: 600; margin-bottom: 2px; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 1px; font-size: 11px; color: var(--msg-muted); }
.msg-del { height: auto; padding: 0 2px; border: 0; background: none; color: var(--msg-muted); cursor: pointer; opacity: 0; transition: opacity 0.12s; }
.msg:hover .msg-del, .msg-del:focus-visible { opacity: 1; }
@media (hover: none) { .msg-del { opacity: 0.6; } }
.msg-ticks { display: inline-flex; color: var(--msg-muted); }
.msg-ticks svg + svg { margin-left: -9px; }
.msg-ticks.read { color: var(--msg-tick); }
.msg-compose { display: flex; gap: var(--s2); align-items: flex-end; padding: var(--s2) var(--s3); background: var(--msg-bar); }
.msg-compose textarea { flex: 1 1 auto; min-height: 42px; max-height: 140px; resize: none; padding: 10px 14px; font: inherit; line-height: 1.4; border: 0; border-radius: 21px; background: #fff; color: var(--msg-ink); outline: none; }
.msg-tool { flex: 0 0 auto; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #54656f; cursor: pointer; }
.msg-tool:hover { background: rgba(11, 20, 26, 0.06); }
.msg-send { flex: 0 0 auto; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: var(--msg-green); color: #fff; cursor: pointer; }
.msg-send:hover { background: #008f72; }
@media (max-width: 1079px) {
  .msg-layout { grid-template-columns: minmax(0, 1fr); height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); }
  .msg-layout.open .msg-side, .msg-layout:not(.open) .msg-thread { display: none; }
  .msg-back { display: inline-flex; align-items: center; justify-content: center; margin-left: calc(-1 * var(--s2)); }
  .msg-scroll { padding: var(--s2) var(--s3); }
  .msg { max-width: 85%; }
}
.msg-image img { display: block; max-width: min(100%, 320px); max-height: 320px; border-radius: 6px; }
.msg-file { display: flex; align-items: center; gap: var(--gap-inline); color: var(--msg-ink); text-decoration: none; padding: var(--s2); background: rgba(11, 20, 26, 0.05); border-radius: 6px; }
.msg-file > span { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.msg-file:hover strong { text-decoration: underline; }
.msg-poll { display: flex; flex-direction: column; gap: var(--s2); min-width: min(260px, 60vw); }
.msg-poll-question { font-weight: 600; }
.msg-poll-option { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--s3); align-items: center; height: auto; padding: var(--s2) var(--s3); text-align: left; white-space: normal; background: var(--surface); border: 1px solid var(--border-strong); }
.msg-poll-option.chosen { border-color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); font-weight: 600; }
.messenger-page .msg-poll-option { border-radius: 6px; border-color: var(--msg-line); background: #fff; }
.messenger-page .msg-poll-option.chosen { border-color: var(--msg-green); box-shadow: inset 3px 0 0 var(--msg-green); }
.msg-poll-label { display: inline-flex; align-items: center; gap: var(--s1); overflow-wrap: anywhere; }
.msg-poll-names { grid-column: 1 / -1; font-size: var(--fs-xs); font-weight: 400; color: var(--muted); }
.msg-poll-close { align-self: flex-start; height: auto; padding: 0; border: 0; background: none; color: var(--muted); font-size: var(--fs-xs); text-decoration: underline; cursor: pointer; }

/* ---------- Unterschriftsfeld (UI.signaturePad) ---------- */
.signature-pad { position: relative; border: 1px solid var(--border-strong); background: var(--surface); }
.signature-pad canvas { display: block; width: 100%; height: auto; aspect-ratio: 600 / 180; touch-action: none; cursor: crosshair; color: var(--text); }
.signature-pad::after { content: "Hier unterschreiben"; position: absolute; left: var(--s3); bottom: var(--s2); font-size: var(--fs-xs); color: var(--muted); pointer-events: none; }
.signature-pad.signed::after { content: ""; }
.signature-pad .signature-clear { position: absolute; top: var(--s1); right: var(--s1); height: auto; padding: var(--s1) var(--s2); font-size: var(--fs-xs); }
.signature-image { display: block; max-width: 100%; border: 1px solid var(--border); background: var(--surface); }

/* Entfernen-Kreuz in einem Tag (Empfänger eines Dokuments) */
.tag .tag-remove { height: auto; padding: 0 0 0 var(--s1); border: 0; background: none; color: inherit; font-size: inherit; line-height: 1; cursor: pointer; }

/* Prüfsummen und andere lange Kennungen: brechen um, statt den Behälter zu sprengen */
code.hash { white-space: normal; overflow-wrap: anywhere; word-break: break-all; }

/* Sponsoren-Netzwerk: Logo im Verzeichnis, Kommentare unter einem Beitrag */
.sponsor-logo { flex: none; width: 64px; height: 64px; object-fit: contain; border: 1px solid var(--border); background: var(--surface); }
.sponsor-logo-empty { display: flex; align-items: center; justify-content: center; font-size: var(--fs-xl); font-weight: 700; color: var(--muted); background: var(--surface-2); }
.sponsor-card .panel-list { margin-top: var(--gap-text); border-top: 1px solid var(--border); }
.sponsor-comment { margin-top: var(--gap-text); padding: var(--s2) var(--s3); background: var(--surface-2); border-left: 2px solid var(--border-strong); overflow-wrap: anywhere; }
.sponsor-comment-form { margin-top: var(--gap-text); margin-bottom: 0; }
.sponsor-card .card-body > .row { margin-bottom: var(--gap-text); align-items: flex-start; }
.sponsor-comment-form .field { margin-bottom: var(--gap-inline); }

/* Alltag der Gruppe (Tablet): je Kind eine Zeile mit großen Knöpfen */
.care-day { display: flex; flex-direction: column; }
.care-child { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--gap-text); padding: var(--s3) 0; border-top: 1px solid var(--border); border-left: 4px solid transparent; padding-left: var(--s3); }
.care-child:first-child { border-top: 0; }
.care-child.here { border-left-color: var(--success); }
.care-child.away { border-left-color: var(--warning); background: var(--surface-2); }
.care-child-main { flex: 1 1 280px; min-width: 0; }
.care-child-name { font-size: var(--fs-lg); font-weight: 600; text-align: left; }
.care-child-actions { display: flex; flex-wrap: wrap; gap: var(--gap-inline); }
.care-child-actions button { min-height: 44px; min-width: 76px; }

/* Wissensdatenbank: Seitenbaum als eingerückte Liste, Treffer der Suche hervorgehoben */
ul.wiki-tree { list-style: none; margin: 0; padding: 0; }
ul.wiki-tree ul.wiki-tree { margin-left: var(--s2); padding-left: var(--s3); border-left: 1px solid var(--border); }
.wiki-search { display: flex; align-items: flex-end; gap: var(--gap-inline); margin-bottom: var(--gap-block); }
.wiki-search .field { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }
.card-body > .wiki-search:last-child { margin-bottom: 0; }
ul.wiki-notes { list-style: none; margin: 0; padding: 0; }
ul.wiki-notes li { padding: var(--s3) 0; border-top: 1px solid var(--border); }
ul.wiki-notes li:first-child { border-top: 0; padding-top: 0; }
ul.wiki-notes li:last-child { padding-bottom: 0; }
.wiki-tree li { padding: var(--s1) 0; }
.wiki-tree li > a { display: inline-block; padding: 2px 0; font-weight: 500; }
.wiki-tree li > a.active { color: var(--accent); }
mark { background: var(--accent-soft); color: inherit; padding: 0 2px; }

/* Rechnungen: Positionen des Entwurfs, Summenblock, Logo der Vorlage */
.inv-line { padding: var(--gap-block) 0; border-top: 1px solid var(--border); }
.inv-line:first-child { border-top: 0; padding-top: 0; }
.inv-line:last-child { padding-bottom: 0; }
.inv-line-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--gap-inline) var(--gap-block); }
table.inv-totals { width: auto; min-width: min(360px, 100%); margin: var(--gap-block) 0 var(--gap-block) auto; border-collapse: collapse; border: 0; }
.inv-totals td { padding: var(--s1) 0 var(--s1) var(--s6); text-align: right; border: 0; background: none; }
.inv-totals td:first-child { text-align: left; padding-left: 0; color: var(--muted); }
.inv-totals tr.strong td { border-top: 2px solid var(--border-strong); font-weight: 700; font-size: var(--fs-lg); color: var(--text-strong); padding-top: var(--s2); }
.inv-logo { max-height: 40px; max-width: 160px; display: block; }

/* Dashboard: Übersichten als Karten nebeneinander, Kacheln darin kompakter */
/* Übersichten in höchstens --n Spalten (Einstellung je Benutzergruppe), **fließend**: endet eine Kachel, schließt die nächste
   direkt darunter an, ohne Leerraum bis zur Höhe der Nachbarn. Dafür Spaltensatz statt Raster: die Kacheln laufen von oben
   nach unten durch die Spalten. Wird der Platz knapp (unter 250 px je Spalte), werden es von selbst weniger. */
.dash-grid { --n: 2; columns: 250px var(--n); column-gap: var(--gap-block); }
.dash-grid > * { break-inside: avoid; }
.dash-grid.cols-1 { --n: 1; }
.dash-grid.cols-3 { --n: 3; }
/* Dashboard: links die Übersichten, rechts das Schwarze Brett über die volle Höhe (bleibt beim Scrollen stehen) */
.dash-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 30%); gap: 0 var(--gap-section); align-items: start; }
.dash-layout.no-news { grid-template-columns: minmax(0, 1fr); }
.dash-left { min-width: 0; }
/* Höhe = Fenster minus Abstand oben und minus den unteren Innenabstand der Seite (--s8): sonst schiebt das Ende der Seite
   die Box beim Scrollen ein Stück nach oben */
.dash-right { position: sticky; top: var(--gap-block); max-height: calc(100vh - var(--gap-block) - var(--s8)); overflow-y: auto; min-width: 0; }
.dash-right .card:last-child { margin-bottom: 0; }
/* erst im Handy-Layout (unter 1080 px) einspaltig; darüber bleibt das Schwarze Brett rechts */
@media (max-width: 1079px) {
  .dash-layout { grid-template-columns: minmax(0, 1fr); }
  /* schmal: das Schwarze Brett steht als Box oben, die Übersichten folgen darunter */
  .dash-right { position: static; max-height: none; overflow: visible; order: -1; }
  /* dort zeigt das Schwarze Brett einen Beitrag je Seite, den neuesten zuerst: wischen oder die Knöpfe darunter */
  .dash-right .news-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: var(--gap-block); overscroll-behavior-x: contain; }
  .dash-right .news-track::-webkit-scrollbar { display: none; }
  .dash-right .news-track > .news-item { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; margin-top: 0; padding-top: 0; border-top: 0; max-height: 60vh; overflow-y: auto; }
  .dash-right .news-pager { display: flex; align-items: center; justify-content: center; gap: var(--gap-block); margin-top: var(--gap-text); }
  .dash-right .news-count { font-size: var(--fs-sm); color: var(--muted); min-width: 4em; text-align: center; }
}
.dash-tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: var(--gap-block); }
.dash-tiles:last-child { margin-bottom: 0; }
.nav-label:not(:first-child) { margin-top: var(--s3); }
.dash-tiles { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--gap-inline); }
.dash-tiles .tile { padding: var(--s3); }
.dash-tiles .tile .value { font-size: var(--fs-xl); overflow-wrap: anywhere; }

/* Postfach: Ordner links, Liste oder E-Mail rechts; fremdes HTML im abgeschotteten Rahmen */
/* Knöpfe links in der Fußzeile eines Dialogs (z. B. „Verbindung prüfen“), mit Ergebnis daneben */
dialog .btn-row .btn-row-left { margin: 0 auto 0 0; display: inline-flex; align-items: center; gap: var(--gap-inline); min-width: 0; }
/* Symbol-Knopf, der gerade lädt: das Symbol dreht sich */
.is-spinning svg { animation: spin 0.8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .is-spinning svg { animation: none; } }
/* Postfach am Rechner: Liste und Vorschau nebeneinander, dazwischen der Griff für die Breite (--mail-list-w merkt die Seite) */
/* ohne Seitenkopf über die ganze Fläche (wie der Chat): der Innenabstand von .content fällt am Rechner weg, es scrollen nur die Spalten */
@media (min-width: 1080px) {
  .content:has(> .mail-page) { padding: 0; }
  html:has(.mail-page), body:has(.mail-page) { overflow: hidden; height: 100%; }
}
.mail-split { display: grid; grid-template-columns: minmax(240px, min(var(--mail-list-w, 380px), 42%)) 9px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; }
/* Titel und Aktionen des Postfachs als schmale Leiste */
.mail-toolbar { display: flex; align-items: center; gap: var(--gap-inline); padding: var(--s3); position: sticky; top: 0; z-index: 1; background: var(--surface); border-bottom: 1px solid var(--border); }
.mail-toolbar h1 { margin: 0; font-size: var(--fs-lg); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-toolbar .row { flex: none; margin-inline-start: auto; }
.mail-toolbar > button { flex: none; }
.mail-pane { min-width: 0; overflow: auto; }
.mail-pane-list { background: var(--surface); }
.mail-pane-list > form, .mail-pane-list > .empty-state { margin: var(--s3); }
/* die Suche bleibt in der schmalen Liste einzeilig */
.mail-pane-list .search-bar { flex-wrap: nowrap; margin-bottom: 0; }
.mail-pane-list .search-bar > :first-child { flex: 1 1 0; }
.mail-pane-list > .list-footer { padding: var(--s2) var(--s3); }
.mail-pane-view { background: var(--surface); }
.mail-blank { padding: var(--s5); }
.mail-split-handle { cursor: col-resize; position: relative; touch-action: none; }
.mail-split-handle::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 4px; width: 1px; background: var(--border-strong); }
.mail-split-handle:hover::after, .mail-split-handle:focus-visible::after, .mail-split.resizing .mail-split-handle::after { width: 3px; inset-inline-start: 3px; background: var(--primary); }
.mail-split-handle:focus-visible { outline: none; }
/* beim Ziehen des Griffs darf die Vorschau (iframe) die Maus nicht schlucken */
.mail-split.resizing { user-select: none; cursor: col-resize; }
.mail-split.resizing .mail-pane { pointer-events: none; }
ul.mail-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.mail-toolbar + form + ul.mail-list { margin-top: var(--s3); }
.mail-list li { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); border-inline-start: 3px solid transparent; cursor: pointer; }
.mail-list li:hover { background: var(--surface-2); }
.mail-list li.active { background: var(--accent-soft); border-inline-start-color: var(--accent); }
.mail-list li:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.mail-list li.dragging { opacity: 0.5; }
.mail-list-top { display: flex; gap: var(--gap-inline); align-items: center; }
.mail-list-top .mail-from { flex: 1 1 auto; }
/* Gelesen (Haken bzw. Punkt) und Stern: schlichte Symbole ohne Rahmen, zum Anklicken */
.mail-list .mail-mark { flex: none; width: 22px; height: 22px; min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; display: inline-flex; align-items: center; justify-content: center; color: var(--border-strong); cursor: pointer; }
.mail-list .mail-mark:hover { background: none; color: var(--primary); filter: none; }
.mail-list .mail-mark svg { display: block; }
.mail-list .mail-clip { flex: none; display: inline-flex; color: var(--muted); }
.mail-list .mail-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.mail-list .mail-star.on { color: #d99a00; }
.mail-list .mail-star.on svg { fill: currentColor; }
.mail-list .mail-subject, .mail-list li > .row { margin-inline-start: 30px; }
/* E-Mail schreiben: Kopfzeilen als schmale Zeilen mit Beschriftung davor, der Text füllt den Rest des Dialogs */
dialog .dialog-body.mail-compose { padding-top: 0; gap: 0; }
.mail-compose .mc-row { display: flex; align-items: center; gap: var(--s3); min-height: 44px; border-bottom: 1px solid var(--border); }
.mail-compose .mc-row[hidden] { display: none; }
.mail-compose .mc-row label { flex: none; width: 64px; margin: 0; font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.mail-compose .mc-row input { flex: 1 1 auto; min-width: 0; height: 42px; border: 0; background: none; box-shadow: none; padding: 0; }
.mail-compose .mc-row input:focus { outline: none; box-shadow: none; }
.mail-compose .mc-row:focus-within { border-bottom-color: var(--primary); }
.mail-compose .mc-more { flex: none; display: inline-flex; gap: var(--s1); }
.mail-compose .mc-more button { height: 28px; min-height: 0; padding: 0 var(--s2); border: 0; background: none; box-shadow: none; color: var(--muted); font-size: var(--fs-sm); }
.mail-compose .mc-more button:hover { color: var(--primary); background: none; }
.mail-compose .mc-more button[hidden] { display: none; }
dialog.dialog-fill .dialog-body.mail-compose > .mc-text { flex: 1 1 auto; min-height: 200px; width: 100%; margin: 0; padding: var(--s3) 0; border: 0; background: none; box-shadow: none; resize: none; font: inherit; line-height: 1.5; }
.mail-compose .mc-text:focus { outline: none; box-shadow: none; }
.mb-test-row { margin-bottom: var(--gap-block); }
.mail-from { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-date { flex: none; font-size: var(--fs-xs); color: var(--muted); }
.mail-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.mail-list li.unread .mail-from, .mail-list li.unread .mail-subject { font-weight: 700; color: var(--text-strong); }
.mail-list .row { margin-top: 2px; }
/* E-Mail wird gezogen: die Ordner im Untermenü sind die Ziele */
.subnav-tree li.mail-drop > .tree-row { background: var(--accent-soft); outline: 2px dashed var(--primary); outline-offset: -2px; }
/* Eine Spalte (Klasse mail-single, setzt die Seite bei wenig Platz und am Handy): Liste und E-Mail nacheinander über die ganze Fläche */
.mail-single .mail-toolbar h1 { flex: 1 1 auto; }
.mail-single .mail-main > form { margin: var(--s3); }
.mail-single .mail-main .search-bar { flex-wrap: nowrap; margin-bottom: 0; }
.mail-single .mail-main .search-bar > :first-child { flex: 1 1 0; }
.mail-single .mail-main > .empty-state { margin: var(--s5) var(--s3); }
.mail-single .mail-main > .list-footer { padding: var(--s3); }
/* Zurück oben links: nur das Symbol, kräftig, ohne Rahmen */
.mail-single .mail-toolbar > [data-act="folders"], .mail-single .mail-actions > [data-act="back"] { flex: none; width: 32px; padding: 0; border: 0; background: none; box-shadow: none; color: var(--text-strong); }
.mail-single .mail-toolbar > [data-act="folders"] svg, .mail-single .mail-actions > [data-act="back"] svg { width: 26px; height: 26px; stroke-width: 3; }
.mail-single .mail-toolbar > [data-act="folders"]:hover, .mail-single .mail-actions > [data-act="back"]:hover { background: none; color: var(--primary); }
/* E-Mail: Aktionen und Kopf (Betreff, Absender) bleiben stehen, darunter scrollt nur der Inhalt */
.mail-single .mail-main:has(> .mail-scroll) { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.mail-single .mail-main:has(> .mail-scroll) > .mail-actions, .mail-single .mail-main:has(> .mail-scroll) > .mail-head { flex: none; }
.mail-single .mail-main > .mail-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
@media (min-width: 1080px) {
  /* am Rechner scrollt nie die Seite (siehe oben), deshalb scrollt hier die einspaltige Ansicht selbst */
  .mail-page.mail-single { height: 100vh; height: 100dvh; overflow: auto; background: var(--surface); }
}
/* Handy: dazu die Stufe „Postfächer“ und die Kopfzeile der App darüber */
@media (max-width: 1079px) {
  /* Untermenü nur am Rechner (ROUTES[…].desktopOnly): am Handy steht es nicht im Burger-Menü */
  .subnav.subnav-desktop-only { display: none; }
  .content:has(> .mail-page) { padding: 0; background: var(--surface); }
  /* weiß bis zum unteren Rand, auch wenn die Liste kürzer ist als der Bildschirm */
  html:has(.mail-page), body:has(.mail-page), body:has(.mail-page) .app, body:has(.mail-page) .content { background: var(--surface); background-image: none; }
  .mail-page { min-height: calc(100dvh - var(--topbar-h)); background: var(--surface); }
  .mail-toolbar { position: static; }
  .mail-single .mail-main:has(> .mail-scroll) { height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); }
  html:has(.mail-main > .mail-scroll), body:has(.mail-main > .mail-scroll) { overflow: hidden; height: 100%; }
  .mail-main > .mail-head { padding: var(--s3); }
  .mail-main > .mail-head h2 { font-size: var(--fs-lg); margin-bottom: var(--s2); }
  /* der stehende Kopf soll wenig Höhe kosten */
  .mail-main > .mail-head > .row { margin-top: var(--s2); }
  .mail-head-images button, .mail-head-files button, .mail-head-files a { height: 32px; min-height: 32px; }
  .mail-acc h2 { margin: 0; padding: var(--s4) var(--s3) var(--s2); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
  .mail-acc-note { padding: 0 var(--s3) var(--s3); }
  ul.mail-folder-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
  .mail-folder-list li { border-bottom: 1px solid var(--border); }
  .mail-folder-list button, .mail-acc-foot button { width: 100%; height: auto; min-height: 48px; justify-content: flex-start; gap: var(--s2); padding: var(--s2) var(--s3); border: 0; background: none; box-shadow: none; color: var(--text); font-weight: 500; text-align: start; }
  .mail-folder-list button > span:first-child { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mail-folder-list button > svg:last-child { flex: none; color: var(--border-strong); }
  .mail-folder-list .depth-1 { padding-inline-start: calc(var(--s3) + 20px); }
  .mail-folder-list .depth-2 { padding-inline-start: calc(var(--s3) + 40px); }
  .mail-folder-list .depth-3 { padding-inline-start: calc(var(--s3) + 60px); }
  .mail-folder-list .depth-4 { padding-inline-start: calc(var(--s3) + 80px); }
  .mail-folder-list .mail-folder-add, .mail-acc-foot .mail-folder-add { color: var(--primary); }
  .mail-folder-add > span { flex: none; }
  /* „Neues Postfach“ steht fest am unteren Bildschirmrand; die Liste darüber lässt dafür Platz */
  .mail-acc-foot { position: fixed; inset-inline: 0; bottom: 0; z-index: 5; padding: var(--s1) 0 calc(var(--s1) + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--border); }
  .mail-main:has(> .mail-acc-foot) { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
}
.mail-folders { background: var(--surface); border: 1px solid var(--border); }
.mail-unread { font-weight: 700; color: var(--text-strong); }
.mail-frame { display: block; width: 100%; height: 70vh; min-height: 320px; border: 1px solid var(--border); background: #fff; }
.mail-headers { margin: 0; padding: var(--s3); max-height: 60vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-sm); line-height: 1.55; color: var(--text-strong); background: var(--surface); border: 1px solid var(--border); }
.mail-text { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; margin: 0; padding: var(--s3); border: 1px solid var(--border); background: var(--surface); }
.mail-main > .btn-row { margin-bottom: var(--gap-block); }
/* Aktionen über der E-Mail: immer eine Zeile; Löschen und „…“ rechts, bei wenig Platz wandern zwei Knöpfe ins Menü */
.mail-main { container-type: inline-size; }
.mail-actions { display: flex; align-items: center; gap: var(--gap-inline); flex-wrap: nowrap; margin-bottom: var(--gap-block); }
.mail-actions > button, .mail-actions .push { flex: none; }
.mail-actions-wide, .mail-actions .push { display: inline-flex; gap: var(--gap-inline); }
.mail-actions .push { margin-inline-start: auto; }
.mail-actions-narrow { display: none; }
.mail-actions-narrow > button { width: 100%; justify-content: flex-start; border: 0; background: transparent; color: var(--text); padding: var(--s3) var(--s4); white-space: nowrap; height: auto; }
.mail-actions-narrow > button:hover { background: var(--primary-soft); }
@container (max-width: 560px) {
  .mail-actions-wide { display: none; }
  .mail-actions-narrow { display: contents; }
}
/* Mailansicht ohne Kasten: oben die Aktionen (bleiben stehen), darunter scrollt alles gemeinsam, der Balken sitzt ganz rechts */
.mail-actions { padding: var(--s3) var(--s4); margin: 0; background: var(--surface); border-bottom: 1px solid var(--border); }
.mail-head { padding: var(--s4) var(--s4) var(--s3); border-bottom: 1px solid var(--border); }
.mail-head h2 { margin: 0 0 var(--s3); font-size: var(--fs-xl); line-height: 1.25; overflow-wrap: anywhere; }
.mail-head-row { display: flex; align-items: flex-start; gap: var(--s3); }
.mail-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: var(--fs-sm); }
.mail-head-who { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.mail-head-date { flex: none; white-space: nowrap; padding-top: 2px; }
.mail-head > .row { margin-top: var(--s3); flex-wrap: wrap; }
.mail-scroll .mail-frame { border: 0; height: 60vh; }
/* Text-E-Mails (auch Unzustellbarkeitsmeldungen): dunkle Schrift auf Weiß; `pre` ist sonst der dunkle Codeblock mit heller Schrift */
.mail-text { color: var(--text); font-size: var(--fs-md); line-height: 1.55; }
.mail-scroll .mail-text { border: 0; padding: var(--s4); background: none; }
/* nur für Vorleseprogramme sichtbar */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Eingangsrechnung: Angaben links, der Beleg rechts daneben (bleibt beim Scrollen stehen); bei wenig Platz darunter */
.bill-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 46%); gap: var(--gap-section); align-items: start; }
.bill-main { min-width: 0; }
.bill-doc { position: sticky; top: var(--s4); display: flex; flex-direction: column; height: calc(100vh - 2 * var(--s4)); height: calc(100dvh - 2 * var(--s4)); min-height: 420px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-box); }
.bill-doc-head { flex: none; display: flex; align-items: center; gap: var(--gap-inline); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); }
.bill-doc-head .muted { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bill-doc-body { flex: 1 1 auto; min-height: 0; width: 100%; border: 0; background: #fff; overflow: auto; }
.bill-doc-body img { display: block; max-width: 100%; height: auto; }
/* XML einer E-Rechnung: aufgeräumt, eingerückt, farbig (helle Fläche statt des dunklen Codeblocks) */
.xml-view { margin: 0; padding: var(--s3); background: var(--surface); color: var(--text); font-size: var(--fs-xs); line-height: 1.6; white-space: pre; tab-size: 2; }
.xml-view .xml-tag { color: var(--primary); font-weight: 600; }
.xml-view .xml-attr { color: var(--accent); }
.xml-view .xml-val { color: #0b6e4f; }
.xml-view .xml-text { color: var(--text-strong); font-weight: 600; }
.xml-view .xml-p, .xml-view .xml-muted { color: var(--muted); }
.bill-doc-body[hidden] { display: none; }
/* neben Haupt- und Untermenü bleibt erst ab etwa 1600 px genug Platz für beide Spalten */
@media (max-width: 1599px) {
  .bill-layout { grid-template-columns: minmax(0, 1fr); }
  .bill-doc { position: static; height: 80vh; }
}
/* Angaben bearbeiten: Formular links, Beleg rechts im selben Dialog */
dialog.dialog-fill .dialog-body.bill-edit { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(0, 1.1fr); gap: var(--gap-block); overflow: hidden; }
.bill-edit > div { overflow: auto; min-width: 0; padding-inline-end: var(--s2); }
.bill-doc.in-dialog { position: static; height: auto; min-height: 0; box-shadow: none; }
@media (max-width: 1079px) {
  dialog.dialog-fill .dialog-body.bill-edit { display: flex; flex-direction: column; overflow: auto; }
  .bill-edit > div { overflow: visible; }
  .bill-doc.in-dialog { flex: none; height: 70vh; }
}
/* Ausgangsvorlage wählen und zurücksetzen, über dem Stylesheet */
.css-start { align-items: flex-end; margin-bottom: var(--gap-block); }
.css-start .field { margin-bottom: 0; min-width: 180px; }
/* im Feld der Vorlage „Eigene“: eingerückt unter dem Auswahlpunkt */
.tpl-own .css-start { margin: var(--s2) 0 0; padding-inline-start: 28px; flex-wrap: wrap; }
/* großes Eingabefeld für Code (eigenes Stylesheet der Website) */
textarea.code-area { width: 100%; min-height: 360px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-sm); line-height: 1.5; white-space: pre; overflow: auto; tab-size: 2; padding: var(--s3); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); }
/* Belege übernehmen: links die Auswahl, rechts die Vorschau des angeklickten Belegs */
dialog.dialog-fill .dialog-body.bill-pick { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: var(--gap-block); overflow: hidden; }
.bill-pick > div { overflow: auto; min-width: 0; }
.bill-pick .panel-list li { cursor: pointer; }
.bill-preview { width: 100%; height: 100%; min-height: 320px; border: 1px solid var(--border); background: #fff; }
@media (max-width: 1079px) {
  dialog.dialog-fill .dialog-body.bill-pick { display: flex; flex-direction: column; overflow: auto; }
  .bill-preview { flex: none; height: 60vh; }
}
@media (min-width: 1080px) {
  .mail-pane-view { display: flex; flex-direction: column; overflow: hidden; }
  .mail-pane-view > .mail-actions { flex: none; }
  /* der Kopf der E-Mail (Betreff, Absender, Anhänge) steht fest über dem Scrollbereich: der Balken beginnt darunter */
  .mail-pane-view > .mail-head { flex: none; }
  .mail-pane-view > .mail-scroll, .mail-pane-view > .mail-blank { flex: 1 1 auto; min-height: 0; overflow: auto; }
}
}

/* Installationsknopf von Progressier auf der Anmeldeseite: kommt ungestaltet, hier wie ein gewöhnlicher Knopf */
.progressier-install-button { display: inline-flex; align-items: center; justify-content: center; gap: var(--gap-inline); min-height: var(--control-h); }
.progressier-install-button:empty { display: none; }

/* Gelesen-Status: Zeile unter einem Beitrag, Häkchen an eigenen Chatnachrichten */
.read-foot { margin-top: var(--s2); font-size: var(--fs-sm); }
[data-read-new] { margin-left: var(--s2); }

/* Offline-Ansicht (legt sich über alles) und Hinweis auf eine neue Version */
dialog.offline-screen { position: fixed; inset: 0; z-index: 3000; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; border: 0; padding: var(--s5); background: var(--bg); }
dialog.offline-screen[open] { display: flex; align-items: center; justify-content: center; }
.offline-box { max-width: 460px; text-align: center; }
.offline-box h1 { margin: var(--s3) 0 var(--s2); }
.offline-box button { margin-top: var(--s3); min-width: 180px; }
.offline-art { width: min(100%, 300px); height: auto; }
.offline-art path { fill: none; stroke: var(--text-strong); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.offline-art .offline-sail { fill: var(--surface); }
.offline-art .offline-sail.slack { stroke-dasharray: 5 6; }
.offline-art .offline-hull { fill: var(--accent); stroke: var(--accent); }
.offline-art .offline-sun { stroke: var(--warning); }
.offline-art .offline-wave { stroke: var(--primary); stroke-width: 2; }
/* Leiste oben „Neue Version“ (UI.updateBar): Gelb des Textmarkers mit dunkler Schrift, damit sie sich von jeder
   Seitenleiste abhebt (Farbthemen der Vereine, Beere im Ops Center); über die ganze Breite, gleitet herein */
.update-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 2500; padding-top: env(safe-area-inset-top, 0px); background: #ffe066; color: #1f1b2d; border-bottom: 2px solid #1f1b2d; box-shadow: 0 6px 20px rgba(31, 27, 45, 0.25); animation: update-bar-in 0.35s ease-out; }
.update-bar-inner { display: flex; align-items: center; justify-content: center; gap: var(--gap-text); padding: var(--s2) var(--s4); min-height: 48px; }
.update-bar-text { font-size: var(--fs-sm); }
.update-bar-hint { opacity: 0.85; }
.update-bar .update-bar-reload { display: inline-flex; align-items: center; gap: var(--s2); background: #1f1b2d; color: #ffffff; border-color: #1f1b2d; font-weight: 700; }
.update-bar .update-bar-reload:hover { background: #3a344f; border-color: #3a344f; }
.update-bar .update-bar-close { background: none; border-color: transparent; color: #1f1b2d; padding: 0 var(--s2); opacity: 0.7; }
.update-bar .update-bar-close:hover { opacity: 1; background: rgba(31, 27, 45, 0.08); }
@keyframes update-bar-in { from { transform: translateY(-100%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .update-bar { animation: none; } }
@media (max-width: 1079px) { .update-bar-hint { display: none; } }

/* Hauptmenü: aufklappbare Gruppen unter den wichtigsten Bereichen */
.sidebar nav .nav-group { display: flex; align-items: center; gap: var(--s3); width: 100%; height: auto; margin-top: var(--s2); padding: var(--s2) var(--s3); border: 0; border-top: 1px solid rgba(255, 255, 255, 0.14); background: none; color: var(--sidebar-muted); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; text-align: left; cursor: pointer; }
.sidebar nav .nav-group > span:first-child { flex: 1 1 auto; }
.sidebar nav .nav-group:hover { color: var(--sidebar-strong); background: var(--sidebar-2); }
.sidebar nav .nav-group svg { flex: none; transition: transform 0.15s; }
.sidebar nav .nav-group[aria-expanded="true"] svg { transform: rotate(180deg); }
.sidebar nav .nav-group .nav-badge { margin-left: 0; }
.sidebar nav .nav-group[aria-expanded="true"] .nav-badge { display: none; }
.nav-group-items { display: flex; flex-direction: column; }
.nav-group-items[hidden] { display: none; }

/* Suche über alle Bereiche: Feld oben in der Seitenleiste, Trefferliste im Dialog */
.nav-search { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: var(--control-h); margin: var(--s3) 0 var(--s2); padding: var(--s3); background: rgba(255, 255, 255, 0.1); color: var(--sidebar-text); border: 1px solid var(--sidebar-border); font: inherit; font-size: var(--fs-sm); cursor: pointer; text-align: left; }
.nav-search:hover, .nav-search:focus-visible { background: rgba(255, 255, 255, 0.18); }
.nav-search span { flex: 1; }
/* das Kürzel als schlichter Text: ein eigener Rahmen im Rahmen des Feldes verschob die Abstände */
.nav-search kbd { font: inherit; font-size: var(--fs-xs); padding: 0; margin: 0; background: transparent; border: 0; box-shadow: none; color: inherit; opacity: 0.7; white-space: nowrap; }
.search-results { min-height: 180px; max-height: 52vh; overflow-y: auto; }
.search-results h4 { margin: var(--gap-block) 0 var(--s1); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.search-results .search-hit { display: block; text-decoration: none; color: inherit; padding: var(--s1) 0; }
.search-results .search-hit:focus-visible, .search-results .search-hit:hover { background: var(--surface-2); outline: none; }
/* Schnellzugriff auf dem Dashboard: die häufigsten Handgriffe der eigenen Rolle */
.quick-bar { display: flex; flex-wrap: wrap; gap: var(--gap-inline); margin-bottom: var(--gap-block); }
@media (max-width: 1079px) { .nav-search kbd { display: none; } .quick-bar .btn, .quick-bar button { flex: 1 1 44%; } }

/* Glocke in der Seitenleiste: Zähler der ungelesenen Benachrichtigungen */
.bell-btn { position: relative; }
.bell-count { position: absolute; top: 3px; left: calc(50% + 3px); min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; border-radius: 9px; background: var(--accent); color: #fff; box-shadow: 0 0 0 2px var(--sidebar); font-size: 10px; font-weight: 700; line-height: 1; pointer-events: none; }
.notify-item { display: block; text-decoration: none; color: inherit; }
.panel-list li.active .notify-item strong { color: var(--primary); }

/* Kita-Tag: Mitteilung der Eltern am Kind, Übersicht aller Gruppen */
.care-message { margin-top: var(--s1); padding: var(--s1) var(--s2); background: var(--warning-soft, #fff4d6); border-left: 3px solid var(--warning, #b7791f); font-size: var(--fs-sm); }
.care-message.seen { background: transparent; border-left-color: var(--border); color: var(--muted); }

/* Mehrsprachigkeit: Sprachwahl auf der Anmeldeseite; Schreibrichtung von rechts nach links (Arabisch) ist vorbereitet,
   aber noch nicht durchgeprüft: Seitenleiste rechts, Text rechtsbündig, Tabellen und Formulare folgen der Richtung. */
/* Sprachwahl (langMenu in app.js): Flagge mit Kürzel und Liste der Sprachen; nur auf der Anmeldeseite, angemeldet
   ändert man die Sprache in den Benutzereinstellungen. */
.lang-menu { position: relative; flex: none; }
button.lang-current { display: inline-flex; align-items: center; gap: 6px; min-height: 0; height: 40px; padding: 0 var(--s2); background: transparent; border: 1px solid transparent; color: inherit; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; cursor: pointer; }
button.lang-current:hover, button.lang-current[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border); }
.lang-flag-img { display: inline-block; line-height: 0; }
.lang-flag-img svg { display: block; width: 24px; height: 16px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18); }
.lang-list { position: absolute; bottom: calc(100% + var(--s1)); right: 0; min-width: 170px; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-pop); padding: var(--s1); z-index: 15; display: flex; flex-direction: column; }
.lang-list[hidden] { display: none; }
.lang-list button { display: flex; align-items: center; justify-content: flex-start; gap: var(--s3); width: 100%; min-height: 40px; height: auto; padding: var(--s2) var(--s3); background: transparent; border: 0; color: var(--text); font-weight: 500; text-align: start; cursor: pointer; }
.lang-list button:hover { background: var(--primary-soft); }
.lang-list button.active { font-weight: 700; color: var(--primary); }
.lang-list button.active::after { content: "✓"; margin-inline-start: auto; }
/* Anmeldeseite: Kopf mit Logo links und Sprache rechts (Aufklappliste nach unten); Fuß mit „Passwort vergessen?“,
   „Zur Website“ und dem kleinen App-Symbol rechts */
.login-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.login-brand { flex: 1 1 auto; min-width: 0; }
.login-head > .lang-menu { margin-top: -4px; margin-right: calc(-1 * var(--s2)); }
.lang-menu.down .lang-list { bottom: auto; top: calc(100% + var(--s1)); }
.login-foot { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-top: var(--gap-section); padding-top: var(--s4); border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.login-foot .app-install-btn { margin-left: auto; }
button.app-install-btn { height: 32px; min-height: 0; padding: 0 var(--s2); gap: 6px; background: transparent; border: 1px solid var(--border); color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
button.app-install-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
[dir="rtl"] body { text-align: right; }
[dir="rtl"] .app { direction: rtl; }
[dir="rtl"] th, [dir="rtl"] td { text-align: right; }
[dir="rtl"] th.right, [dir="rtl"] td.right { text-align: left; }

/* Balkenliste (UI.barList): Name, Balken in einer Farbe, Wert als Text; mobil steht der Wert unter dem Namen */
.bar-list { display: grid; gap: var(--s2); }
.bar-row { display: grid; grid-template-columns: minmax(120px, 28%) 1fr minmax(48px, auto); align-items: center; gap: var(--s3); font-size: var(--fs-sm); }
.bar-label { overflow-wrap: anywhere; }
.bar-track { height: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.bar-fill { height: 100%; background: var(--primary); min-width: 0; }
.bar-value { text-align: right; color: var(--muted); white-space: nowrap; }
@media (max-width: 1079px) {
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; order: 3; }
  .bar-value { white-space: normal; }
}

/* Erscheinungsbild: Logo im Markenfeld, Vorlagen-Karten und Vorschau (pages/branding.js) */
.brand-logo { object-fit: contain; background: transparent; padding: 0; }
.brand-logo-preview { max-width: 160px; max-height: 64px; object-fit: contain; border: 1px solid var(--border); background: var(--surface-2); padding: var(--s1); }
.brand-favicon-preview { width: 32px; height: 32px; object-fit: contain; border: 1px solid var(--border); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--s3); margin-bottom: var(--gap-block); }
.theme-card { display: grid; gap: var(--s1); padding: var(--s3); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; }
.theme-card.active { outline: 2px solid var(--primary); outline-offset: -2px; }
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-card:focus-within { outline: 2px solid var(--primary); }
.theme-swatches { display: flex; gap: 2px; height: 24px; }
.theme-swatch { flex: 1; border: 1px solid var(--border); }
.theme-preview { display: grid; grid-template-columns: 180px 1fr; border: 1px solid var(--border-strong); margin-bottom: var(--gap-block); background: var(--bg); min-height: 150px; }
.theme-preview-side { background: var(--sidebar); color: var(--sidebar-strong); padding: var(--s3); display: grid; gap: var(--s2); align-content: start; }
.theme-preview-nav { color: var(--sidebar-text); padding: var(--s1) var(--s2); }
.theme-preview-nav.active { background: var(--sidebar-active); color: var(--sidebar-strong); }
.theme-preview-main { padding: var(--s4); }
@media (max-width: 1079px) { .theme-preview { grid-template-columns: 1fr; } }

/* Dienstplan: Zelle je Gruppe und Tag mit Besetzung und Schichten als Knöpfe (pages/roster.js) */
.roster-cell { display: grid; gap: var(--s1); min-width: 120px; justify-items: start; }
.roster-state { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.roster-chip { display: grid; justify-items: start; text-align: left; width: 100%; padding: var(--s1) var(--s2); height: auto; min-height: 0; line-height: 1.25; border: 1px solid var(--border-strong); border-left: 3px solid var(--primary); background: var(--surface); font-size: var(--fs-sm); font-weight: 400; }
.roster-chip small { color: var(--muted); font-size: var(--fs-xs); }
.roster-chip.other { border-left-color: var(--accent); }
.roster-chip.absent { border-left-color: var(--danger); background: var(--danger-soft); text-decoration: line-through; }
.roster-chip:disabled { opacity: 1; cursor: default; }

/* ---------- Assistent (pages/chat.js): Aufbau wie der Chat (.messenger-page), Roboter als Bild, Werkzeugaufrufe aufklappbar ---------- */
.ai-avatar { background: var(--sidebar); color: #fff; }
.msg-layout.single { grid-template-columns: minmax(0, 1fr); }
.assistant-page .msg-chats a { position: relative; }
.assistant-page .ai-del { opacity: 0; }
.assistant-page .msg-chats a:hover .ai-del, .assistant-page .ai-del:focus-visible { opacity: 1; }
@media (hover: none) { .assistant-page .ai-del { opacity: 0.6; } }
.ai-head-btn { margin-left: auto; }
.ai-scroll { gap: var(--s2); }
.ai-row { display: flex; align-items: flex-start; gap: var(--s3); align-self: stretch; }
.ai-row .msg-avatar { margin-top: var(--s2); }
.ai-msg { max-width: min(100%, 820px); min-width: 0; flex: 0 1 auto; display: flex; flex-direction: column; gap: var(--s2); padding: 8px 12px; }
.msg.mine { max-width: min(80%, 640px); }
.ai-text > :first-child { margin-top: 0; }
.ai-text > :last-child { margin-bottom: 0; }
.ai-typing { display: inline-flex; align-items: center; gap: var(--s2); color: var(--msg-muted); font-size: var(--fs-sm); }
.ai-tools { display: flex; flex-direction: column; gap: 4px; }
.ai-tool { border: 1px solid var(--msg-line); border-radius: 6px; background: #f7f8fa; font-size: var(--fs-sm); }
.ai-tool.failed { border-color: #f3c5c0; background: #fdf3f2; }
.ai-tool summary { display: flex; align-items: center; gap: var(--s2); padding: 6px 10px; cursor: pointer; list-style: none; min-width: 0; }
.ai-tool summary::-webkit-details-marker { display: none; }
.ai-tool summary::after { content: "▸"; margin-left: auto; color: var(--msg-muted); transition: transform 0.12s; }
.ai-tool[open] summary::after { transform: rotate(90deg); }
.ai-tool-state { display: inline-flex; color: var(--msg-green); }
.ai-tool.failed .ai-tool-state { color: var(--danger); }
.ai-tool-name { font-weight: 600; white-space: nowrap; }
.ai-tool-sum { min-width: 0; color: var(--msg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-tool-body { padding: 0 10px 10px; }
.ai-tool-label { margin: var(--s2) 0 4px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--msg-muted); }
.ai-tool-label code { text-transform: none; letter-spacing: 0; font-weight: 500; }
.ai-tool pre, .ai-approval-call pre { color: var(--msg-ink); margin: 0; max-height: 260px; overflow: auto; padding: var(--s2); background: #fff; border: 1px solid var(--msg-line); border-radius: 4px; font-size: 12px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-card { border: 1px solid var(--msg-line); border-left: 3px solid var(--primary); border-radius: 6px; background: #fff; padding: var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
.ai-card p { margin: 0; }
/* Recherche: bereinigte Suchanfrage in der Freigabe, Quellen unter der Antwort (Fachindex und Websuche einheitlich) */
.ai-query { color: var(--msg-ink); padding: var(--s2) var(--s3); background: #f7f8fa; border: 1px solid var(--msg-line); border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; }
.ai-sources { margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--msg-line); }
.ai-sources-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--msg-muted); margin-bottom: var(--s1); }
.ai-sources-title .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.ai-sources ol { margin: 0; padding-left: 1.4em; display: grid; gap: var(--s2); font-size: var(--fs-sm); }
.ai-source a { font-weight: 600; overflow-wrap: anywhere; }
.ai-source-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 2px; font-size: var(--fs-xs); color: var(--msg-muted); }
.ai-card-title { display: inline-flex; align-items: center; gap: var(--s1); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--primary); }
.ai-card.approval { border-left-color: var(--warning, #b7791f); }
.ai-card.approval .ai-card-title { color: var(--warning, #b7791f); }
.ai-card.approved { border-left-color: var(--msg-green); }
.ai-card.rejected { border-left-color: var(--msg-muted); }
.ai-card .hint { color: var(--msg-muted); font-size: var(--fs-sm); display: inline-flex; align-items: center; gap: 4px; }
.ai-approval-call { display: flex; flex-direction: column; gap: 4px; }
.ai-options, .ai-suggest { display: flex; flex-direction: column; gap: var(--s2); }
.ai-suggest { margin-top: var(--s4); align-items: stretch; }
.ai-option { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; height: auto; padding: var(--s2) var(--s3); text-align: left; white-space: normal; border: 1px solid var(--msg-line); border-radius: 8px; background: #fff; color: var(--msg-ink); cursor: pointer; }
label.ai-option { flex-direction: row; align-items: flex-start; gap: var(--s2); }
label.ai-option > span { display: flex; flex-direction: column; }
.ai-option:hover:not(:disabled) { border-color: var(--msg-green); background: #f3fbf8; }
.ai-option.chosen { border-color: var(--msg-green); box-shadow: inset 3px 0 0 var(--msg-green); }
.ai-option .hint { font-size: var(--fs-xs); color: var(--msg-muted); font-weight: 400; }
.ai-welcome .msg-avatar { width: 64px; height: 64px; }
.ai-stop { background: var(--danger); }
.ai-stop:hover { background: #961c13; }
@media (max-width: 1079px) {
  .ai-row { gap: var(--s2); }
  .ai-row .msg-avatar { display: none; }
  .ai-msg { max-width: 100%; }
}

/* Ops Center → Wissen und Suche: Einrichtungsliste und Erklärungen */
.kb-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gap-text); }
.kb-check { display: block; }
.kb-check .muted { margin-top: 2px; }
.kb-help { font-size: var(--fs-sm); }
.kb-help > :last-child { margin-bottom: 0; }
.kb-help ol, .kb-help ul { padding-left: 1.4em; display: grid; gap: 4px; }
/* Liste ohne Punkte (z. B. Prüfergebnisse je Zeile mit Badge) */
.plain-list { list-style: none; padding: 0; margin: 0 0 var(--gap-block); display: grid; gap: var(--s1); }
/* Belegungsplan: Räume bzw. Fahrzeuge zum An- und Abwählen (farbige Marke mit Haken) */
.plan-pick label.tag { display: inline-flex; align-items: center; gap: var(--s1); cursor: pointer; }
.plan-pick label.tag input { width: auto; min-height: 0; height: auto; margin: 0; }
/* Marke einer Sprache (Flagge und Kürzel), z. B. an Dokumenten */
.lang-tag { display: inline-flex; align-items: center; gap: var(--s1); }
.lang-tag svg { width: 18px; height: 12px; flex: none; }
/* Fotos als Vorschau mit Entfernen-Kreuz (z. B. am Vorfall) */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: var(--s2); }
.photo-thumb { position: relative; margin: 0; aspect-ratio: 1; border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .photo-remove { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; min-height: 0; padding: 0; border: 0; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
/* Kontakt: Stammdaten links, Foto rechts (schmal darüber). Das Bild ist Ablagefläche: hineinziehen oder anklicken. */
.person-master { display: flex; gap: var(--gap-section); align-items: flex-start; }
.person-data { flex: 1 1 auto; min-width: 0; }
.person-photo { flex: 0 0 180px; display: grid; gap: var(--gap-inline); justify-items: center; }
.photo-drop { position: relative; width: 180px; aspect-ratio: 4 / 5; border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-drop .person-photo-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 3rem; font-weight: 700; color: var(--muted); }
.photo-drop.can-drop { cursor: pointer; }
.photo-drop.can-drop:hover, .photo-drop.can-drop:focus-visible, .photo-drop.over { border-color: var(--primary); outline: 2px dashed var(--primary); outline-offset: -4px; }
.photo-drop-hint { position: absolute; left: 0; right: 0; bottom: 0; padding: var(--s1) var(--s2); display: flex; align-items: center; justify-content: center; gap: var(--s1); font-size: var(--fs-xs); background: rgba(0, 0, 0, 0.62); color: #fff; opacity: 0; transition: opacity 0.12s; }
.photo-drop:not(:has(img)) .photo-drop-hint, .photo-drop.can-drop:hover .photo-drop-hint, .photo-drop.can-drop:focus-visible .photo-drop-hint, .photo-drop.over .photo-drop-hint { opacity: 1; }
.photo-drop .photo-trash { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; min-height: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; background: rgba(0, 0, 0, 0.62); color: #fff; cursor: pointer; }
.photo-drop .photo-trash:hover { background: var(--danger); }
.photo-drop.busy { opacity: 0.5; pointer-events: none; }
@media (max-width: 1079px) { .person-master { flex-direction: column-reverse; } .person-photo { flex-basis: auto; width: 100%; } }
/* kleines Vorschaubild eines Kontakts in Listen */
.avatar-sm { width: 28px; height: 35px; object-fit: cover; flex: none; border: 1px solid var(--border); vertical-align: middle; margin-right: var(--s2); }
/* Wochenauswahl (Speiseplan, Dienstplan): Abstand zur Karte darunter */
.week-bar { margin-bottom: var(--gap-block); }
/* Logo einer Firma an der Stelle des Fotos: ganzes Bild auf Weiß, nichts abgeschnitten */
.person-photo.is-logo .photo-drop { aspect-ratio: 1 / 1; background: #fff; }
.person-photo.is-logo .photo-drop img { object-fit: contain; padding: var(--s3); box-sizing: border-box; }
.avatar-sm.is-logo { width: 35px; object-fit: contain; background: #fff; }

/* ==========================================================================================================
   Feinschliff (23.11.2026): moderner, ohne das eckige, flache Grundgerüst aufzugeben. Alles hängt an --primary
   (color-mix), folgt also dem Farbthema des Vereins. Abschalten = diesen Block entfernen.
   - Boxen schweben leicht: weicher Schatten in der Hauptfarbe statt harter Rahmen
   - anklickbare Flächen reagieren (heben sich, Schatten wird kräftiger)
   - Hauptknopf mit leichtem Schein, weichere Übergänge überall
   - Dialoge vor unscharfem Hintergrund
   ========================================================================================================== */
:root {
  --glow: color-mix(in srgb, var(--primary) 22%, transparent);
  --glow-strong: color-mix(in srgb, var(--primary) 34%, transparent);
  --shadow-box: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 28px -14px var(--glow);
  --shadow-box-hover: 0 2px 4px rgba(16, 24, 40, .06), 0 16px 36px -14px var(--glow-strong);
  --border: color-mix(in srgb, var(--primary) 7%, #e3e5e8);
  --focus: 0 0 0 3px color-mix(in srgb, var(--primary) 26%, transparent);
}
/* ganz leichter Farbschimmer oben im Hintergrund: die Fläche wirkt nicht mehr grau und tot */
body { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 5%, var(--bg)) 0, var(--bg) 420px) no-repeat var(--bg); }
.card, .tile, .table-wrap, .week-cal, .month-cal, .accordion { box-shadow: var(--shadow-box); }
/* Kopf der Karte: weiß mit feiner Linie statt grauer Leiste, der Titel trägt die Farbe */
.card-header { background: var(--surface); }
.card-title { letter-spacing: -0.005em; }
.tile { transition: transform .14s ease, box-shadow .14s ease, background .12s; }
a.tile.tile-link:hover { background: var(--surface); transform: translateY(-2px); box-shadow: var(--shadow-box-hover); }
/* Knöpfe: weicher Übergang, der Hauptknopf leuchtet leicht in seiner Farbe */
button { transition: background .12s ease, border-color .12s ease, box-shadow .14s ease, transform .08s ease; }
button.primary { box-shadow: 0 6px 16px -8px var(--glow-strong); }
button.primary:hover:not(:disabled) { box-shadow: 0 8px 20px -8px var(--glow-strong); }
/* kein Eindrück-Effekt per transform: Knöpfe, die selbst über transform sitzen (das Schließen-Kreuz im Dialog: translateY(-50%)),
   sprangen beim Drücken unter dem Mauszeiger weg, und der Klick kam nicht an (Fehler vom 23.11.2026) */
button:active:not(:disabled) { filter: brightness(0.96); }
/* Eingabefelder: beim Anklicken ein weicher Schein statt eines harten Rings */
.field input:not([type=checkbox]):not([type=radio]), .field textarea, .field select { transition: border-color .12s ease, box-shadow .14s ease; }
/* Tabellenzeilen: beim Überfahren ein Hauch der Hauptfarbe */
tbody tr:hover td { background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
/* Dialog: Hintergrund wird unscharf, der Dialog hebt sich mit farbigem Schatten ab und blendet weich ein */
dialog { box-shadow: 0 24px 64px -16px rgba(0, 0, 0, .38), 0 0 0 1px color-mix(in srgb, var(--primary) 10%, transparent); }
dialog::backdrop { background: color-mix(in srgb, var(--primary) 12%, rgba(20, 20, 24, .5)); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
dialog[open]:not(.offline-screen) { animation: dialog-in .16s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px); } }
/* Seitenleiste: der aktive Punkt bekommt einen leichten Verlauf, Einträge wechseln weich */
.sidebar nav a { transition: background .12s ease, color .12s ease; }
/* Seitentitel etwas kräftiger gesetzt */
.page-title h1 { letter-spacing: -0.015em; }
/* Hinweise und Badges: unverändert eckig, Hinweise mit demselben weichen Schatten */
.alert { box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
@media (prefers-reduced-motion: reduce) { .tile, button, dialog[open] { transition: none; animation: none; } }

/* ---------- Feinschliff 2: eigene Schrift und Zeichnungen für leere Zustände ----------
   Figtree (Text) und Bricolage Grotesque (Seitentitel, große Zahlen), beide OFL, vom eigenen Server (web/fonts, wie auf der
   Homepage); nichts wird von außen geladen. Nur lateinische Zeichen: andere Schriften fallen auf die des Geräts zurück. */
@font-face { font-family: "Figtree"; src: url("fonts/figtree-latin-wght-normal.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
:root { font-family: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --font-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif; }
.page-title h1, .tile .value, dialog h2, .empty-title, .login-card h1 { font-family: var(--font-display); }
.tile .value { font-weight: 650; letter-spacing: -0.02em; }
/* Zahlen in Tabellen stehen sauber untereinander */
table { font-variant-numeric: tabular-nums; }
.empty-icon { color: var(--primary); margin-bottom: var(--s3); }
.empty-art { display: block; margin: 0 auto; }
.empty-art .fill { fill: var(--primary-soft); stroke: none; }
.empty-art .accent { stroke: var(--accent); }
.empty-title { font-size: var(--fs-lg, 1.1rem); }
/* Eigenes Logo des Vereins: nie mit der Farbfläche des Kürzel-Quadrats hinterlegen (auch nicht auf Anmelde- und Erlaubnisseite,
   deren Regeln sonst spezifischer wären): ein außen durchsichtiges Logo bleibt durchsichtig. */
.brand-mark.brand-logo, .login h1 .brand-mark.brand-logo, .consent .card-title .brand-mark.brand-logo, .sidebar .brand-mark.brand-logo, .topbar .brand-mark.brand-logo { background: transparent; }

/* Kacheln in fester Aufteilung (Auswertungen): cols-4 = vier je Reihe, cols-3 = drei; schmal zwei, am Handy eine */
.tiles.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1279px) { .tiles.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1079px) { .tiles.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tiles.cols-4, .tiles.cols-3 { grid-template-columns: minmax(0, 1fr); } }

/* Kleine Aufklappzeile in Tabellenzellen (z. B. „5 Posten“ bei „Verrechnet mit“): Pfeil dreht sich beim Öffnen */
details.fold > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: var(--s1); color: var(--primary); font-weight: 600; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .12s ease; }
details.fold[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
details.fold[open] > summary { margin-bottom: var(--s1); }
/* Zähler an Chat und Glocke: Fläche in der Schriftfarbe der Leiste, Zahl in deren Hintergrundfarbe. So ist er bei jedem Farbthema
   sichtbar (vorher Akzentfarbe: gleicht sie der Leiste, verschwand er). */
.bell-count { background: var(--sidebar-strong); color: var(--sidebar); }

/* Zwischenüberschrift mit Knöpfen rechts (Abschnitt innerhalb einer Seite, z. B. Zahlläufe in der Monatsabrechnung) */
.section-head { justify-content: space-between; align-items: center; margin: var(--gap-section) 0 var(--gap-block); }
.section-head h2 { margin: 0; }

/* Tagesansicht der Gruppe: noch nicht gekommen = grauer Balken (grün = da, gelb = abwesend gemeldet) */
.care-child { border-left-color: var(--border-strong); }
.care-child.here { border-left-color: var(--success); }
.care-child.away { border-left-color: var(--warning); }

/* Tagesansicht: Knöpfe in festen Spalten, damit derselbe Knopf in jeder Zeile an derselben Stelle steht; ein fehlender lässt seinen Platz frei */
.care-child-actions { display: grid; grid-template-columns: repeat(5, 132px); gap: var(--gap-inline); flex: none; }
.care-child-actions[data-cols="4"] { grid-template-columns: repeat(4, 132px); }
.care-child-actions[data-cols="3"] { grid-template-columns: repeat(3, 132px); }
.care-child-actions[data-cols="2"] { grid-template-columns: repeat(2, 132px); }
.care-child-actions[data-cols="1"] { grid-template-columns: 132px; }
.care-slot { display: flex; min-height: 44px; }
.care-slot > button { width: 100%; min-width: 0; white-space: nowrap; }
@media (max-width: 1279px) { .care-child-actions, .care-child-actions[data-cols] { width: 100%; grid-template-columns: repeat(var(--care-cols, 5), minmax(0, 1fr)); } .care-child-actions[data-cols="4"] { --care-cols: 4; } .care-child-actions[data-cols="3"] { --care-cols: 3; } .care-child-actions[data-cols="2"] { --care-cols: 2; } .care-child-actions[data-cols="1"] { --care-cols: 1; } }
@media (max-width: 640px) { .care-child-actions, .care-child-actions[data-cols] { grid-template-columns: repeat(3, minmax(0, 1fr)); } .care-slot:empty { display: none; } }

/* Seitenkopf eingeklappt: Symbol-Knöpfe mit data-keep (Verlauf, Archivieren) bleiben rechts neben dem ⋮ stehen */
.page-menu { display: flex; align-items: center; gap: var(--gap-inline); }
.page-menu[hidden] { display: none; }

/* Karte, die nur eine Tabelle enthält: die Tabelle füllt die Karte bis an den Rand (kein Rahmen im Rahmen). Gilt auch, wenn
   die Tabelle allein in einem Hüll-Element steht. Steht noch etwas daneben (Text, Suche, Knöpfe), bleibt alles wie bisher. */
.card-body:has(> .table-wrap:only-child), .card-body:has(> div:only-child > .table-wrap:only-child) { padding: 0; }
.card-body > .table-wrap:only-child, .card-body > div:only-child > .table-wrap:only-child { border: 0; margin: 0; box-shadow: none; }
/* … und ihre erste und letzte Spalte fluchten mit dem Titel der Karte */
.card-body > .table-wrap:only-child :is(th, td):first-child, .card-body > div:only-child > .table-wrap:only-child :is(th, td):first-child { padding-left: var(--s5); }
.card-body > .table-wrap:only-child :is(th, td):last-child, .card-body > div:only-child > .table-wrap:only-child :is(th, td):last-child { padding-right: var(--s5); }

/* Tabelle am Ende einer Karte (davor steht nur Text, eine Suche o. Ä.): sie läuft bis an den Rand der Karte, ohne eigenen
   Rahmen an den Seiten und unten (kein Rahmen im Rahmen). Auch wenn sie allein in einem Hüll-Element am Ende steht. */
.card-body > .table-wrap:last-child:not(:only-child), .card-body > div:last-child:not(:only-child) > .table-wrap:only-child {
  margin: 0 calc(-1 * var(--pad-box)) calc(-1 * var(--pad-box)); border-left: 0; border-right: 0; border-bottom: 0; box-shadow: none;
}
.card-body > .table-wrap:last-child:not(:only-child) :is(th, td):first-child, .card-body > div:last-child:not(:only-child) > .table-wrap:only-child :is(th, td):first-child { padding-left: var(--s5); }
.card-body > .table-wrap:last-child:not(:only-child) :is(th, td):last-child, .card-body > div:last-child:not(:only-child) > .table-wrap:only-child :is(th, td):last-child { padding-right: var(--s5); }

/* Tagesansicht: feste Plätze als Reihe; Text-Knöpfe 132 px, Symbol-Knöpfe (Notiz, Chat) 44 px */
.care-child-actions, .care-child-actions[data-cols] { display: flex; flex-wrap: nowrap; grid-template-columns: none; width: auto; gap: var(--gap-inline); }
.care-slot { flex: 0 0 132px; }
.care-slot.icon { flex: 0 0 44px; }
.care-slot.icon > button { min-width: 0; padding: 0; }
@media (max-width: 1279px) { .care-child-actions, .care-child-actions[data-cols] { width: 100%; } .care-slot { flex: 1 1 0; min-width: 0; } .care-slot.icon { flex: 0 0 44px; } }
@media (max-width: 640px) { .care-child-actions, .care-child-actions[data-cols] { flex-wrap: wrap; } .care-slot { flex: 1 1 30%; } .care-slot:empty { display: none; } }

/* Schmale Filterzeile über einer Auswertung (Stichtag, Jahr): kleines Feld, „Anzeigen“ direkt daneben auf gleicher Höhe,
   weitere Knöpfe (Export) rechtsbündig über .push. Erklärungen stehen als .filter-hint darunter, nicht als Hilfe am Feld. */
.filter-bar { display: flex; align-items: flex-end; gap: var(--gap-inline); flex-wrap: wrap; margin-bottom: var(--s2); }
.filter-bar .field { flex: 0 0 190px; margin-bottom: 0; }
.filter-bar .field .field-error:empty { display: none; }
.filter-bar .push { margin-left: auto; display: inline-flex; gap: var(--gap-inline); }
.filter-hint { margin: 0 0 var(--gap-block); }

/* Tabelle am Ende einer Karte: nach oben hält sie Abstand zu dem, was davor steht (Balken, Text, Suche) */
.card-body > .table-wrap:last-child:not(:only-child), .card-body > div:last-child:not(:only-child) > .table-wrap:only-child { margin-top: var(--pad-box); }
/* Filterzeile mit Hinweis: darunter ein Abschnittsabstand zur Tabelle bzw. Karte */
.filter-hint { margin-bottom: var(--gap-section); }
.filter-bar:not(:has(+ .filter-hint)) { margin-bottom: var(--gap-section); }

/* Rahmen mit Überschrift (fieldset): oben und unten derselbe Innenabstand, auch wenn Haken darin stehen */
.frame { padding: var(--s1) var(--s4) var(--s3); }
.frame > :first-child:not(legend), .frame > legend + * { margin-top: 0; }
.frame > :last-child { margin-bottom: 0; }
.frame .check-grid .check { margin: var(--s1) 0; }

/* Team-Seite der Website: eine Zeile je Quelle */
.team-source { margin-bottom: var(--gap-inline); flex-wrap: wrap; }
.team-source select { min-width: 0; flex: 1 1 200px; }

/* Suche über alle Bereiche: je Bereich eine Spalte (so viele nebeneinander, wie hineinpassen) */
.search-results.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--gap-block) var(--gap-section); align-items: start; max-height: 62vh; }
.search-results .search-col { min-width: 0; }
.search-results .search-col h4 { margin-top: 0; padding-bottom: var(--s1); border-bottom: 2px solid var(--primary); display: flex; justify-content: space-between; align-items: baseline; }
.search-results .search-count { color: var(--muted); font-weight: 400; }
.search-results .search-hit strong, .search-results .search-hit .hint { overflow-wrap: anywhere; }

/* ---------- Mobil-Korrekturen (24.11.2026) ---------- */
/* Wochenkalender: schmal als Liste je Tag statt Stundenraster (wie die Terminübersicht in Kalender-Apps) */
.week-cal-wrap { container-type: inline-size; margin-bottom: var(--gap-block); }
.week-cal-wrap > .week-cal { margin-bottom: 0; }
.cal-agenda { display: none; border: 1px solid var(--border); background: var(--surface); }
.cal-agenda-day { padding: var(--s3) var(--s4); border-top: 1px solid var(--border); }
.cal-agenda-day:first-child { border-top: 0; }
.cal-agenda-day.today { background: color-mix(in srgb, var(--primary-soft) 45%, transparent); }
.cal-agenda-day h4 { margin: 0 0 var(--s2); font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); display: flex; gap: var(--s2); align-items: baseline; }
.cal-agenda-day h4 .cal-agenda-date { color: var(--text-strong); font-size: var(--fs-md); letter-spacing: 0; }
.cal-agenda-day.none { padding-block: var(--s2); }
.cal-agenda-day.none h4 { margin: 0; display: inline-flex; }
.cal-agenda-day.none p { display: inline; margin: 0 0 0 var(--s2); }
.cal-agenda ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.cal-agenda-item { display: grid; grid-template-columns: 6.2em minmax(0, 1fr); gap: var(--s3); padding: var(--s2) var(--s3); border: 1px solid; border-left-width: 4px; min-height: 44px; align-items: center; }
.cal-agenda-item[data-block] { cursor: pointer; }
.cal-agenda-time { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; color: var(--text); }
.cal-agenda-main { display: grid; min-width: 0; }
.cal-agenda .cal-block-label { font-weight: 600; overflow-wrap: anywhere; color: var(--text-strong); }
.cal-agenda .cal-block-hint { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.cal-agenda .cal-c1, .cal-agenda .cal-c2, .cal-agenda .cal-c3, .cal-agenda .cal-c4, .cal-agenda .cal-c5, .cal-agenda .cal-c6, .cal-agenda .cal-c7, .cal-agenda .cal-c8 { background: color-mix(in srgb, var(--cal-color) 12%, var(--surface)); border-color: color-mix(in srgb, var(--cal-color) 45%, var(--surface)); border-left-color: var(--cal-color); }
.cal-agenda .cal-c1 { --cal-color: var(--cal-1); } .cal-agenda .cal-c2 { --cal-color: var(--cal-2); } .cal-agenda .cal-c3 { --cal-color: var(--cal-3); } .cal-agenda .cal-c4 { --cal-color: var(--cal-4); }
.cal-agenda .cal-c5 { --cal-color: var(--cal-5); } .cal-agenda .cal-c6 { --cal-color: var(--cal-6); } .cal-agenda .cal-c7 { --cal-color: var(--cal-7); } .cal-agenda .cal-c8 { --cal-color: var(--cal-8); }
.cal-agenda .cal-muted { background: var(--surface-3); border-color: var(--border-strong); border-left-color: var(--muted); }
.cal-agenda .cal-off .cal-block-label { text-decoration: line-through; }
@container (max-width: 640px) {
  .week-cal-wrap > .week-cal { display: none; }
  .week-cal-wrap > .cal-agenda { display: block; }
}
/* Gestapelte Tabellen: lange Wörter (E-Mail-Adressen) brechen um statt aus der Karte zu laufen */
.table-wrap.stacked td, .table-wrap.stacked td .cell { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
@media (max-width: 1079px) {
  /* Dashboard: das Schwarze Brett oben hält denselben Abstand zur nächsten Karte wie die Karten untereinander */
  .dash-right { margin-bottom: var(--gap-block); }
  /* Listen mit Aktionen (Speiseplan): Titel über die ganze Zeile, Aktionen darunter; Knöpfe mit Symbol zeigen nur das Symbol */
  .meal-item .news-item-head { flex-wrap: wrap; }
  .meal-item .news-item-title { flex: 1 1 100%; }
  .meal-item .card-actions { flex-wrap: wrap; }
  button.label-wide > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  button.label-wide { padding-inline: 0; width: var(--control-h); justify-content: center; }
}
.dash-news-group + .dash-news-group { margin-top: var(--gap-block); }

/* Säulendiagramm (UI.columnChart): Verlauf mit gestapelten Säulen */
.col-chart { margin-bottom: var(--gap-block); }
.col-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--gap-inline); flex-wrap: wrap; margin-bottom: var(--s2); }
.col-legend { display: inline-flex; gap: var(--gap-block); font-size: var(--fs-sm); }
.col-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; }
.col-plot { display: flex; align-items: stretch; gap: 2px; height: 220px; border-bottom: 1px solid var(--border-strong); }
.col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.col-bar { flex: 1; display: flex; align-items: flex-end; }
.col-stack { width: 100%; display: flex; flex-direction: column-reverse; min-height: 0; gap: 1px; }
.col:hover .col-stack { filter: brightness(1.12); }
.col-seg { display: block; min-height: 1px; }
.col-label { height: 0; overflow: visible; font-size: var(--fs-xs); color: var(--muted); text-align: center; white-space: nowrap; transform: translateY(6px); }
.col-chart .col-plot { margin-bottom: 26px; }
.col-primary { background: var(--primary); } .col-accent { background: var(--accent); } .col-success { background: var(--success); } .col-warning { background: var(--warning); } .col-neutral { background: var(--muted); }

/* Kartenkopf am Handy: stehen dort mehr als zwei Dinge (Marken und Knöpfe), bekommen sie eine eigene Zeile unter dem
   Titel, statt sich in einer schmalen Spalte daneben zu stapeln (Tagesansicht der Gruppe, Speiseplan) */
@media (max-width: 1079px) {
  .card-header { flex-wrap: wrap; }
  .card-header > .card-actions { flex-wrap: wrap; row-gap: var(--s2); }
  .card-header > .card-actions:has(> :nth-child(3)), .card-header > .card-actions:has(> .row > :nth-child(3)) { flex: 1 1 100%; }
  .card-header > .card-actions > .row { flex-wrap: wrap; row-gap: var(--s2); }
}

/* Tagesansicht: die Plätze der Knöpfe haben eine feste Breite (width statt flex-basis). Mit flex-basis rechnete der Browser
   die Breite der Knopfleiste aus dem Inhalt: fehlte ein Knopf (Kind noch nicht da), galt die Leiste als schmaler, blieb
   neben dem Namen stehen und ragte dann rechts aus der Karte. */
.care-slot { flex: 0 0 auto; width: 132px; }
.care-slot.icon { flex: 0 0 auto; width: 44px; }
.care-slot > button { width: 100%; }
@media (max-width: 1279px) { .care-slot { flex: 1 1 0; width: auto; min-width: 0; } .care-slot.icon { flex: 0 0 44px; width: 44px; } }
@media (max-width: 640px) { .care-slot { flex: 1 1 30%; width: auto; } .care-slot.icon { flex: 0 0 44px; } .care-child-actions button { min-width: 0; padding-inline: var(--s2); } }

/* Assistent ohne Gesprächsliste (noch nicht eingerichtet, .msg-layout.single): am Handy blieb die Seite leer, weil dort ohne
   offenes Gespräch nur die Liste gezeigt wird, die es in diesem Aufbau nicht gibt */
@media (max-width: 1079px) { .msg-layout.single:not(.open) .msg-thread { display: flex; } }

/* Links als Knopf in der Hauptfarbe (z. B. der gewählte Zeitraum einer Auswertung): wie button.primary */
a.btn.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
a.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

/* Wochenkalender ohne Klick an den Einträgen (UI.weekCalendar({ clickable: false })): kein Zeiger */
.cal-static .cal-block[data-block], .cal-static .cal-agenda-item[data-block] { cursor: default; }

/* Tagesansicht: lange Hinweise am Kind (Unverträglichkeiten, Mitteilungen) brechen um, statt am Handy über den Rand zu laufen */
.care-child-main .row { flex-wrap: wrap; min-width: 0; }
.care-child-main .badge { white-space: normal; height: auto; min-height: 22px; max-width: 100%; text-align: left; overflow-wrap: anywhere; line-height: 1.3; padding-block: 3px; }

/* Gestapelte Tabellen (am Handy als Karten): lange Marken brechen um, statt über den Rand zu laufen */
.table-wrap.stacked .cell .badge { white-space: normal; height: auto; max-width: 100%; text-align: left; overflow-wrap: anywhere; line-height: 1.3; padding-block: 3px; }

/* Lange Zeichenketten ohne Leerzeichen (E-Mail-Adressen, Kennungen) dürfen an jeder Stelle umbrechen: in Tabellen zählt ihre
   volle Länge sonst als Mindestbreite der Spalte, und die Tabelle wird früher als nötig zu Karten gestapelt */
.break-any { overflow-wrap: anywhere; }

/* Umrandete Marke: eine zweite Art von Zuordnung neben den gefüllten Marken (Kontaktliste: Sponsorengruppen unter den Rollen) */
.tag.tag-outline { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text); }
a.tag.tag-outline:hover { background: var(--surface-2); }

/* ---------- Support (pages/support.js): Antwort des Assistenten und Verlauf einer Anfrage ---------- */
.support-wait { padding: var(--gap-section) 0; }
.support-answer { border: 1px solid var(--border); border-left: 3px solid var(--primary); background: var(--surface-2); padding: var(--pad-box); margin-bottom: var(--gap-block); }
.support-answer > :last-child { margin-bottom: 0; }
.support-who { display: flex; gap: var(--gap-inline); align-items: center; margin-bottom: var(--gap-text); }
.support-who .muted { margin-left: auto; }
.support-thread { display: grid; gap: var(--gap-block); }
.support-msg { border: 1px solid var(--border); background: var(--surface); padding: var(--pad-box); box-shadow: var(--shadow-box); max-width: 860px; }
.support-msg > :last-child { margin-bottom: 0; }
.support-msg.kunde { justify-self: end; background: var(--primary-soft); }
.support-msg.support { border-left: 3px solid var(--primary); }
.support-msg.ki { border-left: 3px solid var(--border-strong, var(--border)); background: var(--surface-2); }
.support-thread { margin-bottom: var(--gap-block); }
/* Knöpfe im Inhalt des Support-Dialogs: bewusst nicht .btn-row (das ist im Dialog die Fußzeile mit eigenem Hintergrund) */
.support-actions { display: flex; flex-wrap: wrap; gap: var(--gap-inline); margin-bottom: var(--gap-block); }
.support-badges, .support-charge { margin-bottom: var(--gap-block); }
/* KI-Support als Gespräch (pages/support.js): Verlauf mit eigener Höhe, darunter die Eingabe */
.support-chat { display: grid; gap: var(--gap-text); align-content: start; max-height: min(56vh, 620px); overflow-y: auto; padding: 2px 2px var(--gap-text); margin-bottom: var(--gap-block); }
.support-chat .support-msg { max-width: min(760px, 92%); box-shadow: none; padding: var(--gap-text) var(--gap-block); }
.support-chat .support-msg > :last-child, .support-chat .support-msg .no-i18n > :last-child { margin-bottom: 0; }
.support-ask .field { margin-bottom: var(--gap-text); }
.support-ask .support-actions { margin-bottom: 0; }
