/* ============================================================
   W6 - Web | Zeiterfassung (Bildschirmentwuerfe v0.2, 15.09.2026)
   ------------------------------------------------------------
   Gestaltung der Ansichten aus js/zeiterfassung.js: Tagesjournal,
   Pruefen und Freigeben, Antraege, Abwesenheiten, Kontingente,
   Monatsabschluss, Leistungsarten, Arbeitszeitmodelle,
   Organisationsstruktur, Uebersicht, Nachrichten-Glocke.

   Alles ueber die Tokens aus design.css - hell und dunkel ohne
   eigene Farbwerte. Praefix "ze-", damit nichts mit style.css
   kollidiert; wiederverwendet werden dort .aw-kpi (Kennzahlen),
   .aw-tabs/.aw-tab (Reiter), table.daten, .feld/.eingabe/.knopf.
   ============================================================ */

/* ---- Chips (Status und Kennzeichen, Entwurf 2/3) ---- */
.ze-chip {
  display: inline-block; white-space: nowrap;
  border-radius: var(--radius-rund); padding: 2px 9px;
  font-size: 11.5px; font-weight: 600; line-height: 1.5;
  background: var(--einlage); color: var(--text-mittel);
  border: 1px solid transparent;
}
.ze-chip.offen    { background: var(--einlage); color: var(--text-mittel); }
.ze-chip.geprueft { background: var(--info-hell); color: var(--info); border-color: var(--info-rand); }
.ze-chip.frei     { background: var(--gruen-hell); color: var(--gruen); border-color: var(--gruen-rand); }
.ze-chip.fest     { background: var(--einlage); color: var(--text); border-color: var(--rand-stark); }
.ze-chip.warn     { background: var(--warn-hell); color: var(--warn); border-color: var(--warn-rand); }
.ze-chip.rot      { background: var(--rot-hell); color: var(--rot); border-color: var(--rot-rand); }
.ze-chip + .ze-chip { margin-left: 4px; }

/* ---- Hinweisbanner "noch nicht angebunden" (Datenbanktabelle fehlt) ---- */
.ze-db-hinweis {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--warn-hell); border: 1px solid var(--warn-rand); color: var(--warn);
  border-radius: var(--radius-m); padding: 11px 14px; margin: 0 0 14px;
  font-size: 12.5px; line-height: 1.5;
}
.ze-db-hinweis svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.ze-db-hinweis b { display: block; margin-bottom: 2px; }
.ze-db-hinweis code {
  font-family: Consolas, "Cascadia Mono", monospace; font-size: 11.5px;
  background: rgba(0, 0, 0, .06); border-radius: 4px; padding: 0 4px;
}
.ze-db-hinweis.klein { padding: 8px 12px; font-size: 12px; margin: 10px 0 0; }

/* ---- Karten, Werkzeugleiste, Zweispalt ---- */
.ze-karte {
  background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 15px 17px; margin-bottom: 14px; min-width: 0;
}
.ze-karte > h3 { margin: 0 0 10px; font-size: 14px; font-weight: 800; }
.ze-karte > h3 + .ze-karte-sub { margin-top: -6px; }
.ze-karte-sub { font-size: 12px; color: var(--text-grau); margin-bottom: 10px; }
.ze-karte.eng { padding: 0; overflow: hidden; }
.ze-karte.eng > table.daten { margin: 0; }

.ze-werkzeuge {
  background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 11px 14px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.ze-werkzeuge .feld { margin: 0; min-width: 220px; }
.ze-werkzeuge .feld label { margin-bottom: 3px; font-size: 10.5px; }
.ze-werkzeuge .eingabe { padding: 7px 10px; font-size: 13px; }
.ze-werkzeuge .knopf { padding: 8px 13px; }
.ze-strecker { flex: 1; }
.ze-monat { display: inline-flex; align-items: center; gap: 4px; }
.ze-monat .knopf { padding: 7px 10px; }
.ze-monat .ze-monat-name { min-width: 130px; text-align: center; font-weight: 700; font-size: 13px; }

.ze-zweispalt { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.ze-zweispalt.links-schmal { grid-template-columns: minmax(280px, 2fr) 3fr; }
@media (max-width: 900px) { .ze-zweispalt, .ze-zweispalt.links-schmal { grid-template-columns: 1fr; } }

/* ---- Tabellen: Ergaenzungen zu table.daten ---- */
.ze-karte table.daten th, .ze-karte table.daten td { white-space: normal; max-width: none; }
table.daten td.z, table.daten th.z { text-align: right; font-variant-numeric: tabular-nums; }
table.daten tr.ze-grau td { color: var(--text-blass); }
table.daten tr.ze-rot td { background: var(--rot-hell); }   /* Befundzeile (Abgleich 3.13) */
table.daten tr.ze-klick { cursor: pointer; }
table.daten tr.ze-gewaehlt td { background: var(--rot-hell); }
table.daten tr.ze-summe td { font-weight: 700; border-top: 2px solid var(--rand-stark); background: var(--tabellen-kopf); }
table.daten td.ze-aktion { text-align: right; white-space: nowrap; }
table.daten td.ze-aktion .knopf { padding: 5px 10px; font-size: 12px; }
table.daten input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--rot); cursor: pointer; }
table.daten input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .35; }
.ze-zaehler { font-size: 12px; color: var(--text-grau); padding: 10px 2px 0; }
.ze-hinweis { font-size: 12px; color: var(--text-grau); margin-top: 8px; line-height: 1.5; }
.ze-hinweis.rot { color: var(--rot); }
.ze-leer { padding: 26px 12px; text-align: center; color: var(--text-grau); font-size: 13px; }

