/* ==========================================================================
   Werkbank: Design-Tokens und Basiskomponenten
   Kontraste nach WCAG 2.x berechnet, Werte in EINRICHTUNG.md (Abschnitt UI-Prüfung)
   ========================================================================== */

:root {
  /* Farbe, heller Modus (Standard) */
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;          /* ruhige Flaechen: Code, Diff, Auswahl-Hintergrund */
  --field: #ffffff;
  --text: #18202b;               /* 16,40:1 auf surface, 15,04:1 auf bg */
  --muted: #525d6b;              /* 6,69:1 auf surface, 6,14:1 auf bg */
  --border: #7a8594;             /* UI-Kanten 3,74:1 auf surface, 3,43:1 auf bg */
  --line: #dde1e6;               /* nur dekorative Trennlinien */
  --accent: #b3261e;             /* Primaerbutton, Weiss darauf 6,54:1 */
  --accent-text: #ffffff;
  --accent-soft: #fbe8e6;        /* Auswahl-Hintergrund */
  --accent-ink: #9b1f18;         /* Akzent als Text: 8,07:1 auf surface, 6,83:1 auf accent-soft */
  --ok: #17703c;                 /* 6,14:1 */
  --warn: #8a5300;               /* 6,33:1 */
  --err: #b3261e;                /* 6,54:1 */
  --focus: #1f55c7;              /* 6,60:1 auf surface, 6,05:1 auf bg */
  --toast-bg: #18202b;
  --toast-text: #ffffff;
  --shadow-color: 24 32 43;

  /* Typografie: eine Familie, Systemschrift */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-body: 1rem;                                   /* 16 px */
  --fs-small: 0.875rem;                              /* 14 px, nur Metadaten */
  --fs-h1: clamp(1.5rem, 1.25rem + 1.2vw, 2rem);
  --fs-h2: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  --fs-h3: 1rem;
  --lh: 1.5;
  --measure: 70ch;

  /* Abstaende, Raster 4/8 px */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;

  /* Radien und Schatten */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-pill: 999px;
  --sh-1: 0 1px 2px rgb(var(--shadow-color) / 0.06);
  --sh-2: 0 8px 24px rgb(var(--shadow-color) / 0.16);

  /* Bewegung */
  --t-fast: 150ms; --t-base: 200ms; --t-slow: 300ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Zielgroessen */
  --target: 44px;
  --nav-h: 64px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a; --surface: #19212a; --surface-2: #222b35; --field: #111820;
    --text: #e8ebef;      /* 13,59:1 auf surface */
    --muted: #a5afbb;     /* 7,31:1 auf surface */
    --border: #76828f;    /* 4,15:1 auf surface */
    --line: #2c3540;
    --accent: #c43a31;    /* Weiss darauf 5,25:1, Kante zur Flaeche 3,09:1 */
    --accent-text: #ffffff;
    --accent-soft: #3a1d1c;
    --accent-ink: #ff9a92;/* 7,96:1 auf surface, 7,50:1 auf accent-soft */
    --ok: #5cc98a; --warn: #f0b45a; --err: #ff8a80;
    --focus: #8db3ff;     /* 7,76:1 auf surface */
    --toast-bg: #e8ebef; --toast-text: #18202b;
    --shadow-color: 0 0 0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141a; --surface: #19212a; --surface-2: #222b35; --field: #111820;
  --text: #e8ebef; --muted: #a5afbb; --border: #76828f; --line: #2c3540;
  --accent: #c43a31; --accent-text: #ffffff; --accent-soft: #3a1d1c; --accent-ink: #ff9a92;
  --ok: #5cc98a; --warn: #f0b45a; --err: #ff8a80; --focus: #8db3ff;
  --toast-bg: #e8ebef; --toast-text: #18202b; --shadow-color: 0 0 0;
  color-scheme: dark;
}

/* ---------- Grundlage ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: var(--fs-body); line-height: var(--lh);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
[hidden] { display: none !important; }
h1 { font-size: var(--fs-h1); line-height: 1.2; margin: var(--s-2) 0 var(--s-4); text-wrap: balance; }
h2 { font-size: var(--fs-h2); line-height: 1.3; margin: var(--s-5) 0 var(--s-2); font-weight: 650; }
h3 { font-size: var(--fs-h3); margin: var(--s-4) 0 var(--s-2); }
p { margin: 0 0 var(--s-3); max-width: var(--measure); }
img, svg, canvas { max-width: 100%; }

/* Fokus: immer sichtbar, 2 px, mit Abstand, damit er auch auf farbigen Buttons gegen die Flaeche steht */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

.skip {
  position: absolute; left: var(--s-2); top: var(--s-2); z-index: 100;
  padding: var(--s-3) var(--s-4); background: var(--surface); color: var(--text);
  border: 2px solid var(--focus); border-radius: var(--r-md); font-weight: 600;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

.wrap {
  max-width: 680px; margin: 0 auto; padding-block: var(--s-4) var(--s-6);
  padding-left: max(var(--s-4), env(safe-area-inset-left, 0px));
  padding-right: max(var(--s-4), env(safe-area-inset-right, 0px));
}
.wrap.wide { max-width: 1120px; }

.muted { color: var(--muted); font-size: var(--fs-small); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.err { color: var(--err); }
.code, code { font-family: var(--mono); font-size: var(--fs-small); overflow-wrap: anywhere; }
pre.code { background: var(--surface-2); padding: var(--s-3); border-radius: var(--r-md); white-space: pre-wrap; margin: 0 0 var(--s-3); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Kopf und Navigation ---------- */

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(var(--s-4), env(safe-area-inset-left, 0px));
  padding-right: max(var(--s-4), env(safe-area-inset-right, 0px));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: 56px;
  font-weight: 700; color: var(--text); text-decoration: none;
}
.brand svg, .brand img { width: 24px; height: 24px; color: var(--accent); }
.brand img { border-radius: 6px; }

/* Hauptnavigation: am Handy unten (Daumenbereich), ab Tablet oben rechts */
.mainnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
  background: var(--surface); border-top: 1px solid var(--line);
}
.mainnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--nav-h); padding: var(--s-1) var(--s-1);
  color: var(--muted); text-decoration: none; font-size: 0.75rem; font-weight: 600;
  position: relative;
}
.mainnav svg { width: 24px; height: 24px; }
.mainnav a[aria-current="page"] { color: var(--accent-ink); }
.mainnav a[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
}
body.has-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }

@media (min-width: 768px) {
  .mainnav {
    position: static; display: flex; gap: var(--s-1); padding: 0; border: 0; background: none;
  }
  .mainnav a { flex-direction: row; gap: var(--s-2); min-height: var(--target); padding: 0 var(--s-3); font-size: var(--fs-small); border-radius: var(--r-md); }
  .mainnav svg { width: 20px; height: 20px; }
  .mainnav a[aria-current="page"] { background: var(--accent-soft); }
  .mainnav a[aria-current="page"]::before { display: none; }
  body.has-nav { padding-bottom: env(safe-area-inset-bottom, 0px); }
}

