/**
 * admin.lukaswojcik.com
 *
 * Dunkel und nur dunkel. Das ist kein Geschmack, sondern eine Entscheidung:
 * dieser Bereich ist ein Betriebsbild, das lange offen steht und aus der
 * Entfernung gelesen wird. Eine zweite Fassung in Hell wäre eine zweite
 * Fassung, die von Hand gleich gehalten werden müsste - und sie hätte hier
 * keinen Leser.
 *
 * Farben stehen als Marken oben und werden nirgends sonst ausgeschrieben.
 */

:root {
  --grund:      #0e1116;
  --flaeche:    #161b22;
  --flaeche-2:  #1c232d;
  --linie:      #2a313c;
  --linie-hell: #3a424f;
  --schrift:    #d6dbe3;
  --blass:      #8b94a3;
  --sehr-blass: #5d6675;

  --gut:      #2fb886;
  --schlecht: #ef5d5d;
  --laeuft:   #4d8dff;
  --ersatz:   #b0883c;
  --warn:     #e0a53a;

  --mass: 1200px;
  --schmal: 0.8125rem;
}

* { box-sizing: border-box; }

/* --------------------------------------------------------------------------
 * [hidden] MUSS GEWINNEN
 * --------------------------------------------------------------------------
 * Der Browser bringt [hidden]{display:none} mit, aber das ist eine Regel des
 * Browsers - jede eigene display-Regel mit Klassenselektor schlaegt sie,
 * einfach weil sie spaeter kommt. .zeile{display:flex} hat deshalb alle
 * ausgeblendeten Zeilen sichtbar gelassen, obwohl das hidden-Merkmal korrekt
 * gesetzt war. Der Filter hat gearbeitet, man hat es nur nicht gesehen.
 *
 * Das ist beim Pruefen durchgerutscht, weil ich el.hidden ABGEFRAGT und nicht
 * HINGESEHEN habe: die Zaehlung "4 von 120" war richtig, das Bild nicht.
 * Wer etwas ein- und ausblendet, muss es im Bild pruefen.
 */
[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--schrift);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.mono { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace; }
.blass { color: var(--blass); }
.klein { font-size: var(--schmal); }
.zahl { text-align: right; font-variant-numeric: tabular-nums; }
.warn { color: var(--warn); }
.schlecht-text { color: var(--schlecht); }

a { color: var(--laeuft); }

.sprung {
  position: absolute; left: -9999px;
}
.sprung:focus {
  left: 8px; top: 8px; z-index: 50; padding: 8px 12px;
  background: var(--flaeche); border: 1px solid var(--linie-hell); border-radius: 6px;
}

/* ------------------------------------------------------------------ Kopf */

.kopf {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px 20px;
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
  position: sticky; top: 0; z-index: 20;
}

.marke {
  display: flex; align-items: center; gap: 10px;
  color: var(--schrift); text-decoration: none; font-weight: 600; letter-spacing: -0.01em;
}
.marke-blass { color: var(--sehr-blass); font-weight: 400; }
.marke-punkt {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--gut); box-shadow: 0 0 0 3px rgba(47, 184, 134, 0.18);
}

.kopf-rechts { display: flex; align-items: center; gap: 14px; }
.wer { color: var(--blass); font-size: var(--schmal); }
.abmeldung { margin: 0; }
.abmeldung button, .tor-form button, .schalter {
  font: inherit; color: var(--schrift);
  background: var(--flaeche-2); border: 1px solid var(--linie-hell);
  border-radius: 6px; padding: 5px 11px; cursor: pointer;
}
.abmeldung button:hover, .schalter:hover { border-color: var(--blass); }

/* --------------------------------------------------------------- Rahmen */

.rahmen { display: flex; align-items: flex-start; }

.seitlich {
  flex: 0 0 190px; padding: 18px 12px;
  border-right: 1px solid var(--linie);
  position: sticky; top: 49px; height: calc(100vh - 49px);
}

.nav-gruppe {
  margin: 18px 0 6px; padding: 0 10px;
  font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--sehr-blass);
}
.nav-punkt {
  display: block; padding: 7px 10px; border-radius: 6px;
  color: var(--blass); text-decoration: none;
}
.nav-punkt:hover { background: var(--flaeche); color: var(--schrift); }
.nav-punkt.aktiv { background: var(--flaeche-2); color: var(--schrift); font-weight: 600; }

.inhalt { flex: 1 1 auto; min-width: 0; padding: 22px 24px 40px; max-width: var(--mass); }

h1 { font-size: 1.375rem; margin: 0 0 4px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 0.9375rem; margin: 28px 0 10px; font-weight: 600; }
h3 { font-size: var(--schmal); margin: 16px 0 5px; color: var(--blass); font-weight: 600; }
.unterzeile { color: var(--blass); margin: 0 0 8px; }

/* --------------------------------------------------------------- Marken */

.plakette {
  display: inline-block; min-width: 2.4em; text-align: center;
  padding: 1px 6px; border-radius: 4px;
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.02em;
  color: var(--f); background: color-mix(in srgb, var(--f) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--f) 35%, transparent);
}
.plakette.klein { min-width: 2.2em; font-size: 0.625rem; }

