/* =========================================================================
   Gestaltung der Verwaltungsoberfläche.
   Farben liegen als Variablen vor und werden für den dunklen Modus
   getauscht; alles Übrige bezieht sich nur auf diese Variablen.
   ========================================================================= */

:root {
  color-scheme: light;

  --grund: #f5f7fa;
  --flaeche: #ffffff;
  --flaeche-leise: #f8fafc;
  --flaeche-aktiv: #eef3f8;

  --linie: #e3e9f0;
  --linie-stark: #cdd8e4;

  --text: #15202b;
  --text-leise: #5a6b7d;
  --text-schwach: #8798a9;

  --marke: #0f4d7d;
  --marke-stark: #0b3a60;
  --marke-zart: #eaf2f9;
  --marke-rand: #c5dbec;

  --gruen: #17724d;
  --gruen-zart: #e4f3ec;
  --rot: #a8261f;
  --rot-zart: #fceceb;
  --gelb: #7d5700;
  --gelb-zart: #fbf1d9;

  /* Navigation: fast schwarz statt blau — das Markenblau bleibt dadurch dem
     vorbehalten, was anklickbar ist, und die Oberfläche wirkt ruhiger. */
  --leiste: #101922;
  --leiste-text: #aab8c6;
  --leiste-gruppe: #5d6f81;
  --leiste-aktiv: #ffffff;
  --leiste-linie: rgba(255, 255, 255, .07);
  /* Der Logobereich oben links ist hell, damit jede hochgeladene Logodatei
     dort passt — auch ein JPG mit weißem Rand. */
  --logo-grund: #ffffff;
  --logo-text: #15202b;
  --logo-leise: #6b7c8d;

  --radius: 12px;
  --radius-klein: 8px;
  --radius-winzig: 6px;

  --schatten-1: 0 1px 2px rgba(15, 34, 54, .06), 0 1px 3px rgba(15, 34, 54, .04);
  --schatten-2: 0 4px 12px rgba(15, 34, 54, .08), 0 2px 4px rgba(15, 34, 54, .04);
  --schatten-3: 0 16px 48px rgba(15, 34, 54, .22);

  --schrift: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;
  --uebergang: 140ms cubic-bezier(.2, 0, .2, 1);

  --leiste-breite: 236px;
  --tableiste-hoehe: 0px;
  /* Logobereich und Seitenkopf sind gleich hoch, damit oben eine
     durchgehende Leiste entsteht statt zweier versetzter Kästen. */
  --kopf-hoehe: 62px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --grund: #0f151b;
    --flaeche: #171f28;
    --flaeche-leise: #1c2530;
    --flaeche-aktiv: #222d3a;

    --linie: #27323f;
    --linie-stark: #3a4756;

    --text: #e7edf4;
    --text-leise: #9dadbe;
    --text-schwach: #78899a;

    --marke: #6bb2e2;
    --marke-stark: #8cc6ee;
    --marke-zart: #16293a;
    --marke-rand: #27455e;

    --gruen: #5cc79a;
    --gruen-zart: #142a22;
    --rot: #f28b83;
    --rot-zart: #2d1a19;
    --gelb: #e0b458;
    --gelb-zart: #2b2314;

    --leiste: #0c141c;
    --leiste-text: #a9bccd;
    --leiste-gruppe: #6b7d8f;
    --leiste-aktiv: #ffffff;
    --leiste-linie: rgba(255, 255, 255, .08);
    /* Im dunklen Modus wird auch der Logobereich dunkel — ein weißes Feld
       mitten in einer dunklen Oberfläche würde blenden. Logos mit hellem
       Hintergrund bekommen deshalb hier einen hellen Träger (siehe .marke). */
    --logo-grund: #141d27;
    --logo-text: #e7edf4;
    --logo-leise: #8ea0b2;

    --schatten-1: 0 1px 2px rgba(0, 0, 0, .4);
    --schatten-2: 0 4px 12px rgba(0, 0, 0, .45);
    --schatten-3: 0 16px 48px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--schrift);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--grund);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; letter-spacing: -.011em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 .7rem; }
