/* terminblatt.css (K6) – das Termin-Blatt: Spalte am rechten Rand (breit/mittel, nicht modal), schmal von unten.
   Bau-Blatt K6 3.1, 3.7, 7.3. Nur Tokens. Neben den Bereichs-Kreisen nichts in App-Farbe: Auswahl-Zustände neutral
   (--glas-hoch + --tinte); der einzige Akzent ist „Speichern“, durch eine Haarlinie getrennt. K10 ergänzt .z-tb-ganz. */

:root { --z-tb-breite: 400px; }
@media (max-width: 1199px) { :root { --z-tb-breite: 360px; } }

/* Plan bleibt sichtbar: der Seiten-Platz wird schmaler (Abgleich 1.11: #z-inhalt). */
@media (min-width: 761px) {
  .z-tb-offen #z-inhalt { padding-inline-end: calc(var(--z-tb-breite) + var(--a16)); }
}

.z-tb {
  position: fixed; inset-block: var(--a12); inset-inline-end: var(--a12); inset-inline-start: auto; z-index: 45;
  width: var(--z-tb-breite); height: auto; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  color: var(--tinte); border-radius: var(--r28); background: var(--glas-blatt); box-shadow: var(--schatten-hoch);
  -webkit-backdrop-filter: var(--filter-blatt); backdrop-filter: var(--filter-blatt);
  --z-richtung: 1;
}
[dir="rtl"] .z-tb { --z-richtung: -1; }
.z-tb[open] { display: flex; flex-direction: column; animation: z-tb-rein var(--d-normal) var(--k-blatt) both; }
.z-tb::backdrop { background: var(--schleier); -webkit-backdrop-filter: var(--schleier-filter); backdrop-filter: var(--schleier-filter); }
@keyframes z-tb-rein { from { opacity: 0; transform: translateX(calc(24px * var(--weg) * var(--z-richtung))); } }
@keyframes z-tb-hoch { from { opacity: 0; transform: translateY(calc(24px * var(--weg))); } }
@media (prefers-reduced-motion: reduce) {
  .z-tb[open] { animation: z-tb-blende var(--d-tausch) linear both; }
}
@keyframes z-tb-blende { from { opacity: 0; } }

/* Kopf (fest) · Mitte (scrollt) · Fuß (fest) */
.z-tb-kopf { flex: none; display: flex; align-items: center; gap: var(--a12); min-height: 56px; padding: var(--a8) var(--a16); }
.z-tb-kopf h2 { flex: 1; min-width: 0; font: var(--t-seite); overflow-wrap: anywhere; }
.z-tb-mitte {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: var(--a12); padding: var(--a4) var(--a16) var(--a16);
}
.z-tb-fuss {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--a12);
  min-height: 72px; padding: var(--a12) var(--a16); border-block-start: 1px solid var(--haarlinie);
}
.z-tb-speichern { min-height: 52px; min-width: 132px; }
.z-tb-loeschen { color: var(--gefahr-text); gap: var(--a8); }
.z-tb-loeschen .z-sym { width: 18px; height: 18px; }

/* Zeilen */
.z-tb-zeile { display: flex; align-items: center; gap: var(--a8); min-width: 0; }
.z-tb-titel { flex-direction: column; align-items: stretch; }
.z-tb input[type="text"], .z-tb textarea, .z-tb select {
  width: 100%; min-height: var(--tipp); padding: var(--a8) var(--a12); border: 0; border-radius: var(--r14);
  font: var(--t-text); color: var(--tinte); background: var(--glas-mulde);
}
#z-tb-titel { font: var(--t-seite); min-height: 52px; }
.z-tb textarea { resize: none; line-height: 1.4; overflow-y: auto; }
.z-tb :disabled { opacity: 0.55; cursor: default; }
.z-tb-zaehler { align-self: flex-end; font: var(--t-neben); color: var(--grau); }

