:root {
  --bg: #f6f7f9; --karte: #fff; --text: #1d2430; --leise: #6b7480; --akzent: #e0a800; --linie: #dde1e6;
  --blau: #2a78d6; --blau-hell: #cde2fb; --gut: #0ca30c; --kritisch: #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15181d; --karte: #1f242b; --text: #e8ebef; --leise: #9aa3ad; --linie: #333a44; --blau: #3987e5; --blau-hell: #0d366b; }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; }
header { padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
header h1 { font-size: 1.3rem; margin: 0; }
header h1 a { text-decoration: none; }
header nav { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.blitz { color: var(--akzent); font-size: 1.5rem; }
main { padding: 0 16px 32px; max-width: 1100px; margin: 0 auto; }
main.breit { max-width: none; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.karte { background: var(--karte); border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 16px; }
.schmal { max-width: 420px; margin: 8vh auto 0; }
.leise { color: var(--leise); }
.klein { font-size: .85rem; }
code { font-size: 1rem; }

/* Formulare – groß genug für Finger */
input, select, textarea, button, .knopf { font: inherit; color: inherit; border-radius: 8px; border: 1px solid var(--linie); background: var(--karte); padding: 10px 12px; min-height: 44px; }
textarea { width: 100%; min-height: 80px; resize: vertical; }
button, .knopf { cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button.haupt { background: var(--akzent); border-color: var(--akzent); color: #1d2430; font-weight: 600; }
button.gefahr { color: var(--kritisch); }
button.aktiv { outline: 3px solid var(--akzent); }
label { display: block; margin-bottom: 12px; }
label span { display: block; font-size: .85rem; color: var(--leise); margin-bottom: 4px; }
label input, label select { width: 100%; }
.zeile { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.zeile .fuellen { flex: 1; min-width: 160px; }
form.inline { display: inline; }
.meldung { background: var(--karte); border-left: 4px solid var(--akzent); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }

table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 8px 6px; border-top: 1px solid var(--linie); vertical-align: middle; }
th { border-top: 0; font-size: .85rem; color: var(--leise); font-weight: 500; }

.projektliste { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.projektliste a { display: block; text-decoration: none; margin: 0; }
.projektliste strong { display: block; font-size: 1.1rem; margin-bottom: 4px; }

/* Reiter im Projekt */
.reiter { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--linie); }
.reiter a { padding: 10px 16px; text-decoration: none; color: var(--leise); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.reiter a.aktiv { color: var(--text); border-color: var(--akzent); font-weight: 600; }

/* Dashboard */
.kacheln { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.kacheln .karte { margin: 0; text-decoration: none; }
.kachel-zahl { font-size: 1.9rem; font-weight: 600; line-height: 1.1; }
.kachel-name { color: var(--leise); font-size: .85rem; margin-top: 4px; }
.held { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.held .zahl { font-size: 3.2rem; font-weight: 600; line-height: 1; }
.held .fuellen { flex: 1; min-width: 200px; }
.balken { height: 10px; border-radius: 5px; background: var(--blau-hell); overflow: hidden; min-width: 90px; }
.balken i { display: block; height: 100%; border-radius: 5px; background: var(--blau); }
.balken.fertig i { background: var(--gut); }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.breit { width: 35%; }
.marke { display: inline-block; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--linie); font-size: .8rem; white-space: nowrap; }
.marke.ueberfaellig { border-color: var(--kritisch); }
.marke.fertig { border-color: var(--gut); }
.tabelle-rahmen { overflow-x: auto; }

/* Übersichtsplan */
.werkzeuge { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.legende { display: flex; gap: 12px; align-items: center; font-size: .85rem; flex-wrap: wrap; margin: 8px 0; color: var(--leise); }
.legende i { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: 4px; vertical-align: -2px; border: 2px solid #1d2430; background: #fff; }
.legende i.halb { background: conic-gradient(#2a78d6 50%, #fff 0); }
.legende i.voll { background: #0ca30c; }
.legende i.kasten { border-radius: 3px; background: #1d2430; }
.legende i.sicherheit { border-radius: 2px; border-color: #d03b3b; transform: rotate(45deg) scale(.85); margin-right: 6px; }
.legende i.medien { background: #9aa3ad; border-color: #6b7480; }
.plan-rahmen { overflow: auto; height: 74vh; border: 1px solid var(--linie); border-radius: 12px; background: #fff; -webkit-overflow-scrolling: touch; }
.plan-flaeche { position: relative; width: 100%; --punkt: 10px; }
.plan-flaeche img { display: block; width: 100%; user-select: none; -webkit-user-drag: none; }
.plan-flaeche.setzen { cursor: crosshair; }
/* Kreis füllt sich mit dem Fortschritt; ganz fertig = grün */
.punkt { position: absolute; width: var(--punkt); height: var(--punkt); min-height: 0; padding: 0; margin: calc(var(--punkt) / -2) 0 0 calc(var(--punkt) / -2);
  border-radius: 50%; border: 2px solid #1d2430; box-shadow: 0 0 0 1.5px #fff; background: conic-gradient(#2a78d6 var(--anteil, 0%), #fff 0); }
.punkt.fertig { background: #0ca30c; }
.punkt.verteiler { border-radius: 3px; background: #1d2430; }
/* Sicherheitsrelevante Technik: Raute mit rotem Rand, füllt sich wie die Kreise */
.punkt.sicherheit { border-radius: 2px; border-color: #d03b3b; border-width: 3px; transform: rotate(45deg) scale(1.2); }
.punkt.medien { background: #9aa3ad; border-color: #6b7480; }
.punkt span { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 3px; padding: 0 5px; border-radius: 4px; background: #1d2430; color: #fff; font-size: .75rem; font-weight: 600; white-space: nowrap; pointer-events: none; }
.ohne-position button { margin: 0 6px 6px 0; }

dialog { border: 0; border-radius: 14px; padding: 20px; width: min(520px, 94vw); max-height: 92vh; background: var(--karte); color: var(--text); box-shadow: 0 8px 40px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog-kopf { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.dialog-kopf h2 { margin: 0; flex: 1; }
.schritt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 0 0 6px; border: 1px solid var(--linie); border-radius: 10px; cursor: pointer; }
.schritt input { width: 26px; height: 26px; min-height: 0; flex: none; accent-color: var(--gut); }
.schritt b { font-weight: 500; flex: 1; }
.schritt small { color: var(--leise); text-align: right; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 14px 0; }
dt { color: var(--leise); }
dd { margin: 0; }
details { margin: 0 0 12px; }
summary { cursor: pointer; padding: 8px 0; color: var(--leise); }

/* Prüfen und Ausrichten weiterer Pläne */
.pruefung p { margin: 6px 0 10px; }
.pruefung .zeile form { display: inline; }
#ausrichten { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--linie); }
#ausrichten-liste { margin: 8px 0; }
.ausricht-marke { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; pointer-events: none; }
.ausricht-marke::before, .ausricht-marke::after { content: ""; position: absolute; background: #d03b3b; }
.ausricht-marke::before { left: 10px; top: 0; width: 2px; height: 22px; }
.ausricht-marke::after { top: 10px; left: 0; height: 2px; width: 22px; }
.ausricht-marke span { position: absolute; left: 16px; top: -18px; background: #d03b3b; color: #fff; font-size: .75rem; padding: 0 4px; border-radius: 3px; white-space: nowrap; }
button:disabled { opacity: .45; cursor: default; }
