/*
 * mealix: Stylesheet der Oberfläche (Büro, Küche, Kunden).
 * Aufbau: 1 Farben und Masse · 2 Grundlage · 3 Seitenaufbau · 4 Navigation
 *         5 Inhalt (Überschriften, Karten) · 6 Formulare · 7 Knöpfe · 8 Tabellen
 *         9 Meldungen und Kennzeichen · 10 Tablet und Handy · 11 Druck
 * Haupt- und Zweitfarbe sowie helle oder dunkle Seitenleiste kommen aus den Einstellungen
 * (/theme.css überschreibt --primary, --secondary und bei Bedarf --sidebar-…).
 * Gestaltung «ruhig und luftig»: helle Flächen, feine Linien statt Schatten, die Hauptfarbe
 * nur als Akzent. Keine Schrift von aussen (C11): Systemschrift.
 */

/* 1 Farben und Masse ------------------------------------------------------- */
:root {
  --primary: #e85d26;
  --secondary: #2d6a4f;
  /* Füllfarbe für Flächen mit weisser Schrift: mindestens 4.5:1 (WCAG AA). /theme.css rechnet sie aus der Hauptfarbe. */
  --primary-fill: #c75021;
  --primary-fill-strong: color-mix(in srgb, var(--primary-fill) 86%, black);
  --primary-strong: color-mix(in srgb, var(--primary) 82%, black);
  --primary-soft: color-mix(in srgb, var(--primary) 10%, var(--surface));
  --secondary-soft: color-mix(in srgb, var(--secondary) 10%, var(--surface));

  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --text: #18212b;
  --text-muted: #5d6875;
  --border: #e4e7ec;
  --border-strong: #cdd3db;

  /* Seitenleiste: hell als Vorgabe; dunkel über Einstellungen → Darstellung (theme.css). */
  --sidebar-bg: #ffffff;
  --sidebar-text: #3b4654;
  --sidebar-muted: #8a94a3;
  --sidebar-strong: #101828;
  --sidebar-hover: rgba(16, 24, 40, 0.05);
  --sidebar-border: var(--border);
  --sidebar-active-bg: color-mix(in srgb, var(--primary) 11%, var(--sidebar-bg));
  --sidebar-active-text: var(--primary-strong);
  --link: var(--primary-strong);

  --danger: #c62828;
  --success: #2e7d32;
  --warning: #9a5b00;
  --danger-soft: color-mix(in srgb, var(--danger) 9%, var(--surface));
  --success-soft: color-mix(in srgb, var(--success) 11%, var(--surface));
  --warning-soft: color-mix(in srgb, var(--warning) 13%, var(--surface));

  --radius: 12px;
  --radius-control: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-raised: 0 8px 24px rgba(16, 24, 40, 0.12);
  --sidebar-width: 16.5rem;
  --sidebar-collapsed: 4.5rem;
  --nav-motion: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --control-height: 2.75rem;
  --focus: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent);

  /*
   * Bedienelemente flach, ohne Schatten. Felder heben sich nur über die Farbe ab: ein Grau, das weder
   * dem Seitengrund (--bg) noch den Karten (--surface) gleicht; mit dem Fokus werden sie hell.
   * Knöpfe tragen einen leichten Verlauf von oben nach unten, gedrückt eine Spur dunkler.
   */
  --field-bg: #eceff3;
  --field-bg-focus: #ffffff;
  /* Nie heller als --primary-fill: diese Farbe ist für weisse Schrift auf Kontrast geprüft (appearance.ts). */
  --btn-gradient-primary: linear-gradient(var(--primary-fill), color-mix(in srgb, var(--primary-fill) 90%, black));
  --btn-gradient-primary-hover: linear-gradient(var(--primary-fill-strong), color-mix(in srgb, var(--primary-fill-strong) 90%, black));
  --btn-gradient-primary-pressed: linear-gradient(color-mix(in srgb, var(--primary-fill) 86%, black), color-mix(in srgb, var(--primary-fill) 86%, black));
  --btn-gradient: linear-gradient(var(--surface), color-mix(in srgb, var(--surface) 96%, #64748b));
  --btn-gradient-pressed: linear-gradient(color-mix(in srgb, var(--surface) 93%, #64748b), color-mix(in srgb, var(--surface) 93%, #64748b));
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6875' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: light dark;
}

/*
 * Dunkelmodus: «System» folgt dem Gerät (prefers-color-scheme), «Hell» und «Dunkel» erzwingt der
 * Schalter über data-theme am <html> (Cookie, src/http/color-mode.ts). Die Werte stehen deshalb
 * zweimal: einmal für das Gerät, einmal für die feste Wahl. Beide Blöcke gleich halten.
 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #111418;
    --surface: #191d23;
    --surface-muted: #1e232a;
    --text: #e6e9ee;
    --text-muted: #9aa4b2;
    --border: #2a3038;
    --border-strong: #404956;
    --sidebar-bg: #15181d;
    --sidebar-text: #c9cfd8;
    --sidebar-muted: #7f8998;
    --sidebar-strong: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active-text: color-mix(in srgb, var(--primary) 75%, white);
    --danger: #ef5350;
    --success: #66bb6a;
    --warning: #ffb74d;
    --shadow: none;
    --shadow-raised: 0 8px 24px rgba(0, 0, 0, 0.5);
    --link: color-mix(in srgb, var(--primary) 75%, white);
    --field-bg: #242a32;
    --field-bg-focus: #1c2128;
    --btn-gradient: linear-gradient(color-mix(in srgb, var(--surface) 94%, white), var(--surface));
    --btn-gradient-pressed: linear-gradient(color-mix(in srgb, var(--surface) 92%, black), color-mix(in srgb, var(--surface) 92%, black));
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa4b2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  }
}
:root[data-theme='dark'] {
  --bg: #111418;
  --surface: #191d23;
  --surface-muted: #1e232a;
  --text: #e6e9ee;
  --text-muted: #9aa4b2;
  --border: #2a3038;
  --border-strong: #404956;
  --sidebar-bg: #15181d;
  --sidebar-text: #c9cfd8;
  --sidebar-muted: #7f8998;
  --sidebar-strong: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active-text: color-mix(in srgb, var(--primary) 75%, white);
  --danger: #ef5350;
  --success: #66bb6a;
  --warning: #ffb74d;
  --shadow: none;
  --shadow-raised: 0 8px 24px rgba(0, 0, 0, 0.5);
  --link: color-mix(in srgb, var(--primary) 75%, white);
  --field-bg: #242a32;
  --field-bg-focus: #1c2128;
  --btn-gradient: linear-gradient(color-mix(in srgb, var(--surface) 94%, white), var(--surface));
  --btn-gradient-pressed: linear-gradient(color-mix(in srgb, var(--surface) 92%, black), color-mix(in srgb, var(--surface) 92%, black));
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa4b2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: dark;
}
:root[data-theme='light'] { color-scheme: light; }

/* 2 Grundlage --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--primary); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

.icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* 3 Seitenaufbau ------------------------------------------------------------ */

/*
 * Seitenwechsel: die neue Seite blendet kurz über die alte (View Transitions, nur CSS, keine Skripte, R17).
 * Leiste, Kopfzeile und Glocke stehen fest; nur der Inhalt wechselt. Browser ohne Unterstützung laden wie bisher.
 * Nur auf dem Schreibtisch eingeschaltet (Maus, über 1024 px). Auf iOS lief die alte Seite sonst als Wisch nach links
 * weg; das Abschalten innerhalb einer @media-Regel für kleine Bildschirme beachtete Safari nicht.
 */
@media (min-width: 1025px) and (pointer: fine) {
  @view-transition { navigation: auto; }
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.15s; }
.sidebar { view-transition-name: sidebar; }
.topbar { view-transition-name: topbar; }
.notif { view-transition-name: notif; }
::view-transition-group(sidebar), ::view-transition-group(topbar), ::view-transition-group(notif),
::view-transition-old(sidebar), ::view-transition-old(topbar), ::view-transition-old(notif),
::view-transition-new(sidebar), ::view-transition-new(topbar), ::view-transition-new(notif) { animation: none; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
/* Zweite Sicherung für Handy und Tablet: startet ein Browser trotzdem einen Übergang, wechselt die Seite ohne Bewegung. */
@media (max-width: 1024px), (pointer: coarse) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*), ::view-transition-image-pair(*) { animation: none !important; }
}

.content {
  padding: 2.25rem 3rem 4rem;
  max-width: 84rem;
}
.with-sidebar .content { margin-left: var(--sidebar-width); }

/* Anmeldung und öffentliche Seiten: eine Karte in der Mitte */
.plain-page .content {
  max-width: 28rem;
  margin: 7vh auto 2rem;
  padding: 2rem 2rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.plain-page .content > h1::before { content: 'mealix'; display: block; color: var(--primary); font-size: 1.05rem; font-weight: 800; letter-spacing: 0.01em; margin-bottom: 0.75rem; }
.plain-page .stack { max-width: none; }
.plain-page form.stack { padding: 0; border: none; background: none; box-shadow: none; }

.footer { margin-top: 4rem; color: var(--text-muted); font-size: 0.8rem; }

.topbar, .backdrop { display: none; }

/* 4 Navigation (Seitenleiste) ---------------------------------------------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  z-index: 20;
}

/* Vorschau von Logo und Icon unter Einstellungen → Darstellung (auf dem Grund der Seitenleiste) */
.branding-preview img { display: block; max-height: 6rem; max-width: 20rem; padding: 0.75rem; background: var(--sidebar-bg); border: 1px solid var(--border); border-radius: var(--radius); }
.branding-preview-icon img { max-height: 3rem; }

.brand-logo { display: block; max-width: 100%; max-height: 3rem; width: auto; height: auto; object-fit: contain; }
.topbar .brand-logo { max-height: 2.4rem; max-width: 12rem; }

.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 1rem 0.75rem 0.75rem 1.5rem; }
.sidebar .brand {
  display: block;
  min-width: 0;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}
/*
 * Auf- und Zuklappen: runder Knopf auf dem rechten Rand der Leiste (wie ein Griff), ‹ zu, › auf.
 * position: fixed, damit ihn das overflow der Leiste nicht abschneidet; er wandert mit der Breite mit.
 */
.nav-expand {
  display: none;
  position: fixed;
  top: 1.45rem;
  left: calc(var(--sidebar-width) - 0.85rem);
  z-index: 21;
  width: 1.7rem; height: 1.7rem; min-width: 0; min-height: 0; padding: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  box-shadow: 0 2px 6px rgb(9 10 12 / 0.18);
}
.nav-expand .icon { width: 1rem; height: 1rem; }
.nav-expand:where(:not([disabled])):hover { background: var(--primary-fill); border-color: var(--primary-fill); color: #fff; }
.nav-expand:where(:not([disabled])):active { background: var(--primary-fill-strong); box-shadow: none; }
.nav-expand .icon:first-child { display: none; }
.with-sidebar:not(.nav-expanded) .nav-expand .icon:first-child { display: block; }
.with-sidebar:not(.nav-expanded) .nav-expand .icon:last-child { display: none; }

.nav { flex: 1; overflow-y: auto; padding: 0.25rem 0.75rem 1rem; }

/* Hauptpunkt: «Start» als Link, die Bereiche als aufklappbare Gruppe */
.nav-top,
.nav-group > summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-control);
  color: var(--sidebar-text);
  font-size: 0.975rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-top .icon, .nav-group > summary .icon { color: var(--sidebar-muted); }

/* Pfeil rechts: zeigt, ob die Gruppe offen ist */
.nav-group > summary::after {
  content: '';
  margin-left: auto;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid var(--sidebar-muted);
  border-bottom: 1.5px solid var(--sidebar-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.nav-group[open] > summary::after { transform: rotate(45deg); }

.nav-top:hover, .nav-group > summary:hover { background: var(--sidebar-hover); color: var(--sidebar-strong); }
.nav-top.active, .nav-group > summary.active { color: var(--sidebar-strong); }
.nav-top.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); }
.nav-top.active .icon, .nav-group > summary.active .icon { color: var(--primary); }

.nav-group ul { list-style: none; margin: 0.1rem 0 0.5rem; padding: 0 0 0 1.35rem; }
.nav-group li a {
  display: flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.35rem 0.75rem 0.35rem 1.1rem;
  border-left: 1px solid var(--sidebar-border);
  color: var(--sidebar-text);
  font-size: 0.95rem;
  text-decoration: none;
}
.nav-group li a:hover { background: var(--sidebar-hover); color: var(--sidebar-strong); border-radius: 0 var(--radius-control) var(--radius-control) 0; }
.nav-group li a.active {
  border-left: 2px solid var(--primary);
  padding-left: calc(1.1rem - 1px);
  background: var(--sidebar-active-bg);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem 1.1rem;
  border-top: 1px solid var(--sidebar-border);
  margin-top: 0.75rem;
}
.sidebar-user .user-name { font-weight: 600; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user form { margin: 0; }
.sidebar-user .button.ghost { color: var(--sidebar-text); border-color: var(--sidebar-border); background: transparent; box-shadow: none; min-height: 2.4rem; margin: 0; padding: 0.3rem 0.8rem; font-size: 0.9rem; gap: 0.4rem; white-space: nowrap; }
.sidebar-user .button.ghost:hover { background: var(--sidebar-hover); color: var(--sidebar-strong); }
.sidebar-user .button.ghost .icon { width: 1.1rem; height: 1.1rem; }

/*
 * Schreibtisch: die Leiste zeigt in Ruhe nur Symbole (4.5rem) und klappt auf Klick weich auf.
 * Breite und Inhaltsrand bewegen sich gemeinsam; die Texte blenden ein, sobald Platz ist.
 * Gruppen-Listen sind eingeklappt ganz weg, die Zähler sitzen als Punkt am Symbol.
 * Den Anfangszustand liefert der Server (nav-expanded am <body>, aus dem Cookie), darum springt beim Laden nichts.
 */
@media (min-width: 1025px) {
  .with-sidebar:not(.nav-expanded) { --sidebar-width: var(--sidebar-collapsed); }
  .sidebar { transition: width var(--nav-motion); overflow: hidden; }
  .with-sidebar .content { transition: margin-left var(--nav-motion); }
  .nav-expand { display: inline-flex; transition: left var(--nav-motion), background-color 0.15s ease, color 0.15s ease; }
  .nav { overflow-x: hidden; }
  .nav-top span, .nav-group > summary span:not(.count-badge), .sidebar .brand, .sidebar-user .user-name, .sidebar-user .button.ghost span, .sidebar-lang .lang-switch {
    transition: opacity 0.18s ease 0.1s;
  }
  .nav-top, .nav-group > summary { white-space: nowrap; }
  .nav-group > summary { position: relative; }

  /* Eingeklappt bleibt das Logo sichtbar, nur kleiner (Schriftzug oder hochgeladenes Logo) */
  /* links ausgerichtet, damit rechts Platz für den Knopf auf dem Rand bleibt */
  .with-sidebar:not(.nav-expanded) .sidebar-head { justify-content: flex-start; padding: 1.55rem 0 1.1rem 0.6rem; }
  .with-sidebar:not(.nav-expanded) .sidebar .brand { font-size: 0.85rem; max-width: 2.9rem; overflow: hidden; }
  .with-sidebar:not(.nav-expanded) .sidebar .brand .brand-logo { max-height: 2rem; }
  .with-sidebar:not(.nav-expanded) .nav { padding-left: 0.6rem; padding-right: 0.6rem; }
  .with-sidebar:not(.nav-expanded) .nav-top, .with-sidebar:not(.nav-expanded) .nav-group > summary { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
  .with-sidebar:not(.nav-expanded) .nav-top span, .with-sidebar:not(.nav-expanded) .nav-group > summary span:not(.count-badge) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; transition: none; }
  .with-sidebar:not(.nav-expanded) .nav-group > summary::after { display: none; }
  .with-sidebar:not(.nav-expanded) .nav-group ul { display: none; }
  .with-sidebar:not(.nav-expanded) .nav-group summary .count-badge { position: absolute; top: 0.3rem; right: 0.3rem; margin: 0; min-width: 1.1rem; height: 1.1rem; font-size: 0.65rem; }
  .with-sidebar:not(.nav-expanded) .nav-top .icon, .with-sidebar:not(.nav-expanded) .nav-group > summary .icon { width: 1.4rem; height: 1.4rem; }
  .with-sidebar:not(.nav-expanded) .sidebar-lang { padding: 0; justify-content: center; }
  .with-sidebar:not(.nav-expanded) .sidebar-lang .lang-switch { display: none; }
  .with-sidebar:not(.nav-expanded) .sidebar-user { justify-content: center; padding-left: 0.5rem; padding-right: 0.5rem; }
  .with-sidebar:not(.nav-expanded) .sidebar-user .user-name { display: none; }
  .with-sidebar:not(.nav-expanded) .sidebar-user .button.ghost span { display: none; }
  .with-sidebar:not(.nav-expanded) .sidebar-user .button.ghost { min-width: 2.5rem; padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .with-sidebar .content, .nav span, .sidebar .brand, .nav-expand { transition: none !important; }
}

/* Sprachumschalter: vier Knöpfe als eine Leiste, die aktive Sprache ist hervorgehoben */
.lang-switch { display: inline-flex; gap: 0; margin: 0; border: 1px solid var(--border); border-radius: var(--radius-control); overflow: hidden; background: var(--surface); }
.lang-switch button {
  min-height: 2.25rem;
  min-width: 2.6rem;
  padding: 0 0.55rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 0;
  box-shadow: none;
  font-size: 0.8rem;
  font-weight: 600;
}
.lang-switch button:hover { background: var(--surface-muted); color: var(--text); }
.lang-switch button[aria-current='true'] { background: var(--primary-soft); color: var(--primary-strong); }
.sidebar-lang { padding: 0 1.25rem; }
.sidebar-lang .lang-switch { background: transparent; border-color: var(--sidebar-border); }
.sidebar-lang .lang-switch button { color: var(--sidebar-muted); }
.sidebar-lang .lang-switch button:hover { background: var(--sidebar-hover); color: var(--sidebar-strong); }
.sidebar-lang .lang-switch button[aria-current='true'] { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); }
.lang-plain { position: absolute; top: 1rem; right: 1rem; display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
/* Hell, Dunkel oder System: ein Knopf, der den aktuellen Modus zeigt */
.sidebar-lang { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.mode-switch { margin: 0; }
.mode-switch button { min-height: 2.35rem; min-width: 2.6rem; padding: 0 0.6rem; background: var(--surface); color: var(--text-muted); border: 1px solid var(--border); box-shadow: none; }
.mode-switch button:hover { background: var(--surface-muted); color: var(--text); }
.mode-switch .icon { width: 1.1rem; height: 1.1rem; }
.sidebar-lang .mode-switch button { background: transparent; border-color: var(--sidebar-border); color: var(--sidebar-muted); }
.sidebar-lang .mode-switch button:hover { background: var(--sidebar-hover); color: var(--sidebar-strong); }

/* 5 Inhalt ------------------------------------------------------------------ */
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.75rem; letter-spacing: -0.012em; }
h1 { font-size: 1.7rem; font-weight: 700; margin-bottom: 1.5rem; }
h2 { font-size: 1.2rem; font-weight: 650; margin-top: 2.5rem; }
h3 { font-size: 1.02rem; font-weight: 650; margin-top: 1.5rem; }
p { margin: 0 0 1rem; }
/* Erklärtext direkt unter dem Seitentitel: näher heran, begrenzte Zeilenlänge */
h1 + p.muted { margin-top: -0.9rem; margin-bottom: 1.5rem; max-width: 46rem; }
p.muted { max-width: 46rem; font-size: 0.95rem; }

/* Zurück-Link oberhalb des Titels («← Rechnungen») */
.content > p:first-child > a:only-child { color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.content > p:first-child > a:only-child:hover { color: var(--primary); }

section { margin-top: 2.5rem; }
section > h2:first-child { margin-top: 0; }

/* Karte: Fieldsets und .card sind helle Flächen mit feiner Linie */
.card, fieldset {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.6rem;
  margin: 0 0 1.25rem;
  min-width: 0;
}
/* Titel der Karte innen statt auf dem Rahmen */
legend { float: left; width: 100%; padding: 0; margin: 0 0 0.9rem; font-weight: 650; font-size: 1.02rem; }
legend + * { clear: both; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.5rem; margin: 0 0 1rem; }
dt { color: var(--text-muted); font-weight: 500; }
dd { margin: 0; }

pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; overflow: auto; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.5rem 1rem; }

/* Kennzahlen der Startseite (dashboard.tsx): Karten mit grosser Zahl, Beschriftung und Weg zur Seite */
.dashboard-group { margin-top: 1.5rem; }
.dashboard-group > h2 { font-size: 1.05rem; margin: 0 0 0.6rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: 0.75rem; }
.kpi { display: flex; flex-direction: column; gap: 0.15rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.15rem; text-decoration: none; color: var(--text); transition: border-color 0.15s ease; min-width: 0; }
.kpi:hover { border-color: var(--border-strong); }
.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.15; color: var(--primary-strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-label { font-weight: 600; }
.kpi-detail, .kpi-list { color: var(--text-muted); font-size: 0.9rem; }
.kpi-list { margin: 0.25rem 0 0; padding-left: 1.1rem; }
.kpi-hint { grid-column: 1 / -1; margin: 0; }

/* Kacheln der Startseite */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.35rem 1.5rem; transition: border-color 0.15s ease; }
.tile:hover { border-color: var(--border-strong); }
.tile h2 { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.75rem; font-size: 1.05rem; }
.tile h2 .icon { color: var(--primary); }
.tile ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; }
.tile a { display: block; padding: 0.3rem 0; font-weight: 500; text-decoration: none; color: var(--text); }
.tile a:hover { color: var(--primary-strong); }

/* Aufklappbare Bereiche im Inhalt (Ändern, Verlauf): schlichter Schalter statt Browser-Pfeil */
.content details:not(.section):not(.dropdown):not(.shortcut-help) > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  list-style: none;
  color: var(--link);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 6px;
}
.content details:not(.section):not(.dropdown):not(.shortcut-help) > summary::-webkit-details-marker { display: none; }
.content details:not(.section):not(.dropdown):not(.shortcut-help) > summary::after {
  content: '';
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s ease;
}
.content details:not(.section):not(.dropdown):not(.shortcut-help)[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.content details:not(.section):not(.dropdown):not(.shortcut-help)[open] > summary { margin-bottom: 0.75rem; }

/* 6 Formulare --------------------------------------------------------------- */
label { font-weight: 500; font-size: 0.93rem; color: var(--text); }

/*
 * Felder flach, in Ruhe auf eigenem Grau (--field-bg). Mit dem Fokus: heller Grund, zweifacher Rahmen in der Hauptfarbe (Rahmen plus innerer Ring), kein Schein.
 * Die Beschriftung darüber nimmt dieselbe Farbe an.
 */
input, select, textarea {
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--field-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  padding: 0.5rem 0.75rem;
  min-height: var(--control-height);
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
/*
 * iOS Safari gibt Datums- und Zeitfeldern eine eigene Mindestbreite und zentriert den Wert; sie ragen dann über
 * den Rand. Ohne native Darstellung halten sie sich an die Breite; die Auswahl öffnet beim Tippen trotzdem.
 * Nur auf iOS (-webkit-touch-callout gibt es nur dort), damit Desktop-Browser ihr Kalendersymbol behalten.
 */
@supports (-webkit-touch-callout: none) {
  input[type='date'], input[type='time'], input[type='datetime-local'], input[type='month'], input[type='week'] {
    -webkit-appearance: none;
    appearance: none;
    min-width: 0;
    max-width: 100%;
  }
  input::-webkit-date-and-time-value { text-align: start; min-height: 1.5em; }
}
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 0.75; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--border-strong) 50%, var(--text-muted)); }
textarea { min-height: 7rem; line-height: 1.5; width: 100%; }
input:focus, select:focus, textarea:focus {
  outline: none;
  background: var(--field-bg-focus);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.stack label:has(> :focus), .filters label:has(> :focus), .panel-group:has(:focus) > label { color: var(--primary-strong); transition: color 0.15s ease; }
/* Ungültig erst nach dem Verlassen des Feldes (user-invalid), nicht schon beim Öffnen der Seite */
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }

/* Auswahl mit eigenem Pfeil, in beiden Farbmodi gleich */
select:not([multiple]):not([size]) {
  appearance: none;
  padding-right: 2.3rem;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
}

/*
 * Ankreuzfelder und Auswahlknöpfe gezeichnet statt vom Browser (nach css-tricks.com, «Custom
 * Styling Form Inputs With Modern CSS Features»): gleicher Grund wie die Felder, beim Ankreuzen
 * füllt die Hauptfarbe, Häkchen und Punkt drehen bzw. schrumpfen hinein. .switch macht aus einem
 * Ankreuzfeld einen Schalter.
 */
input[type='checkbox'], input[type='radio'] {
  appearance: none;
  flex: none;
  width: 21px;
  height: 21px;
  min-height: 0;
  margin: 0;
  padding: 0;
  position: relative;
  vertical-align: middle;
  cursor: pointer;
  background: var(--cb-bg, var(--field-bg));
  border: 1px solid var(--cb-border, var(--border-strong));
  border-radius: 6px;
  box-shadow: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
input[type='radio'] { border-radius: 50%; }
input[type='checkbox']::after, input[type='radio']::after {
  content: '';
  position: absolute;
  display: block;
  opacity: var(--cb-o, 0);
  transition: transform 0.25s cubic-bezier(0.2, 0.85, 0.32, 1.2), opacity 0.2s ease;
}
/* Häkchen: zwei Kanten eines gedrehten Rechtecks */
input[type='checkbox']:not(.switch)::after {
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: 2px solid #fff;
  border-top: 0;
  border-left: 0;
  transform: rotate(var(--cb-r, 20deg));
}
input[type='radio']::after {
  inset: 0;
  margin: auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  transform: scale(var(--cb-s, 0.5));
}
input[type='checkbox']:checked, input[type='radio']:checked {
  --cb-bg: var(--primary-fill);
  --cb-border: var(--primary-fill);
  --cb-o: 1;
  --cb-r: 43deg;
  --cb-s: 1;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--primary-fill) 35%, transparent);
}
input[type='checkbox']:not(:checked):not(:disabled):hover, input[type='radio']:not(:checked):not(:disabled):hover { --cb-border: var(--primary); }
input[type='checkbox']:focus, input[type='radio']:focus { background: var(--cb-bg, var(--field-bg)); border-color: var(--cb-border, var(--border-strong)); }
input[type='checkbox']:focus-visible, input[type='radio']:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
input[type='checkbox']:disabled, input[type='radio']:disabled { cursor: not-allowed; opacity: 0.5; box-shadow: none; }
label:has(> input[type='checkbox']:disabled), label:has(> input[type='radio']:disabled) { cursor: not-allowed; color: var(--text-muted); }
/* Schalter: Ankreuzfeld mit Knopf, der nach rechts wandert */
input[type='checkbox'].switch { width: 40px; border-radius: 12px; }
input[type='checkbox'].switch::after {
  left: 2px;
  top: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  opacity: 1;
  background: var(--sw-knob, var(--text-muted));
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.25);
  transform: translateX(var(--sw-x, 0));
}
input[type='checkbox'].switch:checked { --sw-knob: #fff; --sw-x: 19px; }

input[type='color'] { padding: 0.2rem; width: 4.5rem; cursor: pointer; }
input[disabled], select[disabled], textarea[disabled], fieldset[disabled] input { opacity: 0.6; cursor: not-allowed; box-shadow: none; }

/* Fahrer-Nachrichten (ADR-040): Zeilenumbrüche des Büros bleiben stehen. */
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Formular untereinander: Beschriftung über dem Feld */
.stack { display: grid; gap: 1.1rem; max-width: 32rem; }
.stack.wide { max-width: 48rem; }
.stack label { display: grid; gap: 0.4rem; }
.stack p { margin: 0; }
/* Lange Auswahltexte sprengen sonst den Rahmen des Formulars. */
.stack select { max-width: 100%; min-width: 0; }
/* Adresse: Strasse und Nr. 70/30, PLZ und Ort 30/70, auch auf dem Handy in einer Zeile */
.addr-row { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 3fr); gap: 0 0.75rem; align-items: end; }
.addr-row.zip-city { grid-template-columns: minmax(0, 3fr) minmax(0, 7fr); }
.addr-row > label { min-width: 0; }
.addr-row input { width: 100%; min-width: 0; }
.stack label:has(> input[type='checkbox']), .stack label:has(> input[type='radio']) { display: flex; align-items: center; gap: 0.6rem; font-weight: 400; font-size: 1rem; }
/* Block statt Grid: nur so liegt der Titel (legend, float) innen in der Karte */
.stack fieldset { margin: 0; }
.stack fieldset > * + * { margin-top: 1rem; }
/* Ein Formular ohne eigene Karten ist selbst die Karte; in Tabellen und Aufklappbereichen bleibt es flach. */
form.stack:not(:has(fieldset)) {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.6rem;
}
td form.stack:not(:has(fieldset)), details:not(.section) form.stack:not(:has(fieldset)), fieldset form.stack:not(:has(fieldset)), .card form.stack:not(:has(fieldset)), details.section form.stack:not(:has(fieldset)) {
  background: none; border: none; box-shadow: none; padding: 0; border-radius: 0;
}