/* Filterzeile unter dem Kopf (Entwurf 3/5) */
table.daten tr.ze-filter th { padding: 4px 8px; background: var(--tabellen-kopf); cursor: default; }
table.daten tr.ze-filter th:hover { background: var(--tabellen-kopf); }
.ze-filter-eingabe {
  width: 100%; min-width: 60px; padding: 3px 7px; font-size: 11.5px; font-family: inherit;
  border: 1px solid var(--rand); border-radius: var(--radius-s); background: var(--karte); color: var(--text);
}

/* ---- Felder (Anzeige und Eingabe) ---- */
.ze-feldraster { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 14px; }
.ze-feldraster .feld { margin: 0; }
.ze-wert {
  border: 1px solid var(--rand); border-radius: var(--radius-s); padding: 8px 10px;
  background: var(--flaeche); font-size: 13px; min-height: 36px; word-break: break-word;
}
.ze-wert.leer { color: var(--text-blass); }
.ze-abschnitt { margin-top: 16px; font-size: 13px; font-weight: 800; }

/* ---- Baum (Organisationsstruktur, Entwurf 8) ---- */
.ze-baum { font-size: 13.5px; }
.ze-baum-zeile {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-s);
  border-bottom: 1px solid var(--rand-zart); cursor: pointer;
}
.ze-baum-zeile:hover { background: var(--hover); }
.ze-baum-zeile.gewaehlt { background: var(--rot-hell); }
.ze-baum-zeile.inaktiv { color: var(--text-blass); }
.ze-baum-zeile small { color: var(--text-grau); font-weight: 400; }
.ze-baum-zeile .e0 { font-weight: 800; }

/* ---- Kennzahlen: Variante mit Achtung (Entwurf 2/10) ---- */
.aw-kpi.ze-achtung .aw-kpi-wert { color: var(--rot); }
.aw-kpi.ze-ruhig .aw-kpi-wert { color: var(--text); }

/* ---- Antrag-Detail (Entwurf 4) ---- */
.ze-verlauf td:first-child { width: 120px; color: var(--text-grau); white-space: nowrap; }

/* ---- Nachrichten-Glocke in der Kopfzeile ---- */
.ze-glocke {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-rund); border: none; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff; margin-right: 6px;
}
.ze-glocke:hover { background: rgba(255, 255, 255, .24); }
.ze-glocke svg { width: 18px; height: 18px; }
.ze-glocke-zahl {
  position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--radius-rund); background: #fff; color: var(--rot);
  font-size: 10.5px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.ze-nachricht { padding: 10px 12px; border: 1px solid var(--rand); border-radius: var(--radius-m); margin-bottom: 8px; background: var(--karte); }
.ze-nachricht.ungelesen { border-left: 3px solid var(--rot); }
.ze-nachricht-kopf { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 700; }
.ze-nachricht-kopf small { color: var(--text-grau); font-weight: 400; white-space: nowrap; }
.ze-nachricht-text { font-size: 12.5px; color: var(--text-mittel); margin-top: 3px; line-height: 1.45; }
/* Nach links wischen zum Loeschen (Touch, 23.09.2026): rot "Löschen" liegt hinter der Karte. */
.ze-wisch { position: relative; margin-bottom: 8px; border-radius: var(--radius-m); overflow: hidden; }
.ze-wisch > .ze-nachricht { position: relative; margin-bottom: 0; }
.ze-wisch > .ze-nachricht.wischbar { touch-action: pan-y; }
.ze-wisch-hinten {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end;
  padding-right: 18px; background: #FF3B30; color: #fff; font-size: 13px; font-weight: 700;
}

