/* VergabeCockpit – Oberfläche Modul 1
   Leitidee: eine ruhige Arbeitsfläche, auf der nur der Zustand des Verfahrens Farbe trägt.
   Das Verfahrensband (V1–V8) ist das eine prägende Element. */

:root {
  --tinte: #17212B;
  --tinte-2: #46525F;
  --tinte-3: #7A8592;
  --grund: #F3F5F7;
  --flaeche: #FFFFFF;
  --flaeche-2: #F8FAFB;
  --linie: #DCE1E6;
  --linie-2: #EBEEF1;
  --akzent: #0E5E5A;       /* Aktendeckel-Petrol */
  --akzent-hell: #E3F0EE;
  --akzent-text: #FFFFFF;
  --rot: #B93A2E;
  --rot-hell: #FBEAE7;
  --gelb: #A96E00;
  --gelb-hell: #FDF3DC;
  --gruen: #2D7A4B;
  --gruen-hell: #E5F3EA;
  --blau: #2C5A9E;
  --blau-hell: #E8EFF9;
  --schatten: 0 1px 2px rgba(23, 33, 43, .06), 0 4px 14px rgba(23, 33, 43, .06);
  --radius: 10px;
  --radius-k: 6px;
  --schrift: "Segoe UI Variable Text", "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --schrift-titel: "Segoe UI Variable Display", "Segoe UI", "Inter", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tinte: #E6EBEF; --tinte-2: #B3BDC7; --tinte-3: #8692A0;
    --grund: #12181E; --flaeche: #1A2229; --flaeche-2: #1F2830; --linie: #2E3A45; --linie-2: #26313B;
    --akzent: #4FB3A9; --akzent-hell: #183A38; --akzent-text: #0B1C1B;
    --rot: #F08A7E; --rot-hell: #3A1F1C; --gelb: #E8B54A; --gelb-hell: #352A12; --gruen: #6CC891; --gruen-hell: #18301F;
    --blau: #86AEEA; --blau-hell: #1B2A40;
    --schatten: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 var(--schrift); color: var(--tinte); background: var(--grund);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
a.knopf:hover { text-decoration: none; }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- Gerüst ---- */
.rahmen { display: grid; grid-template-columns: 248px 1fr; height: 100vh; }
.leiste {
  background: var(--flaeche); border-right: 1px solid var(--linie); display: flex; flex-direction: column;
  padding: 14px 10px; gap: 2px; overflow-y: auto;
}
.marke { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font: 600 15px var(--schrift-titel); }
.marke svg { flex: none; }
.navpunkt {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-k);
  color: var(--tinte-2); text-decoration: none; border: 0; background: none; width: 100%; text-align: left; cursor: pointer;
}
.navpunkt:hover { background: var(--flaeche-2); color: var(--tinte); }
.navpunkt.aktiv { background: var(--akzent-hell); color: var(--akzent); font-weight: 600; }
.navpunkt .zahl { margin-left: auto; font-size: 12px; color: var(--tinte-3); }
.navgruppe { font-size: 12px; color: var(--tinte-3); padding: 14px 10px 4px; }
.navpunkt .punkt { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.leiste-fuss { margin-top: auto; padding: 10px; border-top: 1px solid var(--linie-2); font-size: 12.5px; color: var(--tinte-2); }
.leiste-fuss strong { display: block; color: var(--tinte); font-size: 13.5px; }
.haupt { overflow-y: auto; min-width: 0; }
.seite { padding: 24px 32px 48px; max-width: 1440px; }

h1 { font: 600 22px/1.25 var(--schrift-titel); margin: 0; letter-spacing: -.01em; }
h2 { font: 600 16px/1.3 var(--schrift-titel); margin: 0 0 10px; }
h3 { font: 600 14px/1.3 var(--schrift); margin: 0 0 8px; }
.leise { color: var(--tinte-3); }
.klein { font-size: 12.5px; }

/* ---- Bedienelemente ---- */
.knopf {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius-k);
  border: 1px solid var(--linie); background: var(--flaeche); cursor: pointer; font-weight: 500; white-space: nowrap;
}
.knopf:hover { border-color: var(--tinte-3); }
.knopf.primaer { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
.knopf.primaer:hover { filter: brightness(1.08); }
.knopf.gefahr { color: var(--rot); }
.knopf.ghost { border-color: transparent; background: none; color: var(--tinte-2); }
.knopf.ghost:hover { background: var(--flaeche-2); }
.knopf:disabled { opacity: .45; cursor: not-allowed; }
.knopf.klein { padding: 3px 9px; font-size: 12.5px; }
.eingabe, select.eingabe, textarea.eingabe {
  width: 100%; padding: 7px 10px; border: 1px solid var(--linie); border-radius: var(--radius-k); background: var(--flaeche);
}
.eingabe:focus { border-color: var(--akzent); outline: none; box-shadow: 0 0 0 3px var(--akzent-hell); }
textarea.eingabe { resize: vertical; min-height: 72px; }
label.feld { display: grid; gap: 4px; font-size: 12.5px; color: var(--tinte-2); }
.reihe { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.raster-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 16px 18px; }
.karte + .karte { margin-top: 14px; }

.marker { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.m-rot { color: var(--rot); background: var(--rot-hell); }
.m-gelb { color: var(--gelb); background: var(--gelb-hell); }
.m-gruen { color: var(--gruen); background: var(--gruen-hell); }
.m-blau { color: var(--blau); background: var(--blau-hell); }
.m-grau { color: var(--tinte-2); background: var(--linie-2); }
.ampel { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.ampel.rot { background: var(--rot); } .ampel.gelb { background: var(--gelb); } .ampel.gruen { background: var(--gruen); }

/* ---- Kopf eines Verfahrens ---- */
.vkopf { display: grid; gap: 14px; margin-bottom: 18px; }
.vkopf-zeile { display: flex; align-items: flex-start; gap: 16px; }
.vkopf-titel { flex: 1; min-width: 0; }
.vkopf-titel .mandant { color: var(--tinte-2); font-size: 13px; margin-bottom: 2px; }
.kennungen { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.kennung { white-space: nowrap; font-size: 12px; padding: 2px 8px; border: 1px solid var(--linie); border-radius: 999px; color: var(--tinte-2); background: var(--flaeche); }
.kennung b { color: var(--tinte); font-weight: 600; }
.kennung.fehlt { border-style: dashed; color: var(--rot); }

/* Verfahrensband: acht Abschnitte, Füllung = erledigter Anteil */
.band { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.band-teil {
  position: relative; padding: 9px 10px 8px; background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: var(--radius-k); cursor: pointer; text-align: left; overflow: hidden; min-width: 0;
}
.band-teil::before {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--anteil); background: var(--akzent);
  transition: width .4s ease;
}
.band-teil.fertig { border-color: var(--akzent); background: var(--akzent-hell); }
.band-teil.fertig::before { height: 3px; }
.band-teil.aktiv { box-shadow: 0 0 0 2px var(--akzent) inset; }
.band-teil .k { font-weight: 700; font-size: 12px; color: var(--akzent); }
.band-teil .t { display: block; font-size: 12.5px; color: var(--tinte); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.band-teil .z { font-size: 11.5px; color: var(--tinte-3); }
.band.mini { grid-template-columns: repeat(8, 1fr); gap: 2px; }
.band.mini span { height: 6px; border-radius: 2px; background: var(--linie); position: relative; overflow: hidden; }
.band.mini span i { position: absolute; inset: 0 auto 0 0; background: var(--akzent); }

.reiter { display: flex; gap: 2px; border-bottom: 1px solid var(--linie); margin-bottom: 18px; overflow-x: auto; }
.reiter a { white-space: nowrap;
  padding: 9px 14px; color: var(--tinte-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; display: inline-flex; gap: 6px; align-items: center;
}
.reiter a:hover { color: var(--tinte); }
.reiter a.aktiv { color: var(--tinte); border-bottom-color: var(--akzent); font-weight: 600; }
.reiter .zaehler { font-size: 11.5px; padding: 0 6px; border-radius: 999px; background: var(--rot-hell); color: var(--rot); font-weight: 600; }

/* ---- Lage ---- */
.lage { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.befund { display: grid; grid-template-columns: 50px 1fr auto; gap: 10px; padding: 9px 0; border-top: 1px solid var(--linie-2); align-items: start; }
.befund:first-of-type { border-top: 0; }
.befund .nr { font-weight: 600; color: var(--tinte-2); font-size: 12.5px; padding-top: 1px; }
.befund-titel { display: flex; gap: 8px; align-items: baseline; }
.befund-titel .schwere { flex: none; }
.befund .nachweis { font-size: 12.5px; color: var(--tinte-3); }
.schwere { font-size: 11px; font-weight: 700; width: 22px; height: 20px; display: inline-grid; place-items: center; border-radius: 4px; }
.schwere.K { background: var(--rot-hell); color: var(--rot); }
.schwere.H { background: var(--gelb-hell); color: var(--gelb); }
.schwere.M { background: var(--blau-hell); color: var(--blau); }
.liste-fehlt { list-style: none; padding: 0; margin: 0; }
.liste-fehlt li { padding: 6px 0; border-top: 1px solid var(--linie-2); display: flex; gap: 10px; }
.liste-fehlt li:first-child { border-top: 0; }
.liste-fehlt .s { font-weight: 600; color: var(--akzent); min-width: 26px; font-size: 12.5px; }

/* Schwellenbalken */
.schwelle { margin: 10px 0 4px; }
.schwelle-bahn { position: relative; height: 10px; background: var(--linie-2); border-radius: 999px; }
.schwelle-wert { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--akzent); }
.schwelle-wert.ueber { background: var(--rot); }
.schwelle-marke { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--tinte); }
.schwelle-legende { display: flex; justify-content: space-between; font-size: 12px; color: var(--tinte-2); margin-top: 6px; }
.zahl-gross { font: 600 26px/1.1 var(--schrift-titel); letter-spacing: -.01em; }

/* ---- Dialog ---- */
.dialog-raster { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.verlauf { display: grid; gap: 12px; }
.blase { max-width: 760px; }
.blase .kopf { font-size: 12px; color: var(--tinte-3); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.blase.nutzer { justify-self: end; }
.blase.nutzer .inhalt { background: var(--akzent-hell); border-color: transparent; }
.blase .inhalt { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 12px 14px; white-space: pre-wrap; }
.blase.eingang .inhalt { border-left: 3px solid var(--tinte-2); }
.blase.frage .inhalt { border-left: 3px solid var(--gelb); }
.satz-zeile { display: grid; grid-template-columns: 22px 92px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--linie-2); align-items: start; }
.satz-zeile:first-of-type { border-top: 0; }
.satz-zeile .was { font-weight: 500; }
.beleg { font-size: 12.5px; color: var(--tinte-2); margin-top: 3px; }
.beleg::before { content: "„"; } .beleg::after { content: "“"; }
.art { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 4px; text-align: center; }
.art.neu { background: var(--blau-hell); color: var(--blau); }
.art.aendert { background: var(--akzent-hell); color: var(--akzent); }
.art.bestaetigt { background: var(--linie-2); color: var(--tinte-2); }
.art.widerspricht { background: var(--rot-hell); color: var(--rot); }
.art.uebernommen { background: var(--gruen-hell); color: var(--gruen); }
.lagekarte { display: grid; gap: 10px; }
.lagekarte section h4 { margin: 0 0 4px; font-size: 12.5px; color: var(--tinte-2); font-weight: 600; }
.lagekarte ul { margin: 0; padding-left: 18px; }
.lagekarte .folgen li { margin-bottom: 2px; }
.lagekarte .zutun li { list-style: none; margin-left: -18px; }
.lagekarte .zutun li::before { content: "☐ "; color: var(--akzent); }
.eingabefeld {
  position: sticky; bottom: 0; background: linear-gradient(transparent, var(--grund) 18px); padding-top: 18px; margin-top: 16px;
}
.eingabefeld .karte { padding: 12px; box-shadow: var(--schatten); }
.eingabefeld textarea { border: 0; min-height: 64px; padding: 4px; box-shadow: none !important; }
.eingabefeld.ziehen .karte { outline: 2px dashed var(--akzent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { white-space: nowrap; font-size: 12.5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--linie); background: var(--flaeche); cursor: pointer; color: var(--tinte-2); }
.chip:hover { border-color: var(--akzent); color: var(--akzent); }

.sachstand { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 0; }
.sachstand .blockkopf {
  position: sticky; top: 0; background: var(--flaeche); padding: 10px 14px; border-bottom: 1px solid var(--linie-2);
  font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; z-index: 1;
}
.sfeld { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 7px 14px; border-bottom: 1px solid var(--linie-2); cursor: pointer; }
.sfeld:hover { background: var(--flaeche-2); }
.sfeld .l { font-size: 12.5px; color: var(--tinte-2); }
.sfeld .w { grid-column: 1 / -1; font-weight: 500; overflow-wrap: anywhere; }
.sfeld .w.fehlt { color: var(--tinte-3); font-weight: 400; font-style: italic; }
.sfeld .q { font-size: 11.5px; color: var(--tinte-3); }
.sfeld.neu { animation: aufleuchten 1.6s ease; }
@keyframes aufleuchten { from { background: var(--akzent-hell); } to { background: transparent; } }

/* ---- Tabellen / Listen ---- */
table.tab { width: 100%; border-collapse: collapse; }
table.tab th { text-align: left; font-size: 12px; font-weight: 600; color: var(--tinte-3); padding: 6px 8px; border-bottom: 1px solid var(--linie); }
table.tab td { padding: 9px 8px; border-bottom: 1px solid var(--linie-2); vertical-align: top; }
table.tab td.zahl, table.tab th.zahl { text-align: right; }
table.tab tr.klickbar { cursor: pointer; }
table.tab tr.klickbar:hover td { background: var(--flaeche-2); }
table.tab tr.weg td { color: var(--tinte-3); text-decoration: line-through; }

.verfahrenszeile { display: grid; grid-template-columns: 14px minmax(0, 2.2fr) 120px 180px minmax(0, 1.4fr); gap: 14px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--linie-2); cursor: pointer; }
.verfahrenszeile:hover { background: var(--flaeche-2); }
.verfahrenszeile .titel { font-weight: 600; }

/* Schritte der Schätzungsprüfung */
.schritte { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.schritte > li { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; padding: 12px 0; border-top: 1px solid var(--linie-2); }
.schritte > li:first-child { border-top: 0; }
.schritte .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; background: var(--linie-2); color: var(--tinte-2); }
.schritte .ok .num { background: var(--gruen-hell); color: var(--gruen); }
.schritte .fehler .num { background: var(--rot-hell); color: var(--rot); }
.schritte .warnung .num, .schritte .offen .num { background: var(--gelb-hell); color: var(--gelb); }
.schritte ul { margin: 4px 0 0; padding-left: 18px; color: var(--tinte-2); font-size: 13px; }

/* Zeitleiste */
.zeitleiste { position: relative; margin: 6px 0 0 6px; padding-left: 22px; border-left: 2px solid var(--linie); }
.zpunkt { position: relative; padding: 4px 0 16px; }
.zpunkt::before { content: ""; position: absolute; left: -29px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--flaeche); border: 2px solid var(--akzent); }
.zpunkt.kritisch::before { border-color: var(--rot); background: var(--rot-hell); }
.zpunkt.vorbei::before { background: var(--linie); border-color: var(--tinte-3); }
.zpunkt .d { font-weight: 600; }
.zpunkt .r { font-size: 12.5px; color: var(--tinte-3); }

.hinweis { padding: 10px 12px; border-radius: var(--radius-k); font-size: 13px; }
.hinweis.rot { background: var(--rot-hell); color: var(--rot); }
.hinweis.gelb { background: var(--gelb-hell); color: var(--gelb); }
.hinweis.blau { background: var(--blau-hell); color: var(--blau); }
.hinweis + .hinweis { margin-top: 6px; }

.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.rf { padding: 10px 0; border-top: 1px solid var(--linie-2); }
.rf:first-of-type { border-top: 0; }
.rf .meta { font-size: 12px; color: var(--tinte-3); display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }

.vermerke { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.vliste button { display: flex; width: 100%; justify-content: space-between; gap: 8px; align-items: center; text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: var(--radius-k); cursor: pointer; }
.vliste button:hover { background: var(--flaeche-2); }
.vliste button.aktiv { background: var(--akzent-hell); }

/* ---- Dialoge, Toasts, Anmeldung ---- */
dialog { border: 1px solid var(--linie); border-radius: 12px; padding: 0; width: min(560px, 92vw); background: var(--flaeche); color: var(--tinte); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 22, 30, .35); }
dialog form { padding: 20px 22px; display: grid; gap: 12px; }
dialog .fuss { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
#toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--tinte); color: var(--grund); padding: 10px 14px; border-radius: 8px; box-shadow: var(--schatten); max-width: 420px; animation: rein .2s ease; }
.toast.fehler { background: var(--rot); color: #fff; }
@keyframes rein { from { transform: translateY(8px); opacity: 0; } }
.anmeldung { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.anmeldung .karte { width: min(440px, 100%); padding: 28px; display: grid; gap: 12px; box-shadow: var(--schatten); }
.anmeldung .karte > * { min-width: 0; }
.anmeldung .wahl { white-space: normal; flex-wrap: wrap; justify-content: flex-start; text-align: left; padding: 9px 12px; }
.anmeldung .wahl:hover { border-color: var(--akzent); background: var(--akzent-hell); }
.leer { padding: 28px; text-align: center; color: var(--tinte-3); }
.konflikt { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.konflikt > div { padding: 10px; border: 1px solid var(--linie); border-radius: var(--radius-k); }
kbd { font: 11px var(--schrift); border: 1px solid var(--linie); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; color: var(--tinte-2); }

@media (max-width: 1100px) {
  .lage, .dialog-raster, .vermerke { grid-template-columns: 1fr; }
  .sachstand { position: static; max-height: none; }
  .band { grid-template-columns: repeat(4, 1fr); }
  .verfahrenszeile { grid-template-columns: 14px 1fr; }
  .verfahrenszeile > :nth-child(n+3) { grid-column: 2; }
}
@media (max-width: 760px) {
  .rahmen { grid-template-columns: 1fr; }
  .leiste { display: none; }
  .seite { padding: 16px; }
  .raster-2 { grid-template-columns: 1fr; }
  .vkopf-zeile { flex-wrap: wrap; }
  .vkopf-zeile > .reihe { width: 100%; }
  .band { grid-template-columns: repeat(2, 1fr); }
  .befund { grid-template-columns: 40px 1fr; }
  .befund > :last-child { grid-column: 2; }
}

.knopf.primaer kbd { color: inherit; border-color: rgba(255,255,255,.45); opacity: .85; }
.navpunkt:hover, .reiter a:hover { text-decoration: none; }