/* Blitz-Zeile (schlauer Titel) – neutral */
.z-tb-blitz {
  display: flex; align-items: center; gap: var(--a8); width: 100%; min-height: var(--tipp); padding: var(--a8) var(--a12);
  border-radius: var(--r14); font: var(--t-text); font-weight: 700; color: var(--tinte); background: var(--glas-hoch); text-align: start;
}
.z-tb-blitz .z-sym { flex: none; width: 18px; height: 18px; }

/* Tag ‹ Do, 19. November › */
.z-tb-tag { justify-content: space-between; }
.z-tb-tagtext {
  flex: 1; min-width: 0; min-height: var(--tipp); padding: var(--a4) var(--a8); border-radius: var(--r14);
  font: var(--t-text); font-weight: 700; color: var(--tinte); text-align: center; background: var(--glas-mulde);
}
.z-tb-datum { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; pointer-events: none; }

/* Beginn / Ende – Baustein Zeitfeld */
.z-tb-zeit { align-items: stretch; }
.z-zf { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--a4); }
.z-zf .z-label { color: var(--grau); }
.z-zf-feld { font-variant-numeric: tabular-nums; text-align: center; }
.z-zf-liste {
  position: absolute; inset-inline: 0; inset-block-start: calc(100% + var(--a4)); z-index: 2; max-height: 240px;
  overflow-y: auto; margin: 0; padding: var(--a4); list-style: none;
}
.z-zf-liste.z-oben { inset-block-start: auto; inset-block-end: calc(100% - 20px); }
.z-zf-liste [role="option"] {
  display: flex; justify-content: space-between; gap: var(--a8); min-height: 36px; align-items: center;
  padding: 0 var(--a12); border-radius: var(--r10); font: var(--t-text); cursor: pointer; font-variant-numeric: tabular-nums;
}
.z-zf-liste [role="option"]:hover, .z-zf-liste .z-aktiv { background: var(--glas-hoch); }
.z-zf-liste [aria-selected="true"] { font-weight: 700; }
.z-zf-dauer { font: var(--t-neben); color: var(--grau); }
.z-tb-dauer { min-height: 1.45em; font: var(--t-neben); color: var(--grau); text-align: center; }

/* Dauer-Knöpfe: neutral markiert, brechen um statt abzuschneiden */
.z-tb-kapseln { display: flex; flex-wrap: wrap; align-items: center; gap: var(--a8); }
.z-tb-kapsel {
  min-width: var(--tipp); min-height: var(--tipp); padding: 0 var(--a12); border-radius: var(--r-kapsel);
  font: var(--t-text); font-weight: 700; color: var(--tinte); background: var(--glas-mulde); font-variant-numeric: tabular-nums;
}
.z-tb-kapsel[aria-checked="true"] { background: var(--glas-hoch); box-shadow: 0 0 0 1.5px var(--tinte); }
.z-tb-einheit { font: var(--t-neben); color: var(--grau); }

/* Erinnern + Hinweise */
.z-tb-erinnern label { flex: none; display: inline-flex; align-items: center; gap: var(--a8); font: var(--t-text); font-weight: 700; }
.z-tb-erinnern label .z-sym { width: 18px; height: 18px; }
.z-tb-erinnern select { flex: 1; width: auto; min-width: 0; }
.z-tb-hinweis { font: var(--t-neben); color: var(--grau); }
.z-tb-hinweis p, .z-tb-sperre { display: flex; align-items: flex-start; gap: var(--a8); font: var(--t-neben); color: var(--grau); }
.z-tb-hinweis .z-sym, .z-tb-sperre .z-sym { flex: none; width: 16px; height: 16px; margin-block-start: 2px; }
.z-tb-routine { display: flex; flex-direction: column; gap: var(--a4); }
.z-tb-sperre[hidden], .z-tb-blitz[hidden] { display: none; }

/* Bereich: sechs Kreise, darunter der Name (bricht um) */
.z-tb-bereich .z-bereichswahl-name { font: var(--t-neben); color: var(--grau); overflow-wrap: anywhere; }

