/* Admin-Frontend der WaSe7-Firewall – ein Stylesheet für alle Seiten.
 * Teil 1: übernommen aus status-frontend/style.css (Statusseite, Farben als Tokens, hell und
 * dunkel über prefers-color-scheme; Verlaufsfarben geprüft (CVD, OKLab): hell #a8e4ad/#145c2c/
 * #e9a400/#e85656, dunkel #9fe0a5/#2b7f47/#f5b52a/#ff7070; Grau trägt zusätzlich ein Muster).
 * Teil 2 (unten): Rahmen, Navigation, Formulare, Tabellen, Anmeldung. Keine Inline-Stile (CSP). */

:root {
  color-scheme: light dark;
  --bg: #f2f3f5;
  --flaeche: #ffffff;
  --flaeche-2: #f6f7f9;
  --rand: #dde1e6;
  --rand-stark: #c3c9d1;
  --text: #14171a;
  --text-2: #47505b;
  --text-3: #66707c;
  --akzent: #1f5fbf;
  --akzent-text: #ffffff;
  --fokus: #1f5fbf;

  --ok: #157a3a;      --ok-bg: #e2f5e7;
  --warn: #9a5800;    --warn-bg: #fdf0d3;
  --bad: #b42323;     --bad-bg: #fde5e5;
  --grau: #5b636d;    --grau-bg: #eceef1;
  --punkt-ok: #22a447; --punkt-warn: #e9a400; --punkt-bad: #d63b3b; --punkt-grau: #9aa1aa;

  /* Verlaufsfarben (Vertrag: hellgruen, dunkelgruen, gelb, rot, grau) */
  --c-h: #a8e4ad;
  --c-d: #145c2c;
  --c-g: #e9a400;
  --c-r: #e85656;
  --c-x: #a0a09c;
  --c-u: #6f42c1;     /* unbekanntes Kürzel (Vertragsverstoß) */
  --ink-g: rgba(110, 62, 0, .55);
  --ink-r: rgba(90, 0, 0, .55);
  --ink-x: rgba(255, 255, 255, .7);
  --spur: #e9ecef;

  --schatten: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 10px;
  --mono: ui-monospace, "SFMono-Regular", "DejaVu Sans Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1114;
    --flaeche: #1b1e22;
    --flaeche-2: #22262b;
    --rand: #30353c;
    --rand-stark: #434a53;
    --text: #e9ebee;
    --text-2: #b6bcc5;
    --text-3: #8e96a1;
    --akzent: #5b9bff;
    --akzent-text: #0b1220;
    --fokus: #7fb0ff;

    --ok: #5fd583;      --ok-bg: rgba(46, 160, 80, .16);
    --warn: #f5c04a;    --warn-bg: rgba(233, 164, 0, .16);
    --bad: #ff8a8a;     --bad-bg: rgba(232, 86, 86, .17);
    --grau: #a9b0ba;    --grau-bg: rgba(160, 166, 175, .14);
    --punkt-ok: #3fcf6b; --punkt-warn: #f5b52a; --punkt-bad: #ff6464; --punkt-grau: #7d848e;

    --c-h: #9fe0a5;
    --c-d: #2b7f47;
    --c-g: #f5b52a;
    --c-r: #ff7070;
    --c-x: #7a7a80;
    --c-u: #b48cff;
    --ink-g: rgba(100, 55, 0, .6);
    --ink-r: rgba(80, 0, 0, .55);
    --ink-x: rgba(20, 20, 24, .55);
    --spur: #262a30;

    --schatten: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

/* hidden muss gegen Klassen mit display gewinnen (sonst bleibt z. B. das Mock-Schild stehen) */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: .9rem; color: var(--text-2); font-weight: 600; }

button, input { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; }

.nebeninfo { color: var(--text-3); font-size: .85rem; }
.ic { width: 1em; height: 1em; flex: none; vertical-align: -.125em; }
.platzhalter { color: var(--text-3); margin: .5rem 0; }
.zahl { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .85em; }

