/* 7aSENSE Lagebild */
:root {
  --bg: #f4f6fa; --flaeche: #ffffff; --flaeche-2: #eef2f7; --rand: #dde3ec;
  --text: #0f172a; --leise: #5b6577; --akzent: #1d4ed8; --akzent-text: #ffffff;
  --extrem: #7b2cbf; --schwer: #d62828; --mittel: #f08c00; --gering: #e9c46a; --grau: #8a94a6;
  --ok: #15803d; --warn: #b45309; --fehler: #b91c1c;
  --radius: 12px; --schatten: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --leiste-h: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120; --flaeche: #121a2b; --flaeche-2: #1a2438; --rand: #26324a;
    --text: #e6ebf4; --leise: #97a3b8; --akzent: #5b8cff; --akzent-text: #0b1120;
    --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, body { margin: 0; }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; }
.leise { color: var(--leise); }
.klein { font-size: .85rem; }
.nowrap { white-space: nowrap; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Kopfleiste */
.leiste { position: sticky; top: 0; z-index: 1000; height: var(--leiste-h); display: flex; align-items: center; gap: 1.25rem;
  padding: 0 1.25rem; background: var(--flaeche); border-bottom: 1px solid var(--rand); }
.marke { display: flex; align-items: center; gap: .5rem; font-weight: 750; color: var(--text); letter-spacing: .02em; white-space: nowrap; }
.marke:hover { text-decoration: none; }
.marke-zusatz { font-weight: 450; color: var(--leise); }
.marke-punkt { width: 12px; height: 12px; border-radius: 50%; background: var(--schwer); box-shadow: 0 0 0 4px color-mix(in srgb, var(--schwer) 22%, transparent); }
.marke-gross { font-size: 1.3rem; justify-content: center; margin-bottom: .5rem; }
.menue { display: flex; gap: .25rem; }
.menue a { padding: .4rem .75rem; border-radius: 8px; color: var(--leise); font-weight: 550; }
.menue a:hover { background: var(--flaeche-2); text-decoration: none; color: var(--text); }
.menue a.aktiv { background: var(--flaeche-2); color: var(--text); }
.region-wahl { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.region-label { color: var(--leise); font-size: .85rem; }
.region-wahl select { max-width: 260px; }
.konto { display: flex; align-items: center; gap: .75rem; white-space: nowrap; }
.konto form { margin: 0; }
.konto-name { color: var(--text); font-weight: 550; }
.abzeichen { font-size: .7rem; padding: .1rem .4rem; border-radius: 6px; background: var(--akzent); color: var(--akzent-text); vertical-align: middle; }

/* Formulare und Knöpfe */
input, select, textarea { font: inherit; color: inherit; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 8px; padding: .5rem .65rem; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible, .meldung:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }
input:disabled { background: var(--flaeche-2); color: var(--leise); }
.region-wahl select, .filterleiste select, .inline select { width: auto; }
label { display: grid; gap: .3rem; font-weight: 550; font-size: .9rem; }
.knopf { display: inline-block; font: inherit; font-weight: 600; background: var(--akzent); color: var(--akzent-text); border: 0; border-radius: 8px; padding: .55rem 1.1rem; cursor: pointer; }
.knopf:hover { filter: brightness(1.08); text-decoration: none; }
.knopf-leise { font: inherit; font-size: .9rem; background: transparent; color: var(--leise); border: 1px solid var(--rand); border-radius: 8px; padding: .35rem .7rem; cursor: pointer; }
.knopf-leise:hover { color: var(--text); background: var(--flaeche-2); text-decoration: none; }
.knopf-leise.gefahr:hover { color: var(--fehler); border-color: var(--fehler); }
.formular { display: grid; gap: 1rem; }
.raster-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); align-items: start; margin-top: 1rem; }
.inline { display: inline; margin: 0; }
hr { border: 0; border-top: 1px solid var(--rand); margin: 1.5rem 0; }

