/* Bedienoberflaeche der Berichtsheft-App - auf iPad-Bedienung ausgelegt:
   grosse Schrift, grosse Flaechen zum Antippen, keine winzigen Knoepfe. */

:root {
  --bg:      #f2f4f7;
  --karte:   #ffffff;
  --text:    #14171c;
  --grau:    #6a7280;
  --linie:   #dfe3e9;
  --akzent:  #1f5f8b;
  --akzent-hell: #e8f1f8;
  --gruen:   #14713d;
  --gelb:    #8a6100;
  --rot:     #a8322a;
  --gelb-hg: #fdf6e3;
  --gruen-hg:#e9f6ee;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #101317;
    --karte:   #1b1f25;
    --text:    #e9ecf0;
    --grau:    #98a1ad;
    --linie:   #2b313a;
    --akzent:  #6cb0e0;
    --akzent-hell: #16303f;
    --gruen:   #56c98a;
    --gelb:    #d9ad4a;
    --rot:     #e5776c;
    --gelb-hg: #2a2416;
    --gruen-hg:#152a1f;
  }
}

* { box-sizing: border-box; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ------------------------------------------------------------- Kopfleiste */

header {
  position: sticky; top: 0; z-index: 20;
  background: var(--karte);
  border-bottom: 1px solid var(--linie);
  padding: env(safe-area-inset-top) 0 0;
}
.kopf-innen {
  max-width: 900px; margin: 0 auto;
  padding: 14px 18px 0;
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.kopf-innen h1 { font-size: 21px; margin: 0; letter-spacing: -0.01em; }
.kopf-innen .wer { color: var(--grau); font-size: 15px; }

nav {
  max-width: 900px; margin: 0 auto;
  display: flex; gap: 4px; padding: 10px 12px 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
nav button {
  flex: none;
  background: none; border: none; border-bottom: 3px solid transparent;
  color: var(--grau); font: inherit; font-size: 16px; font-weight: 600;
  padding: 10px 14px 12px; cursor: pointer; white-space: nowrap;
}
nav button[aria-selected="true"] { color: var(--akzent); border-bottom-color: var(--akzent); }

/* ----------------------------------------------------------------- Inhalt */

main { max-width: 900px; margin: 0 auto; padding: 20px 18px 80px; }
section[hidden] { display: none; }

.karte {
  background: var(--karte); border: 1px solid var(--linie);
  border-radius: 14px; padding: 18px; margin-bottom: 16px;
}
.karte > h2 {
  font-size: 14px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--grau); margin: 0 0 14px; font-weight: 700;
}

/* --------------------------------------------------------------- Formular */

.felder { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
label { display: block; font-size: 14px; color: var(--grau); margin-bottom: 5px; font-weight: 600; }

input, textarea, select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg);
  border: 1px solid var(--linie); border-radius: 10px;
  padding: 11px 12px;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--akzent); outline-offset: -1px; background: var(--karte);
}
textarea { min-height: 108px; resize: vertical; line-height: 1.55; }

/* ------------------------------------------------------------------- Tage */

