/* Betriebs-App — Shell.
   Schlicht und schnell: keine Animationen, keine Schatten, keine Verlaeufe.
   Dichte Darstellung ist erwuenscht. Ecken abgerundet, nie kantig.
   Aktionsknoepfe stehen beim Objekt, auf das sie wirken. */

:root {
  --mass: 1;
  --grundgroesse: 16px;
  --schrift: system-ui, "Segoe UI", sans-serif;

  --grund: #f3f5f6;
  --flaeche: #ffffff;
  --fuell: #e8ecee;
  --rahmen: #c5cdd2;
  --rahmen-stark: #8b959c;
  --text: #1a2125;
  --text-leise: #5a666e;
  --akzent: #1f5f8b;
  --akzent-flaeche: #e2ecf3;
  --warn: #8a4b12;
  --warn-flaeche: #f6ebdd;
  --gut: #1f6b45;

  --r-klein: 6px;
  --r-mittel: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-darstellung="hell"]) {
    --grund: #12161a;
    --flaeche: #1a2126;
    --fuell: #242c33;
    --rahmen: #323b43;
    --rahmen-stark: #606c75;
    --text: #e4e9ec;
    --text-leise: #939ea7;
    --akzent: #74b2db;
    --akzent-flaeche: #1a2c39;
    --warn: #d9a44f;
    --warn-flaeche: #32261a;
    --gut: #6cc194;
  }
}

:root[data-darstellung="dunkel"] {
  --grund: #12161a;
  --flaeche: #1a2126;
  --fuell: #242c33;
  --rahmen: #323b43;
  --rahmen-stark: #606c75;
  --text: #e4e9ec;
  --text-leise: #939ea7;
  --akzent: #74b2db;
  --akzent-flaeche: #1a2c39;
  --warn: #d9a44f;
  --warn-flaeche: #32261a;
  --gut: #6cc194;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font-family: var(--schrift);
  font-size: calc(var(--grundgroesse) * var(--mass));
  line-height: 1.5;
}

h1 { font-size: 1.5em; margin: 0 0 0.6em; text-wrap: balance; }
h2 { font-size: 1.1em; margin: 0 0 0.5em; }
p  { margin: 0 0 0.6em; }
a  { color: var(--akzent); }

.bahn { max-width: 1200px; margin-inline: auto; padding: 24px 16px 64px; }
.mitte { max-width: 42ch; margin-inline: auto; padding-top: 24px; }
.klein { font-size: 0.82em; color: var(--text-leise); }
.fest  { font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- Kopf */

.umgebungsband {
  background: var(--warn-flaeche); color: var(--warn);
  padding: 6px 16px; font-size: 0.82em; text-align: center;
  border-bottom: 1px solid var(--rahmen);
}

.kopf {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  padding: 10px 16px; background: var(--flaeche);
  border-bottom: 1px solid var(--rahmen);
}
.marke { font-weight: 600; text-decoration: none; color: var(--text); }
.kopfnav { display: flex; gap: 14px; flex-wrap: wrap; }
.kopfnav a { text-decoration: none; }
/* Zwei Zeilen: oben Kuerzel und Abmelden, darunter die Uhr bis zur
   Zwangsabmeldung. Sie steht dauerhaft im Bild und nicht erst in der letzten
   Minute -- wer am Hallengeraet steht, soll wissen, wieviel Zeit er hat,
   bevor ihm die Erfassung wegbricht. */
.kopfrechts {
  margin-left: auto; display: flex; flex-direction: column;
  gap: 4px; align-items: flex-end;
}
.kopfrechts .sitzung { font-size: 0.86em; }
.uhr {
  font-variant-numeric: tabular-nums; color: var(--text-leise);
  min-width: 5ch; text-align: right;
}
.uhr.knapp { color: var(--warn); font-weight: 600; }

/* Das Kuerzel steht dauerhaft im Bild, nicht in einem Menue: Wer am geteilten
   Geraet steht und ein fremdes Kuerzel sieht, merkt es sofort. */
.kuerzel {
  font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--akzent-flaeche); color: var(--akzent);
  border-radius: var(--r-klein); padding: 4px 10px;
}