/* Hinweise */
.hinweis { margin: 1rem auto 0; max-width: 1100px; padding: .75rem 1rem; border-radius: var(--radius); border: 1px solid; }
.hinweis-ok { background: color-mix(in srgb, var(--ok) 10%, var(--flaeche)); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.hinweis-fehler { background: color-mix(in srgb, var(--fehler) 10%, var(--flaeche)); border-color: color-mix(in srgb, var(--fehler) 35%, transparent); }

/* Layout */
.inhalt { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.karte { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); box-shadow: var(--schatten); padding: 1.25rem 1.4rem; margin-bottom: 1rem; }
.schmal { max-width: 560px; margin: 1rem auto; }
.seitenkopf { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.leer { text-align: center; color: var(--leise); padding: 2.5rem 1rem; }
details.karte summary { cursor: pointer; }

/* Login */
.seite-login { min-height: 100vh; display: grid; place-items: center; background:
  radial-gradient(900px 500px at 15% 10%, color-mix(in srgb, var(--akzent) 16%, transparent), transparent),
  radial-gradient(700px 500px at 90% 90%, color-mix(in srgb, var(--schwer) 12%, transparent), transparent), var(--bg); }
.login-rahmen { width: 100%; padding: 1rem; }
.login-karte { max-width: 380px; margin: 0 auto; display: grid; gap: 1rem; padding: 2rem; }
.seite-login .hinweis { max-width: 380px; margin: 0 auto 1rem; }

/* Lage */
.lage { display: grid; grid-template-columns: minmax(0, 1fr) 400px; height: calc(100vh - var(--leiste-h)); }
.lage-karte { position: relative; }
#karte { position: absolute; inset: 0; }
.legende { position: absolute; left: 12px; bottom: 22px; z-index: 500; display: flex; gap: .75rem; padding: .4rem .7rem; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 999px; box-shadow: var(--schatten); font-size: .8rem; }
.legende span { display: flex; align-items: center; gap: .3rem; }
.punkt { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.lage-liste { border-left: 1px solid var(--rand); background: var(--flaeche); overflow-y: auto; padding: 1rem; }
.lage-kopf { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.zaehler { font-size: 1.6rem; font-weight: 750; min-width: 2.5rem; text-align: center; padding: .1rem .5rem; border-radius: 10px; background: var(--flaeche-2); }
.filter-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .75rem 0; }
.chip { font: inherit; font-size: .82rem; background: var(--flaeche-2); color: var(--text); border: 1px solid var(--rand); border-radius: 999px; padding: .25rem .65rem; cursor: pointer; }
.chip b { font-weight: 700; margin-left: .2rem; }
.chip.aus { opacity: .45; text-decoration: line-through; }
.meldungen { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.meldung { position: relative; padding: .7rem .8rem .7rem 1rem; border: 1px solid var(--rand); border-radius: 10px; background: var(--flaeche); cursor: pointer; transition: background .15s; }
.meldung::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--farbe); }
.meldung:hover { background: var(--flaeche-2); }
.meldung-zeile { display: flex; gap: .5rem; align-items: baseline; }
.meldung-titel { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; min-width: 0; }
.lage-liste { overflow-x: hidden; }
.tabelle td a { overflow-wrap: anywhere; }
.meldung-meta, .meldung-orte { color: var(--leise); font-size: .82rem; margin-top: .2rem; }
.meldung-mehr { font-size: .82rem; position: absolute; right: .8rem; bottom: .55rem; opacity: 0; transition: opacity .15s; }
.meldung:hover .meldung-mehr, .meldung:focus-within .meldung-mehr { opacity: 1; }

/* Schwere / Status */
.s-Extreme { background: var(--extrem); } .s-Severe { background: var(--schwer); }
.s-Moderate { background: var(--mittel); } .s-Minor { background: var(--gering); } .s-x { background: var(--grau); }
.schwere { display: inline-block; font-size: .78rem; font-weight: 650; color: #fff; padding: .1rem .5rem; border-radius: 999px; white-space: nowrap; }
.schwere.s-Minor { color: #3b2f00; }
.status { font-size: .78rem; font-weight: 650; padding: .1rem .5rem; border-radius: 999px; white-space: nowrap; }
.status-ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.status-warnung, .status-laeuft { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.status-fehler { background: color-mix(in srgb, var(--fehler) 15%, transparent); color: var(--fehler); }

/* Tabellen */
.filterleiste { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filterleiste input[type=search] { flex: 1 1 260px; width: auto; }
.tabelle-rahmen { overflow-x: auto; background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); box-shadow: var(--schatten); }
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th, .tabelle td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--rand); vertical-align: top; }
.tabelle th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--leise); background: var(--flaeche-2); }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle tr.gesperrt td { opacity: .55; }
.aktionen { white-space: nowrap; text-align: right; }
.seiten { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; }

/* Status-Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.kachel { color: var(--text); margin: 0; border-top: 4px solid var(--grau); transition: transform .15s; }
.kachel:hover { text-decoration: none; transform: translateY(-2px); }
.kachel-kopf { display: flex; align-items: center; gap: .6rem; }
.kachel-kopf h2 { margin: 0; font-size: 1rem; }
.ampel-licht { width: 12px; height: 12px; border-radius: 50%; background: var(--grau); flex: none; }
.ampel-gruen { border-top-color: var(--ok); } .ampel-gruen .ampel-licht { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.ampel-gelb { border-top-color: var(--warn); } .ampel-gelb .ampel-licht { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 20%, transparent); }
.ampel-rot { border-top-color: var(--fehler); } .ampel-rot .ampel-licht { background: var(--fehler); box-shadow: 0 0 0 4px color-mix(in srgb, var(--fehler) 25%, transparent); }
.kachel-grund { color: var(--leise); font-size: .88rem; margin: .4rem 0 .8rem; min-height: 2.6em; }
.kachel-zahlen { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin: 0; }
.kachel-zahlen dt { font-size: .7rem; color: var(--leise); text-transform: uppercase; letter-spacing: .03em; }
.kachel-zahlen dd { margin: 0; font-weight: 650; }
.kachel-fehler { margin: .75rem 0 0; padding: .5rem; border-radius: 8px; background: var(--flaeche-2); color: var(--leise); word-break: break-word; }

/* Meldungsdetail */
.meldung-kopf { display: flex; gap: .75rem; align-items: center; margin-bottom: .5rem; }
.daten { display: grid; grid-template-columns: 120px 1fr; gap: .35rem 1rem; margin: 1rem 0; }
.daten dt { color: var(--leise); }
.daten dd { margin: 0; word-break: break-word; }
.meldungstext { white-space: pre-wrap; background: var(--flaeche-2); padding: 1rem; border-radius: 10px; font-size: .9rem; overflow-x: auto; }
.startpasswort code { display: inline-block; font-size: 1.4rem; letter-spacing: .05em; padding: .5rem 1rem; border-radius: 10px; background: var(--flaeche-2); user-select: all; }

/* Leaflet an das Design anpassen */
.leaflet-container { background: var(--flaeche-2); font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--flaeche); color: var(--text); }
@media (prefers-color-scheme: dark) { .leaflet-tile-pane { filter: brightness(.8) contrast(1.1) saturate(.8); } }