.pille {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 0.6875rem; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.pille.gut      { color: var(--gut);      background: rgba(47, 184, 134, 0.12);  border-color: rgba(47, 184, 134, 0.3); }
.pille.schlecht { color: var(--schlecht); background: rgba(239, 93, 93, 0.12);   border-color: rgba(239, 93, 93, 0.3); }
.pille.laeuft   { color: var(--laeuft);   background: rgba(77, 141, 255, 0.12);  border-color: rgba(77, 141, 255, 0.3); }
.pille.ersatz   { color: var(--ersatz);   background: rgba(176, 136, 60, 0.14);  border-color: rgba(176, 136, 60, 0.32); }
.pille.warn     { color: var(--warn);     background: rgba(224, 165, 58, 0.12);  border-color: rgba(224, 165, 58, 0.3); }
.pille.aus,
.pille.unklar   { color: var(--blass);    background: rgba(139, 148, 163, 0.12); border-color: rgba(139, 148, 163, 0.28); }

/* --------------------------------------------------------------- Tafeln */

.tafel { width: 100%; border-collapse: collapse; font-size: var(--schmal); }
.tafel th {
  text-align: left; padding: 7px 10px; color: var(--sehr-blass); font-weight: 600;
  border-bottom: 1px solid var(--linie); white-space: nowrap;
}
.tafel td { padding: 7px 10px; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tafel tr:hover td { background: var(--flaeche); }
.tafel tr.fehlt td { opacity: 0.75; }
.tafel .pille + .pille { margin-left: 4px; }

/* ------------------------------------------------------------- AI-Seite */

.ai-kopf { display: flex; align-items: baseline; gap: 14px; }
.ai-lage { display: flex; align-items: center; gap: 10px; }

.leiste {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin: 14px 0 16px;
}
.kachel {
  flex: 1 1 110px; min-width: 100px;
  background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.kachel.breit { flex: 1 1 150px; }
.kachel-zahl { font-size: 1.375rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.kachel-name { font-size: 0.6875rem; color: var(--sehr-blass); text-transform: uppercase; letter-spacing: 0.06em; }

.filter {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 10px; margin-bottom: 12px;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px;
}
.filter-gruppe { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-gruppe.wachsend { flex: 1 1 200px; }

/* AN und AUS muessen auf einen Blick zu unterscheiden sein.
 * Ein blosser Deckkraftunterschied reicht dafuer nicht - auf einem dunklen
 * Grund sehen 45 % und 100 % aehnlicher aus, als man beim Bauen denkt.
 * Deshalb wechselt zusaetzlich die Farbe: an traegt die Systemfarbe, aus ist
 * grau und durchgestrichen. */
.schalter {
  font-size: var(--schmal); padding: 4px 9px;
  color: var(--sehr-blass); background: transparent;
  border-color: var(--linie); text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.schalter.an { color: var(--schrift); background: var(--flaeche-2);
               border-color: var(--linie-hell); text-decoration: none; }
.schalter[data-system].an {
  color: var(--f); background: color-mix(in srgb, var(--f) 14%, transparent);
  border-color: color-mix(in srgb, var(--f) 45%, transparent);
}
.schalter.an .schalter-name { color: var(--blass); }
.schalter:not(.an) .schalter-name { color: var(--sehr-blass); }
/* Anhalten und Leeren sind keine Filter - sie duerfen nicht aussehen wie ein
 * ausgeschalteter. */
#halten, #leeren { color: var(--schrift); background: var(--flaeche-2);
                   border-color: var(--linie-hell); text-decoration: none; }
#halten.an { color: var(--warn); border-color: var(--warn); }
.schalter-name { display: none; }
@media (min-width: 900px) { .schalter-name { display: inline; color: var(--blass); margin-left: 5px; } }

#suche {
  width: 100%; font: inherit; font-size: var(--schmal);
  color: var(--schrift); background: var(--grund);
  border: 1px solid var(--linie-hell); border-radius: 6px; padding: 5px 10px;
}
#suche:focus { outline: 2px solid var(--laeuft); outline-offset: -1px; }

/* ---------------------------------------------------------------- Spuren */

.zwei-spuren { display: flex; gap: 14px; align-items: stretch; }
.spur { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.spur.schmal { flex: 0 0 34%; }
@media (max-width: 1100px) {
  .zwei-spuren { flex-direction: column; }
  .spur.schmal { flex: 1 1 auto; }
}

.spur-kopf {
  margin: 0 0 6px; font-size: var(--schmal); font-weight: 600;
  display: flex; gap: 8px; align-items: baseline;
}

.strom {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px;
  height: 62vh; min-height: 320px; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
}

.spur-hinweise {
  border: 1px solid rgba(224, 165, 58, 0.3); background: rgba(224, 165, 58, 0.07);
  border-radius: 8px; padding: 8px 11px; margin-bottom: 8px;
  font-size: 0.75rem; color: var(--blass);
}
.spur-hinweise p { margin: 0 0 6px; }
.spur-hinweise p:last-child { margin-bottom: 0; }
.spur-hinweise strong { color: var(--schrift); }

.strom-huelle { position: relative; }
.leer-hinweis {
  position: absolute; inset: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 0 28px;
  color: var(--sehr-blass); font-size: var(--schmal);
  pointer-events: none;   /* die Liste darunter bleibt scrollbar */
}

/* --------------------------------------------------------------- Zeilen */

.zeile {
  display: flex; align-items: baseline; gap: 8px;
  padding: 4px 10px; border-bottom: 1px solid rgba(42, 49, 60, 0.55);
  font-size: var(--schmal); white-space: nowrap;
}
.zeile:hover { background: var(--flaeche-2); }
.zeile.klickbar { cursor: pointer; }
.zeile.klickbar:focus-visible { outline: 2px solid var(--laeuft); outline-offset: -2px; }
.zeile.schlecht { background: rgba(239, 93, 93, 0.05); }

.z-zeit    { color: var(--sehr-blass); flex: 0 0 auto; }
.z-fort    { color: var(--sehr-blass); flex: 0 0 auto; }
.z-system  { flex: 0 0 auto; }
.z-strang  { color: var(--blass); flex: 0 0 auto; }
.z-zustand { flex: 0 0 auto; }
.z-mitte   { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 8px; }
.z-art     { color: var(--blass); }
.z-mandant { color: var(--sehr-blass); }
.z-sprache { color: var(--sehr-blass); text-transform: uppercase; font-size: 0.6875rem; }
.z-modell  { color: var(--schrift); }
.z-knoten  { color: var(--sehr-blass); }
.z-zusatz  { color: var(--blass); font-size: 0.6875rem; border: 1px solid var(--linie-hell); border-radius: 3px; padding: 0 4px; }
.z-versuche{ color: var(--warn); flex: 0 0 auto; font-size: 0.6875rem; }
.z-dauer   { color: var(--blass); flex: 0 0 auto; min-width: 4.5em; text-align: right; }
.z-fehler  { color: var(--schlecht); flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
.z-fehler.harmlos { color: var(--ersatz); }

.p-zeile {
  display: flex; gap: 7px; align-items: baseline;
  padding: 2px 9px; font-size: 0.75rem; line-height: 1.45;
}
.p-zeile:hover { background: var(--flaeche-2); }
.p-name { color: var(--sehr-blass); flex: 0 0 auto; }
.p-text { color: var(--blass); white-space: pre-wrap; word-break: break-word; min-width: 0; }

/* -------------------------------------------------------------- Detail */

.detail {
  border: 1px solid var(--linie-hell); border-radius: 10px;
  background: var(--flaeche); color: var(--schrift);
  width: min(860px, 92vw); max-height: 86vh; padding: 0;
}
.detail::backdrop { background: rgba(0, 0, 0, 0.6); }
.detail-kopf {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--linie);
  position: sticky; top: 0; background: var(--flaeche);
}
.detail-kopf button {
  font: inherit; font-size: 1.25rem; line-height: 1; cursor: pointer;
  background: none; border: none; color: var(--blass); padding: 0 4px;
}
.detail-inhalt { padding: 14px 16px 20px; overflow-y: auto; max-height: calc(86vh - 52px); }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 8px; font-size: var(--schmal); }
.detail-name { color: var(--sehr-blass); margin-right: 6px; }
.detail-text {
  background: var(--grund); border: 1px solid var(--linie); border-radius: 6px;
  padding: 9px 11px; margin: 0; font-size: 0.75rem; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; max-height: 40vh; overflow: auto;
  font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

/* ------------------------------------------------------------ Anmeldung */

body.nur-tor { display: grid; place-items: center; min-height: 100vh; }
.tor {
  width: min(360px, 90vw); padding: 26px;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px;
}
.tor-marke { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 20px; }
.tor-form { display: flex; flex-direction: column; gap: 5px; }
.tor-form label { font-size: 0.75rem; color: var(--blass); margin-top: 8px; }
.tor-form input {
  font: inherit; color: var(--schrift); background: var(--grund);
  border: 1px solid var(--linie-hell); border-radius: 6px; padding: 8px 10px;
}
.tor-form input:focus { outline: 2px solid var(--laeuft); outline-offset: -1px; }
.tor-form button { margin-top: 18px; padding: 9px; font-weight: 600; }
.tor-fehler {
  margin: 0 0 14px; padding: 9px 11px; font-size: var(--schmal);
  color: var(--schlecht); background: rgba(239, 93, 93, 0.1);
  border: 1px solid rgba(239, 93, 93, 0.3); border-radius: 6px;
}

/* ------------------------------------------------------------- Schmales */

@media (max-width: 760px) {
  .rahmen { flex-direction: column; }
  .seitlich {
    flex: 1 1 auto; width: 100%; height: auto; position: static;
    border-right: none; border-bottom: 1px solid var(--linie);
    display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 8px 12px;
  }
  .nav-gruppe { margin: 0; padding: 0; }
  .inhalt { padding: 16px 12px 32px; }
  .strom { height: 50vh; }
  .zeile { flex-wrap: wrap; white-space: normal; }
}
