/* =============================================
   Zeiterfassung (ZE) — tools/zeit/zeit.js, zeit-auswertung.js
   Im Programmrahmen (bauteile.css): Spalte mit Monat, Person, Zeigen, Ausgabe und dem Stand; innen ein Hinweis, die
   Tabelle (scrollt in sich, Kopf und Tag bleiben stehen) und die Summen. Felder und Knöpfe aus bauteile.css (.feld, .knopf, .schalter).
   ============================================= */

.ze.view.active { display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--flaeche); color: var(--text); }

/* ---------- Spalte: Monat (‹ Monat Jahr ›), Person, Schalter bzw. Filter, Ausgabe, Stand ---------- */
.ze-teil { display: flex; flex-direction: column; gap: var(--a2); padding: 0 var(--a1); }
.ze-monat { display: flex; flex: none; align-items: center; gap: var(--a1); }
.ze-monat .ze-wahl { flex: 1; min-width: 0; }
.ze-wahl { width: 100%; }
.ze-wahl-name { padding: 0 var(--a1); font-weight: 600; }   /* nur eine Person: der Name ohne Auswahl */
.ze-schalter { display: flex; flex: none; align-items: center; gap: var(--a2); min-height: var(--h-klein); color: var(--text); font-size: var(--s-normal); }
.ze-status { min-width: 0; overflow: hidden; color: var(--text-2); font-size: var(--s-klein); white-space: nowrap; text-overflow: ellipsis; }
.ze-hinweis { margin: 0; padding: var(--a1) var(--a3); border-bottom: 1px solid var(--linie); color: var(--text-2); font-size: var(--s-klein); }

/* ---------- Tabelle ---------- */
.ze-rahmen { flex: 1; min-height: 0; overflow: auto; }
.ze-tabelle { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--s-klein); }
.ze-tabelle th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: var(--a2) var(--a1);
  border-right: 1px solid var(--linie);
  border-bottom: 1px solid var(--linie-stark);
  background: var(--flaeche-2);
  color: var(--text-2);
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
}
.ze-tabelle td { padding: var(--a0) var(--a1); border-right: 1px solid var(--flaeche-2); border-bottom: 1px solid var(--linie); vertical-align: middle; }
.ze-zeile.ze-erste td { border-top: 1px solid var(--linie); }
.ze-zeile.ze-weitere td { border-top: 1px dashed var(--linie); }
.ze-zeile:is(.ze-we, .ze-ft) td { background: var(--flaeche-2); }
.ze-zeile.ze-frei td:first-child { box-shadow: inset 3px 0 0 var(--erfolg); }   /* freigegeben */
/* Erste Spalte bleibt beim Scrollen nach rechts stehen */
.ze-tabelle .ze-c-tag { position: sticky; left: 0; z-index: 1; min-width: 56px; padding-left: var(--a2); background: var(--flaeche); white-space: nowrap; }
.ze-tabelle th.ze-c-tag { z-index: 3; background: var(--flaeche-2); }
.ze-zeile:is(.ze-we, .ze-ft) .ze-c-tag { background: var(--flaeche-2); }
.ze-c-tagwerk { min-width: 52px; font-variant-numeric: tabular-nums; font-weight: 600; text-align: center; }
/* Felder der Zeile (.feld): so hoch wie ein kleiner Knopf */
.ze-zeile .feld { box-sizing: border-box; font-size: var(--s-klein); }
.ze-zeile .ze-c-baustelle { width: 200px; }
.ze-zeile .ze-c-bl { width: 196px; }
.ze-zeile .ze-c-ort { width: 150px; }
.ze-zeile .ze-zeit { width: 64px; font-variant-numeric: tabular-nums; text-align: center; }
.ze-zeile .ze-c-weg { width: 170px; }
.ze-zeile .ze-c-abw { width: 180px; }
td.ze-c-ja { text-align: center; }
td.ze-c-ja input { width: 16px; height: 16px; margin: 0; accent-color: var(--akzent); }
td.ze-c-std { min-width: 52px; font-variant-numeric: tabular-nums; text-align: center; }
.ze-zeile :is(select, input):disabled { opacity: 0.55; }
.ze-vorschlag { color: var(--text-2); font-style: italic; }
.ze-zeile .feld.ze-vorschlag { border: 1px dashed var(--linie-stark); }
.ze-c-knopf { width: 32px; text-align: center; }
.ze-c-frei { min-width: 120px; white-space: nowrap; }
.ze-frei-name { margin-right: var(--a1); color: var(--erfolg); font-weight: 600; }
.ze-leer { padding: var(--a5) !important; color: var(--text-2); text-align: center; }

