/* Schaltwerk — Stil A: flach, technisch, wie eine Herstellerzeichnung.
   Bewusst nur ein Erscheinungsbild statt hell und dunkel: Ein Leitstand ist
   dunkel, und die Geraete im Schrank sind es ohnehin — ein heller Aufguss
   davon saehe aus wie ein Datenblatt, nicht wie eine Anlage. */

:root {
  --grund:    #14171A;
  --flaeche:  #1B1F22;
  --flaeche2: #23282C;
  --senke:    #101315;
  --linie:    #2C3238;
  --linie-2:  #3A4147;

  --text:     #DEE3E0;
  --text-2:   #98A0A2;
  --text-3:   #6B7376;

  --akzent:   #E8A020;   /* Strom liegt an */
  --gruen:    #35C25B;
  --rot:      #E2483A;
  --blau:     #3D86C6;

  --stahl:    #8E959B;
  --gehaeuse: #33383D;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --zelle-b: 88px;
  --zelle-h: 66px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

.kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 1.1rem;
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
  position: sticky;
  top: 0;
  z-index: 20;
}
.marke { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.wortmarke {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.anlagenname {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--text-3);
  letter-spacing: .08em;
}
.kopf-status { display: flex; align-items: center; gap: .8rem; }
.zykluszeit { font-family: var(--mono); font-size: .72rem; color: var(--text-3); }

.run {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .12em;
  padding: .35rem .9rem;
  border-radius: 2px;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--gruen) 45%, var(--linie));
  background: color-mix(in srgb, var(--gruen) 14%, var(--flaeche2));
  color: var(--gruen);
}
.run[aria-pressed="false"] {
  border-color: color-mix(in srgb, var(--rot) 45%, var(--linie));
  background: color-mix(in srgb, var(--rot) 14%, var(--flaeche2));
  color: var(--rot);
}

/* ---------- Aufteilung ---------- */

main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1rem;
  max-width: 1900px;
  margin: 0 auto;
}
@media (min-width: 1300px) {
  main { grid-template-columns: 2fr 1fr; }
  .anlage-karte { grid-column: 1 / -1; }
}

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 3px;
  padding: .9rem 1rem 1rem;
  min-width: 0;
}
.karte > h2 {
  margin: 0 0 .8rem;
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex; align-items: center; gap: .55rem;
}
.karte > h2::before {
  content: "";
  width: 1.1rem; height: 2px;
  background: var(--akzent);
}

/* ---------- Anlage ---------- */

.anlage-rahmen {
  background: var(--senke);
  border: 1px solid var(--linie);
  border-radius: 2px;
  overflow-x: auto;
  padding: .4rem;
}
#anlage { display: block; min-width: 900px; width: 100%; height: auto; }