/* ---------- Kopf ---------- */
.kopf {
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem;
  align-items: center; justify-content: space-between;
  padding: 1rem clamp(16px, 3vw, 32px);
  background: var(--flaeche);
  border-bottom: 1px solid var(--rand);
}
.untertitel { margin: .15rem 0 0; color: var(--text-2); font-size: .9rem; }
.steuerung { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.zuletzt { color: var(--text-2); font-size: .88rem; min-width: 13ch; font-variant-numeric: tabular-nums; }
.zuletzt.alt { color: var(--warn); }

.knopf {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .85rem;
  border: 1px solid var(--rand-stark); border-radius: 8px;
  background: var(--flaeche-2);
  cursor: pointer;
  font-size: .9rem; font-weight: 550;
  min-height: 36px;
}
.knopf:hover:not(:disabled) { border-color: var(--akzent); }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf-flach { background: transparent; border-color: transparent; }
.knopf-haupt { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
.knopf.dreht::before {
  content: ""; width: .8em; height: .8em; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: drehen .8s linear infinite;
}

.umschalter { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; }
.umschalter input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.umschalter-bahn {
  width: 38px; height: 22px; border-radius: 11px; position: relative;
  background: var(--rand-stark); transition: background .15s;
  flex: none;
}
.umschalter-bahn::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s;
}
.umschalter input:checked + .umschalter-bahn { background: var(--akzent); }
.umschalter input:checked + .umschalter-bahn::after { transform: translateX(16px); }
.umschalter input:focus-visible + .umschalter-bahn { outline: 2px solid var(--fokus); outline-offset: 2px; }

.marke {
  display: inline-block; padding: .05rem .5rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; vertical-align: middle;
  border: 1px solid transparent;
}
.marke-mock { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); margin-left: .35rem; }
.marke-echt { color: var(--text-3); border-color: var(--rand-stark); font-weight: 550; margin-left: .35rem; }

/* ---------- Abschnitte ---------- */
main { padding: 1rem clamp(16px, 3vw, 32px) 2rem; max-width: 1800px; margin: 0 auto; }
.abschnitt { margin-bottom: 1.25rem; }
.abschnitt-kopf { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; margin-bottom: .6rem; }

