/* NPK-IFC Viewer – modernes, ruhiges Erscheinungsbild (Systemschrift, Linien-Icons, eine Akzentfarbe). Offline: keine externen Schriften. */
:root {
  --bg: #f3f4f7; --flaeche: #ffffff; --flaeche-2: #f8f9fb; --rand: #e3e6ec; --rand-stark: #cfd4dd;
  --text: #161b26; --leise: #6b7385; --sehr-leise: #9aa1b0;
  --akzent: #3b5bdb; --akzent-dunkel: #2f4ac0; --akzent-hell: #eef2ff; --akzent-rand: #c7d2fe;
  --sicher: #12a150; --unsicher: #f2a516; --nicht: #e5484d; --keine: #9aa1b0;
  --fehler: #e5484d; --warnung: #e8890c; --hinweis: #3b5bdb; --info: #6b7385;
  --radius: 10px; --radius-klein: 7px;
  --schatten: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --schatten-hoch: 0 8px 24px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .06);
  --schrift: "Segoe UI Variable Text", "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 13px/1.45 var(--schrift); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
body { display: flex; flex-direction: column; }
::selection { background: var(--akzent-rand); }

/* Icons (inline SVG, Linienstil) */
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon.klein { width: 14px; height: 14px; vertical-align: -2px; }

/* Knöpfe und Felder */
button { font: inherit; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--rand); background: var(--flaeche);
  color: var(--text); border-radius: var(--radius-klein); cursor: pointer; transition: background .12s, border-color .12s, color .12s, box-shadow .12s; }
button:hover { border-color: var(--rand-stark); background: var(--flaeche-2); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--akzent-rand); outline-offset: 1px; }
button.primaer { background: var(--akzent); color: #fff; border-color: var(--akzent); box-shadow: 0 1px 2px rgba(59, 91, 219, .35); }
button.primaer:hover { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); }
button.geist { border-color: transparent; background: transparent; color: var(--leise); }
button.geist:hover { background: var(--akzent-hell); color: var(--akzent); }
button:disabled { opacity: .5; cursor: default; }
select, input { font: inherit; padding: 5px 8px; border: 1px solid var(--rand); border-radius: var(--radius-klein); background: var(--flaeche); color: var(--text); max-width: 100%; }
select:hover, input:hover { border-color: var(--rand-stark); }
input[type="checkbox"] { accent-color: var(--akzent); width: 15px; height: 15px; padding: 0; }
.leise { color: var(--leise); }
h3 { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--leise); margin: 16px 0 6px; }
h4 { font-size: 12px; margin: 10px 0 3px; color: var(--leise); }

/* Kopfleiste */
#kopf { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: var(--flaeche); border-bottom: 1px solid var(--rand); flex-wrap: wrap; position: relative; z-index: 2; }
#kopf .titel { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; letter-spacing: -.01em; }
#kopf .titel .logo { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--akzent), #7048e8); display: grid; place-items: center; color: #fff; }
#kopf .titel .logo .icon { width: 15px; height: 15px; }
#kopf .werkzeuge { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#kopf label { display: flex; align-items: center; gap: 6px; color: var(--leise); font-size: 12px; }
#kopf label select { color: var(--text); }
.trenner { width: 1px; height: 22px; background: var(--rand); margin: 0 4px; }

/* Raster */
#haupt { --links: 320px; --rechts: 400px; flex: 1; display: grid; grid-template-columns: var(--links) 1fr var(--rechts); min-height: 0; }
#links, #rechts { background: var(--flaeche); overflow: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--rand-stark) transparent; }
#links { border-right: 1px solid var(--rand); display: flex; flex-direction: column; }
#rechts { border-left: 1px solid var(--rand); padding: 10px 12px; }
#mitte { position: relative; min-width: 0; min-height: 0; }
#leinwand { width: 100%; height: 100%; display: block; background: radial-gradient(ellipse at 50% 35%, #fbfcfe 0%, #e9ecf2 100%); }

