/* NotebookLM-orientiertes Design: dunkler Grund, drei abgerundete Panels,
   blaue Akzente, Pill-Buttons. Light-Variante folgt dem System. */

:root {
  --bg: #1b1c1d;
  --panel: #232527;
  --panel-2: #2a2c2e;
  --panel-3: #323639;
  --border: #3c4043;
  --text: #e3e3e3;
  --muted: #9aa0a6;
  --accent: #8ab4f8;
  --accent-strong: #a8c7fa;
  --accent-ink: #062e6f;
  --ok: #81c995;
  --warn: #fdd663;
  --danger: #f28b82;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f2f4f7;
    --panel: #ffffff;
    --panel-2: #f1f3f4;
    --panel-3: #e8eaed;
    --border: #dadce0;
    --text: #1f1f1f;
    --muted: #5f6368;
    --accent: #0b57d0;
    --accent-strong: #0b57d0;
    --accent-ink: #ffffff;
    --shadow: 0 1px 3px rgba(60,64,67,.15);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Google Sans", "Segoe UI", Roboto, system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* mobile Browserleisten korrekt beruecksichtigen */
  overflow: hidden;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.brand-icon { font-size: 20px; }
.brand-name { font-weight: 500; letter-spacing: .2px; }
.notebook-picker { display: flex; gap: 6px; align-items: center; margin-left: 8px; }
.notebook-picker select {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 14px; font: inherit; max-width: 260px;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.badge {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted);
}
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.err { color: var(--warn); border-color: var(--warn); }

/* ---------- Buttons ---------- */
button { font: inherit; cursor: pointer; color: var(--text); }
.ghost {
  background: transparent; border: none; border-radius: 999px;
  padding: 6px 10px;
}
.ghost:hover { background: var(--panel-3); }
.pill {
  display: inline-block; text-decoration: none; text-align: center;
  background: var(--panel-3); border: none; border-radius: 999px;
  padding: 8px 18px; color: var(--text);
}
.pill.primary { background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.pill.primary:hover { background: var(--accent-strong); }
.pill:disabled { opacity: .5; cursor: default; }

/* ---------- Panels ---------- */
.panels {
  flex: 1; display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr) minmax(250px, 320px);
  gap: 14px; padding: 0 14px 14px; min-height: 0;
}
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 0;
  position: relative;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 500; }
.panel-body { flex: 1; overflow-y: auto; padding: 12px 14px; min-height: 0; }

