/* towet.dev – VPS Dashboard
   Farben nach DESIGN_towet.dev.md (Olibo-Grün, dunkle Slate-Flächen),
   Aufbau nach dem Mockup (große Kennzahlen, ruhige Tabellen, Rollen-Abzeichen). */

:root {
  --bg: #0E1822;
  --bg-deep: #0A131B;
  --surface: #1C2934;
  --surface-raised: #24333F;
  --border: #344652;
  --border-weich: rgba(52, 70, 82, 0.55);

  --text: #E8EDF2;
  --text-muted: #A8B6BF;
  --text-subtle: #81919D;

  --accent: #5C6437;
  --accent-hover: #737F48;
  --accent-bright: #909A62;
  --accent-soft: #283324;
  --on-accent: #FFFFFF;
  --nav-aktiv: #6A7441;          /* etwas heller als --accent, weißer Text bleibt gut lesbar */

  /* Olibo-Metallic (wie im Mockup). Der helle Glanz liegt rechts, wo kein
     Text steht – weißer Text sitzt immer auf dem dunklen Teil. */
  --metall-flaeche: linear-gradient(100deg, #56612E 0%, #646F37 50%, #8A9655 76%, #6F7B40 90%, #5F6A34 100%);
  --metall-flaeche-hover: linear-gradient(100deg, #5F6A34 0%, #6F7B40 50%, #97A361 76%, #7A8748 90%, #67733A 100%);
  /* Balken: Glanz von oben nach unten wie bei einem gebürsteten Metallstreifen */
  --metall-balken: linear-gradient(180deg, #B6C07D 0%, #95A15B 40%, #7A8644 75%, #8F9B56 100%);
  --metall-abzeichen: linear-gradient(135deg, #5E6934 0%, #7B8746 55%, #98A462 75%, #6C783D 100%);

  --success: #22C55E;
  --warning: #F2B84B;
  --danger: #EF5350;
  --inactive: #94A3B8;
  --chart-secondary: #B5C9D8;

  --font-body: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
  --radius-card: 14px;
  --radius-control: 9px;
  --gap-card: 18px;
  --fokus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-bright);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-bright); }
a:hover { color: #A9B37A; }

:focus-visible { outline: none; box-shadow: var(--fokus); border-radius: 6px; }

svg { flex: none; }

.sprung {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  padding: 8px 12px; border-radius: var(--radius-control);
  background: var(--accent); color: var(--on-accent);
}
.sprung:focus { top: 12px; }

.abstand-oben { margin-top: 18px; }

.nur-vorlesen {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* --- Grundgerüst -------------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.seitenleiste {
  background: var(--bg-deep);
  border-right: 1px solid var(--border-weich);
  padding: 28px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.marke {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}
.marke img { width: 80px; height: 80px; margin-bottom: 10px; }
.marke-name { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
/* ".dev" im Schriftzug im Grün des Logos (DESIGN-towet.md, Abschnitt 4) */
.marke-endung { color: var(--accent-bright); }
.marke-zusatz { font-size: 16px; color: var(--text-muted); }
/* Statuspunkt neben dem Namen und Konto-Symbol gibt es nur auf dem Handy (siehe unten) */
.marke-status, .konto-knopf, .menue-punkt .kurz { display: none; }

.menue { display: flex; flex-direction: column; gap: 4px; }
.menue-punkt {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 16px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
}
.menue-punkt svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  color: var(--text-muted);
}
.menue-punkt:hover { background: var(--surface); color: var(--text); }
.menue-punkt[aria-current="page"] {
  background: var(--metall-flaeche);
  color: var(--on-accent);
  font-weight: 700;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.menue-punkt[aria-current="page"] svg { color: var(--on-accent); }
.menue-punkt[aria-current="page"]:hover { background: var(--metall-flaeche-hover); }
.menue-trenner { border: 0; border-top: 1px solid var(--border); margin: 12px 16px; }

.serverstatus {
  margin-top: auto;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border-weich);
  border-radius: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.serverstatus .status { font-weight: 700; font-size: 15px; }
.serverstatus .klein { color: var(--text-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main { padding: 26px 32px 40px; max-width: 1600px; width: 100%; }
main:focus { outline: none; }

/* --- Kopfbereich ---------------------------------------------------------------- */

.kopf {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px 24px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.kopf h1 { margin: 0; font-size: 32px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.untertitel { margin: 4px 0 0; color: var(--text-muted); font-size: 15px; }

.kopf-meta { display: flex; align-items: center; gap: 18px; padding-top: 8px; font-size: 15px; }
.meta-eintrag { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.meta-eintrag svg {
  width: 20px; height: 20px; fill: none; stroke: var(--text-muted);
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.meta-eintrag.veraltet { color: var(--warning); }
.meta-trenner { width: 1px; height: 26px; background: var(--border); }

/* --- Raster und Karten -------------------------------------------------------------- */

.ansicht {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap-card);
}
.ansicht[hidden] { display: none; }
.s-12 { grid-column: span 12; }
.s-8 { grid-column: span 8; }
.s-7 { grid-column: span 7; }
.s-6 { grid-column: span 6; }
.s-5 { grid-column: span 5; }
.s-4 { grid-column: span 4; }

.karte {
  background: var(--surface);
  border: 1px solid var(--border-weich);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  min-width: 0;
}
.karte-kopf {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.karte-titel { display: flex; align-items: center; gap: 12px; min-width: 0; }
.karte-titel h2 { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.3; }
.karte-titel svg {
  width: 26px; height: 26px; fill: none; stroke: url(#metall-strich);
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.karte .unterzeile { margin: -8px 0 14px; color: var(--text-muted); font-size: 14px; }

/* --- KPI-Karte -------------------------------------------------------------------- */

.kpi { display: flex; flex-direction: column; padding: 22px 22px 20px; }
.kpi-oben { display: flex; gap: 18px; align-items: flex-start; }
.kpi-symbol svg {
  width: 44px; height: 44px; fill: none; stroke: url(#metall-strich);
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.kpi-titel { font-size: 16px; font-weight: 700; }
/* Große Ziffern eng setzen: Mit wachsender Größe wirken Abstände zwischen Zeichen zu weit */
.kpi-wert { font-size: 40px; font-weight: 700; line-height: 1.1; margin-top: 2px; letter-spacing: -0.025em; }
.kpi-wert.keine-daten { font-size: 24px; color: var(--text-subtle); font-weight: 600; padding: 8px 0 4px; }
.kpi-detail { color: var(--text-muted); font-size: 16px; }

.balken {
  height: 14px;
  background: #2B3945;
  border-radius: 7px;
  margin-top: 18px;
  overflow: hidden;
}
/* Der Füllstreifen ist immer voll breit und wird per transform verschoben (app.js).
   So gleitet er beim Aktualisieren vom alten zum neuen Wert, ohne dass der Browser
   die Seite neu berechnen muss. Weich auslaufend, wie ein Körper, der abbremst. */
.balken > span {
  display: block; height: 100%; width: 100%; border-radius: 7px;
  background: var(--metall-balken);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform: translateX(-100%);
  transition: transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
}
/* Warnstufen bleiben matt in den Statusfarben – eindeutig statt dekorativ */
.balken.warnung > span { background: var(--warning); box-shadow: none; }
.balken.kritisch > span { background: var(--danger); box-shadow: none; }

.kpi-warnung { margin-top: 10px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi-warnung.warnung { color: var(--warning); }
.kpi-warnung.kritisch { color: var(--danger); }

/* --- Status und Abzeichen ------------------------------------------------------------ */

.status { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; }
.punkt { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.punkt-ok { background: var(--success); }
.punkt-warnung { background: var(--warning); }
.punkt-fehler { background: var(--danger); }
.punkt-inaktiv { background: var(--inactive); }

.abzeichen {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: #2E3D49;
  color: #D5DEE5;
}
.abzeichen-admin {
  background: var(--metall-abzeichen); color: #FFFFFF;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.chip {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12.5px;
  margin: 2px 4px 2px 0;
}

/* --- Hinweise und Meldungen ---------------------------------------------------------- */

/* Statuszeile: in einem Satz, ob alles in Ordnung ist (DESIGN_towet.dev.md, 7.2).
   Status steht immer als Text da, Farbe und Symbol unterstützen nur. */
.statuszeile {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 16px; margin-bottom: var(--gap-card);
  border-radius: 12px; border: 1px solid var(--border-weich); background: var(--surface);
  font-size: 15px;
}
.statuszeile p { margin: 0; color: var(--text-muted); }
.statuszeile p strong { color: var(--text); font-weight: 650; }
.statuszeile.ok .punkt { margin-top: 7px; }
.statuszeile > svg { margin-top: 2px; }
.statuszeile.warnung { border-color: #7A6230; }
.statuszeile.warnung > svg { color: var(--warning); }
.statuszeile.fehler { border-color: #7C3533; }
.statuszeile.fehler > svg { color: var(--danger); }
.probleme { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.probleme li { font-weight: 600; display: flex; align-items: baseline; gap: 9px; }
.probleme li .punkt { flex: none; transform: translateY(-1px); }
.probleme li.weitere { font-weight: 400; color: var(--text-muted); }
.probleme a { color: inherit; text-decoration-color: var(--text-subtle); text-underline-offset: 3px; }
.probleme a:hover { text-decoration-color: currentColor; }

.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 14px 18px;
  background: var(--surface-raised);
  border: 1px solid #2E6B45;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-weight: 500;
}
.toast::before { content: "✓"; color: var(--success); font-weight: 700; }
/* Kommt von unten herein und geht auf demselben Weg wieder hinaus */
.toast {
  transition: opacity 200ms ease-out, transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
    display 280ms allow-discrete;
}
.toast[hidden] { display: none; opacity: 0; transform: translateY(16px); }
@starting-style { .toast:not([hidden]) { opacity: 0; transform: translateY(16px); } }

/* --- Tabellen ---------------------------------------------------------------------- */

.tabelle-rahmen { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; }
th {
  background: var(--surface-raised);
  color: var(--text-muted);
  font-weight: 500;
  text-align: left;
  padding: 8px 12px;
  white-space: nowrap;
}
th:first-child { border-radius: 8px 0 0 8px; }
th:last-child { border-radius: 0 8px 8px 0; }
td { padding: 9px 12px; border-bottom: 1px solid var(--border-weich); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th.zahl, td.zahl { text-align: right; white-space: nowrap; }
td.name {
  max-width: 240px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 700;
}
/* Tabellen in den kleineren Karten der Übersicht etwas enger, ohne Symbol vor dem Namen */
.kompakt th, .kompakt td { padding-left: 9px; padding-right: 9px; }
.kompakt .mit-symbol svg { display: none; }
/* Lange Zustände wie „gestoppt (Fehlercode 1)“ dürfen hier umbrechen statt Spalten zu verdrängen */
.kompakt .status { white-space: normal; }
.kompakt td.name { max-width: 190px; }

.mit-symbol { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; vertical-align: middle; }
.mit-symbol > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.mit-symbol svg {
  width: 20px; height: 20px; fill: none; stroke: var(--text-muted);
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.mit-symbol.container svg { stroke: var(--accent-bright); }
.leer { color: var(--text-subtle); }
td .zusatz { display: block; color: var(--text-subtle); font-size: 12.5px; font-weight: 400; }

/* --- Angaben-Liste (Systeminformationen) ----------------------------------------------- */

.info-liste { margin: 0; }
.info-liste > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-weich);
}
.info-liste > div:last-child { border-bottom: 0; }
.info-liste dt { color: var(--text); }
.info-liste dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }

/* --- Diagramm --------------------------------------------------------------------------- */

.legende { display: flex; gap: 22px; margin: 0; padding: 0; list-style: none; font-size: 15px; }
.legende li { display: flex; align-items: center; gap: 8px; }
.quadrat { width: 14px; height: 14px; border-radius: 3px; flex: none; display: inline-block; }
.farbe-cpu { background: var(--metall-balken); }
.farbe-ram { background: var(--chart-secondary); }

.diagramm-platz { min-width: 0; }
.diagramm { position: relative; height: 230px; }
.diagramm svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }
.diagramm svg:focus-visible { box-shadow: var(--fokus); }
.diagramm .raster line { stroke: var(--border); stroke-width: 1; opacity: 0.6; }
.diagramm .achse text { fill: var(--text); font-size: 13px; }
.diagramm .linie { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.diagramm .linie-cpu { stroke: var(--accent-bright); }
.diagramm .linie-ram { stroke: var(--chart-secondary); }
.diagramm .endpunkt { stroke: var(--surface); stroke-width: 2; }
.diagramm .endwert { fill: var(--text); font-size: 12px; font-weight: 600; }
.diagramm .fadenkreuz { stroke: var(--text-subtle); stroke-width: 1; }
.diagramm .leer-text { fill: var(--text-subtle); font-size: 14px; }

.tooltip {
  position: absolute; pointer-events: none; z-index: 2;
  background: var(--bg-deep); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; min-width: 150px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.tooltip .zeit { color: var(--text-subtle); margin-bottom: 4px; }
.tooltip .zeile { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .zeile span:first-child { display: flex; align-items: center; gap: 6px; color: var(--text-muted); }

.stunden-tabelle .tabelle-rahmen { max-height: 360px; overflow-y: auto; }
.stunden-tabelle th { position: sticky; top: 0; }

/* --- Knöpfe -------------------------------------------------------------------------- */

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-control);
  font: inherit; font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text);
}
.knopf:hover { border-color: var(--accent-bright); }
a.knopf { text-decoration: none; }  /* Links, die wie ein Knopf aussehen */
.knopf svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.knopf-primaer {
  background: var(--metall-flaeche); border-color: #56612E; color: var(--on-accent);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.knopf-primaer:hover { background: var(--metall-flaeche-hover); border-color: #6F7B40; }
.knopf-klein { padding: 6px 12px; font-size: 14px; }
.knopf:disabled { opacity: 0.6; cursor: wait; }
.knopf-symbol {
  width: 36px; height: 36px; padding: 0;
  display: inline-grid; place-items: center;
  border-radius: 8px; border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
}
.knopf-symbol:hover { background: var(--surface-raised); color: var(--text); }
.knopf-symbol svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* --- Fenster "Neues Konto anlegen" -------------------------------------------------------- */

dialog.fenster {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
dialog.fenster::backdrop { background: rgba(4, 9, 14, 0.72); }

/* Das Fenster wächst aus dem Knopf, der es geöffnet hat (Ursprung setzt app.js), und
   schrumpft beim Schließen dorthin zurück. Schließen ist schneller als Öffnen. */
dialog.fenster {
  transition: opacity 160ms ease-in, transform 160ms ease-in,
    overlay 160ms allow-discrete, display 160ms allow-discrete;
  opacity: 0;
  transform: scale(0.94);
}
dialog.fenster[open] {
  opacity: 1;
  transform: none;
  transition-duration: 220ms, 320ms, 320ms, 320ms;
  transition-timing-function: ease-out, cubic-bezier(0.22, 1, 0.36, 1);
}
@starting-style { dialog.fenster[open] { opacity: 0; transform: scale(0.94); } }
dialog.fenster::backdrop { transition: opacity 220ms ease-out, overlay 220ms allow-discrete, display 220ms allow-discrete; opacity: 0; }
dialog.fenster[open]::backdrop { opacity: 1; }
@starting-style { dialog.fenster[open]::backdrop { opacity: 0; } }

.fenster-kopf {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 22px 24px 0;
}
.fenster-kopf h2 { margin: 0; font-size: 21px; font-weight: 700; }
.fenster-kopf p { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }
.fenster-inhalt { padding: 18px 24px 4px; display: flex; flex-direction: column; gap: 18px; }
.fenster-fuss {
  display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 18px 24px 22px;
}

.feld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.feld > label, .feldgruppe > legend { font-size: 14px; font-weight: 600; color: var(--text); }
.feld input {
  font: inherit;
  padding: 11px 13px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
.feld input:focus-visible { border-color: var(--accent-bright); }
.feld input[aria-invalid="true"] { border-color: var(--danger); }
.feld-hilfe { font-size: 13px; color: var(--text-subtle); }

.passwort-feld { position: relative; }
.passwort-feld input { padding-right: 48px; }
.passwort-feld .knopf-symbol { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }

.feldgruppe { border: 0; margin: 0; padding: 0; min-width: 0; }
.feldgruppe > legend { padding: 0; margin-bottom: 8px; }
.rollen-wahl { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.rolle-karte {
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px 12px 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  cursor: pointer;
}
.rolle-karte input { position: absolute; opacity: 0; pointer-events: none; }
.rolle-karte::before {
  content: "";
  position: absolute; left: 14px; top: 15px;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--text-subtle);
}
.rolle-karte:has(input:checked) {
  border-color: var(--accent-bright);
  background: linear-gradient(120deg, #283324 0%, #2E3A26 60%, #3A4730 85%, #2C3725 100%);
}
.rolle-karte:has(input:checked)::before { border-color: var(--accent-bright); background: radial-gradient(var(--accent-bright) 0 4px, transparent 5px); }
.rolle-karte:has(input:focus-visible) { box-shadow: var(--fokus); }
.rolle-name { font-weight: 700; }
.rolle-rechte { font-size: 13px; color: var(--text-muted); }

.dienste-wahl { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.dienst-haken {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; min-height: 44px;
  border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--bg); cursor: pointer;
}
.dienst-haken input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-bright); flex: none; }
.dienst-haken:has(input:checked) { border-color: var(--accent-bright); }
.dienst-haken:has(input:disabled) { cursor: default; color: var(--text-muted); }
.dienst-haken:has(input:focus-visible) { box-shadow: var(--fokus); }
.dienst-haken input[aria-invalid="true"] { outline: 2px solid var(--danger); outline-offset: 2px; }

.abschnitt-trenner {
  border-top: 1px solid var(--border-weich);
  padding-top: 16px;
}
.abschnitt-trenner .feld-hilfe { margin-top: -2px; }

.formular-meldung {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  border: 1px solid #7C3533;
  background: rgba(239, 83, 80, 0.08);
  font-size: 14px;
}
.formular-meldung::before { content: "✕ "; color: var(--danger); font-weight: 700; }
.formular-meldung[hidden] { display: none; }

/* --- Login ----------------------------------------------------------------------------- */

.login-seite {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  /* Bauplan-Muster wie im Hub (Punkte und Würfel in Olibo, durchsichtig) */
  background: var(--bg) url("/_konto/static/hintergrund.svg") repeat;
}
.login-karte {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border-weich);
  border-radius: 16px;
  padding: 34px 32px 30px;
}
.login-marke { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 26px; }
.login-marke img { width: 80px; height: 80px; margin-bottom: 10px; }
/* Eine Anmeldeseite für alle Dienste: nur der Schriftzug, dafür größer.
   Großer Text braucht etwas engere Laufweite. */
.login-marke .marke-name { font-size: 34px; letter-spacing: -0.02em; }
@media (max-width: 380px) { .login-marke .marke-name { font-size: 30px; } }
.login-karte h1 { font-size: 22px; margin: 0 0 14px; }
.login-formular { display: flex; flex-direction: column; gap: 6px; }
.login-formular label { font-size: 14px; font-weight: 600; margin-top: 10px; }
.login-formular input {
  font: inherit; padding: 11px 13px;
  border-radius: var(--radius-control); border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
}
.login-formular input:focus-visible { border-color: var(--accent-bright); }
.login-formular .knopf { margin-top: 22px; }
.login-meldung {
  margin: 0 0 8px; padding: 10px 12px;
  border-radius: var(--radius-control); border: 1px solid var(--border);
  background: var(--surface-raised); font-size: 14px;
}
/* Seite für Konten, die nur andere Dienste nutzen dürfen */
.zugang-text { margin: 0 0 14px; color: var(--text-muted); }
.zugang-liste { margin: 0 0 22px; padding-left: 20px; line-height: 1.9; }
.zugang-liste a { color: var(--text); text-decoration-color: var(--accent-bright); text-underline-offset: 3px; }
.zugang-liste a:focus-visible { outline: none; box-shadow: var(--fokus); border-radius: 3px; }
.login-karte form .knopf { width: 100%; }

/* --- Bewegung -----------------------------------------------------------------------------
   Rückmeldung schon beim Drücken, nicht erst beim Loslassen. Animiert werden nur
   transform und opacity, die der Browser ohne Neuberechnung der Seite darstellt. */

.knopf, .knopf-symbol, .menue-punkt, .konto-knopf {
  transition: transform 180ms ease-out;
}
.knopf:active:not(:disabled), .knopf-symbol:active, .menue-punkt:active, .konto-knopf:active {
  transform: scale(0.97);
  transition-duration: 60ms;
}
/* Das Auge im Passwortfeld ist schon per transform mittig gesetzt – das bleibt erhalten */
.passwort-feld .knopf-symbol:active { transform: translateY(-50%) scale(0.92); }

/* Seitenwechsel: kurze, ruhige Überblendung mit einem Hauch Bewegung nach oben */
.ansicht:not([hidden]) { animation: einblenden 220ms ease-out; }
@keyframes einblenden {
  from { opacity: 0; transform: translateY(6px); }
}

/* "Bewegung reduzieren" im Betriebssystem: nur noch Überblendungen, nichts gleitet */
@media (prefers-reduced-motion: reduce) {
  .balken > span { transition: none; }
  .knopf:active:not(:disabled), .knopf-symbol:active, .menue-punkt:active, .konto-knopf:active { transform: none; }
  .passwort-feld .knopf-symbol:active { transform: translateY(-50%); }
  .ansicht:not([hidden]) { animation-name: einblenden-ruhig; }
  @keyframes einblenden-ruhig { from { opacity: 0; } }
  dialog.fenster, dialog.fenster[open], .toast, .toast[hidden] { transform: none; }
  @starting-style {
    dialog.fenster[open] { transform: none; }
    .toast:not([hidden]) { transform: none; }
  }
}

/* --- Übersicht am PC: alles auf einen Bildschirm, ohne Scrollen ------------------------------
   Die Kacheln teilen sich die Fensterhöhe. Reicht der Platz nicht, scrollt nur
   die Tabelle innerhalb ihrer Kachel. Unter 1281 × 720 Pixel gilt der normale
   Aufbau mit Scrollen. */

@media (min-width: 1281px) and (min-height: 720px) {
  main.vollbild {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 20px;
    padding-bottom: 20px;
  }
  main.vollbild .kopf { margin-bottom: 14px; }
  main.vollbild .kopf h1 { font-size: 30px; }
  main.vollbild .statuszeile { margin-bottom: 14px; padding: 8px 14px; }
  main.vollbild #ansicht-uebersicht {
    flex: 1;
    min-height: 0;
    gap: 16px;
    /* Reihe 3 (Dienste, System) ist so hoch wie ihr Inhalt, den Rest bekommt Reihe 2 */
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  main.vollbild #ansicht-uebersicht > .karte {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 16px 20px;
  }
  main.vollbild #ansicht-uebersicht .karte-kopf { margin-bottom: 10px; }
  main.vollbild #ansicht-uebersicht .tabelle-rahmen,
  main.vollbild #ansicht-uebersicht .info-liste { flex: 1; min-height: 0; overflow-y: auto; }
  main.vollbild #ansicht-uebersicht th { position: sticky; top: 0; z-index: 1; }
  main.vollbild #ansicht-uebersicht td { padding-top: 7px; padding-bottom: 7px; }
  main.vollbild #ansicht-uebersicht .info-liste > div { padding: 6px 0; }
  main.vollbild .diagramm-platz { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  main.vollbild .diagramm { flex: 1; height: auto; min-height: 120px; }
  main.vollbild .kpi { padding: 16px 20px 16px; }
  main.vollbild .kpi-wert { font-size: 36px; }
  main.vollbild .balken { margin-top: 14px; }
}

/* Schmalere PC-Bildschirme (z. B. Laptop oder Windows-Skalierung 125 %):
   Seitenleiste und Tabellen etwas enger, damit keine Spalte abgeschnitten wird. */
@media (min-width: 1281px) and (max-width: 1599px) {
  .app { grid-template-columns: 228px minmax(0, 1fr); }
  .seitenleiste { padding: 22px 14px 16px; gap: 22px; }
  .marke img { width: 64px; height: 64px; }
  .marke-name { font-size: 22px; }
  .menue-punkt { padding: 10px 14px; font-size: 15px; gap: 12px; }
  main { padding-left: 24px; padding-right: 24px; }
  .kompakt table { font-size: 14px; }
  .kompakt th, .kompakt td { padding-left: 7px; padding-right: 7px; }
  .kompakt td.name { max-width: 150px; }
  .kompakt .mit-symbol { gap: 7px; }
  .kompakt .mit-symbol svg { width: 17px; height: 17px; }
  .kompakt .abzeichen { padding: 1px 7px; font-size: 12.5px; }
}

/* Niedrigere PC-Bildschirme: Übersicht noch kompakter, damit alles passt. */
@media (min-width: 1281px) and (min-height: 720px) and (max-height: 860px) {
  main.vollbild { padding-top: 14px; padding-bottom: 14px; }
  main.vollbild .kopf { margin-bottom: 10px; }
  main.vollbild .kopf h1 { font-size: 26px; }
  main.vollbild .untertitel { font-size: 14px; margin-top: 2px; }
  main.vollbild .kopf-meta { padding-top: 4px; font-size: 14px; }
  main.vollbild #ansicht-uebersicht { gap: 12px; }
  main.vollbild #ansicht-uebersicht > .karte { padding: 12px 18px; }
  main.vollbild #ansicht-uebersicht .karte-kopf { margin-bottom: 6px; }
  main.vollbild #ansicht-uebersicht .karte-titel h2 { font-size: 17px; }
  main.vollbild #ansicht-uebersicht .karte-titel svg { width: 22px; height: 22px; }
  main.vollbild .kpi { padding: 12px 18px; }
  main.vollbild .kpi-oben { gap: 14px; }
  main.vollbild .kpi-symbol svg { width: 36px; height: 36px; }
  main.vollbild .kpi-titel { font-size: 15px; }
  main.vollbild .kpi-wert { font-size: 30px; }
  main.vollbild .kpi-detail { font-size: 14px; }
  main.vollbild .balken { height: 11px; margin-top: 10px; }
  main.vollbild #ansicht-uebersicht th { padding-top: 6px; padding-bottom: 6px; }
  main.vollbild #ansicht-uebersicht td { padding-top: 5px; padding-bottom: 5px; }
  main.vollbild #ansicht-uebersicht .info-liste > div { padding: 4px 0; font-size: 14px; }
  main.vollbild .knopf-klein { padding: 4px 10px; }
}

/* --- Kleinere Bildschirme ---------------------------------------------------------------- */

@media (max-width: 1280px) {
  .s-8, .s-7, .s-6, .s-5 { grid-column: span 12; }
}

@media (max-width: 1100px) {
  .s-4 { grid-column: span 12; }
}

/* --- Handy und schmale Tablets (DESIGN_towet.dev.md, 7.1) ----------------------------------
   Oben eine schmale Kopfzeile mit Logo, Statuspunkt und Konto-Symbol, unten eine feste
   Menüleiste in Daumenreichweite. Die Seite wird nie breiter als der Bildschirm. */

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); align-content: start; }

  .seitenleiste {
    position: sticky; top: 0; z-index: 20;
    height: auto; overflow: visible;
    flex-direction: row; align-items: center; justify-content: space-between;
    padding: 10px 12px 10px 16px; gap: 12px;
    padding-top: max(10px, env(safe-area-inset-top));
    border-right: 0; border-bottom: 1px solid var(--border-weich);
  }
  .marke { flex-direction: row; align-items: center; gap: 10px; text-align: left; }
  .marke img { width: 34px; height: 34px; margin: 0; }
  .marke-name { font-size: 19px; display: flex; align-items: center; gap: 8px; }
  .marke-zusatz { display: none; }
  .marke-status { display: inline-flex; }
  .serverstatus { display: none; }

  .konto-knopf {
    display: inline-grid; place-items: center;
    width: 44px; height: 44px; border-radius: 50%;
    color: var(--text-muted);
  }
  .konto-knopf svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
  .konto-knopf:hover { background: var(--surface); color: var(--text); }
  .konto-knopf[aria-current="page"] { background: var(--metall-flaeche); color: var(--on-accent); }

  /* Menüleiste unten: fünf gleich breite Punkte, Symbol über kurzer Beschriftung */
  .menue {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    flex-direction: row; gap: 4px;
    padding: 6px 6px max(6px, env(safe-area-inset-bottom));
    background: var(--bg-deep);
    border-top: 1px solid var(--border-weich);
  }
  .menue-punkt {
    flex: 1 1 0; min-width: 0; min-height: 54px;
    flex-direction: column; justify-content: center; gap: 3px;
    padding: 6px 2px;
    font-size: 12px; font-weight: 600; line-height: 1.2;
    color: var(--text-muted);
  }
  .menue-punkt svg { width: 22px; height: 22px; }
  .menue-punkt .lang { display: none; }
  .menue-punkt .kurz { display: inline; }
  .menue-trenner, .menue-punkt[data-ziel="einstellungen"] { display: none; }

  main { padding: 18px 16px calc(92px + env(safe-area-inset-bottom)); }
  .kopf { margin-bottom: 14px; }
  .kopf h1 { font-size: 26px; }
  .kopf-meta { padding-top: 0; font-size: 14px; }
  /* Datum und Uhrzeit zeigt das Handy selbst */
  .kopf-meta #jetzt, .meta-trenner { display: none; }

  .ansicht { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .ansicht > * { grid-column: 1 / -1; }
  .karte { padding: 16px; }
  .statuszeile { margin-bottom: 14px; }
  /* Kennzahlen kompakter, damit auf dem Handy mehr auf einen Blick passt */
  .kpi { padding: 14px 16px; }
  .kpi-oben { gap: 14px; }
  .kpi-symbol svg { width: 34px; height: 34px; }
  .kpi-titel { font-size: 15px; }
  .kpi-wert { font-size: 32px; }
  .kpi-detail { font-size: 14px; }
  .balken { height: 10px; margin-top: 12px; }
}

/* Tabellen werden auf dem Handy zu Zeilenkarten: Der Wert der ersten Spalte ist die
   Überschrift, darunter je Zeile "Spalte … Wert". So muss nichts seitlich scrollen. */
@media (max-width: 600px) {
  .tabelle-rahmen table, .tabelle-rahmen tbody, .tabelle-rahmen tr, .tabelle-rahmen td { display: block; }
  .tabelle-rahmen thead { display: none; }
  .tabelle-rahmen tr { padding: 10px 0; border-bottom: 1px solid var(--border-weich); }
  .tabelle-rahmen tr:last-child { border-bottom: 0; }
  .tabelle-rahmen td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
    padding: 3px 0; border: 0; text-align: right;
  }
  .tabelle-rahmen td::before { content: attr(data-titel); color: var(--text-muted); text-align: left; flex: none; }
  .tabelle-rahmen td:first-child { font-weight: 700; padding-bottom: 6px; }
  .tabelle-rahmen td:first-child::before, .tabelle-rahmen td.leer::before { content: none; }
  .tabelle-rahmen td.name { max-width: none; }
  .tabelle-rahmen td > div { text-align: right; }
}

/* --- Benutzerverwaltung (benutzer.js) --------------------------------------------- */

.werkzeugleiste { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.werkzeugleiste input[type="search"], .werkzeugleiste select {
  font: inherit; font-size: 14px; padding: 8px 12px;
  border-radius: var(--radius-control); border: 1px solid var(--border);
  background: var(--bg); color: var(--text); min-height: 40px;
}
.werkzeugleiste input[type="search"] { flex: 1 1 220px; min-width: 0; }
.werkzeugleiste input:focus-visible, .werkzeugleiste select:focus-visible { outline: none; box-shadow: var(--fokus); }
.werkzeug-anzahl { color: var(--text-subtle); font-size: 13px; font-variant-numeric: tabular-nums; margin-left: auto; }

.sortier-knopf {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  font: inherit; color: inherit; border-radius: 4px;
}
.sortier-knopf:hover { color: var(--text); }
.sortier-knopf:focus-visible { box-shadow: var(--fokus); }
.sortier-pfeil { font-size: 10px; color: var(--accent-bright); min-width: 10px; }
.benutzer-tabelle td:last-child { text-align: right; white-space: nowrap; }

.feld-paar { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chip-klein { font-size: 11px; padding: 0 7px; margin-left: auto; }
.dienst-haken:has(input:disabled) .chip-klein { opacity: 0.7; }

.protokoll-rahmen { max-height: 420px; overflow-y: auto; }
.zeile-warnung td:nth-child(2) { color: var(--warning); }

@media (max-width: 640px) {
  .feld-paar { grid-template-columns: 1fr; }
  .werkzeug-anzahl { margin-left: 0; width: 100%; }
  .benutzer-tabelle td:last-child { text-align: left; }
}

/* --- Mein Konto (konto.html) ----------------------------------------------------- */

.konto-karte { max-width: 480px; }
.konto-angaben { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 8px; font-size: 15px; }
.konto-angaben dt { color: var(--text-muted); }
.konto-angaben dd { margin: 0; overflow-wrap: anywhere; }
.konto-abschnitt { font-size: 17px; margin: 22px 0 8px; }
.konto-fuss { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.konto-fuss form { flex: 1 1 auto; }
.konto-fuss .knopf { width: 100%; text-align: center; }
.login-meldung-ok { border-color: var(--success); }
.knopf-reihe { display: flex; flex-wrap: wrap; gap: 10px; }
.knopf-reihe form { margin: 0; }

/* --- Live-Hinweise zu Passwörtern (passwortregeln.js) ---------------------------- */
/* Rot, solange eine Regel fehlt; grün, wenn alles passt. Bedeutung nie nur über
   Farbe: Darunter steht immer auch der Text mit Zeichen davor. */

.login-formular input[aria-invalid="true"], .feld input[aria-invalid="true"] { border-color: var(--danger); }
.login-formular input.feld-gueltig, .feld input.feld-gueltig { border-color: var(--success); }
.regel-liste { list-style: none; margin: 4px 0 2px; padding: 0; font-size: 13px; line-height: 1.5; }
.regel-liste:empty { display: none; }
.regel-offen { color: var(--text-muted); }
.regel-offen::before { content: "✕ "; color: var(--danger); font-weight: 700; }
.regel-ok { color: var(--success); }
.regel-ok::before { content: "✓ "; font-weight: 700; }

/* --- Marktauswahl für Kunden (benutzer.js) --------------------------------------- */

.markt-bereich[hidden] { display: none; }
.markt-bereich input[type="search"] {
  font: inherit; font-size: 14px; width: 100%; padding: 9px 12px;
  border-radius: var(--radius-control); border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.markt-bereich input[type="search"]:focus-visible { outline: none; box-shadow: var(--fokus); }
.markt-alle { margin: 0 0 6px; padding: 4px 4px 4px 12px; cursor: default; }
.markt-alle input[type="search"] { flex: 1 1 auto; min-width: 0; border: 0; padding: 8px; background: transparent; }
.markt-liste {
  list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 4px;
  max-height: 260px; overflow-y: auto; overscroll-behavior: contain;
}
.markt-haken { min-height: 40px; }
.markt-haken strong { font-variant-numeric: tabular-nums; min-width: 52px; }
.markt-haken span:not(.chip) { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }


/* --- Startseite des Kontodienstes (verwaltung.html) ------------------------------ */

main.verwaltung { margin: 0 auto; }
.kopf-marke { display: flex; align-items: center; gap: 16px; min-width: 0; }
.kopf-marke img { width: 56px; height: 56px; flex: none; }
.kopf-marke .untertitel { margin: 2px 0 0; }
.kopf-marke .marke-name { font-size: inherit; font-weight: 700; letter-spacing: 0; }
.kopf .knopf-reihe form { margin: 0; }
@media (max-width: 640px) {
  main.verwaltung { padding: 14px 12px 28px; }
  .kopf-marke img { width: 44px; height: 44px; }
  .kopf h1 { font-size: 24px; }
}