/* Mittlere Breite: Regionswahl in eigene Zeile */
@media (max-width: 1150px) {
  .leiste { height: auto; min-height: var(--leiste-h); flex-wrap: wrap; padding: .6rem 1rem; gap: .6rem; }
  .konto { margin-left: auto; }
  .region-wahl { margin-left: 0; order: 3; width: 100%; }
  .region-wahl select { max-width: none; flex: 1; }
  .lage { height: calc(100vh - 110px); }
}
/* Schmale Bildschirme */
@media (max-width: 900px) {
  .lage { grid-template-columns: 1fr; grid-template-rows: 55vh auto; height: auto; }
  .lage-karte { min-height: 55vh; }
  .lage-liste { border-left: 0; border-top: 1px solid var(--rand); }
  .daten { grid-template-columns: 1fr; }
}

/* Lage: Werkzeuge */
.lage-werkzeuge { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .75rem; }
.schwere-wahl { display: flex; flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; font-size: .85rem; color: var(--leise); }
.schwere-wahl select { width: auto; padding: .3rem .5rem; }
.lage-warnung { margin: .6rem 0 0; padding: .5rem .7rem; border-radius: 8px; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.gesendet-zeichen { font-size: .8rem; margin-left: .25rem; }
.s-Unknown { background: var(--grau); }