/* ---------- Quellen ---------- */
.select-all {
  display: flex; gap: 10px; align-items: center;
  padding: 6px 8px 10px; color: var(--muted); font-size: 13px;
  border-bottom: 1px solid var(--border); margin-bottom: 8px; cursor: pointer;
}
.source-list { list-style: none; margin: 0; padding: 0; }
.source-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: 10px;
}
.source-item:hover { background: var(--panel-2); }
.source-item .s-icon { flex: none; width: 20px; text-align: center; }
.source-item .s-title {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.source-item .s-meta { color: var(--muted); font-size: 11px; }
.source-item .s-del { visibility: hidden; }
.source-item:hover .s-del { visibility: visible; }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

/* Pending-/Fehler-Einträge (Ingest-Jobs) */
.source-item.pending .job-meta { color: var(--accent); }
.source-item.failed {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.source-item.failed .s-title { white-space: normal; }
.source-item.failed .job-meta { color: var(--danger); white-space: normal; }
.job-list .s-cancel { flex: none; padding: 4px 8px; }

.spinner {
  flex: none; display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
  vertical-align: -3px;
}
.spinner.small { width: 12px; height: 12px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Drag&Drop-Overlay */
.drop-overlay {
  position: absolute; inset: 0; z-index: 5;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 14%, var(--panel));
  outline: 2px dashed var(--accent); outline-offset: -8px;
  display: flex; align-items: center; justify-content: center;
  text-align: center; pointer-events: none;
}
.drop-inner p { margin: 4px 0; font-weight: 500; }
.drop-inner .muted { font-weight: 400; }

/* ---------- Chat ---------- */
.panel-wide { min-width: 0; }
.chat-head { gap: 10px; }
.chat-tools { display: flex; gap: 4px; align-items: center; min-width: 0; }
.chat-tools select {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 12px; font: inherit; font-size: 12.5px; max-width: 200px;
}
.chat-scroll { display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.msg { max-width: 92%; animation: msgIn .28s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.msg.user {
  align-self: flex-end; background: var(--panel-3);
  border-radius: 18px 18px 4px 18px; padding: 10px 16px;
  white-space: pre-wrap;
}
.msg.assistant { align-self: stretch; padding: 2px 4px; }
.msg.assistant .msg-body p { margin: 0 0 10px; }
.msg.assistant .msg-body ul, .msg.assistant .msg-body ol { margin: 0 0 10px; padding-left: 22px; }
.msg.assistant .msg-body h1, .msg.assistant .msg-body h2, .msg.assistant .msg-body h3 {
  font-size: 15px; margin: 14px 0 6px;
}
.msg.assistant code {
  background: var(--panel-2); border-radius: 4px; padding: 1px 5px;
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace; font-size: 12.5px;
}
.cite {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 4px; margin: 0 1px;
  border-radius: 999px; border: none;
  background: var(--panel-3); color: var(--accent);
  font-size: 11px; font-weight: 600; vertical-align: 2px;
}
.cite:hover { background: var(--accent); color: var(--accent-ink); }
.cite.unverified { background: transparent; outline: 1px dashed var(--muted); color: var(--muted); }
.msg-warn {
  margin-top: 8px; padding: 8px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  color: var(--warn); font-size: 12.5px;
}
.msg-sources { margin-top: 6px; color: var(--muted); font-size: 12px; }
.typing { color: var(--muted); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* Lebende Statuszeile (SSE status-Events) — auch mobil einzeilig mit Ellipse */
.msg-status {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  color: var(--muted); font-size: 12.5px;
  margin: 2px 0 6px;
  animation: msgIn .2s ease;
  transition: opacity .25s ease;
}
.msg-status .ico-sm { flex: none; color: var(--accent); animation: pulse 1.2s infinite; }
.msg-status .status-text {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  animation: pulse 1.2s infinite;
}
.msg-status.gone { opacity: 0; }

/* Dezenter Hinweis bei grounded:'unknown' */
.msg-hint { margin-top: 6px; color: var(--muted); font-size: 12px; }
.msg-hint .ico-inline { margin-right: 4px; color: var(--muted); }

/* Pipeline-Fußzeile („Route: … · 2 Suchläufe · Belege geprüft“) */
.msg-pipeline { margin-top: 5px; color: var(--muted); font-size: 11.5px; }

/* Vorschlagsfragen-Chips */
.suggest-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 14px 0;
}
.suggest-label {
  color: var(--muted); font-size: 12px;
  display: inline-flex; gap: 6px; align-items: center;
}
.suggest-chip {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px;
  font-size: 12.5px; color: var(--accent); text-align: left;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.suggest-chip:hover { background: var(--panel-3); border-color: var(--accent); }
.suggest-gen {
  background: transparent; border: 1px dashed var(--border);
  border-radius: 999px; padding: 6px 14px;
  color: var(--muted); font-size: 12.5px;
}
.suggest-gen:hover { color: var(--accent); border-color: var(--accent); }

.chat-input {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 12px 14px 6px; border-top: none;
}
.chat-input textarea {
  flex: 1; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 22px;
  padding: 11px 18px; font: inherit; line-height: 1.4; outline: none;
  resize: none; max-height: 160px; overflow-y: auto;
}
.chat-input textarea:focus { border-color: var(--accent); }
.send {
  flex: none; width: 42px; height: 42px; border-radius: 999px; border: none;
  background: var(--accent); color: var(--accent-ink); font-size: 16px;
}
.send:disabled { opacity: .4; }
.chat-foot {
  margin: 0; padding: 0 16px 10px; text-align: center;
  color: var(--muted); font-size: 11.5px;
}

.empty .pill { margin-top: 14px; }

/* ---------- Studio ---------- */
.studio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.studio-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 12px; text-align: left; position: relative;
}
.studio-card:hover:not(.disabled) { background: var(--panel-3); border-color: var(--accent); }
.studio-card.disabled { opacity: .45; cursor: default; }
.card-icon { font-size: 20px; }
.soon {
  position: absolute; top: 8px; right: 8px;
  font-size: 10px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px;
}

/* Artefakt-Liste */
.artifact-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.artifact-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px; cursor: pointer;
}
.artifact-item:hover { border-color: var(--accent); }
.artifact-item .card-icon { font-size: 16px; flex: none; }
.artifact-item .a-main { flex: 1; min-width: 0; }
.artifact-item .a-title {
  display: block; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.artifact-item .a-meta {
  display: block; color: var(--muted); font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.artifact-item.pending, .artifact-item.running { cursor: default; }
.artifact-item.failed {
  cursor: default;
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
}
.artifact-item .a-err { color: var(--danger); font-size: 11px; flex: none; }
.artifact-item .a-del { visibility: hidden; flex: none; padding: 4px 8px; }
.artifact-item:hover .a-del { visibility: visible; }

/* Artefakt-Detail */
.artifact-detail-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
#artifactDetail h4 { margin: 0 0 10px; font-size: 14px; }
.coverage-line { margin: -6px 0 10px; font-size: 12px; }
.coverage-line.coverage-warn { color: var(--warn); }

/* Suchabdeckung (agent_report: data.queries_coverage) */
.qc-details { margin: 12px 0 4px; font-size: 12.5px; }
.qc-details summary {
  cursor: pointer; color: var(--muted); list-style-position: inside;
  padding: 4px 0; user-select: none;
}
.qc-details summary:hover { color: var(--text); }
.qc-details summary .ico-sm { margin: 0 4px; }
.qc-details ul {
  list-style: none; margin: 6px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.qc-details li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  background: var(--panel-2); border-radius: 8px; padding: 5px 10px;
}
.qc-query { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qc-stats { flex: none; color: var(--muted); font-size: 11.5px; }
.qc-zero .qc-query, .qc-zero .qc-stats { color: var(--warn); }
.artifact-body { font-size: 13px; }
.artifact-body p { margin: 0 0 8px; }
.artifact-body ul, .artifact-body ol { margin: 0 0 8px; padding-left: 20px; }
.artifact-body h2, .artifact-body h3, .artifact-body h4 { font-size: 13.5px; margin: 12px 0 6px; }
.artifact-body code {
  background: var(--panel-2); border-radius: 4px; padding: 1px 5px;
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace; font-size: 12px;
}

/* Mindmap */

/* ---------- Empty-States ---------- */
.empty { text-align: center; color: var(--text); padding: 40px 16px; margin: auto; }
.empty-icon { font-size: 34px; margin-bottom: 10px; }
.empty p { margin: 4px 0; }
.muted { color: var(--muted); font-size: 12.5px; }

/* ---------- Dialoge ---------- */
dialog {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; width: min(440px, 92vw); box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h3 { margin: 0 0 14px; font-size: 16px; font-weight: 500; }
dialog input[type="url"], dialog input[type="text"], dialog input[type="password"],
dialog input[type="number"], dialog textarea {
  width: 100%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font: inherit; margin-bottom: 10px; outline: none;
}
dialog input[type="file"] {
  width: 100%; color: var(--text); font: inherit; margin-bottom: 10px;
  background: var(--panel-2); border: 1px dashed var(--border);
  border-radius: 10px; padding: 16px 12px;
}
dialog textarea { resize: vertical; }
dialog .row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
dialog input[type="number"] { width: 110px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px; color: var(--muted);
}
.tabs button.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ---------- Zitat-Sheet ---------- */
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 94vw);
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -8px 0 40px rgba(0,0,0,.45);
  display: flex; flex-direction: column; z-index: 20;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.sheet-head h3 { margin: 0; font-size: 15px; font-weight: 500; }
.sheet-body { padding: 16px; overflow-y: auto; }
.sheet-body blockquote {
  margin: 10px 0 16px; padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--panel-2); border-radius: 0 10px 10px 0;
}
.sheet-body mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; }
.cit-context h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.cit-context p { white-space: pre-wrap; font-size: 13px; }
.verify-badge { font-size: 12px; margin: 0 0 4px; }
.verify-neighbor { color: var(--muted); font-size: 11px; }
.verify-badge.exact { color: var(--ok); }
.verify-badge.fuzzy { color: var(--warn); }
.verify-badge.unverified { color: var(--danger); }
.sheet .pill { margin-top: 14px; }

/* =====================================================================
   Responsive: drei Stufen.
   Desktop  (>1120px): drei fluide Spalten.
   Tablet   (761-1120px): Quellen | Chat; Studio als Drawer von rechts.
   Mobil    (<=760px): App-Shell — ein Panel, Tab-Bar unten, Bottom-Sheets.
   ===================================================================== */

.tabbar { display: none; }
.drawer-scrim {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(0, 0, 0, .45);
}
.drawer-toggle.active { background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* Enger werdende Topbar: erst Badge, dann Button-Beschriftungen einklappen */
@media (max-width: 1250px) { #llmBadge { display: none; } }
@media (max-width: 950px) { .btn-label { display: none; } }

/* ---------- Tablet: Studio wird zum Drawer ---------- */
@media (max-width: 1120px) and (min-width: 761px) {
  .panels { grid-template-columns: minmax(230px, 280px) minmax(0, 1fr); }
  #studioPanel {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
    width: min(360px, 92vw);
    border-radius: 0; border-right: none; border-top: none; border-bottom: none;
    transform: translateX(102%);
    transition: transform .25s ease;
    box-shadow: -12px 0 40px rgba(0, 0, 0, .45);
  }
  body.studio-open #studioPanel { transform: translateX(0); }
  #studioDrawerBtn[hidden] { display: inline-block !important; } /* JS blendet nur mobil aus */
}

/* ---------- Mobil: ein Panel + Tab-Bar ---------- */
@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 8px 10px; }
  .brand { gap: 0; }
  .brand-name { display: none; }               /* Icon reicht — Platz fuers Notebook */
  #llmBadge { display: none; }
  .notebook-picker { flex: 1; min-width: 0; margin-left: 0; }
  .notebook-picker select { flex: 1; min-width: 0; max-width: none; }
  .topbar-right { gap: 2px; }

  .panels { display: block; padding: 0; min-height: 0; overflow: hidden; }
  .panel {
    display: none;
    height: 100%;
    border-radius: 0; border-left: none; border-right: none; border-bottom: none;
  }
  body[data-active-panel="sourcesPanel"] #sourcesPanel,
  body[data-active-panel="chatPanel"] #chatPanel,
  body[data-active-panel="studioPanel"] #studioPanel { display: flex; }

  .tabbar {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    border-top: 1px solid var(--border);
    background: var(--panel);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar button {
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 0 6px;
    background: none; border: none; color: var(--muted);
    font-size: 11px;
  }
  .tabbar button.active { color: var(--accent); }
  .tabbar .tab-icon { font-size: 20px; line-height: 1; }
  .tab-badge {
    position: absolute; top: 4px; left: calc(50% + 8px);
    min-width: 16px; height: 16px; padding: 0 4px;
    background: var(--accent); color: var(--accent-ink);
    border-radius: 999px; font-size: 10px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .tab-badge.alert { background: var(--danger); color: #1b1c1d; }

  /* Eingaben: >=16px verhindert den iOS-Auto-Zoom */
  .chat-input textarea, .chat-input input,
  dialog input, dialog textarea, dialog select { font-size: 16px; }
  .chat-input { padding: 10px 10px calc(10px + env(safe-area-inset-bottom) * 0); }

  /* Fundstellen: Bottom-Sheet statt Seitenleiste */
  .sheet {
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100%; max-height: 78dvh;
    border-left: none; border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .5);
    animation: sheet-up .22s ease;
    padding-bottom: env(safe-area-inset-bottom);
  }
  @keyframes sheet-up { from { transform: translateY(30%); opacity: .4; } }

  /* Dialoge: fast vollflaechig, innen scrollbar */
  dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    padding: 18px;
  }

  /* Benachrichtigungen: volle Breite unter der Topbar */
  .notify-dropdown {
    position: fixed; top: 52px; left: 8px; right: 8px;
    width: auto; max-height: min(60dvh, 480px);
  }

  /* Chips (Spange/Vorschlaege): horizontal wischen statt umbrechen */
  .chip-row { flex-wrap: nowrap; overflow-x: auto; max-width: none;
              scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip { flex: none; }

  .msg { max-width: 100%; }
  .studio-cards { grid-template-columns: 1fr 1fr; }
  .chat-tools select { max-width: 120px; }
}

/* ---------- Touch: Hover-Aktionen immer zeigen, Ziele vergroessern ---------- */
@media (hover: none) {
  .source-item .s-del, .source-item .s-sched,
  .connector-item .s-sync, .artifact-item .a-del,
  .task-item .t-del { visibility: visible; }
  .ghost { padding: 9px 12px; }
  .source-item { padding: 12px 8px; }
  .cite { min-width: 22px; height: 22px; font-size: 12px; }
  .notify-item, .tabbar button { -webkit-tap-highlight-color: transparent; }
}

/* ---------- Sehr breite Bildschirme: Chat lesbar halten ---------- */
@media (min-width: 1500px) {
  .chat-scroll, .chat-input { max-width: 860px; width: 100%; margin-inline: auto; }
}

/* ---------- hidden-Attribut gewinnt auch gegen display-Klassen ---------- */
[hidden] { display: none !important; }

/* ---------- Spange & Chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; max-width: 520px; }
.chip-row-wrap { max-width: none; margin-bottom: 10px; }
.chip {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px;
  font-size: 12.5px; color: var(--muted);
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip:hover { border-color: var(--accent); }
.chip.on {
  background: color-mix(in srgb, var(--accent) 18%, var(--panel-2));
  border-color: var(--accent); color: var(--accent);
}
#spangeToggle.active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}
.spange-off .studio-cards .studio-card { opacity: .45; pointer-events: none; }
.spange-note { margin: 0 0 10px; }
#spangeHint { padding: 28px 12px; }

/* ---------- Sektionen im Quellen-/Studio-Panel ---------- */
.section-label {
  display: block; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px; padding: 4px 8px 6px;
}
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 18px; border-top: 1px solid var(--border); padding-top: 10px;
}
.section-head .section-label { padding: 0 0 0 8px; }
#connectorSection { border-bottom: 1px solid var(--border); margin-bottom: 8px; padding-bottom: 6px; }
.connector-item .s-sync { flex: none; visibility: hidden; padding: 4px 8px; }
.connector-item:hover .s-sync { visibility: visible; }

/* ---------- Zeitplan je Quelle ---------- */
.source-item .s-sched { visibility: hidden; flex: none; padding: 4px 8px; }
.source-item:hover .s-sched { visibility: visible; }
.sched-ind { margin-left: 5px; font-size: 11px; color: var(--accent); }

.popover {
  position: fixed; z-index: 40; width: 240px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.5);
  padding: 12px;
}
.pop-title { font-size: 12.5px; font-weight: 500; margin-bottom: 8px; }
.popover select {
  width: 100%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 10px; font: inherit; margin-bottom: 8px;
}
.popover .pill { width: 100%; }
.popover .muted { margin: 8px 0 0; }

/* ---------- Benachrichtigungen ---------- */
.notify-wrap { position: relative; }
#notifyBtn { position: relative; }
.notify-badge {
  position: absolute; top: -2px; right: -4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--danger); color: #1b1c1d;
  border-radius: 999px; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.notify-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  width: min(340px, 92vw); max-height: 420px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.notify-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 8px 8px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 500;
}
.notify-head .ghost { font-size: 12px; color: var(--accent); }
.notify-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.notify-item:last-child { border-bottom: none; }
.notify-item:hover { background: var(--panel-2); }
.notify-item .n-top { display: flex; justify-content: space-between; gap: 10px; }
.notify-item .n-title { font-size: 13px; font-weight: 500; }
.notify-item .n-time { color: var(--muted); font-size: 11px; flex: none; }
.notify-item .n-body { color: var(--muted); font-size: 12px; }
.notify-empty { padding: 16px 14px; margin: 0; }

/* ---------- Teilen-Dialog ---------- */
.share-h { margin: 16px 0 8px; font-size: 13px; font-weight: 500; }
.member-list { display: flex; flex-direction: column; gap: 6px; }
.member-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px 8px 6px 12px;
}
.member-row .m-main { flex: 1; min-width: 0; }
.member-row .m-name { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-row .m-mail { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog select {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 10px; font: inherit;
}
.member-row select { flex: none; padding: 5px 8px; font-size: 12px; }
.member-add { display: flex; gap: 8px; align-items: center; }
.member-add select { margin-bottom: 0; }
#memberUserSelect { flex: 1; min-width: 0; }
.key-warn {
  color: var(--warn); font-size: 12.5px;
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border-radius: 10px; padding: 8px 12px;
}
.key-row { display: flex; gap: 8px; align-items: center; }
.key-row input {
  flex: 1; margin-bottom: 0 !important;
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace; font-size: 12px;
}
.key-row .pill { flex: none; }

/* ---------- Agent-Auftraege ---------- */
#tasksSection .artifact-list { margin-top: 10px; }
.task-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px;
}
.task-item.off .a-main { opacity: .5; }
.task-item .a-main { flex: 1; min-width: 0; }
.task-item .ghost { flex: none; padding: 4px 8px; }
.task-item .t-del { visibility: hidden; }
.task-item:hover .t-del { visibility: visible; }
.badge-mini {
  display: inline-block; font-size: 10px; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--border));
  border-radius: 999px; padding: 0 7px; vertical-align: 1px;
}
.radio-col { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.radio-col select { margin-left: 6px; padding: 5px 8px; font-size: 12.5px; }
dialog .row input[type="radio"] { accent-color: var(--accent); }

/* ---------- Zitat-Sheet: Speicher-Label (Spange) ---------- */
.cit-coll {
  display: inline-block; margin: 0 0 6px;
  font-size: 11px; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--border));
  border-radius: 999px; padding: 2px 10px;
}