/*
 * Wochen-, Tages- und Kundenwechsel (ui/week-nav.tsx): Pfeile ganz aussen, dazwischen die Mitte. Auf dem Schreibtisch
 * begrenzt, damit die Pfeile nahe bleiben; auf dem Handy über die ganze Breite.
 */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; width: 100%; max-width: 26rem; margin: 0 0 1.25rem; }
/* Doppelte Klasse: sonst gewinnt .button (steht weiter unten) in Ruhe, :hover aber diese Regel, und der Pfeil springt. */
.button.step-arrow { flex: none; margin: 0; min-width: 2.8rem; }
.step-arrow[aria-disabled='true'] { opacity: 0.35; pointer-events: none; }
.kw-label { flex: 1; min-width: 0; text-align: center; }
.kw-top { display: flex; align-items: center; justify-content: center; gap: 0.45rem; }
.kw-badge { display: inline-block; padding: 0.15rem 0.7rem; border-radius: 999px; background: var(--primary-fill); color: #fff; font-weight: 700; font-size: 0.85rem; }
.kw-today { font-size: 0.8rem; font-weight: 600; padding: 0.1rem 0.55rem; border: 1px solid var(--border-strong); border-radius: 999px; text-decoration: none; color: var(--text); background: var(--surface); }
.kw-today:hover { border-color: var(--primary); color: var(--primary-strong); }
.kw-dates { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Soll-Besetzung Mo–So in der Zeile einer Tätigkeit */
.targets-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; flex-basis: 100%; }
.targets-row input { width: 4.5rem; }

/* Adressvorschläge unter dem Feld Strasse (address-suggest.js) */
.suggestions { list-style: none; margin: -0.6rem 0 0; padding: 0.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: grid; gap: 0.1rem; }
.suggestions[hidden] { display: none; }
/* hidden gilt immer, auch wo eine Regel display setzt (Knöpfe sind inline-flex; push.js blendet über hidden ein und aus) */
[hidden] { display: none !important; }
.suggestions button.link { display: block; width: 100%; padding: 0.5rem 0.6rem; border-radius: 6px; text-align: left; text-decoration: none; color: var(--text); font-weight: 500; }
.suggestions button.link:hover, .suggestions button.link:focus-visible { background: var(--surface-muted); }

/* Dialog (app.js: data-dialog-open): Formular über der Seite statt aufgeklappt in der Liste */
dialog.modal { width: min(30rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow-y: auto; padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow-raised); }
dialog.modal::backdrop { background: rgb(15 23 42 / 0.45); }
dialog.modal h2 { margin: 0 0 0.25rem; }
dialog.modal form.stack { background: none; border: none; box-shadow: none; padding: 0; max-width: none; margin-top: 1rem; }
dialog.modal .filters { margin-bottom: 0; }
dialog.modal .modal-danger { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* Schritte des Assistenten «Neuer Kontakt» */
.steps { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; list-style: none; padding: 0; margin: 0 0 1.25rem; counter-reset: step; }
.steps li { counter-increment: step; color: var(--text-muted); font-size: 0.92rem; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; margin-right: 0.4rem; border-radius: 50%; border: 1px solid var(--border); font-size: 0.8rem; }
.steps li.done::before { background: var(--success-soft); border-color: transparent; color: var(--success); }
.steps li.current { color: var(--text); font-weight: 600; }
.steps li.current::before { background: var(--primary-fill); border-color: transparent; color: #fff; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.4rem 1rem; }
.relationship-choice { align-items: center; }

/* Kontaktseite: Kopf mit Name und Ansprechperson bleibt beim Scrollen stehen (ADR-030) */
.contact-head { position: sticky; top: 0; z-index: 12; margin: 0 -0.5rem 1rem; padding: 0.5rem; background: var(--bg); border-bottom: 1px solid transparent; }
.contact-head h1 { margin: 0; }
.contact-head-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; align-items: center; }
.badge.warn { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 35%, var(--surface)); }
.badge.info { background: var(--primary-soft); color: var(--primary-strong); border-color: color-mix(in srgb, var(--primary) 30%, var(--surface)); }
.badge a { color: inherit; }
ul.relationships { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.6rem; }
ul.relationships li { padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); }
ul.relationships li.inactive { opacity: 0.65; }
.relationship-actions { margin: 0.35rem 0 0; gap: 0.25rem 1rem; }
.relationship-actions form { display: inline; margin: 0; }
.relationship-pick { padding: 0.75rem; border: 1px dashed var(--border); border-radius: var(--radius); margin-bottom: 0.75rem; }
.relationship-pick p { margin: 0 0 0.5rem; }

