/* ---------------------------------------------------------------------------
   Verkehrszeichenplan -- einziges Stilblatt. Farben ausschliesslich hier.
   --------------------------------------------------------------------------- */

:root {
  --grund:      #151a21;
  --grund2:     #1c232c;
  --grund3:     #252e3a;
  --rand:       #333f4e;
  --schrift:    #e6ecf3;
  --schrift2:   #9aa8b8;
  --marke:      #ffb020;
  --marke2:     #ff8a1f;
  --gut:        #3ec46d;
  --warn:       #ffb020;
  --fehler:     #ff5c4d;
  --blau:       #4aa8ff;
  --knopf:      #2c3848;
  --knopf-an:   var(--marke);
  --rund:       6px;
  --schatten:   0 2px 8px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

a { color: var(--blau); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 20px; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 15px; margin: 0 0 8px; font-weight: 600; }
h3 { font-size: 13px; margin: 14px 0 6px; color: var(--schrift2);
     text-transform: uppercase; letter-spacing: .04em; }

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

.kopf {
  display: flex; align-items: center; gap: 18px;
  padding: 0 16px; height: 48px;
  background: var(--grund2); border-bottom: 1px solid var(--rand);
}
.marke { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--schrift); }
.marke:hover { text-decoration: none; }
.kopf nav { display: flex; gap: 4px; }
.kopf nav a {
  padding: 6px 12px; border-radius: var(--rund); color: var(--schrift2);
}
.kopf nav a:hover { background: var(--grund3); color: var(--schrift); text-decoration: none; }
.kopf nav a.an { background: var(--grund3); color: var(--marke); }
.kopf .rechts { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.kopf .wer { color: var(--schrift2); }
.kopf .wer small {
  background: var(--grund3); padding: 1px 6px; border-radius: 10px;
  margin-left: 4px; font-size: 11px;
}
.kopf .warnung {
  background: rgba(255,176,32,.15); color: var(--warn);
  border: 1px solid rgba(255,176,32,.4);
  padding: 3px 10px; border-radius: 12px; font-size: 12px;
}

main { padding: 18px; }
.fuss {
  padding: 14px 18px; color: var(--schrift2); font-size: 12px;
  border-top: 1px solid var(--rand);
}

/* --------------------------------------------------------- Formularelemente */

input[type=text], input[type=search], input[type=password], input[type=datetime-local],
input[type=number], select, textarea {
  background: var(--grund); color: var(--schrift);
  border: 1px solid var(--rand); border-radius: var(--rund);
  padding: 7px 9px; font: inherit; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--marke); outline-offset: -1px; }
input[readonly] { opacity: .7; }

