/* Aegis Vitae Elite Lab — Dashboard Styles */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #d8dee4;
  --text: #1a2332;
  --muted: #5c6b7a;
  --accent: #1e5a8a;
  --accent-light: #e8f1f8;
  --danger: #c0392b;
  --load: #e67e22;
  --grid: #e2e8ee;
  --shadow: 0 1px 3px rgba(26, 35, 50, 0.08);
  --radius: 6px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.brand h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
}

.subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.controls label {
  font-size: 0.85rem;
  color: var(--muted);
}

.controls select {
  min-width: 220px;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
}

.controls button {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}

.controls button:hover {
  opacity: 0.9;
}

.controls button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface) !important;
  color: var(--accent) !important;
}

/* Export & Dokumentation */

.export-panel .export-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.btn-export {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-export:hover:not(:disabled) {
  background: var(--accent-light);
}

.btn-export:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hierarchie-tree {
  font-size: 0.82rem;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 0.5rem;
}

.hierarchie-tree ul {
  list-style: none;
  margin: 0;
  padding-left: 0.85rem;
}

.hierarchie-tree > ul {
  padding-left: 0;
}

.tree-node {
  padding: 0.2rem 0;
  cursor: default;
}

.tree-node.project { font-weight: 600; color: var(--accent); }
.tree-node.geschoss { font-weight: 600; color: #2e5a7a; }
.tree-node.raum { color: #5c6b7a; }
.tree-node.bauteil { color: var(--text); cursor: grab; }
.tree-node.bauteil:hover { color: var(--accent); }
.tree-node.bauteil.dragging { opacity: 0.45; }
.tree-node.drop-target { outline: 2px dashed var(--accent); border-radius: 4px; background: rgba(30, 90, 138, 0.08); }
.tree-node.basis-geschoss { color: #9a6b00; }

.integritaet-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius);
  font-size: 0.78rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
}

.integritaet-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.integritaet-vollstaendig { background: #e8f5e9; border-color: #a5d6a7; }
.integritaet-vollstaendig .integritaet-dot { background: #2e7d32; }
.integritaet-unvollstaendig { background: #fff8e1; border-color: #ffe082; }
.integritaet-unvollstaendig .integritaet-dot { background: #f9a825; }
.integritaet-neutral { background: var(--surface); }

.verschieben-form {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.verschieben-form label {
  display: block;
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
}

.verschieben-form select,
.verschieben-form button {
  width: 100%;
  margin-bottom: 0.4rem;
}

#projektion-panel label {
  display: block;
  font-size: 0.78rem;
  margin: 0.4rem 0 0.2rem;
}

#projektion-panel select,
#projektion-panel input {
  width: 100%;
  margin-bottom: 0.35rem;
  padding: 0.35rem;
  font-size: 0.82rem;
}

#projektion-panel .btn-export,
#projektion-panel .btn-small {
  width: 100%;
  margin-top: 0.35rem;
}

#projektion-info {
  color: var(--accent);
  font-size: 0.82rem;
  margin-right: 1rem;
}

.hierarchie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.btn-small {
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.btn-small:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-light);
}

.btn-small:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.entity-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.entity-form label {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.entity-form input,
.entity-form select {
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.85rem;
}

.entity-form button[type="submit"] {
  margin-top: 0.35rem;
  padding: 0.45rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.entity-form button[type="button"] {
  padding: 0.35rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  min-height: 0;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
}

.panel h2 {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.status {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

/* Bauteil-Liste */

.bauteil-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bauteil-list li {
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.bauteil-list li:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.bauteil-list li.active {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: inset 3px 0 0 var(--accent);
}

.bauteil-list .item-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.bauteil-list .item-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--border);
  color: var(--text);
}

.badge.has-geo {
  background: #d4edda;
  color: #1e5631;
}

.badge.no-geo {
  background: #f8e8e8;
  color: #7b2d26;
}

/* Details */

.details-panel dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.75rem;
  font-size: 0.82rem;
}

.details-panel dt {
  color: var(--muted);
  font-weight: 500;
}

.details-panel dd {
  margin: 0;
  word-break: break-word;
}

.details-panel .section-title {
  grid-column: 1 / -1;
  margin: 0.6rem 0 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Canvas */

.mode-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0.5rem;
}

.mode-tab {
  padding: 0.55rem 1.1rem;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.mode-tab:hover {
  color: var(--accent);
  background: rgba(30, 90, 138, 0.06);
}

.mode-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.canvas-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.canvas-view[hidden] {
  display: none !important;
}

.plan-wrapper {
  border: 2px solid var(--accent);
}

#plan-svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 480px;
}

#plan-title {
  font-weight: 600;
  color: var(--accent);
}

#plan-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-right: 1rem;
}

#projektion-panel {
  border-left: 3px solid var(--accent);
}

#skizzen-panel {
  border-left: 3px solid #c0392b;
}