/* Notiz / Ort / Link: erst eine Zeile „… hinzufügen“, dann ein Feld */
.z-tb-mehrzeile { display: flex; flex-direction: column; gap: var(--a4); }
.z-tb-hinzu {
  display: flex; align-items: center; gap: var(--a8); min-height: var(--tipp); padding: 0 var(--a12);
  border-radius: var(--r14); font: var(--t-text); color: var(--grau); text-align: start;
}
.z-tb-hinzu:hover:not(:disabled) { background: var(--glas-mulde); color: var(--tinte); }
.z-tb-hinzu .z-sym { flex: none; width: 18px; height: 18px; }
.z-tb-hinzu[hidden], .z-tb-text[hidden] { display: none; }

.z-tb-fehler { display: flex; flex-wrap: wrap; align-items: center; gap: var(--a8); font: var(--t-neben); font-weight: 700; color: var(--gefahr-text); }
.z-tb-fehler[hidden] { display: none; }

/* Niedrige Fenster (1093 × 480): weniger Luft, „Speichern“ bleibt immer sichtbar */
@media (max-height: 620px) {
  .z-tb-kopf { min-height: 48px; padding-block: var(--a4); }
  .z-tb-mitte { gap: var(--a8); }
  .z-tb-fuss { min-height: 64px; padding-block: var(--a8); }
}

/* Schmal: von unten, volle Breite, höchstens 92 % der Höhe, Griff oben */
@media (max-width: 760px) {
  .z-tb {
    inset-inline: 0; inset-block-start: auto; inset-block-end: 0; width: auto; max-height: 92dvh;
    border-end-start-radius: 0; border-end-end-radius: 0;
  }
  .z-tb[open] { animation-name: z-tb-hoch; }
  .z-tb-kopf::before {
    content: ""; position: absolute; inset-block-start: var(--a8); inset-inline-start: calc(50% - var(--griff-b) / 2);
    width: var(--griff-b); height: var(--griff-h); border-radius: var(--r-kapsel); background: var(--griff);
  }
  .z-tb-kopf { padding-block-start: var(--a16); }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .z-tb[open] { animation: z-tb-blende var(--d-tausch) linear both; }
}

/* Große Schrift: Bereichs-Kreise 2 × 3 */
@media (max-width: 340px) {
  .z-tb .z-bereichswahl { grid-template-columns: repeat(3, minmax(var(--tipp), 1fr)); row-gap: var(--a8); }
}

/* ---------- Block K10: Ganztägig (Schalter, Beginn/Ende als Tage) – neutral, nie in App-Farbe ---------- */
.z-tb-ganz[hidden] { display: none; }
.z-gt-schalterzeile { justify-content: space-between; min-height: var(--tipp); }
.z-gt-schalter-text { display: inline-flex; align-items: center; gap: var(--a8); font: var(--t-text); font-weight: 700; }
.z-gt-schalter-text .z-sym { width: 18px; height: 18px; }
.z-gt-schalter {
  position: relative; flex: none; width: 52px; height: var(--tipp); border: 0; padding: 0; background: transparent; cursor: pointer;
}
.z-gt-schalter::before {
  content: ""; position: absolute; inset-inline: 0; inset-block: 8px; border-radius: var(--r-kapsel); background: var(--glas-mulde);
  box-shadow: inset 0 0 0 1px var(--haarlinie);
}
.z-gt-schalter[aria-checked="true"]::before { background: var(--tinte); }
.z-gt-knauf {
  position: absolute; inset-block-start: 11px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--glas-hoch); box-shadow: var(--schatten-hoch);
}
.z-gt-schalter[aria-checked="true"] .z-gt-knauf { transform: translateX(calc(24px * var(--richtung))); background: var(--grund-oben); }
.z-gt-schalter:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; border-radius: var(--r-kapsel); }
@media (prefers-reduced-motion: no-preference) { .z-gt-knauf { transition: transform var(--d-schnell) var(--k-hin-her), background-color var(--d-schnell) var(--k-druck); } }
.z-gt-tagzeile { justify-content: space-between; }
.z-gt-tag-name { flex: none; min-width: 56px; font: var(--t-text); font-weight: 700; }
.z-gt-laenge { text-align: start; }
#z-tbg-titel { font: var(--t-seite); min-height: 52px; }