/* Reklamation: Position mit ihren Teilen zur Auswahl */
.complaint-line { display: grid; gap: 0.25rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.complaint-line .complaint-menu { font-weight: 600; }
.complaint-line .complaint-part { padding-left: 1.6rem; }
.complaint-list { display: grid; gap: 0.75rem; margin-bottom: 1.5rem; }
.complaint.inactive { opacity: 0.65; }
.complaint-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; }
.complaint-parts { margin: 0.5rem 0 0; padding-left: 1.2rem; }
.complaint-text { margin: 0.5rem 0 0; white-space: pre-line; }
.complaint-ack { margin: 0.5rem 0 0; padding: 0.4rem 0.6rem; border-left: 3px solid var(--primary); background: var(--primary-soft); }
.complaint-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.complaint-actions form.inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem; }
.complaint-actions form.stack { flex: 1 1 16rem; }

/* Filterleiste über Listen */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin: 0 0 1.25rem;
}
.filters input[type='search'] { flex: 1; min-width: 14rem; }
.filters label { display: inline-flex; align-items: center; gap: 0.5rem; }
.filters .button, .filters button { margin: 0; }
/* Formulare in einer Leiste: ihr Knopf steht wie die anderen in der Reihe */
.filters > form { display: contents; }
.filters > form.filters { display: flex; flex: 1 1 18rem; margin: 0; }
/* Menü «Mehr»: Links untereinander statt als weitere Knöpfe */
.dropdown-panel.menu { min-width: 14rem; padding: 0.4rem; gap: 0; }
.dropdown-panel.menu a, .dropdown-panel.menu button.link { display: block; width: 100%; padding: 0.6rem 0.75rem; border-radius: 6px; color: var(--text); font-weight: 500; font-size: 0.95rem; text-align: left; text-decoration: none; }
.dropdown-panel.menu a:hover, .dropdown-panel.menu button.link:hover { background: var(--surface-muted); color: var(--text); }
.dropdown-panel.menu form { margin: 0; display: block; }
details.dropdown > summary.button { margin: 0; }