.skizzen-actions,
.skizze-wall-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.skizze-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0.75rem 0;
}

.skizze-tools-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  width: 100%;
}

.skizze-tool.active {
  background: #c0392b;
  color: #fff;
  border-color: #a93226;
}

.skizze-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.skizze-hint {
  font-size: 0.78rem;
  margin-top: 0.5rem;
}

.skizze-wrapper {
  border: 2px solid #c0392b;
  cursor: crosshair;
}

#skizze-svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 480px;
}

#skizze-title {
  font-weight: 600;
  color: #c0392b;
}

.skizze-ref-point {
  fill: #e74c3c;
  stroke: #fff;
  stroke-width: 2;
}

.skizze-ref-line {
  stroke: #e74c3c;
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.skizze-wall-preview {
  fill: none;
  stroke: #2980b9;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skizze-wall-point {
  fill: #2980b9;
  stroke: #fff;
  stroke-width: 1.5;
}

.skizze-traced-wall {
  fill: none;
  stroke: #27ae60;
  stroke-width: 2.5;
  opacity: 0.85;
}

.skizze-coord-label {
  font-size: 10px;
  fill: #2c3e50;
  font-family: system-ui, sans-serif;
}

.canvas-area {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem;
  min-width: 0;
}

.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.svg-wrapper {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 480px;
}

#geometrie-svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 480px;
}

.svg-bg {
  fill: #fafbfc;
}

.hint {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Massenliste */

.massen-panel {
  margin-top: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.massen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.massen-header h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--accent);
}

.massen-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.massen-warnungen {
  background: #fff8e6;
  border: 1px solid #f0d78c;
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: #7a5c00;
}

.massen-warnungen ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.sub-table-title {
  margin: 1rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.table-scroll {
  overflow-x: auto;
}

.massen-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.massen-table th,
.massen-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.massen-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.massen-table tfoot td {
  font-weight: 600;
  background: var(--accent-light);
  border-top: 2px solid var(--accent);
}

.massen-table tr.warn-row td {
  background: #fff8f8;
}

.warn-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.72rem;
  background: #fff3cd;
  color: #856404;
}

.ok-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.72rem;
  background: #d4edda;
  color: #1e5631;
}

/* SVG-Elemente (via JS-Klassen) */

.bauteil-shape {
  fill: rgba(30, 90, 138, 0.12);
  stroke: var(--accent);
  stroke-width: 2;
  cursor: pointer;
  transition: fill 0.15s;
}

.bauteil-shape:hover,
.bauteil-shape.selected {
  fill: rgba(30, 90, 138, 0.28);
  stroke-width: 2.5;
}

.bauteil-label {
  font-size: 11px;
  fill: var(--accent);
  font-weight: 600;
  pointer-events: none;
  text-anchor: middle;
}

.knoten-punkt {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 1.5;
  cursor: pointer;
}

.knoten-label {
  font-size: 9px;
  fill: var(--muted);
  pointer-events: none;
}