/* ---------- Mindmap (eigener SVG-Renderer) ---------- */
.km8-mindmap {
  position: relative;
  height: clamp(320px, 55vh, 560px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.km8-mindmap-svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.km8-mindmap-svg:active { cursor: grabbing; }
.mm-node:focus { outline: none; }
.mm-toolbar {
  position: absolute; right: 10px; bottom: 10px;
  display: flex; gap: 6px;
}
.mm-toolbar button {
  width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 15px; line-height: 1;
}
.mm-toolbar button:hover { background: var(--panel-3); }
.km8-mindmap.mm-full {
  position: fixed; inset: 12px; z-index: 70;
  height: auto;
  box-shadow: 0 12px 60px rgba(0, 0, 0, .6);
}
body.mm-full-open { overflow: hidden; }
@media (max-width: 760px) {
  .km8-mindmap { height: clamp(300px, 60dvh, 520px); border-radius: 10px; }
  .km8-mindmap.mm-full { inset: 6px; }
  .mm-toolbar button { width: 40px; height: 40px; }
}


/* ---------- Icon-System (Inline-SVG-Sprite, Lucide-Stil) ---------- */
.ico {
  width: 18px; height: 18px; flex: none;
  stroke-width: 2; vertical-align: -4px;
  color: inherit;
}
.ico-sm { width: 15px; height: 15px; vertical-align: -3px; }
.ico-xs { width: 12px; height: 12px; vertical-align: -2px; }
.ico-lg { width: 22px; height: 22px; }
.ico-xl { width: 40px; height: 40px; color: var(--muted); stroke-width: 1.5; }
.ico-tab { width: 21px; height: 21px; }
.ico-brand { width: 21px; height: 21px; color: var(--accent); vertical-align: -5px; }
.ico-src { width: 17px; height: 17px; color: var(--muted); }
.ico-inline { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; }
button .ico, .pill .ico { pointer-events: none; }
.ghost { display: inline-flex; align-items: center; justify-content: center; }
.send .ico { width: 20px; height: 20px; }
.empty-icon { margin-bottom: 12px; }
.section-label .ico-sm { margin-right: 4px; vertical-align: -3px; }
.key-warn .ico-inline { color: var(--warn); }
.msg-warn .ico-inline { margin-right: 4px; }
.tabs button { display: inline-flex; align-items: center; }
.card-icon .ico-lg { color: var(--accent); stroke-width: 1.8; }
.mm-toolbar button { display: inline-flex; align-items: center; justify-content: center; }
