/* =====================================================================
   Jarvis Design-System – Tokens (Dark = Standard, Light per data-theme)
   Kontraste nach WCAG 2.2 AA geprueft (siehe docs/02-Analyse-Frontend.md)
   Schriften: selbst gehostet bzw. Systemschriften (keine Google-Server, DSGVO)
   ===================================================================== */
:root, [data-theme="dark"] {
  --bg: #0B0F1A;
  --surface-1: #121826;
  --surface-2: #1A2233;
  --surface-glass: rgba(18, 24, 38, 0.86);
  --border: #2A3447;
  --border-strong: #5B6B85;
  --text: #E6EAF2;
  --text-muted: #94A3B8;
  --cyan: #22D3EE;
  --violet: #A78BFA;
  --primary: #7C3AED;
  --primary-hover: #6D28D9;
  --on-primary: #FFFFFF;
  --ok: #34D399;
  --warn: #FBBF24;
  --bad: #FB7185;
  --chart: #0EA5C6; /* per validate_palette.js geprueft (dark, Flaeche #121826) */
  --grid: #2A3447;
  --bubble-user: #1E2A44;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --glow: 0 0 0 1px rgba(34, 211, 238, .12), 0 8px 40px rgba(124, 58, 237, .18);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F8FAFC;
  --surface-1: #FFFFFF;
  --surface-2: #F1F5F9;
  --surface-glass: rgba(255, 255, 255, 0.9);
  --border: #E2E8F0;
  --border-strong: #64748B;
  --text: #0F172A;
  --text-muted: #475569;
  --cyan: #0E7490;
  --violet: #7C3AED;
  --primary: #7C3AED;
  --primary-hover: #6D28D9;
  --on-primary: #FFFFFF;
  --ok: #047857;
  --warn: #B45309;
  --bad: #BE123C;
  --chart: #0891B2; /* per validate_palette.js geprueft (light, Flaeche #FFFFFF) */
  --grid: #E2E8F0;
  --bubble-user: #EDE9FE;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --glow: 0 0 0 1px rgba(14, 116, 144, .12), 0 8px 30px rgba(124, 58, 237, .10);
  color-scheme: light;
}
:root {
  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Space Grotesk", "Inter", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, "SF Mono", monospace;
  --r-card: 14px;
  --r-field: 10px;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 85% -10%, rgba(124, 58, 237, .10), transparent 60%),
                    radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, .07), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.01em; margin: 0; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.15rem; }
a { color: var(--cyan); }
code, .mono { font-family: var(--font-mono); font-size: .86em; }
.muted { color: var(--text-muted); }
.small { font-size: .82rem; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.error-text { color: var(--bad); }
.danger-text { color: var(--bad) !important; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }
h1:focus, h1:focus-visible { outline: none; } /* programmatischer Fokus nach Navigation (Screenreader) */
.icon { flex: none; vertical-align: -3px; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 18px 14px; border-right: 1px solid var(--border); background: var(--surface-glass);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.brand-sub { color: var(--text-muted); font-size: .78rem; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-spacer { flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; min-height: 40px; border-radius: 10px;
  color: var(--text-muted); text-decoration: none; font-weight: 500; position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(124, 58, 237, .22), rgba(34, 211, 238, .08)); color: var(--text); }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--cyan); }
.badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: .75rem; display: inline-grid; place-items: center; font-weight: 600; }
.badge-dot { position: absolute; top: -4px; right: -6px; margin: 0; min-width: 18px; height: 18px; font-size: .68rem; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  border-bottom: 1px solid var(--border); background: var(--surface-glass); backdrop-filter: blur(14px);
}
.tenant { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(52, 211, 153, .15); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--border); }
.avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem;
  background: linear-gradient(135deg, var(--primary), #0891B2); color: #fff; }
.content { padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }
/* Oeffentliche Adresse / Tunnel (Kanaele) */
.public-address { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.public-address h2 { margin: 0; font-size: 1.05rem; }
.public-address code { padding: 6px 10px; border-radius: 8px; background: var(--surface-2, rgba(255,255,255,.04)); border: 1px solid var(--border); }
.tunnel-problem { color: var(--warn); }
.refresh-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.refresh-list li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.refresh-ok > span:first-child { color: var(--ok); }
.refresh-manual > span:first-child, .refresh-failed > span:first-child { color: var(--warn); }
.narrow-field { max-width: 460px; }
/* Protokoll (Einstellungen) */
.log-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.log-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.log-err { color: #F87171; } .log-warn { color: var(--warn); }
.chip-err { border-color: rgba(248, 113, 113, .5); color: #F87171; }
.log-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.log-list li { padding: 8px 10px; border-left: 3px solid var(--warn); background: var(--surface-2); border-radius: 6px; min-width: 0; }
.log-list li.log-error, .log-list li.log-critical { border-left-color: #F87171; }
.log-list li.log-ok { border-left-color: var(--ok); }
.alert-box { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
.log-msg { overflow-wrap: anywhere; } .log-cat { overflow-wrap: anywhere; }
/* ---- Webradio */
.radio-control > button { position: relative; }
.radio-control .radio-on { color: var(--cyan); }
.radio-live { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, .2); }
.radio-panel { width: min(360px, calc(100vw - 32px)); }
.radio-hud .radio-panel { top: 40px; color: var(--text); text-align: left; }
.radio-now { display: flex; align-items: center; gap: 10px; }
.radio-name { font-weight: 600; overflow-wrap: anywhere; }
.radio-logo { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; background: var(--surface-2); flex: none; }
.radio-logo-empty { display: grid; place-items: center; color: var(--text-muted); }
.radio-volume { display: flex; align-items: center; gap: 8px; }
.radio-volume input { flex: 1; accent-color: var(--primary); }
.radio-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.radio-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; border-radius: 8px; background: none; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.radio-item:hover, .radio-item:focus-visible { background: var(--surface-2); }
.radio-sub { margin-top: 4px; text-transform: uppercase; letter-spacing: .06em; font-size: .7rem; }

/* ---- Kontakte */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 14px; }
.contact-card { cursor: pointer; }
.contact-card:hover, .contact-card:focus-visible { border-color: var(--cyan); }
.file-btn { position: relative; overflow: hidden; }

/* ---- Geteilte Liste (ohne Anmeldung) */
.shared-list { max-width: 640px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 14px; min-height: 100vh; }
.shared-title { margin: 0; font-size: 1.5rem; }
.share-box { display: grid; gap: 10px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: 12px; }
.share-link { font-family: var(--font-mono); font-size: .8rem; overflow-wrap: anywhere; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; }

/* ---- Dokumente (Post-Scan) */
.scan-drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; border: 2px dashed var(--border-strong); border-radius: 14px; text-align: center; cursor: pointer; color: var(--cyan); }
.scan-drop:hover, .scan-drop:focus-within { background: var(--surface-2); }
.scan-drop.busy { cursor: progress; opacity: .8; }
.scan-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.scan-title { font-weight: 600; color: var(--text); }
.spin { animation: orb-spin 1s linear infinite; }
.docs-toolbar { margin: 18px 0 10px; }
.doc-card p { margin: 0; }
.doc-title { font-size: 1.05rem; margin: 2px 0 0; overflow-wrap: anywhere; }
.doc-deadline { display: flex; align-items: center; gap: 6px; font-size: .88rem; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); }
.doc-deadline.soon { color: var(--warn); border: 1px solid rgba(251, 191, 36, .45); }

/* ---- Erinnerungen & Listen */
.planner-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.input-narrow { width: auto; min-width: 0; flex: 0 1 auto; }
.input-sm { min-height: 30px; padding: 4px 8px; font-size: .85rem; width: 150px; }
.gap-xs { gap: 4px; }
.warn-text { color: var(--warn); }
.chip-mini { min-height: 18px; padding: 0 8px; font-size: .7rem; margin-left: 6px; }
.timer-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.timer-row .chip-btn { min-height: 30px; padding: 2px 12px; }
.group-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin: 8px 0 0; font-weight: 600; }
.reminder-list, .todo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.reminder { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-1); }
.reminder-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); color: var(--cyan); flex: none; }
.reminder.kind-timer .reminder-icon { color: var(--warn); }
.reminder.kind-birthday .reminder-icon { color: #F472B6; }
.reminder.kind-deadline .reminder-icon { color: var(--bad); }
.reminder-body { flex: 1; min-width: 0; }
.reminder-text { overflow-wrap: anywhere; }
.todo { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; }
.todo:hover { background: var(--surface-2); }
.todo-check { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; overflow-wrap: anywhere; }
.todo-check input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.todo.done .todo-check span { text-decoration: line-through; color: var(--text-muted); }
.done-block summary { cursor: pointer; color: var(--text-muted); padding: 6px 0; }
.list-tabs { flex-wrap: wrap; }
.list-tabs .badge { margin-left: 4px; }

.briefing-preview { margin: 0; font: .9rem/1.55 var(--font-body, inherit); background: var(--surface-2); padding: 12px 14px; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-tail { max-height: 420px; overflow: auto; font: .75rem/1.45 var(--font-mono); background: var(--surface-2); padding: 10px; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Kalender-Abos (Fahrten) */
.calendar-feeds { margin-bottom: 20px; }
.connect-status { display: grid; gap: 6px; }
.connect-code { font: 700 1.3rem var(--font-mono); letter-spacing: .12em; padding: 4px 10px; }
.feed-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border); }
.feed-row .grow { min-width: 0; }
details.help summary { cursor: pointer; color: var(--primary); font-size: .9rem; }
details.help ul { margin: 8px 0; padding-left: 18px; display: grid; gap: 4px; }
/* Sicherheitshinweis (z. B. Start-Passwort noch aktiv) */
.security-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 24px;
  border-bottom: 1px solid rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .10); color: var(--warn); font-weight: 600; }
.security-banner span { flex: 1 1 220px; }
.security-warning { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .10); color: var(--warn); }
.boot { min-height: 100vh; display: grid; place-items: center; }
.only-mobile { display: none !important; }