.last-pfeil {
  stroke: var(--load);
  stroke-width: 2;
  fill: none;
  marker-end: url(#arrowhead-load);
}

.last-z-marker {
  fill: var(--load);
  stroke: #fff;
  stroke-width: 1;
}

.last-label {
  font-size: 9px;
  fill: var(--load);
  font-weight: 600;
}

.grid-line {
  stroke: var(--grid);
  stroke-width: 1;
}

.grid-label {
  font-size: 9px;
  fill: #b0bac4;
}

/* Footer */

.app-footer {
  display: flex;
  gap: 1.5rem;
  padding: 0.6rem 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}

.app-footer code {
  font-size: 0.78rem;
  color: var(--text);
}

/* Responsive */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 280px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.fail-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.72rem;
  background: #fadbd8;
  color: #c0392b;
}

#nachweise-panel {
  border-left: 3px solid #8e44ad;
}

.nachweis-ergebnis-panel {
  border-top: 3px solid #8e44ad;
}

.nachweis-gesamt-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-left: 0.75rem;
}

.nachweis-gesamt-ok {
  background: #d4edda;
  color: #1e5631;
}

.nachweis-gesamt-teil {
  background: #fff3cd;
  color: #856404;
}

.nachweis-gesamt-fail {
  background: #fadbd8;
  color: #c0392b;
}

.nachweis-ok-row {
  background: rgba(39, 174, 96, 0.06);
}

.nachweis-fail-row {
  background: rgba(192, 57, 43, 0.06);
}

.nachweis-hinweis-text {
  margin-bottom: 0.75rem;
  font-style: italic;
}

/* --- Statik-Bemessung (Phase 9b) --- */

#statik-panel {
  border-left: 3px solid #1a5276;
}

.statik-form label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 0.5rem;
}

.statik-form input,
.statik-form select {
  width: 100%;
  margin-bottom: 0.25rem;
}

.statik-form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.statik-save-status.statik-saved {
  color: #1e8449;
  font-weight: 600;
}

.statik-view-title,
.nachweise-view-title {
  font-weight: 600;
  color: #1a5276;
}

.statik-empty,
.nachweise-placeholder {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin-top: 0.5rem;
}

.statik-result-card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eta-bar-wrap {
  margin-bottom: 1.25rem;
}

.eta-bar-label {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #1a2e44;
}

.eta-bar {
  height: 28px;
  background: #e8ecf0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #ccd4dc;
}

.eta-bar-fill {
  height: 100%;
  border-radius: 14px;
  transition: width 0.4s ease, background 0.3s;
}

