/*! Werkbank 1.0 – GUI-Framework für Editor-Webanwendungen
 *  Abgeleitet aus der Oberfläche von „Grundriss → IFC“.
 *  Theming: CSS-Variablen in :root überschreiben (z. B. --accent).
 */
:root {
  --bg: #f4f3ef;
  --panel: #fbfaf7;
  --ink: #1d2327;
  --muted: #6b7378;
  --line: #dedbd2;
  --line-strong: #c5c1b5;
  --chip: #efede7;
  --chip-hover: #e3e0d8;
  --accent: #1f5fbf;
  --accent-ink: #fff;
  --accent-soft: #e3ecf9;
  --sel: #e0462f;
  --ok: #2f8a4f;
  --warn: #b7791f;
  --err: #c0392b;
  --radius: 8px;
  --wb-left: 290px;
  --wb-right: 300px;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  font-family: var(--sans);
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body.wb-root { display: flex; flex-direction: column; font-size: 13.5px; overflow: hidden; }
.wb-root h2 { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0; font-weight: 600; }
.wb-root h3 { margin: 0 0 6px; font-weight: 600; font-size: 14px; }
.wb-root input, .wb-root select, .wb-root textarea, .wb-root button { font: inherit; color: inherit; }
.wb-root input:not([type=checkbox]):not([type=range]):not([type=radio]), .wb-root select, .wb-root textarea {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; min-width: 0;
}
.wb-root input:focus, .wb-root select:focus, .wb-root textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.wb-root textarea { resize: vertical; }
.wb-root label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.wb-root label.wb-chk { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: 12.5px; }
.wb-root input[readonly] { background: #f6f5f1; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.45; }
.mono { font-family: var(--mono); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .err { color: var(--err); }
[hidden] { display: none !important; }

/* ---------- Kopfleiste ---------- */
.wb-topbar { display: flex; align-items: center; gap: 20px; padding: 9px 16px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.wb-brand { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--accent); white-space: nowrap; }
.wb-brand > span:last-child { color: var(--ink); }
.wb-brand-icon { display: inline-flex; }
.wb-steps { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; counter-reset: s; }
.wb-steps li { counter-increment: s; font-size: 12px; color: var(--muted); padding: 4px 10px 4px 6px; border-radius: 99px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.wb-steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); font-size: 11px; }
.wb-steps li.done { color: var(--ink); }
.wb-steps li.done::before { background: var(--ok); border-color: var(--ok); color: #fff; content: '✓'; }
.wb-steps li.current { background: var(--accent-soft); color: var(--accent); }
.wb-steps li.current::before { border-color: var(--accent); }
.wb-top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wb-root label.wb-proj { flex-direction: row; align-items: center; gap: 6px; }
.wb-proj input { width: 190px !important; }

/* ---------- Buttons ---------- */
.wb-btn { border: 1px solid var(--line); background: #fff; padding: 7px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: var(--ink) !important; }
.wb-btn:hover { border-color: var(--line-strong); }
.wb-btn.primary { background: var(--accent); color: var(--accent-ink) !important; border-color: var(--accent); }
.wb-btn.primary:hover { filter: brightness(1.08); }
.wb-btn.ghost { background: transparent; }
.wb-btn.danger { color: var(--err) !important; border-color: #efc6c0; }
.wb-btn.small { padding: 4px 9px; font-size: 12px; }
.wb-btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.wb-btn.wide { flex: 1; }
.wb-icon-btn { border: 1px solid var(--line); background: #fff; width: 26px; height: 26px; border-radius: 6px; cursor: pointer; line-height: 1; padding: 0; }
.wb-icon-btn:hover { border-color: var(--line-strong); }
.wb-link { background: none; border: 0; color: var(--accent); padding: 6px 0 0; cursor: pointer; font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; }
.wb-row { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.wb-row.wrap { flex-wrap: wrap; }
.wb-row.end { justify-content: flex-end; }

/* ---------- Layout ---------- */
.wb-layout { flex: 1; display: grid; grid-template-columns: var(--wb-left) minmax(0, 1fr) var(--wb-right); min-height: 0; }
.wb-layout.no-right { grid-template-columns: var(--wb-left) minmax(0, 1fr); }
.wb-panel { background: var(--panel); overflow-y: auto; min-height: 0; }
.wb-panel.left { border-right: 1px solid var(--line); }
.wb-panel.right { border-left: 1px solid var(--line); }
.wb-sec { padding: 12px 16px 14px; border-bottom: 1px solid var(--line); }
.wb-sec-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; min-height: 22px; }
.wb-sec-head h2 { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 6px; }
.wb-sec-head h2::before { content: '▾'; font-size: 9px; transition: transform .15s; }
.wb-sec.collapsed .wb-sec-head { margin-bottom: 0; }
.wb-sec.collapsed .wb-sec-head h2::before { transform: rotate(-90deg); }
.wb-sec.collapsed .wb-sec-body { display: none; }
.wb-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.wb-span2 { grid-column: 1 / -1; }
.wb-subhead { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 6px; font-weight: 600; }

/* ---------- Listen ---------- */
.wb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.wb-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.wb-list li:hover { background: #f0eee8; }
.wb-list li.active { background: var(--accent-soft); border-color: #c6d6f1; }
.wb-list .nm { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-list .meta { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.wb-list .del { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; }
.wb-list .del:hover { color: var(--err); }

/* ---------- Dropzone ---------- */
.wb-drop { border: 1.5px dashed #c9c5ba; border-radius: var(--radius); padding: 18px 12px; text-align: center; cursor: pointer; background: #fff; color: var(--ink) !important; }
.wb-drop:hover, .wb-drop.over { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Status / Fortschritt ---------- */
.wb-status { margin-top: 10px; font-size: 12.5px; line-height: 1.45; }
.wb-bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.wb-bar i { display: block; height: 100%; width: 40%; background: var(--accent); animation: wb-slide 1.2s ease-in-out infinite; }
@keyframes wb-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

/* ---------- Bühne + Werkzeugleiste ---------- */
.wb-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.wb-toolbar { display: flex; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; align-items: center; }
.wb-tgroup { display: flex; gap: 2px; background: var(--chip); border-radius: 7px; padding: 2px; align-items: center; }
.wb-tgroup.right { margin-left: auto; background: none; gap: 12px; }
.wb-tool { border: 0; background: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; font-size: 12.5px; white-space: nowrap; }
.wb-tool:hover { background: var(--chip-hover); }
.wb-tool.active { background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.12); color: var(--accent); font-weight: 500; }
.wb-tool:disabled { opacity: .4; cursor: default; background: none; }
.wb-root label.wb-mini { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); white-space: nowrap; }
.wb-seg { display: flex; background: var(--chip); border-radius: 7px; padding: 2px; }
.wb-seg-btn { border: 0; background: none; padding: 5px 12px; border-radius: 5px; cursor: pointer; font-weight: 500; }
.wb-seg-btn.active { background: var(--ink); color: #fff; }
.wb-views { position: relative; flex: 1; min-height: 0; }
.wb-canvas-wrap { position: absolute; inset: 0; background: #e9e8e3; overflow: hidden; }
.wb-canvas-wrap.grid-bg { background: #fff; background-image: linear-gradient(#eef1f5 1px, transparent 1px), linear-gradient(90deg, #eef1f5 1px, transparent 1px); background-size: 24px 24px; }
.wb-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.wb-pane { position: absolute; inset: 0; overflow: auto; background: var(--bg); }
.wb-hint { position: absolute; left: 12px; bottom: 12px; background: rgba(29,35,39,.86); color: #fff; padding: 6px 10px; border-radius: 6px; font-size: 12px; pointer-events: none; max-width: 70%; line-height: 1.4; }
.wb-hint:empty { display: none; }
.wb-hint { transition: opacity .6s; }
.wb-hint.fade { opacity: 0; }
.wb-badge { position: absolute; right: 12px; bottom: 12px; background: rgba(255,255,255,.94); border: 1px solid var(--line); padding: 4px 8px; border-radius: 6px; font-family: var(--mono); font-size: 11.5px; pointer-events: none; }
.wb-badge:empty { display: none; }
.wb-empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 40px; pointer-events: none; }
.wb-empty p { max-width: 420px; color: var(--muted); line-height: 1.5; margin: 0 auto; }
.wb-float { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.15); width: 280px; }

/* ---------- Eigenschaften / Kennzahlen ---------- */
.wb-props { display: flex; flex-direction: column; gap: 8px; }
.wb-props .wb-type { font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.wb-props .wb-type small { font-family: var(--mono); color: var(--muted); font-weight: 400; }
.wb-stats { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-size: 12.5px; }
.wb-stats dt { color: var(--muted); } .wb-stats dd { margin: 0; font-family: var(--mono); text-align: right; }
.wb-notes { font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; }

/* ---------- Meldungsliste ---------- */
.wb-msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto; }
.wb-msgs li { display: flex; gap: 8px; font-size: 12.5px; line-height: 1.35; padding: 5px 6px; border-radius: 5px; cursor: pointer; }
.wb-msgs li:hover { background: #f0eee8; }
.wb-msgs li::before { content: '●'; font-size: 9px; line-height: 17px; }
.wb-msgs li.err::before { color: var(--err); } .wb-msgs li.warn::before { color: var(--warn); } .wb-msgs li.info::before { color: var(--accent); }
.wb-msgs li { color: var(--ink); }

/* ---------- Tabs + Tabellen ---------- */
.wb-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 10px 16px 0; background: var(--panel); position: sticky; top: 0; z-index: 2; flex-wrap: wrap; }
.wb-tab { border: 1px solid transparent; border-bottom: 0; background: none; padding: 7px 12px; border-radius: 6px 6px 0 0; cursor: pointer; color: var(--muted); margin-bottom: -1px; }
.wb-tab.active { background: var(--bg); border-color: var(--line); color: var(--ink); font-weight: 500; }
.wb-tab .cnt { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: 4px; }
.wb-tabbody { padding: 16px; }
.wb-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.wb-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.wb-table th { text-align: left; font-weight: 600; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: #f7f6f2; position: sticky; top: 0; }
.wb-table th, .wb-table td { padding: 6px 10px; border-bottom: 1px solid #ecebe5; vertical-align: top; }
.wb-table td.mono { font-family: var(--mono); font-size: 12px; }
.wb-table tr:hover td { background: #fafaf7; }
.wb-table tr.group td { background: #f3f2ee; font-weight: 600; }

/* ---------- Modal-Dialog ---------- */
.wb-modal { position: fixed; inset: 0; background: rgba(29,35,39,.32); display: grid; place-items: center; z-index: 60; padding: 16px; }
.wb-dlg { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.25); width: min(380px, 100%); padding: 18px; max-height: 90vh; overflow: auto; }
.wb-dlg.wide { width: min(560px, 100%); }
.wb-dlg p { margin: 0 0 10px; }
.wb-dlg.xl { width: min(1000px, 100%); }
.wb-dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.wb-dlg-head h3 { margin: 0; }
.wb-modal-body .wb-table td .wb-btn { padding: 3px 8px; font-size: 12px; }
.wb-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--chip); color: var(--muted); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.wb-chip.ok { background: #e3f1e7; color: var(--ok); }
.wb-chip.warn { background: #fbefd9; color: var(--warn); }
.wb-chip.err { background: #f8e1de; color: var(--err); }
.wb-chip::before { content: '●'; font-size: 9px; }

/* ---------- Toast ---------- */
.wb-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; font-size: 13px; z-index: 70; max-width: 90vw; }
.wb-toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- Responsiv ---------- */
@media (max-width: 1150px) {
  .wb-layout { grid-template-columns: 260px minmax(0, 1fr); }
  .wb-panel.right { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); border-left: 0; border-top: 1px solid var(--line); max-height: 38vh; }
  .wb-steps { display: none; }
}
@media (max-width: 760px) {
  body.wb-root { overflow: auto; height: auto; }
  .wb-layout { grid-template-columns: 1fr; }
  .wb-stage { min-height: 72vh; order: -1; }
  .wb-panel.right { max-height: none; }
  .wb-top-actions { margin-left: 0; }
  .wb-proj input { width: 140px !important; }
  .wb-hint { display: none; }
}