/* ---------- Summen ---------- */
.ze-summen { display: flex; flex: none; flex-wrap: wrap; gap: var(--a1) var(--a5); padding: var(--a2) var(--a3); border-top: 1px solid var(--linie); color: var(--text-2); font-size: var(--s-klein); }
.ze-summe { display: inline-flex; align-items: baseline; gap: var(--a1); }
.ze-summe strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Alle Personen: Monatsübersicht (zeit-auswertung.js) ---------- */
.ze-tabelle.ze-uebersicht td { padding: var(--a2) var(--a3); white-space: nowrap; }
.ze-tabelle.ze-uebersicht th { padding: var(--a2) var(--a3); }
.za-zeile { cursor: default; }
.za-zeile:hover td { background: var(--akzent-hover); }
.za-name { font-weight: 600; }
.za-r { font-variant-numeric: tabular-nums; text-align: right; }
.za-ok { color: var(--erfolg); font-weight: 600; }
.za-warn { color: var(--warnung); font-weight: 600; }
/* Hinweise nach dem Arbeitszeitgesetz (zeit-gesetz.js) und Tage länger als 7 Tage offen (§ 17 MiLoG) */
.ze-gesetz { display: inline-flex; margin-left: var(--a1); color: var(--warnung); vertical-align: -2px; }
.ze-gesetz .ic { width: 14px; height: 14px; }
.ze-offen-alt .ze-c-tag { color: var(--gefahr); font-weight: 600; }
.ze-summe-warn strong { color: var(--warnung); }
.za-grau { color: var(--text-2); }

/* DATEV-Einstellungen (Dialog #za-datev): Nummern nebeneinander, Lohnart und Schlüssel als schmale Felder */
.za-datev { width: min(640px, 100%); }
.za-nummern { display: grid; grid-template-columns: 1fr 1fr; gap: var(--a3); }
.za-la-rahmen { max-height: 320px; overflow: auto; border: 1px solid var(--linie); border-radius: var(--r-knopf); }
.za-la-tabelle { width: 100%; border-collapse: collapse; font-size: var(--s-klein); }
.za-la-tabelle th { position: sticky; top: 0; padding: var(--a1) var(--a2); background: var(--flaeche-2); color: var(--text-2); font-weight: 600; text-align: left; }
.za-la-tabelle td { padding: var(--a1) var(--a2); border-top: 1px solid var(--linie); }
.za-la-tabelle .feld { width: 72px; }

/* ---------- Schmales Fenster und Handy: die Summen in einer Zeile zum Wischen ---------- */
@container fenster (max-width: 700px) {
  .ze-summen { flex-wrap: nowrap; gap: var(--a4); overflow-x: auto; white-space: nowrap; }
}

/* ---------- Handy-App (zeit-handy.js): über der Liste der Monat (handy.css .handy-band); je Tag eine kurze Zeile,
   Tippen klappt darunter die
   Felder des Tages auf (die Zeilen der Tabelle als Karte, die Beschriftung aus data-titel über dem Feld) ---------- */
.ze-tabelle:has(> .ze-handy-liste), .ze-handy-liste, .ze-handy-liste > tr, .ze-tabelle .ze-handy-liste > tr > td { display: block; width: 100%; min-width: 0; }
.ze-handy-liste { font-size: var(--s-normal); }
.ze-tabelle .ze-handy-liste td { padding: 0; border: 0; background: transparent; }