/* ---- Dialoge ---- */
.ze-dialog-knoepfe { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.ze-pruefung { margin-top: 12px; }
.ze-pruefung ul { margin: 6px 0 0 18px; padding: 0; }
.ze-datei { font-size: 12.5px; }

/* ---- Arbeitszeitmodelle: Mitarbeiter einer Schicht ---- */
.az-leute { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.az-leute .ze-chip + .ze-chip { margin-left: 0; }

/* ---- Einstellungen: Bereiche links, ein Bereich rechts (18.09.2026) ---- */
.es-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.es-nav { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 4px; background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); padding: 8px; }
.es-nav button { all: unset; box-sizing: border-box; cursor: pointer; padding: 10px 12px; border-radius: var(--radius-s); border-left: 3px solid transparent; }
.es-nav button:hover { background: var(--hover); }
.es-nav button:focus-visible { outline: 2px solid var(--rot); outline-offset: -2px; }
.es-nav button.aktiv { background: var(--rot-hell); border-left-color: var(--rot); }
.es-nav b { display: block; font-size: 13.5px; font-weight: 700; }
.es-nav small { display: block; font-size: 11.5px; color: var(--text-grau); margin-top: 1px; }
.es-inhalt { min-width: 0; max-width: 860px; }
.es-zeile { display: flex; align-items: center; gap: 18px; padding: 13px 0; border-top: 1px solid var(--rand); cursor: default; }
.ze-karte > h3 + .es-zeile, .ze-karte > .ze-karte-sub + .es-zeile, .es-stufen > .es-zeile:first-child { border-top: none; }
label.es-zeile { cursor: pointer; }
.es-text { flex: 1; min-width: 0; }
.es-text b { display: block; font-size: 13.5px; font-weight: 700; }
.es-text small { display: block; font-size: 12px; color: var(--text-grau); line-height: 1.45; margin-top: 2px; }
.es-wert { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.es-wert .eingabe { width: 86px; text-align: right; padding: 7px 9px; }
.es-wert em { font-style: normal; font-size: 12px; color: var(--text-grau); min-width: 56px; }
.es-schalter { position: relative; flex-shrink: 0; width: 42px; height: 24px; }
.es-schalter input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.es-schalter i { position: absolute; inset: 0; border-radius: 12px; background: var(--rand-stark); transition: background .15s; pointer-events: none; }
.es-schalter i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.es-schalter input:checked + i { background: var(--rot); }
.es-schalter input:checked + i::after { transform: translateX(18px); }
.es-schalter input:focus-visible + i { outline: 2px solid var(--rot); outline-offset: 2px; }
.es-stufen { border-left: 3px solid var(--rot-rand); padding-left: 14px; margin: 4px 0 10px; }
.es-speichern { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 12px 0; background: linear-gradient(transparent, var(--hintergrund, var(--karte)) 35%); }
.es-speichern[hidden] { display: none; }
.es-speichern span { font-size: 12.5px; color: var(--warn); font-weight: 600; }
@media (max-width: 860px) {
  .es-layout { grid-template-columns: 1fr; }
  .es-nav { position: static; flex-direction: row; overflow-x: auto; }
  .es-nav button { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
  .es-nav button.aktiv { border-bottom-color: var(--rot); }
  .es-nav small { display: none; }
}

/* ---- Abwesenheiten: Kalender (Monatsraster je Mitarbeiter, 18.09.2026) ---- */
.ab-k-rahmen { overflow-x: auto; }
table.ab-k { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; table-layout: fixed; min-width: 980px; }
table.ab-k th, table.ab-k td { border-bottom: 1px solid var(--rand); border-right: 1px solid var(--rand); height: 30px; text-align: center; padding: 0; }
table.ab-k thead th { background: var(--einlage); font-weight: 700; color: var(--text-mittel); font-size: 11.5px; line-height: 1.15; padding: 4px 0; }
table.ab-k thead th span { display: block; font-size: 9.5px; font-weight: 600; color: var(--text-grau); }
table.ab-k .ab-k-name { position: sticky; left: 0; z-index: 1; width: 190px; text-align: left; padding: 0 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--karte); }
table.ab-k thead .ab-k-name { background: var(--einlage); }
table.ab-k .we { background: var(--einlage); }
table.ab-k .ft { background: repeating-linear-gradient(135deg, var(--einlage) 0 5px, transparent 5px 10px); }
table.ab-k th.heute { color: var(--rot); box-shadow: inset 0 -3px 0 var(--rot); }
table.ab-k td.heute { box-shadow: inset 2px 0 0 var(--rot-rand), inset -2px 0 0 var(--rot-rand); }
table.ab-k td[data-id] { cursor: pointer; font-weight: 800; font-size: 11px; }
table.ab-k td[data-id]:hover { filter: brightness(.94); }
.ab-k-urlaub { background: var(--gruen-hell) !important; color: var(--gruen); }
.ab-k-krank  { background: var(--rot-hell) !important; color: var(--rot); }
.ab-k-frei   { background: var(--info-hell) !important; color: var(--info); }
.ab-k-plan   { background: var(--warn-hell) !important; color: var(--warn); }
.ab-k-offen  { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.55) 0 4px, transparent 4px 8px) !important; }
.ab-k-blass  { opacity: .45; }
table.ab-k tfoot td, table.ab-k tfoot th { background: var(--einlage); font-weight: 700; border-bottom: none; }
.ab-k-legende { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 10px 2px 0; font-size: 12px; color: var(--text-mittel); }
.ab-k-legende span { display: inline-block; min-width: 22px; height: 20px; line-height: 20px; text-align: center; border-radius: 4px; font-weight: 800; font-size: 11px; margin-left: 10px; border: 1px solid var(--rand); }
.ab-k-legende span:first-child { margin-left: 0; }
.ab-k-legende .ab-k-muster.we { background: var(--einlage); }
.ab-k-legende .ab-k-muster.ft { background: repeating-linear-gradient(135deg, var(--einlage) 0 5px, transparent 5px 10px); }
.ab-k-abwesend { background: var(--einlage) !important; color: var(--text-mittel); box-shadow: inset 0 0 0 1px var(--text-grau); }

