/* Backup-Ampel. Hell und dunkel, fuer das Handy zuerst. */
:root {
  --grund: #f6f5f2; --flaeche: #ffffff; --text: #1f2328; --leise: #6a6f77; --linie: #e2e0db;
  --gruen: #1a7f37; --gelb: #c98a00; --rot: #c62828; --grau: #b9bcc2; --offen: #e9e7e2;
  --gruen-hg: #e6f4ea; --gelb-hg: #fdf3d8; --rot-hg: #fbe6e6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #16181b; --flaeche: #1f2226; --text: #e6e6e6; --leise: #9aa0a8; --linie: #2e3237;
    --gruen: #3fb26a; --gelb: #e0a82e; --rot: #ef5350; --grau: #5a5f66; --offen: #2a2d32;
    --gruen-hg: #17301f; --gelb-hg: #33290f; --rot-hg: #3a1a1a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--grund); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 720px; margin: 0 auto; padding: 16px 14px 8px; }
h1 { font-size: 1.35rem; margin: 0; line-height: 1.2; }
h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); margin: 26px 0 8px; }
h3 { font-size: 1rem; margin: 0 0 2px; }
em { font-style: normal; font-size: .75rem; color: var(--leise); border: 1px solid var(--linie); border-radius: 4px; padding: 0 4px; margin-left: 4px; white-space: nowrap; }
a { color: inherit; }
.klein { font-size: .85rem; color: var(--leise); margin: 2px 0 0; }
.fehler { color: var(--rot); }

.punkt {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 1.3em; height: 1.3em; border-radius: 50%; font-size: .8em; font-weight: 700;
  color: #fff; background: var(--grau); vertical-align: -.15em;
}
.punkt.klein { width: 1.1em; height: 1.1em; font-size: .7em; }
.punkt.gross { width: 56px; height: 56px; font-size: 28px; }
.gruen.punkt { background: var(--gruen); } .gelb.punkt { background: var(--gelb); } .rot.punkt { background: var(--rot); }

.gesamt { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 12px; background: var(--flaeche); border: 1px solid var(--linie); }
.gesamt.gruen { background: var(--gruen-hg); border-color: transparent; }
.gesamt.gelb { background: var(--gelb-hg); border-color: transparent; }
.gesamt.rot { background: var(--rot-hg); border-color: transparent; }

.probleme { list-style: none; padding: 0; margin: 12px 0 0; }
.probleme li { padding: 8px 10px; margin-bottom: 6px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; font-size: .92rem; }

.maschine, .sicherung, .lauf { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.kopien { list-style: none; padding: 0; margin: 8px 0 0; font-size: .9rem; }
.kopien li { padding: 3px 0; }

/* Raster: Spalte fuer die Kennung, dann 14 Tage, heute links */
.raster { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; margin-top: 10px; }
.raster.kopf { margin: 10px 0 -7px; font-size: .66rem; color: var(--leise); text-align: center; }
.raster.kopf .we { font-weight: 700; }
.raster.kopf .heute { color: var(--text); font-weight: 700; text-decoration: underline; }
.feld {
  aspect-ratio: 1; min-height: 18px; border-radius: 4px; display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; color: #fff; text-decoration: none; background: var(--offen);
}
.feld.gruen { background: var(--gruen); } .feld.gelb { background: var(--gelb); } .feld.rot { background: var(--rot); }
.feld.grau { background: var(--grau); }
.feld.offen { background: transparent; border: 1.5px dashed var(--grau); }
.feld.leer { background: var(--offen); }
.feld.laeuft { background: var(--offen); color: var(--leise); }
a.feld:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }

.legende { list-style: none; padding: 0; margin: 22px 0 4px; font-size: .82rem; color: var(--leise); }
.legende li { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.legende .feld { width: 18px; height: 18px; display: inline-flex; flex: none; }

.status { padding: 10px 12px; border-radius: 8px; background: var(--flaeche); border: 1px solid var(--linie); }
.status.gruen { background: var(--gruen-hg); } .status.gelb { background: var(--gelb-hg); } .status.rot { background: var(--rot-hg); }
.lauf h2 { text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--text); margin: 0; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; font-size: .88rem; margin: 10px 0; }
dt { color: var(--leise); } dd { margin: 0; }
details summary { cursor: pointer; font-size: .88rem; color: var(--leise); }
pre { white-space: pre-wrap; word-break: break-word; font-size: .74rem; line-height: 1.35; background: var(--grund); padding: 10px; border-radius: 6px; margin: 8px 0 0; max-height: 70vh; overflow: auto; }
.zurueck { text-decoration: none; color: var(--leise); }