.ze-kurz-knopf {
  display: flex;
  align-items: center;
  gap: var(--a2);
  width: 100%;
  min-height: var(--h-normal);
  padding: var(--a2) var(--a3);
  border: 0;
  border-bottom: 1px solid var(--linie);
  background: var(--flaeche);
  color: var(--text);
  font: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.ze-kurz:is(.ze-we, .ze-ft) .ze-kurz-knopf { background: var(--flaeche-2); }
.ze-kurz.ze-frei .ze-kurz-knopf { box-shadow: inset 3px 0 0 var(--erfolg); }
.ze-kurz-knopf:active { background: var(--akzent-hover); }
.ze-kurz-tag { flex: none; width: 60px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ze-kurz.ze-heute .ze-kurz-tag { color: var(--akzent); }
.ze-kurz.ze-offen-alt .ze-kurz-tag { color: var(--gefahr); }
.ze-kurz-was { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.3; }
.ze-kurz-was > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ze-kurz-was > .ze-kurz-ort { color: var(--text-2); font-size: var(--s-klein); }
.ze-kurz-was.ze-kurz-offen { color: var(--text-2); }
.ze-kurz-std { flex: none; font-variant-numeric: tabular-nums; font-weight: 600; }
.ze-kurz-knopf > .ic { flex: none; width: 16px; height: 16px; color: var(--text-2); transition: rotate var(--dauer-kurz) var(--kurve); }
.ze-kurz-knopf[aria-expanded="true"] > .ic { rotate: 180deg; }

/* Aufgeklappt: je Zeile eine Karte in sechs Spalten; Baustelle, Abwesenheit, Weg und Freigabe über die ganze Breite,
   Uhrzeiten, Bundesland und Ort je halb, die drei Knöpfe nebeneinander. Reihe: Baustelle, Anwesenheit und Pause,
   Bundesland und Ort, die Details, zuletzt die Knöpfe */
.ze-handy-liste > tr:is(.ze-zeile, .ze-handy-frei) { padding: var(--a2) var(--a3) var(--a3); border-bottom: 1px solid var(--linie); background: var(--flaeche-2); }
.ze-handy-liste > .ze-zeile { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--a2); }
.ze-handy-liste > .ze-zeile.ze-weitere { border-top: 1px dashed var(--linie-stark); }
.ze-tabelle .ze-handy-liste > .ze-zeile > td { display: flex; flex-direction: column; grid-column: span 3; order: 3; gap: var(--a0); min-width: 0; }
.ze-handy-liste > .ze-zeile > td[data-titel="Baustelle"] { order: 0; }
.ze-handy-liste > .ze-zeile > td:is([data-titel="Von"], [data-titel="Bis"], [data-titel="Pause von"], [data-titel="Pause bis"]) { order: 1; }
.ze-handy-liste > .ze-zeile > td:is([data-titel="Bundesland"], [data-titel="Einsatzort"]) { order: 2; }
.ze-handy-liste > .ze-zeile > td.ze-c-knopf { order: 4; }
.ze-handy-liste > .ze-zeile > td[data-titel]::before { content: attr(data-titel); color: var(--text-2); font-size: var(--s-hinweis); }
.ze-handy-liste > .ze-zeile > td:is([data-titel="Baustelle"], [data-titel="Wegstreckenentschädigung"], [data-titel="Abwesenheit"], .ze-c-frei) { grid-column: 1 / -1; }
.ze-handy-liste > .ze-zeile > td:is(.ze-c-tag, .ze-c-tagwerk, .ze-c-std:empty, .ze-c-frei:empty, :not([class], [data-titel])) { display: none; }
.ze-handy-liste > .ze-zeile > td :is(select, input[type="text"]) { width: 100%; text-align: left; }
.ze-tabelle .ze-handy-liste > .ze-zeile > td.ze-c-knopf { grid-column: span 2; }
.ze-handy-liste .ze-c-knopf .knopf { width: 100%; padding: 0 var(--a1); }
.ze-handy-liste > .ze-zeile > td.ze-c-ja { flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: var(--a2); }
.ze-handy-liste > .ze-zeile > td.ze-c-ja::before { font-size: var(--s-klein); }
.ze-handy-liste > .ze-handy-frei > td { display: flex; align-items: center; gap: var(--a2); }