.banner { background: var(--warn); color: #fff; padding: var(--s-2) var(--s-4); font-size: var(--fs-small); text-align: center; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .banner { color: #18202b; } }

/* ---------- Buttons ---------- */
/* Primaer: button (gefuellt). Sekundaer: .secondary (Kontur). Tertiaer: .ghost (Text). Je Ansicht genau ein Primaerbutton. */

button, .btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--target); min-width: var(--target); padding: 0 var(--s-4);
  font: inherit; font-weight: 650; line-height: 1.2; text-decoration: none; cursor: pointer;
  border: 1px solid var(--accent); border-radius: var(--r-md);
  background: var(--accent); color: var(--accent-text);
  transition: transform var(--t-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
button.secondary, .btn.secondary {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
button.ghost, .btn.ghost {
  background: transparent; color: var(--accent-ink); border-color: transparent; padding: 0 var(--s-3);
}
button.ghost.danger { color: var(--err); }
button.big { width: 100%; min-height: 56px; font-size: 1.125rem; }
button:active:not(:disabled), .btn:active { transform: scale(0.97); }
button:disabled { cursor: not-allowed; opacity: 0.55; }
button[aria-busy="true"] { cursor: progress; }
button[aria-busy="true"]::after {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (hover: hover) and (pointer: fine) {
  button:hover:not(:disabled), .btn:hover { filter: brightness(1.08); }
  button.secondary:hover:not(:disabled), .btn.secondary:hover { background: var(--surface-2); filter: none; }
  button.ghost:hover:not(:disabled), .btn.ghost:hover { background: var(--surface-2); filter: none; }
  a:hover { text-decoration-thickness: 2px; }
  .tile:hover { border-color: var(--border); box-shadow: var(--sh-2); }
}

.btns { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); justify-content: flex-end; }
.btns.start { justify-content: flex-start; }
.mt { margin-top: var(--s-3); }

/* ---------- Links ---------- */

a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Formularfelder: Label ueber dem Feld, Fehler am Feld ---------- */

label { display: block; margin-bottom: var(--s-4); font-weight: 600; font-size: 0.9375rem; color: var(--text); }
label .muted { font-weight: 400; }
input, select, textarea {
  display: block; width: 100%; margin-top: var(--s-1);
  min-height: 48px; padding: var(--s-3);
  font: inherit; font-size: 1rem; font-weight: 400; color: var(--text);
  background: var(--field); border: 1px solid var(--border); border-radius: var(--r-md);
}
textarea { min-height: 96px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border: 2px solid var(--err); }
input:disabled { opacity: 0.55; }
input[type="checkbox"], input[type="radio"] {
  display: inline-block; width: 24px; height: 24px; min-height: 0; margin: 0; accent-color: var(--accent);
}
.fieldwrap { margin-bottom: var(--s-4); }
.fieldwrap > label { margin-bottom: 0; }
.field-msg { display: flex; gap: var(--s-1); margin: var(--s-1) 0 0; color: var(--err); font-size: var(--fs-small); font-weight: 600; }
.field-msg::before { content: "Fehler:"; }
.hint { margin: var(--s-1) 0 0; color: var(--muted); font-size: var(--fs-small); font-weight: 400; }
.check { display: flex; align-items: center; gap: var(--s-3); min-height: var(--target); margin: 0 0 var(--s-3); font-weight: 500; }
.form-error { padding: var(--s-3); border: 2px solid var(--err); border-radius: var(--r-md); background: var(--surface); color: var(--err); font-weight: 600; }
.form-error:empty { display: none; }

/* ---------- Karten und Zeilen ---------- */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--s-4); margin-bottom: var(--s-3); box-shadow: var(--sh-1);
  container-type: inline-size;
}
@media (min-width: 1024px) { .card { padding: var(--s-5); } }
.row {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-3);
  padding: var(--s-3) 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row > div:first-child { min-width: 0; }
/* Zeilen mit langem Text und mehreren Buttons stapeln in schmalen Karten */
@container (max-width: 360px) {
  .row.stack { flex-direction: column; align-items: stretch; }
  .row.stack .btns { justify-content: flex-start; }
}

.pill {
  display: inline-block; padding: 2px var(--s-2); border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line); font-size: 0.8125rem; font-weight: 600; margin-right: var(--s-1);
}
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.err { color: var(--err); }

/* Kacheln auf der Startseite */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }
.tile {
  display: flex; flex-direction: column; gap: var(--s-1); min-height: 96px; padding: var(--s-4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1);
  color: var(--text); text-decoration: none; transition: transform var(--t-fast) var(--ease-out);
}
.tile strong { font-size: 1.0625rem; }
.tile span { color: var(--muted); font-size: var(--fs-small); }
.tile span.warn { color: var(--warn); font-weight: 600; }
.tile:active { transform: scale(0.97); }
.tile.off { opacity: 0.55; pointer-events: none; }
.tile.off span::before { content: "Noch nicht verfügbar, "; }

/* Segmentierte Umschalter (Zeitraum u. a.): Auswahl mit Haken, nicht nur ueber Farbe */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s-2); margin-bottom: var(--s-3); }
.segmented button { background: var(--surface); color: var(--text); border-color: var(--border); font-weight: 600; padding: 0 var(--s-2); white-space: nowrap; }
.segmented button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); border: 2px solid var(--accent); }
.segmented button[aria-pressed="true"]::before { content: "✓"; }

/* ---------- Layout-Bausteine ---------- */