a { color: var(--marke); text-decoration-color: color-mix(in srgb, var(--marke) 35%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }

/* Zahlen in Tabellen sollen untereinander stehen */
td, .wert, .zeit, .kennzahl { font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2px solid var(--marke);
  outline-offset: 2px;
  border-radius: var(--radius-winzig);
}

/* ---------- Grundgerüst ---------- */

.rahmen { display: flex; min-height: 100dvh; }

.seitenleiste {
  width: var(--leiste-breite);
  flex: 0 0 var(--leiste-breite);
  background: var(--leiste);
  color: var(--leiste-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
}

/* Der Logobereich: heller Streifen über der dunklen Navigation. Das Logo
   liegt zusätzlich auf einer weißen Kachel, damit auch eine Datei ohne
   transparenten Hintergrund sauber aussieht — und damit sie im dunklen
   Modus nicht in der Fläche verschwindet. */
.marke {
  display: flex;
  align-items: center;
  gap: .6rem;
  height: var(--kopf-hoehe);
  padding: 0 1rem;
  background: var(--logo-grund);
  color: var(--logo-text);
  border-bottom: 1px solid var(--linie);
  min-width: 0;
  flex: 0 0 auto;
}
.marke img {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-winzig);
  flex: 0 0 auto;
  object-fit: contain;
  background: #fff;
}
/* Ein breites Logo darf die Höhe behalten und in die Breite gehen, statt in
   ein Quadrat gequetscht zu werden. Die Grenze ist eng gesetzt: Daneben muss
   der Firmenname noch lesbar in die 236 px der Leiste passen. */
.marke img.breit { width: auto; max-width: 84px; max-height: 30px; }
.marke .namen { min-width: 0; }
.marke .firma {
  font-weight: 640;
  font-size: .92rem;
  color: var(--logo-text);
  line-height: 1.25;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.marke small {
  display: block;
  font-size: .68rem;
  color: var(--logo-leise);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Nur das Logo, ohne Namenszeile — wenn der Betrieb ein Logo hochlädt, in
   dem der Firmenname schon steht. */
.marke.nurbild img { width: auto; max-width: 100%; max-height: 42px; }

.seitenleiste nav { padding: .7rem .55rem; overflow-y: auto; flex: 1; }
.navgruppe {
  font-size: .655rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--leiste-gruppe);
  font-weight: 650;
  padding: .85rem .6rem .3rem;
}
.navgruppe:first-child { padding-top: .15rem; }
.seitenleiste nav a {
  display: flex;
  align-items: center;
  gap: .62rem;
  padding: .48rem .62rem;
  margin-bottom: 1px;
  border-radius: 7px;
  color: var(--leiste-text);
  text-decoration: none;
  font-size: .875rem;
  transition: background var(--uebergang), color var(--uebergang);
}
.seitenleiste nav a svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: .75; }
.seitenleiste nav a > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seitenleiste nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.seitenleiste nav a.aktiv { background: rgba(255, 255, 255, .10); color: var(--leiste-aktiv); font-weight: 560; }
.seitenleiste nav a.aktiv svg { opacity: 1; }

/* Zähler am rechten Rand eines Navigationspunktes (offene Mängel, fällige
   Dauerrechnungen). „dringend" hebt hervor, was liegen bleibt. */
.navzahl {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: .69rem;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, .12);
  color: #d6e2ee;
  border-radius: 99px;
  padding: .05rem .42rem;
  line-height: 1.5;
}
.navzahl.dringend { background: #b4541f; color: #fff; font-weight: 650; }

.seitenleiste .fuss {
  padding: .7rem .8rem calc(.7rem + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, .09);
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.seitenleiste .fuss a, .seitenleiste .fuss button {
  font-size: .84rem;
  color: var(--leiste-text);
  text-decoration: none;
  background: rgba(255, 255, 255, .08);
  border: none;
  border-radius: var(--radius-winzig);
  padding: .45rem .6rem;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--uebergang);
}
.seitenleiste .fuss a:hover, .seitenleiste .fuss button:hover { background: rgba(255, 255, 255, .16); color: #fff; }

.inhalt {
  flex: 1;
  min-width: 0;
  padding: 0 1.6rem calc(3rem + var(--tableiste-hoehe));
  animation: einblenden 180ms ease-out;
}

@keyframes einblenden {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* Der Seitenkopf ist eine eigene Leiste: Er bleibt beim Blättern oben stehen,
   damit „+ Neu" und die Filter auch bei 200 Objekten erreichbar bleiben.
   Die negativen Ränder heben die Polsterung von .inhalt auf, sodass die
   Trennlinie über die volle Breite läuft. */
.kopf {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 -1.6rem 1.25rem;
  padding: .6rem 1.6rem;
  min-height: var(--kopf-hoehe);
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
}
.kopf h1 { font-size: 1.22rem; margin: 0; }
.kopf p { margin: .1rem 0 0; color: var(--text-leise); font-size: .855rem; }

/* ---------- Karten & Raster ---------- */

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten-1);
  padding: 1.05rem 1.15rem;
  margin-bottom: 1.1rem;
}
.karte > h2:first-child, .karte > h3:first-child { margin-top: 0; }
.karte > .tabellenrahmen:last-child, .karte > .leer:last-child { margin-bottom: -.35rem; }

.raster { display: grid; gap: 1.1rem; }
/* Rasterkinder haben von Haus aus min-width: auto und wachsen dann auf die
   Breite ihres Inhalts. Eine breite Tabelle sprengte so am Handy die Spalte
   und die ganze Seite, statt in ihrem .tabellenrahmen zu scrollen. */
.raster > * { min-width: 0; }
.raster.k2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.raster.k3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.raster.k4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.kennzahl {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  box-shadow: var(--schatten-1);
}
.kennzahl .titel {
  font-size: .74rem;
  color: var(--text-leise);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}
.kennzahl .wert { font-size: 1.65rem; font-weight: 650; line-height: 1.15; margin-top: .2rem; letter-spacing: -.025em; }
.kennzahl .zusatz { font-size: .8rem; color: var(--text-leise); margin-top: .25rem; }
.kennzahl.warn .wert { color: var(--rot); }
.kennzahl.gut .wert { color: var(--gruen); }

/* ---------- Tabellen ---------- */

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--linie); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }

/* Dichte Darstellung für lange Listen. ui.js setzt das ab einer gewissen
   Zeilenzahl selbst — kurze Listen bleiben luftig, lange werden lesbar
   kompakt, ohne dass irgendwo Text abgeschnitten wird. */
.tabellenrahmen.dicht table { font-size: .855rem; }
.tabellenrahmen.dicht th, .tabellenrahmen.dicht td { padding: .32rem .5rem; line-height: 1.4; }
.tabellenrahmen.dicht th { font-size: .66rem; }

/* Verweise in Listen bleiben Text: In einer Tabelle ist fast jede Zeile
   anklickbar — durchgehend blau und unterstrichen wird das zum Flimmern.
   Die Farbe kommt beim Zeigen, die erste Spalte trägt etwas mehr Gewicht. */
td a { color: var(--text); text-decoration: none; }
td a:hover { color: var(--marke); text-decoration: underline; text-underline-offset: 2px; }
tbody td:first-child a { font-weight: 560; }
th {
  font-size: .73rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-leise);
  font-weight: 650;
  white-space: nowrap;
  border-bottom-color: var(--linie-stark);
}
tbody tr { transition: background var(--uebergang); }
tbody tr:hover { background: var(--flaeche-leise); }
/* Rechtsbündige Spalten enthalten Zahlen, Zeiten oder Beträge — die sollen
   nicht mitten im Wert umbrechen. */