.anmeldung { max-width: 300px; padding-top: 30vh; }
.anmeldung form { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
input[type=password] { font-size: 1rem; padding: 10px 12px; border: 1px solid var(--linie); border-radius: 8px; background: var(--flaeche); color: var(--text); }
button { font: inherit; padding: 10px 14px; border-radius: 8px; border: 0; background: var(--text); color: var(--grund); cursor: pointer; }
button.leise { background: none; color: var(--leise); padding: 4px 0; text-decoration: underline; }

footer { max-width: 720px; margin: 0 auto; padding: 8px 14px 28px; display: flex; justify-content: space-between; align-items: center; font-size: .75rem; color: var(--leise); }
footer form { margin: 0; }

/* 1.1: Codes, Hinweise, Knoepfe, Diagnose */
code { font: .75rem ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--grund); border: 1px solid var(--linie); border-radius: 4px; padding: 0 4px; white-space: nowrap; }
.hinweis { padding: 8px 10px; border-radius: 8px; background: var(--gelb-hg); font-size: .9rem; }
.probleme a { text-decoration: none; }
.knoepfe { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
button.zweit { background: var(--grund); color: var(--text); border: 1px solid var(--linie); padding: 7px 10px; font-size: .88rem; }
textarea { width: 100%; margin-top: 8px; font: .72rem/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--grund); color: var(--text); border: 1px solid var(--linie); border-radius: 6px; padding: 8px; }
details > summary { cursor: pointer; }
.anmeldung input[type=password] { width: 100%; }

