/* Zentrale: schlichter Darkmode im Stil von greengoon und Schauen, keine externen Ressourcen */
:root {
  color-scheme: dark;
  --bg: #131513;
  --text: #e4e7e2;
  --muted: #9aa097;
  --panel: #1b1e1a;
  --line: #2c302b;
  --accent: #6fcf7f;
  --warn: #e0a458;
  --gefahr: #e07a6f;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5;
}
main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; width: 100%; }
h1 { color: var(--accent); margin: 0 0 1.25rem; font-size: 1.75rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
a { color: var(--accent); }
code { background: var(--bg); padding: .1rem .35rem; border-radius: 4px; }
.muted { color: var(--muted); }
.klein { font-size: .85rem; color: var(--muted); max-width: 22rem; word-break: break-word; }

section {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 1rem; margin-bottom: 1.25rem;
}
section.schmal { max-width: 460px; margin: 2rem auto; }

/* Formulare */
label { display: block; margin: .75rem 0 .35rem; color: var(--muted); }
input:not([type=hidden]):not([type=checkbox]), select {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: .55rem .7rem; font: inherit;
}
input[type=checkbox] { width: auto; margin-right: .5rem; }
label.wahl { color: var(--text); }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 1rem 0 0; padding: .5rem .9rem .9rem; }
legend { color: var(--muted); padding: 0 .4rem; }
button, .button {
  display: inline-block; background: var(--accent); color: #0d1a0f; border: 0;
  border-radius: 6px; padding: .5rem 1rem; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap; margin-top: 1rem;
}
button:hover, .button:hover { filter: brightness(1.1); }
button.zweit, .button.zweit { background: var(--bg); color: var(--text); border: 1px solid var(--line); }
button.gefahr, .button.gefahr { background: var(--gefahr); color: #200d0a; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.button:focus-visible, button:focus-visible { outline-color: var(--text); }
.aktionen { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.aktionen form { margin: 0; }
.aktionen button, .aktionen .button { margin-top: 0; }
.abstand { margin-top: 1rem; }
input.link { font-family: ui-monospace, monospace; font-size: .85rem; }

/* Meldungen */
.msg { padding: .6rem .9rem; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); }
.msg.ok { border-color: var(--accent); }
.msg.error { border-color: var(--gefahr); color: var(--gefahr); }

/* Tabellen */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td button { margin-top: 0; }
@media (max-width: 700px) { section { overflow-x: auto; } }

dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }
ul.liste { list-style: none; padding: 0; margin: 0; }
ul.liste li { padding: .4rem 0; border-bottom: 1px solid var(--line); }

/* ---------- Seitenleiste ---------- */
.sym { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.rahmen { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
html.eingeklappt .rahmen { grid-template-columns: 68px minmax(0, 1fr); }
.leiste {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line); padding: .75rem .6rem; overflow-y: auto;
}
.leiste-kopf { display: flex; align-items: center; justify-content: space-between; padding: .25rem .4rem .75rem; }
.logo { color: var(--accent); font-weight: 700; font-size: 1.2rem; text-decoration: none; }
.symbol-knopf {
  background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 6px;
  padding: .35rem; margin: 0; line-height: 0; display: inline-flex;
}
.symbol-knopf:hover { color: var(--text); border-color: var(--line); filter: none; }
.leiste-nav { display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.gruppe { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; margin: 1rem .6rem .25rem; }
.eintrag {
  position: relative; display: flex; align-items: center; gap: .7rem; padding: .5rem .6rem;
  border-radius: 6px; color: var(--text); text-decoration: none;
}
.eintrag:hover { background: var(--bg); }
.eintrag.aktiv { background: var(--bg); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }

/* Statuspunkt: grau = unbekannt, grün = erreichbar, rot = nicht erreichbar */
.status { width: .6rem; height: .6rem; border-radius: 50%; background: var(--muted); margin-left: auto; flex: none; }
.status.an { background: var(--accent); }
.status.aus { background: var(--gefahr); }

/* Benutzerkarte unten */
.benutzerkarte { margin-top: .75rem; border-top: 1px solid var(--line); padding-top: .6rem; position: relative; }
.benutzerkarte summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: .7rem;
  padding: .4rem .5rem; border-radius: 6px;
}
.benutzerkarte summary::-webkit-details-marker { display: none; }
.benutzerkarte summary:hover { background: var(--bg); }
.kreis {
  width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--accent); color: #0d1a0f;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none;
}
.karte-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.karte-text strong { overflow: hidden; text-overflow: ellipsis; }
.karte-text small { color: var(--muted); }
.karte-menue {
  position: absolute; bottom: calc(100% - .2rem); left: 0; right: 0; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: .35rem; display: flex; flex-direction: column; gap: .1rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45); min-width: 11rem;
}
.karte-menue a, .menue-knopf {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: 6px;
  color: var(--text); text-decoration: none; background: transparent; border: 0; width: 100%;
  font: inherit; font-weight: 400; margin: 0; cursor: pointer; text-align: left; white-space: nowrap;
}
.karte-menue a:hover, .menue-knopf:hover { background: var(--panel); filter: none; }
.karte-menue form { margin: 0; }