button, .knopf {
  background: var(--knopf); color: var(--schrift);
  border: 1px solid var(--rand); border-radius: var(--rund);
  padding: 7px 13px; font: inherit; cursor: pointer;
  display: inline-block;
}
button:hover, .knopf:hover { background: var(--grund3); text-decoration: none; }
button.an { background: var(--knopf-an); color: #201600; border-color: var(--marke2); font-weight: 600; }
button.haupt { background: var(--marke); color: #201600; border-color: var(--marke2); font-weight: 600; }
button.weg { background: rgba(255,92,77,.15); color: var(--fehler); border-color: rgba(255,92,77,.4); }
button.klein, .knopf.klein { padding: 3px 9px; font-size: 12px; }
button:disabled { opacity: .45; cursor: default; }

label { display: block; color: var(--schrift2); font-size: 12px; }
label input, label select { display: block; width: 100%; margin-top: 3px; color: var(--schrift); font-size: 14px; }
label.kasten { display: flex; align-items: center; gap: 6px; font-size: 13px; }
label.kasten input { width: auto; margin: 0; display: inline; }

.meldung { padding: 10px 14px; border-radius: var(--rund); margin: 0 0 14px; }
.meldung.fehler { background: rgba(255,92,77,.12); border: 1px solid rgba(255,92,77,.4); color: #ffb9b2; }
.meldung.gut { background: rgba(62,196,109,.12); border: 1px solid rgba(62,196,109,.4); color: #b6f0cb; }
.meldung.warn { background: rgba(255,176,32,.12); border: 1px solid rgba(255,176,32,.4); color: #ffe0a8; }

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

.anmeldekasten {
  max-width: 360px; margin: 8vh auto; background: var(--grund2);
  border: 1px solid var(--rand); border-radius: 10px; padding: 28px;
  box-shadow: var(--schatten);
}
.anmeldekasten .unter { color: var(--schrift2); margin: 0 0 20px; }
.anmeldekasten label { margin-bottom: 14px; }
.anmeldekasten button { width: 100%; }

/* ---------------------------------------------------------------- Liste */

.zeile { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.zeile h1 { margin: 0; }
.suchform { margin-left: auto; display: flex; gap: 8px; align-items: center; }

details.neu {
  background: var(--grund2); border: 1px solid var(--rand);
  border-radius: var(--rund); padding: 10px 14px; margin-bottom: 16px;
}
details.neu summary { cursor: pointer; color: var(--marke); }
details.neu .reihe { display: flex; gap: 12px; align-items: flex-end; margin-top: 12px; flex-wrap: wrap; }
details.neu .reihe label { flex: 1 1 160px; }

table.liste { width: 100%; border-collapse: collapse; }
table.liste th {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rand);
  color: var(--schrift2); font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
}
table.liste td { padding: 9px 10px; border-bottom: 1px solid rgba(51,63,78,.5); vertical-align: top; }
table.liste tr:hover td { background: var(--grund2); }
table.liste .nr { font-family: ui-monospace, Consolas, monospace; color: var(--schrift2); }
table.liste .r, td.r, th.r { text-align: right; }
table.liste small { color: var(--schrift2); }

.stand { padding: 2px 9px; border-radius: 11px; font-size: 12px; white-space: nowrap; }
.s-entwurf     { background: var(--grund3); color: var(--schrift2); }
.s-freigegeben { background: rgba(74,168,255,.15); color: var(--blau); }
.s-aktiv       { background: rgba(62,196,109,.15); color: var(--gut); }
.s-beendet     { background: rgba(154,168,184,.1); color: var(--schrift2); }

.leer { color: var(--schrift2); padding: 30px 0; text-align: center; }

/* ---------------------------------------------------------------- Editor */

body[data-seite="plan"] main,
body[data-seite="ansicht"] main { padding: 0; }
body[data-seite="plan"] .fuss,
body[data-seite="ansicht"] .fuss { display: none; }

.editor { display: flex; flex-direction: column; height: calc(100vh - 48px); }

.planleiste {
  display: flex; align-items: center; gap: 16px; padding: 8px 14px;
  background: var(--grund2); border-bottom: 1px solid var(--rand); flex-wrap: wrap;
}
.planleiste .links { display: flex; align-items: center; gap: 10px; }
.planleiste .plannr {
  font-family: ui-monospace, Consolas, monospace; color: var(--marke);
  background: var(--grund3); padding: 4px 9px; border-radius: var(--rund); white-space: nowrap;
}
.planleiste #f-titel { width: 260px; font-weight: 600; }
.planleiste .felder { display: flex; gap: 10px; flex-wrap: wrap; }
.planleiste .felder label { font-size: 11px; }
.planleiste .felder input, .planleiste .felder select { padding: 5px 7px; font-size: 13px; }
.planleiste .felder #f-ort { width: 150px; }
.planleiste .knoepfe { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.merker { font-size: 12px; color: var(--schrift2); min-width: 120px; text-align: right; }
.merker.gut { color: var(--gut); }
.merker.offen { color: var(--warn); }
.merker.fehler { color: var(--fehler); }

.buehne { display: flex; flex: 1; min-height: 0; }

/* Werkzeugspalte */
.werkzeugspalte {
  width: 228px; flex: 0 0 228px; display: flex; flex-direction: column;
  background: var(--grund2); border-right: 1px solid var(--rand); min-height: 0;
}
.werkzeuge { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; }
.werkzeuge button { padding: 8px 4px; font-size: 13px; }
.werkzeuge button:first-child { grid-column: span 2; }

.suchfeld { padding: 0 10px 8px; }
.suchfeld input { width: 100%; }

.katfilter { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 10px 10px; }
.katfilter button { padding: 3px 8px; font-size: 11px; }

.zeichenliste {
  flex: 1; overflow-y: auto; padding: 8px 10px 14px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px;
  align-content: start; border-top: 1px solid var(--rand);
}
.zeichenliste .zk {
  padding: 5px 2px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--grund3); border-color: transparent;
}
.zeichenliste .zk img { width: 34px; height: 34px; object-fit: contain; }
.zeichenliste .zk span { font-size: 9px; color: var(--schrift2); font-family: ui-monospace, monospace; }
.zeichenliste .zk:hover { border-color: var(--marke); }
.zeichenliste .zk.an { background: var(--marke); }
.zeichenliste .zk.an span { color: #201600; }
.zeichenliste.nichts::after {
  content: "Kein Zeichen passt zur Suche."; grid-column: 1 / -1;
  color: var(--schrift2); font-size: 12px; padding: 14px 0; text-align: center;
}

/* Kartenspalte */
.kartenspalte { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.kartenleiste {
  display: flex; align-items: center; gap: 12px; padding: 7px 12px;
  background: var(--grund2); border-bottom: 1px solid var(--rand); position: relative;
}
.kartenleiste #ortssuche { width: 220px; }
.kartenleiste .abstand { flex: 1; }
.kartenleiste .hinweis { color: var(--marke); font-size: 12px; }

.treffer {
  position: absolute; top: 100%; left: 12px; z-index: 1200; margin: 2px 0 0; padding: 4px;
  list-style: none; background: var(--grund3); border: 1px solid var(--rand);
  border-radius: var(--rund); box-shadow: var(--schatten); width: 260px; max-height: 320px; overflow-y: auto;
}
.treffer li { padding: 6px 9px; border-radius: 4px; cursor: pointer; }
.treffer li:hover { background: var(--marke); color: #201600; }
.treffer li small { color: var(--schrift2); }
.treffer li:hover small { color: #5a4000; }

#karte { flex: 1; min-height: 0; background: #0d1117; cursor: grab; }
body.zeichnet #karte { cursor: crosshair; }

.fussleiste {
  display: flex; gap: 20px; padding: 5px 12px; background: var(--grund2);
  border-top: 1px solid var(--rand); color: var(--schrift2); font-size: 12px;
  font-family: ui-monospace, Consolas, monospace;
}

/* Eigenschaften */
.eigenschaften {
  width: 250px; flex: 0 0 250px; padding: 14px; overflow-y: auto;
  background: var(--grund2); border-left: 1px solid var(--rand);
}
.eigenschaften .leer { font-size: 13px; }
.eigenschaften .zname { color: var(--marke); margin: -4px 0 10px; font-size: 13px; }
.eigenschaften .mass {
  color: var(--schrift2); font-size: 12px; font-family: ui-monospace, monospace;
  background: var(--grund); padding: 6px 9px; border-radius: var(--rund); margin: 0 0 12px;
}
.eigenschaften label { margin-bottom: 12px; position: relative; }
.eigenschaften .wert { position: absolute; right: 0; top: 0; color: var(--schrift); }
.eigenschaften input[type=range] { width: 100%; margin-top: 6px; accent-color: var(--marke); }
.eigenschaften input[type=color] { width: 100%; height: 32px; padding: 2px; }
.eknoepfe { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }

/* -------------------------------------------------- Elemente auf der Karte */

.vz-zeichen { background: none; border: none; }
.vz-zeichen .dreh { transform-origin: 50% 50%; line-height: 0; }
.vz-zeichen img { filter: drop-shadow(0 1px 3px rgba(0,0,0,.8)); display: block; }
.vz-zeichen.gewaehlt .dreh { outline: 2px solid var(--marke); outline-offset: 2px; border-radius: 3px; }
.vz-zeichen .fehlt {
  display: inline-block; background: var(--fehler); color: #fff; font-size: 10px;
  padding: 2px 4px; border-radius: 3px;
}
.vz-zeichen .zbeschriftung {
  position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  white-space: nowrap; font-size: 11px; background: rgba(0,0,0,.7);
  padding: 1px 5px; border-radius: 3px; margin-top: 3px; font-weight: 600;
}

.vz-text { background: none; border: none; white-space: nowrap; }
.vz-text span {
  display: inline-block; font-weight: 600; font-size: 13px;
  text-shadow: 0 0 4px #000, 0 0 2px #000; transform-origin: 50% 50%;
}
.vz-text.gewaehlt span { outline: 1px dashed var(--marke); outline-offset: 3px; }

.vz-masszahl {
  background: rgba(0,0,0,.75); color: var(--schrift); font-size: 11px;
  padding: 1px 6px; border-radius: 10px; white-space: nowrap;
  font-family: ui-monospace, monospace; border: 1px solid var(--rand);
  width: auto !important; height: auto !important;
}
.vz-masszahl.hilf { border-color: var(--marke); color: var(--marke); }

.vz-griff {
  background: var(--marke); border: 2px solid #201600; border-radius: 50%;
  cursor: move; box-shadow: 0 0 4px rgba(0,0,0,.6);
}

.vz-strassenname {
  color: rgba(230,236,243,.72); font-size: 10px; white-space: nowrap;
  text-shadow: 0 0 3px #000; width: auto !important; height: auto !important;
  transform: translate(-50%, -50%); font-weight: 600; letter-spacing: .02em;
}

.leaflet-container { background: #0d1117; font: inherit; }
.leaflet-control-zoom a { background: var(--grund2); color: var(--schrift); border-color: var(--rand); }
.leaflet-control-zoom a:hover { background: var(--grund3); }

/* -------------------------------------------------------------- Zeichenblatt */

.blatt { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.blatt .z {
  background: var(--grund2); border: 1px solid var(--rand); border-radius: var(--rund);
  padding: 12px; text-align: center;
}
.blatt .z img { width: 64px; height: 64px; object-fit: contain; }
.blatt .z b { display: block; font-family: ui-monospace, monospace; color: var(--marke); margin-top: 8px; }
.blatt .z span { display: block; font-size: 12px; color: var(--schrift2); }

/* -------------------------------------------------------------- Eichung */

.eichkasten { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
#eichkarte { height: 68vh; border: 1px solid var(--rand); border-radius: var(--rund); }
.eichspalte { background: var(--grund2); border: 1px solid var(--rand);
              border-radius: var(--rund); padding: 16px; }
.punktkasten { background: var(--grund); border: 1px solid var(--rand);
               border-radius: var(--rund); padding: 12px; margin-bottom: 12px; }
.punktkasten h3 { margin-top: 0; }
.punktkasten .paar { display: flex; gap: 8px; }
.punktkasten .paar label { flex: 1; }
.werte { font-family: ui-monospace, monospace; font-size: 12px; color: var(--schrift2); }

/* ---------------------------------------------------------------- Drucken */

.druckanhang { display: none; }

@media print {
  :root { --schrift: #000; --schrift2: #444; --grund: #fff; --grund2: #fff; --rand: #999; }
  html, body { background: #fff; color: #000; }
  .kopf, .werkzeugspalte, .eigenschaften, .kartenleiste, .fussleiste,
  .planleiste .knoepfe, .planleiste .felder select, .fuss,
  .leaflet-control-container { display: none !important; }
  .editor { height: auto; }
  .buehne { display: block; }
  #karte { height: 17cm !important; page-break-inside: avoid; border: 1px solid #000; }
  .planleiste { border-bottom: 2px solid #000; }
  .planleiste #f-titel { border: none; font-size: 17px; width: auto; background: none; color: #000; }
  .vz-strassenname { color: #333; text-shadow: none; }
  .vz-masszahl { background: #fff; color: #000; border-color: #000; }
  .druckanhang { display: block; margin-top: 12px; font-size: 11pt; }
  .druckanhang table { border-collapse: collapse; width: 100%; }
  .druckanhang td { padding: 2px 8px; border-bottom: 1px solid #ccc; }
  .druckanhang .r { text-align: right; width: 3cm; }
  @page { size: A4 landscape; margin: 12mm; }
}

/* ------------------------------------------------------------ schmale Fenster */

@media (max-width: 1100px) {
  .werkzeugspalte { width: 180px; flex-basis: 180px; }
  .eigenschaften { width: 210px; flex-basis: 210px; }
  .planleiste #f-titel { width: 180px; }
}
@media (max-width: 860px) {
  .buehne { flex-direction: column; }
  .werkzeugspalte, .eigenschaften { width: auto; flex: 0 0 auto; border: none;
    border-bottom: 1px solid var(--rand); max-height: 220px; }
  .zeichenliste { max-height: 140px; }
  .editor { height: auto; }
  #karte { height: 60vh; }
  .eichkasten { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------- Nachtraege */

.unter { color: var(--schrift2); margin: 0 0 18px; max-width: 70ch; }

ol.anleitung { max-width: 75ch; color: var(--schrift); padding-left: 22px; }
ol.anleitung li { margin-bottom: 7px; }
code {
  background: var(--grund3); padding: 1px 5px; border-radius: 3px;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px;
}

.beschreibungskasten {
  margin: 16px 18px; padding: 14px 16px; background: var(--grund2);
  border: 1px solid var(--rand); border-radius: var(--rund); max-width: 80ch;
}
.beschreibungskasten h3 { margin-top: 0; }

.vz-eichpunkt {
  background: var(--marke); color: #201600; border: 2px solid #201600;
  border-radius: 50%; font-weight: 700; text-align: center; line-height: 18px;
  box-shadow: 0 0 6px rgba(0,0,0,.7);
}