/* ---------- Ampeln ---------- */
.ampeln { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.ampel {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: .75rem .9rem;
  border-left: 5px solid var(--punkt-grau);
}
.ampel.st-online { border-left-color: var(--punkt-ok); }
.ampel.st-fehler { border-left-color: var(--punkt-warn); }
.ampel.st-offline { border-left-color: var(--punkt-bad); }
.ampel-kopf { display: flex; align-items: center; gap: .5rem; justify-content: space-between; }
.ampel-name { font-weight: 600; }
.ampel-werte { display: flex; flex-wrap: wrap; gap: .2rem .9rem; margin-top: .35rem; font-size: .88rem; color: var(--text-2); }
.ampel-werte b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.ampel-detail { margin: .35rem 0 0; font-size: .85rem; color: var(--text-2); overflow-wrap: anywhere; }

.zustand {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .12rem .55rem; border-radius: 999px;
  font-size: .82rem; font-weight: 650; white-space: nowrap;
}
.zustand svg { width: 14px; height: 14px; flex: none; }
.z-ok { background: var(--ok-bg); color: var(--ok); }
.z-warn { background: var(--warn-bg); color: var(--warn); }
.z-bad { background: var(--bad-bg); color: var(--bad); }
.z-grau { background: var(--grau-bg); color: var(--grau); }

/* ---------- Fehlerleiste ---------- */
.fehlerleiste {
  background: var(--bad-bg); color: var(--text);
  border: 1px solid var(--bad); border-radius: var(--radius);
  padding: .6rem .9rem; margin: 0 0 1.25rem;
}
.fehlerleiste h3 { font-size: .95rem; color: var(--bad); margin-bottom: .25rem; }
.fehlerleiste ul { margin: 0; padding-left: 1.2rem; }
.fehlerleiste li { margin: .1rem 0; overflow-wrap: anywhere; }
.fehlerleiste .nebeninfo { color: var(--text-2); }

/* ---------- Bereichswahl ---------- */
.bereich { display: inline-flex; border: 0; padding: 0; margin: 0 0 0 auto; gap: 0; align-items: center; }
.bereich legend { float: left; margin-right: .5rem; font-size: .88rem; color: var(--text-2); padding: 0; }
.bereich label { position: relative; }
.bereich input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.bereich span {
  display: inline-block; padding: .35rem .8rem; min-height: 34px; line-height: 1.5;
  border: 1px solid var(--rand-stark); background: var(--flaeche);
  font-size: .88rem; font-weight: 550; cursor: pointer;
}
.bereich label:first-of-type span { border-radius: 8px 0 0 8px; }
.bereich label:last-of-type span { border-radius: 0 8px 8px 0; }
.bereich label + label span { border-left-width: 0; }
.bereich input:checked + span { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
.bereich input:focus-visible + span { outline: 2px solid var(--fokus); outline-offset: 2px; }

/* ---------- Legende ---------- */
.legende {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: .5rem .9rem; margin-bottom: .9rem;
}
.legende summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.legende-liste {
  list-style: none; margin: .5rem 0 .2rem; padding: 0;
  display: grid; gap: .35rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.legende-liste li { display: flex; gap: .55rem; align-items: flex-start; font-size: .88rem; }
.legende-liste .muster { width: 30px; height: 18px; border-radius: 3px; flex: none; margin-top: 1px; }
.legende-liste b { font-weight: 650; }
.legende-zusatz { margin: .35rem 0 0; font-size: .82rem; color: var(--text-3); }

/* ---------- Musterflächen (Farbe + Muster) ---------- */
.c-h { background-color: var(--c-h); }
.c-d { background-color: var(--c-d); }
.c-g {
  background-color: var(--c-g);
  background-image: repeating-linear-gradient(45deg, var(--ink-g) 0 1.5px, transparent 1.5px 5px);
}
.c-r {
  background-color: var(--c-r);
  background-image:
    repeating-linear-gradient(45deg, var(--ink-r) 0 1.2px, transparent 1.2px 5px),
    repeating-linear-gradient(-45deg, var(--ink-r) 0 1.2px, transparent 1.2px 5px);
}
.c-x {
  background-color: var(--c-x);
  background-image: repeating-linear-gradient(90deg, var(--ink-x) 0 1px, transparent 1px 3px);
}
.c-u { background-color: var(--c-u); }

/* ---------- Host-Karten ---------- */
.hosts { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 1800px) { .hosts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hosts.veraltet .karte { opacity: .8; }

.karte {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: .9rem 1rem 1rem;
  border-top: 4px solid var(--punkt-grau);
  min-width: 0;
}
.karte.zs-normal { border-top-color: var(--punkt-ok); }
.karte.zs-angriff { border-top-color: var(--punkt-warn); }
.karte.zs-gestoppt, .karte.zs-defekt { border-top-color: var(--punkt-bad); }

.karte-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.karte-name { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.karte-name .nebeninfo { font-family: var(--mono); font-size: .8rem; }
.karte-zustand { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; }
.karte-zustand .zustand { font-size: .95rem; padding: .25rem .75rem; }
.karte-zustand .zustand svg { width: 16px; height: 16px; }
.zustand-text { font-size: .82rem; color: var(--text-2); max-width: 46ch; }
.meldung { font-size: .88rem; color: var(--text-2); text-align: right; }
.meldung b { color: var(--text); font-variant-numeric: tabular-nums; }
.meldung.alt b { color: var(--bad); }

.angriff-band {
  margin-top: .7rem; padding: .5rem .75rem; border-radius: 8px;
  background: var(--warn-bg); border: 1px solid var(--punkt-warn);
  display: flex; flex-wrap: wrap; gap: .2rem 1rem; align-items: center; font-size: .9rem;
}
.angriff-band strong { color: var(--warn); }
.angriff-band .ic { width: 18px; height: 18px; color: var(--warn); }
.angriff-band .mono { font-weight: 650; }

.fakten {
  display: grid; gap: .75rem 1.25rem; margin-top: .85rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr) minmax(0, .85fr) minmax(0, 1.45fr);
}
@media (max-width: 1150px) { .fakten { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .fakten { grid-template-columns: 1fr; } }
.fakt { min-width: 0; }
.fakt h4 { margin-bottom: .3rem; }
.fakt h4.abstand { margin-top: .7rem; }
.tabelle-rahmen { overflow-x: auto; max-width: 100%; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .12rem .75rem; margin: 0; font-size: .88rem; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.wert-ok { color: var(--ok); font-weight: 600; }
.wert-warn { color: var(--warn); font-weight: 600; }
.wert-bad { color: var(--bad); font-weight: 600; }
.wert-grau { color: var(--text-3); }

.spieler-zahl { font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.spieler-zahl small { font-size: .95rem; color: var(--text-3); font-weight: 500; }
.balken { height: 6px; border-radius: 3px; background: var(--spur); overflow: hidden; margin: .2rem 0 .4rem; }
.balken > span { display: block; height: 100%; background: var(--akzent); border-radius: 3px; }
.stand-alt { font-size: .8rem; color: var(--warn); }

.klapp summary { cursor: pointer; font-size: .85rem; color: var(--text-2); }
.klapp[open] summary { margin-bottom: .25rem; }

.tabelle { width: 100%; border-collapse: collapse; font-size: .84rem; }
.tabelle th, .tabelle td { text-align: left; padding: .18rem .4rem .18rem 0; border-bottom: 1px solid var(--rand); vertical-align: top; }
.tabelle th { color: var(--text-3); font-weight: 550; }
.tabelle td.r, .tabelle th.r { text-align: right; padding-right: 0; padding-left: .4rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle .name { overflow-wrap: anywhere; }
.tabelle.listen { font-size: .8rem; }
.tabelle.listen .name { overflow-wrap: normal; white-space: nowrap; }
.fussnote { font-size: .75rem; margin-top: .2rem; }

.chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .88rem; }
.chip .muster { width: 16px; height: 16px; border-radius: 3px; display: inline-block; flex: none; }

/* ---------- Verlauf ---------- */
.verlauf { margin-top: 1rem; border-top: 1px solid var(--rand); padding-top: .75rem; }
.verlauf-kopf { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; margin-bottom: .45rem; }
.verlauf-kopf .nebeninfo { font-size: .8rem; }
.zl-zeile { display: flex; align-items: stretch; gap: 6px; }
.zl {
  flex: 1 1 auto; min-width: 0;
  display: flex; gap: 1px; height: 30px;
  background: var(--spur); border-radius: 4px; overflow: hidden;
  cursor: crosshair; touch-action: pan-y;
}
.zl.dicht { gap: 0; }
.zl > span {
  flex: 1 1 0; min-width: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  font: 600 11px/1 var(--mono); color: rgba(0,0,0,.65);
}
.zl > span.c-d, .zl > span.c-r { color: rgba(255,255,255,.92); }
.zl > span.luecke::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 28%;
  background: var(--c-x);
  background-image: repeating-linear-gradient(90deg, var(--ink-x) 0 1px, transparent 1px 3px);
}
.zl > span.aktiv { outline: 2px solid var(--text); outline-offset: -2px; z-index: 1; }
.zl-laeuft {
  flex: none; width: 34px; border-radius: 4px; position: relative;
  border: 2px dashed var(--text-2); cursor: help;
  background-clip: padding-box;
}
.zl-laeuft.leer { visibility: hidden; }
.zl-achse { position: relative; height: 1.3rem; margin-right: 40px; font-size: .75rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.zl-achse span { position: absolute; top: .15rem; white-space: nowrap; transform: translateX(-50%); }
.zl-achse span::before { content: ""; position: absolute; top: -.2rem; left: 50%; width: 1px; height: .3rem; background: var(--rand-stark); }
.zl-achse span.links { transform: none; }
.zl-achse span.links::before { left: 0; }
.zl-achse span.rechts { transform: translateX(-100%); }
.zl-achse span.rechts::before { left: auto; right: 0; }
.verlauf-fuss { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; margin-top: .25rem; }
.angriffe { flex: 1 1 100%; }
.angriffe .tabelle { margin-top: .25rem; }
.verlauf-hinweis { font-size: .82rem; color: var(--warn); margin: .25rem 0 0; }

.karte-aktionen { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- Tooltip ---------- */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  max-width: min(360px, calc(100vw - 16px));
  background: var(--flaeche); color: var(--text);
  border: 1px solid var(--rand-stark); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  padding: .5rem .65rem; font-size: .83rem; line-height: 1.4;
}
.tooltip .tt-zeit { font-weight: 650; font-variant-numeric: tabular-nums; }
.tooltip .tt-farbe { display: flex; gap: .4rem; align-items: flex-start; margin-top: .25rem; }
.tooltip .tt-farbe .muster { width: 14px; height: 14px; border-radius: 3px; flex: none; margin-top: 2px; }
.tooltip .tt-mini { display: flex; gap: 1px; height: 12px; margin: .35rem 0 .1rem; }
.tooltip .tt-mini span { flex: 1 1 0; border-radius: 1px; }
.tooltip .tt-teil { color: var(--text-2); margin-top: .2rem; }
.tooltip .tt-angriff { margin-top: .35rem; padding-top: .3rem; border-top: 1px solid var(--rand); }

/* ---------- iptables-Fenster ---------- */
.ipt {
  width: min(1000px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
  padding: 0; border: 1px solid var(--rand-stark); border-radius: 12px;
  background: var(--flaeche); color: var(--text);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.ipt[open] { display: flex; flex-direction: column; }
.ipt::backdrop { background: rgba(8, 12, 18, .55); }
.ipt-kopf { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--rand); }
.ipt-x { font-size: 1.1rem; padding: .3rem .6rem; }
.ipt-status { padding: .75rem 1rem 0; }
.ipt-status:empty { display: none; }
.ipt-warten { display: flex; gap: .75rem; align-items: flex-start; }
.ipt-warten .kreisel {
  width: 22px; height: 22px; flex: none; border-radius: 50%; margin-top: 2px;
  border: 3px solid var(--rand-stark); border-top-color: var(--akzent);
  animation: drehen .9s linear infinite;
}
.ipt-warten p, .ipt-meldung p { margin: 0 0 .2rem; }
.ipt-meldung { padding: .6rem .8rem; border-radius: 8px; margin-bottom: .25rem; }
.ipt-meldung.fehler { background: var(--bad-bg); border: 1px solid var(--bad); }
.ipt-meldung.verfallen { background: var(--grau-bg); border: 1px solid var(--rand-stark); }
.ipt-text {
  margin: .75rem 1rem 0; padding: .75rem; flex: 1 1 auto; min-height: 120px;
  overflow: auto; max-height: 62vh;
  background: var(--flaeche-2); border: 1px solid var(--rand); border-radius: 8px;
  font: 12.5px/1.45 var(--mono); white-space: pre; tab-size: 4;
}
.ipt-fuss { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .75rem 1rem; }
.ipt-knoepfe { display: flex; flex-wrap: wrap; gap: .5rem; }

.fuss { padding: 0 clamp(16px, 3vw, 32px) 1.5rem; color: var(--text-3); font-size: .8rem; text-align: center; }

@keyframes drehen { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .ipt-warten .kreisel, .knopf.dreht::before { animation-duration: 3s; }
  .umschalter-bahn, .umschalter-bahn::after { transition: none; }
}

/* ---------- schmal ---------- */
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .kopf { padding-top: .75rem; padding-bottom: .75rem; }
  .bereich { margin-left: 0; width: 100%; }
  .bereich legend { float: none; display: block; width: 100%; margin-bottom: .25rem; }
  .meldung { text-align: left; width: 100%; }
  .karte { padding: .8rem .8rem .9rem; }
  .karte-aktionen { width: 100%; }
  .zl-laeuft { width: 22px; }
  .zl-achse { margin-right: 28px; }
  .ipt-text { max-height: 55vh; font-size: 11.5px; }
}

@media (forced-colors: active) {
  .zl > span, .muster, .zl-laeuft { forced-color-adjust: none; }
}

/* =====================================================================================
 * Teil 2: Admin-Frontend
 * ===================================================================================== */

a { color: var(--akzent); }
a:hover { text-decoration-thickness: 2px; }
.leer { color: var(--text-3); }

/* ---------- Leiste oben: Marke, Navigation, Abmelden ---------- */
.leiste {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem;
  padding: .6rem clamp(16px, 3vw, 32px);
  background: var(--flaeche); border-bottom: 1px solid var(--rand);
}
.leiste-marke { font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.leiste-marke span { color: var(--akzent); }
.navi { display: flex; flex-wrap: wrap; gap: .25rem; margin-right: auto; }
.navi a {
  padding: .4rem .75rem; border-radius: 8px; color: var(--text-2); text-decoration: none; font-weight: 550;
}
.navi a:hover { background: var(--flaeche-2); color: var(--text); }
.navi a.aktiv { background: var(--akzent); color: var(--akzent-text); }
.abmelden { display: flex; align-items: center; gap: .5rem; margin: 0; }
.abmelden .wer { color: var(--text-2); font-size: .9rem; }
.marke-super { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }

/* ---------- Seitenkopf ---------- */
.inhalt { min-height: 60vh; }
.seitenkopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1.5rem; margin: .4rem 0 1rem; }
.seitenkopf h1 { font-size: 1.4rem; }
.status-fuss { text-align: center; margin-top: 1.5rem; }

/* ---------- Hinweiskästen ---------- */
.kasten {
  border: 1px solid var(--rand-stark); border-left-width: 5px; border-radius: var(--radius);
  background: var(--flaeche); padding: .6rem .9rem; margin: 0 0 1rem;
}
.kasten p { margin: .15rem 0; overflow-wrap: anywhere; }
.kasten-titel { font-weight: 700; }
.kasten-ok { border-color: var(--punkt-ok); background: var(--ok-bg); }
.kasten-warn { border-color: var(--punkt-warn); background: var(--warn-bg); }
.kasten-fehler { border-color: var(--punkt-bad); background: var(--bad-bg); }
.kasten-info { border-left-color: var(--akzent); }

/* ---------- Formulare ---------- */
.formular { margin: 0 0 1rem; }
.formular-zeile { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem .9rem; }
.feld { display: flex; flex-direction: column; gap: .2rem; min-width: 12rem; }
.feld-breit { flex: 1 1 18rem; }
.feld label, .code-formular label { font-size: .85rem; color: var(--text-2); font-weight: 600; }
input[type="text"], input[type="search"], textarea {
  font: inherit; color: var(--text); background: var(--flaeche);
  border: 1px solid var(--rand-stark); border-radius: 8px;
  padding: .45rem .65rem; min-height: 38px; width: 100%;
}
input[type="text"]:focus-visible, input[type="search"]:focus-visible { outline: 2px solid var(--fokus); outline-offset: 1px; }
input:invalid:not(:placeholder-shown) { border-color: var(--punkt-warn); }
form.inline { display: inline; margin: 0; }
.knopf { color: var(--text); text-decoration: none; }
a.knopf-haupt, .knopf-haupt { color: var(--akzent-text); }
.knopf-klein { min-height: 30px; padding: .2rem .6rem; font-size: .82rem; }
.knopf-gross { font-size: 1rem; padding: .65rem 1.2rem; }
.knopf-gefahr { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }
.knopf-gefahr:hover:not(:disabled) { background: var(--bad); color: #fff; border-color: var(--bad); }
.knopf-haupt:hover:not(:disabled) { filter: brightness(1.08); }

/* ---------- Reiter (Listen) ---------- */
.reiter { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.25rem; }
.reiter a {
  display: flex; flex-direction: column; gap: .1rem; min-width: 12rem;
  padding: .55rem .9rem; border: 1px solid var(--rand); border-radius: var(--radius);
  background: var(--flaeche); color: var(--text); text-decoration: none; box-shadow: var(--schatten);
}
.reiter a:hover { border-color: var(--akzent); }
.reiter a.aktiv { border-color: var(--akzent); box-shadow: inset 0 -3px 0 var(--akzent); }
.reiter-titel { font-weight: 650; }
.reiter-zahl { font-size: .82rem; color: var(--text-3); }

/* ---------- Tabellen ---------- */
.daten { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); font-size: .88rem; }
.daten th, .daten td { padding: .4rem .6rem; }
.daten th { background: var(--flaeche-2); position: sticky; top: 0; }
.daten tbody tr:nth-child(even) { background: var(--flaeche-2); }
.daten tbody tr:hover { background: var(--grau-bg); }
.daten td.r, .daten th.r { padding-right: .6rem; }
.daten .aktionen { white-space: nowrap; }
.daten .aktionen form + form { margin-left: .3rem; }
.protokoll td { vertical-align: top; }
.daten time { white-space: nowrap; }
.protokoll .marke { white-space: nowrap; }
.marke-list_add { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.marke-list_remove { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.marke-history_delete { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }
.abschnitt > h2 { margin-bottom: .5rem; }
.kv-paar { display: inline-block; margin-right: .6rem; }
.kv-schluessel { color: var(--text-3); }

.blaettern { display: flex; gap: .5rem; margin-top: .75rem; }
.seitenwahl { margin-left: auto; font-size: .85rem; color: var(--text-2); }
.seitenwahl a, .seitenwahl strong { margin-left: .25rem; }
.suche { margin-top: .25rem; }

/* ---------- Blacklist: Einzelheiten ---------- */
.lage { margin: 0 0 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.fakten-zwei { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1.25rem; }
.fakten-zwei .fakt { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: .75rem .9rem; }
.fakten-zwei h2 { font-size: 1rem; margin-bottom: .4rem; }
.gefahr { border: 1px solid var(--bad); border-left-width: 5px; border-radius: var(--radius); background: var(--flaeche); padding: .8rem 1rem; }
.gefahr h2 { color: var(--bad); margin-bottom: .4rem; }
.gefahr .formular { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem .9rem; margin: .6rem 0 0; }

/* ---------- Anmeldung ---------- */
body.anmelden .inhalt { max-width: 640px; }
.karte-anmelden {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px;
  box-shadow: var(--schatten); padding: 1.1rem 1.25rem;
}
.karte-anmelden p { margin: .5rem 0; }
.schritte { display: flex; gap: .4rem; list-style: none; padding: 0; margin: 0 0 .8rem; counter-reset: s; flex-wrap: wrap; }
.schritte li {
  counter-increment: s; padding: .2rem .7rem; border-radius: 999px; font-size: .85rem;
  background: var(--grau-bg); color: var(--text-2);
}
.schritte li::before { content: counter(s) ". "; }
.schritte li.fertig { background: var(--ok-bg); color: var(--ok); }
.schritte li.aktuell { background: var(--akzent); color: var(--akzent-text); font-weight: 650; }
.code-formular { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin: .8rem 0; }
.code-formular input { width: 9rem; font-size: 1.2rem; letter-spacing: .15em; font-family: var(--mono); }
.einrichten { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; margin: .8rem 0; }
.qr { background: #fff; padding: 6px; border-radius: 8px; border: 1px solid var(--rand); line-height: 0; }
.qr svg { width: 210px; height: 210px; display: block; }
.feldname { display: block; font-size: .85rem; color: var(--text-2); font-weight: 600; }
.geheimnis {
  display: inline-block; margin-top: .2rem; padding: .35rem .6rem; border-radius: 6px;
  background: var(--flaeche-2); border: 1px solid var(--rand); font: 600 1rem/1.4 var(--mono);
  letter-spacing: .05em; overflow-wrap: anywhere; user-select: all;
}

@media (max-width: 760px) {
  .fakten-zwei { grid-template-columns: 1fr; }
  .abmelden { width: 100%; justify-content: space-between; }
  .seitenwahl { margin-left: 0; width: 100%; }
  .feld { min-width: 0; width: 100%; }
}

/* =====================================================================================
 * Teil 3 (0.2.0, Vertrag 18): Host-Seite /host, Whitelisten /whitelisten, Statusseite
 * ===================================================================================== */

/* Statusseite: Name als Link zur Host-Seite, letzter Angriff */
.karte-name h3 a { color: inherit; text-decoration: none; }
.karte-name h3 a:hover, .karte-name h3 a:focus-visible { text-decoration: underline; }
.letzter-angriff { font-size: .88rem; }
.karte-aktionen a.knopf { text-decoration: none; }

/* Host-Seite */
.zurueck { margin: -.5rem 0 .75rem; font-size: .9rem; }
.host-kopf.karte { padding: .9rem 1rem 1rem; }
.fakten-kopf { margin-top: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .fakten-kopf { grid-template-columns: 1fr; } }
.fakten-kopf .lage { margin-bottom: .4rem; }
.host-kopf .angriff-band { margin-top: .75rem; }
.teile { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.ampel.teil-ok { border-left-color: var(--punkt-ok); }
.ampel.teil-bad { border-left-color: var(--punkt-bad); background: var(--bad-bg); }
.ampel.teil-grau { border-left-color: var(--punkt-grau); }
.inline-formular { display: inline-flex; margin: 0 0 .6rem; }
.auftrag {
  display: flex; gap: .75rem; align-items: flex-start; padding: .7rem .9rem; margin: .25rem 0 .75rem;
  border: 1px solid var(--rand); border-radius: var(--radius); background: var(--flaeche);
}
.auftrag .kreisel {
  width: 22px; height: 22px; flex: none; border-radius: 50%; margin-top: 2px;
  border: 3px solid var(--rand-stark); border-top-color: var(--akzent);
  animation: drehen .9s linear infinite;
}
.auftrag p { margin: 0 0 .3rem; }
.block-text { margin: .5rem 0; max-height: 70vh; min-height: 0; }
.bericht { display: flex; flex-direction: column; gap: .4rem; margin: .5rem 0; }
.json-teil {
  border: 1px solid var(--rand); border-radius: var(--radius); background: var(--flaeche); padding: .45rem .8rem;
}
.json-teil > summary { cursor: pointer; font-weight: 650; }
.json-teil[open] > summary { margin-bottom: .4rem; }
.json-kv { font-size: .84rem; }
.json-kv .json-kv { padding-left: .2rem; border-left: 2px solid var(--rand); }
.json-liste { margin: 0; padding-left: 1.2rem; }
.json-tabelle { font-size: .8rem; }
.json-tabelle td, .json-tabelle th { white-space: nowrap; }
.json-roh { margin-top: .5rem; }
.json-roh > summary { cursor: pointer; font-size: .9rem; color: var(--text-2); }
.angriffe-tabelle tr.angriff td { border-bottom: 0; }
.angriffe-tabelle tr.angriff-ziele td { padding-top: 0; }
/* zwei Zeilen je Angriff: beide gleich hinterlegt, jeder zweite Angriff abgesetzt */
.angriffe-tabelle tbody tr:nth-child(even) { background: transparent; }
.angriffe-tabelle tbody tr:nth-child(4n+1), .angriffe-tabelle tbody tr:nth-child(4n+2) { background: var(--flaeche-2); }
.tabelle.ziele { margin: .3rem 0 .4rem; }

/* Whitelisten */
.holen { margin-bottom: .75rem; }
.holen .nebeninfo { margin: .2rem 0 0; }
.stand { margin-bottom: .75rem; }
.stand h3 { font-size: .95rem; margin-bottom: .35rem; }
.stand h3.abstand { margin-top: .75rem; }
.hash { overflow-wrap: anywhere; }
.ergebnis { margin: .5rem 0; }
.ip-raster {
  list-style: none; margin: .5rem 0; padding: .6rem .8rem; display: grid; gap: .15rem 1rem;
  grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
}
.ip-raster li { display: flex; gap: .6rem; align-items: baseline; font-size: .9rem; }
.ip-raster .nr { color: var(--text-3); font-size: .75rem; min-width: 4.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.blaettern { flex-wrap: wrap; align-items: center; }
.seite-springen { display: inline-flex; align-items: center; gap: .4rem; margin: 0 0 0 auto; font-size: .88rem; }
.seite-springen input {
  width: 6.5rem; font: inherit; color: var(--text); background: var(--flaeche);
  border: 1px solid var(--rand-stark); border-radius: 8px; padding: .35rem .5rem; min-height: 36px;
}
.abrufe td.name { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .seite-springen { margin-left: 0; }
  .ip-raster { grid-template-columns: 1fr 1fr; gap: .15rem .5rem; padding: .5rem; }
  .ip-raster .nr { min-width: 0; }
}
