*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, sans-serif; background: #0f172a; color: #e2e8f0; min-height: 100vh; }

/* ── HEADER ──────────────────────────────── */
header { padding: 1.25rem 2rem; background: #1e293b; border-bottom: 1px solid #334155; display: flex; align-items: center; gap: 1rem; }
header h1 { font-size: 1.1rem; font-weight: 600; }
header a { color: #64748b; font-size: .85rem; text-decoration: none; }
header a:hover { color: #94a3b8; }

/* ── DATASET PICKER (step 0) ─────────────── */
.dataset-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .9rem 2rem;
  background: #172033;
  border-bottom: 1px solid #334155;
}
.dataset-bar label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #94a3b8;
}
.dataset-bar select {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #3b82f6;
  border-radius: 6px;
  padding: .45rem .7rem;
  font-size: .85rem;
  cursor: pointer;
}
.dataset-bar select:hover { background: #1e293b; }
.dataset-hint { font-size: .78rem; color: #64748b; }

/* ── MODE SWITCHER ───────────────────────── */
.mode-bar { display: flex; gap: .5rem; margin-bottom: 2rem; }
.mode-bar.sm { margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.mode-btn { background: #1e293b; border: 1px solid #334155; color: #94a3b8; padding: .6rem 1.2rem; border-radius: 6px; cursor: pointer; font-size: .88rem; transition: all .2s; flex: 1; }
.mode-bar.sm .mode-btn { padding: .4rem .8rem; font-size: .75rem; }
.mode-btn:hover { background: #334155; color: #f8fafc; }
.mode-btn.active { background: #3b82f6; border-color: #3b82f6; color: white; box-shadow: 0 4px 12px rgba(59,130,246,0.3); }

/* ── LAYOUT ──────────────────────────────── */
.layout { display: grid; grid-template-columns: 1fr 360px; gap: 0; height: calc(100vh - 115px); }
.left { overflow-y: auto; padding: 1.5rem 2rem; display: flex; flex-direction: column; gap: 1.5rem; }
.right { background: #1e293b; border-left: 1px solid #334155; display: flex; flex-direction: column; }

/* ── SECTION BLOCKS ──────────────────────── */
.section { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 1rem 1.25rem; }
.section-title {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bulk-actions {
  font-size: 0.75rem;
  text-transform: none;
  font-weight: 400;
}

.bulk-link {
  color: var(--accent);
  cursor: pointer;
}
.bulk-link:hover { text-decoration: underline; }

.lb-komps-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}

.lb-item { border: 1px solid #334155; border-radius: 6px; margin-bottom: .4rem; overflow: hidden; }
.lb-header { padding: .6rem .9rem; cursor: pointer; display: flex; align-items: center; gap: .6rem; background: #0f172a; }
.lb-header:hover { background: #172033; }
.lb-nr { font-size: .72rem; font-weight: 700; color: #64748b; min-width: 2.5rem; }
.lb-text { font-size: .83rem; color: #cbd5e1; flex: 1; }
.lb-toggle { color: #475569; font-size: .75rem; }
.lb-komps { padding: .5rem .9rem .75rem 1.8rem; display: flex; flex-direction: column; gap: .4rem; background: #0a1628; }
.lb-komps.hidden { display: none; }
.komp-row { display: flex; align-items: flex-start; gap: .6rem; padding: .45rem .6rem; border-radius: 5px; cursor: pointer; border: 1px solid transparent; transition: all .15s; }
.komp-row:hover { background: #1e293b; border-color: #334155; }
.komp-row.sel { background: #1e3a5f; border-color: #3b82f6; }
.komp-nr { font-size: .7rem; font-weight: 700; color: #64748b; min-width: 2.8rem; }
.komp-text { font-size: .8rem; color: #cbd5e1; }

/* ── CHIPS ───────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { padding: .35rem .75rem; border-radius: 20px; border: 1px solid #334155; background: #0f172a; color: #94a3b8; cursor: pointer; font-size: .82rem; transition: all .15s; }
.chip:hover { border-color: #64748b; color: #e2e8f0; }
.chip.sel { background: #1d4ed8; border-color: #3b82f6; color: #fff; }
.chip.sel-green { background: #166534; border-color: #22c55e; color: #fff; }

/* ── THEMA CARDS ─────────────────────────── */
.thema-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem; }
.thema-card { padding: .75rem 1rem; border-radius: 8px; border: 2px solid #334155; background: #0f172a; cursor: pointer; transition: all .15s; }
.thema-card:hover { border-color: #64748b; }
.thema-card.sel { border-color: #3b82f6; background: #1e3a5f; }
.thema-card .t-nr { font-size: .7rem; color: #64748b; font-weight: 700; }
.thema-card .t-title { font-size: .85rem; color: #e2e8f0; margin-top: .2rem; }
.thema-card .t-lj { font-size: .7rem; color: #64748b; margin-top: .15rem; }

/* ── LEBENSBEZUG TREE ────────────────────── */
.lb-item { border: 1px solid #334155; border-radius: 6px; margin-bottom: .4rem; overflow: hidden; }
.lb-header { padding: .6rem .9rem; cursor: pointer; display: flex; align-items: center; gap: .6rem; background: #0f172a; }
.lb-header:hover { background: #172033; }
.lb-nr { font-size: .72rem; font-weight: 700; color: #64748b; min-width: 2.5rem; }
.lb-text { font-size: .83rem; color: #cbd5e1; flex: 1; }
.lb-toggle { color: #475569; font-size: .75rem; }
.lb-komps { padding: .5rem .9rem .75rem 1.8rem; display: flex; flex-direction: column; gap: .4rem; background: #0a1628; }
.lb-komps.hidden { display: none; }
.komp-row { display: flex; align-items: flex-start; gap: .6rem; padding: .45rem .6rem; border-radius: 5px; cursor: pointer; border: 1px solid transparent; transition: all .15s; }
.komp-row:hover { background: #1e293b; border-color: #334155; }
.komp-row.sel { background: #1e3a5f; border-color: #3b82f6; }
.komp-nr { font-size: .7rem; font-weight: 700; color: #64748b; min-width: 2.8rem; }
.komp-text { font-size: .8rem; color: #cbd5e1; }

/* ── GESELLSCHAFTLICHE INHALTE ───────────── */
.gi-list { display: flex; flex-direction: column; gap: .4rem; }
.gi-row { display: flex; align-items: flex-start; gap: .6rem; padding: .45rem .6rem; border-radius: 5px; cursor: pointer; border: 1px solid #334155; background: #0f172a; transition: all .15s; }
.gi-row:hover { border-color: #64748b; }
.gi-row.sel { background: #1c3a2a; border-color: #22c55e; }
.gi-aspekt { font-size: .75rem; font-weight: 700; color: #94a3b8; min-width: 5rem; }
.gi-detail { font-size: .78rem; color: #cbd5e1; }

/* ── PROMPT PANEL ────────────────────────── */
.prompt-header { padding: 1rem 1.25rem; border-bottom: 1px solid #334155; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #64748b; display: flex; align-items: center; justify-content: space-between; }
.prompt-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; }
.prompt-pre { font-size: .78rem; line-height: 1.6; color: #cbd5e1; white-space: pre-wrap; font-family: 'Consolas', monospace; }
.prompt-empty { color: #475569; font-size: .83rem; padding-top: 2rem; text-align: center; }
.prompt-actions { padding: .75rem 1.25rem; border-top: 1px solid #334155; display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── BUTTONS ─────────────────────────────── */
.btn { padding: .45rem .9rem; border-radius: 5px; border: 1px solid #334155; background: #334155; color: #e2e8f0; cursor: pointer; font-size: .82rem; transition: all .15s; }
.btn:hover { background: #475569; }
.btn.primary { background: #2563eb; border-color: #3b82f6; }
.btn.primary:hover { background: #1d4ed8; }
.btn.sm { padding: .3rem .6rem; font-size: .75rem; }

/* ── OUTPUT TYPE SELECT ──────────────────── */
.output-select { padding: .4rem .7rem; background: #0f172a; border: 1px solid #334155; border-radius: 5px; color: #e2e8f0; font-size: .82rem; width: 100%; margin-top: .5rem; }

/* ── UTILS ───────────────────────────────── */
.hidden { display: none !important; }
.dim { opacity: .4; pointer-events: none; }

/* ── INTERIM-HINWEIS (Orientierungsbeispiel) ── */
.pb-note { font-size: .78rem; color: #6b21a8; background: #f5f3ff; border: 1px solid #e9d5ff; border-radius: 6px; padding: 6px 10px; margin: 8px 0; }

/* ── R-PROGRESSIONS-BADGE (R1 hell → R6 dunkel) ── */
.r-badge { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 9px; font-size: .62rem; font-weight: 700; vertical-align: middle; }

/* ─── Werkstatt-Bruecke ──────────────────────────────────────────────────────
   Liste der Einheiten, die zur aktuellen Auswahl passen, mit Sprung in deren
   Werkstatt. `target="_top"` in den Links ist Pflicht: die Sub-App laeuft unter
   /prompt-builder im iframe, ein normaler Link laedt bbw-hko in sich selbst.
   Eigene Hoehe mit Scroll, damit die Prompt-Vorschau darunter nicht wegrutscht —
   `.layout` rechnet mit einer festen Hoehe. */
.wk-panel { border-top: 1px solid #334155; padding: .75rem 1.25rem; max-height: 38%;
  overflow-y: auto; background: #182234; }
.wk-head { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #94a3b8; margin-bottom: .35rem; }
.wk-hint { font-size: .75rem; line-height: 1.45; color: #cbd5e1; margin: 0 0 .6rem; }
.wk-row { display: flex; align-items: center; gap: .5rem; justify-content: space-between;
  padding: .45rem .6rem; border: 1px solid #334155; border-radius: 6px; margin-bottom: .35rem;
  text-decoration: none; background: #1e293b; }
.wk-row:hover { border-color: #0E6E3A; background: #1b2b3a; }
.wk-row-main { min-width: 0; }
.wk-row-title { display: block; font-size: .82rem; font-weight: 600; color: #e2e8f0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-row-meta { display: block; font-size: .7rem; color: #94a3b8; }
.wk-row-go { flex: none; font-size: .72rem; font-weight: 600; color: #6ee7a8; white-space: nowrap; }

/* ─── Werkstatt-Panel ────────────────────────────────────────────────────────
   Schublade rechts ueber dem Builder; der Builder bleibt dahinter unveraendert. */
.wkp { position: fixed; top: 0; right: 0; bottom: 0; width: min(980px, 100vw); z-index: 50;
  display: flex; flex-direction: column; background: #f8fafc;
  border-left: 1px solid #334155; box-shadow: -12px 0 32px rgba(0,0,0,.45); }
.wkp-bar { display: flex; align-items: center; gap: .75rem; padding: .55rem .9rem;
  background: #182234; border-bottom: 1px solid #334155; }
.wkp-title { flex: 1; min-width: 0; font-size: .85rem; font-weight: 600; color: #e2e8f0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wkp-bar a.btn { text-decoration: none; }
#wkp-frame { flex: 1; width: 100%; border: 0; background: #fff; }