/* 7 Knöpfe ------------------------------------------------------------------ */
/*
 * Eine Hauptaktion je Formular: <button> ohne Klasse ist gefüllt (Hauptfarbe, leichter Verlauf, flach).
 * Alles andere ist Nebenaktion mit Rahmen (.button für Links, .secondary für Knöpfe) und nimmt
 * beim Überfahren die Hauptfarbe an. .danger bestätigt Löschen, .link sieht aus wie ein Link.
 * Drücken macht den Knopf eine Spur dunkler; nichts verschiebt sich.
 * Fokus mit der Tastatur: Ring mit Abstand; die Felder zeigen dagegen einen Rahmen.
 */
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--control-height);
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, translate 0.08s ease;
}
button:focus-visible, .button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; box-shadow: none; }

/* Hauptaktion */
button, .button.primary {
  background: var(--primary-fill) var(--btn-gradient-primary);
  color: #fff;
  border-color: color-mix(in srgb, var(--primary-fill) 85%, black);
  box-shadow: none;
}
button:where(:not([disabled])):hover, .button.primary:hover { background: var(--primary-fill) var(--btn-gradient-primary-hover); color: #fff; }
/* Gedrückt: eine Spur dunkler, flach */
button:where(:not([disabled])):active, .button.primary:active { background: var(--primary-fill-strong) var(--btn-gradient-primary-pressed); }

/* Nebenaktion: derselbe Aufbau ohne farbiges Leuchten */
.button, button.secondary, .button.secondary {
  background: var(--surface) var(--btn-gradient);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: none;
}
.button:hover, button.secondary:where(:not([disabled])):hover, .button.secondary:hover {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 50%, var(--border-strong));
  color: var(--primary-strong);
}
.button:active, button.secondary:active, .button.secondary:active { background: var(--surface) var(--btn-gradient-pressed); }

button.danger { background: var(--surface) var(--btn-gradient); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--surface)); box-shadow: none; }
button.danger:where(:not([disabled])):hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* Knopf, der wie ein Link aussieht (z. B. «Entfernen» in Tabellen) */
button.link { background: none; border: none; box-shadow: none; min-height: 0; padding: 0; color: var(--link); font-weight: 600; font-size: 0.9rem; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
button.link:hover, button.link:active { background: none; box-shadow: none; color: var(--primary); }
button.link:focus-visible { outline-offset: 3px; border-radius: 3px; }

button[disabled], .button[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
/* Während htmx eine Antwort lädt */
button.htmx-request { cursor: progress; opacity: 0.7; }

/*
 * Knöpfe nebeneinander: der Absatz setzt den Abstand, nicht der Knopf. «Abbrechen» neben
 * «Speichern» ist ein schlichter Link in gleicher Höhe.
 */
p:has(> button), p:has(> .button) { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.75rem; }
p:has(> button) > a:not(.button) { padding: 0.5rem 0.4rem; color: var(--text-muted); font-weight: 600; text-decoration: none; border-radius: var(--radius-control); }
p:has(> button) > a:not(.button):hover { color: var(--primary); text-decoration: underline; }

form { margin: 0 0 1rem; }
td form, .filters form, p form { display: inline; margin: 0; }

/* 8 Tabellen ---------------------------------------------------------------- */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 0 1.5rem;
  overflow: hidden;
}
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-muted); font-size: 0.8rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
tbody th { white-space: normal; color: var(--text); font-size: 0.93rem; }
tbody tr:last-child td, tbody tr:last-child th, tr:last-child > td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-muted); }
tr.inactive td { color: var(--text-muted); }
td input, td select { min-height: 2.4rem; }
td.muted, td .muted { font-size: 0.92em; }
/* Fahrer-Präsenz in der Live-Übersicht (ADR-039) */
.presence-online { color: var(--success); }

/* 9 Meldungen und Kennzeichen ---------------------------------------------- */
.notice, .error {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-control);
  border: 1px solid;
  font-weight: 500;
  max-width: 60rem;
}
.notice { background: var(--secondary-soft); border-color: color-mix(in srgb, var(--secondary) 30%, var(--surface)); color: var(--text); }
.error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, var(--surface)); color: var(--text); }
section.notice { padding: 1.1rem 1.4rem; }
/* Fehler direkt in Tabellen oder Listen ohne Kasten */
td .error, li .error, span.error { padding: 0; border: none; background: none; color: var(--danger); }

.muted { color: var(--text-muted); }

.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  vertical-align: middle;
}

.qr svg { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 8px; }

/* 10 Tablet und Handy ------------------------------------------------------- */
@media (max-width: 1024px) {
  /* Unter der mitlaufenden Kopfzeile der App */
  .contact-head { top: 3.6rem; }
  .with-sidebar .content { margin-left: 0; padding: 1.25rem 1rem 3rem; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    border-bottom: 1px solid var(--sidebar-border);
  }
  .topbar .brand { color: var(--primary); font-size: 1.25rem; font-weight: 800; text-decoration: none; }
  .menu-button { background: transparent; color: var(--sidebar-text); border-color: var(--sidebar-border); box-shadow: none; min-height: 2.75rem; min-width: 2.75rem; padding: 0.4rem; }
  .menu-button:hover { background: var(--sidebar-hover); color: var(--sidebar-strong); }

  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; width: min(20rem, 86vw); }
  .nav-open .sidebar { transform: none; box-shadow: var(--shadow-raised); }
  .nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 18; background: rgba(16, 24, 40, 0.4); }

  /* Breite Tabellen scrollen seitlich statt die Seite zu sprengen */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  h1 { font-size: 1.45rem; margin-bottom: 1.1rem; }
  h1 + p.muted { margin-top: -0.6rem; }
}

