/* Striewe Stunden: Handy zuerst, ruhig, grosse Tippflaechen. Logische Eigenschaften, damit RTL spiegelt. */
:root {
  --marke: #282979;
  --marke-dunkel: #1d1e5c;
  --marke-hell: #ecedf8;
  --gruen: #047857;
  --gruen-hell: #e7f6ef;
  --rot: #b91c1c;
  --rot-hell: #fdecec;
  --gelb: #92400e;
  --gelb-hell: #fef6e4;
  --text: #1a1b2e;
  --text-leise: #5b5d72;
  --linie: #d9dae6;
  --grund: #f4f5fa;
  --karte: #ffffff;
  --rund: 12px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--grund);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
}

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Kopf */
.kopf {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--marke);
  color: #fff;
  padding-top: env(safe-area-inset-top, 0px);
}
.kopf-innen {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
  min-height: 56px;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
}
.kopf-symbol { width: 32px; height: 32px; border-radius: 8px; flex: none; }
.kopf-titel { font-weight: 650; font-size: 1.1rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menue-knopf {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 10px;
  background: transparent;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.menue-knopf[aria-expanded="true"] { background: rgba(255, 255, 255, .15); }

.menue {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px 16px;
  display: grid;
  gap: 8px;
}
.menue label { color: #fff; }
.menue .knopf { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .35); color: #fff; }

/* ---------- Inhalt */
.inhalt {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
h1 { font-size: 1.45rem; line-height: 1.25; margin: 8px 0 16px; }
h2 { font-size: 1.15rem; margin: 0; }
p { margin: 0 0 12px; }
.leise { color: var(--text-leise); }
.klein { font-size: .9rem; }
.mitte { text-align: center; }

.karte {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--rund);
  padding: 16px;
  margin-bottom: 12px;
}

/* ---------- Formulare */
.feld { display: block; margin-bottom: 14px; }
.feld > span { display: block; font-size: .95rem; font-weight: 600; margin-bottom: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="time"], input[type="number"], select {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #b9bbcc;
  border-radius: 10px;
  background: #fff;
  color: var(--text);   /* sonst erbt die Sprachwahl im Menue die weisse Schrift (weiss auf weiss) */
  font-size: 1rem;
}
select option { color: var(--text); background: #fff; }
input[type="time"], input[type="number"] { font-variant-numeric: tabular-nums; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-leise) 50%), linear-gradient(135deg, var(--text-leise) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
[dir="rtl"] select { background-position: 14px 50%, 20px 50%; }
input:focus-visible, select:focus-visible, button:focus-visible, .link:focus-visible {
  outline: 3px solid #8b8ce0;
  outline-offset: 2px;
}
input:disabled, select:disabled { background: #f0f0f5; color: var(--text-leise); }

.knopf {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--marke);
  border-radius: 10px;
  background: var(--marke);
  color: #fff;
  font-weight: 650;
  cursor: pointer;
  text-align: center;
}
.knopf:active { background: var(--marke-dunkel); }
.knopf:disabled { opacity: .55; cursor: default; }
.knopf.zweit { background: #fff; color: var(--marke); }
.knopf.zweit:active { background: var(--marke-hell); }
.knopf.gruen { background: var(--gruen); border-color: var(--gruen); }
.knopf.gruen:active { background: #03664a; }
.knopf + .knopf { margin-top: 10px; }

.link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--marke);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.meldung { border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.meldung p:last-child { margin-bottom: 0; }
.meldung.fehler { background: var(--rot-hell); color: var(--rot); border: 1px solid #f3c2c2; }
.meldung.ok { background: var(--gruen-hell); color: var(--gruen); border: 1px solid #b7e2cf; }
.meldung.info { background: var(--marke-hell); color: var(--marke); border: 1px solid #cfd0ee; }
.meldung.warn { background: var(--gelb-hell); color: var(--gelb); border: 1px solid #f3dcae; }

.sprache-wahl { margin-top: 28px; }

/* ---------- Hauptseite */
.gruss { font-size: 1.2rem; font-weight: 650; margin: 4px 0 12px; }
.einsatz-name { color: var(--text-leise); margin: -6px 0 12px; }

.wochen-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.wochen-nav .pfeil {
  flex: none;
  width: 48px;
  height: 48px;
  border: 1px solid var(--linie);
  border-radius: 10px;
  background: #fff;
  color: var(--marke);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.wochen-nav .pfeil:disabled { color: #c3c4d4; cursor: default; }
.wochen-mitte { flex: 1; text-align: center; min-width: 0; }
.wochen-kw { font-weight: 700; font-size: 1.15rem; }
.wochen-daten { color: var(--text-leise); font-size: .95rem; }

.stand-zeile { display: flex; justify-content: center; margin-bottom: 12px; }
.stand {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 650;
  background: var(--marke-hell);
  color: var(--marke);
}
.stand.s-korrektur { background: var(--rot-hell); color: var(--rot); }
.stand.s-freigegeben, .stand.s-uebernommen, .stand.s-abgerechnet { background: var(--gruen-hell); color: var(--gruen); }
.stand.s-offen { background: #eef0f4; color: #3c3f55; }

.vorwoche {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid #f3dcae;
  border-radius: 10px;
  background: var(--gelb-hell);
  color: var(--gelb);
  text-align: start;
  cursor: pointer;
}
.vorwoche b { font-weight: 650; }
.vorwoche .stand, .vorwoche span span { white-space: nowrap; }

/* Tageskarten */
.tag { padding: 14px 16px; }
.tag-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.tag-name { font-weight: 700; }
.tag-datum { color: var(--text-leise); font-weight: 400; margin-inline-start: 6px; }
.tag-std { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag-std.null { color: var(--text-leise); font-weight: 400; }
.tag-nacht { color: var(--text-leise); font-size: .9rem; text-align: end; margin-top: -8px; margin-bottom: 8px; }
.feiertag { display: inline-block; margin-bottom: 10px; padding: 2px 10px; border-radius: 999px; background: var(--gelb-hell); color: var(--gelb); font-size: .9rem; font-weight: 600; }
.tag.zukunft { background: #f8f8fb; color: var(--text-leise); }
.tag.zukunft .tag-kopf { margin-bottom: 4px; }
.tag.zukunft p { margin: 0; font-size: .95rem; }

.zeiten { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.zeiten .feld { margin-bottom: 12px; }
input[type="time"], input[type="number"] { direction: ltr; }
[dir="rtl"] input[type="time"], [dir="rtl"] input[type="number"] { text-align: end; }

.pause { margin-bottom: 14px; }
.pause .feld { margin-bottom: 0; }
.schnell { display: flex; gap: 6px; margin-top: 8px; }
.schnell button {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 2px;
  border: 1px solid var(--linie);
  border-radius: 10px;
  background: #fff;
  color: var(--marke);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.schnell button[aria-pressed="true"] { background: var(--marke); border-color: var(--marke); color: #fff; }
.schnell button:disabled { color: #b3b4c4; cursor: default; }

.tag-fuss { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.tag-fuss .knopf { width: auto; min-height: 44px; padding: 6px 14px; font-weight: 600; }
.speicher { font-size: .9rem; color: var(--text-leise); min-height: 1.3em; margin-inline-start: auto; }
.speicher.ok { color: var(--gruen); }
.speicher.fehler { color: var(--rot); }
.hinweise { margin-top: 10px; }
.hinweise .meldung { margin-bottom: 6px; padding: 8px 12px; font-size: .95rem; }

.summe {
  display: flex;
  justify-content: center;
  margin: 18px 0 14px;
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.abgeben-hinweis { margin-top: 10px; text-align: center; }

/* Oben auf dem Zettel: Arbeitszeit und Pausen der Woche (04.11.2026) */
.kopf-summe { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 14px; }
.kopf-summe > div {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
  background: var(--karte); border: 1px solid var(--linie); border-radius: 10px;
}
.kopf-summe b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.kostenstelle { margin: 0 0 14px; }
.kostenstelle .feld { margin-bottom: 4px; }
.kostenstelle p { margin: 4px 0 0; }

.tipp { display: flex; align-items: flex-start; gap: 8px; margin-top: 20px; }
.tipp p { flex: 1; margin: 0; padding-top: 10px; }
.tipp .zu {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--marke);
  font-size: 1.5rem;
  cursor: pointer;
}

/* ---------- Dialog */
.dialog-hintergrund {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(16, 17, 40, .45);
}
.dialog {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}
.dialog p { font-size: 1.05rem; margin-bottom: 18px; }
@media (min-width: 600px) { .dialog-hintergrund { align-items: center; } }

/* ---------- Laden */
.laden {
  width: 36px;
  height: 36px;
  margin: 48px auto;
  border: 4px solid var(--marke-hell);
  border-top-color: var(--marke);
  border-radius: 50%;
  animation: drehen 1s linear infinite;
}
@keyframes drehen { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .laden { animation-duration: 3s; } }

@media (max-width: 370px) {
  body { font-size: 16px; }
  .schnell { gap: 4px; }
}

.unter-link { margin: 8px 0 0; }
.karten-titel { margin-bottom: 8px; }

/* Zwei Pausen mit Uhrzeit von bis (Befund 8) */
.pause-zeile { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 10px; margin-bottom: 12px; }
.pause-zeile .feld { margin-bottom: 0; }
.pause-zeile input { min-width: 0; width: 100%; }
.pause-name { grid-column: 1 / -1; font-weight: 600; }

/* Bestaetigung vor dem Abgeben (Befund 3) */
.dialog .bestaetigung { background: var(--flaeche, #f4f5f8); border-radius: 10px; padding: 12px; margin-bottom: 16px; }
.dialog .bestaetigung p { font-size: .95rem; margin-bottom: 10px; }
.dialog .bestaetigung p.klein { font-size: .82rem; }
.haken { display: flex; gap: 10px; align-items: center; font-weight: 600; cursor: pointer; }
.haken input { width: 24px; height: 24px; flex: none; }
.knopf:disabled { opacity: .45; cursor: default; }