td.rechts, th.rechts { text-align: right; white-space: nowrap; }
td.knopfzelle { white-space: nowrap; width: 1%; }
/* Die Knöpfe am Zeilenende bleiben nebeneinander, auch wenn die Tabelle
   breit wird — untereinander gestapelt reißen sie die Zeilenhöhe auf. */
td.knopfzelle .knopfgruppe { flex-wrap: nowrap; }
.tabellenrahmen { overflow-x: auto; margin: 0 -.35rem; padding: 0 .35rem; }
.leer { padding: 1.6rem 1rem; text-align: center; color: var(--text-leise); font-size: .9rem; }

/* ---------- Formulare ---------- */

label { display: block; font-size: .8rem; font-weight: 620; color: var(--text-leise); margin-bottom: .25rem; }
input, select, textarea {
  width: 100%;
  padding: .48rem .6rem;
  border: 1px solid var(--linie-stark);
  border-radius: var(--radius-winzig);
  font: inherit;
  background: var(--flaeche);
  color: var(--text);
  transition: border-color var(--uebergang), box-shadow var(--uebergang);
}
input:hover, select:hover, textarea:hover { border-color: var(--text-schwach); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--marke);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--marke) 18%, transparent);
}
textarea { min-height: 74px; resize: vertical; }
.feld { margin-bottom: .8rem; }
.feldreihe { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }
.kontrollkaestchen {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-weight: 400;
  color: var(--text);
  font-size: .9rem;
  margin-bottom: 0;
  cursor: pointer;
}
.kontrollkaestchen input { width: auto; accent-color: var(--marke); }
fieldset {
  border: 1px solid var(--linie);
  border-radius: var(--radius-klein);
  padding: .85rem .9rem;
  margin: 0 0 .9rem;
  background: var(--flaeche-leise);
}
legend { font-size: .78rem; font-weight: 650; color: var(--text-leise); padding: 0 .35rem; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Knöpfe ---------- */

button, .knopf {
  font: inherit;
  font-weight: 520;
  padding: .45rem .85rem;
  border-radius: var(--radius-winzig);
  border: 1px solid var(--linie-stark);
  background: var(--flaeche);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background var(--uebergang), border-color var(--uebergang), transform var(--uebergang);
}
button:hover, .knopf:hover { background: var(--flaeche-aktiv); border-color: var(--text-schwach); }
button:active, .knopf:active { transform: translateY(1px); }
button.haupt, .knopf.haupt {
  background: var(--marke);
  border-color: var(--marke);
  color: #fff;
  font-weight: 620;
}
button.haupt:hover, .knopf.haupt:hover { background: var(--marke-stark); border-color: var(--marke-stark); }
button.gefahr { color: var(--rot); border-color: color-mix(in srgb, var(--rot) 32%, var(--linie)); }
button.gefahr:hover { background: var(--rot-zart); border-color: var(--rot); }
button.klein, .knopf.klein { padding: .25rem .55rem; font-size: .83rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.knopfgruppe { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Symbole behalten ihre Größe, auch in engen Flex-Zeilen */
.symbol { flex: 0 0 auto; }

/* ---------- Status ---------- */

.marke-status {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 99px;
  font-size: .76rem;
  font-weight: 620;
  white-space: nowrap;
  border: 1px solid transparent;
}
.s-grau { background: var(--flaeche-aktiv); color: var(--text-leise); border-color: var(--linie); }
.s-blau { background: var(--marke-zart); color: var(--marke); border-color: var(--marke-rand); }
.s-gruen { background: var(--gruen-zart); color: var(--gruen); border-color: color-mix(in srgb, var(--gruen) 25%, transparent); }
.s-rot { background: var(--rot-zart); color: var(--rot); border-color: color-mix(in srgb, var(--rot) 25%, transparent); }
.s-gelb { background: var(--gelb-zart); color: var(--gelb); border-color: color-mix(in srgb, var(--gelb) 25%, transparent); }

/* ---------- Dialog ---------- */

.abdunkeln {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 36, .5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  z-index: 50;
  animation: abdunkelnEin 140ms ease-out;
}
@keyframes abdunkelnEin { from { opacity: 0; } to { opacity: 1; } }

.dialog {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  width: 100%;
  max-width: 660px;
  box-shadow: var(--schatten-3);
  animation: dialogEin 180ms cubic-bezier(.2, .8, .3, 1);
}
@keyframes dialogEin { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.dialog.breit { max-width: 920px; }
.dialog header {
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--linie);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.dialog header h2 { margin: 0; }
.dialog .koerper { padding: 1.1rem; }
.dialog footer {
  padding: .8rem 1.1rem calc(.8rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--linie);
  display: flex;
  justify-content: flex-end;
  gap: .55rem;
  background: var(--flaeche-leise);
  border-radius: 0 0 var(--radius) var(--radius);
  flex-wrap: wrap;
}
.schliessen {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0 .35rem;
  color: var(--text-leise);
}
.schliessen:hover { background: var(--flaeche-aktiv); color: var(--text); }

/* Sichtbare Lücke in den Rechtstexten: was nicht eingetragen ist, soll
   auffallen und nicht wie eine bewusst leere Stelle aussehen. */
.rechtsluecke {
  background: var(--gelb-zart, #fdf3d7);
  color: var(--rot, #a3222a);
  border: 1px dashed currentColor;
  border-radius: var(--radius-winzig, 4px);
  padding: 0 .3rem;
  font-size: .92em;
  font-weight: 600;
}

/* ---------- Meldungen ---------- */

.meldungen {
  position: fixed;
  /* logisch statt „rechts": in der Mitarbeiter-App kann die Seite auf
     Arabisch von rechts nach links laufen, dann gehören die Meldungen nach
     links. In deutscher Leserichtung ändert sich nichts. */
  inset-inline-end: 1rem;
  bottom: calc(1rem + var(--tableiste-hoehe) + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: .5rem;
  z-index: 80;
  pointer-events: none;
}
.meldung {
  padding: .6rem .9rem;
  border-radius: var(--radius-klein);
  box-shadow: var(--schatten-2);
  font-size: .89rem;
  max-width: 340px;
  color: #fff;
  animation: meldungEin 200ms cubic-bezier(.2, .8, .3, 1);
}
@keyframes meldungEin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.meldung.ok { background: #17724d; }
.meldung.fehler { background: #a8261f; }

/* ---------- Einsatzplan ---------- */

.plantag { margin-bottom: 1.2rem; }
.plantag:last-child { margin-bottom: 0; }
.plantag h3 {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  padding-bottom: .35rem;
  margin-bottom: .2rem;
  border-bottom: 2px solid var(--marke-zart);
  flex-wrap: wrap;
}
.plantag h3 small { font-weight: 400; color: var(--text-leise); font-size: .8rem; }
.planzeile {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .25rem;
  border-bottom: 1px solid var(--linie);
  border-radius: var(--radius-winzig);
  transition: background var(--uebergang);
}
.planzeile:last-child { border-bottom: none; }
.planzeile:hover { background: var(--flaeche-leise); }
.planzeile input[type=checkbox] { width: 19px; height: 19px; flex: 0 0 auto; accent-color: var(--gruen); cursor: pointer; }
.planzeile .haupttext { flex: 1; min-width: 0; }
.planzeile .haupttext strong { display: block; font-weight: 580; }
.planzeile .haupttext span { font-size: .82rem; color: var(--text-leise); }
.planzeile.fertig .haupttext strong { text-decoration: line-through; color: var(--text-leise); }
.planzeile .zeit { font-size: .82rem; color: var(--text-leise); white-space: nowrap; }
.planmeta { display: flex; align-items: center; gap: .75rem; flex: 0 0 auto; }

/* ---------- Beleg / Druck ---------- */

.beleg { background: var(--flaeche); padding: 2rem; max-width: 820px; margin: 0 auto; }
.beleg .kopfzeile { display: flex; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; flex-wrap: wrap; }
.beleg .absender { font-size: .8rem; color: var(--text-leise); }
.beleg table { margin: 1rem 0; }
.beleg .summen { margin-left: auto; width: 290px; }
.beleg .summen td { border: none; padding: .2rem 0; }
.beleg .summen tr.gesamt td { border-top: 2px solid var(--text); font-weight: 700; padding-top: .4rem; }
.beleg .fusszeile { margin-top: 2.5rem; font-size: .76rem; color: var(--text-leise); border-top: 1px solid var(--linie); padding-top: .6rem; }

/* ---------- Leiste unten (Handy) ---------- */

.tableiste { display: none; }

/* ---------- Handy ---------- */

@media (max-width: 860px) {
  :root { --tableiste-hoehe: 60px; }

  .rahmen { flex-direction: column; }

  /* Seitenleiste wird zur Kopfzeile; die Navigation wandert nach unten */
  .seitenleiste {
    width: 100%;
    flex: none;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 30;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-right: .6rem;
  }
  /* Am Handy besteht die Leiste nur noch aus dem Logobereich — dann soll
     auch der Rest der Zeile hell sein, statt rechts dunkel auszulaufen. */
  .seitenleiste { background: var(--logo-grund); border-bottom: 1px solid var(--linie); }
  .seitenleiste .marke { border-bottom: none; padding: .65rem .9rem; flex: 1; min-width: 0; }
  .seitenleiste .marke .firma {
    -webkit-line-clamp: 1;
    font-size: .95rem;
    white-space: nowrap;
  }
  /* Untertitel und Fußknöpfe wandern ins Blatt „Mehr" — die Kopfzeile
     bleibt dem Firmennamen vorbehalten. */
  .seitenleiste .marke small { display: none; }
  .seitenleiste nav,
  .seitenleiste .fuss { display: none; }

  .inhalt { padding: 0 .85rem calc(1.5rem + var(--tableiste-hoehe)); }

  .tableiste {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    position: fixed;
    left: 0;
    right: 0;
    /* An der sichtbaren Fensterhöhe ausrichten: manche mobilen Browser
       melden ein höheres Layout-Fenster als das, was zu sehen ist. */
    top: auto;
    bottom: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--flaeche) 92%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--linie);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tableiste a, .tableiste button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: .45rem .2rem .4rem;
    font-size: .68rem;
    font-weight: 560;
    color: var(--text-leise);
    text-decoration: none;
    background: none;
    border: none;
    border-radius: 0;
    min-height: var(--tableiste-hoehe);
    transition: color var(--uebergang);
  }
  .tableiste a svg, .tableiste button svg { width: 21px; height: 21px; }
  .tableiste a.aktiv { color: var(--marke); }
  .tableiste a:active, .tableiste button:active { background: var(--flaeche-aktiv); transform: none; }

  /* Planzeile: Haken und Text oben, Zuständigkeit und Dauer darunter */
  .planzeile { flex-wrap: wrap; column-gap: .65rem; row-gap: .15rem; align-items: flex-start; }
  .planzeile input[type=checkbox] { margin-top: .2rem; }
  .planmeta { flex: 1 0 100%; margin-left: calc(19px + .65rem); gap: .5rem; }
  .planmeta .zeit { font-size: .8rem; }
  .planmeta .zeit + .zeit::before { content: "· "; margin-right: .2rem; }

  /* Der Seitenkopf klebt unter der Kopfleiste, nicht darunter verschwindend.
     Die seitlichen Ränder werden an die schmalere Polsterung angepasst. */
  .kopf {
    top: var(--kopf-hoehe);
    margin: 0 -.85rem .9rem;
    padding: .55rem .85rem;
    min-height: 0;
  }
  .kopf h1 { font-size: 1.12rem; }
  h1 { font-size: 1.28rem; }
  .karte { padding: .9rem .95rem; border-radius: var(--radius-klein); }
  .raster.k2, .raster.k3, .raster.k4 { grid-template-columns: 1fr; gap: .8rem; }
  .raster.k4 { grid-template-columns: repeat(2, 1fr); }
  .kennzahl .wert { font-size: 1.45rem; }
  .abdunkeln { padding: 0; align-items: flex-end; }
  .dialog { max-width: none; border-radius: var(--radius) var(--radius) 0 0; animation: blattEin 220ms cubic-bezier(.2, .8, .3, 1); }
  @keyframes blattEin { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
  .dialog footer { position: sticky; bottom: 0; }
  .meldungen { left: .8rem; right: .8rem; align-items: stretch; }
  .meldung { max-width: none; }
  /* Auf kleinen Geräten sind größere Tippflächen wichtiger als Kompaktheit */
  input, select, textarea { font-size: 16px; padding: .55rem .65rem; }
  button, .knopf { padding: .5rem .9rem; }
}

/* ---------- Zugangsseiten (Anmelden, Registrieren, Einladung) ---------- */

.zugangsseite {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 1.5rem 1rem;
}
.zugang { width: 100%; max-width: 380px; }
.zugang .karte { margin-bottom: 0; padding: 1.4rem 1.3rem; }
.zeichen { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.2rem; }
.zeichen img { width: 42px; height: 42px; border-radius: 10px; flex: 0 0 auto; }
.zeichen h1 { font-size: 1.15rem; margin: 0; }
.zeichen p { margin: 0; font-size: .82rem; color: var(--text-leise); }
.zugangsfehler {
  background: var(--rot-zart);
  color: var(--rot);
  border: 1px solid color-mix(in srgb, var(--rot) 25%, transparent);
  border-radius: var(--radius-winzig);
  padding: .5rem .7rem;
  font-size: .87rem;
  margin: 0 0 .8rem;
}
.zugangsfuss { margin: .9rem 0 0; font-size: .85rem; color: var(--text-leise); text-align: center; }
.feldhinweis { margin: .25rem 0 0; font-size: .78rem; color: var(--text-leise); }
/* Als label.zustimmung, weil die allgemeine label-Regel oben block und klein setzt */
label.zustimmung { display: flex; gap: .55rem; align-items: flex-start; font-size: .87rem; font-weight: 400; line-height: 1.4; color: var(--text); margin: 0; }
label.zustimmung input { margin: .2rem 0 0; flex: 0 0 auto; width: auto; }
label.zustimmung span { flex: 1 1 auto; min-width: 0; }

/* ---------- Team, Konto, Tarif ---------- */

.mitgliedzeile { display: flex; align-items: center; gap: .6rem; }
.linkkasten {
  display: flex;
  gap: .5rem;
  align-items: center;
  background: var(--flaeche-leise);
  border: 1px solid var(--linie);
  border-radius: var(--radius-winzig);
  padding: .5rem .6rem;
  margin-top: .6rem;
}
.linkkasten input { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .8rem; }

.tarifliste { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.tarifkarte {
  border: 1px solid var(--linie);
  border-radius: var(--radius-klein);
  padding: .9rem 1rem;
  background: var(--flaeche);
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.tarifkarte.gewaehlt { border-color: var(--marke); box-shadow: 0 0 0 2px color-mix(in srgb, var(--marke) 22%, transparent); }
.tarifkarte .preis { font-size: 1.5rem; font-weight: 660; letter-spacing: -.02em; }
.tarifkarte .funktionen { list-style: none; padding: 0; margin: 0 0 .6rem; font-size: .84rem; }
.tarifkarte .funktionen li { padding: .12rem 0; }
.tarifkarte .funktionen .drin { color: var(--text); }
.tarifkarte .funktionen .fehlt { color: var(--text-leise); opacity: .7; }
.tarifkarte .preis small { font-size: .8rem; font-weight: 400; color: var(--text-leise); }
.tarifkarte ul { margin: .3rem 0 .6rem; padding-left: 1.1rem; font-size: .86rem; color: var(--text-leise); }
.tarifkarte button { margin-top: auto; }

.balken { height: 6px; border-radius: 99px; background: var(--flaeche-aktiv); overflow: hidden; margin-top: .35rem; }
.balken span { display: block; height: 100%; background: var(--marke); border-radius: 99px; }
.balken.voll span { background: var(--rot); }

/* ---------- Rechtstexte (Impressum, Datenschutz, AGB, AVV, TOM) ---------- */

.rechtsseite {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.2rem 3rem;
  line-height: 1.6;
}
.rechtsseite h1 { font-size: 1.5rem; margin-bottom: .3rem; }
.rechtsseite h2 { font-size: 1.15rem; margin-top: 1.8rem; }
.rechtsseite .stand { color: var(--text-leise); font-size: .85rem; margin-bottom: 1.6rem; }
.rechtsseite table { width: 100%; border-collapse: collapse; margin: .8rem 0; }
.rechtsseite th, .rechtsseite td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--linie); font-size: .92rem; }
.rechtshinweis {
  background: var(--rot-zart);
  color: var(--rot);
  border: 1px solid color-mix(in srgb, var(--rot) 25%, transparent);
  border-radius: var(--radius-klein);
  padding: .9rem 1rem;
  font-size: .9rem;
  margin-bottom: 1.6rem;
}
.rechtsseite a { color: var(--marke); }
.rechtsfuss { margin-top: 2.5rem; font-size: .82rem; color: var(--text-leise); }
.rechtsfuss a { color: inherit; }

/* ---------- Support-Zugang (Hinweisleiste) ---------- */

#support-banner[hidden] { display: none; }
#support-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .9rem;
  padding: .55rem 1rem;
  padding-top: calc(.55rem + env(safe-area-inset-top, 0px));
  background: var(--gelb-zart);
  color: var(--gelb);
  border-bottom: 1px solid color-mix(in srgb, var(--gelb) 30%, transparent);
  font-size: .86rem;
  line-height: 1.4;
}
#support-banner strong { font-weight: 660; }
#support-banner .text { flex: 1 1 260px; }
#support-banner button {
  flex: 0 0 auto;
  background: var(--gelb);
  color: var(--flaeche);
  border: none;
  border-radius: var(--radius-winzig);
  padding: .35rem .8rem;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
}
#support-banner button:hover { opacity: .9; }

/* ---------- Als installierte App ---------- */

@media (display-mode: standalone) {
  .nichtInApp { display: none !important; }
}

/* ---------- Druck ---------- */

@media print {
  :root { --tableiste-hoehe: 0px; }
  .seitenleiste, .tableiste, .kopf .knopfgruppe, .meldungen, .nichtdrucken { display: none !important; }
  body { background: #fff; color: #000; }
  .inhalt { padding: 0; animation: none; }
  /* Der Seitenkopf ist am Bildschirm eine klebende Leiste — auf Papier wäre
     das nur ein Kasten mit Strich darunter. */
  .kopf {
    position: static;
    background: none;
    border-bottom: none;
    margin: 0 0 1rem;
    padding: 0;
    min-height: 0;
  }
  .karte { border: none; box-shadow: none; padding: 0; background: #fff; }
  .abdunkeln { position: static; padding: 0; background: none; backdrop-filter: none; }
  .dialog { box-shadow: none; max-width: none; border: none; animation: none; }
  .dialog header, .dialog footer { display: none; }
  table { font-size: .85rem; }
  tbody tr:hover { background: none; }
}
