:root {
  --nav: #0b2447;
  --nav-2: #13315c;
  --nav-text: #c9d6ea;
  --nav-aktiv: #7cc4ff;
  --grund: #f3f5f9;
  --flaeche: #ffffff;
  --linie: #dfe4ec;
  --linie-2: #eef1f6;
  --text: #1b2433;
  --text-2: #5b6778;
  --akzent: #1f6feb;
  --akzent-hell: #e7f0ff;
  --offen: #fff7e0;
  --offen-rand: #f0b429;
  --gefahr: #c62828;
  --ok: #1a7f37;
  --formel: #6f42c1;
  --radius: 8px;
  --sidebar-breite: 240px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  background: var(--grund);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--grund); font-size: 14px; }
a { color: inherit; }

.rahmen { display: flex; height: 100vh; overflow: hidden; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-breite); flex: none; background: var(--nav); color: var(--nav-text);
  display: flex; flex-direction: column; padding: 18px 12px; overflow-y: auto;
}
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 21px; font-weight: 600; letter-spacing: .3px; padding: 0 8px 20px; }
.logo svg { width: 28px; height: 28px; color: var(--nav-aktiv); flex: none; }
.sidebar { transition: width .18s ease; }
.sidebar-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.sidebar-kopf .logo { padding-bottom: 20px; overflow: hidden; }
.menue-klappe { flex: none; width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--nav-text); cursor: pointer; display: grid; place-items: center; }
.menue-klappe:hover { background: var(--nav-2); color: #fff; }
.menue-klappe svg { width: 18px; height: 18px; transition: transform .18s; }
.nav-bereich, .sidebar-fuss a { white-space: nowrap; overflow: hidden; }
.sidebar-fuss a { display: flex; align-items: center; gap: 10px; }

/* eingeklappt: nur Symbole */
html.nav-zu .sidebar { width: 64px; padding-left: 8px; padding-right: 8px; }
html.nav-zu .nav-text, html.nav-zu .nav-karten { display: none; }
html.nav-zu .sidebar-kopf { flex-direction: column; align-items: center; }
html.nav-zu .sidebar-kopf .logo { padding: 0 0 6px; }
html.nav-zu .menue-klappe { margin-bottom: 14px; }
html.nav-zu .menue-klappe svg { transform: rotate(180deg); }
html.nav-zu .nav-bereich, html.nav-zu .sidebar-fuss a { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-bereich { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px; text-decoration: none; font-weight: 500; }
.nav-bereich:hover { background: var(--nav-2); color: #fff; }
.nav-bereich.aktiv { background: var(--nav-2); color: #fff; }
.nav-icon { width: 20px; text-align: center; }
.nav-hinweis { margin-left: auto; font-size: 11px; opacity: .55; }
.nav-karten { display: flex; flex-direction: column; margin: 2px 0 8px 30px; border-left: 1px solid #2a4a78; }
.nav-karten a { padding: 5px 10px; text-decoration: none; font-size: 13px; border-left: 2px solid transparent; margin-left: -1px; }
.nav-karten a:hover { color: #fff; }
.nav-karten a.aktiv { color: var(--nav-aktiv); border-left-color: var(--nav-aktiv); font-weight: 600; }
.nav-karten a.offen { opacity: .5; }
.sidebar-fuss { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid #22406b; padding-top: 10px; }
.sidebar-fuss a { padding: 7px 10px; border-radius: 6px; text-decoration: none; font-size: 13px; }
.sidebar-fuss a:hover, .sidebar-fuss a.aktiv { background: var(--nav-2); color: #fff; }
.sidebar-fuss small { opacity: .6; }

/* ---------- Inhalt: Kopf bleibt stehen, nur die Tabelle scrollt ---------- */
.inhalt { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.kopf { flex: none; background: var(--flaeche); border-bottom: 1px solid var(--linie); padding: 14px 22px 0; z-index: 5; }
.kopf-zeile { display: flex; align-items: baseline; gap: 14px; }
.kopf h1 { margin: 0; font-size: 22px; font-weight: 600; }
.quelle { color: var(--text-2); font-size: 12px; }
.menue-knopf { display: none; border: 0; background: none; font-size: 22px; cursor: pointer; padding: 0 4px; }

.reiter { display: flex; gap: 2px; margin-top: 12px; overflow-x: auto; scrollbar-width: thin; }
.reiter a {
  padding: 8px 14px; text-decoration: none; white-space: nowrap; color: var(--text-2);
  border: 1px solid transparent; border-bottom: 0; border-radius: 7px 7px 0 0; font-weight: 500;
}
.reiter a:hover { background: var(--linie-2); color: var(--text); }
.reiter a.aktiv { background: var(--grund); border-color: var(--linie); color: var(--akzent); position: relative; top: 1px; }
.reiter a.offen { opacity: .55; font-weight: 400; }

.werkzeug { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 22px; margin: 0 -22px; background: var(--grund); border-top: 1px solid var(--linie); }
.knopf { border: 1px solid var(--linie); background: var(--flaeche); color: var(--text); padding: 7px 14px; border-radius: 6px; font: inherit; font-weight: 500; cursor: pointer; }
.knopf:hover { border-color: #b8c2d2; }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.primaer:hover { background: #1a5fcc; }
.knopf.gefahr { color: var(--gefahr); border-color: #f0c4c4; }
.suche { border: 1px solid var(--linie); border-radius: 6px; padding: 7px 10px; font: inherit; min-width: 200px; background: var(--flaeche); }
.zaehler { color: var(--text-2); font-size: 13px; margin-left: auto; }

.schalter { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-weight: 500; }
.schalter input { position: absolute; opacity: 0; pointer-events: none; }
.bahn { width: 34px; height: 19px; border-radius: 10px; background: #c3cad6; position: relative; transition: background .15s; }
.bahn::after { content: ""; position: absolute; left: 2px; top: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.schalter input:checked + .bahn { background: var(--akzent); }
.schalter input:checked + .bahn::after { left: 17px; }
.schalter input:focus-visible + .bahn { outline: 2px solid var(--akzent); outline-offset: 2px; }

/* ---------- Tabelle ---------- */
.tabelle-rahmen { flex: 1; overflow: auto; padding: 0 22px 40px; }
.tabelle { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--flaeche); margin-top: 14px; border: 1px solid var(--linie); border-radius: var(--radius); }
.tabelle thead th { position: sticky; top: 0; z-index: 2; background: #f8fafc; }
.tabelle thead tr.filter th { top: var(--kopf-hoehe, 37px); }
.tabelle th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--text-2); padding: 9px 10px; border-bottom: 1px solid var(--linie); white-space: nowrap; cursor: pointer; user-select: none; }
.tabelle th:hover { color: var(--text); }
.tabelle th .pfeil { color: var(--akzent); margin-left: 4px; }
.tabelle th .fx { color: var(--formel); font-style: italic; font-weight: 600; margin-left: 4px; cursor: help; }
.tabelle tr.filter th { padding: 5px 6px; cursor: default; background: #f1f4f9; }
.tabelle tr.filter input { width: 100%; min-width: 60px; border: 1px solid var(--linie); border-radius: 4px; padding: 4px 6px; font: inherit; font-size: 12.5px; font-weight: 400; }
.tabelle td { padding: 7px 10px; border-bottom: 1px solid var(--linie-2); vertical-align: top; }
.tabelle tbody tr:last-child td { border-bottom: 0; }
.tabelle tbody tr:hover td { background: #f7faff; }
.tabelle tbody tr.ist-offen td { background: var(--offen); }
.tabelle tbody tr.ist-offen td:first-child { box-shadow: inset 3px 0 0 var(--offen-rand); }
.tabelle td.t-datum, .tabelle td.t-zahl { white-space: nowrap; }
.tabelle td.t-zahl { text-align: right; font-variant-numeric: tabular-nums; }
.tabelle td.t-langtext { min-width: 220px; max-width: 420px; }
.tabelle td.t-text { max-width: 220px; }
.tabelle td.editierbar { cursor: text; }
.tabelle td.editierbar:hover { box-shadow: inset 0 0 0 1px #b9cdf5; }
.tabelle td.berechnet { color: var(--formel); }
.tabelle td.negativ { color: var(--gefahr); font-weight: 600; }
.tabelle td .fx-mini { font-size: 10px; color: var(--formel); font-style: italic; margin-left: 4px; vertical-align: super; }
.tabelle td.aktion { width: 34px; padding: 4px; text-align: center; }
.tabelle td.aktion button { border: 0; background: none; cursor: pointer; color: var(--text-2); font-size: 15px; border-radius: 4px; padding: 3px 6px; }
.tabelle td.aktion button:hover { background: var(--akzent-hell); color: var(--akzent); }
.tabelle td.bearbeiten { padding: 3px; }
.tabelle td.bearbeiten input, .tabelle td.bearbeiten textarea { width: 100%; min-width: 120px; font: inherit; padding: 4px 6px; border: 2px solid var(--akzent); border-radius: 4px; outline: none; }
.tabelle td.bearbeiten textarea { min-height: 70px; resize: vertical; }
.tabelle td.gespeichert { animation: blitz 1s; }
.tabelle td.fehlerhaft { box-shadow: inset 0 0 0 2px var(--gefahr); }
@keyframes blitz { from { background: #d7f5dd; } }
.heute-zelle { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.heute-knopf { border: 1px solid #b9cdf5; background: var(--akzent-hell); color: var(--akzent); border-radius: 5px; padding: 2px 7px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.heute-knopf:hover { background: var(--akzent); color: #fff; border-color: var(--akzent); }
.heute-knopf:disabled { opacity: .5; cursor: wait; }
.feld-mit-knopf { display: flex; gap: 8px; }
.feld-mit-knopf input { flex: 1; min-width: 0; }
.feld-mit-knopf .heute-knopf { padding: 0 12px; font-size: 13px; }
/* ---------- Impfpass ---------- */
.uebersicht h2 { font-size: 15px; font-weight: 600; margin: 18px 0 10px; color: var(--text); }
.impf-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.impf-karte { background: var(--flaeche); border: 1px solid var(--linie); border-left: 4px solid #b8c2d2; border-radius: var(--radius); padding: 10px 12px; }
.impf-karte.gruen { border-left-color: var(--ok); }
.impf-karte.gelb { border-left-color: var(--offen-rand); }
.impf-karte.rot { border-left-color: var(--gefahr); }
.impf-name { font-weight: 600; margin-bottom: 4px; }
.impf-zeile { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.impf-zeile b { color: var(--text); font-weight: 600; }
.impf-ohne { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.leer-hinweis { color: var(--text-2); margin: 0; }
.chip { display: inline-block; background: var(--akzent-hell); color: #174ea6; border-radius: 10px; padding: 1px 8px; font-size: 12px; margin: 1px 3px 1px 0; white-space: nowrap; }
.chip.grau { background: var(--linie-2); color: var(--text-2); }
.ampel { display: inline-block; border-radius: 10px; padding: 1px 7px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.ampel.gruen { background: #e6f6ea; color: var(--ok); }
.ampel.gelb { background: var(--offen); color: #8a5a00; }
.ampel.rot { background: #fdecec; color: var(--gefahr); }
.ampel.grau { background: var(--linie-2); color: var(--text-2); font-weight: 500; }
.tabelle td.per-maske { cursor: pointer; }
.tabelle td.per-maske:hover { box-shadow: inset 0 0 0 1px #b9cdf5; }
.mehrfach { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; padding: 8px 10px; border: 1px solid var(--linie); border-radius: 6px; }
.mehrfach label { display: flex; align-items: center; gap: 6px; font-weight: 400 !important; color: var(--text) !important; font-size: 13px !important; cursor: pointer; }
.leer { padding: 40px; text-align: center; color: var(--text-2); }

/* ---------- Eingabemaske ---------- */
.maske { border: 0; border-radius: 12px; padding: 0; width: min(640px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(11,36,71,.35); }
.maske::backdrop { background: rgba(11,36,71,.45); }
.maske header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; background: var(--nav); color: #fff; }
.maske h2 { margin: 0; font-size: 17px; font-weight: 600; }
.maske .x { border: 0; background: none; color: #fff; font-size: 18px; cursor: pointer; }
.maske-felder { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 18px 20px; max-height: 65vh; overflow-y: auto; }
.feld { display: flex; flex-direction: column; gap: 4px; }
.feld.breit { grid-column: 1 / -1; }
.feld label { font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.feld input, .feld textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--linie); border-radius: 6px; background: #fff; }
.feld input:focus, .feld textarea:focus { outline: 2px solid var(--akzent-hell); border-color: var(--akzent); }
.feld textarea { min-height: 70px; resize: vertical; }
.feld small { color: var(--text-2); font-size: 11.5px; }
.feld.breit #f-datum { max-width: 200px; }
.feld .pauschal { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--formel); font-weight: 500; }
.feld .berechnet-wert { padding: 8px 10px; background: #f5f2fb; border-radius: 6px; color: var(--formel); }
.maske footer { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--linie); background: #fafbfd; }
.maske .platz { flex: 1; }
.maske-fehler { margin: 0 20px 4px; color: var(--gefahr); background: #fdecec; padding: 8px 10px; border-radius: 6px; }
.meldung-ok { color: var(--ok); background: #e6f6ea; padding: 8px 10px; border-radius: 6px; }

.toast { position: fixed; bottom: 22px; right: 22px; background: var(--nav); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 20; }
.toast.fehler { background: var(--gefahr); }

.platzhalter { padding: 40px 22px; max-width: 720px; overflow-y: auto; }
.platzhalter h2 { margin-top: 0; }
.platzhalter p { color: var(--text-2); line-height: 1.55; }

/* ---------- Bilder, Notizen, Links in der Tabelle ---------- */
.tabelle th.k-bild { cursor: default; }
.tabelle td.bildzelle { cursor: pointer; padding: 5px 8px; min-width: 64px; }
.mini-bilder { display: flex; flex-wrap: wrap; gap: 4px; }
.t-langtext .mini-bilder, .t-text .mini-bilder { margin-top: 4px; }
.mini { height: 72px; width: auto; max-width: 120px; object-fit: cover; border-radius: 6px; display: block; cursor: zoom-in;
  background: var(--linie-2); box-shadow: 0 0 0 1px rgba(11,36,71,.08); }
.mini:hover { box-shadow: 0 0 0 2px var(--akzent); }
.tabelle td.hat-notiz { position: relative; }
.tabelle td.hat-notiz::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 8px 8px 0;
  border-color: transparent #d93025 transparent transparent; }
.tabelle a.link { color: var(--akzent); word-break: break-all; }
.tabelle a.link:hover { text-decoration: underline; }

/* ---------- Lichtbox ---------- */
.lichtbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; overflow: visible; }
.lichtbox::backdrop { background: rgba(6,16,32,.86); }
.lichtbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lichtbox img { max-width: calc(100vw - 140px); max-height: calc(100vh - 110px); border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.5); background: #fff; }
.lichtbox figcaption { color: #e8eef8; font-size: 13px; }
.lb-x, .lb-pfeil { position: fixed; border: 0; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; border-radius: 50%; }
.lb-x { top: 16px; right: 16px; width: 40px; height: 40px; font-size: 18px; }
.lb-pfeil { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 30px; line-height: 1; }
.lb-pfeil.links { left: 16px; }
.lb-pfeil.rechts { right: 16px; }
.lb-x:hover, .lb-pfeil:hover { background: rgba(255,255,255,.25); }

/* ---------- Maske: Bilder, Notizen, Zählen ---------- */
.bildfeld { border: 1px dashed #c3cad6; border-radius: 8px; padding: 10px 12px; }
.bildfeld.ziehen { border-color: var(--akzent); background: var(--akzent-hell); }
.bild-galerie { display: flex; flex-wrap: wrap; gap: 8px; }
.bild-galerie figure { position: relative; margin: 0; }
.bild-galerie img { height: 88px; width: auto; max-width: 160px; object-fit: cover; border-radius: 6px; display: block; background: var(--linie-2); }
.bild-galerie .weg { position: absolute; top: 4px; right: 4px; border: 0; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(11,36,71,.75); color: #fff; cursor: pointer; font-size: 12px; line-height: 22px; padding: 0; }
.bild-galerie .weg:hover { background: var(--gefahr); }
.bild-galerie figcaption { position: absolute; left: 4px; bottom: 4px; background: var(--ok); color: #fff; font-size: 10.5px; padding: 1px 6px; border-radius: 8px; }
.bild-leer { color: var(--text-2); font-size: 12.5px; padding: 6px 0; }
.bild-ablage { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; color: var(--text-2); font-size: 12px; }
.notiz-knopf { align-self: flex-start; border: 0; background: none; color: var(--text-2); font: inherit; font-size: 11.5px; padding: 0; cursor: pointer; }
.notiz-knopf:hover { color: var(--akzent); text-decoration: underline; }
.feld textarea.notiz { min-height: 54px; background: #fffbea; border-color: #f3e2a4; font-size: 13px; }
.feld .zaehlen-text { margin-top: 2px; }
.feld .zaehlen-text:disabled { background: #f3f5f9; color: var(--text-2); }

/* ---------- Schnellknöpfe, Auswahllisten, Meldung mit Aktion ---------- */
.schnell { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.schnell-knopf { padding: 6px 11px; font-size: 13px; white-space: nowrap; }
.schnell-knopf.sofort { background: #fff7e0; border-color: #f0d38a; }
.schnell-knopf.sofort:hover { border-color: var(--offen-rand); }
.schnell-knopf.frau { background: #eef7e6; border-color: #cfe5bb; }
.schnell-knopf.frau:hover { border-color: #92d050; }
.schnell-knopf:disabled { opacity: .5; cursor: wait; }
.feld select { font: inherit; padding: 8px 10px; border: 1px solid var(--linie); border-radius: 6px; background: #fff; }
.tabelle td.bearbeiten select { width: 100%; min-width: 110px; font: inherit; padding: 4px 6px; border: 2px solid var(--akzent); border-radius: 4px; outline: none; }
.tabelle td.aktion { white-space: nowrap; }
.tabelle td.aktion button.verschieben { font-size: 12px; font-weight: 600; color: var(--akzent); }
/* Breite Tabellen: Knopfspalte (✎, → Partner) bleibt rechts sichtbar – app.js setzt die Klasse nur, wenn die Tabelle überläuft */
.tabelle.aktion-fest td.aktion, .tabelle.aktion-fest thead th:last-child {
  position: sticky; right: 0;
  box-shadow: inset 1px 0 0 var(--linie), 22px 0 0 var(--grund); /* deckt den Rand rechts daneben ab */
}
.tabelle.aktion-fest td.aktion { z-index: 1; background: var(--flaeche); }
.tabelle.aktion-fest thead th:last-child { z-index: 3; }
.tabelle.aktion-fest tbody tr:hover td.aktion { background: #f7faff; }
.toast-aktion { margin-left: 12px; border: 0; background: rgba(255,255,255,.2); color: #fff; padding: 3px 10px; border-radius: 5px; font: inherit; font-weight: 600; cursor: pointer; }
.toast-aktion:hover { background: rgba(255,255,255,.32); }

/* ---------- Eigene Ansichten ---------- */
.segmente { display: inline-flex; border: 1px solid var(--linie); border-radius: 7px; overflow: hidden; background: var(--flaeche); flex-wrap: wrap; }
.segment { border: 0; border-right: 1px solid var(--linie); background: none; padding: 6px 11px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text-2); }
.segment:last-child { border-right: 0; }
.segment:hover { background: var(--linie-2); color: var(--text); }
.segment.an { background: var(--akzent); color: #fff; }
.textknopf { border: 0; background: none; padding: 0; font: inherit; color: var(--akzent); cursor: pointer; }
.textknopf:hover { text-decoration: underline; }

/* ---------- Statistik ---------- */
.eigene-seite { flex: 1; overflow: auto; padding: 16px 22px 40px; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kachel { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 14px 16px; }
.k-label { color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.k-wert { font-size: 34px; font-weight: 600; line-height: 1.15; margin: 4px 0 2px; color: var(--text); }
.k-info { color: var(--text-2); font-size: 12px; }
.block { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 14px 16px 12px; margin-bottom: 16px; }
.block-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.block h2 { margin: 0; font-size: 16px; font-weight: 600; }
.stat-scroll { overflow-x: auto; border: 1px solid var(--linie-2); border-radius: 6px; }
.stat-tabelle { border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.stat-tabelle th, .stat-tabelle td { padding: 6px 10px; border-bottom: 1px solid var(--linie-2); white-space: nowrap; }
.stat-tabelle thead th { background: #f8fafc; color: var(--text-2); font-weight: 600; font-size: 12px; text-align: right; }
.stat-tabelle thead th.ecke, .stat-tabelle tbody th { text-align: left; position: sticky; left: 0; background: #f8fafc; z-index: 1; }
.stat-tabelle tbody th { font-weight: 500; color: var(--text); background: var(--flaeche); box-shadow: 1px 0 0 var(--linie-2); }
.stat-tabelle td { text-align: right; min-width: 44px; }
.stat-tabelle tbody tr:last-child th, .stat-tabelle tbody tr:last-child td { border-bottom: 0; }
.stat-tabelle.monate td, .stat-tabelle.monate thead tr:last-child th { min-width: 38px; padding: 6px 7px; }
.stat-tabelle.monate th.jahr { text-align: left; border-left: 1px solid var(--linie); }
.stat-tabelle.monate .jahresanfang { border-left: 1px solid var(--linie); }
.stat-tabelle.monate td.laufend { background: var(--akzent-hell); }
.schluessel { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 8px; }
.legende-text { color: var(--text-2); font-size: 12px; margin: 8px 2px 0; }
.legende { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--text-2); margin: 2px 0 6px; }
.leg { display: inline-flex; align-items: center; gap: 7px; }
.leg-linie { width: 16px; height: 2px; border-radius: 1px; }
.diagramm { position: relative; margin-bottom: 12px; }
.diagramm svg { display: block; width: 100%; height: auto; overflow: visible; }
.linien .gitter { stroke: #e1e0d9; stroke-width: 1; }
.linien .basis { stroke: #c3c2b7; stroke-width: 1; }
.linien .tick { stroke: #c3c2b7; stroke-width: 1; }
.linien .achse { fill: #898781; font-size: 11px; font-variant-numeric: tabular-nums; }
.linien .reihe { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.linien .punkt { stroke: #fff; stroke-width: 2; }
.linien .endwert { fill: var(--text-2); font-size: 11.5px; font-weight: 600; }
.linien .fadenkreuz { stroke: #898781; stroke-width: 1; }
.linien .trefferflaeche { fill: transparent; cursor: crosshair; outline: none; }
.diagramm-tip { position: absolute; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: 8px 10px;
  box-shadow: 0 8px 24px rgba(11,36,71,.14); pointer-events: none; font-size: 12.5px; min-width: 170px; z-index: 3; }
.tip-kopf { font-weight: 600; margin-bottom: 4px; color: var(--text); }
.tip-zeile { display: flex; align-items: center; gap: 7px; padding: 1px 0; }
.tip-zeile strong { min-width: 26px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.tip-linie { width: 12px; height: 2px; border-radius: 1px; }
.tip-name { color: var(--text-2); }
.auswahl-liste { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; padding: 16px 20px; max-height: 60vh; overflow-y: auto; }
.auswahl-liste label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---------- Periode ---------- */
.periode-rahmen { flex: 1; overflow: auto; margin: 14px 22px 22px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); }
.periode { border-collapse: separate; border-spacing: 0; font-size: 11px; }
.periode th, .periode td { border-right: 1px solid var(--linie-2); border-bottom: 1px solid var(--linie-2); }
.periode thead th { position: sticky; background: #f8fafc; z-index: 2; color: var(--text-2); font-weight: 600; }
.periode thead tr.monate th { top: 0; height: 26px; text-align: left; padding: 0 6px; font-size: 12px; color: var(--text); border-left: 1px solid var(--linie); }
.periode thead tr.tage th { top: 26px; height: 22px; min-width: 25px; text-align: center; font-weight: 500; font-variant-numeric: tabular-nums; }
.periode thead tr.tage th.we { background: #eef1f6; }
.periode thead tr.tage th.heute { background: var(--akzent); color: #fff; }
.periode thead th.ecke { left: 0; z-index: 3; text-align: left; padding: 0 10px; font-size: 13px; color: var(--text); min-width: 210px; }
.periode th.name { position: sticky; left: 0; z-index: 1; background: var(--flaeche); text-align: left; padding: 4px 10px; min-width: 210px; max-width: 240px;
  box-shadow: 1px 0 0 var(--linie); }
.periode th.name .fn { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.periode th.name .fz { font-size: 11px; font-weight: 500; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.periode tr.inaktiv th.name .fn { color: var(--text-2); }
.periode td { position: relative; width: 25px; min-width: 25px; height: 38px; text-align: center; cursor: pointer; color: #1b2433;
  font-weight: 600; font-size: 10.5px; padding: 0 1px; font-variant-numeric: tabular-nums; }
.periode td:hover { box-shadow: inset 0 0 0 2px #b9cdf5; }
.periode td.voll { background: var(--f); }
/* hochgerechnet: gleiche Farbe, aufgehellt und schraffiert */
.periode td.hoch { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--f) 50%, #fff) 0 3px, color-mix(in srgb, var(--f) 28%, #fff) 3px 6px);
  color: #3b4453; font-weight: 500; }
.periode td.sex::after { content: "♥"; position: absolute; top: 0; right: 1px; font-size: 10px; line-height: 1; color: #b3134f; }
.periode .m1 { border-left: 1px solid var(--linie); }
.periode td.heute { box-shadow: inset 2px 0 0 var(--akzent), inset -2px 0 0 var(--akzent); }
.periode td.gewaehlt { box-shadow: inset 0 0 0 2px var(--nav); }
.jahr-wahl { display: inline-flex; align-items: center; gap: 4px; }
.jahr-wahl select { font: inherit; padding: 6px 8px; border: 1px solid var(--linie); border-radius: 6px; background: var(--flaeche); }
.jahr-wahl .knopf { padding: 6px 10px; }
.code-legende { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-left: auto; font-size: 12px; color: var(--text-2); }
.code { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 4px; border-radius: 4px; font-size: 11px; font-weight: 700; color: #1b2433; margin-left: 6px; }
.code.herz { color: #b3134f; font-size: 13px; }
.code.hoch-muster { background: repeating-linear-gradient(135deg, #ff9f9f 0 3px, #ffd1d1 3px 6px); }
.periode-pop { position: fixed; z-index: 40; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: 12px;
  box-shadow: 0 14px 40px rgba(11,36,71,.25); width: 300px; display: flex; flex-direction: column; gap: 10px; }
.periode-pop[hidden] { display: none; }
.pop-kopf { font-size: 13px; color: var(--text-2); }
.pop-kopf strong { color: var(--text); }
.pop-info { font-size: 12.5px; color: var(--text); }
.pop-hinweis { color: var(--text-2); font-size: 11.5px; }
.pop-codes { display: flex; gap: 6px; }
.pop-codes button { flex: 1; border: 0; border-radius: 6px; height: 32px; font: inherit; font-weight: 700; cursor: pointer; color: #1b2433; }
.pop-codes button:hover { outline: 2px solid var(--nav); }

/* ---------- Login ---------- */
.login-seite { display: grid; place-items: center; min-height: 100vh; background: var(--nav); }
.login { background: var(--flaeche); padding: 32px; border-radius: 12px; width: min(360px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 14px; }
.login.eingebettet { width: min(420px, 100%); border: 1px solid var(--linie); }
.login h2 { margin: 0; font-size: 18px; }
.login label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.login input { font: inherit; padding: 9px 11px; border: 1px solid var(--linie); border-radius: 6px; }
.login .maske-fehler { margin: 0; }
.logo.gross { color: var(--nav); justify-content: center; padding-bottom: 6px; font-size: 26px; }
.logo.gross svg { color: var(--akzent); }

/* ---------- Schmal ---------- */
@media (max-width: 820px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  body.nav-offen .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  /* auf dem Handy übernimmt ☰ das Auf- und Zuklappen */
  .menue-klappe { display: none; }
  html.nav-zu .sidebar { width: var(--sidebar-breite); padding: 18px 12px; }
  html.nav-zu .nav-text { display: inline; }
  html.nav-zu .nav-karten { display: flex; }
  html.nav-zu .sidebar-kopf { flex-direction: row; }
  html.nav-zu .nav-bereich, html.nav-zu .sidebar-fuss a { justify-content: flex-start; padding: 9px 10px; }
  .menue-knopf { display: inline-block; }
  .kopf { padding: 12px 16px 0; }
  .werkzeug { padding: 10px 16px; margin: 0 -16px; gap: 10px; }
  .suche { min-width: 0; flex: 1; }
  .zaehler { margin-left: 0; }
  .tabelle-rahmen { padding: 0 16px 40px; }
  .maske-felder { grid-template-columns: 1fr; }
  .eigene-seite { padding: 12px 16px 40px; }
  .periode-rahmen { margin: 12px 16px 16px; }
  .periode thead th.ecke, .periode th.name { min-width: 150px; max-width: 150px; }
  .code-legende { margin-left: 0; }
  .lichtbox img { max-width: calc(100vw - 24px); }
  .lb-pfeil { top: auto; bottom: 16px; transform: none; }
}
