/* Diktier-App Brunnenbohrung Oschmann – ausgelegt fürs Handy (Samsung XCover, auch mit Handschuh), läuft auch am PC */
:root {
  --blau: #17324f;
  --blau-2: #24507e;
  --akzent: #e07b2a;          /* Sandfarbe aus der Säule: Hauptaktionen */
  --akzent-dunkel: #b95f17;
  --grund: #eef1f5;
  --karte: #ffffff;
  --karte-2: #f6f8fb;
  --text: #17202b;
  --grau: #5d6a78;
  --linie: #d6dde6;
  --rot: #b3261e;
  --rot-hell: #fdecea;
  --gruen: #1e7a3c;
  --gruen-hell: #e7f5ec;
  --gelb: #fff4cc;
  --gelb-rand: #e8c75a;
  --blau-hell: #e8f0fa;
  --schatten: 0 1px 2px rgba(16, 32, 52, .06), 0 4px 14px rgba(16, 32, 52, .07);
  --radius: 14px;
  --leiste-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grund: #0f141a; --karte: #19212b; --karte-2: #1f2934; --text: #e7edf3; --grau: #9aa8b6; --linie: #2e3a47;
    --gelb: #3a3320; --gelb-rand: #8a7430; --rot-hell: #3a1f1d; --gruen-hell: #18301f; --blau-hell: #1b2a3c;
    --schatten: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  --grund: #0f141a; --karte: #19212b; --karte-2: #1f2934; --text: #e7edf3; --grau: #9aa8b6; --linie: #2e3a47;
  --gelb: #3a3320; --gelb-rand: #8a7430; --rot-hell: #3a1f1d; --gruen-hell: #18301f; --blau-hell: #1b2a3c;
  --schatten: 0 1px 2px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--grund); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
.ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Kopfleiste */
.leiste { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 10px; min-height: 58px;
  padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--blau); color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