/* ---------- Bausteine ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; }
.panel .section-title:first-child { margin-top: 0; }
.small-title { font-size: 1rem; }
.panel, .card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-card); padding: 18px; box-shadow: var(--shadow); }
.glass { background: var(--surface-glass); backdrop-filter: blur(16px); border: 1px solid var(--border); box-shadow: var(--glow); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.gap-s { gap: 8px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.w-full { width: 100%; }
.w-auto { width: auto !important; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 16px; }
.card-grid > * { min-width: 0; }
.narrow { max-width: 640px; }
.center-self { align-self: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 16px;
  border-radius: 10px; border: 1px solid transparent; font: 600 .92rem var(--font); cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--bad); color: #1a0b10; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: .82rem; }
.btn-lg { min-height: 46px; font-size: 1rem; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn-sm { width: 30px; height: 30px; }

.input, .field input, .field select, .field textarea, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border-radius: var(--r-field); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font: inherit; min-height: 40px;
}
textarea.input { resize: vertical; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--cyan); outline-offset: 0; border-color: transparent; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; color: var(--text-muted); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 12px 0 16px; }
.span-2 { grid-column: span 2; }
.search-box { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: var(--r-field); border: 1px solid var(--border-strong); background: var(--surface-2); min-height: 40px; color: var(--text-muted); }
.search-box input { border: 0; background: transparent; color: var(--text); font: inherit; outline: none; width: 100%; min-height: 38px; }
.search-box:focus-within { outline: 2px solid var(--cyan); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; min-height: 24px; border-radius: 999px; font-size: .78rem; font-weight: 500;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border); text-decoration: none; white-space: nowrap; }
.chip-mono { font-family: var(--font-mono); font-size: .72rem; color: var(--text-muted); white-space: normal; overflow-wrap: anywhere; max-width: 100%; border-radius: 12px; }
.chip-accent { border-color: rgba(34, 211, 238, .45); color: var(--cyan); }
.chip-warn { border-color: rgba(251, 191, 36, .5); color: var(--warn); }
.chip-ok, .status-sent, .status-published { border-color: rgba(52, 211, 153, .5); color: var(--ok); }
.chip-bad, .status-failed, .status-rejected { border-color: rgba(251, 113, 133, .5); color: var(--bad); }
.status-pending, .status-scheduled { border-color: rgba(251, 191, 36, .5); color: var(--warn); }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text-muted); font: 500 .85rem var(--font); cursor: pointer; }
.chip-btn.active, .chip-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--cyan); }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-row .search-box { margin-left: auto; min-width: 220px; }

.segmented, .tabs { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.segmented button, .tabs button { border: 0; background: transparent; color: var(--text-muted); font: 600 .84rem var(--font); padding: 6px 12px; border-radius: 8px; cursor: pointer; min-height: 30px; display: inline-flex; gap: 6px; align-items: center; }
.segmented button.active, .tabs button.active { background: var(--surface-1); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.tabs-wide { margin-bottom: 16px; flex-wrap: wrap; }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .88rem; color: var(--text); user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-ui { width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .2s; flex: none; }
.toggle-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked + .toggle-ui { background: var(--primary); }
.toggle input:checked + .toggle-ui::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-ui { outline: 2px solid var(--cyan); outline-offset: 2px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .88rem; }
.notice { border: 1px solid rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .07); border-radius: 10px; padding: 10px 12px; font-size: .85rem; }
.quote { border-left: 3px solid var(--violet); padding: 6px 12px; background: var(--surface-2); border-radius: 0 8px 8px 0; margin-top: 6px; }
.empty-mini { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 40px 20px; color: var(--text-muted); height: 100%; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table.compact td { padding: 6px 10px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(5, 8, 15, .6); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; }
.modal { width: min(640px, 100%); max-height: 90vh; overflow: auto; background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: var(--glow), var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.modal-wide { width: min(860px, 100%); }

.dropdown { position: relative; }
.click-away { position: fixed; inset: 0; z-index: 15; } /* unter der Kopfzeile (z 20), ueber dem Inhalt */
.dropdown-panel { z-index: 30; position: absolute; right: 0; top: 46px; width: 360px; max-height: 70vh; overflow: auto; background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.notif { padding: 10px; border-radius: 10px; background: var(--surface-2); border-left: 3px solid var(--cyan); }
.notif-approval { border-left-color: var(--warn); }
.notif-title { font-weight: 600; font-size: .88rem; }
.notif-body { font-size: .84rem; color: var(--text-muted); white-space: pre-wrap; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 16px; border-radius: 10px; background: var(--surface-1); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: .9rem; max-width: 420px; animation: toast-in .2s ease-out; }
.toast-success { border-left: 4px solid var(--ok); }
.toast-error { border-left: 4px solid var(--bad); }
.toast-warn { border-left: 4px solid var(--warn); }
.toast-info { border-left: 4px solid var(--cyan); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Orb (KI-Signal) ---------- */
.orb { width: var(--orb-size); height: var(--orb-size); position: relative; flex: none; }
.orb-glow { position: absolute; inset: -18%; border-radius: 50%; background: radial-gradient(circle, rgba(34, 211, 238, .35), rgba(124, 58, 237, .15) 45%, transparent 70%); filter: blur(calc(var(--orb-size) * .08)); animation: orb-pulse 4s ease-in-out infinite; }
.orb-ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, #22D3EE, #8B5CF6, #22D3EE 60%, #8B5CF6, #22D3EE); animation: orb-spin 8s linear infinite;
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%); mask: radial-gradient(circle, transparent 58%, #000 60%); opacity: .9; }
.orb-core { position: absolute; inset: 14%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #A5F3FC, #22D3EE 25%, #7C3AED 70%, #1E1B4B); box-shadow: inset 0 0 calc(var(--orb-size) * .12) rgba(255, 255, 255, .25); animation: orb-breathe 4s ease-in-out infinite; }
.orb-thinking .orb-ring { animation-duration: 1.6s; }
.orb-thinking .orb-core { animation-duration: 1.2s; }
.orb-speaking .orb-core { animation: orb-talk .5s ease-in-out infinite alternate; }
@keyframes orb-spin { to { transform: rotate(360deg); } }
@keyframes orb-pulse { 50% { opacity: .55; transform: scale(.94); } }
@keyframes orb-breathe { 50% { transform: scale(.94); } }
@keyframes orb-talk { from { transform: scale(.9); } to { transform: scale(1.02); } }

/* ---------- Anmeldung ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); border-radius: 22px; padding: 34px 30px; display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
.login-card > .orb { align-self: center; }
.login-title { text-align: center; font-size: 2rem; background: linear-gradient(90deg, var(--cyan), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Chat ---------- */
.chat-layout { display: grid; grid-template-columns: 270px 1fr; gap: 18px; height: calc(100vh - 110px); }
.conv-list { display: flex; flex-direction: column; gap: 12px; padding: 14px; min-height: 0; }
.conv-items { overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.conv-item { display: flex; align-items: center; border-radius: 10px; }
.conv-item:hover, .conv-item.active { background: var(--surface-2); }
.conv-item.active { box-shadow: inset 3px 0 0 var(--cyan); }
.conv-link { flex: 1; min-width: 0; padding: 8px 10px; color: var(--text); text-decoration: none; }
.conv-title { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-scroll { flex: 1; overflow: auto; padding: 4px 4px 16px; scroll-padding-bottom: 120px; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 6vh 10px 20px; max-width: 760px; margin: 0 auto; }
.hero-title { font-size: 2rem; background: linear-gradient(90deg, var(--text), var(--violet) 55%, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 10px; }
.suggestion { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; min-height: 56px; transition: border-color .15s, transform .15s; }
.suggestion:hover { border-color: var(--cyan); transform: translateY(-1px); }
.suggestion .icon { color: var(--cyan); margin-top: 2px; }
.messages { display: flex; flex-direction: column; gap: 18px; max-width: 860px; margin: 0 auto; padding-top: 10px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg-user, .msg-right { justify-content: flex-end; }
.msg-left { justify-content: flex-start; }
.msg-avatar { padding-top: 4px; }
.msg-bubble { max-width: min(720px, 85%); padding: 12px 16px; border-radius: 16px; background: var(--surface-1); border: 1px solid var(--border); }
.msg-user .msg-bubble, .msg-right .msg-bubble { background: var(--bubble-user); border-color: transparent; border-bottom-right-radius: 4px; }
.msg-assistant .msg-bubble { border-bottom-left-radius: 4px; }
.msg-left .msg-bubble { background: var(--surface-2); border-bottom-left-radius: 4px; border-bottom-right-radius: 16px; }
.msg-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.thinking { display: inline-flex; gap: 4px; align-items: center; color: var(--text-muted); font-size: .88rem; }
.thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: dot 1.2s infinite ease-in-out; }
.thinking span:nth-child(2) { animation-delay: .15s; } .thinking span:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.composer { position: sticky; bottom: 0; border-radius: 18px; padding: 12px 14px; margin: 0 auto; width: 100%; max-width: 900px; display: flex; flex-direction: column; gap: 8px; }
.composer textarea { width: 100%; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 1rem; resize: none; outline: none; min-height: 28px; max-height: 220px; }
.composer:focus-within { outline: 2px solid var(--cyan); outline-offset: 0; }
.composer-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Markdown */
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: .5em 0; } .md ul, .md ol { margin: .4em 0; padding-left: 1.3em; }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; overflow: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; } .md th, .md td { border: 1px solid var(--border); padding: 4px 8px; }
.md h1, .md h2, .md h3 { margin: .8em 0 .3em; font-size: 1.05rem; }
.report { max-height: 520px; overflow: auto; }

/* ---------- Posteingang ---------- */
.inbox { display: grid; grid-template-columns: 360px 1fr; gap: 16px; height: calc(100vh - 230px); min-height: 480px; }
.inbox-list { overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.inbox-item { display: flex; gap: 10px; text-align: left; padding: 10px; border-radius: 12px; border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; width: 100%; }
.inbox-item:hover, .inbox-item.active { background: var(--surface-2); }
.inbox-item.active { box-shadow: inset 3px 0 0 var(--cyan); }
.inbox-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.inbox-thread { display: flex; flex-direction: column; min-height: 0; padding: 0; }
.thread-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.thread { flex: 1; overflow: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.reply-box { border-top: 1px solid var(--border); padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Gedaechtnis ---------- */
.memory-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.memory-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-1); border: 1px solid var(--border); }
.kind-profile { color: var(--violet); border-color: rgba(167, 139, 250, .5); }
.kind-note { color: var(--cyan); border-color: rgba(34, 211, 238, .5); }
.kind-preference { color: var(--warn); border-color: rgba(251, 191, 36, .45); }
.kind-knowledge { color: var(--ok); border-color: rgba(52, 211, 153, .45); }
.episode { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; color: var(--text); text-decoration: none; }
.episode:hover { background: var(--surface-2); }
.add-memory { border-top: 1px dashed var(--border); padding-top: 12px; }

/* ---------- KPIs & Diagramme ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 16px; border-radius: var(--r-card); background: var(--surface-1); border: 1px solid var(--border); position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, var(--cyan), var(--violet)); opacity: .7; }
.kpi-label { color: var(--text-muted); font-size: .8rem; font-weight: 500; }
.kpi-value { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; line-height: 1.2; margin-top: 4px; }
.kpi-value small { font-size: .9rem; color: var(--text-muted); font-weight: 500; }
.kpi-small { font-size: 1.1rem; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--text-muted); font: 11px var(--font); }
.chart .bar-fill { fill: var(--chart); }
.chart .hit { fill: transparent; }
.chart .bar:hover .bar-fill { fill: var(--violet); }
.chart .bar:hover .hit { fill: var(--surface-2); }
.hbars { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.hbar { display: grid; grid-template-columns: 130px 1fr 44px; gap: 10px; align-items: center; font-size: .88rem; }
.hbar-label { display: flex; align-items: center; gap: 6px; }
.hbar-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--chart); }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Automationen ---------- */
.rule-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.rule { display: flex; flex-direction: column; gap: 10px; }
.rule.disabled { opacity: .6; }
.rule-sentence { font-size: 1.02rem; line-height: 1.6; }
.rule-sentence .kw { font-family: var(--font-display); font-weight: 700; color: var(--violet); text-transform: uppercase; font-size: .8rem; letter-spacing: .08em; padding: 2px 8px; border-radius: 6px; background: rgba(167, 139, 250, .12); margin-right: 4px; }
.test-panel { margin-bottom: 4px; }
.test-hit { padding: 8px 0; border-top: 1px solid var(--border); }

/* ---------- Kanaele, Freigaben, Social ---------- */
.channel-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.channel-card.on { border-color: rgba(34, 211, 238, .45); box-shadow: var(--glow); }
.channel-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(124, 58, 237, .25), rgba(34, 211, 238, .18)); color: var(--cyan); }
.webhook { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px dashed var(--border); }
.webhook code { background: var(--surface-2); padding: 6px 8px; border-radius: 8px; min-width: 0; overflow-wrap: anywhere; }
.approval { display: flex; flex-direction: column; gap: 12px; }
.media-preview { max-width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.ig-preview { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface-2); max-width: 420px; }
.ig-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.ig-preview img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.ig-placeholder { aspect-ratio: 1; display: grid; place-items: center; color: var(--text-muted); background: linear-gradient(135deg, rgba(124, 58, 237, .18), rgba(34, 211, 238, .12)); }
.ig-caption { padding: 12px; font-size: .9rem; }

/* ---------- Adresssuche & Wettervorschau ---------- */
.autocomplete { position: relative; }
.autocomplete-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow); max-height: 280px; overflow: auto; }
.autocomplete-list li { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: .88rem; color: var(--text); }
.autocomplete-list li .icon { color: var(--cyan); }
.autocomplete-list li:hover, .autocomplete-list li.active { background: var(--surface-2); }
.autocomplete-empty { padding: 6px 2px; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--cyan); border-radius: 50%; animation: orb-spin .8s linear infinite; flex: none; }
.weather-preview { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.weather-preview .icon { color: var(--cyan); }
.weather-temp { font: 700 1.5rem var(--font-display); }
.forecast-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 6px; }
.forecast-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; background: var(--surface-1); border: 1px solid var(--border); }