@media (max-width: 600px) {
  dl { grid-template-columns: 1fr; gap: 0.15rem; }
  dd { margin-bottom: 0.6rem; }
  .card, fieldset, form.stack:not(:has(fieldset)) { padding: 1.1rem 1rem; }
  .plain-page .content { margin: 4.5rem 0.75rem 1.5rem; padding: 1.5rem 1.1rem 1.1rem; }
  section { margin-top: 2rem; }
  h2 { margin-top: 2rem; }
  th, td { padding: 0.65rem 0.75rem; }

  /*
   * Tabellen als Karten: app.js markiert Listen mit mehr als drei Spalten (table.as-cards) und
   * schreibt die Spaltentitel an jede Zelle (data-label). Ohne Skript bleibt die Tabelle und scrollt seitlich.
   */
  table.as-cards { display: block; overflow: visible; background: none; border: none; box-shadow: none; border-radius: 0; }
  table.as-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.as-cards tbody { display: grid; gap: 0.6rem; }
  table.as-cards tr { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.35rem 0.9rem; }
  /* Zelle bleibt ein Block (Inhalt unverändert); der Spaltentitel steht links in einer festen Spalte */
  table.as-cards td { display: block; position: relative; min-height: 2.1rem; padding: 0.45rem 0 0.45rem 38%; border-bottom: none; overflow-wrap: anywhere; }
  table.as-cards td ~ td { border-top: 1px solid var(--border); }
  table.as-cards td::before { content: attr(data-label); position: absolute; left: 0; top: 0.55rem; width: 34%; color: var(--text-muted); font-size: 0.82rem; font-weight: 600; }
  /* Ohne Titel (Aktionen) und über mehrere Spalten: ganze Breite */
  table.as-cards td[data-label=''], table.as-cards td[colspan] { padding-left: 0; }
  table.as-cards td[data-label='']::before, table.as-cards td[colspan]::before { content: none; }
  /* Leere Zellen brauchen keine Zeile */
  table.as-cards td:empty, table.as-cards td[data-empty] { display: none; }
  table.as-cards tbody tr:hover td { background: none; }

  .week-nav { max-width: none; }
  /* Formulare und Filter nutzen die ganze Breite; Knöpfe sind gut zu treffen */
  .stack, .stack.wide { max-width: none; }
  /* Knopfgruppen als gleichmässiges Raster statt in zufälligen Breiten umbrechen */
  .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; align-items: stretch; }
  .filters > .button, .filters > button, .filters > form > button, .filters > details.dropdown > summary.button { width: 100%; min-width: 0; padding-left: 0.6rem; padding-right: 0.6rem; }
  .filters > details.dropdown { display: block; }
  .filters > details.dropdown .dropdown-panel { left: 0; right: 0; min-width: 0; }
  /* Titel der Leiste (Woche, Datum) zuerst und über die ganze Breite; einfache Links in eigener Zeile */
  .filters > strong, .filters > span { grid-column: 1 / -1; order: -1; }
  .filters > a:not(.button) { grid-column: 1 / -1; padding: 0.25rem 0; }
  /* Felder, Beschriftungen und verschachtelte Formulare nehmen die ganze Zeile */
  .filters > input:not([type='checkbox']):not([type='radio']):not([type='hidden']), .filters > select, .filters > label, .filters > form.filters, .filters > .span-all { grid-column: 1 / -1; }
  .filters > form.filters { display: grid; grid-template-columns: 1fr; }
  /* Ein einzelner letzter Knopf füllt die Zeile */
  .filters > :is(.button, button, form:not(.filters), details.dropdown):last-child:nth-child(odd) { grid-column: 1 / -1; }
  .filters > input:not([type='checkbox']):not([type='radio']):not([type='hidden']), .filters > select, .filters > label > select, .filters > label > input:not([type='checkbox']):not([type='radio']) { flex: 1 1 100%; min-width: 0; width: 100%; }
  .filters > label:has(> select), .filters > label:has(> input:not([type='checkbox']):not([type='radio'])) { flex: 1 1 100%; display: grid; gap: 0.3rem; }
  form.stack > p > button, form.stack > button { width: 100%; }
  /* iOS zoomt in Felder mit Schrift unter 16px hinein */
  input, select, textarea { font-size: 16px; }
}

/*
 * Leiste unten (Handy und Tablet bis 900 px), wie in Apps: Symbol mit kurzem Text, aktiver Eintrag in der
 * Hauptfarbe, «Profil» zuletzt (eigene Kontaktseite). Die Seitenleiste öffnet der Knopf oben links. Abstand zum
 * Home-Balken des iPhones über safe-area (viewport-fit=cover im Layout).
 */
.bottombar { display: none; }
@media (max-width: 900px) {
  .bottombar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 16;
    display: flex;
    justify-content: center;
    padding: 0.3rem max(0.25rem, env(safe-area-inset-right)) calc(0.3rem + env(safe-area-inset-bottom)) max(0.25rem, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--sidebar-bg) 92%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid var(--sidebar-border);
    view-transition-name: bottombar;
  }
  /* Fünf feste Plätze (nav.ts, slot): derselbe Eintrag steht bei jeder Rolle am selben Ort; fehlt einer, bleibt die Lücke. */
  .bottombar > a, .bottombar > button, .bottombar > .bottombar-gap {
    position: relative;
    flex: 1 1 0; min-width: 0; max-width: 7rem; min-height: 3.2rem;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
    padding: 0.25rem 0.1rem; margin: 0;
    background: none; border: none; box-shadow: none; border-radius: var(--radius-control);
    color: var(--sidebar-muted); font: inherit; font-size: 0.66rem; font-weight: 600; line-height: 1.1;
    text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .bottombar > a span:not(.bottombar-dot), .bottombar > button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottombar .icon { width: 1.45rem; height: 1.45rem; transition: transform 0.15s ease; }
  .bottombar > a:hover, .bottombar > button:hover { color: var(--sidebar-strong); background: none; }
  .bottombar > a:active .icon, .bottombar > button:active .icon { transform: scale(0.9); }
  .bottombar > a[aria-current='page'] { color: var(--primary); }
  .bottombar > a[aria-current='page'] .icon { stroke-width: 2.25; }
  .bottombar > button[aria-expanded='true'] { color: var(--primary); }
  /* Laufende Stoppuhr: Eintrag grün mit blinkendem Punkt (wie die Anzeige oben). */
  .bottombar > a.running { color: var(--success); }
  .bottombar > a.running::after { content: ''; position: absolute; top: 0.35rem; left: calc(50% + 0.55rem); width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--success); animation: timer-blink 2s ease-in-out infinite; }
  .bottombar-dot { position: absolute; top: 0.35rem; left: calc(50% + 0.55rem); width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--danger); }
  /* Inhalt endet über der Leiste. Die volle Navigation öffnet der Knopf oben links (Leiste unten endet mit «Profil»). */
  .with-sidebar .content { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  /* Seitenleiste als Schublade liegt über der Leiste unten. */
  .sidebar { z-index: 30; }
  .nav-open .backdrop { z-index: 25; }
}
@media (prefers-reduced-motion: reduce) { .bottombar .icon { transition: none; } .bottombar > a.running::after { animation: none; } }
::view-transition-group(bottombar), ::view-transition-old(bottombar), ::view-transition-new(bottombar) { animation: none; }

/* Runterziehen zum Neuladen in der installierten App (app.js): Kreis mit Pfeilen, oben in der Mitte. */
.ptr {
  position: fixed; top: calc(env(safe-area-inset-top) - 2.6rem); left: 50%; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  background: var(--surface); color: var(--text-muted); box-shadow: var(--shadow-raised);
  transform: translate(-50%, 0); opacity: 0; pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease, color 0.15s ease;
}
.ptr .icon { width: 1.2rem; height: 1.2rem; }
.ptr.ready { color: var(--primary); }
.ptr.loading { transform: translate(-50%, 3.5rem); opacity: 1; animation: ptr-spin 0.8s linear infinite; }
@keyframes ptr-spin { to { rotate: 360deg; } }
@media (prefers-reduced-motion: reduce) { .ptr, .ptr.loading { transition: none; animation: none; } }

/* Zwei Felder nebeneinander in einem Formular (Personalakte); auf dem Handy untereinander. */
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.field-pair > label { display: grid; gap: 0.4rem; min-width: 0; }
.field-pair input, .field-pair select { width: 100%; min-width: 0; }
@media (max-width: 600px) { .field-pair { grid-template-columns: 1fr; gap: 1.1rem; } }
/* Gesperrte Gruppe ohne eigenen Rahmen (Personalakte ohne Schreibrecht). */
fieldset.plain { border: none; padding: 0; margin: 0; background: none; box-shadow: none; min-width: 0; display: grid; gap: 1.1rem; }

/* Kopieren (ui/copy-button.tsx): kleines Symbol neben dem Wert; nach dem Kopieren ein Häkchen. */
.copy-button, .copy-button:where(:not([disabled])):hover, .copy-button:where(:not([disabled])):active {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  min-width: 0; min-height: 0; width: 1.8rem; height: 1.8rem; padding: 0;
  background: transparent; border: 1px solid transparent; box-shadow: none; color: var(--text-muted); translate: none;
}
.copy-button:hover { color: var(--text); border-color: var(--border); }
.copy-button .icon { width: 1rem; height: 1rem; }
.copy-button .icon:last-child, .copy-button.copied .icon:first-child { display: none; }
.copy-button.copied .icon:last-child { display: block; color: var(--success); }
.with-copy { display: flex; align-items: center; gap: 0.3rem; }
.with-copy input { flex: 1; min-width: 0; }
@media print { .copy-button { display: none; } }

