/* =============================================
   Handy-App (handy/handy.js, plaene/handy.md): gilt nur unter html[data-handy]. Die Fenster im Vollbild und die
   Programme in der Form Kopf kommen vorerst von der Desktop-App am schmalen Bildschirm (fenster.css, bauteile.css).
   ============================================= */

/* ---------- Statt Taskleiste und Insel: die Leiste unten (handy/leiste.js). Sie liegt, wo am schmalen Bildschirm die
   Taskleiste liegt: Schreibtisch, Meldungen und Projektwahl lassen dort schon Platz (os.css, fenster.css) ---------- */
[data-handy] .leiste, [data-handy] .fenster-kopf, [data-handy] .rahmen-kopf > .rahmen-knopf { display: none; }
/* Ohne die Insel in der Mitte hat das Dokument oben die ganze Breite */
[data-handy] .fenster .rahmen[data-form="kopf"] > .rahmen-kopf > :is(.rahmen-name, .fenster-dokument, .rahmen-teil) { max-width: none; }
/* Teil eines Pakets (In-Time, Tagebuch …): oben statt des Namens, in der Spalte nicht noch einmal (rahmen.js) */
[data-handy] .rahmen-kopf:has(> .rahmen-kopf-teil:not([hidden])) > .rahmen-name, [data-handy] .rahmen-spalte > .rahmen-teil { display: none; }

.handy-leiste { display: none; }
[data-handy] .handy-leiste:not([hidden]) {
  position: fixed;
  right: var(--a1);
  bottom: calc(var(--a1) + env(safe-area-inset-bottom, 0px));
  left: var(--a1);
  z-index: 8000;
  display: flex;
  align-items: center;
  height: var(--h-leiste);
  padding: var(--a1);
  border-radius: calc(var(--r-menue) + var(--a1));
  touch-action: none;   /* Wischen zur Seite wechselt das Programm (leiste.js), der Browser scrollt hier nichts */
  -webkit-user-select: none;
  user-select: none;
}
[data-handy][data-tastatur] .handy-leiste, body[data-gesperrt] .handy-leiste { display: none !important; }
.handy-knopf {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--r-menue);
  background: transparent;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.handy-knopf .ic { width: 22px; height: 22px; }
.handy-knopf:active { background: var(--akzent-hover); }

/* ---------- Homescreen (handy/heim.js) statt des Schreibtischs: oben Projekt und Verbindung, darunter zwei Seiten
   zum Wischen (Heute, Programme), unten die Punkte der Seiten. Hinter einem Programm nicht zu sehen ---------- */
[data-handy] .heim { display: none !important; }   /* gegen „Schmales Fenster“ in schreibtisch.css */
.handy-heim { display: none; }
[data-handy] .handy-heim:not([hidden]) { position: absolute; inset: 0; display: flex; flex-direction: column; }
.schreibtisch:has(.fenster.aktiv:not(.min)) .handy-heim { visibility: hidden; }

