/* Verzeichnis – Oberfläche (hell/dunkel, mobil) */
:root {
  --hg: #f5f7fb; --flaeche: #ffffff; --flaeche2: #f0f3f8; --rand: #e2e8f0; --text: #0f172a; --leise: #64748b;
  --akzent: #0d9488; --akzent2: #6366f1; --akzent-text: #fff; --gefahr: #dc2626; --warn: #d97706; --ok: #059669;
  --balken: linear-gradient(90deg, #14b8a6, #6366f1); --schatten: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.05);
  --radius: 14px; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) {
    --hg: #0b1120; --flaeche: #111a2e; --flaeche2: #17223a; --rand: #22304d; --text: #e2e8f0; --leise: #94a3b8;
    --akzent: #2dd4bf; --akzent2: #818cf8; --akzent-text: #04121a; --gefahr: #f87171; --warn: #fbbf24; --ok: #34d399;
    --schatten: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-thema="dunkel"] {
  --hg: #0b1120; --flaeche: #111a2e; --flaeche2: #17223a; --rand: #22304d; --text: #e2e8f0; --leise: #94a3b8;
  --akzent: #2dd4bf; --akzent2: #818cf8; --akzent-text: #04121a; --gefahr: #f87171; --warn: #fbbf24; --ok: #34d399;
  --schatten: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--hg); color: var(--text); font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--akzent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .2rem; letter-spacing: -.02em; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
h2 { font-size: 1.05rem; margin: 0 0 .9rem; letter-spacing: -.01em; }
h2 small, h3 small { font-weight: 400; color: var(--leise); font-size: .85rem; margin-left: .3rem; }
h3 { font-size: .95rem; margin: 1.2rem 0 .6rem; }
code, pre { font-family: var(--mono); font-size: .85em; }
.leise { color: var(--leise); } .klein { font-size: .85rem; } .zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.umbruch { word-break: break-all; } .fehlertext { color: var(--gefahr); }
[hidden] { display: none !important; }

/* Kopfzeile */
.kopf { position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.5rem;
  background: color-mix(in srgb, var(--flaeche) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rand); }
.marke { display: flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--text); font-size: 1.05rem; }
.marke:hover { text-decoration: none; } .logo { width: 30px; height: 30px; flex: none; }
.hauptnav { display: flex; gap: .2rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.hauptnav a { color: var(--leise); padding: .4rem .75rem; border-radius: 9px; white-space: nowrap; font-weight: 500; }
.hauptnav a:hover { background: var(--flaeche2); color: var(--text); text-decoration: none; }
.hauptnav a.aktiv { background: color-mix(in srgb, var(--akzent) 14%, transparent); color: var(--akzent); }
.kopf-rechts { display: flex; gap: .5rem; align-items: center; } .kopf-rechts form { margin: 0; }
.inhalt { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

/* Bausteine */
.karte { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--schatten); margin-bottom: 1.2rem; min-width: 0; }
.karte-kopf { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; } .karte-kopf h2 { margin: 0; }
.raster { display: grid; gap: 1.2rem; } .raster > .karte { margin-bottom: 0; } section.raster { margin-bottom: 1.2rem; }
.raster.zwei { grid-template-columns: repeat(2, minmax(0, 1fr)); } .raster.drei { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seitenkopf { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.seitenkopf p { margin: 0; } .brotkrumen { font-size: .85rem; color: var(--leise); }
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--rand);
  background: var(--flaeche); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: .15s; white-space: nowrap; }
.knopf:hover { border-color: var(--akzent); text-decoration: none; }
.knopf.primaer { background: linear-gradient(135deg, var(--akzent), var(--akzent2)); color: #fff; border: 0; }
.knopf.primaer:hover { filter: brightness(1.08); box-shadow: 0 4px 14px color-mix(in srgb, var(--akzent) 40%, transparent); }
.knopf.gefahr { background: var(--gefahr); color: #fff; border: 0; }
.knopf.leise { background: transparent; border-color: transparent; color: var(--leise); } .knopf.leise:hover { color: var(--text); }
.knopf.klein { padding: .3rem .65rem; font-size: .85rem; } .knopf.breit { width: 100%; } .knopf:disabled { opacity: .6; cursor: wait; }
.knopf-icon { background: none; border: 1px solid var(--rand); color: var(--text); border-radius: 9px; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; }
.knopf-reihe { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; } .knopf-reihe form { margin: 0; }
input, select, textarea { font: inherit; color: var(--text); background: var(--flaeche); border: 1px solid var(--rand); border-radius: 9px; padding: .5rem .65rem; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--akzent) 45%, transparent); border-color: var(--akzent); }
textarea.mono { font-family: var(--mono); font-size: .85rem; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--leise); }
.meldung { padding: .7rem .9rem; border-radius: 10px; margin: 0 0 1rem; font-size: .92rem; }
.meldung.fehler { background: color-mix(in srgb, var(--gefahr) 12%, transparent); color: var(--gefahr); border: 1px solid color-mix(in srgb, var(--gefahr) 30%, transparent); }
.meldung.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }
.leer { color: var(--leise); font-style: italic; margin: .3rem 0; }
.schalter { flex-direction: row; align-items: center; font-weight: 500; } .schalter input { width: auto; }

/* Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.kachel { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--schatten); position: relative; overflow: hidden; }
.kachel::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--balken); opacity: .7; }
.kachel-titel { color: var(--leise); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kachel-wert { font-size: 1.7rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: .15rem 0; }
.kachel-unter { color: var(--leise); font-size: .8rem; }
.kachel.akzent .kachel-wert { color: var(--akzent); } .kachel.warnung .kachel-wert { color: var(--warn); }

/* Balken, Stapel, Legende */
.balken-liste { display: flex; flex-direction: column; gap: .45rem; }
.balken-zeile { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; gap: .6rem; align-items: center; font-size: .88rem; }
.balken-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.balken-spur { background: var(--flaeche2); border-radius: 6px; height: 10px; overflow: hidden; }
.balken { height: 100%; background: var(--balken); border-radius: 6px; }
.balken-zahl { font-variant-numeric: tabular-nums; color: var(--leise); font-size: .82rem; white-space: nowrap; }
.balken-rest { font-size: .8rem; color: var(--leise); }
.stapel { display: flex; height: 14px; border-radius: 8px; overflow: hidden; background: var(--flaeche2); margin: .6rem 0; }
.legende { list-style: none; padding: 0; margin: .4rem 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .85rem; }
.legende i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.f-grau { background: #94a3b8; } .f-blau { background: #3b82f6; } .f-gruen { background: #10b981; } .f-rot { background: #ef4444; }
.f-gelb { background: #f59e0b; } .f-dunkel { background: #475569; } .f-teal { background: #14b8a6; }
.gross-zahl strong { font-size: 2rem; letter-spacing: -.02em; } .gross-zahl span { color: var(--leise); }
svg.verlauf { width: 100%; height: auto; display: block; }
svg.verlauf .vb { fill: #14b8a6; } svg.verlauf .vf { fill: #ef4444; } svg.verlauf .gitter { stroke: var(--rand); stroke-dasharray: 3 3; }
svg.verlauf .achse { fill: var(--leise); font-size: 10px; }

/* Tabellen */
.tabelle-huelle { overflow-x: auto; }
.tabelle { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabelle th { text-align: left; color: var(--leise); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; padding: .5rem .6rem; border-bottom: 1px solid var(--rand); white-space: nowrap; }
.tabelle td { padding: .55rem .6rem; border-bottom: 1px solid var(--rand); vertical-align: top; }
.tabelle tbody tr:hover { background: var(--flaeche2); } .tabelle tr.gesperrt td { opacity: .6; }
.tabelle.vergleich th { text-transform: none; font-size: .85rem; } .tabelle.vergleich tr.abweichend td { background: color-mix(in srgb, var(--warn) 10%, transparent); }
.marke-status { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--flaeche2); color: var(--leise); white-space: nowrap; }
.s-fertig { background: color-mix(in srgb, #10b981 18%, transparent); color: var(--ok); }
.s-laeuft { background: color-mix(in srgb, #3b82f6 18%, transparent); color: #3b82f6; }
.s-fehler, .s-abgebrochen { background: color-mix(in srgb, #ef4444 16%, transparent); color: var(--gefahr); }
.s-gesperrt { background: color-mix(in srgb, #f59e0b 18%, transparent); color: var(--warn); }
.code { font-family: var(--mono); font-weight: 600; } .code.c2 { color: var(--ok); } .code.c3 { color: #3b82f6; } .code.c4, .code.c5, .code.c0 { color: var(--gefahr); }
.spanne-zelle { min-width: 200px; } .spanne { position: relative; height: 8px; background: var(--flaeche2); border-radius: 4px; margin: .35rem 0 .2rem; }
.spanne-bereich { position: absolute; top: 0; bottom: 0; background: var(--balken); border-radius: 4px; opacity: .8; }
.spanne-median { position: absolute; top: -3px; width: 3px; height: 14px; background: var(--text); border-radius: 2px; margin-left: -1px; }

/* Filter, Formulare */
.filter-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.filter-raster .breit2 { grid-column: span 2; }
.filter-knoepfe { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
fieldset.umkreis { border: 1px solid var(--rand); border-radius: 10px; display: flex; gap: .4rem; padding: .3rem .5rem .5rem; margin: 0; align-items: center; }
fieldset.umkreis legend { font-size: .85rem; font-weight: 600; color: var(--leise); padding: 0 .3rem; }
input.kurz { max-width: 6rem; }
.formular { display: flex; flex-direction: column; gap: .75rem; max-width: 640px; } .formular.inline { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
form.inline { display: inline; } .zeile { display: flex; gap: .75rem; } .zeile > label { flex: 1; }
.blaettern { display: flex; justify-content: center; gap: 1rem; align-items: center; margin: 1rem 0; color: var(--leise); }
.felder { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.felder dt { color: var(--leise); font-size: .85rem; } .felder dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.raster-felder { grid-template-columns: repeat(auto-fill, minmax(90px, max-content) minmax(140px, 1fr)); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: 0; }
.chips li, .chips a { background: var(--flaeche2); border-radius: 99px; padding: .2rem .7rem; font-size: .85rem; }
.chips a.aktiv { background: color-mix(in srgb, var(--akzent) 18%, transparent); }
ul.einfach { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
details.quelle { border: 1px solid var(--rand); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .5rem; }
details summary { cursor: pointer; }
pre.json, pre.quelltext { background: var(--flaeche2); border-radius: 10px; padding: .8rem; overflow: auto; max-height: 420px; white-space: pre-wrap; word-break: break-word; }
pre.quelltext { max-height: 75vh; font-size: .8rem; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--rand); margin-bottom: 1rem; }
.tabs a { padding: .5rem .9rem; color: var(--leise); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.aktiv { color: var(--akzent); border-color: var(--akzent); }
iframe.rohseite { width: 100%; height: 75vh; border: 1px solid var(--rand); border-radius: 10px; background: #fff; }

/* Karte */
.landkarte { height: 460px; border-radius: 10px; overflow: hidden; border: 1px solid var(--rand); z-index: 0; }
.landkarte.klein { height: 260px; }
.cluster { display: flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; font-size: 12px;
  background: color-mix(in srgb, #0d9488 85%, transparent); box-shadow: 0 0 0 5px color-mix(in srgb, #14b8a6 30%, transparent); }
.cluster.g1 { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
.cluster.g2 { width: 40px; height: 40px; margin: -20px 0 0 -20px; background: color-mix(in srgb, #4f46e5 85%, transparent); box-shadow: 0 0 0 6px color-mix(in srgb, #6366f1 30%, transparent); }
.cluster.g3 { width: 52px; height: 52px; margin: -26px 0 0 -26px; background: color-mix(in srgb, #7c3aed 88%, transparent); box-shadow: 0 0 0 7px color-mix(in srgb, #8b5cf6 30%, transparent); }
[data-thema="dunkel"] .leaflet-tile-pane { filter: brightness(.75) contrast(1.1) saturate(.7); }
@media (prefers-color-scheme: dark) { :root:not([data-thema="hell"]) .leaflet-tile-pane { filter: brightness(.75) contrast(1.1) saturate(.7); } }

/* Login */
body.login-seite { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem 1rem; overflow-x: hidden;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, #14b8a6 22%, transparent), transparent 60%),
              radial-gradient(900px 600px at 110% 110%, color-mix(in srgb, #6366f1 25%, transparent), transparent 60%), var(--hg); }
body.login-seite main { width: 100%; display: flex; flex-direction: column; align-items: center; }
.login-hintergrund { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.login-hintergrund span { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .35; animation: schweben 18s ease-in-out infinite alternate; }
.login-hintergrund span:nth-child(1) { width: 380px; height: 380px; background: #2dd4bf; top: 8%; left: 12%; }
.login-hintergrund span:nth-child(2) { width: 320px; height: 320px; background: #818cf8; bottom: 6%; right: 10%; animation-delay: -6s; }
.login-hintergrund span:nth-child(3) { width: 240px; height: 240px; background: #f0abfc; top: 55%; left: 45%; animation-delay: -12s; opacity: .2; }
@keyframes schweben { to { transform: translate(40px, -30px) scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .login-hintergrund span { animation: none; } }
.login-karte { position: relative; z-index: 1; width: 100%; max-width: 410px; padding: 2rem 2rem 1.6rem; border-radius: 22px;
  background: color-mix(in srgb, var(--flaeche) 82%, transparent); backdrop-filter: blur(18px); border: 1px solid color-mix(in srgb, var(--rand) 80%, transparent);
  box-shadow: 0 20px 60px rgba(15, 23, 42, .18); }
.login-kopf { display: flex; gap: .8rem; align-items: center; margin-bottom: 1.3rem; }
.login-kopf .logo { width: 46px; height: 46px; } .login-kopf h1 { font-size: 1.35rem; margin: 0; } .login-kopf p { margin: 0; color: var(--leise); font-size: .88rem; }
.login-karte h2 { font-size: 1.15rem; margin: .4rem 0 1rem; }
.schritte { list-style: none; display: flex; gap: .4rem; padding: 0; margin: 0 0 1rem; counter-reset: s; }
.schritte li { flex: 1; font-size: .75rem; color: var(--leise); padding-top: .45rem; border-top: 3px solid var(--rand); counter-increment: s; }
.schritte li::before { content: counter(s) ". "; } .schritte li.an { border-color: var(--akzent); color: var(--text); font-weight: 600; }
.login-form { display: flex; flex-direction: column; gap: 1rem; margin-bottom: .6rem; }
.login-form input { padding: .75rem .85rem; font-size: 1rem; border-radius: 11px; }
.login-form .knopf { padding: .8rem; font-size: 1rem; border-radius: 11px; }
.passwort-feld { position: relative; display: block; } .passwort-feld input { padding-right: 5.5rem; }
.zeigen { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--akzent); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; padding: .3rem .5rem; }
input.otp { font-size: 1.6rem !important; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.qr { background: #fff; border-radius: 14px; padding: .8rem; width: 220px; margin: 0 auto 1rem; } .qr svg { display: block; width: 100%; height: auto; }
.geheim { text-align: center; font-size: .85rem; margin-bottom: 1rem; color: var(--leise); } .geheim code { display: block; margin-top: .4rem; font-size: .95rem; color: var(--text); word-spacing: .2em; }
.hinweis { font-size: .88rem; color: var(--leise); }
.trenner { display: flex; align-items: center; gap: .8rem; color: var(--leise); font-size: .8rem; margin: 1rem 0; }
.trenner::before, .trenner::after { content: ""; flex: 1; height: 1px; background: var(--rand); }
.login-fuss { position: relative; z-index: 1; color: var(--leise); font-size: .78rem; margin-top: 1.2rem; text-align: center; }

/* Mobil */
@media (max-width: 1000px) { .raster.drei { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) {
  .kopf { flex-wrap: wrap; gap: .4rem .8rem; padding: .5rem 1rem; }
  .hauptnav { order: 3; flex-basis: 100%; }
  .kopf-rechts { margin-left: auto; }
  .inhalt { padding: 1rem; }
  .raster.zwei, .raster.drei { grid-template-columns: 1fr; }
  .filter-raster .breit2 { grid-column: auto; }
  .kacheln { grid-template-columns: 1fr 1fr; gap: .7rem; } .kachel-wert { font-size: 1.35rem; }
  .landkarte { height: 340px; } .zeile { flex-direction: column; gap: .75rem; }
  .login-karte { padding: 1.6rem 1.3rem 1.3rem; }
  .felder { grid-template-columns: 1fr; gap: 0; } .felder dd { margin-bottom: .45rem; }
}