.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--s-5); align-items: start; }
.cols > div { min-width: 0; }
.grid-listen { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--s-4); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-3); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.stats strong { display: block; font-size: 1.25rem; margin-top: 2px; font-variant-numeric: tabular-nums; }
.chartbox { position: relative; height: 260px; }
@media (min-width: 768px) {
  .grid-listen { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
  .cols { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .chartbox { height: 340px; }
}

/* ---------- Rueckmeldung: Toast mit Rueckgaengig, Fortschritt ---------- */

.toasts {
  position: fixed; z-index: 50; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--s-4) + env(safe-area-inset-bottom, 0px));
  width: min(560px, calc(100% - 2 * var(--s-4)));
  display: grid; gap: var(--s-2);
}
body.has-nav .toasts { bottom: calc(var(--nav-h) + var(--s-3) + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 768px) { body.has-nav .toasts { bottom: calc(var(--s-5) + env(safe-area-inset-bottom, 0px)); } }
.toast {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4); border-radius: var(--r-md);
  background: var(--toast-bg); color: var(--toast-text); box-shadow: var(--sh-2);
  animation: toast-in var(--t-base) var(--ease-out);
}
.toast button { background: transparent; border-color: var(--toast-text); color: var(--toast-text); flex: none; }
.toast.err { border-left: 6px solid var(--err); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.progress { display: grid; gap: var(--s-2); margin: var(--s-3) 0; }
.progress-bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress-bar > span { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform var(--t-base) var(--ease-out); }

/* ---------- Bausteine einzelner Ansichten ---------- */

.qr { max-width: 260px; background: #fff; padding: var(--s-2); border-radius: var(--r-md); }
.qr svg { width: 100%; height: auto; display: block; }
.thumbs { display: flex; flex-wrap: wrap; gap: var(--s-2); }
img.fotothumb { width: 120px; height: 120px; object-fit: cover; border-radius: var(--r-md); }
.vor-h { font-size: var(--fs-small); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: var(--s-3) 0 0; }
.vor-h:first-child { margin-top: 0; }
.imp + .imp { border-top: 1px solid var(--line); }
.imp .row { border-bottom: 0; }
.diff { background: var(--surface-2); border-radius: var(--r-md); padding: var(--s-3); margin-bottom: var(--s-3); font-size: var(--fs-small); }
.diff p { margin: 0 0 var(--s-3); }

/* ---------- Reduzierte Bewegung ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  button[aria-busy="true"]::after { animation: none; border-right-color: currentColor; opacity: 0.6; }
}

/* ---------- Abnehm-Protokoll ---------- */
.subnav { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0 0 var(--s-4); }
.subnav a {
  flex: none; display: inline-flex; align-items: center; min-height: var(--target); padding: 0 var(--s-4);
  border: 1px solid var(--border); border-radius: var(--r-pill); color: var(--text); text-decoration: none; font-weight: 600; background: var(--surface);
}
.subnav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); border: 2px solid var(--accent); }
.subnav a[aria-current="page"]::before { content: "✓ "; }
.wzahlen { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); margin-top: var(--s-1); font-variant-numeric: tabular-nums; }
.row.woche { align-items: flex-start; }
.notiz { white-space: pre-line; overflow-wrap: anywhere; }
fieldset.zeile { border: 0; border-bottom: 1px solid var(--line); margin: 0 0 var(--s-3); padding: 0 0 var(--s-2); min-width: 0; }
details.notiz-edit { margin: calc(-1 * var(--s-3)) 0 var(--s-4); }
details summary { display: flex; align-items: center; min-height: var(--target); cursor: pointer; color: var(--accent-ink); font-weight: 600; font-size: var(--fs-small); }
details summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.savebar {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); z-index: 5;
  padding: var(--s-3) 0; background: linear-gradient(to top, var(--bg) 70%, transparent);
}
@media (min-width: 768px) { .savebar { bottom: 0; } }
.tabelle { overflow-x: auto; max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.tabelle table { border-collapse: collapse; width: 100%; font-size: var(--fs-small); }
.tabelle th, .tabelle td { text-align: left; padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--line); vertical-align: top; }
.tabelle th { position: sticky; top: 0; background: var(--surface-2); }
.tabelle tr.err td { color: var(--err); font-weight: 600; }
ol.ablauf { margin: 0 0 var(--s-3); padding-left: var(--s-5); display: grid; gap: var(--s-2); }

/* Rollenauswahl als Gruppe */
fieldset.fieldwrap { border: 0; padding: 0; margin: 0 0 var(--s-3); min-width: 0; }
fieldset.fieldwrap legend { font-weight: 600; margin-bottom: var(--s-2); padding: 0; }
fieldset.fieldwrap .check { margin-bottom: 0; }

/* ==========================================================================
   FF Boele-Kabel (ff.luebold.de, Meldeformular): Farben aus dem Einheitslogo
   Rot #c92a27, Schwarz #11120d, Blau #390dc2, Gelb #ffee1c
   ========================================================================== */