/* ---- ZE-066: Jahresansicht des Abwesenheitskalenders - je Mitarbeiter eine Zeile, je Tag ein schmaler
   Streifen, Monate durch eine kräftigere Linie getrennt. Beantragt = schraffiert (ab-k-offen). ---- */
table.ab-j { border-collapse: separate; border-spacing: 0; font-size: 12px; table-layout: fixed; }
table.ab-j th, table.ab-j td { border-bottom: 1px solid var(--rand); height: 24px; padding: 0; }
table.ab-j td { width: 4px; min-width: 4px; }
table.ab-j td.ms, table.ab-j th.ms { border-left: 1px solid var(--text-grau); }
table.ab-j thead th { background: var(--einlage); font-weight: 700; color: var(--text-mittel); font-size: 11.5px; padding: 4px 0; text-align: center; cursor: pointer; }
table.ab-j thead th:hover { color: var(--rot); }
table.ab-j .ab-k-name { position: sticky; left: 0; z-index: 1; width: 190px; min-width: 190px; text-align: left; padding: 0 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--karte); border-right: 1px solid var(--rand); cursor: default; }
table.ab-j thead .ab-k-name { background: var(--einlage); }
table.ab-j td.we { background: var(--einlage); }
table.ab-j td.heute { box-shadow: inset 2px 0 0 var(--rot); }
table.ab-j td.z-summe, table.ab-j th.z-summe { width: 58px; min-width: 58px; text-align: right; padding: 0 8px; border-left: 1px solid var(--text-grau); font-variant-numeric: tabular-nums; cursor: default; }

/* ---- ZE-024: Ampel im Monatsabschluss ---- */
.ze-ampel { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; background: var(--text-grau); }
.ze-ampel.gruen { background: var(--gruen); }
.ze-ampel.gelb { background: var(--warn); }
.ze-ampel.rot { background: var(--rot); }
.ze-ampel.grau { background: var(--text-grau); opacity: .55; }
.ze-liste { margin: 0 0 8px; padding-left: 18px; line-height: 1.7; }

/* ---- ZE-065: geführte Umbuchung (Kollision Abwesenheit <-> Arbeitszeit) ---- */
.ze-kollision { border-color: var(--rot-rand); }
.ze-kollision-wege { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; margin-top: 10px; }
.ze-kollision-weg { text-align: left; padding: 9px 12px; border: 1px solid var(--rand); border-radius: 8px; background: var(--karte); color: inherit; cursor: pointer; font: inherit; }
.ze-kollision-weg:hover { border-color: var(--rot); box-shadow: 0 0 0 2px var(--rot-hell); }
.ze-kollision-weg b { display: block; margin-bottom: 3px; }
.ze-kollision-weg span { display: block; font-size: 12px; line-height: 1.4; color: var(--text-mittel); }
.ze-kollision-weg.still { background: var(--einlage); }

/* ---- Druck: Monatsnachweis (Entwurf 2) ---- */
@media print {
  header.kopf, footer.fuss, .zurueck-zeile, .ze-werkzeuge, .ze-db-hinweis, .ze-kein-druck, #toastContainer { display: none !important; }
  body { overflow: visible !important; }
  .inhalt { padding: 0 !important; }
  .ze-karte { box-shadow: none; border-color: #999; break-inside: avoid; }
  table.daten th, table.daten td { padding: 4px 8px; font-size: 11px; }
}