.tag { margin-bottom: 16px; }
.tag-kopf {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.tag-kopf h3 { font-size: 18px; margin: 0; }
.tag-summe { font-size: 15px; color: var(--grau); font-variant-numeric: tabular-nums; }
.tag-summe strong { color: var(--text); font-size: 17px; }

.hinweis { font-size: 14px; color: var(--grau); margin: 8px 0 0; }

/* Aufgeschluesselte Vorschau der eingegebenen Zeilen */
.zeilen { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.zeile {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px; font-size: 15px;
  background: var(--bg); border: 1px solid var(--linie);
}
.zeile .std {
  flex: none; min-width: 52px; text-align: right;
  font-variant-numeric: tabular-nums; font-weight: 700;
}
.zeile .txt { flex: 1; min-width: 0; }
.marke {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 3px 8px; border-radius: 20px; white-space: nowrap;
}
.zeile .marke  { flex: none; }
.marke.bekannt { background: var(--gruen-hg); color: var(--gruen); }
.marke.neu     { background: var(--gelb-hg);  color: var(--gelb); }
.marke.offen   { background: var(--gelb-hg);  color: var(--gelb); }
.zeile.ohne-std { border-color: var(--gelb); }

/* ----------------------------------------------------------------- Knoepfe */

.knopfreihe { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
button.tat {
  font: inherit; font-weight: 700; font-size: 17px;
  padding: 13px 20px; border-radius: 11px; border: 1px solid var(--akzent);
  background: var(--akzent); color: #fff; cursor: pointer;
}
button.tat.zweit { background: var(--karte); color: var(--akzent); }
button.tat:disabled { opacity: .45; cursor: default; }
button.klein {
  font: inherit; font-size: 15px; padding: 8px 14px;
  border-radius: 9px; border: 1px solid var(--linie);
  background: var(--karte); color: var(--text); cursor: pointer;
}

/* ------------------------------------------------- Umschalter Wochenart
   Drei Flaechen nebeneinander, gross genug fuer den Daumen. Die gewaehlte
   ist gefuellt - auf einen Blick erkennbar, ohne hinsehen zu muessen. */

.wahl { display: flex; gap: 8px; flex-wrap: wrap; }
.wahl button {
  flex: 1 1 0; min-width: 110px;
  font: inherit; font-size: 16px; font-weight: 600;
  padding: 12px 10px; border-radius: 10px;
  border: 1px solid var(--linie); background: var(--karte);
  color: var(--text); cursor: pointer;
}
.wahl button[aria-pressed="true"] {
  background: var(--akzent); border-color: var(--akzent); color: #fff;
}

/* ------------------------------------------------------- Tagesstunden
   Das Feld sitzt in der Kopfzeile des Tages und ist bewusst schmal:
   Es nimmt eine Zahl auf, keinen Satz. */

.tag-summe input.tagesstunden {
  width: 68px; padding: 6px 8px; margin: 0 4px;
  font: inherit; font-weight: 700; text-align: right;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--linie); border-radius: 8px;
  background: var(--karte); color: var(--text);
}
.tag-summe input.tagesstunden.geaendert { border-color: var(--akzent); color: var(--akzent); }

/* ----------------------------------------------------------------- Summen */

.gesamt {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 18px; border-radius: 12px;
  background: var(--akzent-hell); border: 1px solid var(--linie);
  font-size: 18px; font-weight: 700;
}
.gesamt .zahl { font-variant-numeric: tabular-nums; font-size: 22px; }

/* ---------------------------------------------------------------- Meldung */

.meldung { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 15px; }
.meldung.gut  { background: var(--gruen-hg); color: var(--gruen); }
.meldung.warn { background: var(--gelb-hg);  color: var(--gelb); }
.meldung.fehl { background: #fdecea; color: var(--rot); }
@media (prefers-color-scheme: dark) { .meldung.fehl { background: #2c1a18; } }

/* ---------------------------------------------------------------- Schicht
   Der Kasten, der sich ueber die Seite legt, wenn etwas zu entscheiden ist.
   Bewusst kein Systemdialog: Hier stehen mehrere Zeilen zum Auswaehlen. */

.schicht {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 14, 20, .55);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px;
}
@media (min-width: 640px) { .schicht { align-items: center; } }
.schicht[hidden] { display: none; }

.schicht .kasten {
  background: var(--karte); border-radius: 16px;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
}
.schicht .kasten h2 { margin-top: 0; }

/* Das Wort, um das es geht - im Fliesstext hervorgehoben. */
.wort {
  font-weight: 700; color: var(--akzent);
  background: var(--akzent-hell); padding: 1px 5px; border-radius: 5px;
}

/* Eine vorgeschlagene Zeile: Haken davor, Begruendung darunter. */
.vorschlag-zeile {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px; margin-bottom: 8px;
  border: 1px solid var(--linie); border-radius: 10px; background: var(--bg);
}
.vorschlag-zeile input { width: auto; flex: none; margin-top: 3px; transform: scale(1.3); }
.vorschlag-zeile .text { flex: 1; min-width: 0; font-weight: 600; }
.warum { display: block; font-weight: 400; font-size: 13px; color: var(--grau); margin-top: 3px; }

/* Was das Programm ergaenzt hat, bleibt sichtbar markiert. */
.marke.ergaenzt { background: var(--akzent-hell); color: var(--akzent); }

/* ------------------------------------------------------------ Rueckfragen
   Je Frage ein Kasten mit Antwortfeld. Bewusst grosszuegig: Hier wird
   getippt, nicht nur gelesen. */

.rueckfrage {
  border: 1px solid var(--linie); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px; background: var(--bg);
}
.rueckfrage .stichpunkt { color: var(--grau); font-size: 14px; }
.rueckfrage .frage { font-weight: 600; margin: 4px 0 10px; }
.rueckfrage input { margin-bottom: 8px; }

/* Stand der Woche: was noch fehlt, in Ruhe aufgezaehlt. */
.stand-liste { margin: 12px 0 0; padding: 0; list-style: none; }
.stand-liste li {
  padding: 7px 0 7px 22px; position: relative; font-size: 15px;
}
.stand-liste li::before {
  position: absolute; left: 0; top: 7px; font-weight: 700;
}
.stand-liste li.fehlt::before   { content: "×"; color: var(--rot); }
.stand-liste li.pruefen::before { content: "!"; color: var(--gelb); }
.stand-liste li.fertig::before  { content: "✓"; color: var(--gruen); }

/* --------------------------------------------------------------- Tabellen */

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--linie); }
th { color: var(--grau); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
.tabellenrahmen { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Stand-Spalte im Verlauf: Marke und Knopf untereinander, damit die Tabelle
   auf dem iPhone nicht seitlich wegläuft. */
td.stand { white-space: nowrap; }
td.stand .marke { margin-right: 8px; }
button.tabellenknopf {
  font: inherit; font-size: 14px; padding: 7px 12px;
  border-radius: 8px; border: 1px solid var(--akzent);
  background: var(--karte); color: var(--akzent); cursor: pointer;
}
button.tabellenknopf.zuruecknehmen { border-color: var(--linie); color: var(--grau); }
button.tabellenknopf:disabled { opacity: .45; cursor: default; }

.leer { color: var(--grau); text-align: center; padding: 30px 10px; }

/* ------------------------------------------------- Berufsschul-Ansicht
   Je Schulstunde eine Zeile: Fach umstellbar, Themenfeld, Vorschlaege
   zum Antippen. Auf dem iPad grosszuegig, damit man sicher trifft. */

.schultag { margin-bottom: 20px; }
.schultag h3 { font-size: 17px; margin: 0 0 10px; }

.schulzeile {
  display: grid;
  grid-template-columns: minmax(108px, auto) 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--linie);
  border-radius: 10px;
}
.schulzeile .chips { grid-column: 1 / -1; }

select.schulfach {
  font-size: 15px; font-weight: 700;
  padding: 9px 8px; background: var(--karte);
}
input.schulthema { font-size: 16px; padding: 10px; background: var(--karte); }

button.schulweg {
  font-size: 20px; line-height: 1;
  padding: 6px 12px; color: var(--grau);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
button.chip {
  font: inherit; font-size: 14px;
  padding: 7px 12px; border-radius: 20px;
  border: 1px solid var(--linie); background: var(--karte);
  color: var(--akzent); cursor: pointer;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
button.chip:active { background: var(--akzent-hell); }

button.schulplus { margin-top: 4px; }

@media (max-width: 560px) {
  .schulzeile { grid-template-columns: 1fr auto; }
  select.schulfach { grid-column: 1 / -1; }
}

/* ------------------------------------------------- Art des einzelnen Tages
   Eine Woche ist nicht immer aus einem Guss: Montag Feiertag, danach Schule.
   Die Auswahl sitzt in der Kopfzeile des Tages, bleibt aber zurueckhaltend -
   im Normalfall steht dort "wie die Woche" und es gibt nichts zu tun. */

select.tagesart {
  font: inherit; font-size: 14px;
  padding: 5px 8px; margin-right: 10px;
  border-radius: 8px; border: 1px solid var(--linie);
  background: var(--karte); color: var(--grau);
  max-width: 150px;
}
select.tagesart[data-gesetzt="ja"] {
  color: var(--text); font-weight: 600; border-color: var(--akzent);
}

/* --------------------------------------------------------- Anmeldung
   Liegt ueber der ganzen Seite, solange nicht angemeldet ist. Bewusst
   schlicht: Hier gibt es nichts zu entdecken, nur zwei Felder. */

#anmeldeschirm {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
}
#anmeldeschirm[hidden] { display: none; }

.anmeldekasten {
  width: 100%; max-width: 420px;
  background: var(--karte); border: 1px solid var(--linie);
  border-radius: 14px; padding: 26px;
}
.anmeldekasten h1 { margin: 0 0 4px; font-size: 26px; }
.anmeldekasten label {
  display: block; margin: 16px 0 6px; font-size: 15px; font-weight: 600;
}
.anmeldekasten input {
  width: 100%; box-sizing: border-box;
  font: inherit; font-size: 17px;      /* unter 16px zoomt Safari beim Tippen */
  padding: 12px; border-radius: 10px;
  border: 1px solid var(--linie); background: var(--bg); color: var(--text);
}
.anmeldekasten button { width: 100%; margin-top: 20px; }