html[data-site="ff"] {
  --accent: #c92a27;             /* Logo-Rot, Weiss darauf 5,46:1 */
  --accent-soft: #fbe9e8;
  --accent-ink: #a8211f;         /* 7,24:1 auf surface, 6,18:1 auf accent-soft */
  --focus: #390dc2;              /* Logo-Blau, 10,44:1 auf surface */
  --top-bg: #11120d;
}
@media (prefers-color-scheme: dark) {
  html[data-site="ff"]:not([data-theme="light"]) { --accent: #d02e2b; --accent-soft: #3a1d1c; --accent-ink: #ff9a92; --focus: #8db3ff; }
}
html[data-site="ff"][data-theme="dark"] { --accent: #d02e2b; --accent-soft: #3a1d1c; --accent-ink: #ff9a92; --focus: #8db3ff; }
/* dunkles Rot: Weiss darauf 5,11:1, Kante zur Flaeche 3,18:1 */

html[data-site="ff"] .top { background: var(--top-bg); border-bottom: 3px solid #ffee1c; }
html[data-site="ff"] .brand { color: #ffffff; }                 /* 18,81:1 */
html[data-site="ff"] .brand img { width: 40px; height: 40px; border-radius: 0; }
html[data-site="ff"] .top :focus-visible { outline-color: #ffee1c; } /* 15,68:1 auf Schwarz */
@media (min-width: 768px) {
  html[data-site="ff"] .top .mainnav a { color: #e8e8e6; }       /* 15,33:1 */
  html[data-site="ff"] .top .mainnav a[aria-current="page"] { background: rgba(255, 255, 255, .12); color: #ffffff; box-shadow: inset 0 -3px 0 #ffee1c; }
}

/* Bildansicht (Vollbild-Dialog) */
.thumbbtn { padding: 0; min-width: 0; min-height: 0; border: 1px solid var(--border); background: none; border-radius: var(--r-md); overflow: hidden; line-height: 0; }
.thumbbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
dialog.viewer {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: #0b0d10; color: #ffffff; display: flex; flex-direction: column;
}
dialog.viewer:not([open]) { display: none; }
dialog.viewer::backdrop { background: rgba(0, 0, 0, .85); }
.viewer-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: calc(env(safe-area-inset-top, 0px) + var(--s-2)) max(var(--s-3), env(safe-area-inset-right, 0px)) var(--s-2) max(var(--s-3), env(safe-area-inset-left, 0px));
}
.viewer-count { font-size: var(--fs-small); color: #d7dbe0; }        /* 13,9:1 auf #0b0d10 */
.viewer-close { background: #ffffff; color: #0b0d10; border-color: #ffffff; }
.viewer-close:focus-visible, .viewer-nav button:focus-visible { outline: 3px solid #ffee1c; outline-offset: 2px; }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: var(--s-2); }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-nav {
  display: flex; justify-content: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-3) calc(env(safe-area-inset-bottom, 0px) + var(--s-3));
}
.viewer-nav button { min-width: 120px; }

/* ==========================================================================
   Lübold (app.luebold.de): Kopfzeile in Schieferblau mit roter Linie, passend zum Icon
   ========================================================================== */
html[data-site="app"] .top { background: #1f2a37; border-bottom: 3px solid #e5534b; }
html[data-site="app"] .brand { color: #f4f1ea; }                 /* 12,9:1 auf #1f2a37 */
html[data-site="app"] .brand img { width: 32px; height: 32px; border-radius: 8px; }
html[data-site="app"] .top :focus-visible { outline-color: #f4f1ea; }
@media (min-width: 768px) {
  html[data-site="app"] .top .mainnav a { color: #d7dce2; }       /* 10,6:1 */
  html[data-site="app"] .top .mainnav a[aria-current="page"] { background: rgba(255, 255, 255, .10); color: #ffffff; box-shadow: inset 0 -3px 0 #e5534b; }
}

/* ---------- Neue Version ---------- */
.updbar {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  top: calc(var(--s-2) + env(safe-area-inset-top, 0px));
  width: min(560px, calc(100% - 2 * var(--s-4)));
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4); border-radius: var(--r-md);
  background: var(--toast-bg); color: var(--toast-text); box-shadow: var(--sh-2);
  border-left: 6px solid var(--accent);
}
.updbar button { flex: none; }

/* ---------- Dialog „Manuell eintragen“ ---------- */
dialog.modal {
  width: min(520px, calc(100% - 2 * var(--s-4))); max-height: calc(100dvh - 2 * var(--s-4));
  padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg, 12px);
  background: var(--surface); color: var(--text); box-shadow: var(--sh-2);
}
dialog.modal::backdrop { background: rgba(0, 0, 0, .5); }
dialog.modal form { padding: var(--s-4); overflow: auto; }
dialog.modal h2 { margin-top: 0; }
.modal-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); }
.quelle { display: inline-block; font-size: .8em; padding: 0 .45em; border-radius: 999px; background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.quelle.manuell { background: var(--accent); color: #fff; }
.tageswerte { display: grid; gap: var(--s-2); }
.tageswerte .row strong { font-variant-numeric: tabular-nums; }
.healthline { margin: 0 0 var(--s-3); }
.ausl { display: flex; flex-wrap: wrap; gap: var(--s-1, 4px) var(--s-3); font-size: .9em; }

/* ---------- Abnehmen: Diagramm über volle Breite ---------- */
.stats.stats3 { grid-template-columns: repeat(3, 1fr); }
.chartkopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); margin-top: var(--s-4); }
.chartkopf .segmented { margin: 0; flex: 1 1 260px; }
.chartcard { padding-left: var(--s-2); padding-right: var(--s-2); }
.chartbox.gross { height: 360px; }
@media (min-width: 768px) { .chartbox.gross { height: 460px; } }
.kartenkopf { margin: 0 0 var(--s-2); font-size: 1.05rem; }
.wrap.wide.breit { max-width: 1440px; }
details.mehr > summary { cursor: pointer; font-weight: 600; } details.mehr[open] > summary { margin-bottom: var(--s-3); } details.mehr h3 { margin: var(--s-4) 0 var(--s-2); font-size: 1rem; } details.mehr textarea { width: 100%; }

/* Fokus auf Überschriften nach Seitenwechsel dient Screenreadern, kein sichtbarer Rahmen */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; box-shadow: none; }
details.kam { border-bottom: 1px solid var(--line); padding: var(--s-3) 0; } details.kam > summary { cursor: pointer; } details.kam form { margin-top: var(--s-3); }
details.kam > summary { display: grid; gap: 4px; list-style: none; color: var(--text); }
details.kam > summary::-webkit-details-marker { display: none; }
details.kam > summary::after { content: "Bearbeiten ›"; color: var(--accent-ink, var(--accent)); font-size: .9em; }
details.kam[open] > summary::after { content: "Schließen ˅"; }
.kam-kopf, .kam-rollen { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kam-info { font-size: .9em; }
.inv-row { border-top: 1px solid var(--line); padding-top: var(--s-2); } .inv-row form { margin: var(--s-2) 0; }

/* ---------- Aufgaben-Board ---------- */
.aufkopf { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; justify-content: space-between; margin-bottom: var(--s-3); }
.aufkopf .segmented { margin: 0; flex: 1 1 240px; }
.board { display: grid; gap: var(--s-4); }
.spalte { display: none; }
.spalte.aktiv { display: grid; gap: var(--s-2); align-content: start; }
.spalte h2 { display: none; margin: 0 0 var(--s-1); font-size: 1rem; }
@media (min-width: 900px) {
  .spaltenwahl { display: none; }
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .spalte, .spalte.aktiv { display: grid; gap: var(--s-2); align-content: start; background: var(--surface-2); border-radius: var(--r-lg); padding: var(--s-3); }
  .spalte h2 { display: block; }
}
.aufkarte { display: grid; gap: 6px; justify-items: start; justify-content: stretch; align-content: start; text-align: left; width: 100%; padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; box-shadow: var(--sh-1, none); }
.aufkarte.mir { border-left: 4px solid var(--accent); }
.aufkarte strong { font-size: 1rem; }
.aufkarte .muted, .aufkarte .warn { font-size: .875rem; font-weight: 400; }
.aufzu { display: flex; flex-wrap: wrap; gap: 4px; }
.leer { padding: var(--s-2) 0; }
.aufbeschr { white-space: pre-wrap; }
dialog.modal.breit { width: min(640px, calc(100% - 2 * var(--s-4))); }
.modal-in { padding: var(--s-4); overflow: auto; max-height: calc(100dvh - 2 * var(--s-4)); }
.chat { display: grid; gap: var(--s-2); max-height: 40vh; overflow-y: auto; padding: var(--s-2); background: var(--surface-2); border-radius: var(--r-md); margin-bottom: var(--s-2); }
.chat:empty::before { content: "Noch keine Einträge."; color: var(--muted); }
.msg { justify-self: start; max-width: 85%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; padding: var(--s-2) var(--s-3); display: grid; gap: 2px; }
.msg.ich { justify-self: end; background: var(--accent-soft, var(--surface)); border-radius: 12px 12px 4px 12px; }
.msg-kopf { font-size: .75rem; color: var(--muted); }
.msg-text { white-space: pre-wrap; }
.sys { justify-self: center; font-size: .75rem; color: var(--muted); text-align: center; }
.sys span { opacity: .8; }
.chatform { display: flex; gap: var(--s-2); align-items: flex-end; }
.chatform textarea { flex: 1; min-height: 44px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 var(--s-3); }
.suchzeile { display: flex; gap: var(--s-2); }
.suchzeile input { flex: 1; }

/* ---------- Termine ---------- */
.termin { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--s-3); padding: var(--s-2) 0; border-bottom: 1px solid var(--line); }
.termin:last-of-type { border-bottom: 0; }
.termin-zeit { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }
h2.tag { font-size: 1rem; margin: var(--s-4) 0 var(--s-2); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent-ink, var(--accent)); text-decoration: underline; font: inherit; cursor: pointer; min-height: 0; }
#home-termine { margin-top: var(--s-5); }

/* ---------- Benachrichtigungen ---------- */
.bentab { display: grid; gap: var(--s-3); margin: var(--s-3) 0; }
.benzeile { border: 0; padding: 0; margin: 0; }
.benzeile legend { padding: 0; margin-bottom: var(--s-1); font-weight: 600; font-size: .95rem; }
.segmented.klein { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0; }
.segmented.klein label { position: relative; }
.segmented.klein input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented.klein span { display: block; text-align: center; padding: 8px 4px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: .9rem; min-height: 40px; line-height: 22px; }
.segmented.klein input:checked + span { background: var(--accent-soft); color: var(--accent-ink); border: 2px solid var(--accent); font-weight: 600; }
.segmented.klein input:focus-visible + span { outline: 3px solid var(--focus, var(--accent)); outline-offset: 2px; }

/* ---------- Kantine ---------- */
.kanstand { display: grid; gap: 4px; }
.kanstand strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--s-3); margin: var(--s-2) 0; }
.kv span { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .02em; }
.kanrow.storno strong, .kanrow.storno div div { text-decoration: line-through; opacity: .6; }
.kanrow strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
button.row.kanperson { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--text); font: inherit; text-align: left; padding: var(--s-2) 0; min-height: 48px; cursor: pointer; }
button.row.kanperson span:last-child { font-variant-numeric: tabular-nums; }
.sltab { display: grid; margin-top: var(--s-3); }
.slkopf, .slzeile { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(52px, .7fr)) minmax(64px, .7fr); gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); }
.slkopf { font-size: .8rem; color: var(--muted); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.slzeile input { width: 100%; min-height: 40px; padding: 6px; text-align: center; }
.slzeile.hat { background: var(--accent-soft); }
.slname { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; }
.slsum { text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; }
.slzeile.unklar .slsum { color: var(--err); font-weight: 600; }
.sltotal { margin: var(--s-3) 0; font-size: 1.1rem; }
@media (max-width: 480px) { .slkopf, .slzeile { grid-template-columns: minmax(0, 1.2fr) repeat(4, 44px) 52px; gap: 4px; } .slname { font-size: .85rem; } }

/* ---------- Meine Aufgaben ---------- */
.mnleiste { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-bottom: var(--s-3); }
.mnleiste .segmented { margin: 0; flex: 0 1 auto; grid-auto-columns: auto; }
.mnleiste .mnfeld { margin: 0; flex: 0 1 180px; }
.mnleiste .mnfeld:has(input) { flex: 1 1 200px; }
.mnleiste #mn-neu { margin-left: auto; }
.mnfeld select, .mnfeld input { width: 100%; }
/* Halber Bildschirm (900 bis 1199 px): 2 mal 2 Spalten, erst ab 1200 px alle vier nebeneinander. Sonst werden die Karten so schmal, dass Titel, ID und Stoppuhr übereinanderliegen. */
@media (min-width: 900px) { .mnboard { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .mnboard { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mnboard .spalte.ueber { outline: 2px dashed var(--focus); outline-offset: 2px; }
.mnboard .spalte.dropziel, .mnboard .mnkarte.dropziel { outline: 2px dashed var(--focus); outline-offset: 2px; }
.aufuid { font-size: .8rem; font-weight: 400; }
.mnboard .spalte h2 { display: flex; gap: var(--s-2); align-items: baseline; }
.mnboard .spalte h2 .linkbtn { margin-left: auto; font-size: .8rem; font-weight: 400; }
.mnplus { justify-self: start; min-height: 36px; }
.mnkarte { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-2); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-2);
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-1, none); }
.mnkarte[draggable="true"] { cursor: grab; }
.mnkarte.zieht { opacity: .45; }
.mnkarte.z-over { border-left-color: var(--err); } .mnkarte.z-today { border-left-color: var(--warn); } .mnkarte.z-soon { border-left-color: var(--focus); }
.mnkarte.z-waiting { border-left-color: var(--muted); } .mnkarte.z-done { opacity: .75; }
.mnkarte.z-done .mnk-titel { text-decoration: line-through; }
.mnkarte.ff { background: var(--surface-2); }
.mnk { display: grid; gap: 4px; min-width: 0; }
.mnk-titel { background: none; border: 0; padding: 0; min-height: 0; color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer; line-height: 1.35; overflow-wrap: anywhere; }
.mnk-titel:hover { text-decoration: underline; }
.mnk-meta { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: .8125rem; }
.mnk-meta .pill { margin: 0; }
.mnk-fuss, .mnwarten { font-size: .8125rem; }
.mnk-id { position: absolute; top: 6px; right: 8px; font-size: .7rem; }
.mnk { padding-right: 3.2rem; }
.pill.b-fire { color: var(--accent-ink, var(--accent)); } .pill.b-private { color: var(--ok); }
.mnchk { width: 26px; height: 26px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); flex: none; margin-top: 1px; cursor: pointer; }
.mnchk:hover { border-color: var(--ok); }
.mnchk.an, .mnchk[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); }
.mnchk.an::after { content: "✓"; color: #fff; font-weight: 700; font-size: 14px; }
.mnchk.leer { border-style: dashed; cursor: default; background: transparent; display: inline-block; box-sizing: border-box; }
.mnchk-teil { display: flex; align-items: center; justify-content: center; width: 26px; }
.frist { white-space: nowrap; font-weight: 600; }
.frist small { font-weight: 400; color: var(--muted); }
.frist.f-over { color: var(--err); } .frist.f-today { color: var(--warn); } .frist.f-soon { color: var(--focus); }
.mnteile { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 2px; font-size: .875rem; }
.mnteile label { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; cursor: pointer; font-weight: 400; margin: 0; }
.mnteile input { width: 16px; height: 16px; margin: 0; flex: none; transform: translateY(2px); }
.mngruppe { margin-bottom: var(--s-5); }
.mngruppe h2 { font-size: 1rem; margin: 0 0 var(--s-2); }
.mngruppe h2.g-over { color: var(--err); } .mngruppe h2.g-today { color: var(--warn); }
.mnkarten { display: grid; gap: var(--s-2); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.mnzeile { display: grid; grid-template-columns: 26px 7.5rem minmax(0, 1fr); gap: var(--s-3); align-items: start; padding: var(--s-2) 0; border-bottom: 1px solid var(--line); }
.mnz-frist { display: grid; font-weight: 600; font-variant-numeric: tabular-nums; font-size: .9rem; }
.mnz-frist small { font-weight: 400; color: var(--muted); }
.mnzeile.z-over .mnz-frist { color: var(--err); } .mnzeile.z-today .mnz-frist { color: var(--warn); }
.mnz-text { display: grid; gap: 2px; min-width: 0; }
.mnz-text .muted { font-size: .8125rem; }
@media (max-width: 520px) { .mnzeile { grid-template-columns: 26px minmax(0, 1fr); } .mnz-frist { grid-column: 2; } .mnz-text { grid-column: 2; } }
.mngrid { display: grid; gap: 0 var(--s-3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.mngrid3 { display: grid; gap: 0 var(--s-3); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.mnfrist { display: flex; gap: var(--s-2); } .mnfrist input:first-child { flex: 1; min-width: 0; } .mnfrist input[type=date] { width: 3.2rem; flex: none; padding-right: 0; }
.mnteile-ed { list-style: none; margin: 0 0 var(--s-2); padding: 0; display: grid; gap: var(--s-2); }
.mnteil-ed { display: grid; grid-template-columns: auto minmax(0, 1fr) 7.5rem auto; gap: var(--s-2); align-items: center; }
.mnteil-ed input[type=checkbox] { margin: 0; }
.mnanh-liste, .mnanh-neu { list-style: none; margin: 0 0 var(--s-2); padding: 0; display: grid; gap: 4px; }
.mnanh-liste li, .mnanh-neu li { display: flex; flex-wrap: wrap; gap: 4px var(--s-2); align-items: center; overflow-wrap: anywhere; }
.mnanh-liste button, .mnanh-neu button { min-height: 32px; padding: 0 var(--s-2); }
.mnanh { border: 1px dashed transparent !important; border-radius: var(--r-md); }
.mnanh.ueber { border-color: var(--focus) !important; background: var(--surface-2); }
.mndrop { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.mnfill { flex: 1; }
dialog.mnmodal { width: min(760px, calc(100% - 2 * var(--s-4))); }
.mnliste { display: grid; gap: var(--s-2); }
button.mnvh, button.mnms { display: grid; gap: 2px; justify-items: start; text-align: left; width: 100%; min-height: 0; padding: var(--s-3); font: inherit; font-weight: 400;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; }
button.mnvh strong { font-size: 1rem; }
button.mnvh.zu { opacity: .65; }
button.mnms { grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--s-3); }
button.mnms.z-over .mnz-frist { color: var(--err); } button.mnms.z-soon .mnz-frist { color: var(--focus); } button.mnms.z-done { opacity: .65; }
.aufkopf .mnfeld { flex: 0 1 220px; margin: 0; }
.mnchk { min-width: 0; width: 28px; height: 28px; aspect-ratio: 1; align-self: start; justify-self: start; box-sizing: border-box; }
.mnk-titel { display: block; min-width: 0; justify-self: stretch; }
.mnteile label { display: flex; flex-wrap: nowrap; font-size: inherit; margin: 0; }
.mnteile label > span { flex: 1; min-width: 0; }
.mnteile input[type=checkbox] { min-height: 0; margin: 0; }
.mnteil-ed input[type=checkbox] { width: 22px; height: 22px; }
/* Zeiten und Stoppuhr */
.mnplay { position: absolute; right: 6px; bottom: 6px; min-width: 0; min-height: 0; width: 32px; height: 32px; padding: 0; border-radius: 50%;
  background: var(--surface); color: var(--ok); border: 1px solid var(--line); font-size: 12px; }
.mnplay.an { background: var(--ok); color: #fff; border-color: var(--ok); }
.mnkarte.laeuft { box-shadow: 0 0 0 2px var(--ok); }
.mnuhr { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); padding: var(--s-2) var(--s-3); margin: 0 0 var(--s-3);
  background: var(--surface); border: 2px solid var(--ok); border-radius: var(--r-md); }
.mnuhr-zeit { font-family: var(--mono); font-size: 1.25rem; font-weight: 700; color: var(--ok); font-variant-numeric: tabular-nums; }
.mnuhr-titel { font-weight: 600; text-align: left; }
.mnuhr input { flex: 1 1 200px; width: auto; margin: 0; min-height: 40px; }
.mnuhr button:not(.linkbtn) { min-height: 40px; }
.mnwoche { font-size: 1rem; }
.tabwrap { overflow-x: auto; }
table.mnwm { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; background: var(--surface); border-radius: var(--r-md); }
.mnwm th, .mnwm td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.mnwm th[scope=row] { text-align: left; } .mnwm th small { display: block; font-weight: 400; color: var(--muted); }
.mnwm th small.warn { color: var(--warn); }
.mnwm th.heute { color: var(--accent-ink, var(--accent)); }
.mnwm td.leer { color: var(--muted); }
.mnwm td.offen { background: color-mix(in srgb, var(--warn) 14%, transparent); }
.mnwm td.geb { background: color-mix(in srgb, var(--ok) 14%, transparent); }
.mnwm td.sum, .mnwm tfoot td, .mnwm tfoot th { font-weight: 700; }
.mnzelle { min-height: 0; min-width: 0; padding: 2px 6px; background: none; border: 0; color: var(--text); font-weight: 700; display: inline-grid; line-height: 1.2; }
.mnzelle small { font-weight: 400; color: var(--muted); font-size: .7rem; }
.mnzelle[aria-pressed="true"]::after { content: "✓ gebucht"; font-size: .65rem; font-weight: 400; color: var(--ok); }
.mncp { min-height: 0; min-width: 0; padding: 0 4px; font-size: .8rem; color: var(--muted); }
.mnoffen { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-3); margin-bottom: var(--s-2); display: grid; gap: 4px; }
.mnoffen-kopf { display: flex; flex-wrap: wrap; gap: 4px var(--s-2); align-items: center; }
.mnoffen-h { margin-left: auto; font-variant-numeric: tabular-nums; }
.mnoffen-text { margin: 0; }
.mnoffen-z { font-size: .8125rem; }
.mnoffen-z .linkbtn { font-size: inherit; }
.mnzeit-z { display: grid; grid-template-columns: 6.5rem 3.5rem minmax(0, 1fr) auto auto; gap: var(--s-2); align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.mnzeit-z.geb { color: var(--muted); }
.mnzeit-z button { min-height: 32px; padding: 0 var(--s-2); }
.mnzeit-g { display: flex; gap: 4px; align-items: center; margin: 0; font-weight: 400; font-size: .8125rem; }
.mnzeit-g input { width: 18px; height: 18px; min-height: 0; margin: 0; }
.mnzeit-neu { display: grid; grid-template-columns: 9.5rem 5.5rem minmax(0, 1fr) auto; gap: var(--s-2); margin-top: var(--s-2); align-items: center; }
.mnzeit-neu input { margin: 0; }
@media (max-width: 560px) { .mnzeit-neu { grid-template-columns: 1fr 1fr; } .mnzeit-z { grid-template-columns: 5.5rem 3.5rem minmax(0, 1fr) auto; } .mnzeit-z .mnzeit-g { grid-column: 3; } }
/* Eingang */
.mneg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-3); }
.mneg-kopf { display: flex; flex-wrap: wrap; gap: 4px var(--s-2); align-items: center; }
.mneg-kopf .pill { margin: 0; }
.mneg-betreff { font-weight: 600; margin: var(--s-1) 0; overflow-wrap: anywhere; }
.mneg .fieldwrap { margin-bottom: var(--s-3); }
/* UX-Prüfung: Kennzahlen schmal, leeres Diagramm */
@media (max-width: 420px) { .stats.stats3 { gap: var(--s-2); } .stats.stats3 .muted { font-size: .75rem; } .stats.stats3 strong { font-size: 1.05rem; } }
.chartbox.ohnewerte { height: auto !important; min-height: 0; }
.chartbox.ohnewerte canvas { display: none; }
.chartleer { margin: 0; padding: var(--s-5) var(--s-3); text-align: center; color: var(--muted); }
/* FF-Board: Bereiche und Filter in einer Zeile, Neue Aufgabe unten rechts */
.aufleiste { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-3); }
.aufleiste .subnav { margin: 0; }
.aufleiste #auf-filter .segmented { margin: 0; }
.aufhinweis { margin: 0 0 var(--s-3); }
.fab { position: fixed; right: max(var(--s-4), env(safe-area-inset-right, 0px)); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + var(--s-4)); z-index: 15;
  border-radius: var(--r-pill); box-shadow: var(--sh-2); padding: 0 var(--s-5); min-height: 52px; }
.fab::before { content: "+"; font-size: 1.3rem; line-height: 1; }
@media (min-width: 768px) { .fab { bottom: var(--s-5); } }
#auf { padding-bottom: 72px; }
.aufleiste .subnav a, .aufleiste #auf-filter button { min-height: 40px; padding: 0 var(--s-3); }
.aufleiste #auf-filter .segmented { gap: 4px; }
.aufleiste #auf-filter { flex: 0 0 auto; }
.aufleiste #auf-filter .segmented { display: inline-grid; }
.aufleiste .subnav { flex: 0 0 auto; flex-wrap: nowrap; }
.aufleiste { column-gap: var(--s-2); }
@media (max-width: 420px) { .aufleiste .subnav a, .aufleiste #auf-filter button { padding: 0 var(--s-2); } .aufleiste .subnav { gap: 4px; } }
/* Meine Aufgaben: Filter einklappbar, Reiter einzeilig scrollbar, Neue Aufgabe schwebend */
.mnleiste .segmented { grid-auto-columns: auto; }
.mnfilter { display: none; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin: 0 0 var(--s-3); padding: var(--s-3); background: var(--surface-2); border-radius: var(--r-md); }
.mnfilter.offen { display: flex; }
.mnfilter .segmented { margin: 0; grid-auto-columns: auto; }
.mnfilter .mnfeld { flex: 1 1 160px; margin: 0; }
.mnfilterknopf { min-height: 44px; }
.mnquelle { font-size: .8125rem; overflow-wrap: anywhere; }
#mn-inhalt { padding-bottom: 72px; }
@media (max-width: 600px) {
  #view .subnav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: calc(-1 * var(--s-4)); margin-right: calc(-1 * var(--s-4)); padding: 2px var(--s-4); }
  #view .subnav::-webkit-scrollbar { display: none; }
  #view .subnav a { flex: none; }
  .mnleiste { gap: var(--s-2); }
  .mnleiste .segmented button, .mnfilterknopf { padding: 0 var(--s-2); font-size: .9rem; }
}
@media (min-width: 900px) { .mnfilter { display: flex; } .mnfilterknopf { display: none; } }
/* Strichliste: Hinweis nicht unter der Buchen-Leiste */
.sltotal { margin: var(--s-3) 0 var(--s-2); }
/* Spaltenwahl auf schmalen Bildschirmen zweizeilig statt abgeschnitten */
@media (max-width: 480px) { .spaltenwahl { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row; } .spaltenwahl button { padding: 0 var(--s-1); font-size: .9rem; } }
@media (max-width: 600px) { #view .subnav { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); } }
.slkopf abbr { text-decoration: none; }
.slkopf span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .slkopf { font-size: .72rem; } }
/* Einstellungen: eine Spalte, Reiter oben */
.einst { max-width: 680px; }
.einst h2:first-child { margin-top: 0; }
details.modf > summary::after { content: "Ändern ›"; }
details.modf[open] > summary::after { content: "Schließen ˅"; }
.mainnav .navkurz { display: none; }
@media (max-width: 767px) { .mainnav .navlang { display: none; } .mainnav .navkurz { display: inline; } }
/* Kopfleiste: Darstellung und Bereichswechsel */
.topctl { display: flex; gap: var(--s-1); align-items: center; margin-left: auto; }
@media (min-width: 768px) { .topctl { margin-left: 0; order: 3; } .top { gap: var(--s-3); } .top .mainnav { margin-left: auto; } }
.topbtn { min-width: 40px; min-height: 40px; padding: 0; background: transparent; border: 1px solid transparent; color: inherit; border-radius: var(--r-md); }
.topbtn:hover { background: rgba(255, 255, 255, .12); filter: none; }
.topbtn svg { width: 22px; height: 22px; }
.topbtn img { width: 22px; height: 22px; border-radius: 4px; background: #fff; display: block; }
html[data-site="app"] .topbtn, html[data-site="ff"] .topbtn { color: #f4f1ea; }

/* Karten ziehen (Maus und Finger) */
.mnkarte.ziehbar, .aufkarte { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.mnkarte.ziehbar { cursor: grab; }
body.beimziehen, body.beimziehen * { cursor: grabbing !important; user-select: none; }
.zieht { opacity: .35; }
.geist { position: fixed; z-index: 1000; pointer-events: none; margin: 0; opacity: .95; transform: rotate(1.5deg) scale(1.02);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28); background: var(--surface, #fff); }
.zielaktiv { outline: 3px dashed var(--focus) !important; outline-offset: 2px; background: var(--surface-2); }
@media (prefers-reduced-motion: reduce) { .geist { transform: none; } }

/* Mindestens 44 px Trefferfläche für kleine Bedienelemente (Apple HIG), ohne das Aussehen zu ändern */
.mnchk, .mncp, .linkbtn { position: relative; }
.mnchk::before, .mnplay::before, .mncp::before { content: ""; position: absolute; inset: -9px; }
.linkbtn::before { content: ""; position: absolute; inset: -12px -4px; }
.mnoffen-z .linkbtn { display: inline-block; padding: 6px 0; }
.mncp { min-width: 32px; min-height: 32px; }

/* ---------- Sprungseite: zugeklappte Bereiche, schmale feste Zeile nur bei offenem Bereich ---------- */
.sprung { position: sticky; top: var(--kopf-h, 57px); z-index: 10; display: flex; align-items: center; gap: var(--s-2);
  margin: 0 calc(-1 * var(--s-4)) var(--s-3); padding: var(--s-1) var(--s-4); background: var(--bg); border-bottom: 1px solid var(--line); }
.sprung[hidden] { display: none; }
.sprung-zurueck { flex: none; min-height: 44px; padding: 0 var(--s-2) 0 0; background: none; border: 0; color: var(--accent-ink, var(--accent)); font-weight: 600; }
.sprung select { flex: 1; min-width: 0; min-height: 44px; border: 0; background: transparent; font-weight: 700; font-size: 1rem; color: var(--text);
  text-align: right; text-align-last: right; padding-right: var(--s-1); }
.sprung select:focus-visible { outline: 2px solid var(--focus); }
details.abschn { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); margin: 0 0 var(--s-3);
  scroll-margin-top: calc(var(--kopf-h, 57px) + 56px); }
details.abschn > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s-3); align-items: center; list-style: none;
  padding: var(--s-3) var(--s-4); min-height: 56px; color: var(--text); font-size: 1rem; }
details.abschn > summary::-webkit-details-marker { display: none; }
details.abschn > summary::after { content: "›"; grid-row: 1 / span 2; grid-column: 2; font-size: 1.4rem; color: var(--muted); transition: transform .15s; }
details.abschn[open] > summary::after { transform: rotate(90deg); }
.abschn-titel { font-weight: 700; font-size: 1.05rem; }
.abschn-info { grid-column: 1; color: var(--muted); font-weight: 400; font-size: .875rem; }
.abschn-info.warn { color: var(--warn); font-weight: 600; }
.abschn-inhalt { padding: 0 var(--s-4) var(--s-4); }
.abschn-inhalt > .card, .abschn-inhalt > div > .card { box-shadow: none; border: 0; padding: 0; margin: 0; background: transparent; }
.abschn-inhalt > div > form.card { padding: 0; border: 0; background: transparent; }
.listsuche { margin: 0 0 var(--s-3); }
.listsuche input { width: 100%; }
@media (prefers-reduced-motion: reduce) { details.abschn > summary::after { transition: none; } }

/* Karten: Platz für ID oben rechts und Stoppuhr unten rechts freihalten, damit kein Text darunter läuft */
.mnk-titel { padding-right: 46px; }
.mnkarte:has(.mnplay) .mnk { padding-bottom: 6px; padding-right: 30px; }
.mnkarte:has(.mnplay) .mnk-titel { padding-right: 16px; }
.mnk-titel, .aufkarte strong, .tile strong { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; }
.mnk-titel { overflow-wrap: break-word; }
/* Kopfleiste zwischen Handy und großem Bildschirm: Name ausblenden, Navigation enger, damit nichts übereinanderläuft */
@media (min-width: 768px) and (max-width: 1023px) {
  .brand > span, .brand .brand-name { display: none; }
  .top { gap: var(--s-2); }
  .mainnav a { padding: 0 var(--s-2); }
}

/* Modulfreigaben: je Adresse eine Gruppe, je Modul eine Zeile mit Schieberegler */
.modsite { margin: 0 0 var(--s-4); }
.modsite-kopf { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-4) 0 var(--s-2); padding: var(--s-2) var(--s-3); border-radius: var(--r-md); font-size: 1rem; }
.modsite-kopf img { width: 28px; height: 28px; border-radius: 6px; flex: none; }
.modsite-kopf > span { display: grid; } .modsite-kopf .muted { font-weight: 400; font-size: .8rem; }
.site-app .modsite-kopf { background: #1f2a37; color: #f4f1ea; } .site-app .modsite-kopf .muted { color: #c9cfd6; }
.site-ff .modsite-kopf { background: #11120d; color: #fff; box-shadow: inset 0 -3px 0 #ffee1c; } .site-ff .modsite-kopf .muted { color: #d6d6cf; }
.modzeile { border-bottom: 1px solid var(--line); padding: var(--s-3) 0; }
.modzeile.aus .modtext strong, .modzeile.aus .modtext .muted { opacity: .6; }
.modkopf { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; }
.modtext { display: grid; gap: 2px; } .modtext label { margin: 0; cursor: pointer; } .modtext .muted { font-size: .85rem; }
.modzustand { font-size: .85rem; font-weight: 600; } .modzeile.aus .modzustand { color: var(--muted); } .modzustand.warn { color: var(--warn); }
.modzeile details.modf { margin-top: var(--s-2); } .modzeile details.modf > summary { font-size: .85rem; }
/* Schieberegler */
input.schalter { appearance: none; -webkit-appearance: none; position: relative; width: 52px; height: 32px; min-height: 0; margin: 0; padding: 0; flex: none;
  border-radius: 16px; border: 0; background: var(--border); cursor: pointer; transition: background var(--t-fast, .15s); }
input.schalter::before { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform var(--t-fast, .15s); }
input.schalter::after { content: ""; position: absolute; inset: -6px; }
input.schalter:checked { background: var(--ok); }
input.schalter:checked::before { transform: translateX(20px); }
input.schalter:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input.schalter:disabled { opacity: .6; }
@media (prefers-reduced-motion: reduce) { input.schalter, input.schalter::before { transition: none; } }
.modzeile details.modf > summary::after { content: " ›"; }
.modzeile details.modf[open] > summary::after { content: " ˅"; }
.modzeile details.modf > summary { display: inline-flex; min-height: 44px; }
/* Einsatz und Atemschutz: Melden in der App */
.card.melden { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); }
.card.melden p { margin: 2px 0 0; }
.zurapp { margin-left: auto; flex: none; white-space: nowrap; min-height: 40px; padding: 0 var(--s-3); font-size: .9rem; color: #fff !important; border: 1px solid rgba(255, 255, 255, .45); }
.top .brand { min-width: 0; }
/* Modulfreigaben: App-Auswahl oben im Stil der jeweiligen App */
.modwahl { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--r-md); margin: 0 0 var(--s-3); }
.modwahl img { width: 28px; height: 28px; border-radius: 6px; flex: none; }
.modwahl select { flex: 1; min-width: 0; min-height: 44px; font-weight: 700; background: transparent; border: 1px solid rgba(255, 255, 255, .35); color: inherit; }
.modwahl select option { color: #111; }
.modwahl.site-app { background: #1f2a37; color: #f4f1ea; }
.modwahl.site-ff { background: #11120d; color: #fff; box-shadow: inset 0 -3px 0 #ffee1c; }
.modwahl { flex-wrap: wrap; } .modwahl select { order: 2; } .modwahl img { order: 1; } .modwahl-host { order: 3; flex-basis: 100%; font-size: .8rem; opacity: .8; padding-left: 40px; }