.handy-kopf { display: flex; flex: none; align-items: center; gap: var(--a2); padding: var(--a3) var(--a4) 0; }
.handy-projekt {
  display: flex;
  align-items: center;
  gap: var(--a2);
  min-width: 0;
  height: var(--h-normal);
  padding: 0 var(--a3) 0 var(--a2);
  border: 0;
  border-radius: var(--r-rund);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.handy-projekt[hidden] { display: none; }
.handy-projekt .t { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.handy-projekt > .ic { flex: none; width: 16px; height: 16px; color: var(--text-2); }
.handy-projekt:active { background: var(--akzent-hover); }
.handy-status { display: flex; align-items: center; gap: var(--a1); margin-left: auto; color: var(--tapete-text); }

.handy-seiten { position: relative; display: flex; flex: 1; min-height: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; }
.handy-seiten::-webkit-scrollbar { display: none; }
.handy-seite { flex: none; width: 100%; overflow-y: auto; padding: var(--a4); scroll-snap-align: start; scroll-snap-stop: always; }

/* Heute: die Widgets untereinander, so hoch wie ihr Inhalt */
.handy-heute { display: flex; flex-direction: column; gap: var(--a3); }
.handy-widget { flex: none; }
.handy-widget[data-widget="uhr"] { padding: var(--a4); }
.handy-heute .st-kal-raster { grid-auto-rows: 36px; }
.handy-heute .st-todo-liste { max-height: 260px; }
/* Widgets der Programme (Zeit stempeln, tools/zeit/zeit-handy.js; Bautagesbericht, tools/btb/btb-handy.js): oben Name
   und Tag, darunter der Stand groß (darunter klein Baustelle bzw. Projekt), unten die Knöpfe */
.handy-w { display: flex; flex-direction: column; gap: var(--a2); padding: var(--a3) var(--a4) var(--a4); }
.handy-w-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: var(--a2); }
.handy-w-kopf span { color: var(--text-2); font-size: var(--s-klein); }
.handy-w-stand { display: flex; flex-direction: column; margin: 0; font-size: var(--s-titel); font-weight: 600; font-variant-numeric: tabular-nums; }
.handy-w-stand span { overflow: hidden; color: var(--text-2); font-size: var(--s-klein); font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }
.handy-w-knoepfe { display: flex; gap: var(--a2); }
.handy-w-knoepfe:empty { display: none; }
.handy-w-knoepfe .knopf { flex: 1; }

/* Programme in vier Spalten, die Namen auf der Tapete */
.handy-programme { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--a4) var(--a1); align-content: start; }
.handy-prog {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--a1);
  min-width: 0;
  padding: var(--a1) 0;
  border: 0;
  border-radius: var(--r-menue);
  background: transparent;
  color: var(--tapete-text);
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}
.handy-prog:active { background: var(--akzent-hover); }
.handy-prog .name {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  font-size: var(--s-klein);
  line-height: 1.35;
  text-align: center;
  text-shadow: var(--tapete-schatten);
  overflow-wrap: break-word;
  hyphens: auto;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Im Safari-Tab: Hinweis, die App auf den Home-Bildschirm zu legen (über die ganze Breite, mit Schließen) */
.handy-hinweis { display: flex; grid-column: 1 / -1; align-items: flex-start; gap: var(--a3); padding: var(--a3) var(--a2) var(--a3) var(--a4); border-radius: var(--r-tafel); color: var(--text); }
.handy-hinweis > .ic { flex: none; width: 22px; height: 22px; margin-top: 1px; color: var(--akzent); }
.handy-hinweis p { flex: 1; margin: 0; font-size: var(--s-klein); line-height: 1.45; }
.handy-hinweis b { display: block; font-size: var(--s-normal); }
.handy-hinweis p .ic { display: inline-block; width: 15px; height: 15px; vertical-align: -2px; }

/* Punkte der Seiten über der Leiste; Tippen wechselt */
.handy-punkte { display: flex; flex: none; justify-content: center; gap: var(--a1); padding-bottom: var(--a1); }
.handy-punkt { display: grid; place-items: center; width: var(--h-klein); height: var(--h-klein); padding: 0; border: 0; background: transparent; -webkit-tap-highlight-color: transparent; }
.handy-punkt::before { width: 7px; height: 7px; border-radius: var(--r-rund); background: var(--tapete-text); opacity: 0.4; content: ""; }
.handy-punkt[aria-current="true"]::before { opacity: 1; }

/* =============================================
   Bauteile der Programme in der Handy-App (tools/<kürzel>/<kürzel>-handy.js), damit alle gleich aussehen:
   - .handy-band: über dem Inhalt ‹ Zeitraum › (Monat, Tag, KW; Mitte .t mit Untertitel) bzw. ein Schalter
   - .handy-kurz: je Eintrag (Tag, Mast …) eine kurze Zeile, als Knopf (.handy-kurz-knopf, Tippen klappt darunter
     .handy-auf auf) oder mit eigenen Knöpfen (.handy-kurz-zeile); links .handy-kurz-links, Mitte .handy-kurz-was
     (zweite Zeile .handy-kurz-unter), rechts .handy-kurz-rechts
   - .handy-auf: die aufgeklappten Felder in zwei Spalten (.breit über beide)
   - .handy-knoepfe: unten Drucken, als PDF, Löschen
   - .handy-druck: die Blätter zum Drucken, unsichtbar unter dem Inhalt (der Druck zeigt sie, grund.css)
   ============================================= */
.handy-band { display: flex; flex: none; align-items: center; gap: var(--a1); padding: var(--a1) var(--a2); border-bottom: 1px solid var(--linie); }
.handy-band[hidden] { display: none; }
.handy-band .t { display: flex; flex: 1; flex-direction: column; align-items: center; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; line-height: 1.3; }
.handy-band .t > span { max-width: 100%; overflow: hidden; color: var(--text-2); font-size: var(--s-klein); white-space: nowrap; text-overflow: ellipsis; }
.handy-band > .segment:only-child { flex: 1; }   /* nur ein Schalter: über die ganze Breite */
.handy-band > .segment:only-child > button { flex: 1; }

.handy-kurz { border-bottom: 1px solid var(--linie); background: var(--flaeche); }
.handy-kurz.we { background: var(--flaeche-2); }
.handy-kurz-knopf, .handy-kurz-zeile { display: flex; align-items: center; gap: var(--a2); width: 100%; min-height: var(--h-normal); padding: var(--a2) var(--a3); }
.handy-kurz-knopf { border: 0; background: none; color: var(--text); font: inherit; text-align: left; -webkit-tap-highlight-color: transparent; }
.handy-kurz-knopf:active { background: var(--akzent-hover); }
.handy-kurz-knopf > .ic { flex: none; width: 16px; height: 16px; color: var(--text-2); transition: rotate var(--dauer-kurz) var(--kurve); }
.handy-kurz-knopf[aria-expanded="true"] > .ic { rotate: 180deg; }
.handy-kurz-links { flex: none; width: 74px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.handy-kurz.heute .handy-kurz-links { color: var(--akzent); }
.handy-kurz-was { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.3; }
.handy-kurz-was > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.handy-kurz-was > .handy-kurz-unter, .handy-kurz-links > .handy-kurz-unter { color: var(--text-2); font-size: var(--s-klein); font-weight: 400; }
.handy-kurz-rechts { display: flex; flex: none; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; font-weight: 600; line-height: 1.3; }
.handy-kurz-leise { flex: 1; min-width: 0; color: var(--text-2); }
.handy-kurz-zeile > .knopf { flex: none; }

.handy-auf { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--a3) var(--a2); padding: var(--a2) var(--a3) var(--a3); background: var(--flaeche-2); }
.handy-auf .breit { grid-column: 1 / -1; }
.handy-auf .feld { width: 100%; height: var(--h-normal); }
.handy-auf textarea.feld { height: auto; min-height: var(--h-normal); padding: var(--a2); line-height: 1.4; resize: none; }

.handy-knoepfe { display: flex; gap: var(--a2); padding: var(--a3) var(--a3) var(--a5); }
.handy-knoepfe .knopf { flex: 1; min-width: 0; }
.handy-druck { height: 0; overflow: hidden; visibility: hidden; }