/* ------------------------------------------------------------ Flaechen */

.kasten {
  background: var(--flaeche); border: 1px solid var(--rahmen);
  border-radius: var(--r-mittel); padding: 16px; margin-bottom: 20px;
}
.kasten.code { border-color: var(--akzent); background: var(--akzent-flaeche); }
.codewert {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 1.6em; letter-spacing: 0.08em; margin: 8px 0;
  user-select: all;
}

.meldung, .hinweis {
  background: var(--akzent-flaeche); color: var(--akzent);
  border: 1px solid var(--akzent); border-radius: var(--r-mittel);
  padding: 10px 14px; margin-bottom: 16px;
}

.band {
  background: var(--flaeche); border: 1px solid var(--rahmen);
  border-left: 4px solid var(--rahmen-stark); border-radius: var(--r-mittel);
  padding: 10px 14px; margin-bottom: 12px;
}
.band-hinweis { border-left-color: var(--akzent); }
.band-warnung { border-left-color: var(--warn); background: var(--warn-flaeche); }

/* ------------------------------------------------------------ Kacheln */

.kacheln {
  display: grid; gap: 12px; margin-bottom: 28px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.kachel {
  display: flex; align-items: center; min-height: 72px;
  background: var(--flaeche); border: 1px solid var(--rahmen);
  border-radius: var(--r-mittel); padding: 16px;
  text-decoration: none; color: var(--text);
}
.kachel:hover { border-color: var(--akzent); }
.kachel .name { font-weight: 600; }
.kachel.verwaltung { background: var(--fuell); }

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

.formular { display: flex; flex-direction: column; gap: 6px; }
.formular label { font-size: 0.86em; color: var(--text-leise); margin-top: 8px; }
.formular.breit { max-width: 44ch; }

.reihe { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.reihe.eng { gap: 6px; align-items: center; }
.reihe span { display: flex; flex-direction: column; gap: 4px; }
.reihe label { font-size: 0.86em; color: var(--text-leise); }

input, select {
  font: inherit; color: var(--text); background: var(--flaeche);
  border: 1px solid var(--rahmen-stark); border-radius: var(--r-klein);
  padding: 9px 10px; min-height: 44px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--akzent); outline-offset: 2px;
}

.knopf {
  font: inherit; font-weight: 500; cursor: pointer;
  min-height: 44px; padding: 8px 16px;
  background: var(--akzent); color: var(--grund);
  border: 1px solid var(--akzent); border-radius: var(--r-klein);
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.knopf.still { background: var(--flaeche); color: var(--text); border-color: var(--rahmen-stark); }
.knopf.gross { margin-top: 16px; width: 100%; }
.knopf.klein-knopf { min-height: 36px; padding: 5px 10px; font-size: 0.86em; }
.knopf[disabled] { opacity: 0.45; cursor: not-allowed; }

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

.rolle { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.92em; }
th, td {
  text-align: left; padding: 8px 10px; vertical-align: top;
  border-bottom: 1px solid var(--rahmen);
}
th { font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-leise); }
tbody tr:last-child td { border-bottom: 0; }

.aktionen, .gruppenwahl { display: flex; flex-wrap: wrap; gap: 6px; }

.marke {
  font: inherit; font-size: 0.82em; cursor: pointer;
  border: 1px solid var(--rahmen-stark); border-radius: 999px;
  padding: 5px 11px; min-height: 32px;
  background: var(--flaeche); color: var(--text-leise);
}
.marke.an { background: var(--akzent-flaeche); color: var(--akzent); border-color: var(--akzent); }
.marke.aus { border-style: dashed; }
.marke-aktiv { color: var(--gut); border-color: var(--gut); cursor: default; }
.marke-neu { color: var(--akzent); border-color: var(--akzent); cursor: default; }
.marke-gesperrt { color: var(--warn); border-color: var(--warn); cursor: default; }

.paare { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.paare dt { color: var(--text-leise); font-size: 0.86em; }
.paare dd { margin: 0; }

form { margin: 0; }

/* -------------------------------------------- Buchhaltung: Wahl und Zahlen */

/* Ampel statt Farbflaeche: Die Farbe steht neben dem Text, nie an seiner
   Stelle. Wer Rot und Gruen nicht unterscheidet, liest daneben trotzdem,
   was los ist. */
.ampel {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-right: 7px;
  background: var(--rahmen-stark);
}
.ampel-gut     { background: var(--gut); }
.ampel-fehler,
.ampel-ueberfaellig { background: var(--warn); }

/* Breiter als die Modulkacheln: Hier stehen Firma, System, Laufzustand und
   gesperrte Belege untereinander, nicht nur ein Wort. */
.kacheln.wahl { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.kachel.firma { display: block; min-height: 0; }
.kachel.firma .name { display: block; font-size: 1.1em; }
.kachel.firma .zeile { display: block; font-size: 0.84em; color: var(--text-leise); margin-top: 6px; }

/* Kennzahlen. Gross genug, um im Vorbeigehen ablesbar zu sein -- aber die
   Herkunft steht darunter, sonst ist es nur eine huebsche Zahl. */
.zahlen {
  display: grid; gap: 10px; margin: 0 0 20px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.zahl {
  background: var(--flaeche); border: 1px solid var(--rahmen);
  border-radius: var(--r-mittel); padding: 14px;
}
.zahl .titel { font-size: 0.82em; color: var(--text-leise); }
.zahl .wert {
  font-size: 1.7em; font-weight: 600; line-height: 1.25;
  font-variant-numeric: tabular-nums; margin-top: 2px;
}
.zahl .wert.offen { font-size: 1em; font-weight: 400; color: var(--text-leise); }
.zahl .fuss { font-size: 0.76em; color: var(--text-leise); margin-top: 8px; }

.zurueck { display: inline-block; margin-bottom: 10px; font-size: 0.86em; }
.kopfreihe { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; justify-content: space-between; }

/* Ein erledigter Klick muss anders aussehen als ein vergessener -- sonst
   drueckt der naechste noch einmal. */
.erledigt {
  color: var(--gut); font-weight: 600; font-size: 0.86em;
  white-space: nowrap;
}

/* Die knappe Kachel: Titel, eine Zeile Erklaerung, die Zahl, der Zeitraum.
   Mehr nicht -- wer die Herleitung braucht, findet sie im Titelhinweis. */
.zahl .unterzeile { font-size: 0.82em; color: var(--text-leise); margin-top: 2px; }
.monatswahl {
  font-size: 0.86em; padding: 2px 6px; max-width: 100%;
  background: var(--fuell); color: var(--text);
  border: 1px solid var(--rahmen); border-radius: var(--r-klein);
}

/* -------------------------------------------------- Personalplanung */

/* Prio-Farben, aufsteigend von rot (P1) nach gruen (P6). Nur als Rand und
   Marke, nie als Textfarbe: Gelb und Gelbgruen erreichen auf Weiss 3:1 fuer
   Bedienelemente, aber nicht 4,5:1 fuer Text. Die Zahl "P1" steht immer
   daneben -- wer Rot und Gruen nicht unterscheidet, liest die Prio trotzdem. */
:root {
  --prio-1: #c62828;
  --prio-2: #d84315;
  --prio-3: #a67c00;
  --prio-4: #6b8e23;
  --prio-5: #2e8b57;
  --prio-6: #1b5e20;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-darstellung="hell"]) {
    --prio-1: #ff6f61;
    --prio-2: #ff9f43;
    --prio-3: #f4c430;
    --prio-4: #b5d33d;
    --prio-5: #6fcf97;
    --prio-6: #3fa66b;
  }
}

:root[data-darstellung="dunkel"] {
  --prio-1: #ff6f61;
  --prio-2: #ff9f43;
  --prio-3: #f4c430;
  --prio-4: #b5d33d;
  --prio-5: #6fcf97;
  --prio-6: #3fa66b;
}

.prio-1 { --prio: var(--prio-1); }
.prio-2 { --prio: var(--prio-2); }
.prio-3 { --prio: var(--prio-3); }
.prio-4 { --prio: var(--prio-4); }
.prio-5 { --prio: var(--prio-5); }
.prio-6 { --prio: var(--prio-6); }

.prio-marke {
  display: inline-block; font-size: 0.78em; font-weight: 600;
  font-variant-numeric: tabular-nums; line-height: 1.3;
  border: 2px solid var(--prio, var(--rahmen-stark)); border-radius: var(--r-klein);
  padding: 0 5px; color: var(--text); vertical-align: 0.1em;
}

.warn { color: var(--warn); }
.warnmarke {
  display: inline-block; font-size: 0.78em; font-weight: 600;
  color: var(--warn); background: var(--warn-flaeche);
  border-radius: var(--r-klein); padding: 1px 6px;
}

.kal-leiste {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  align-items: center; margin-bottom: 12px;
}

/* Spalten je Ansicht. Monat und 14 Tage in Wochenreihen, Tag als eine Spalte. */
.kalender { display: grid; gap: 6px; margin-bottom: 20px; }
.kalender.ansicht-tag    { grid-template-columns: 1fr; }
.kalender.ansicht-5tage  { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kalender.ansicht-woche,
.kalender.ansicht-14tage,
.kalender.ansicht-monat  { grid-template-columns: repeat(7, minmax(0, 1fr)); }

.kal-tag {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  min-height: 140px; padding: 8px 8px 40px;
  background: var(--flaeche); border: 1px solid var(--rahmen);
  border-radius: var(--r-mittel); cursor: cell;
}
.kalender.ansicht-monat .kal-tag { min-height: 110px; }
.kal-tag.heute { border-color: var(--akzent); border-width: 2px; }
.kal-tag.fremd { background: var(--fuell); }
.kal-kopf { display: flex; flex-direction: column; gap: 1px; }
.kal-datum { font-weight: 600; font-variant-numeric: tabular-nums; }

.kal-eintrag {
  display: flex; flex-direction: column; gap: 3px; cursor: default;
  border: 1px solid var(--rahmen); border-left: 5px solid var(--prio, var(--rahmen-stark));
  border-radius: var(--r-klein); padding: 6px 8px; background: var(--grund);
  font-size: 0.9em;
}
.kal-eintrag.ist-erledigt { opacity: 0.7; }
.kal-titel { font-weight: 600; text-decoration: none; color: var(--text); }
.kal-titel:hover { color: var(--akzent); }
.kal-leute { overflow-wrap: anywhere; }

.kal-neu {
  position: absolute; right: 6px; bottom: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 32px; border-radius: var(--r-klein);
  border: 1px dashed var(--rahmen-stark); color: var(--text-leise);
  text-decoration: none; font-weight: 600;
}
.kal-neu:hover { border-color: var(--akzent); color: var(--akzent); }

.dialog {
  max-width: min(640px, calc(100vw - 32px)); width: 100%;
  border: 1px solid var(--rahmen); border-radius: var(--r-mittel);
  background: var(--flaeche); color: var(--text); padding: 20px;
}
.dialog::backdrop { background: rgb(0 0 0 / 0.45); }

.textfeld {
  width: 100%; font-family: "Cascadia Mono", Consolas, monospace; font-size: 0.86em;
  color: var(--text); background: var(--grund);
  border: 1px solid var(--rahmen); border-radius: var(--r-klein); padding: 8px;
  white-space: pre-wrap;
}

.breit-feld { flex: 1 1 260px; }
.breit-feld input { width: 100%; }

/* Schmal: Die Tage untereinander. Kein zweiter Codepfad, nur eine Spalte. */
@media (max-width: 760px) {
  .kalender.ansicht-5tage,
  .kalender.ansicht-woche,
  .kalender.ansicht-14tage,
  .kalender.ansicht-monat { grid-template-columns: 1fr; }
  .kal-tag { min-height: 0; }
  .kal-tag.fremd { display: none; }
}

/* Feiertag: Der Wochenplan gilt nicht. Sichtbar, damit niemand sich wundert,
   warum an einem Donnerstag "0 da" steht. */
.kal-tag.feiertag { background: var(--warn-flaeche); }
.kal-feiertag { color: var(--warn); font-weight: 600; font-size: 0.82em; }