/* 1.2: Karten, Quittieren, Einstellungen, Verlauf, Hilfe */
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.karte h2 { text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--text); margin: 0 0 4px; }
.karte > summary { font-weight: 600; }
.probleme li.quittiert { opacity: .65; }
.quittung { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
select, input[type=time], input[type=url], input[name=bestaetigung] {
  font: inherit; font-size: .9rem; padding: 6px 8px; border: 1px solid var(--linie); border-radius: 6px; background: var(--grund); color: var(--text);
}
button.klein { padding: 4px 8px; font-size: .8rem; }
.einstellungen { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.einstellungen label { display: flex; flex-direction: column; gap: 3px; font-size: .85rem; color: var(--leise); }
.einstellungen button { align-self: flex-start; }
.verlauf { display: block; width: 100%; height: 22px; margin-top: 2px; fill: var(--grau); }
.verlauf-titel { margin-top: 8px; font-size: .72rem; }
.hilfe li { margin-bottom: 6px; }
.hilfe .feld { width: 18px; height: 18px; display: inline-flex; vertical-align: -4px; }
dl.codes { grid-template-columns: 1fr; }
dl.codes dt { color: var(--text); font-weight: 600; margin-top: 8px; }
footer a { color: inherit; }
.wartung a { text-decoration: none; }
.wartung-zeile { padding: 6px 0; border-bottom: 1px solid var(--linie); }
.wartung-zeile:last-child { border-bottom: 0; }
input[type=date], input[name=notiz] { font: inherit; font-size: .9rem; padding: 6px 8px; border: 1px solid var(--linie); border-radius: 6px; background: var(--grund); color: var(--text); }
input[name=notiz] { flex: 1 1 140px; min-width: 0; }
.beweise { margin-top: 6px; }
.beweis { display: inline-block; margin: 2px 4px 0 0; padding: 1px 6px; border-radius: 4px; font-size: .75rem; }
.beweis.ja { background: var(--gruen-hg); color: var(--text); }
.beweis.nein { background: var(--offen); color: var(--leise); }

/* 1.4: Reiter, Orte, Ringe, Matrix, Platz, Verkehr, Auftraege */
:root { --sich: #2f6fb2; }
@media (prefers-color-scheme: dark) { :root { --sich: #5b9be0; } }
.reiter { display: flex; gap: 4px; overflow-x: auto; margin: 12px -14px 0; padding: 0 14px 2px; scrollbar-width: none; }
.reiter a { flex: none; text-decoration: none; font-size: .85rem; padding: 6px 10px; border-radius: 16px; color: var(--leise); border: 1px solid var(--linie); background: var(--flaeche); }
.reiter a.aktiv { color: var(--grund); background: var(--text); border-color: var(--text); }
.einleitung { margin-top: 12px; }
.orte { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 700px) { .orte { grid-template-columns: repeat(3, 1fr); } main { max-width: 1040px; } footer { max-width: 1040px; } }
.ort { background: var(--grund); border: 1px solid var(--linie); border-radius: 12px; padding: 10px; }
.ort > h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); margin: 0 0 8px; }
.geraet { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.geraet:last-child { margin-bottom: 0; }
.geraet.geplant { opacity: .7; border-style: dashed; }
.geraet h4 { margin: 0; font-size: .98rem; }
.platte, .ziel { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.ziel { align-items: flex-start; border-top: 1px solid var(--linie); padding-top: 10px; margin-top: 10px; }
.ziel > div { flex: 1; min-width: 0; }
.ziel h3 .klein { font-weight: 400; }
.ziel dl { margin: 6px 0 0; }
.ring { width: 76px; height: 76px; flex: none; transform: rotate(0deg); }
.ring circle { stroke: var(--grau); }
.ring .t-grund { stroke: var(--offen); }
.ring .t-sich { stroke: var(--sich); } .ring .t-sonst { stroke: var(--grau); } .ring .t-frei { stroke: var(--offen); }
.ring .t-gelb { stroke: var(--gelb); } .ring .t-rot { stroke: var(--rot); }
.ring-mitte { font-size: 7px; font-weight: 700; fill: var(--text); }
.ring-legende { list-style: none; padding: 0; margin: 0; font-size: .8rem; color: var(--leise); }
.ring-legende i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--offen); }
.ring-legende i.t-sich { background: var(--sich); } .ring-legende i.t-sonst { background: var(--grau); }
.ring-legende i.t-frei { background: var(--offen); border: 1px solid var(--linie); }
.chips { line-height: 2; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; text-decoration: none; padding: 1px 7px; border-radius: 12px; border: 1px solid var(--linie); background: var(--grund); color: var(--text); white-space: nowrap; }
.chip.grau { color: var(--leise); }
.chip em { margin-left: 2px; }
.tabelle-rahmen { overflow-x: auto; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .86rem; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--linie); text-align: left; vertical-align: top; }
thead th { font-size: .78rem; color: var(--leise); font-weight: 600; white-space: nowrap; }
tbody th { font-weight: 400; }
tr:last-child th, tr:last-child td { border-bottom: 0; }
td.zahl { text-align: right; white-space: nowrap; }
td.mitte, .matrix thead th:nth-child(n+3) { text-align: center; }
.matrix td.mitte a { text-decoration: none; }
tr.nebenzeile td { padding-top: 0; }
.matrix tr:has(+ tr.nebenzeile) th, .matrix tr:has(+ tr.nebenzeile) td { border-bottom: 0; }
.inhalte { list-style: none; padding: 0; margin: 0; }
.inhalte li { padding: 8px 0; border-bottom: 1px solid var(--linie); }
.inhalte li:last-child { border-bottom: 0; }
.monate { display: block; width: 100%; height: 50px; fill: var(--sich); margin-top: 4px; }
.monatsnamen { font-size: .72rem; }
.auswahl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.auswahl select { flex: 1 1 200px; }
.erklaerung { margin-top: 12px; padding: 10px; border-radius: 8px; background: var(--grund); }
.erklaerung h3 { margin-bottom: 4px; }
.erklaerung dl { grid-template-columns: 1fr; gap: 0; }
.erklaerung dt { margin-top: 6px; font-size: .78rem; }
button.start { background: var(--sich); color: #fff; }
.zwischen { font-size: .85rem; color: var(--leise); margin: 14px 0 0; font-weight: 600; }
.fuss { margin-top: 24px; }
.weg { white-space: nowrap; }
@media (max-width: 520px) {
  .ziel { flex-wrap: wrap; }
  .ziel > div { flex-basis: 100%; }
  .ziel .ring { width: 64px; height: 64px; }
  .reiter a { padding: 6px 9px; }
  table { font-size: .8rem; }
  th, td { padding: 6px 6px; }
  .nur-breit { display: none; }
}

/* 1.5: Erklaerung erscheint sofort nach der Auswahl (CSS :has, kein JavaScript). Ohne :has: Knopf und ?auftrag= */
.erklaerungen > .erklaerung { display: none; }
@supports not selector(:has(*)) { .erklaerungen > .gewaehlt { display: block; } }
@supports selector(:has(*)) { .nur-ohne-has { display: none; } }
.auftraege:has(option:nth-child(2):checked) .erklaerungen > :nth-child(1),
.auftraege:has(option:nth-child(3):checked) .erklaerungen > :nth-child(2),
.auftraege:has(option:nth-child(4):checked) .erklaerungen > :nth-child(3),
.auftraege:has(option:nth-child(5):checked) .erklaerungen > :nth-child(4),
.auftraege:has(option:nth-child(6):checked) .erklaerungen > :nth-child(5),
.auftraege:has(option:nth-child(7):checked) .erklaerungen > :nth-child(6),
.auftraege:has(option:nth-child(8):checked) .erklaerungen > :nth-child(7),
.auftraege:has(option:nth-child(9):checked) .erklaerungen > :nth-child(8),
.auftraege:has(option:nth-child(10):checked) .erklaerungen > :nth-child(9),
.auftraege:has(option:nth-child(11):checked) .erklaerungen > :nth-child(10),
.auftraege:has(option:nth-child(12):checked) .erklaerungen > :nth-child(11),
.auftraege:has(option:nth-child(13):checked) .erklaerungen > :nth-child(12),
.auftraege:has(option:nth-child(14):checked) .erklaerungen > :nth-child(13),
.auftraege:has(option:nth-child(15):checked) .erklaerungen > :nth-child(14),
.auftraege:has(option:nth-child(16):checked) .erklaerungen > :nth-child(15) { display: block; }
.wartung-formular { align-items: flex-end; }
.beschriftet { display: flex; flex-direction: column; gap: 2px; font-size: .75rem; color: var(--leise); }
.beschriftet.notiz { flex: 1 1 140px; min-width: 0; }
.beschriftet.notiz input { width: 100%; }
.karte.geplant { border-style: dashed; opacity: .8; }
.beschriftet input, .beschriftet select { flex: none; }
.beschriftet.notiz { flex: 1 1 220px; }
