:root {
  --bg: #f2f5f4;
  --surface: #ffffff;
  --surface-2: #e9eeec;
  --surface-3: #dfe6e4;
  --ink: #1b2a2f;
  --muted: #5c6c71;
  --faint: #8a9a9e;
  --line: #d5ddda;
  --accent: #0b6b60;
  --accent-ink: #ffffff;
  --accent-tint: #dfeeea;
  --warn: #96660a;
  --warn-tint: #f5ebd4;
  --error: #a33a2e;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1615;
    --surface: #17211f;
    --surface-2: #1c2826;
    --surface-3: #24312f;
    --ink: #e3eae8;
    --muted: #97a7a3;
    --faint: #6e7f7b;
    --line: #2a3734;
    --accent: #43bfae;
    --accent-ink: #0c1b18;
    --accent-tint: #16302c;
    --warn: #d6a44a;
    --warn-tint: #33290f;
    --error: #e0796c;
  }
}

* { box-sizing: border-box; margin: 0; }

html, body, #root { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.app { display: flex; flex-direction: column; height: 100%; }

.spacer { flex: 1; }
.hint { color: var(--faint); font-size: 12.5px; }

/* ---------- Titelleiste ---------- */
.titlebar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: 0.02em; }
.titlebar .path { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- Einstellungen (im Popup) ---------- */
.settings {
  font-size: 13px;
}
.settings-row { display: flex; gap: 8px; margin-top: 8px; align-items: flex-start; }

/* Anpassbare Prüfungen */
.check-editor { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.check-instr {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; background: var(--surface-2);
}
.check-instr-head { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check-instr-titel { font-weight: 600; font-size: 13px; }
.check-instr-state { margin-left: auto; }
.check-instr-off { opacity: 0.72; }
.check-instr-desc { margin: 6px 0 8px; }
.check-instr-param { font-size: 13px; margin-bottom: 8px; }
.check-instr textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink);
  font-family: var(--sans); font-size: 13px;
}
.check-editor > .btn { align-self: flex-start; }
.settings-heading { margin-top: 14px; }
.settings-row textarea {
  flex: 1; resize: vertical;
  padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink);
  font-family: var(--sans); font-size: 13px;
}
.settings-row input {
  flex: 1; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink);
  font-family: var(--mono);
}

/* ---------- Buttons ---------- */
.btn {
  font-size: 12.5px; font-weight: 600;
  padding: 6px 14px; border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  cursor: pointer; font-family: var(--sans);
}
.btn:hover { background: var(--surface-3); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { opacity: 0.9; background: var(--accent); }
.btn-primary:disabled { opacity: 0.4; cursor: default; }
.btn-small { padding: 3px 10px; font-size: 11.5px; }

/* ---------- Spalten ---------- */
.panes { display: flex; flex: 1; min-height: 0; }

.explorer {
  width: 280px; flex: none;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  display: flex; flex-direction: column;
}
.pane-label {
  font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--faint); font-weight: 700; padding: 12px 14px 6px;
  display: flex; align-items: center; justify-content: space-between;
}
.section-action { text-transform: none; letter-spacing: normal; }

.sidebar-section { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.sidebar-section.grow {
  border-bottom: none; flex: 1;
  display: flex; flex-direction: column; min-height: 0;
}

.chat-panel {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex; flex-direction: column;
  max-height: 45%;
}
.chat-panel-search { margin: 0 0 6px; }
.chat-panel-list { overflow-y: auto; padding: 0; max-height: 55vh; }
.chat-divider { border-top: 1px solid var(--line); margin: 4px 8px; }
.chat-row .name { font-size: 12.5px; }
.chat-link { color: var(--faint); font-size: 11px; }
.chat-actions { display: none; margin-left: auto; gap: 2px; }
.chat-row:hover .chat-actions { display: inline-flex; }
.mini-btn {
  border: none; background: none; cursor: pointer;
  color: var(--muted); font-size: 12px; padding: 1px 4px; border-radius: 4px;
}
.mini-btn:hover { background: var(--surface-3); }
.fav-star { margin-left: auto; color: var(--warn); font-size: 11px; }
.tree-search {
  margin: 2px 12px 8px;
  padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink);
  font-family: var(--sans); font-size: 12.5px;
}
.tree-search::placeholder { color: var(--faint); }

