:root {
  --grund: #f6f6f3;
  --karte: #ffffff;
  --text: #1d1d1d;
  --grau: #6b6b6b;
  --linie: #dcdcd6;
  --dunkel: #222222;
  --akzent: #1f6f5c;
  --akzent-hover: #185a4a;
  --link: #1f6f5c;
  --akzent-hell: #e3f1ec;
  --akzent-text: #14523f;
  --gelb: #8a5a00;
  --gelb-hell: #fdf1d8;
  --rot: #a12a2a;
  --rot-hell: #f9e3e3;
  --blau-hell: #e6eef8;
  --blau: #1f4f8a;
  --feld: #ffffff;
  --feld-linie: #bdbdb6;
  --hover: #f0f0ec;
  --tief: #fafaf8;
  --chip: #e8e8e2;
  --badge: #ececE6;
  --ok-linie: #a9d3c5;
  --fehler-linie: #e3b3b3;
  --hinweis-linie: #ecd49b;
  --befund: #fbfdfc;
  --kopf-text: #cfcfcf;
  --kopf-hover: #3a3a3a;
  --kopf-aktiv: #ffffff;
  --kopf-aktiv-text: #222222;
  --kopf-linie: #5a5a5a;
  color-scheme: light;
}

/* Dunkel: wenn das Gerät es wünscht und nichts anderes gewählt ist, oder wenn dunkel gewählt wurde (Knopf in der Kopfzeile) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grund: #151716;
    --karte: #1e2120;
    --text: #e8e8e4;
    --grau: #a3a6a0;
    --linie: #383c39;
    --dunkel: #0e100f;
    --akzent: #2a8a72;
    --akzent-hover: #33a187;
    --link: #62c9ac;
    --akzent-hell: #1b3a31;
    --akzent-text: #86dcc3;
    --gelb: #e8bd62;
    --gelb-hell: #3b3114;
    --rot: #f29595;
    --rot-hell: #402121;
    --blau-hell: #1c2d44;
    --blau: #93bcf0;
    --feld: #262a28;
    --feld-linie: #4b504c;
    --hover: #2e3230;
    --tief: #232624;
    --chip: #2e3230;
    --badge: #2e3230;
    --ok-linie: #2f6757;
    --fehler-linie: #7a3a3a;
    --hinweis-linie: #75612a;
    --befund: #202321;
    --kopf-text: #c4c7c1;
    --kopf-hover: #2a2d2b;
    --kopf-aktiv: #e8e8e4;
    --kopf-aktiv-text: #0e100f;
    --kopf-linie: #4b504c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --grund: #151716;
  --karte: #1e2120;
  --text: #e8e8e4;
  --grau: #a3a6a0;
  --linie: #383c39;
  --dunkel: #0e100f;
  --akzent: #2a8a72;
  --akzent-hover: #33a187;
  --link: #62c9ac;
  --akzent-hell: #1b3a31;
  --akzent-text: #86dcc3;
  --gelb: #e8bd62;
  --gelb-hell: #3b3114;
  --rot: #f29595;
  --rot-hell: #402121;
  --blau-hell: #1c2d44;
  --blau: #93bcf0;
  --feld: #262a28;
  --feld-linie: #4b504c;
  --hover: #2e3230;
  --tief: #232624;
  --chip: #2e3230;
  --badge: #2e3230;
  --ok-linie: #2f6757;
  --fehler-linie: #7a3a3a;
  --hinweis-linie: #75612a;
  --befund: #202321;
  --kopf-text: #c4c7c1;
  --kopf-hover: #2a2d2b;
  --kopf-aktiv: #e8e8e4;
  --kopf-aktiv-text: #0e100f;
  --kopf-linie: #4b504c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--grund); color: var(--text); font: 15px/1.5 "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif; }

header { background: var(--dunkel); color: #fff; display: flex; align-items: center; gap: 2rem; padding: 0.6rem 1.5rem; flex-wrap: wrap; }
header a { color: #fff; text-decoration: none; }
.marke { display: flex; align-items: center; gap: 0.8rem; font-weight: 600; }
.marke img { display: block; }
header nav { display: flex; gap: 0.3rem; flex: 1; }
header nav a { padding: 0.35rem 0.8rem; border-radius: 4px; color: var(--kopf-text); }
header nav a:hover { background: var(--kopf-hover); color: #fff; }
header nav a.aktiv { background: var(--kopf-aktiv); color: var(--kopf-aktiv-text); }
.abmelden { display: flex; align-items: center; gap: 0.8rem; margin: 0; }
.benutzer { color: var(--kopf-text); font-size: 0.9em; }
.umschalter { margin-left: auto; }

main { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }
h1 { font-size: 1.7rem; margin: 0.2rem 0 1rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 0 0 0.8rem; }
h3 { font-size: 1rem; margin: 0 0 0.4rem; }
a { color: var(--link); }
.grau { color: var(--grau); }
.klein { font-size: 0.85em; }
.fehlertext { color: var(--rot); }
.krume { color: var(--grau); margin: 0; font-size: 0.9em; }

.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 8px; padding: 1.1rem 1.3rem; margin: 0 0 1.2rem; }
.karte.schmal { max-width: 420px; margin: 3rem auto; }

.meldung { padding: 0.7rem 1rem; border-radius: 6px; margin: 0 0 1rem; border: 1px solid; }
.meldung.ok { background: var(--akzent-hell); border-color: var(--ok-linie); }
.meldung.fehler { background: var(--rot-hell); border-color: var(--fehler-linie); }
.meldung.hinweis { background: var(--gelb-hell); border-color: var(--hinweis-linie); }

label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9em; color: var(--grau); }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], input[type="date"], select {
  font: inherit; padding: 0.45rem 0.6rem; border: 1px solid var(--feld-linie); border-radius: 5px; background: var(--feld); color: var(--text); min-width: 0;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.karte.schmal form { display: flex; flex-direction: column; gap: 0.9rem; }
.google-knopf { display: block; text-align: center; padding: 0.7rem 1rem; }

button, .knopf {
  font: inherit; padding: 0.45rem 0.9rem; border: 1px solid var(--feld-linie); border-radius: 5px; background: var(--feld); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover:not(:disabled), .knopf:hover { background: var(--hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primaer, .knopf.primaer, button.primaer:hover:not(:disabled) { background: var(--akzent); border-color: var(--akzent); color: #fff; }
button.primaer:hover:not(:disabled), .knopf.primaer:hover { background: var(--akzent-hover); }
button.schlicht { background: transparent; border-color: var(--kopf-linie); color: #fff; padding: 0.25rem 0.7rem; }
button.schlicht:hover:not(:disabled) { background: var(--kopf-hover); }

.zeile { display: flex; gap: 0.9rem; flex-wrap: wrap; align-items: flex-end; margin: 0.4rem 0; }
.zeile label { flex: 1 1 180px; }
.zeile label.kurz { flex: 0 1 130px; }
/* Die Limits stehen oben auf einer Linie, auch wenn ihre Erklärungen verschieden lang sind */
.zeile.limits { align-items: flex-start; }
.zeile label.limit { flex: 1 1 210px; max-width: 280px; }
.zeile label.limit .titel { color: var(--text); font-weight: 600; }
/* Optionen mit Häkchen, untereinander */
.optionen { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; margin: 0.8rem 0; }
.optionen label { flex-direction: row; align-items: center; gap: 0.5rem; color: var(--text); font-size: 0.95em; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
details { margin: 0.6rem 0; }
summary { cursor: pointer; color: var(--link); }

.aktionen { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin: 0.6rem 0; }
.aktionen form { margin: 0; display: inline-block; }

.reiter { display: flex; gap: 0.3rem; margin: 0 0 1rem; flex-wrap: wrap; border-bottom: 1px solid var(--linie); }
.reiter a { padding: 0.5rem 0.9rem; text-decoration: none; color: var(--grau); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.reiter a.aktiv { color: var(--text); border-bottom-color: var(--akzent); font-weight: 600; }
.zaehler { background: var(--chip); border-radius: 10px; padding: 0 0.5rem; font-size: 0.85em; margin-left: 0.2rem; }
.suche { display: flex; gap: 0.5rem; align-items: center; margin: 0 0 1rem; flex-wrap: wrap; }
.suche input[type="search"] { width: 300px; max-width: 100%; }

.tabelle { overflow-x: auto; background: var(--karte); border: 1px solid var(--linie); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.05em; color: var(--grau); background: var(--tief); }
tr:last-child td { border-bottom: 0; }
td.aufhaenger { max-width: 320px; }
td.aktionen { white-space: nowrap; }
td.aktionen form { display: inline-block; margin: 0 0.2rem 0 0; }
td.aktionen .knopf, td.aktionen button { padding: 0.3rem 0.6rem; font-size: 0.9em; }
td.aktionen button.primaer, button.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.leer { padding: 2rem; text-align: center; }

.badge { display: inline-block; padding: 0.05rem 0.55rem; border-radius: 10px; font-size: 0.8em; background: var(--badge); color: var(--text); white-space: nowrap; }
.badge.frei, .badge.freigegeben, .badge.erreicht { background: var(--akzent-hell); color: var(--akzent-text); }
.badge.pruefen, .badge.pausiert, .badge.gescannt { background: var(--gelb-hell); color: var(--gelb); }
.badge.treffer, .badge.verworfen, .badge.abgebrochen { background: var(--rot-hell); color: var(--rot); }
.badge.entwurf, .badge.laeuft, .badge.versendet { background: var(--blau-hell); color: var(--blau); }

.spalten { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.2rem; align-items: start; }
@media (max-width: 960px) { .spalten { grid-template-columns: 1fr; } }
.kopfzeile { margin: 0 0 1.2rem; color: var(--grau); }

iframe.pdf { width: 100%; height: 640px; border: 1px solid var(--linie); border-radius: 6px; background: #fff; }
.befund { border-top: 1px solid var(--linie); padding: 0.9rem 0; }
.befund.imreport { background: var(--befund); }
.befund dl { display: grid; grid-template-columns: 8rem 1fr; gap: 0.2rem 0.8rem; margin: 0.5rem 0 0; font-size: 0.92em; }
.befund dt { color: var(--grau); }
.befund dd { margin: 0; }
.profil { padding-left: 1.2rem; color: var(--grau); font-size: 0.92em; }

dl.mail { display: grid; grid-template-columns: 5rem 1fr; gap: 0.2rem 0.8rem; margin: 0 0 0.6rem; }
dl.mail dt { color: var(--grau); }
dl.mail dd { margin: 0; overflow-wrap: anywhere; }
pre.mailtext { white-space: pre-wrap; word-wrap: break-word; font: inherit; background: var(--tief); border: 1px solid var(--linie); border-radius: 6px; padding: 0.8rem 1rem; max-height: 420px; overflow: auto; }

ul.verlauf { list-style: none; padding: 0; margin: 0.4rem 0 0; }
ul.verlauf li { padding: 0.25rem 0; border-top: 1px solid var(--linie); }
.stufe { font-size: 0.75em; text-transform: uppercase; padding: 0 0.4rem; border-radius: 4px; background: var(--badge); }
.stufe.fehler { background: var(--rot-hell); color: var(--rot); }
.stufe.warnung { background: var(--gelb-hell); color: var(--gelb); }
.zahlen { display: flex; gap: 2rem; flex-wrap: wrap; margin: 0; }
.zahlen a { text-decoration: none; color: var(--text); }
.zahlen strong { font-size: 1.6rem; display: block; line-height: 1.1; }
progress { width: 220px; height: 0.9rem; vertical-align: middle; accent-color: var(--akzent); appearance: none; border: 0; border-radius: 6px; background: var(--chip); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--chip); border-radius: 6px; }
progress::-webkit-progress-value { background: var(--akzent); border-radius: 6px; }
progress::-moz-progress-bar { background: var(--akzent); border-radius: 6px; }
.scan-formular .zeile:first-child label:first-child { flex: 2 1 220px; }

/* Letzte Aktivität auf der Startseite */
.zwischentitel { margin: 1rem 0 0.2rem; font-size: 0.9rem; color: var(--grau); text-transform: uppercase; letter-spacing: 0.04em; }
ul.aktivitaet li { overflow-wrap: anywhere; font-size: 0.92em; }

/* Scan-Details */
dl.kv { display: grid; grid-template-columns: 9rem 1fr; gap: 0.5rem 1rem; margin: 0 0 0.6rem; }
dl.kv dt { color: var(--grau); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.spalten.gleich { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 960px) { .spalten.gleich { grid-template-columns: 1fr; } }
.klein-tabelle { margin: 0 0 1rem; }
.klein-tabelle th, .klein-tabelle td { padding: 0.4rem 0.6rem; }
.klein-tabelle th { letter-spacing: 0; text-transform: none; font-size: 0.85em; }
.klein-tabelle td:first-child { white-space: nowrap; }
.klein-tabelle progress { width: 100px; }
ol.naechste { margin: 0.3rem 0 0.6rem; padding-left: 1.3rem; }
.verlauf-kopf { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; margin: 0 0 0.4rem; }
.klein-reiter { margin: 0; border-bottom: 0; align-items: center; }
.klein-reiter a { padding: 0.3rem 0.7rem; border: 1px solid var(--linie); border-radius: 5px; margin: 0; }
.klein-reiter a.aktiv { border-color: var(--akzent); }
table.log td { padding: 0.45rem 0.7rem; font-size: 0.92em; }
table.log td.nowrap { white-space: nowrap; color: var(--grau); }
table.log td.meldungstext { overflow-wrap: anywhere; }
table.log tr.stufe-fehler td { background: var(--rot-hell); }
table.log tr.stufe-warnung td { background: var(--gelb-hell); }
table.log pre { margin: 0.4rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9em; background: var(--tief); padding: 0.5rem 0.7rem; border-radius: 5px; border: 1px solid var(--linie); max-height: 260px; overflow: auto; }