.inhalt-spalte { min-width: 0; }
.oben, .blende { display: none; }

/* Eingeklappt: nur Symbole */
html.eingeklappt .text, html.eingeklappt .karte-text { display: none; }
html.eingeklappt .leiste { padding-left: .4rem; padding-right: .4rem; }
html.eingeklappt .leiste-kopf { flex-direction: column; gap: .5rem; padding-bottom: .5rem; }
html.eingeklappt .eintrag { justify-content: center; padding: .6rem 0; }
html.eingeklappt .eintrag .status { position: absolute; top: .35rem; right: .55rem; }
html.eingeklappt #einklappen .sym { transform: rotate(180deg); }
html.eingeklappt .benutzerkarte summary { justify-content: center; padding: .4rem 0; }
html.eingeklappt .karte-menue { left: .2rem; right: auto; }

/* ---------- Startseite ---------- */
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; }
.kachel {
  display: flex; flex-direction: column; gap: .35rem; padding: .9rem 1rem; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; color: var(--text); text-decoration: none;
}
.kachel:hover { border-color: var(--accent); }
.kachel-kopf { display: flex; align-items: center; gap: .6rem; }
.kachel-kopf .sym { color: var(--accent); }
.werte { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem; }
.wert { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; display: flex; flex-direction: column; }
.wert .titel { color: var(--muted); font-size: .85rem; }
.wert .zahl { font-size: 1.5rem; font-weight: 600; }
.wert .einheit { color: var(--muted); font-size: .85rem; font-weight: 400; }
.klein-abstand { margin: .75rem 0 0; }

/* ---------- Handy: Seitenleiste wird zum Menü ---------- */
@media (max-width: 800px) {
  .rahmen, html.eingeklappt .rahmen { grid-template-columns: minmax(0, 1fr); }
  .oben {
    display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem; background: var(--panel);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  }
  .leiste {
    position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: min(80vw, 300px);
    transform: translateX(-105%); transition: transform .2s ease;
  }
  .rahmen.menue-offen .leiste { transform: none; }
  .rahmen.menue-offen .blende { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .55); }
  /* Auf dem Handy nie "nur Symbole": das Menü zeigt immer die Namen */
  html.eingeklappt .text, html.eingeklappt .karte-text { display: revert; }
  html.eingeklappt .karte-text { display: flex; }
  html.eingeklappt .eintrag { justify-content: flex-start; padding: .5rem .6rem; }
  html.eingeklappt .eintrag .status { position: static; }
  html.eingeklappt .leiste-kopf { flex-direction: row; }
  #einklappen { display: none; }
  @media (prefers-reduced-motion: reduce) { .leiste { transition: none; } }
}

/* Container-Tabelle der Verwaltung */
.status.inline { display: inline-block; margin: 0 .5rem 0 0; }
td .button { margin-top: 0; }

/* Zwei-Faktor-Anmeldung */
.qr { background: #fff; display: inline-block; padding: .25rem; border-radius: 6px; line-height: 0; }
.qr svg { max-width: 100%; height: auto; }
ul.codes { columns: 2; }
ul.codes li { border-bottom: 0; font-size: 1.05rem; }

/* hidden-Attribut soll auch bei Knöpfen und Formularen gelten */
[hidden] { display: none !important; }