/* ---------- Fahrten ---------- */
.trip { display: flex; flex-direction: column; gap: 10px; }
.trip-due { border-color: rgba(251, 191, 36, .6); box-shadow: 0 0 0 1px rgba(251, 191, 36, .3), var(--shadow); }
.trip-times { display: flex; align-items: center; gap: 18px; padding: 8px 0; }
.trip-times > div { display: flex; flex-direction: column; }
.trip-big { font: 700 1.7rem var(--font-display); line-height: 1.1; }
.trip-arrow { font-size: 1.4rem; color: var(--cyan); }

/* ---------- Responsiv ---------- */
@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .conv-list { display: none; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox-list { max-height: 320px; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .only-mobile { display: inline-grid !important; }
  .hide-mobile { display: none; }
  .content { padding: 16px; }
  /* Kopfleiste passt auf 320–375 px: Mandantenname kuerzen, Bedienelemente kompakt (Ziel >= 32 px bleibt) */
  .topbar { padding: 8px max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left)); gap: 6px; }
  .tenant { flex: 1 1 auto; min-width: 0; }
  .tenant-name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .topbar-actions { gap: 4px; flex-shrink: 0; }
  .topbar .segmented button { padding: 6px 8px; }
  .topbar .user-chip { padding: 0; border: 0; }
  .security-banner { padding: 8px 12px; }
  .suggestions, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .dropdown-panel { position: fixed; left: 10px; right: 10px; top: 56px; width: auto; max-height: calc(100vh - 72px); overflow-y: auto; }
}
@media (max-width: 360px) {
  .topbar .segmented { display: none; }   /* Sprache bleibt unter Einstellungen umschaltbar */
}