.eta-bar-fill.eta-ok {
  background: linear-gradient(90deg, #27ae60, #2ecc71);
}

.eta-bar-fill.eta-warn {
  background: linear-gradient(90deg, #f39c12, #f1c40f);
}

.eta-bar-fill.eta-fail {
  background: linear-gradient(90deg, #c0392b, #e74c3c);
}

.eta-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.72rem;
}

.eta-legend-item::before {
  content: "■ ";
}

.eta-legend-item.eta-ok { color: #1e8449; }
.eta-legend-item.eta-warn { color: #b7950b; }
.eta-legend-item.eta-fail { color: #c0392b; }

.statik-disclaimer {
  font-size: 0.82rem;
  font-style: italic;
  color: #5c3d2e;
  background: #fff8f0;
  border-left: 4px solid #e67e22;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
}

.statik-rechenweg {
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.statik-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  font-size: 0.9rem;
}

.system-status {
  font-weight: 600;
  margin-right: 1rem;
}

.system-status.system-ready {
  color: #1e8449;
}

.system-status.system-error {
  color: #c0392b;
}

/* --- Stabwerk (Phase 11) --- */

#stabwerk-panel {
  border-left: 3px solid #117a65;
}

#stabwerk-panel label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 0.5rem;
}

#stabwerk-panel input {
  width: 100%;
  margin-bottom: 0.25rem;
}

.stabwerk-wrapper {
  min-height: 320px;
}

.stabwerk-empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}

.stabwerk-status-text {
  margin-left: auto;
  font-size: 0.85rem;
}

.stabwerk-status-text.error {
  color: #c0392b;
}

.stabwerk-diagram-tabs {
  display: flex;
  gap: 0.35rem;
  margin-left: 1rem;
}

.stabwerk-bar {
  stroke-width: 4;
  stroke-linecap: round;
}

.stabwerk-balken { stroke: #1a5276; }
.stabwerk-stuetze { stroke: #566573; }
.stabwerk-wand { stroke: #7d6608; }
.stabwerk-fundament { stroke: #4a235a; }

.stabwerk-node {
  fill: #2980b9;
  stroke: #fff;
  stroke-width: 2;
}

.stabwerk-node.fix {
  fill: #c0392b;
}

.stabwerk-node-label {
  font-size: 11px;
  fill: #2c3e50;
}

.stabwerk-diagram-line {
  stroke: #e67e22;
  stroke-width: 2;
}

.stabwerk-diagram-axis {
  stroke: #bdc3c7;
  stroke-width: 1;
}

.stabwerk-diagram-title {
  font-size: 12px;
  font-weight: 600;
  fill: #2c3e50;
}

.stabwerk-stab-summary {
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.stabwerk-stab-row {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.stabwerk-warnungen {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.82rem;
  color: #7d6608;
}

.stabwerk-disclaimer {
  font-size: 0.82rem;
  font-style: italic;
  color: #1a5276;
  background: #eafaf1;
  border-left: 4px solid #117a65;
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
}

.stabwerk-bar-hit {
  stroke: transparent;
  stroke-width: 18;
  cursor: pointer;
}

.stabwerk-bar-selected {
  stroke-width: 6 !important;
  filter: drop-shadow(0 0 4px rgba(230, 126, 34, 0.8));
}

.stabwerk-stab-row {
  cursor: pointer;
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  margin: 0 -0.5rem;
}

.stabwerk-stab-row:hover,
.stabwerk-stab-row-selected {
  background: rgba(26, 82, 118, 0.08);
}

.stabwerk-diagram-popup {
  position: absolute;
  right: 1rem;
  top: 3.5rem;
  width: min(420px, calc(100% - 2rem));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  padding: 1rem 1.25rem;
  z-index: 20;
  opacity: 0;
  transform: scale(0.92) translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.stabwerk-wrapper {
  position: relative;
}

.stabwerk-popup-visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.stabwerk-popup-close {
  position: absolute;
  top: 0.35rem;
  right: 0.5rem;
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.stabwerk-popup-title {
  margin: 0 1.5rem 0.5rem 0;
  font-size: 1rem;
}

.stabwerk-popup-ends {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.stabwerk-popup-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.stabwerk-popup-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.stabwerk-diagram-animated {
  stroke: #e67e22;
  stroke-width: 2;
}

/* --- Historie / Audit-Log (Go-Live UX) --- */

#historie-panel {
  border-left: 3px solid #6c3483;
}

.historie-empty {
  padding: 1.5rem;
  color: var(--muted);
  text-align: center;
}

.historie-meta {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--muted);
}

.historie-status-text.error {
  color: #c0392b;
}

.historie-table-wrap {
  margin: 0 1rem 1rem;
}

.historie-aktion {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}

.historie-aktion-stabwerk_berechnet {
  background: rgba(17, 122, 101, 0.12);
  color: #117a65;
}

.historie-aktion-bemessung_gespeichert {
  background: rgba(26, 82, 118, 0.12);
  color: #1a5276;
}

/* --- Baustelle / Modul D --- */

#baustelle-panel {
  border-left: 3px solid #c0392b;
}

#baustelle-panel label,
#baustelle-panel textarea {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
}

#baustelle-panel textarea {
  min-height: 4rem;
  resize: vertical;
}

.baustelle-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1rem;
  padding: 0 1rem 1rem;
}

.baustelle-wrapper {
  min-height: 420px;
}

.baustelle-sidebar h3 {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.9rem;
}

.baustelle-maengel-list {
  max-height: 280px;
  overflow-y: auto;
}

.mangel-marker {
  cursor: pointer;
}

.mangel-marker-bg {
  fill: #c0392b;
  stroke: #fff;
  stroke-width: 2;
}

.mangel-behoben .mangel-marker-bg {
  fill: #1e8449;
}

.mangel-in_bearbeitung .mangel-marker-bg {
  fill: #d68910;
}

.mangel-marker-icon {
  fill: #fff;
  font-size: 14px;
  font-weight: bold;
  pointer-events: none;
}

.mangel-click-marker {
  fill: none;
  stroke: #2980b9;
  stroke-width: 2;
  stroke-dasharray: 4 2;
}

.mangel-row {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.mangel-row-active {
  border-color: #c0392b;
  background: rgba(192, 57, 43, 0.06);
}

.mangel-badge {
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.mangel-badge-offen { background: #fadbd8; color: #922b21; }
.mangel-badge-in_bearbeitung { background: #fdebd0; color: #7d6608; }
.mangel-badge-behoben { background: #d5f5e3; color: #1e8449; }

.mangel-row-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.soll-ist-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
}

.bau-status-geplant { color: #566573; }
.bau-status-in_ausfuehrung { color: #d68910; }
.bau-status-fertiggestellt { color: #1e8449; }

.baustelle-foto-preview img {
  max-width: 100%;
  border-radius: 6px;
  margin-top: 0.5rem;
}

/* Kalkulation / Rechnungsfreigabe */

.kalkulation-layout {
  padding: 0.75rem 1rem 1.5rem;
}

.kalkulation-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.kalkulation-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.kpi-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}

.kpi-card .kpi-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.s-kurve-wrap {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.s-kurve-wrap h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.s-kurve-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
}

.s-leg-soll { color: #1e5a8a; }
.s-leg-ist { color: #d68910; }
.s-leg-max { color: var(--text-muted); margin-left: auto; }

.s-kurve-svg {
  width: 100%;
  max-width: 760px;
  height: auto;
  display: block;
}

.s-kurve-bg { fill: #fafbfc; }
.s-kurve-grid { stroke: #e8ecf0; stroke-width: 1; }
.s-kurve-soll { stroke: #1e5a8a; }
.s-kurve-ist { stroke: #d68910; stroke-dasharray: 6 4; }
.s-kurve-aktuell { fill: #c0392b; }
.s-kurve-axis { font-size: 11px; fill: #5c6b7a; }

.kalkulation-result {
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.kalkulation-result.result-ok {
  background: #eafaf1;
  border: 1px solid #abebc6;
}

.kalkulation-result.result-warn {
  background: #fff5f5;
  border: 1px solid #f5b7b1;
}

#kalkulation-panel input[type="number"] {
  width: 100%;
  margin-bottom: 0.5rem;
}

.tragwerk-layout {
  padding: 0.75rem 1rem 1.5rem;
}

.tragwerk-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.tragwerk-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.tragwerk-status-planung { background: #ebf5fb; color: #1e5a8a; }
.tragwerk-status-geprueft { background: #fef9e7; color: #9a7d0a; }
.tragwerk-status-freigegeben { background: #eafaf1; color: #1e8449; }

.tragwerk-actions {
  white-space: nowrap;
}

.golive-panel .btn-golive {
  background: linear-gradient(135deg, #1e8449, #1e5a8a);
  color: #fff;
  border: none;
  margin-bottom: 0.5rem;
}

.golive-layout {
  padding: 0.75rem 1rem 1.5rem;
}

.golive-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.golive-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.golive-bereit {
  background: #1e8449;
  color: #fff;
}

.golive-warn {
  background: #fef9e7;
  color: #9a7d0a;
}

.golive-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.golive-schritte-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.golive-schritt {
  display: flex;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.4rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.golive-schritt.golive-ok {
  background: #eafaf1;
  border-color: #abebc6;
}

.golive-schritt.golive-offen {
  background: #fafbfc;
}

.golive-schritt-icon {
  font-weight: bold;
  width: 1.25rem;
}

.golive-modul {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.golive-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.golive-start-log {
  background: #ebf5fb;
  border: 1px solid #aed6f1;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}