/* Reiter als Segmentschalter */
.reiter { display: flex; gap: 2px; margin: 10px 10px 4px; padding: 3px; background: var(--bg); border-radius: var(--radius); position: sticky; top: 0; z-index: 1; }
.reiter button { flex: 1; justify-content: center; border: 0; border-radius: var(--radius-klein); background: none; padding: 5px 4px; color: var(--leise); font-size: 12px; }
.reiter button:hover { background: rgba(255, 255, 255, .6); color: var(--text); }
.reiter button.aktiv { background: var(--flaeche); color: var(--text); font-weight: 600; box-shadow: var(--schatten); }
.reiterinhalt { display: none; padding: 8px 12px 12px; }
.reiterinhalt.aktiv { display: block; }

.formular { display: grid; gap: 8px; }
.formular label { display: grid; gap: 3px; color: var(--leise); font-size: 11.5px; font-weight: 500; }
.formular label.zeile { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 400; }
.formular.zeilen { grid-template-columns: 1fr 1fr; }

/* Listen */
.liste { display: grid; gap: 2px; grid-template-columns: minmax(0, 1fr); }
.eintrag { min-width: 0; padding: 6px 8px; border-radius: var(--radius-klein); cursor: pointer; border: 1px solid transparent; transition: background .1s; }
.eintrag:hover { background: var(--flaeche-2); border-color: var(--rand); }
.eintrag.gewaehlt { border-color: var(--akzent-rand); background: var(--akzent-hell); }
.eintrag .zeile1 > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eintrag .zeile1 { display: flex; gap: 6px; align-items: baseline; justify-content: space-between; }
.eintrag .zeile2 { color: var(--leise); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12px; }
.menge { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Marken als dezente Pillen */
.marke { display: inline-flex; align-items: center; padding: 0 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; line-height: 17px; color: #fff; white-space: nowrap; letter-spacing: .01em; }
.marke.SICHER { background: #e3f6ec; color: #0b7a3d; }
.marke.UNSICHER { background: #fff2d9; color: #8a5600; }
.marke.NICHT_BESTIMMBAR { background: #fde7e8; color: #b42328; }
.marke.KEINE_POSITION { background: #eef0f4; color: var(--leise); }
.marke.Fehler { background: #fde7e8; color: #b42328; }
.marke.Warnung { background: #fff0dc; color: #9a5300; }
.marke.Hinweis { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.marke.Info { background: #eef0f4; color: var(--leise); }
.marke.variante { background: #e0f4fb; color: #16708f; }
.marke.pflicht { background: #efeaff; color: #5b3fc4; }
.marke.bedarf { background: #eef0f4; color: var(--leise); }
.marke.fehlt { background: #fde7e8; color: #b42328; }
.marke.platzhalter { background: #fff0dc; color: #9a5300; }
.marke.code { background: var(--flaeche-2); color: var(--text); border: 1px solid var(--rand); font-family: var(--mono); font-weight: 500; }
.marke.offen { background: #fff2d9; color: #8a5600; }

/* Schwebende Werkzeuge und Legende im 3D-Bereich */
#ansicht-werkzeuge { position: absolute; top: 12px; left: 12px; display: flex; gap: 2px; padding: 4px; background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(8px); border: 1px solid var(--rand); border-radius: var(--radius); box-shadow: var(--schatten-hoch); }
#ansicht-werkzeuge button { border-color: transparent; background: transparent; padding: 5px 9px; font-size: 12px; }
#ansicht-werkzeuge button:hover { background: var(--akzent-hell); color: var(--akzent); }
#legende { position: absolute; right: 12px; top: 12px; max-height: 55%; overflow: auto; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px);
  border: 1px solid var(--rand); border-radius: var(--radius); padding: 8px 10px; min-width: 190px; max-width: 320px; font-size: 12px; box-shadow: var(--schatten-hoch); }
#legende .le { display: flex; gap: 8px; align-items: center; padding: 2px 4px; border-radius: 5px; cursor: default; }
#legende .le.klickbar { cursor: pointer; }
#legende .le.klickbar:hover { background: var(--akzent-hell); }
#legende .farbe { width: 11px; height: 11px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
#legende .titel { font-weight: 650; margin-bottom: 4px; cursor: pointer; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--leise); }
#legende.zu .le-liste { display: none; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(243, 244, 247, .85); backdrop-filter: blur(3px); font-size: 15px; color: var(--leise); }
.overlay.weg { display: none; }

/* Fusszeile */
#fuss { display: flex; justify-content: space-between; gap: 12px; padding: 4px 14px; background: var(--flaeche); border-top: 1px solid var(--rand); font-size: 11.5px; color: var(--leise); }
#meldung { color: var(--text); }
#meldung.fehler { color: var(--fehler); font-weight: 600; }

/* Panel */
.panel-kopf { display: grid; gap: 4px; margin-bottom: 6px; }
.panel-kopf:empty { display: none; }
.panel-kopf .name { font-size: 15px; font-weight: 650; }
table.kv { width: 100%; border-collapse: collapse; }
table.kv td, table.kv th { padding: 3px 6px; border-bottom: 1px solid #f0f2f5; vertical-align: top; text-align: left; }
table.kv tr:last-child td, table.kv tr:last-child th { border-bottom: 0; }
table.kv th { color: var(--leise); font-weight: 400; width: 44%; }
table.kv td.aktion { width: 1%; white-space: nowrap; text-align: right; }
table.kv.zuweisungen th { color: var(--text); font-weight: 500; }
details { border: 1px solid var(--rand); border-radius: var(--radius); margin: 8px 0; background: var(--flaeche); box-shadow: var(--schatten); overflow: hidden; }
details > summary { cursor: pointer; padding: 7px 10px; font-weight: 600; font-size: 12.5px; list-style: none; display: flex; align-items: center; gap: 6px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.8px solid var(--sehr-leise); border-bottom: 1.8px solid var(--sehr-leise); transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
details[open] > summary::before { transform: rotate(45deg); }
details > summary:hover { background: var(--flaeche-2); }
details > .inhalt { padding: 2px 8px 8px; }
.zuweisung { border: 1px solid var(--rand); border-radius: var(--radius-klein); padding: 6px 8px; margin: 6px 0; background: var(--flaeche); }
.zuweisung .kopfzeile { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.zuweisung .rname { font-size: 11px; color: var(--leise); word-break: break-all; }
.link { color: var(--akzent); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.editor { display: grid; gap: 6px; padding: 8px; background: var(--akzent-hell); border: 1px solid var(--akzent-rand); border-radius: var(--radius-klein); margin: 4px 0 6px; }
.editor .knoepfe { display: flex; gap: 6px; flex-wrap: wrap; }
.editor .fehlertext { color: var(--fehler); }
.ungueltig { color: var(--fehler); }
.gruppe-kopf { display: flex; justify-content: space-between; gap: 6px; }
.unter { padding-left: 12px; }

/* Live/Manuell, Fortschritt, offene Änderungen (E105) */
.weg { display: none !important; }
.schalter { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--rand); border-radius: 999px; cursor: pointer; background: var(--flaeche); }
.schalter input { margin: 0; }
#btn-offene { border-color: var(--warnung); color: #9a5300; background: #fff7eb; }
#fortschritt { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; }
.kreisel { width: 12px; height: 12px; border: 2px solid var(--rand); border-top-color: var(--akzent); border-radius: 50%; display: inline-block; animation: drehen .8s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }
.eintrag.offen { border-left: 3px solid var(--warnung); }
#fortschritt-balken { width: 140px; height: 6px; accent-color: var(--akzent); }
#fortschritt-text { white-space: nowrap; }
body.beschaeftigt #kopf button, body.beschaeftigt #kopf select { pointer-events: none; opacity: .6; }

/* Merkmalsleiste: einzeilige Werte, enge Zeilen, fehlende Pflichtmerkmale rot */
table.kv.merkmale td, table.kv.merkmale th { padding: 1px 6px; line-height: 20px; }
table.kv.merkmale th, table.kv.merkmale td.wert { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
table.kv.merkmale tr:hover th, table.kv.merkmale tr:hover td { background: var(--flaeche-2); }
table.kv.merkmale tr.fehlt th, table.kv.merkmale tr.fehlt td.wert { color: var(--fehler); font-weight: 600; }
table.kv.merkmale td.aktion button, .inhalt > .aktion button { padding: 2px; border-color: transparent; background: transparent; color: var(--sehr-leise); }
table.kv.merkmale td.aktion button:hover, .inhalt > .aktion button:hover { color: var(--akzent); background: var(--akzent-hell); }
table.kv.merkmale tr:not(:hover) td.aktion button { opacity: .55; }

/* Leisten: Breite ziehen, ein- und ausklappen (Griffe am Rand der 3D-Ansicht) */
#haupt.links-zu #links, #haupt.rechts-zu #rechts { display: none; }
#haupt.links-zu { grid-template-columns: 0 1fr var(--rechts); }
#haupt.rechts-zu { grid-template-columns: var(--links) 1fr 0; }
#haupt.links-zu.rechts-zu { grid-template-columns: 0 1fr 0; }
.griff { position: absolute; top: 0; bottom: 0; width: 6px; z-index: 3; cursor: col-resize; }
.griff.links { left: 0; }
.griff.rechts { right: 0; }
.griff::before { content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: transparent; transition: background .12s; }
.griff.links::before { left: 0; }
.griff.rechts::before { right: 0; }
.griff:hover::before, .griff.zieht::before { background: var(--akzent); }
/* Klappgriffe fest am Bildrand: gleiche Stelle eingeklappt und ausgeklappt, der Cursor muss nicht nachfahren */
.klappe { position: fixed; top: 50%; transform: translateY(-50%); z-index: 20; width: 16px; height: 52px; padding: 0; justify-content: center;
  background: var(--flaeche); border: 1px solid var(--rand); box-shadow: var(--schatten); color: var(--leise); cursor: pointer; }
.klappe[data-klappe="links"] { left: 0; border-left: 0; border-radius: 0 8px 8px 0; }
.klappe[data-klappe="rechts"] { right: 0; border-right: 0; border-radius: 8px 0 0 8px; }
.klappe:hover { color: var(--akzent); background: var(--akzent-hell); border-color: var(--akzent-rand); }
body.links-zu .klappe[data-klappe="links"] svg, body.rechts-zu .klappe[data-klappe="rechts"] svg { transform: rotate(180deg); }
#haupt.links-zu .griff.links, #haupt.rechts-zu .griff.rechts { display: none; }
body.zieht { cursor: col-resize; user-select: none; }
#ansicht-werkzeuge { left: 14px; }
#legende { right: 14px; }

/* Filterleiste: Bezeichnung und Auswahl auf einer Zeile */
#r-filter .formular label:not(.zeile) { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 8px; }
#r-filter .formular label:not(.zeile) select, #r-filter .formular label:not(.zeile) input { width: 100%; }

/* Preise (E198) */
.kosten { border: 1px solid #d0d4da; border-radius: 6px; padding: 6px 8px; margin: 0 0 8px; }
.kosten .zeile1 { display: flex; justify-content: space-between; font-weight: 600; }
.betrag { font-variant-numeric: tabular-nums; white-space: nowrap; }
.zeile2.preis { font-variant-numeric: tabular-nums; }
table.zuweisungen td.betrag { text-align: right; }
table.zuweisungen tr.summe th, table.zuweisungen tr.summe td { border-top: 1px solid #d0d4da; font-weight: 600; }