.root-select {
  max-width: 420px;
  font-family: var(--mono); font-size: 12px;
  color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 8px;
}

.search-count { padding: 2px 8px 6px; }
.deep-label {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--line);
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 10px;
}
.search-hit { display: flex; flex-direction: column; min-width: 0; }
.search-hit .name { overflow: hidden; text-overflow: ellipsis; }
.search-parent {
  font-size: 10.5px; color: var(--faint);
  overflow: hidden; text-overflow: ellipsis;
}

.tree { flex: 1; overflow-y: auto; padding: 0 6px 12px; }
.tree .hint { padding: 8px; }

.row {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 8px; border-radius: 6px;
  white-space: nowrap; cursor: pointer; user-select: none;
}
.row:hover { background: var(--surface-3); }
.row.active { background: var(--accent-tint); }
.caret { color: var(--faint); font-size: 9px; width: 10px; flex: none; }
.ico { width: 16px; flex: none; text-align: center; font-size: 12.5px; }
.row .name { overflow: hidden; text-overflow: ellipsis; }
.row.file .name { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.row.active .name { color: var(--ink); }
.count { margin-left: auto; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.row-open { margin-left: auto; color: var(--faint); font-size: 12px; }

/* ---------- Explorer-Kopf (Zurück + Pfad, wie am PC) ---------- */
.explorer-nav {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px 6px;
}
.breadcrumb {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  flex: 1; min-width: 0; font-size: 12.5px;
}
.crumb-wrap { display: inline-flex; align-items: center; gap: 2px; min-width: 0; }
.crumb-sep { color: var(--faint); padding: 0 2px; }
.crumb { color: var(--accent); cursor: pointer; }
.crumb:hover { text-decoration: underline; }
.crumb.current { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

.chat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fname { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  color: var(--muted); padding: 40px; text-align: center;
}

.badge {
  font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 99px;
  background: var(--warn-tint); color: var(--warn);
  white-space: nowrap;
}

/* ---------- Entwurf-Karten im Chat ---------- */
.draft-cards { padding: 4px 12px 0; display: flex; flex-direction: column; gap: 8px; }
.draft-card {
  border: 1px solid var(--warn); border-radius: 10px;
  background: var(--warn-tint); padding: 10px 12px;
}
.draft-card-head { display: flex; align-items: center; gap: 8px; }
.draft-card-name { font-family: var(--mono); font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-note { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.draft-card-body {
  margin: 8px 0 0; padding: 8px 10px;
  background: var(--surface); border-radius: 6px;
  font-family: var(--mono); font-size: 12px;
  white-space: pre-wrap; word-break: break-word;
  max-height: 300px; overflow: auto;
}
.draft-card-actions { display: flex; align-items: center; gap: 6px; margin-top: 8px; }

/* ---------- Chat (jetzt Hauptfläche) ---------- */
.chat {
  flex: 1; min-width: 0;
  background: var(--surface-2);
  display: flex; flex-direction: column;
}
.chat.dragover {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
  background: var(--accent-tint);
}
/* Ziel-Hervorhebung beim Ziehen von PC-Dateien in den Explorer */
.row.dropover {
  background: var(--accent-tint);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 6px;
}
.tree.dropover-tree {
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
  background: var(--accent-tint);
}
.chat-head {
  display: flex; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  font-weight: 600; font-size: 13px;
}
.chat-body {
  flex: 1; overflow-y: auto;
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
  font-size: 13px;
}
.msg-user {
  align-self: flex-end; max-width: 88%;
  background: var(--accent); color: var(--accent-ink);
  padding: 9px 13px; border-radius: 12px 12px 3px 12px;
  white-space: pre-wrap;
}
.msg-ai {
  align-self: flex-start; max-width: 94%;
  background: var(--surface); border: 1px solid var(--line);
  padding: 10px 13px; border-radius: 12px 12px 12px 3px;
}
.msg-text { line-height: 1.5; }
/* Leichtgewichtiges Markdown im Chat */
.md-p { margin: 0 0 8px; }
.md-p:last-child { margin-bottom: 0; }
.md-h { font-weight: 700; margin: 10px 0 6px; }
.md-h:first-child { margin-top: 0; }
.md-h1 { font-size: 16px; }
.md-h2 { font-size: 15px; }
.md-h3, .md-h4, .md-h5, .md-h6 { font-size: 13.5px; }
.md-list { margin: 4px 0 8px; padding-left: 20px; }
.md-list:last-child { margin-bottom: 0; }
.md-list li { margin: 2px 0; }
.md-code {
  font-family: var(--mono); font-size: 12px;
  background: var(--surface-2); border-radius: 4px; padding: 1px 5px;
}
.filelink {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-weight: 600;
}
.filelink:hover { opacity: 0.8; }
.msg-error { color: var(--error); font-size: 12.5px; }

/* Ampelzeile am Kopf eines Prüfberichts (statt rohem „STATUS: ROT —“) */
.msg-ampel { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.msg-ampel .ampel { margin-top: 0; }
.msg-ampel b { font-size: 13.5px; }

/* Automatische Prüfung: schlanke, aufklappbare System-Zeile (keine Nutzer-Blase) */
.auto-note { align-self: center; max-width: 94%; width: 100%; }
.auto-note-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: 1px dashed var(--line); border-radius: 8px;
  padding: 6px 12px; cursor: pointer;
  color: var(--muted); font-size: 12.5px; font-family: var(--sans);
}
.auto-note-head:hover { background: var(--surface-2); }
.auto-note-head .hint { margin-left: auto; }
.auto-note-body {
  margin: 6px 0 0; padding: 8px 12px;
  background: var(--surface-2); border-radius: 8px;
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  white-space: pre-wrap; word-break: break-word;
}
.steps {
  list-style: none; padding: 0; margin: 0 0 8px;
  font-size: 12px; color: var(--muted);
}
.steps li { padding: 2px 0; }

.attachments {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 14px 0;
  border-top: 1px solid var(--line);
}
.attachment-chip {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 99px; padding: 3px 6px 3px 10px;
  font-size: 12px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.chip-x {
  border: none; background: var(--surface-3); color: var(--muted);
  border-radius: 50%; width: 17px; height: 17px; line-height: 1;
  cursor: pointer; font-size: 13px; padding: 0;
}
.chip-x:hover { background: var(--error); color: #fff; }

.chat-input {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 12px 14px;
}
.attachments + .chat-input { border-top: none; }
.chat-body + .chat-input { border-top: 1px solid var(--line); }
/* ---------- Auswahl → Chat ---------- */
.sel-btn {
  position: fixed; z-index: 250;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* ---------- Original-Ansicht (PDF & Bilder) ---------- */
.pdf-frame { flex: 1; width: 100%; border: none; background: var(--surface-2); }
.img-wrap {
  flex: 1; overflow: auto;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 20px; background: var(--surface-2);
}
.img-view { max-width: 100%; height: auto; border-radius: 6px; }

/* ---------- Verlauf (Vorversionen) ---------- */
.history-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 20px; border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.history-panel { border-bottom: 1px solid var(--line); }
.history-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 20px; border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}
.history-row:last-child { border-bottom: none; }
.history-date { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.history-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Cockpit (Prüfungen & Meldungen) ---------- */
.cockpit { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cockpit-toolbar { display: flex; align-items: center; gap: 12px; padding: 2px 2px 10px; }
.cockpit-list { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.check-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px;
  cursor: pointer;
}
.check-card:hover { background: var(--surface-3); }
.check-done { opacity: 0.55; }
.check-body { flex: 1; min-width: 0; }
.check-title { font-size: 13.5px; }
.check-summary { font-size: 13px; margin-top: 2px; }
.check-meta { margin-top: 4px; font-variant-numeric: tabular-nums; }
.check-actions { display: flex; gap: 6px; flex: none; }
.check-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.check-activity {
  font-size: 13px; margin-top: 6px; padding: 4px 8px; width: fit-content;
  color: var(--accent); background: var(--accent-tint); border-radius: 6px;
}
.check-draft-hint {
  font-size: 13px; margin-top: 6px; padding: 4px 8px; width: fit-content;
  color: var(--warn); background: var(--warn-tint); border-radius: 6px;
}
.ampel {
  width: 12px; height: 12px; border-radius: 50%;
  flex: none; margin-top: 4px;
}
.ampel-rot { background: #c0392b; box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.18); }
.ampel-gelb { background: #d9a217; box-shadow: 0 0 0 3px rgba(217, 162, 23, 0.18); }
.ampel-gruen { background: #2e8b57; box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.18); }
.ampel-unbekannt { background: var(--faint); }
.ampel-vorbei { background: var(--faint); }

/* Terminampel: anstehende Montagen kompakt über den Meldungen */
.termin-block {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 14px 10px;
}
.termin-heading { margin-bottom: 4px; }
.termin-row {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 0; font-size: 13.5px; cursor: pointer;
}
.termin-row:hover { background: var(--surface-3); border-radius: 6px; }
.termin-row .ampel { margin-top: 0; }
.termin-dringend { color: var(--warn); font-weight: 600; }

.cockpit-link .name { font-size: 13px; }
.badge-count {
  margin-left: auto;
  background: #c0392b; color: #fff;
  font-size: 10.5px; font-weight: 700;
  border-radius: 99px; padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}
.badge-draft { background: var(--warn); }

/* ---------- Meldungen (Ereignis-Automatik) ---------- */
.toasts {
  position: fixed; left: 16px; bottom: 16px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px; max-width: 340px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 10px 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  font-size: 13px; cursor: pointer;
}
.toast-done { border-left-color: var(--warn); }
.toast-open { color: var(--accent); font-weight: 600; white-space: nowrap; }

.settings-check {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; font-size: 13px; cursor: pointer;
}

/* ---------- Kontextmenü & Dialog ---------- */
.ctxmenu {
  position: fixed; z-index: 100;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  display: flex; flex-direction: column; min-width: 210px;
}
.ctxmenu button {
  text-align: left; padding: 7px 12px;
  border: none; background: none; color: var(--ink);
  font-family: var(--sans); font-size: 13px;
  border-radius: 5px; cursor: pointer;
}
.ctxmenu button:hover { background: var(--surface-3); }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.35);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 20px;
  width: 420px; max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}
/* Große Arbeits-Modals (Einstellungen, Cockpit, Leads): fast Vollbild,
   damit Tabellen und lange Eingaben Platz haben. */
.modal-wide {
  width: min(1280px, calc(100vw - 48px));
  height: calc(100vh - 48px);
}
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.modal input {
  padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface-2); color: var(--ink);
  font-family: var(--sans); font-size: 13.5px;
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
/* Cockpit füllt im Popup die Breite, ohne eigene feste Höhe */
.modal .cockpit { min-height: 0; }
.modal .cockpit-list { max-height: calc(100vh - 220px); padding: 4px 0; }

.chat-input textarea {
  flex: 1; resize: none;
  padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font-family: var(--sans); font-size: 13px;
}

/* ---------- Posteingang (IMAP) ---------- */
.mailbox { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.mail-list { overflow-y: auto; flex: 1; }
.mail-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 13px;
}
.mail-row:hover { background: var(--surface-2); }
.mail-dot { width: 12px; color: var(--accent); font-size: 10px; flex: none; }
.mail-from { width: 200px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.mail-unseen .mail-from, .mail-unseen .mail-subject { font-weight: 650; color: var(--ink); }
.mail-subject { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-clip { flex: none; }
.mail-date { flex: none; font-variant-numeric: tabular-nums; }
.mail-footnote { padding: 6px 14px; border-top: 1px solid var(--line); margin: 0; }
.mail-meta {
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px;
  font-size: 13px; background: var(--surface-2);
}
.mail-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.mail-body { flex: 1; }
.mail-settings { margin-top: 14px; }
.mail-form input { font-family: var(--sans); }
.mail-port { width: 70px; flex: none; }
.dir-picker {
  max-height: 260px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface-2); padding: 4px 0;
}
.mail-file-options { display: flex; flex-direction: column; gap: 4px; }
.mail-saved-list { margin: 0; padding-left: 20px; font-size: 13px; }

/* ---------- Mail-Automatik (Zuordnen-Karten & Absender-Liste) ---------- */
.mail-excerpt {
  margin-top: 6px; padding: 8px 10px;
  background: var(--surface-2); border-radius: 6px;
  font-size: 12.5px; color: var(--muted);
  white-space: pre-wrap; word-break: break-word;
  max-height: 120px; overflow: hidden;
}
.sender-list { margin-top: 10px; }
.sender-row { align-items: center; }
.sender-row input { min-width: 0; }
.sender-name { max-width: 180px; }
.sender-subdir { max-width: 120px; }

/* ---- Einstellungen: Reiter statt Endlos-Scrollen ---- */
.settings-tabs {
  display: flex;
  gap: 0.3em;
  border-bottom: 1px solid var(--line);
  margin: 0.4em 0 0.9em;
  flex-wrap: wrap;
}
.settings-tab {
  border: none;
  background: none;
  font: inherit;
  color: var(--muted);
  padding: 0.45em 0.8em;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.settings-tab:hover {
  color: var(--ink);
}
.settings-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ---- Leads-Reiter: Pipeline-Tabelle ---- */
.lead-filter { display: flex; gap: 6px; margin-bottom: 10px; align-items: center; }
.lead-filter button {
  padding: 4px 11px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--muted); cursor: pointer; font-size: 12.5px;
}
.lead-filter button.active { background: var(--surface-2); color: var(--ink); border-color: var(--ink); font-weight: 600; }
.lead-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lead-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--faint); padding: 6px 8px; border-bottom: 1px solid var(--line);
}
.lead-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lead-table select, .lead-table input { width: 100%; box-sizing: border-box; }
.lead-name { font-weight: 600; white-space: nowrap; padding-top: 4px; }
.lead-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.lead-badge {
  font-size: 11px; padding: 1px 7px; border-radius: 9px;
  background: var(--warn-tint); color: var(--warn); white-space: nowrap;
}
.lead-badge-rot { background: rgba(192, 57, 43, 0.15); color: #c0392b; }
.lead-zeile-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.lead-timeline td { background: var(--surface-2); }

/* Sprach-Diktat: 🎤 am Eingabefeld — rot pulsierend während der Aufnahme */
.mic-btn {
  min-width: 2.6em;
}
.mic-live {
  background: #c62828 !important;
  color: #fff !important;
  animation: micpuls 1.2s ease-in-out infinite;
}
@keyframes micpuls {
  50% {
    opacity: 0.55;
  }
}

/* ---- Mobil/Tablet (Browser übers WLAN — gleiche App, andere Aufteilung) ---- */

/* Untere Navigation: nur auf schmalen Bildschirmen sichtbar (React rendert sie
   dort auch nur, das CSS hier ist die Absicherung fürs Fenster-Verkleinern) */
.mobilnav {
  display: flex;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 2px 4px calc(2px + env(safe-area-inset-bottom));
  flex: none;
}
.mobilnav button {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 19px;
  padding: 6px 0 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: pointer;
}
.mobilnav button span { font-size: 10.5px; }
.mobilnav button.aktiv { color: var(--accent); font-weight: 600; }

/* Tablet quer: beide Spalten, Explorer etwas schmaler */
@media (max-width: 1150px) and (min-width: 901px) {
  .explorer { width: 240px; }
}

/* Handy / Tablet hochkant: EINE Spalte, Wechsel über die untere Navigation */
@media (max-width: 900px) {
  .app.m-chat .explorer { display: none; }
  .app.m-dateien .explorer { width: 100%; border-right: none; }
  .app.m-dateien .chat { display: none; }

  .titlebar { flex-wrap: wrap; gap: 8px; row-gap: 4px; padding-top: 6px; padding-bottom: 6px; }
  .titlebar .path { display: none; }

  /* Popups (Einstellungen, Cockpit, Leads) füllen den Bildschirm */
  .modal { width: calc(100vw - 20px); max-height: calc(100dvh - 24px); }
  .modal-wide { width: 100vw; height: 100dvh; max-width: 100vw; border-radius: 0; }

  /* Fingertaugliche Trefferflächen */
  .btn { padding: 9px 14px; }
  .btn-small { padding: 6px 10px; }
  .mini-btn { padding: 6px 9px; }
  .row { min-height: 36px; }
  .chat-input textarea { font-size: 16px; } /* verhindert iOS-Auto-Zoom */

  /* Aktions-Knöpfe an Chat-Zeilen: ohne Maus-Hover immer zeigen */
  .chat-actions { display: inline-flex; }
}