.kennz {
  font-family: var(--mono);
  font-size: 12px;
  fill: #99A0A2;
  text-anchor: middle;
}
.kennz.links  { text-anchor: start; }
.kennz.rechts { text-anchor: end; }
.kennz.klein  { font-size: 10.5px; }
.kennz.kleiner{ font-size: 9.5px; fill: #6B7376; }
.rutsche {
  font-family: var(--mono);
  font-size: 22px;
  fill: #6B7376;
  text-anchor: middle;
}
.zaehler {
  font-family: var(--mono);
  font-size: 17px;
  fill: #DEE3E0;
  text-anchor: middle;
  font-variant-numeric: tabular-nums;
}
.notaus-text {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: .12em;
  fill: #E2483A;
  text-anchor: middle;
}
#notaus-band[hidden] { display: none !important; }

.melder { transition: fill .08s linear; }
#stange { transition: transform .05s linear; }

/* ---------- Bedienpult ---------- */

.pult {
  margin-top: .9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  align-items: center;
  padding: .85rem 1rem;
  background: var(--flaeche2);
  border: 1px solid var(--linie);
  border-radius: 2px;
}
.pult-gruppe { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.pult-gruppe.rechts { margin-left: auto; }

.taster {
  position: relative;
  width: 74px; height: 74px;
  border-radius: 50%;
  border: 3px solid #14171A;
  background: #4A5057;
  color: #14171A;
  font-family: var(--mono);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.35), 0 2px 0 #0C0E10;
  transition: transform .05s ease, box-shadow .05s ease;
}
.taster span { font-size: .58rem; font-weight: 600; letter-spacing: .04em; opacity: .8; }
.taster:active,
.taster.gedrueckt {
  transform: translateY(2px);
  box-shadow: inset 0 3px 6px rgba(0,0,0,.5);
}
.taster:focus-visible { outline: 2px solid var(--akzent); outline-offset: 3px; }
.taster.gruen { background: #3FA35A; }
.taster.rot   { background: #C0483C; color: #F2E6E4; }
.taster.pilz {
  width: 84px; height: 84px;
  background: #C0392B;
  color: #F6E9E7;
  font-size: .62rem;
  border: 4px solid #3B1512;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.4), 0 3px 0 #0C0E10;
}
.taster.pilz[aria-pressed="true"] {
  background: #7E241B;
  transform: translateY(3px);
  box-shadow: inset 0 4px 8px rgba(0,0,0,.6);
}

.schalter, .auswahl {
  display: flex; align-items: center; gap: .45rem;
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--text-2);
}
.auswahl { flex-direction: column; align-items: flex-start; gap: .25rem; }
.auswahl > span { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.schalter input { accent-color: var(--akzent); width: 16px; height: 16px; }

select, input[type="number"] {
  font-family: var(--mono);
  font-size: .78rem;
  padding: .35rem .5rem;
  background: var(--senke);
  color: var(--text);
  border: 1px solid var(--linie-2);
  border-radius: 2px;
  min-width: 150px;
}
select:focus-visible, input:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }

.klein-taster {
  font-family: var(--mono);
  font-size: .74rem;
  padding: .45rem .75rem;
  background: var(--flaeche);
  color: var(--text);
  border: 1px solid var(--linie-2);
  border-radius: 2px;
  cursor: pointer;
}
.klein-taster:hover { border-color: var(--text-3); }
.klein-taster:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.klein-taster.leise { color: var(--text-2); }

/* ---------- Kontaktplan ---------- */

.werkzeug {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  padding-bottom: .8rem;
  margin-bottom: .8rem;
  border-bottom: 1px solid var(--linie);
}
.werkzeug-gruppe { display: flex; flex-wrap: wrap; gap: .3rem; }
.wz {
  font-family: var(--mono);
  font-size: .78rem;
  min-width: 46px;
  padding: .4rem .5rem;
  background: var(--flaeche2);
  color: var(--text-2);
  border: 1px solid var(--linie-2);
  border-radius: 2px;
  cursor: pointer;
}
.wz:hover { color: var(--text); }
.wz.gewaehlt {
  background: color-mix(in srgb, var(--akzent) 18%, var(--flaeche2));
  border-color: var(--akzent);
  color: var(--akzent);
}
.wz:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.wz.loeschen { color: var(--text-3); }
#zeit-feld[hidden] { display: none !important; }

.pfade { display: flex; flex-direction: column; gap: .7rem; }

.pfad {
  background: var(--senke);
  border: 1px solid var(--linie);
  border-radius: 2px;
  overflow-x: auto;
}
.pfad-kopf {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem;
  padding: .35rem .6rem;
  border-bottom: 1px solid var(--linie);
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--text-3);
  letter-spacing: .1em;
}
.pfad-kopf button {
  background: none; border: none; color: var(--text-3);
  font-family: var(--mono); font-size: .8rem; cursor: pointer; padding: 0 .3rem;
}
.pfad-kopf button:hover { color: var(--rot); }
.pfad svg { display: block; }

.zelle-feld { fill: transparent; cursor: pointer; }
.zelle-feld:hover { fill: rgba(232,160,32,.07); }
.zelle-gewaehlt { fill: none; stroke: var(--akzent); stroke-width: 1.5; stroke-dasharray: 4 3; }
.link-feld { fill: transparent; cursor: pointer; }
.link-feld:hover { fill: rgba(232,160,32,.18); }

.draht { stroke: #5A6167; stroke-width: 2; fill: none; }
.draht.strom { stroke: var(--akzent); }
.sym { stroke: #A7AEB2; stroke-width: 2.2; fill: none; stroke-linecap: round; }
.sym.strom { stroke: var(--akzent); }
.sym-text {
  font-family: var(--mono); font-size: 11px; fill: #A7AEB2; text-anchor: middle;
}
.sym-text.strom { fill: var(--akzent); }
.adr-text { font-family: var(--mono); font-size: 11px; fill: #C6CCCE; text-anchor: middle; }
.name-text { font-family: var(--mono); font-size: 9px; fill: #6B7376; text-anchor: middle; }
.schiene { stroke: #6E757B; stroke-width: 2.5; }

.kop-fuss { margin-top: .8rem; display: flex; flex-direction: column; gap: .7rem; }
.kop-knoepfe { display: flex; flex-wrap: wrap; gap: .4rem; }

.meldungen { display: flex; flex-direction: column; gap: .3rem; }
.meldung {
  font-family: var(--mono);
  font-size: .74rem;
  padding: .45rem .6rem;
  border-left: 3px solid var(--rot);
  background: color-mix(in srgb, var(--rot) 10%, var(--flaeche2));
  color: #F0C6C1;
}
.meldung.gut {
  border-left-color: var(--gruen);
  background: color-mix(in srgb, var(--gruen) 9%, var(--flaeche2));
  color: #BFE6CA;
}

/* ---------- Signale ---------- */

.signal-spalten { display: flex; flex-direction: column; gap: 1rem; }
.signal-karte h3 {
  margin: 0 0 .4rem;
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 500;
}
table.signale { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: .74rem; }
table.signale td {
  padding: .22rem .4rem;
  border-bottom: 1px solid var(--linie);
  white-space: nowrap;
}
table.signale td.adr { color: var(--text); width: 3.4rem; }
table.signale td.bmk { color: var(--text-2); width: 3rem; }
table.signale td.txt { color: var(--text-3); white-space: normal; }
table.signale td.pkt { width: 1.4rem; }
.punkt {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #33383D;
  border: 1px solid #101315;
}
.punkt.an { background: var(--gruen); box-shadow: 0 0 6px color-mix(in srgb, var(--gruen) 70%, transparent); }

/* ---------- Ladehinweis ---------- */

.ladehinweis {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--grund);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: .85rem;
  letter-spacing: .1em;
  z-index: 50;
}
.ladehinweis[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .melder, #stange, .taster { transition: none; }
}

/* ---------- Funktionsplan ---------- */

.ansichtswahl {
  display: flex;
  align-items: center;
  gap: .3rem;
  margin-bottom: .8rem;
}
.ans {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .1em;
  padding: .4rem .9rem;
  background: var(--flaeche2);
  color: var(--text-3);
  border: 1px solid var(--linie-2);
  border-radius: 2px;
  cursor: pointer;
}
.ans:hover { color: var(--text); }
.ans.gewaehlt {
  background: color-mix(in srgb, var(--akzent) 18%, var(--flaeche2));
  border-color: var(--akzent);
  color: var(--akzent);
}
.ans:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.ansicht-hinweis { font-family: var(--mono); font-size: .68rem; color: var(--text-3); margin-left: .5rem; }
#werkzeug-fup[hidden], #werkzeug-kop[hidden] { display: none !important; }

.f-draht { stroke: #5A6167; stroke-width: 2; fill: none; }
.f-draht.strom { stroke: var(--akzent); }

.f-kasten, .f-zeit, .f-flanke, .f-zuweisung {
  fill: var(--flaeche2);
  stroke: #A7AEB2;
  stroke-width: 1.6;
}
.f-kasten.strom, .f-zeit.strom, .f-zuweisung.strom {
  stroke: var(--akzent);
  fill: color-mix(in srgb, var(--akzent) 12%, var(--flaeche2));
}
.f-kasten-text {
  font-family: var(--mono); font-size: 13px; fill: #C6CCCE; text-anchor: middle;
}
.f-negiert { fill: var(--senke); stroke: #A7AEB2; stroke-width: 1.6; }

.f-adr   { font-family: var(--mono); font-size: 11.5px; fill: #C6CCCE; text-anchor: start; }
.f-name  { font-family: var(--mono); font-size: 9px;  fill: #6B7376; text-anchor: start; }
.f-klein { font-family: var(--mono); font-size: 8.5px; fill: #6B7376; text-anchor: middle; }
.f-leer  { font-family: var(--mono); font-size: 10px; fill: #565D60; text-anchor: middle; }

.f-feld { fill: transparent; cursor: pointer; }
.f-feld:hover { fill: rgba(232,160,32,.08); }
.f-feld.gewaehlt {
  fill: rgba(232,160,32,.14);
  stroke: var(--akzent);
  stroke-width: 1.4;
  stroke-dasharray: 4 3;
}

.meldung.nicht-fup {
  margin: .6rem;
  border-left-color: var(--akzent);
  background: color-mix(in srgb, var(--akzent) 9%, var(--flaeche2));
  color: #EBD3A6;
}
.f-name.mitte { text-anchor: middle; }
.f-adr.mitte { text-anchor: middle; }

/* ---------- mehrere Anlagen ---------- */
.kopf-auswahl { flex-direction: row; align-items: center; gap: .5rem; }
.kopf-auswahl select { min-width: 190px; }
.anlage-bild[hidden] { display: none !important; }
#aufzug { display: block; min-width: 720px; width: 100%; height: auto; }
#lichtgitter[hidden], #aufzug-notaus[hidden] { display: none !important; }
.meldung.leer {
  border-left-color: var(--text-3);
  background: var(--flaeche2);
  color: var(--text-2);
}