/* Verdeckter Wert (Lohn, ui/secret.tsx): unscharf bis zum Klick auf das Auge. */
.secret { display: inline-flex; align-items: center; gap: 0.3rem; white-space: nowrap; }
.secret-value { filter: blur(6px); user-select: none; transition: filter 0.15s ease; }
.secret.revealed .secret-value { filter: none; user-select: text; }
.secret-toggle, .secret-toggle:where(:not([disabled])):hover, .secret-toggle:where(:not([disabled])):active {
  min-width: 0; min-height: 0; width: 1.7rem; height: 1.7rem; padding: 0;
  background: transparent; border: 1px solid transparent; box-shadow: none; color: var(--text-muted); translate: none;
}
.secret-toggle:hover { color: var(--text); border-color: var(--border); }
.secret-toggle .icon { width: 1rem; height: 1rem; }
.secret-toggle .icon:last-child, .secret.revealed .secret-toggle .icon:first-child { display: none; }
.secret.revealed .secret-toggle .icon:last-child { display: block; }
@media print { .secret-toggle { display: none; } }

/* 11 Druck ------------------------------------------------------------------ */
@media print {
  .sidebar, .topbar, .backdrop, .footer, .lang-plain, .notif, .noprint { display: none !important; }
  body { background: #fff; }
  .with-sidebar .content { margin: 0; padding: 0; max-width: none; }
  table, .card, fieldset { box-shadow: none; }
}

/* Vorzeichen und Betrag der Preisdifferenz nebeneinander (Variationen) */
.price-diff { display: inline-flex; gap: 0.35rem; align-items: center; white-space: nowrap; }
.price-diff select { width: auto; min-width: 3.5rem; }

/* Aufklappbare Abschnitte (Kontaktseite) ------------------------------------- */
details.section { padding: 0; }
details.section > summary { list-style: none; cursor: pointer; padding: 1rem 1.5rem; display: flex; align-items: center; gap: 0.6rem; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::before { content: ''; width: 0.5rem; height: 0.5rem; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(-45deg); transition: transform 0.15s; flex: none; }
details.section[open] > summary::before { transform: rotate(45deg); }
details.section > summary h2 { margin: 0; font-size: 1.15rem; display: flex; align-items: center; gap: 0.5rem; }
details.section[open] > summary { border-bottom: 1px solid var(--border); }
details.section > :not(summary) { margin-left: 1.5rem; margin-right: 1.5rem; }
details.section > :not(summary):first-of-type { margin-top: 1rem; }
details.section > :last-child { margin-bottom: 1.25rem; }
/* Kontaktseite, Abschnitt «Laufend»: Karten nebeneinander, auf dem Handy untereinander. */
.overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.9rem; }
.overview-card { border: 1px solid var(--border); border-radius: var(--radius-control); padding: 0.8rem 1rem; background: var(--bg); min-width: 0; }
.overview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; }
.overview-head h3 { display: flex; align-items: center; gap: 0.45rem; margin: 0; font-size: 0.98rem; }
.overview-head h3 .icon { color: var(--primary); width: 1.1rem; height: 1.1rem; }
.overview-head > a { font-size: 0.85rem; white-space: nowrap; }
.overview-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; font-size: 0.93rem; }
.overview-card li.inactive { opacity: 0.6; }
.overview-card li .icon { width: 0.95rem; height: 0.95rem; vertical-align: -0.12rem; }
.overview-card p { margin: 0.2rem 0 0; font-size: 0.93rem; }
.route-dot { display: inline-block; width: 0.65rem; height: 0.65rem; border-radius: 50%; vertical-align: 0.05rem; }
.section-count { display: inline-block; min-width: 1.4rem; padding: 0 0.4rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary-strong); font-size: 0.8rem; text-align: center; }

/* Pills mit Entfernen-Kreuz (Allergien) */
.pills { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 0.75rem; }
.pill { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.2rem 0.3rem 0.2rem 0.75rem; border-radius: 999px; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--surface)); font-size: 0.9rem; }
.pill-remove { display: inline; margin: 0; }
.pill-x { min-height: 0; padding: 0 0.45rem; border-radius: 999px; background: transparent; color: var(--text-muted); border: none; box-shadow: none; font-size: 1rem; line-height: 1.5; }
.pill-x:hover { background: var(--danger); color: #fff; }
.pill.confirming { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); border-color: var(--danger); }
.pill.confirming .pill-x { background: var(--danger); color: #fff; font-size: 0.8rem; }

/* Ausklappbare Auswahl (Allergien hinzufügen) */
details.dropdown { position: relative; display: inline-block; }
details.dropdown > summary { list-style: none; cursor: pointer; }
details.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-panel { position: absolute; z-index: 10; margin-top: 0.4rem; min-width: 18rem; max-height: 22rem; overflow-y: auto; padding: 0.75rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-raised); display: grid; gap: 0.35rem; }
.dropdown-panel label { display: flex; align-items: center; gap: 0.5rem; }
.dropdown-panel p { margin: 0.5rem 0 0; }