/* Barrierefreiheit: Bewegung reduzieren */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media (forced-colors: active) {
  .chart .bar-fill, .hbar-fill { fill: CanvasText; background: CanvasText; }
}

/* ------------------------------------------------------------------ Einrichtungsassistent */
.setup { display: flex; flex-direction: column; gap: 18px; }
.setup-head { display: flex; flex-direction: column; gap: 12px; }
.setup-head > .btn { align-self: flex-start; }
.setup-title h1 { margin: 0; }
.setup-title p { margin: 4px 0 0; max-width: 70ch; }
.setup-progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.setup-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--cyan)); border-radius: inherit; transition: width .35s ease; }
.setup-body { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
.setup-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 12px; }
.setup-step button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--text-muted); text-align: left; cursor: pointer; font: inherit; }
.setup-step button:hover { background: var(--surface-2); color: var(--text); }
.setup-step.current button { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); font-weight: 600; }
.setup-dot { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 600;
  border: 1.5px solid var(--border-strong); color: var(--text-muted); background: var(--surface); }
.setup-step.current .setup-dot { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 0 4px rgba(34, 211, 238, .12); }
.setup-step.done .setup-dot { border-color: var(--text-muted); }
.setup-step.ok .setup-dot { border-color: var(--ok); background: var(--ok); color: #06261a; }
.setup-step.warn .setup-dot { border-color: var(--warn); color: var(--warn); }
.setup-step.bad .setup-dot { border-color: var(--bad); background: var(--bad); color: #1a0b10; }
.setup-step-title { line-height: 1.25; }
.setup-card { display: flex; flex-direction: column; gap: 14px; }
.setup-card h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.setup-text { line-height: 1.55; }
.setup-needs { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; background: var(--surface-2); font-size: .9rem; }
.setup-needs ul { margin: 6px 0 0; padding-left: 1.2em; }
.setup-webhook { border-top: none; padding-top: 0; }
.setup-result { border-radius: 12px; border: 1px solid var(--border); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.setup-result.ok { border-color: rgba(52, 211, 153, .5); }
.setup-result.warn, .setup-result.wait { border-color: rgba(251, 191, 36, .5); }
.setup-result.bad { border-color: rgba(251, 113, 133, .55); }
.setup-line { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; }
.setup-line-icon { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700;
  border: 1.5px solid var(--border-strong); color: var(--text-muted); }
.setup-line.ok .setup-line-icon { border-color: var(--ok); color: var(--ok); }
.setup-line.warn .setup-line-icon { border-color: var(--warn); color: var(--warn); }
.setup-line.bad .setup-line-icon { border-color: var(--bad); color: var(--bad); }
.setup-line.wait .setup-line-icon { border-color: var(--cyan); color: var(--cyan); animation: setup-pulse 1.2s ease-in-out infinite; }
.setup-line.info .setup-line-icon { border-color: var(--cyan); color: var(--cyan); }
.setup-detail { word-break: break-word; font-family: var(--font-mono); font-size: .76rem; }
.setup-suggest { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px dashed var(--border); padding-top: 8px; }
.setup-summary { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.setup-nav { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
@keyframes setup-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .setup-line.wait .setup-line-icon { animation: none; } .setup-progress span { transition: none; } }
@media (max-width: 860px) {
  .setup-body { grid-template-columns: 1fr; }
  .setup-steps { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .setup-step button { width: auto; white-space: nowrap; }
  .setup-step:not(.current) .setup-step-title { display: none; }
}
.channel-card .setup-cta { align-self: flex-start; }

/* Einrichtung „Was fehlt noch?“ */
.setup-card { width: 100%; max-width: 640px; margin-top: 18px; text-align: left; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-1); }
.setup-card-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.setup-progress { height: 6px; border-radius: 3px; background: var(--surface-2, rgba(127,127,127,.18)); overflow: hidden; margin: 8px 0 10px; }
.setup-progress > span { display: block; height: 100%; background: var(--cyan); border-radius: 3px; }
.setup-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--border); }
.setup-item:first-of-type { border-top: 0; }
.setup-item a { color: var(--text); font-weight: 600; text-decoration: none; }
.setup-item a:hover { color: var(--cyan); }
.setup-item .icon { color: var(--cyan); margin-top: 2px; flex: none; }
.setup-item .grow { flex: 1; min-width: 0; }

/* Handbuch */
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.help-examples { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.help-examples a { color: var(--text); text-decoration: none; border-bottom: 1px dashed var(--border); }
.help-examples a:hover { color: var(--cyan); border-color: var(--cyan); }
.code-block { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; word-break: break-all; user-select: all; }

.field-inline { display: flex; align-items: center; gap: 8px; margin: 0; }
.field-inline .input { width: auto; }

/* Rechnungen */
.invoice-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.invoice-list li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.invoice-list li:first-child { border-top: 0; }
.invoice-list li.overdue { background: rgba(251, 191, 36, .06); }
.invoice-list .grow { flex: 1; min-width: 200px; }

/* KI-Verbrauch */
.usage-bars { display: flex; align-items: flex-end; gap: 2px; height: 64px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.usage-bars span { flex: 1; min-width: 3px; background: var(--cyan); border-radius: 3px 3px 0 0; opacity: .8; }
.usage-bars span:hover { opacity: 1; }

/* Suche ueber alles */
.search-big { max-width: 720px; margin-bottom: 14px; }
.search-big input { flex: 1; min-width: 0; }
.search-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.search-results a { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-1); color: var(--text); text-decoration: none; }
.search-results a:hover { border-color: var(--cyan); }
.search-results .icon { color: var(--cyan); margin-top: 2px; flex: none; }
.search-results .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.topbar-search { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-1); }
.topbar-search input { border: 0; background: transparent; color: var(--text); font: inherit; width: 160px; outline: none; }
@media (max-width: 720px) { .topbar-search input { width: 90px; } }

/* QR-Code fuer die Authenticator-App: immer schwarz auf weiss, feste Groesse zum Abfotografieren */
.qr-box { width: 220px; max-width: 100%; padding: 0; border-radius: 8px; overflow: hidden; background: #fff; align-self: flex-start; }
.qr-box svg { display: block; width: 100%; height: auto; }

/* Alltag: Gewohnheiten, Tagebuch-Rueckblick */
.habit-days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; }
.habit-day { height: 10px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--border); }
.habit-day.on { background: var(--ok); border-color: var(--ok); }
.review-text { white-space: pre-wrap; font-family: inherit; margin: 0; line-height: 1.55; }
.text-danger { color: var(--bad); }

/* Vorsorge: Notfallkontakte, Notfallmappe (Druckansicht) */
.emergency-rank { font-weight: 700; color: var(--cyan); }
.print-only { display: none; }

/* Team: Personalplan als Wochenraster */
.shift-grid-wrap { overflow-x: auto; }
.shift-grid { width: 100%; border-collapse: collapse; min-width: 720px; }
.shift-grid th, .shift-grid td { border: 1px solid var(--border); padding: 6px; vertical-align: top; text-align: left; font-size: .9em; }
.shift-grid thead th { background: var(--surface-1); font-weight: 600; }
.shift-grid thead th.today { color: var(--cyan); }
.shift-grid td.away { background: rgba(251, 191, 36, .08); }
.shift-chip { display: inline-flex; align-items: center; gap: 4px; margin: 2px 0; padding: 2px 6px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.shift-del { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; padding: 0 2px; font-size: 1em; line-height: 1; }
.shift-del:hover { color: var(--bad); }

/* Drucken (z. B. Notfallmappe): nur der Inhalt, schwarz auf weiss */
@media print {
    .sidebar, .topbar, .toasts, .no-print, .click-away { display: none !important; }
    .shell, .main, .content { display: block !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; }
    html, body { background: #fff !important; color: #000 !important; }
    .print-only { display: block !important; }
    .print-sheet { color: #000; font-size: 12pt; line-height: 1.45; }
    .print-sheet h1 { font-size: 18pt; margin: 0 0 12pt; }
    .print-sheet h2 { font-size: 14pt; margin: 16pt 0 6pt; }
    .print-sheet dl { display: grid; grid-template-columns: 34% 1fr; gap: 4pt 12pt; margin: 0; }
    .print-sheet dt { font-weight: 700; }
    .print-sheet dd { margin: 0; white-space: pre-wrap; }
}
/* Besprechungen: Protokolle, Aufnahme, Gespraechsmodus im Chat */
.upload-btn { position: relative; align-self: flex-start; overflow: hidden; }
.upload-btn.disabled { opacity: .6; pointer-events: none; }
.meeting-card { cursor: pointer; }
.meeting-card:hover, .meeting-card:focus-visible { border-color: var(--cyan); }
.meeting-summary { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meeting-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.meeting-text { line-height: 1.6; }
.meeting-transcript summary { cursor: pointer; color: var(--text-muted); }
.meeting-transcript > div { margin-top: 8px; max-height: 420px; overflow: auto; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-1); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bad); animation: rec-pulse 1.2s ease-in-out infinite; flex: none; }
.rec-dot.paused { animation: none; opacity: .4; }
@keyframes rec-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.rec-level { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; max-width: 220px; }
.rec-level > span { display: block; height: 100%; background: var(--cyan); transition: width .2s linear; }
.mode-chip-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
/* Buero: Fahrtenbuch-Summen, Angebotspositionen, Monatsabschluss, Umsatz */
.table .num { text-align: right; white-space: nowrap; }
.text-ok { color: var(--ok); }
.km-bar-col, .rev-bar-col { width: 40%; }
.km-bar, .rev-bars { display: flex; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.km-business { background: var(--cyan); }
.km-private { background: var(--violet); opacity: .7; }
.rev-bars { flex-direction: column; height: 14px; gap: 2px; background: transparent; border-radius: 0; }
.rev-bars span { display: block; height: 6px; border-radius: 999px; min-width: 1px; }
.rev-now { background: var(--cyan); }
.rev-prev { background: var(--text-muted); opacity: .45; }
.offer-items td { padding: 4px 6px; }
.offer-items .input { min-width: 0; }
.offer-items .input-qty { width: 80px; }
.offer-items .input-unit { width: 80px; }
.offer-items .input-price { width: 110px; }
.close-list input[type="checkbox"] { width: 18px; height: 18px; flex: none; margin-top: 2px; accent-color: var(--ok); }
.close-list .close-done .reminder-body > div:first-child { color: var(--text-muted); }
details.panel > summary { cursor: pointer; list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
@media (max-width: 720px) { .km-bar-col, .rev-bar-col { width: 30%; } }
/* Familie: Kalender-Uebersicht, Kalorien */
.fam-legend { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.fam-legend .chip-mini { margin-left: 0; }
.fam-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.fam-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 12px; margin-bottom: 16px; }
.fam-day .section-title { margin-bottom: 8px; }
.fam-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.fam-item { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-left: 4px solid var(--fam-color, var(--cyan)); background: var(--surface-2); border-radius: 6px; }
.fam-item .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fam-time { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: .82rem; min-width: 64px; }
.fam-upload { position: relative; overflow: hidden; }
.fam-meter { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.fam-meter span { display: block; height: 100%; background: var(--ok); }
.fam-meter span.over, .fam-week-bar span.over { background: var(--warn); }
.fam-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; }
.fam-week-day { display: grid; gap: 2px; justify-items: center; }
.fam-week-bar { width: 100%; max-width: 36px; height: 80px; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.fam-week-bar span { display: block; width: 100%; background: var(--cyan); border-radius: 6px 6px 0 0; }
/* Integrationen: Marketing (Analytics, Suche, Bewertungen, Wawi) und Mobil-Extras (E-Auto, Fluege, Haustuer) */
.integration-setup summary { cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.howto { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--text-muted); line-height: 1.5; }
.test-lines { list-style: none; margin: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); display: grid; gap: 4px; font-size: .88rem; }
.test-lines.ok { border-color: var(--ok); }
.test-lines.fail { border-color: var(--bad); }
.text-ok { color: var(--ok); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stars { color: var(--warn); letter-spacing: 1px; }
.stars.text-danger { color: var(--bad); }
.review-quote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--border-strong); color: var(--text); white-space: pre-wrap; font-size: .92rem; }
.battery-bar { height: 6px; border-radius: 999px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.battery-bar span { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.charge-window { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; font-size: 1.05rem; }
.price-bars { display: flex; align-items: flex-end; gap: 3px; overflow-x: auto; padding-bottom: 2px; }
.price-bar { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 16px; }
.price-bar span { display: block; width: 12px; border-radius: 3px 3px 0 0; background: var(--border-strong); }
.price-bar.on span { background: var(--ok); }
.price-bar small { font-size: .65rem; color: var(--text-muted); }
.flight-text { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.camera-shot { width: 100%; max-width: 720px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }

/* ---------- Produktivitaet: Tages-Score ---------- */
.score-detail { margin: 2px 0 0 140px; }
.score-bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding: 4px 0; border-bottom: 1px solid var(--grid); }
.score-bar { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; min-width: 4px; }
.score-bar-fill { display: block; width: 100%; border-radius: 3px 3px 0 0; background: var(--chart); }
.score-bar.live .score-bar-fill { opacity: .55; }
.score-bar:hover .score-bar-fill { background: var(--violet); opacity: 1; }
.social-item .reminder-body { min-width: 0; }
@media (max-width: 640px) { .score-detail { margin-left: 0; } .score-bars { gap: 1px; } }
@media (forced-colors: active) { .score-bar-fill { background: CanvasText; } }
/* Markt: Retourenquote, Preisverlauf, Break-even-Grafik */
.markt-bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; overflow-x: auto; padding-bottom: 2px; }
.markt-bar { flex: 1 0 28px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; height: 100%; }
.markt-bar span { display: block; width: 100%; max-width: 34px; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--chart); }
.markt-bar small { font-size: .68rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.markt-history { margin: 0; padding-left: 18px; display: grid; gap: 2px; color: var(--text-muted); }
.markt-chart { width: 100%; max-width: 640px; height: auto; }
.markt-chart .axis { stroke: var(--border-strong); stroke-width: 1; }
.markt-chart .revenue { stroke: var(--ok); stroke-width: 2.5; }
.markt-chart .cost { stroke: var(--warn); stroke-width: 2.5; }
.markt-chart .fix { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 4 4; }
.markt-chart .plan { stroke: var(--violet); stroke-width: 1.5; stroke-dasharray: 2 3; }
.markt-chart .point { fill: var(--chart); stroke: var(--surface-1); stroke-width: 2; }
.markt-chart .label { fill: var(--text-muted); font-size: 11px; }
.legend::before { content: ""; display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; background: currentColor; }
.legend.revenue::before { background: var(--ok); }
.legend.cost::before { background: var(--warn); }
.legend.fix::before { background: var(--text-muted); }
.legend.plan::before { background: var(--violet); }
/* Haus & Geraete: Fotos im Chat */
.chat-photos { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.chat-photo { position: relative; }
.chat-photo-img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); display: block; }
.chat-photo-remove { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 50%; }
.chat-photo-btn { overflow: hidden; }
.chat-photo-btn.disabled { opacity: .45; pointer-events: none; }
.child-push-list { display: grid; gap: 6px; }
/* Kanaele und CRM: Kontaktdaten-Vorschlaege und Verlauf am Kontakt */
.crm-timeline { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.crm-timeline .section-title { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.crm-suggestions .reminder-body { min-width: 0; overflow-wrap: anywhere; }
/* ------------------------------------------------------------------ Wissen & Medien */
.book-text { max-width: 72ch; line-height: 1.7; font-size: 1.02rem; }
.book-text p { margin: 0 0 .9em; }

/* 3CX-Selbstpruefung: abweichende Kennzahlen hervorheben */
.table tr.warn td { color: var(--warn); font-weight: 600; }

/* ------------------------------------------------------------------ allrounderX: Seitenleiste (kompakt) und Vorschlagskarten */
.shell.eingebettet { grid-template-columns: 1fr; }
.shell.eingebettet .sidebar, .shell.eingebettet .topbar { display: none; }
.shell.eingebettet .content { padding: 8px; }
.shell.eingebettet .chat-layout { grid-template-columns: 1fr; height: calc(100vh - 16px); }
.shell.eingebettet .conv-list, .shell.eingebettet .suggestions, .shell.eingebettet .setup-card { display: none; }
.shell.eingebettet .hero-title { font-size: 1.3rem; }
.shell.eingebettet .msg-bubble { max-width: 100%; }
.ax-kontext { font-size: .8rem; margin-bottom: 6px; }
.ax-vorschlag { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--cyan); border-radius: 12px; background: var(--surface-2); }
.ax-vorschlag dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 6px 0; font-size: .9rem; }
.ax-vorschlag dt { color: var(--muted, var(--text)); opacity: .75; }
.ax-vorschlag dd { margin: 0; overflow-wrap: anywhere; }
.ax-vorschlag .row { flex-wrap: wrap; gap: 8px; }