.leiste .marke { width: 34px; height: 34px; border-radius: 9px; flex: none; background: #fff2; display: grid; place-items: center; }
.leiste .marke svg { width: 22px; height: 22px; }
.leiste .titelblock { flex: 1; min-width: 0; }
.leiste h1 { margin: 0; font-size: 17px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leiste .untertitel { font-size: 12.5px; opacity: .78; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leiste .zurueck { background: #fff1; border: 0; color: #fff; width: 40px; height: 40px; border-radius: 10px; display: grid;
  place-items: center; cursor: pointer; flex: none; }
.leiste .status { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: #fff2; white-space: nowrap; }
.leiste .status:empty { display: none; }

/* ---------- Untere Leiste (Reiter) */
.reiter { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: center;
  background: var(--karte); border-top: 1px solid var(--linie); padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(16, 32, 52, .06); }
.reiter button { flex: 1; max-width: 220px; height: var(--leiste-h); border: 0; background: none; color: var(--grau);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12.5px;
  font-weight: 600; cursor: pointer; position: relative; }
.reiter button .ico { width: 24px; height: 24px; }
.reiter button.aktiv { color: var(--blau-2); }
.reiter button.aktiv::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--akzent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .reiter button.aktiv { color: #8fb8ea; } }

main { max-width: 860px; margin: 0 auto; padding: 14px 14px calc(var(--leiste-h) + 90px); }
body.ohne-reiter main { padding-bottom: 40px; }

/* ---------- Grundbausteine */
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 16px;
  margin-bottom: 14px; box-shadow: var(--schatten); }
.karte h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.karte h3 { font-size: 14.5px; margin: 16px 0 8px; }
.hinweis { color: var(--grau); font-size: 14px; margin: 8px 0 0; }
.leer { text-align: center; color: var(--grau); padding: 28px 12px; }
.zaehler { margin-left: auto; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px;
  background: var(--karte-2); color: var(--grau); border: 1px solid var(--linie); }

.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px; border-radius: 11px;
  border: 1px solid var(--blau-2); background: var(--blau-2); color: #fff; font-weight: 650; cursor: pointer;
  min-height: 46px; text-decoration: none; transition: transform .06s ease, filter .15s; }
.knopf:active { transform: scale(.98); }
.knopf:hover { filter: brightness(1.06); }
.knopf.haupt { background: var(--akzent); border-color: var(--akzent); }
.knopf.zweit { background: var(--karte); color: var(--blau-2); border-color: var(--linie); }
.knopf.gefahr { background: transparent; color: var(--rot); border-color: transparent; }
.knopf.klein { padding: 6px 12px; min-height: 36px; font-size: 14px; border-radius: 9px; }
.knopf.rund { width: 40px; min-height: 40px; padding: 0; border-radius: 10px; }
.knopf.breit { width: 100%; }
.knopf:disabled { opacity: .5; cursor: default; transform: none; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .knopf.zweit { color: #a9c9f0; } }

/* ---------- Startseite */
.start { background: linear-gradient(135deg, var(--blau) 0%, var(--blau-2) 100%); color: #fff; border: 0; }
.start h2 { color: #fff; font-size: 19px; margin-bottom: 4px; }
.start p { margin: 0 0 14px; opacity: .85; font-size: 14.5px; }
.start .knopf.haupt { width: 100%; font-size: 17px; min-height: 54px; }
.projekt { display: flex; gap: 14px; align-items: stretch; padding: 12px; cursor: pointer; }
.projekt .saeule { width: 26px; flex: none; border-radius: 6px; overflow: hidden; border: 1px solid var(--linie);
  background: var(--karte-2); display: flex; flex-direction: column; min-height: 64px; }
.projekt .saeule span { display: block; }
.projekt .info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.projekt .name { font-weight: 650; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.projekt .unter { font-size: 13.5px; color: var(--grau); }
.projekt .aktionen { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650; padding: 2px 9px;
  border-radius: 99px; width: max-content; }
.chip.gut { background: var(--gruen-hell); color: var(--gruen); }
.chip.offen { background: var(--gelb); color: #7a5a00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.offen { color: #f0d27a; } :root:not([data-theme="light"]) .chip.gut { color: #7fd39a; } }
.unterbereich { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }

/* ---------- Diktat */
.aufnahme { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0 4px; }
.mikro { width: 104px; height: 104px; border-radius: 50%; border: 0; background: var(--akzent); color: #fff;
  display: grid; place-items: center; cursor: pointer; position: relative; box-shadow: 0 6px 18px rgba(224, 123, 42, .35); }
.mikro .ico { width: 44px; height: 44px; stroke-width: 1.8; }
.mikro.an { background: var(--rot); box-shadow: 0 6px 18px rgba(179, 38, 30, .35); }
.mikro.an::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--rot);
  animation: puls 1.5s ease-out infinite; }
@keyframes puls { from { transform: scale(.92); opacity: .9; } to { transform: scale(1.25); opacity: 0; } }
.mikro-text { font-weight: 650; font-size: 15px; }
.zwischen { min-height: 1.4em; color: var(--grau); font-style: italic; text-align: center; font-size: 15px; max-width: 100%; }
.textkopf { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.textkopf h2 { margin: 0; }
textarea.diktat { width: 100%; min-height: 160px; margin-top: 10px; padding: 12px; border: 1px solid var(--linie);
  border-radius: 11px; background: var(--karte-2); color: var(--text); font-size: 16px; line-height: 1.5; resize: vertical; }
textarea.diktat:focus, .feld input:focus, .feld select:focus { outline: 2px solid var(--blau-2); outline-offset: 1px; }
.aktionsleiste { position: sticky; bottom: calc(var(--leiste-h) + env(safe-area-inset-bottom) + 8px); z-index: 3;
  display: flex; gap: 8px; padding: 10px; margin: 14px -6px 0; background: var(--karte); border: 1px solid var(--linie);
  border-radius: 14px; box-shadow: 0 6px 22px rgba(16, 32, 52, .14); }
.aktionsleiste .knopf { flex: 1; }
.aktionsleiste .knopf.rund { flex: none; }
details.tipps-box summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; align-items: center; gap: 8px; }
details.tipps-box summary::-webkit-details-marker { display: none; }
details.tipps-box summary::after { content: "▾"; margin-left: auto; color: var(--grau); transition: transform .2s; }
details.tipps-box[open] summary::after { transform: rotate(180deg); }
.tipps { font-size: 14.5px; color: var(--grau); margin: 10px 0 0; padding-left: 18px; }
.tipps li { margin: 5px 0; }

/* Auswertung */
.ergebnis-kopf { display: flex; align-items: center; gap: 8px; margin: 18px 0 4px; font-weight: 700; font-size: 15px; }
.ergebnis-kopf .auto { font-weight: 400; }
.abschnitt { border: 1px solid var(--linie); border-left: 4px solid var(--blau-2); border-radius: 11px; margin-top: 10px;
  background: var(--karte); overflow: hidden; }
.abschnitt > h3 { margin: 0; padding: 9px 12px; font-size: 14px; background: var(--karte-2); display: flex; align-items: center; gap: 8px; }
.abschnitt ul { list-style: none; margin: 0; padding: 0; }
.abschnitt li { padding: 9px 12px; border-top: 1px solid var(--linie); font-size: 14.5px; }
.abschnitt.ok { border-left-color: var(--gruen); }
.abschnitt.warn { border-left-color: var(--gelb-rand); }
.abschnitt.warn > h3 { background: var(--gelb); }
.abschnitt.fehlt { border-left-color: var(--akzent); }
.abschnitt.grau { border-left-color: var(--linie); }
.abschnitt.grau li { color: var(--grau); font-size: 14px; }
.abschnitt.frage { border-left-color: var(--rot); }
.abschnitt.frage > h3 { background: var(--rot-hell); }
.abschnitt li.vorschlag { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.abschnitt li.vorschlag .knopf { margin-left: auto; }
.abschnitt .innen { padding: 10px 12px; border-top: 1px solid var(--linie); }
.frage-eingabe { flex: 1; min-width: 160px; font-size: 16px; padding: 9px; border: 1px solid var(--linie); border-radius: 9px;
  background: var(--karte); color: var(--text); }
.vollstaendig { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 11px 12px; border-radius: 11px;
  background: var(--gruen-hell); color: var(--gruen); font-weight: 650; }
.uebergangen { font-style: italic; margin-top: 10px; font-size: 13px; }

/* ---------- Daten (Formular) */
details.klapp > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
details.klapp > summary::-webkit-details-marker { display: none; }
details.klapp > summary h2 { margin: 0; }
details.klapp > summary::after { content: "▾"; color: var(--grau); transition: transform .2s; }
details.klapp[open] > summary::after { transform: rotate(180deg); }
details.klapp[open] > summary { margin-bottom: 12px; }
.felder { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.feld { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--grau); }
.feld.breit { grid-column: 1 / -1; }
.feld input, .feld select, .feld textarea { font-size: 16px; font-weight: 400; padding: 9px 10px; border: 1px solid var(--linie);
  border-radius: 9px; background: var(--karte-2); color: var(--text); width: 100%; min-height: 44px; }
.feld input.fehler { border-color: var(--rot); background: var(--rot-hell); }
.feld.haken { flex-direction: row; align-items: center; gap: 10px; font-size: 15px; color: var(--text); }
.feld.haken input { width: 22px; height: 22px; min-height: 0; }
.eintrag { border: 1px solid var(--linie); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--karte); }
.eintrag .kopfzeile { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-weight: 650; }
.eintrag .kopfzeile .titel { flex: 1; min-width: 0; }
.farbfeld { width: 16px; height: 34px; border-radius: 4px; border: 1px solid #0003; flex: none; }
.kuerzel { font-family: ui-monospace, Consolas, monospace; font-size: 13px; font-weight: 600; padding: 2px 7px;
  border-radius: 6px; background: var(--blau-hell); color: var(--blau-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kuerzel { color: #a9c9f0; } }
.auto { font-size: 12px; color: var(--grau); font-weight: 400; }
.diktat-alt { border-top: 1px solid var(--linie); padding: 10px 0 0; margin-top: 10px; font-size: 14px; color: var(--grau); white-space: pre-wrap; }

/* ---------- Blätter */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip-wahl { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--linie); background: var(--karte-2); font-size: 14px; font-weight: 600; user-select: none; }
.chip-wahl input { width: 18px; height: 18px; accent-color: var(--blau-2); }
.chip-wahl.aus { opacity: .5; }
.vorschau { display: flex; flex-direction: column; gap: 14px; }
.vorschau .blattrahmen { position: relative; cursor: zoom-in; border-radius: 6px; overflow: hidden; box-shadow: var(--schatten);
  border: 1px solid var(--linie); background: #fff; }
.vorschau .blattrahmen::after { content: "Antippen zum Vergrößern"; position: absolute; right: 8px; bottom: 8px; font-size: 11px;
  background: #17324fcc; color: #fff; padding: 3px 8px; border-radius: 99px; }
.vorschau svg.blatt { display: block; width: 100%; height: auto; }
.vorschau .platzhalter { aspect-ratio: 297 / 210; display: flex; align-items: center; justify-content: center; color: #555;
  background: #fff; border: 1px dashed var(--linie); border-radius: 6px; }
.ansicht { position: fixed; inset: 0; z-index: 20; background: #0b1118f2; overflow: auto; -webkit-overflow-scrolling: touch; }
.ansicht .innen { width: max(1100px, 240vw); max-width: 2400px; padding: 12px; }
.ansicht svg { width: 100%; height: auto; background: #fff; display: block; }
.ansicht .schliessen { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 21; width: 46px; height: 46px;
  border-radius: 50%; border: 0; background: #fff; color: #17324f; font-size: 22px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 14px #0006; }
@media (min-width: 900px) { .ansicht .innen { width: 1600px; margin: 0 auto; } }

.meldung { position: fixed; left: 50%; bottom: calc(var(--leiste-h) + 22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #17202b; color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 30; max-width: 90vw; font-size: 15px;
  box-shadow: 0 6px 20px #0005; animation: einblenden .2s ease-out; }
@keyframes einblenden { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

code { font-size: 13px; background: var(--karte-2); padding: 1px 5px; border-radius: 5px; }

/* ---------- Druck / PDF */
#druckbereich { display: none; }
@page { size: A4 landscape; margin: 0; }
@media print {
  html, body { background: #fff; }
  body > *:not(#druckbereich) { display: none !important; }
  #druckbereich { display: block; }
  #druckbereich svg { display: block; width: 297mm; height: 210mm; break-after: page; page-break-after: always; }
  #druckbereich svg:last-child { break-after: auto; page-break-after: auto; }
}

/* Feinschliff */
details.klapp > summary h2 { flex: 1; }
details.klapp > summary .zaehler { margin-left: 0; }
details.mehr { margin-top: 10px; }
details.mehr > summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--blau-2); padding: 6px 0; }
details.mehr[open] > summary { margin-bottom: 8px; }
