/* ============================================================
   EINHEITLICHE CRM-OBERFLÄCHE
   Die bisherige Variante 2 ist die feste Grundlage der Verwaltung.
   Die Regeln gelten app-weit und ergänzen die gemeinsame style.css.
   ============================================================ */

body.ui-v2 {
  font-family: 'Inter', Arial, sans-serif;
  background: #f4f5f7;
  /* Sidebar/Topbar/Main-Content lesen alle dieselbe Variable
     (style.css: #sidebar width, #topbar left, #main-content
     margin-left) – hier überschreiben statt margin-left separat
     zu duplizieren hält alle drei automatisch synchron. */
  --sidebar-w: 250px;
}
body.ui-v2 #main-content { background: #f4f5f7; }

/* Sidebar-Labels: bei 250px passen die meisten Begriffe wieder
   vollständig; für sehr lange Einträge sauber mit Ellipsis
   abschneiden statt Buchstaben hart zu clippen. */
.ui-v2 .sidebar-link .link-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Sidebar ─────────────────────────────────────────────── */
/* Logo-Bereich (.sidebar-brand) bewusst NICHT überschrieben – das
   bestehende Logo/Sizing aus style.css funktioniert bereits und
   soll unverändert bleiben (kein neues Logo-Asset in v2). */
body.ui-v2 #sidebar { border-right: 1px solid #eee; }
body.ui-v2 .sidebar-nav { padding: 8px 16px; }
body.ui-v2 .sidebar-link {
  border-radius: 8px;
  border-left: none !important;
  padding: 5px 12px;
  margin-bottom: 2px;
  font-size: .88rem;
  color: #555;
}
body.ui-v2 .sidebar-link:hover { background: #eff1f3; color: #222; }
body.ui-v2 .sidebar-link.active,
body.ui-v2 .sidebar-link[aria-expanded="true"] {
  background: #e2ebf4 !important;
  color: #14436f !important;
  font-weight: 600;
}
body.ui-v2 .sidebar-link i { color: #1e5f9b; opacity: .8; }
body.ui-v2 .sidebar-link:hover i { opacity: 1; }
body.ui-v2 .sidebar-link.active i,
body.ui-v2 .sidebar-link[aria-expanded="true"] i { color: #14436f; opacity: 1; }
/* Alternative „Neutral“: dunkel im hellen Menü, hell im dunklen Menü. */
body.ui-v2.icons-neutral .sidebar-link i,
body.ui-v2.icons-neutral .sidebar-section-label i { color: #34383d !important; opacity: .88 !important; }
body.ui-v2.icons-neutral .sidebar-link:hover i,
body.ui-v2.icons-neutral .sidebar-link.active i,
body.ui-v2.icons-neutral .sidebar-link[aria-expanded="true"] i { color: #111418 !important; opacity: 1 !important; }
body.ui-v2 .sidebar-divider { margin: 8px 8px; }
body.ui-v2 .sidebar-submenu { background: transparent; }
body.ui-v2 .sidebar-user { padding: 14px 16px; border-top: 1px solid #f1f1f1; }
body.ui-v2 .nav-avatar { background: #12487a !important; color: #fff !important; }

/* ── Topbar ──────────────────────────────────────────────── */
body.ui-v2 #topbar { border-bottom: 1px solid #eee; box-shadow: none; background: #fff; }
body.ui-v2 .topbar-btn-neutral {
  background: #154a7c !important;
  color: #fff !important;
  border: none !important;
  border-radius: 8px;
}
body.ui-v2 .topbar-btn-neutral:hover { background: #0d3962 !important; }
body.ui-v2 .topbar-btn-primary {
  background: #154a7c !important;
  color: #fff !important;
  border-radius: 8px;
}
body.ui-v2 .topbar-search input {
  background: #eff1f3;
  border: none;
  border-radius: 8px;
}
body.ui-v2 .topbar-right .btn {
  border-radius: 50% !important;
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none !important;
  background: #eff1f3 !important;
  color: #555 !important;
}
body.ui-v2 .topbar-right .btn:hover { background: #e8e6e0 !important; }
body.ui-v2 .topbar-right .topbar-btn-help {
  background: #154a7c !important;
  color: #fff !important;
}
body.ui-v2 .topbar-right .topbar-btn-help:hover { background: #0d3962 !important; }

/* ── Karten (global – wirkt auf alle Module) ────────────────── */
body.ui-v2 .card-header { border-radius: 14px 14px 0 0 !important; }
body.ui-v2 .stat-card {
  border-radius: 10px !important;
  /* Ecken oben werden durch den Karten-border-radius automatisch
     mitgerundet (Browser rundet Ränder immer passend zum Radius) –
     dafür ist keine separate Regel nötig. Templates setzen inline nur
     style="border-color:#hex" (färbt alle Seiten) statt einer eigenen
     Property/Custom-Property – daher hier bewusst KEINE eigene
     border-top-color setzen, sonst überschreibt das die inline
     gesetzte Akzentfarbe. Dünner (3px statt 4px) wirkt dezenter als
     Kategorie-Markierung statt wie ein Rahmen. */
  border-left-width: 0 !important;
  border-top-width: 3px !important;
  border-top-style: solid !important;
}

/* Alle übrigen Boxen mit farbigem Rand links → oben (gleiche Stärke
   wie .stat-card, 3px). Diese Boxen setzen ihre Akzentfarbe als
   Inline-Style (Templates in dashboard.php, layout.php,
   customers/geburtstage.php, customers/view.php, einwilligung.php,
   tasks/view.php, protokolle/view.php, dashboard/widget_abstimmungen.php,
   calendar/index.php + belegung/index.php Modal-Header), da es dafür
   keine gemeinsame CSS-Klasse gibt. Templates wurden daher zusätzlich
   um eine Custom Property --box-accent (Kopie der jeweiligen Farbe)
   ergänzt; die Darstellung wird hier zentral vereinheitlicht.
   Bei den beiden Modal-Headern (calendar/belegung) wird --box-accent
   auch per JS mitgesetzt, wenn sich die Farbe dynamisch ändert. */
.ui-v2 [style*="--box-accent"] {
  border-left-width: 0 !important;
  border-top-width: 3px !important;
  border-top-style: solid !important;
  border-top-color: var(--box-accent) !important;
}

/* Hausfarbe der Schaltflaechen: #1e5f9b ergab mit weisser Schrift nur
   3,30:1. #154a7c ist optisch fast gleich und erreicht 4,87:1. */
body.ui-v2 .btn-rewa { background: #154a7c !important; }
body.ui-v2 .btn-rewa:hover { background: #0d3962 !important; }
body.ui-v2 .progress-bar { background: #1e5f9b !important; }
body.ui-v2 .page-title { border-left: none; padding-left: 0; }
body.ui-v2 .page-title-icon { font-size: 1em; color: #12487a; margin-right: .5rem; vertical-align: -0.08em; }
body.ui-v2 .form-control:focus, body.ui-v2 .form-select:focus {
  border-color: #1e5f9b;
  box-shadow: 0 0 0 .2rem rgba(110,155,30,.2);
}

/* Einheitliche Box-Kopfzeilen. Die höhere Spezifität neutralisiert
   alte seitenbezogene Grau-, Dunkel- und Inline-Farben zuverlässig. */
body.ui-v2 .card > .card-header {
  background: #ececea !important;
  color: #1f2430 !important;
  border-bottom: 1px solid #c9c5bd !important;
}
body.ui-v2 .card > .card-header span,
body.ui-v2 .card > .card-header strong,
body.ui-v2 .card > .card-header .fw-bold,
body.ui-v2 .card > .card-header i,
body.ui-v2 .card > .card-header a:not(.btn) { color: #1f2430 !important; }
body.ui-v2 .card > .card-header .badge { background: #154a7c !important; color: #fff !important; }
body.ui-v2 .card > .card-header .badge.bg-danger { background: #dc3545 !important; }
body.ui-v2 .card > .card-header .badge.bg-warning { background: #ffc107 !important; color: #212529 !important; }
body.ui-v2 .card > .card-header .badge.bg-success { background: #198754 !important; }
body.ui-v2 .card > .card-header .badge.bg-primary { background: #0d6efd !important; }
body.ui-v2 .card > .card-header .badge.bg-info { background: #0dcaf0 !important; color: #212529 !important; }
body.ui-v2 .card > .card-header .badge.bg-secondary { background: #6c757d !important; }
body.ui-v2 .card > .card-header .badge.bg-light,
body.ui-v2 .card > .card-header .badge.text-bg-light { background: #f8f9fa !important; color: #34383d !important; border: 1px solid #d6d3cc; }
body.ui-v2 .card > .card-header .btn-outline-secondary,
body.ui-v2 .card > .card-header .btn:not(.btn-outline-secondary) {
  color: #1f2430 !important;
  border-color: #c9c5bd !important;
  background: transparent !important;
}

/* Erinnerungen-Leiste (eigener Block ohne .card, siehe dashboard.php) */
body.ui-v2 .dash-band { background: #fff !important; box-shadow: 0 2px 10px rgba(0,0,0,.05) !important; }
body.ui-v2 .dash-band-title { background: #ececea !important; color: #3d3a2e !important; }
body.ui-v2 .dash-band-title i { color: #3d3a2e !important; }

/* Notizzettel (Sticky Notes) ──────────────────────────── */
body.ui-v2 .dash-note-card > div { border-radius: 10px !important; box-shadow: 0 2px 8px rgba(0,0,0,.06) !important; }
body.ui-v2 #note-add-box { border-radius: 10px !important; }

/* Karten */
.ui-v2 .card {
  border: none;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(16,24,40,0.06), 0 1px 2px rgba(16,24,40,0.04);
  overflow: hidden;
}
.ui-v2 .card > .card-header {
  font-weight: 600;
  padding: 16px 20px;
}
.ui-v2 .card.border-start {
  border-left: 4px solid #5a758f;
}

/* Überschriften */
.ui-v2 h1, .ui-v2 h2, .ui-v2 h3, .ui-v2 h4 {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #1f2430;
}

/* Buttons */
.ui-v2 .btn-success {
  /* Bleibt grün: Ein Erfolgsknopf, der blau ist, verliert seine Aussage.
     Umgestellt wurde nur die Hausfarbe (früher Oliv, jetzt Blau). */
  background: #198754;
  border-color: #198754;
  border-radius: 8px;
  box-shadow: none;
}
.ui-v2 .btn-danger {
  background: #fff;
  color: #d64545;
  border: 1px solid #f1c7c7;
}
.ui-v2 .btn-danger:hover {
  background: #d64545;
  color: #fff;
}
.ui-v2 .btn {
  border-radius: 8px;
}

/* Badges */
.ui-v2 .badge {
  border-radius: 6px;
  font-weight: 600;
  padding: 5px 10px;
}
/* Bootstrap setzt .bg-success mit !important. Ohne !important greift hier nur
   die Schriftfarbe -> dunkelgruen auf dunkelgruen (1,5:1, praktisch unlesbar).
   Mit !important entsteht das gewollte weiche Etikett: 5,6:1. */
.ui-v2 .badge.bg-success {
  background: #e3f3e1 !important;
  color: #2f6b28 !important;
}

/* Tabelle */
.ui-v2 table.table thead th {
  background: #fafbfc;
  color: #6b7280;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 1px solid #eef0f2;
  padding: 12px 16px;
}
.ui-v2 table.table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}
.ui-v2 table.table-hover tbody tr:hover {
  background-color: #f7f9fb;
}

/* Sidebar */
.ui-v2 #sidebar {
  background: #ffffff;
  border-right: 1px solid #eef0f2;
}
.ui-v2 .sidebar-section-label {
  color: #6f7681;   /* war #9aa1ab = 2,61:1 auf Weiss */
  font-size: 11px;
  letter-spacing: .08em;
  padding: 14px 16px 6px;
}
.ui-v2 .sidebar-item {
  margin: 0;
  padding: 0;
  color: #4b5563;
}
.ui-v2 .sidebar-item:hover {
  background: transparent;
}
.ui-v2 .sidebar-item.active {
  color: #284b6b;
  font-weight: 600;
}

/* Such-/Filterfelder */
.ui-v2 input.form-control, .ui-v2 select.form-select {
  border-radius: 8px;
  border: 1px solid #e2e5e9;
}

/* Tabs auf der Detailseite */
.ui-v2 .nav-tabs .nav-link {
  border: none;
  color: #6b7280;
}
.ui-v2 .nav-tabs .nav-link.active {
  border-bottom: 2px solid #3f5d7a;
  color: #1f2430;
  font-weight: 600;
}

/* --- FullCalendar Toolbar ───────────────────────────────
   !important nötig: FullCalendar lädt sein eigenes CSS über
   $pageExtraHead, das in layout.php NACH style-v2.css im <head>
   ausgegeben wird (siehe calendar/index.php) – bei gleicher
   Spezifität gewinnt sonst das später geladene FullCalendar-CSS. */
.ui-v2 .fc-toolbar { padding: 4px 4px 18px !important; }
.ui-v2 .fc-toolbar-title { font-weight: 700 !important; font-size: 1.15rem !important; color: #1f2430 !important; }
.ui-v2 .fc-button {
  background: #fff !important;
  border: 1px solid #e2e5e9 !important;
  color: #4b5563 !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  text-transform: capitalize !important;
  font-weight: 500 !important;
}
.ui-v2 .fc-button:hover { background: #f2f4f2 !important; }
.ui-v2 .fc-button-primary:not(:disabled).fc-button-active {
  background: #3f5d7a !important;
  border-color: #3f5d7a !important;
  color: #fff !important;
}
.ui-v2 .fc-today-button {
  background: #eef1ee !important;
  border-color: #eef1ee !important;
  color: #374151 !important;
}
.ui-v2 .fc-button-group .fc-button { border-radius: 0 !important; }
.ui-v2 .fc-button-group .fc-button:first-child { border-radius: 8px 0 0 8px !important; }
.ui-v2 .fc-button-group .fc-button:last-child { border-radius: 0 8px 8px 0 !important; }

/* --- Grid --- */
.ui-v2 .fc-theme-standard td, .ui-v2 .fc-theme-standard th {
  border-color: #f0f1f3 !important;
}
.ui-v2 .fc-col-header-cell {
  background: #fafbfc !important;
  padding: 8px 0 !important;
}
.ui-v2 .fc-col-header-cell-cushion {
  color: #9aa1ab !important;
  font-size: 11px !important;
  letter-spacing: .06em !important;
  text-transform: uppercase !important;
  font-weight: 600 !important;
  text-decoration: none !important;
}
.ui-v2 .fc-daygrid-day-number {
  color: #4b5563 !important;
  font-size: 13px !important;
  padding: 6px 8px !important;
  text-decoration: none !important;
}
.ui-v2 .fc-day-today {
  background: #f4f7fa !important;
}
.ui-v2 .fc-day-today .fc-daygrid-day-number {
  background: #3f5d7a !important;
  color: #fff !important;
  border-radius: 999px !important;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 4px;
  padding: 0 !important;
}

/* --- Events --- */
.ui-v2 .fc-event {
  border: none !important;
  border-radius: 6px !important;
  padding: 2px 6px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}
.ui-v2 .fc-daygrid-event-dot { display: none !important; }

/* ============================================================
   Kombination Dunkles Menü (body.theme-dark, siehe style.css)
   + einheitliche Oberfläche (body.ui-v2). Die Grundregeln gehen von
   einer hellen Sidebar aus und gewinnen gegen die
   gleich-spezifischen Dunkel-Regeln aus style.css allein durch die
   spätere Ladereihenfolge → dunkler Hintergrund + dunkle Schrift,
   praktisch unlesbar. Kombinierter Selektor mit beiden Klassen ist
   spezifischer als jede der beiden Einzelregeln und gewinnt sicher,
   unabhängig von künftigen Umsortierungen oben in dieser Datei. */
body.theme-dark.ui-v2 #sidebar { background: #3d3a2e !important; border-right-color: rgba(255,255,255,.1) !important; }
body.theme-dark.ui-v2 .sidebar-link { color: rgba(255,255,255,.75) !important; }
body.theme-dark.ui-v2 .sidebar-link:hover { background: rgba(255,255,255,.08) !important; color: #fff !important; }
body.theme-dark.ui-v2 .sidebar-link.active,
body.theme-dark.ui-v2 .sidebar-link[aria-expanded="true"] {
  background: rgba(255,255,255,.12) !important;
  color: #fff !important;
}
body.theme-dark.ui-v2 .sidebar-link i { color: var(--rewa-blau) !important; opacity: .9 !important; }
body.theme-dark.ui-v2.icons-neutral .sidebar-link i,
body.theme-dark.ui-v2.icons-neutral .sidebar-section-label i { color: rgba(255,255,255,.82) !important; opacity: 1 !important; }
body.theme-dark.ui-v2.icons-neutral .sidebar-link:hover i,
body.theme-dark.ui-v2.icons-neutral .sidebar-link.active i,
body.theme-dark.ui-v2.icons-neutral .sidebar-link[aria-expanded="true"] i { color: #fff !important; }
body.theme-dark.ui-v2 .sidebar-section-label { color: rgba(255,255,255,.55) !important; }
body.theme-dark.ui-v2 .sidebar-item { color: rgba(255,255,255,.75) !important; }
body.theme-dark.ui-v2 .sidebar-item:hover { background: rgba(255,255,255,.08) !important; }
body.theme-dark.ui-v2 .sidebar-item.active { background: rgba(255,255,255,.12) !important; color: #fff !important; }
body.theme-dark.ui-v2 .sidebar-user { border-top-color: rgba(255,255,255,.1) !important; }
body.theme-dark.ui-v2 .sidebar-user .user-info small { color: rgba(255,255,255,.5) !important; }
body.theme-dark.ui-v2 .sidebar-user .user-info strong { color: #fff !important; }
body.theme-dark.ui-v2 .sidebar-user a { color: rgba(255,255,255,.6) !important; }

/* ============================================================
   ELTERN-APP – mobile Arbeitsoberfläche
   Die Verwaltung bleibt unverändert; diese Regeln greifen nur bei
   body.is-parent-app. Große Touch-Ziele, klare Hierarchie und eine
   feste Hauptnavigation orientieren sich an der tatsächlichen PWA-Nutzung.
   ============================================================ */
.parent-topbar-brand { display: none; }

/* Auf :root statt auf body.is-parent-app, damit auch die Team-Oberflaeche
   (Startseite, Mehr-Seite) dieselben Bausteine nutzen kann. Variablen allein
   bewirken nichts - sie wirken nur dort, wo sie referenziert werden. */
:root {
  --parent-navy: #233246;
  --parent-navy-deep: #192637;
  --parent-green: #1e5f9b;
  --parent-green-soft: #dfeaf5;
  --parent-surface: #ffffff;
  --parent-line: #e7e9e4;
  --parent-muted: #6b727a;   /* war #727981 = 4,40:1 auf Weiss, jetzt 4,87:1 */
}
body.is-parent-app #main-content { background: #f2f4f5; }
body.is-parent-app .page-title { color: var(--parent-navy); }
body.is-parent-app .btn-rewa {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border-radius: 10px;
}

/* Startseite */
.parent-home-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 1.25rem;
  padding: 1.5rem 1.6rem;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--parent-navy-deep), var(--parent-navy));
  box-shadow: 0 10px 28px rgba(25,38,55,.16);
}
.parent-home-hero::after {
  content: '';
  position: absolute;
  width: 180px;
  height: 180px;
  right: -65px;
  top: -85px;
  border-radius: 50%;
  background: rgba(176,203,31,.12);
}
.parent-home-date {
  margin-bottom: .35rem;
  color: rgba(255,255,255,.68);
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .035em;
  text-transform: uppercase;
}
body.is-parent-app .parent-home-hero h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #fff;
  font-size: clamp(1.45rem, 4vw, 2rem);
}
.parent-home-hero > p { margin: .35rem 0 1rem; color: rgba(255,255,255,.78); font-size: .92rem; }
.parent-child-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.parent-child-chips > span {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: .35rem;
  padding: .35rem .7rem;
  border: 1px solid color-mix(in srgb, var(--child-color, #2f6fb0) 55%, transparent);
  border-radius: 999px;
  background: rgba(255,255,255,.13);
  color: inherit;
  font-size: .76rem;
  font-weight: 650;
}
.parent-home-hero .parent-child-chips > span { box-shadow: inset 3px 0 0 var(--child-color, #2f6fb0); }

.parent-priority-feed { margin-bottom: 1.25rem; }
.parent-priority-feed h2 { margin:0 0 .7rem; color:#59616b; font-size:.77rem; font-weight:750; letter-spacing:.065em; text-transform:uppercase; }
.parent-priority-list { overflow:hidden; border:1px solid #d1dbe4; border-radius:16px; background:#fff; box-shadow:0 3px 12px rgba(31,36,48,.04); }
.parent-priority-list > a { display:flex; min-height:72px; align-items:center; gap:.8rem; padding:.8rem 1rem; border-bottom:1px solid #ebeef0; color:var(--parent-navy); text-decoration:none; }
.parent-priority-list > a:last-child { border-bottom:0; }
.parent-priority-list > a:hover { background:#f7fafd; color:var(--parent-navy); }
.parent-priority-list > a > span:nth-child(2) { min-width:0; flex:1; }
.parent-priority-list strong,.parent-priority-list small { display:block; }
.parent-priority-list strong { font-size:.96rem; }
.parent-priority-list small { margin-top:.14rem; color:var(--parent-muted); font-size:.8rem; }
.parent-priority-list > a > .bi-chevron-right { color:#aeb5bb; font-size:.8rem; }
.priority-icon { display:grid; width:42px; height:42px; flex:0 0 42px; place-items:center; border-radius:13px; font-size:1.12rem; }
.priority-icon.is-notice { background:#fff1e0; color:#955807; }    /* war #d78320 = 2,64:1 */
.priority-icon.is-chat { background:#e3edf6; color:#134471; }      /* war #1b568d = 3,53:1 */

.parent-quick-section { margin-bottom: 1.35rem; }
.parent-quick-section h2,
.parent-section-title,
.parent-menu-section h2 {
  margin: 0 0 .7rem;
  color: #59616b;
  font-size: .77rem;
  font-weight: 750;
  letter-spacing: .065em;
  text-transform: uppercase;
}
.parent-action-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .75rem; }
.parent-action-grid > a {
  display: flex;
  min-height: 132px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  border: 1px solid var(--parent-line);
  border-radius: 16px;
  background: #fff;
  color: var(--parent-navy);
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(31,36,48,.04);
  transition: transform .16s ease, box-shadow .16s ease;
}
.parent-action-grid > a:hover { color: var(--parent-navy); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(31,36,48,.09); }
.parent-action-grid strong { margin-top: .65rem; font-size: .99rem; }
.parent-action-grid small { margin-top: .14rem; color: var(--parent-muted); font-size: .81rem; }
.action-icon,
.menu-icon {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 13px;
  background: #eef1f4;
  color: var(--parent-navy);
  font-size: 1.18rem;
}
.action-coral,.icon-coral { background:#fff0ec; color:#b8452d; }   /* war #d7644c = 3,25:1 */
.action-green,.icon-green { background:#e3edf6; color:#134471; }   /* war #1b568d = 3,53:1 */
.action-blue,.icon-blue { background:#eaf3fb; color:#2a6289; }     /* war #377eaf = 3,93:1 */
.action-orange,.icon-orange { background:#fff3e4; color:#96590a; } /* war #d98625 = 2,60:1 */
.icon-violet { background:#f2ecfa; color:#6b4a92; }                /* war #8260ac = 4,30:1 */

.parent-overview-grid .card { height: 100%; border: 1px solid var(--parent-line); }
.parent-overview-grid .card-body { padding: 1rem 1.1rem; }
.parent-alert-card { border-top: 3px solid var(--parent-accent) !important; }

/* Infokarten "Heute & demnaechst".
   Statt eines duennen Farbstreifens links steht rechts ein farbiges Feld mit
   Symbol - das Thema der Karte ist damit schon aus der Entfernung erkennbar. */
.parent-info-card {
  display: flex;
  align-items: stretch;
  height: 100%;
  min-height: 88px;
  background: var(--parent-surface);
  border: 1px solid var(--parent-line);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(31, 36, 48, .06);
}
a.parent-info-card:hover,
a.parent-info-card:focus-visible { box-shadow: 0 4px 14px rgba(31, 36, 48, .13); }
.parent-info-card .pic-body { flex: 1 1 auto; min-width: 0; padding: .8rem 1rem; }
.parent-info-card .pic-label {
  font-size: .78rem; font-weight: 600; color: var(--parent-muted); margin-bottom: .3rem;
}
.parent-info-card .pic-main { color: #2c2f36; font-weight: 700; line-height: 1.35; }
.parent-info-card .pic-sub { font-size: .84rem; color: var(--parent-muted); line-height: 1.4; }
.parent-info-card .pic-side {
  flex: 0 0 66px;
  display: grid;
  place-items: center;
  background: var(--pic-color, #1e5f9b);
  color: #fff;
  font-size: 1.6rem;
}
@media (max-width: 430px) {
  .parent-info-card .pic-side { flex-basis: 56px; font-size: 1.4rem; }
  .parent-info-card .pic-body { padding: .75rem .85rem; }
}

/* Postfach: offizielle Mitteilungen und Dialoge bleiben erkennbar getrennt. */
.parent-page-heading h1 { color: var(--parent-navy); }
.parent-comm-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem;
  max-width: 520px;
  margin-bottom: 1rem;
  padding: .3rem;
  border: 1px solid var(--parent-line);
  border-radius: 14px;
  background: #e9ece7;
}
.parent-comm-tabs a {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border-radius: 10px;
  color: #666e76;
  font-size: .84rem;
  font-weight: 650;
  text-decoration: none;
}
.parent-comm-tabs a.active { background: #fff; color: var(--parent-navy); box-shadow: 0 2px 7px rgba(31,36,48,.08); }
.parent-comm-tabs .tab-count {
  min-width: 20px;
  padding: .08rem .35rem;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: .66rem;
  text-align: center;
}
.parent-message-list,
.parent-inbox-card { overflow: hidden; border: 1px solid var(--parent-line); border-radius: 16px; box-shadow: 0 3px 12px rgba(31,36,48,.04); }
.parent-message-list .list-group-item {
  position: relative;
  display: flex;
  min-height: 94px;
  align-items: flex-start;
  gap: .8rem;
  padding: 1rem;
  border: 0;
  border-bottom: 1px solid #ebeef0;
  background: #fff;
}
.parent-message-list .list-group-item:last-child { border-bottom: 0; }
.parent-message-list .list-group-item.is-unread { background: #f7fafd; }
.chat-avatar,
.notice-avatar {
  display: inline-grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border-radius: 50%;
  background: #e5edf5;
  color: #446c94;
  font-size: 1rem;
  font-weight: 750;
}
.notice-avatar { border-radius: 14px; background: #edeff1; color: #657078; }
.notice-avatar.is-new { background: #fff1e0; color: #d78320; }
.chat-row-content { min-width: 0; flex: 1; }
.chat-row-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.chat-row-head time { flex-shrink: 0; color: #8a9096; font-size: .68rem; font-weight: 500; }
.chat-partner { overflow: hidden; color: #1f2731; font-size: .96rem; text-overflow: ellipsis; white-space: nowrap; }
.chat-subject { margin-top: .15rem; color: #4c555f; font-size: .8rem; }
.chat-preview,.notice-preview { overflow: hidden; margin-top: .15rem; color: #757d85; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.chat-context { margin-top: .25rem; color: #92979c; font-size: .68rem; }
.unread-dot { width: 9px; height: 9px; flex: 0 0 9px; margin-top: 7px; border-radius: 50%; background: var(--parent-green); box-shadow: 0 0 0 3px #deeaf5; }
.parent-inbox-card .list-group-item { min-height: 88px; padding: 1rem; border-color: #ebeef0; }
.parent-inbox-card .list-group-item.bg-light { background: #f7fafd !important; }

/* Gesprächsansicht */
.chat-transcript {
  min-height: 260px;
  padding: 1rem;
  border: 1px solid var(--parent-line);
  border-radius: 18px;
  background: #eef0ec;
}
.chat-message-inner { max-width: min(82%, 590px); }
.chat-bubble { padding: .72rem .9rem; border: 1px solid #e2e5df; border-radius: 16px 16px 16px 4px; background: #fff; color: #303841; font-size: .88rem; line-height: 1.48; box-shadow: 0 1px 2px rgba(31,36,48,.04); }
.chat-message.is-own .chat-bubble { border-color: #b7cfe6; border-radius: 16px 16px 4px 16px; background: #d8e6f3; }
.chat-meta { margin-top: .3rem; padding: 0 .25rem; color: #848b91; font-size: .66rem; }
.chat-composer { border: 1px solid var(--parent-line); }
.chat-composer textarea { resize: vertical; }
.chat-bubble-text + .chat-image-grid { margin-top: .65rem; }
.chat-image-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.28rem; overflow:hidden; border-radius:12px; }
.chat-image-grid.count-1 { grid-template-columns:minmax(0,1fr); }
.chat-image-grid a { display:block; overflow:hidden; border-radius:10px; background:#dfe3df; }
.chat-image-grid img { display:block; width:100%; height:150px; object-fit:cover; }
.chat-image-grid.count-1 img { height:auto; max-height:360px; object-fit:contain; background:#e5e8e4; }
.chat-compose-actions { display:flex; align-items:center; gap:.65rem; margin-top:.65rem; }
.chat-image-button { display:inline-flex; min-height:42px; align-items:center; gap:.4rem; cursor:pointer; }
.chat-image-status { color:#7a8188; font-size:.7rem; }
.chat-image-preview { display:flex; gap:.45rem; overflow-x:auto; padding:.35rem 0 .15rem; }
.chat-image-preview > span { display:block; width:64px; height:64px; flex:0 0 64px; overflow:hidden; border:2px solid #fff; border-radius:11px; background:#e4e7e2; box-shadow:0 1px 5px rgba(31,36,48,.12); }
.chat-image-preview img { width:100%; height:100%; object-fit:cover; }

/* Mehr-Menü */
.parent-profile-card {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--parent-navy-deep), var(--parent-navy));
  color: #fff;
  box-shadow: 0 8px 22px rgba(25,38,55,.13);
}
.parent-profile-avatar { display:grid; width:48px; height:48px; flex:0 0 48px; place-items:center; border-radius:50%; background:#2f6fb0; color:#0f2233; font-weight:800; }
.parent-profile-card .parent-child-chips { margin-top: .35rem; }
.parent-profile-card .parent-child-chips > span { min-height: 25px; padding: .2rem .55rem; font-size: .67rem; }
.parent-profile-card .btn { border-color: rgba(255,255,255,.3); color:#fff; }
.parent-menu-section { margin-bottom: 1.35rem; }
.parent-menu-list { overflow: hidden; border: 1px solid var(--parent-line); border-radius: 16px; background: #fff; box-shadow: 0 2px 8px rgba(31,36,48,.035); }
.parent-menu-list > a {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: .8rem;
  padding: .8rem 1rem;
  border-bottom: 1px solid #ebeef0;
  color: var(--parent-navy);
  text-decoration: none;
}
.parent-menu-list > a:last-child { border-bottom: 0; }
.parent-menu-list > a:hover { background: #f8fafb; color: var(--parent-navy); }
.parent-menu-list > a > span:nth-child(2) { min-width:0; flex:1; }
.parent-menu-list strong,.parent-menu-list small { display:block; }
.parent-menu-list strong { font-size:.98rem; }
.parent-menu-list small { margin-top:.14rem; color:var(--parent-muted); font-size:.81rem; }
.parent-menu-list > a > .bi-chevron-right { color:#b2b7bc; font-size:.8rem; }
.parent-menu-list > a.is-danger strong,.parent-menu-list > a.is-danger > .bi { color:#b84b4b; }

@media (max-width: 991.98px) {
  body.is-parent-app { --topbar-h: calc(54px + env(safe-area-inset-top)); background: #f2f4f5; }
  body.is-parent-app #topbar {
    height: var(--topbar-h);
    padding: env(safe-area-inset-top) .75rem .35rem;
    border-bottom: 0;
    background: var(--parent-navy) !important;
    box-shadow: 0 2px 12px rgba(25,38,55,.18);
  }
  body.is-parent-app #sidebar-toggle { color: #fff; font-size: 1.45rem; }
  body.is-parent-app #sidebar-toggle:hover { background: rgba(255,255,255,.1); }
  body.is-parent-app .parent-topbar-brand { display:flex; min-width:0; flex:1; align-items:center; justify-content:center; gap:.45rem; color:#fff; font-size:.88rem; font-weight:700; text-decoration:none; }
  body.is-parent-app .parent-topbar-brand img { width:28px; height:28px; border-radius:8px; }
  body.is-parent-app .topbar-right { margin-left:0; }
  body.is-parent-app .topbar-right .parent-inbox-button { position:relative; background:rgba(255,255,255,.1) !important; color:#fff !important; }
  .parent-topbar-badge { position:absolute; top:-4px; right:-5px; min-width:18px; padding:1px 4px; border:2px solid var(--parent-navy); border-radius:999px; background:#dc3545; color:#fff; font-size:.58rem; line-height:1.2; }
  body.is-parent-app #main-content { margin-top: var(--topbar-h); padding: 18px 14px; }
  body.is-parent-app #main-content > .page-title { display:none; }
  body.is-parent-app .form-control,
  body.is-parent-app .form-select { min-height:46px; font-size:16px; }
  body.is-parent-app textarea.form-control { min-height:118px; }
  .parent-action-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .parent-action-grid > a { min-height: 124px; }
  .parent-comm-tabs { max-width:none; }
  .chat-composer { position:sticky; bottom:calc(4.75rem + env(safe-area-inset-bottom)); z-index:20; box-shadow:0 -6px 24px rgba(31,36,48,.08); }
  .chat-compose-actions { flex-wrap:wrap; }
  .chat-compose-actions .btn-rewa { margin-left:auto; }
  .parent-form-card .card-body { padding:1rem; }
}

@media (max-width: 430px) {
  .parent-home-hero { margin-left:-2px; margin-right:-2px; padding:1.25rem 1.15rem; border-radius:18px; }
  .parent-home-hero > p { margin-bottom:.8rem; }
  .parent-action-grid { gap:.6rem; }
  .parent-action-grid > a { min-height:116px; padding:.85rem; }
  .parent-action-grid strong { font-size:.92rem; }
  .action-icon { width:39px; height:39px; flex-basis:39px; }
  .parent-message-list .list-group-item,
  .parent-inbox-card .list-group-item { padding:.85rem .8rem; }
  .chat-avatar,.notice-avatar { width:42px; height:42px; flex-basis:42px; }
  .chat-message-inner { max-width:88%; }
  .chat-image-grid img { height:125px; }
  .chat-image-grid.count-1 img { height:auto; max-height:320px; }
  .chat-transcript { margin-left:-4px; margin-right:-4px; padding:.75rem; }
  .parent-profile-card { padding:.9rem; }
  .parent-menu-list > a { padding:.75rem .85rem; }
}

/* ============================================================================
   Nachtrag – Handy, Lesbarkeit, Wochennavigation
   ========================================================================= */

/* ── 1. Geraeteraender (Statusleiste) ─────────────────────────────────────
   Als installierte App laeuft die Seite unter der Statusleiste des Handys
   hindurch. Die Eltern-Ansicht hat dafuer laengst einen Abstand; die
   Team-Ansicht hatte keinen, deshalb lag die Kopfleiste dort unter Uhrzeit
   und Akkuanzeige und war nicht mehr bedienbar.
   env(safe-area-inset-top) ist im normalen Browser 0 – die Regel wirkt sich
   also nur dort aus, wo sie gebraucht wird. */
@media (max-width: 1024px) {
  /* Gilt fuer alle Rollen. Die Eltern-Ansicht hat weiter oben eine eigene,
     staerkere Regel (body.is-parent-app #topbar) und behaelt ihre Werte. */
  #topbar {
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }
  #main-content {
    margin-top: calc(var(--topbar-h) + env(safe-area-inset-top));
  }
  /* Das Menue faehrt von links ueber die ganze Hoehe – auch dort darf der
     Logokopf nicht unter der Statusleiste liegen. */
  #sidebar { padding-top: env(safe-area-inset-top); }
}

/* ── 2. Wochennavigation (Speiseplan) ─────────────────────────────────────
   Bisher standen Vorwoche, Datum und Folgewoche in einer Flex-Zeile. Auf dem
   Handy blieb fuer das Datum zu wenig Platz, es brach mitten im Zeitraum um.
   Als Raster bekommt das Datum auf schmalen Bildschirmen eine eigene Zeile. */
.week-nav {
  display: grid;
  align-items: center;
  gap: .6rem;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "prev label next";
}
.week-nav .wn-prev  { grid-area: prev; }
.week-nav .wn-next  { grid-area: next; }
.week-nav .wn-label {
  grid-area: label;
  color: #3d3a2e;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}
@media (max-width: 575.98px) {
  .week-nav {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "label label" "prev  next";
  }
  .week-nav .wn-label { font-size: 1.05rem; }
}

/* Deutlicher als btn-outline-secondary: fester Rahmen, dunkle Schrift.
   Rahmen #6b6552 auf Weiss ergibt 4,9:1, Schrift #3d3a2e 10,1:1. */
.btn-week {
  border: 1.5px solid #6b6552;
  background: #fff;
  color: #3d3a2e;
  font-weight: 600;
}
.btn-week:hover,
.btn-week:focus-visible {
  border-color: #3d3a2e;
  background: #3d3a2e;
  color: #fff;
}

/* ── 3. Schriftgroesse ────────────────────────────────────────────────────
   Der Grundwert steigt von 16 px auf 17 px. Weil praktisch alle Schrift- und
   Abstandsangaben in rem stehen, waechst der Text ueberall gleichmaessig mit.
   Kopfleiste, Menuebreite und die untere Leiste sind in Pixeln festgelegt und
   bleiben davon unberuehrt. */
html { font-size: 106.25%; }

/* Die kleinsten Angaben tragen den Zuwachs allein nicht weit genug. */
.parent-menu-list small,
.parent-comm-tabs a { font-size: .88rem; }

/* PLZ und Ort teilen sich ein Formularfeld. Bewusst eine eigene Klasse statt
   .d-flex.gap-2: style.css zwingt diese Kombination auf dem Handy in den
   Umbruch (Zeile 647), die beiden gehoeren hier aber in eine Zeile. */
.field-plz-ort { display: flex; flex-wrap: nowrap; gap: .5rem; }
.field-plz-ort .plz { flex: 0 0 7rem; max-width: 7rem; }
.field-plz-ort .ort { flex: 1 1 auto; min-width: 0; }

/* Doppelte Seitenüberschrift vermeiden.
   pageHeader() setzt immer eine .page-title. 26 Seiten bringen zusätzlich eine
   eigene <h1> mit – auf großen Bildschirmen stand der Titel dadurch zweimal da.
   Auf dem Handy fiel es nur deshalb nicht auf, weil .page-title in der
   Eltern-Ansicht ohnehin ausgeblendet ist.
   :has() beherrschen Safari 15.4+, Chrome 105+ und Firefox 121+. Ältere
   Browser zeigen weiterhin beide Zeilen – unschön, aber nichts geht kaputt. */
#main-content:has(h1) > .page-title { display: none; }