/* Fotos zum Lieferhinweis */
.photos { margin-top: 1.5rem; }
.photos h3 { display: flex; align-items: center; gap: 0.5rem; font-size: 1rem; margin: 0 0 0.75rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }
.photo { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.photo img { display: block; width: 100%; height: 8rem; object-fit: cover; }
.photo figcaption { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.photo figcaption form { margin: 0; }
.photo-upload input[name=caption] { flex: 1; min-width: 12rem; }

/* Kundenzugang (ADR-019): Feld gegen einfache Bots, für Menschen unsichtbar. */
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* Anmeldung: die Karte bekommt einen langsam umlaufenden Leuchtrand. Der Winkel ist eine registrierte
   Eigenschaft, damit der Browser ihn animieren kann; ohne @property bleibt der Rand stehen.
   Ebenen hinter dem Inhalt: ::before das weiche Leuchten, ::after Rand und Fläche der Karte. */
@property --glow-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes login-glow-spin { to { --glow-angle: 360deg; } }
.plain-page .content:has(.login-form) {
  --glow: conic-gradient(from var(--glow-angle, 0deg), transparent 0deg, var(--primary) 70deg, color-mix(in srgb, var(--primary) 45%, #fbbf24) 120deg, transparent 190deg, transparent 360deg);
  position: relative;
  isolation: isolate;
  background: none;
  border-color: transparent;
  animation: login-glow-spin 6s linear infinite;
}
.plain-page .content:has(.login-form)::before,
.plain-page .content:has(.login-form)::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
}
.plain-page .content:has(.login-form)::before {
  z-index: -2;
  background: var(--glow);
  filter: blur(22px);
  opacity: 0.4;
}
.plain-page .content:has(.login-form)::after {
  z-index: -1;
  border: 2px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--glow) border-box, linear-gradient(var(--border), var(--border)) border-box;
}
@media (prefers-reduced-motion: reduce) {
  .plain-page .content:has(.login-form) { animation: none; --glow-angle: 200deg; }
}
.login-alt { margin-top: 1rem; }
/*
 * Anmelden ↔ Neukunde anmelden (_auth-switch.eta). Schreibtisch: zwei Hälften, die farbige Fläche
 * liegt über der jeweils anderen Hälfte und gleitet beim Wechsel hinüber. Handy: eine Spalte, nur
 * die aktive Hälfte, die Fläche als Streifen darunter. Die Kartenhöhe richtet sich nach der längeren
 * Hälfte (Neukunde); die Anmeldung steht darin mittig.
 */
.plain-page .content:has(.auth) { max-width: 62rem; padding: 0; }
.plain-page .content:has(.auth) > .footer { margin: 0; padding: 0.75rem 1.5rem 1rem; }
.auth { position: relative; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; }
.auth-pane { grid-row: 1; min-width: 0; padding: 2.5rem 2.25rem; display: flex; flex-direction: column; justify-content: center; transition: opacity 0.45s ease; }
.auth-pane h1 { margin-top: 0; }
.auth-login { grid-column: 1; }
.auth-register { grid-column: 2; }
.auth:not(.is-register) .auth-register, .auth.is-register .auth-login { opacity: 0; }
.auth .stack { grid-template-columns: minmax(0, 1fr); }
.auth input, .auth textarea { width: 100%; min-width: 0; }
.auth-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 0.75rem; }
.auth-row > label { min-width: 0; }

.auth-hero {
  position: absolute; z-index: 2; top: 0; bottom: 0; left: 50%; width: 50%;
  display: grid; place-items: center; padding: 2.5rem; text-align: center; color: #fff;
  background: linear-gradient(155deg, var(--primary-fill), color-mix(in srgb, var(--primary-fill) 62%, black));
  transition: translate 0.65s cubic-bezier(0.65, 0, 0.35, 1);
}
.auth.is-register .auth-hero { translate: -100% 0; }
.auth-hero-text { grid-area: 1 / 1; max-width: 22rem; transition: opacity 0.3s ease 0.2s; }
.auth-hero h2 { margin: 0 0 0.75rem; color: #fff; font-size: 1.6rem; }
.auth-hero p { margin: 0 0 1.5rem; color: rgb(255 255 255 / 0.88); }
.auth:not(.is-register) .auth-hero-to-login, .auth.is-register .auth-hero-to-register { opacity: 0; visibility: hidden; transition-delay: 0s; }
/* Umschalter: heller Rahmen auf der Farbfläche statt gefülltem Knopf */
.auth-hero .button.auth-switch { background: transparent; color: #fff; border: 1.5px solid rgb(255 255 255 / 0.85); border-radius: 999px; box-shadow: none; padding: 0.55rem 1.8rem; }
.auth-hero .button.auth-switch:hover { background: rgb(255 255 255 / 0.15); color: #fff; border-color: #fff; }
.auth-hero .button.auth-switch:focus-visible { outline-color: #fff; }
@media (max-width: 899px) {
  .auth { grid-template-columns: 1fr; }
  .auth-pane { grid-column: 1; padding: 1.75rem 1.25rem 1.25rem; }
  .auth:not(.is-register) .auth-register, .auth.is-register .auth-login { display: none; }
  .auth-hero { position: static; grid-row: 2; width: auto; padding: 1.5rem 1.25rem; translate: none; }
  .auth.is-register .auth-hero { translate: none; }
  .auth-row { grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
  /* oben und unten statt links und rechts: beim Neukunden steht die Fläche oben */
  .auth.is-register .auth-hero { grid-row: 1; }
  .auth.is-register .auth-register { grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-hero, .auth-pane, .auth-hero-text { transition: none; }
}
/* Google-Anmeldung so breit wie «Anmelden», mit dem farbigen G vor dem Text */
.login-alt .google-login { width: 100%; gap: 0.6rem; }
.google-mark { width: 1.15rem; height: 1.15rem; flex: none; }
.login-links { margin-top: 1rem; font-size: 0.95em; }
td.actions form { display: inline-block; margin: 0 0.25rem 0.25rem 0; }

/* Mitteilungen: Glocke oben rechts und Zähler in der Navigation (src/http/notifications.ts). */
.count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.25rem; height: 1.25rem; padding: 0 0.35rem; margin-left: 0.4rem;
  border-radius: 999px; background: var(--primary-fill); color: #fff;
  font-size: 0.72rem; font-weight: 700; line-height: 1;
}
.nav-group summary .count-badge { margin-left: auto; margin-right: 0.4rem; }
.notif { position: fixed; top: 0.75rem; right: 1rem; z-index: 40; }
.notif {
  display: inline-flex; align-items: center; text-decoration: none; color: var(--text);
  padding: 0.5rem 0.6rem; border-radius: var(--radius-control); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.notif:hover { border-color: var(--border-strong); }
.notif .icon { width: 1.25rem; height: 1.25rem; }
.notif .count-badge { margin-left: 0.3rem; }
/* Auf schmalen Bildschirmen sitzt die Glocke in der Kopfzeile neben dem Menü. */
@media (max-width: 900px) { .notif { top: 0.55rem; right: 0.75rem; } }
/* Laufende Stoppuhr links neben der Glocke; auf der Zeiterfassung selbst überflüssig */
.timer-pill {
  position: fixed; top: 0.75rem; right: 4.6rem; z-index: 40;
  display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.5rem 0.8rem;
  border-radius: 999px; text-decoration: none; font-weight: 700; font-variant-numeric: tabular-nums;
  color: #fff; background: color-mix(in srgb, var(--success) 70%, black); box-shadow: var(--shadow);
}
.timer-pill:hover { color: #fff; background: color-mix(in srgb, var(--success) 58%, black); }
.timer-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #fff; animation: timer-blink 2s ease-in-out infinite; }
@keyframes timer-blink { 50% { opacity: 0.3; } }
body:has(.stopwatch.running) .timer-pill { display: none; }
@media (max-width: 900px) { .timer-pill { top: 0.55rem; right: 4.2rem; padding: 0.45rem 0.7rem; } }
@media (prefers-reduced-motion: reduce) { .timer-dot { animation: none; } }

/* htmx-Ladeanzeige (htmx fügt die Stile wegen der CSP nicht selbst ein). */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* Stoppuhr der Zeiterfassung (ADR-023) */
.stopwatch { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.5rem; max-width: 46rem; text-align: center; }
.stopwatch p { margin: 0 0 0.6rem; }
.stopwatch p:last-child { margin-bottom: 0; }
.timer-form { display: grid; justify-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.timer-today { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 1rem !important; }
/* Knopf in der Mitte, Wechseln als kleiner Kreis rechts daneben (Raster mit drei Spalten hält den Knopf mittig) */
.timer-main { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; }
.timer-main > :first-child { grid-column: 2; }
.timer-main > .timer-button { grid-column: 2; }
.timer-side { grid-column: 3; justify-self: start; margin-left: 1.25rem; width: 3.5rem; height: 3.5rem; min-height: 0; padding: 0; border-radius: 50%; }
.timer-side .icon { width: 1.4rem; height: 1.4rem; }
.timer-fields { display: grid; gap: 0.9rem; width: 100%; max-width: 30rem; margin: 1rem auto 0.75rem; text-align: left; }
.timer-field { display: grid; gap: 0.35rem; font-weight: 600; color: var(--primary-strong); font-size: 0.9rem; }
.timer-field select, .timer-field input { width: 100%; }
.timer-stopped { margin: 0.5rem 0 0 !important; }
.timer-stopped span { display: inline-block; padding: 0.35rem 1rem; border-radius: var(--radius); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: color-mix(in srgb, var(--danger) 80%, var(--text)); font-size: 1.6rem; font-weight: 800; }
.timer-correct { margin: 0.25rem 0 0 !important; font-size: 0.9rem; }
/*
 * Grosser runder Knopf der Stoppuhr. Bereit: rot und erhaben (Licht oben, Schatten unten, Leuchten).
 * Läuft: grün und eingedrückt (Schatten nach innen, etwas kleiner), damit man auf einen Blick sieht,
 * dass die Zeit läuft. Farben: --danger und --success; die Schrift bleibt weiss.
 */
.timer-button {
  --timer-color: var(--danger);
  width: 9rem; height: 9rem; min-height: 0; padding: 0;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--timer-color) 70%, black);
  display: grid; place-content: center; justify-items: center; gap: 0.35rem;
  font-size: 1.25rem; font-weight: 700; letter-spacing: 0.02em; color: #fff;
  background: linear-gradient(var(--timer-color), color-mix(in srgb, var(--timer-color) 78%, black));
  box-shadow: inset 0 3px 0 rgb(255 255 255 / 0.25), inset 0 -8px 12px -6px rgb(0 0 0 / 0.3), 0 4px 6px rgb(0 0 0 / 0.2), 0 14px 32px color-mix(in srgb, var(--timer-color) 40%, transparent);
  transition: box-shadow 0.2s ease, background 0.2s ease, scale 0.15s ease;
}
.timer-button .icon { width: 2.2rem; height: 2.2rem; fill: currentColor; }
.timer-button:where(:not([disabled])):hover { background: linear-gradient(color-mix(in srgb, var(--timer-color) 92%, white), color-mix(in srgb, var(--timer-color) 82%, black)); color: #fff; }
.timer-button:where(:not([disabled])):active { translate: none; scale: 0.96; box-shadow: inset 0 6px 14px rgb(0 0 0 / 0.4); }
/* Läuft: andere Farbe, eingedrückt */
.timer-button.is-running {
  --timer-color: var(--success);
  scale: 0.94;
  /* dunkler gemischt, damit weisse Schrift auch auf dem hellen Grün des Dunkelmodus lesbar bleibt */
  background: linear-gradient(color-mix(in srgb, var(--timer-color) 52%, black), color-mix(in srgb, var(--timer-color) 70%, black));
  box-shadow: inset 0 6px 14px rgb(0 0 0 / 0.38), inset 0 -2px 0 rgb(255 255 255 / 0.15), 0 1px 2px rgb(0 0 0 / 0.15);
}
.timer-button.is-running:where(:not([disabled])):hover { background: linear-gradient(color-mix(in srgb, var(--timer-color) 46%, black), color-mix(in srgb, var(--timer-color) 62%, black)); }
.timer-time { margin: 0.5rem 0 0.25rem !important; }
.timer-time strong { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; line-height: 1; }
.timer-time.is-idle strong { color: var(--text-muted); opacity: 0.6; }
.running .timer-time strong { color: color-mix(in srgb, var(--success) 75%, var(--text)); }
/* Unsichtbarer Schalter für das Tippen auf dem iPhone (stopwatch.js) */
.haptic-switch { position: fixed; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .timer-button { transition: none; } }

/* Einsatzplan (ADR-024) */
.plan-scroll { overflow-x: auto; }
table.plan th, table.plan td { vertical-align: top; min-width: 7.5rem; }
/* Tage klar getrennt; die Stunden-Spalte und die Summenzeile setzen sich ab */
table.plan th + th, table.plan td { border-left: 1px solid var(--border); }
table.plan .hours { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.plan th .hours { margin-top: 0.2rem; font-weight: 600; color: var(--text-muted); font-size: 0.9rem; }
table.plan .hours .muted { display: block; font-size: 0.8rem; }
table.plan tfoot th, table.plan tfoot td { border-top: 2px solid var(--border); font-weight: 600; }
table.plan thead th.today { background: var(--primary-soft); color: var(--primary-strong); }
table.plan .shift { padding: 0.25rem 0.5rem; margin-bottom: 0.3rem; border-radius: 6px; background: var(--surface-muted); border: 1px solid var(--border); font-size: 0.92rem; }
/* Stift oben rechts auf der Karte öffnet den Dialog zum Ändern und Entfernen */
table.plan .shift { position: relative; padding-right: 1.9rem; }
table.plan .shift .shift-edit { position: absolute; top: 0.2rem; right: 0.2rem; padding: 0.25rem; line-height: 1; color: var(--text-muted); text-decoration: none; border-radius: 6px; }
table.plan .shift .shift-edit:hover, table.plan .shift .shift-edit:focus-visible { color: var(--primary); background: var(--surface); }
table.plan .shift .shift-edit .icon { width: 1rem; height: 1rem; }
table.plan .shift.own { border-color: color-mix(in srgb, var(--primary) 45%, var(--surface)); background: var(--primary-soft); font-weight: 600; }
table.plan .shift.absent { border-color: color-mix(in srgb, var(--danger) 45%, var(--surface)); background: var(--danger-soft); }
table.plan .shift.absent strong { color: var(--danger); font-size: 0.85em; }
table.plan .badge { margin-bottom: 0.3rem; }
table.plan .badge.ok { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, var(--surface)); color: var(--success); }
table.plan .badge.warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, var(--surface)); color: var(--warning); }
.swatch { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 3px; margin-right: 0.4rem; vertical-align: middle; }

/* Plantafel (ADR-024, Nachtrag): Tagesspalten mit Feiertag und Hinweis, Ziehen, Ablage */
table.plan thead th.holiday { background: var(--danger-soft); color: var(--danger); }
table.plan thead th.note { background: var(--warning-soft); color: var(--warning); }
table.plan thead th.holiday.today, table.plan thead th.note.today { box-shadow: inset 0 -3px 0 var(--primary); }
table.plan thead th .day-flag { display: block; font-weight: 500; font-size: 0.75rem; line-height: 1.2; margin-top: 0.15rem; white-space: normal; }
table.plan tbody tr.absent-row th, table.plan tbody tr.absent-row td { background: var(--surface-muted); border-top: 2px solid var(--border-strong); }
table.plan .shift[draggable='true'], .pool-card[draggable='true'] { cursor: grab; }
table.plan .shift.dragging, .pool-card.dragging { opacity: 0.45; }
table.plan td[data-drop-date] { transition: background 0.12s ease, box-shadow 0.12s ease; }
.plan-board.is-dragging table.plan td[data-drop-date] { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent); }
table.plan td.drop-over { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.plan-board.is-busy { opacity: 0.6; pointer-events: none; }
.plan-pool { margin-top: 1.5rem; padding: 1rem 1.25rem; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); transition: background 0.12s ease, border-color 0.12s ease; }
.plan-pool.drop-over { border-color: var(--danger); background: var(--danger-soft); }
.plan-pool h2 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.plan-pool > p { margin: 0 0 0.9rem; font-size: 0.9rem; }
.pool-groups { display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; }
.pool-group h3 { margin: 0 0 0.45rem; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.pool-cards { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.pool-card { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.35rem 0.7rem 0.35rem 0.45rem; border-radius: 999px; background: var(--surface-muted); border: 1px solid var(--border); font-size: 0.92rem; font-weight: 500; user-select: none; }
.pool-card .icon { width: 0.95rem; height: 0.95rem; color: var(--text-muted); }
.pool-card:hover { border-color: var(--border-strong); background: var(--surface); }
/* Einsatzplan als Liste je Tag (Nachtrag 14.11.2026): Mitarbeitende immer, wer plant nur auf kleinen Bildschirmen.
   Auf dem Schreibtisch mehrere Karten nebeneinander, auf dem Handy eine Spalte Montag bis Sonntag. */
.plan-scope { display: inline-flex; margin: 0 0 1rem; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface); }
.plan-scope a { display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0 1rem; color: var(--text-muted); font-weight: 600; text-decoration: none; }
.plan-scope a + a { border-left: 1px solid var(--border); }
.plan-scope a:hover { background: var(--surface-muted); color: var(--text); }
.plan-scope a[aria-current='true'] { background: var(--primary-soft); color: var(--primary-strong); }
.plan-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; margin-top: 0.5rem; }
.plan-days > .plan-day { margin: 0; padding: 1rem 1.1rem; min-width: 0; }
.plan-day h2 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.plan-day h2 .muted { font-weight: 500; font-size: 0.9rem; }
.plan-day.today { border-color: var(--primary); box-shadow: inset 0 3px 0 var(--primary); }
.plan-day .day-flag { display: inline-block; margin: 0 0.4rem 0.5rem 0; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.8rem; background: var(--warning-soft); color: var(--warning); }
.plan-day .day-flag.holiday { background: var(--danger-soft); color: var(--danger); }
.plan-day h3 { margin: 0.75rem 0 0.35rem; font-size: 0.9rem; color: var(--text-muted); }
.plan-day .plan-group:first-of-type h3 { margin-top: 0; }
.plan-entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.plan-entry { position: relative; padding: 0.45rem 0.65rem; border-radius: 6px; background: var(--surface-muted); border: 1px solid var(--border); overflow-wrap: anywhere; }
.plan-entry.own { border-color: color-mix(in srgb, var(--primary) 45%, var(--surface)); background: var(--primary-soft); font-weight: 600; }
.plan-entry.absent { border-color: color-mix(in srgb, var(--danger) 45%, var(--surface)); background: var(--danger-soft); }
.plan-entry.absent strong, .plan-day .plan-absent { color: var(--danger); font-weight: 600; }
.plan-entry .plan-time { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.plan-entry .plan-note { display: block; font-size: 0.88rem; font-weight: 400; }
.plan-entry .shift-edit { float: right; margin: -0.2rem -0.3rem 0 0.4rem; padding: 0.25rem; line-height: 1; color: var(--text-muted); border-radius: 6px; }
.plan-entry .shift-edit .icon { width: 1rem; height: 1rem; }
.plan-day .plan-free, .plan-day .plan-absent, .plan-day .plan-absent-list { margin: 0; }
.plan-day .plan-absent-list { margin-top: 0.6rem; font-size: 0.9rem; color: var(--text-muted); }
.plan-board .plan-days.compact { display: none; }
@media (max-width: 900px) {
  .plan-days { grid-template-columns: 1fr; }
  .plan-board .plan-days.compact { display: grid; }
  .plan-board.has-grid .plan-scroll, .plan-board.has-grid .plan-pool { display: none; }
}
@media print { .plan-board .plan-days.compact { display: none; } .plan-board.has-grid .plan-scroll { display: block; } }
.activity-members { margin-top: 0.5rem; }
.activity-members > summary { cursor: pointer; font-size: 0.92rem; color: var(--text-muted); }
.activity-members .member-choices { display: flex; flex-wrap: wrap; gap: 0.3rem 1.25rem; }
.activity-members .member-choices label { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 400; }

/* Aktionsleiste (Wochenplan): Symbol mit kurzem Text darunter. Ein Klick klappt darunter ein Feld mit dem
   eigentlichen Knopf aus (app.js, data-slideout); erst dieser löst die Aktion aus. */
.actionbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  width: fit-content;
  max-width: 100%;
  /* Abstand zum Inhalt darunter (Wochenplan: Tabelle), auch wenn kein Feld offen ist. */
  margin: 0.5rem 0 1rem;
  padding: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.actionbar .actionbar-item,
.actionbar .actionbar-item:where(:not([disabled])):hover,
.actionbar .actionbar-item:where(:not([disabled])):active {
  flex-direction: column;
  gap: 0.2rem;
  min-width: 4.6rem;
  min-height: 3.6rem;
  padding: 0.45rem 0.6rem 0.4rem;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  translate: none;
  position: relative;
}
.actionbar .actionbar-item .icon { width: 1.35rem; height: 1.35rem; transition: transform 0.18s ease; }
/* Links in der Leiste (öffnen nur, z. B. PDF in der Bestellwoche) sehen aus wie die Knöpfe. */
.actionbar a.actionbar-item { display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-control); text-decoration: none; }
/* Linkliste in einem Ausklapp-Feld («Mehr»). */
.action-links { list-style: none; margin: 0 0 0.75rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
.actionbar .actionbar-item::after {
  content: '';
  position: absolute;
  left: 30%;
  right: 30%;
  bottom: 0.15rem;
  height: 2px;
  border-radius: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}
.actionbar .actionbar-item:where(:not([disabled])):hover { background: var(--primary-soft); color: var(--primary-strong); }
.actionbar .actionbar-item:hover .icon { transform: translateY(-2px); }
.actionbar .actionbar-item:hover::after { transform: scaleX(0.6); }
.actionbar .actionbar-item:where(:not([disabled])):active .icon { transform: scale(0.92); }
.actionbar .actionbar-item[aria-expanded='true'] { background: var(--primary-soft); color: var(--primary-strong); border-color: color-mix(in srgb, var(--primary) 22%, var(--surface)); }
.actionbar .actionbar-item[aria-expanded='true']::after { transform: scaleX(1); }

.slideout {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.25s ease, opacity 0.2s ease, margin 0.25s ease;
  margin: 0;
}
.slideout > .slideout-inner { overflow: hidden; min-height: 0; }
.slideout.open { grid-template-rows: 1fr; opacity: 1; margin: -0.5rem 0 1rem; }
.slideout.open > .slideout-inner {
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-raised);
}
.slideout-inner > p:first-child { margin-top: 0; }
.slideout-inner > :last-child { margin-bottom: 0; }
.slideout-inner h2 { margin-top: 0; font-size: 1.05rem; }
/* Formulare im Feld ohne eigene Karte (sonst Rahmen im Rahmen). */
.slideout-inner form.stack { padding: 0; border: none; background: none; box-shadow: none; max-width: 32rem; }
.slideout-inner form > button, .slideout-inner p > button, .slideout-inner > .button { animation: slideout-in 0.3s ease both; }
@keyframes slideout-in { from { opacity: 0; translate: -0.75rem 0; } }
@media (max-width: 600px) {
  /*
   * Seitlich scrollen statt umbrechen: Text in einer Zeile, Symbole etwas grösser. Damit man sieht, dass noch etwas
   * kommt, blendet die Leiste am Rand aus, an dem es weitergeht (app.js setzt data-more="start|end|both").
   */
  /*
   * Über die ganze Breite; wenige Einträge teilen sich den Platz, viele scrollen. Kein Innenabstand links und
   * rechts: sonst scrollt der Inhalt in diesem Streifen klar am Verlauf vorbei. Den Abstand tragen erster und
   * letzter Eintrag. Auch eine Leiste mit nur einem Eintrag ist voll breit: mit width: fit-content zusammen mit
   * overflow-x und den klebenden Rändern rechnete iOS Safari sie auf fast null zusammen (leerer schmaler Kasten).
   */
  .actionbar {
    width: 100%;
    padding-left: 0;
    padding-right: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .actionbar::-webkit-scrollbar { display: none; }
  /* Verlauf als klebende Ränder in der Leiste: der Rahmen bleibt stehen, nur der Inhalt blendet aus. */
  .actionbar::before, .actionbar::after {
    content: ''; position: sticky; z-index: 1; flex: 0 0 2.2rem; align-self: stretch; pointer-events: none;
    opacity: 0; transition: opacity 0.15s ease;
  }
  .actionbar::before { order: -1; left: 0; margin-right: -2.2rem; background: linear-gradient(to right, var(--surface), transparent); }
  .actionbar::after { order: 99; right: 0; margin-left: -2.2rem; background: linear-gradient(to left, var(--surface), transparent); }
  .actionbar:is([data-more='start'], [data-more='both'])::before, .actionbar:is([data-more='end'], [data-more='both'])::after { opacity: 1; }
  .actionbar .actionbar-item, .actionbar .actionbar-item:where(:not([disabled])):hover, .actionbar .actionbar-item:where(:not([disabled])):active {
    flex: 1 0 auto; min-width: 4.4rem; min-height: 3.9rem; padding-left: 0.5rem; padding-right: 0.5rem; scroll-snap-align: start;
  }
  .actionbar > :first-child { margin-left: 0.3rem; }
  .actionbar > :last-child { margin-right: 0.3rem; }
  .actionbar .actionbar-item span { font-size: 0.72rem; white-space: nowrap; }
  .actionbar .actionbar-item .icon { width: 1.6rem; height: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .slideout, .actionbar .actionbar-item .icon, .actionbar .actionbar-item::after { transition: none; }
  .slideout-inner form > button, .slideout-inner p > button, .slideout-inner > .button { animation: none; }
}

/* Erst bestätigen (app.js, data-confirm): Feld direkt beim Formular mit Frage, eigentlichem Knopf und «Abbrechen». */
.confirm-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.6rem;
  margin: 0.5rem 0;
  padding: 0.7rem 0.9rem;
  min-width: min(18rem, 100%);
  max-width: 40rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-raised);
  text-align: left;
  white-space: normal;
  animation: slideout-in 0.25s ease both;
}
.confirm-panel > p { flex: 1 1 100%; margin: 0; font-weight: 500; }
.confirm-panel > button { min-height: 2.4rem; padding: 0.35rem 0.9rem; font-size: 0.9rem; }
@media (prefers-reduced-motion: reduce) {
  .confirm-panel { animation: none; }
}
