/* AI Receptionist – Oberfläche
   Idee: Telefonzentrale im Schweizer Raster. Graphit und kühles Grau, ein einziger Akzent:
   PTT-Gelb – und Gelb heisst immer "braucht dich" (offene Rückrufe, ungelesene Anmerkungen, jetzt). */

:root {
  --canvas: #eef0f2;
  --surface: #ffffff;
  --surface-2: #f6f7f8;
  --ink: #1e2128;
  --ink-2: #4a505c;
  --muted: #747a86;
  --line: #dde0e5;
  --line-strong: #c9cdd4;
  --ptt: #ffcc00;
  --ptt-soft: #fff4c2;
  --on-ptt: #1e2128;
  --blue: #2c5bd0;
  --green: #1d7a52;
  --red: #c2410c;
  --amber: #a16207;
  --bubble-caller: #eef0f2;
  --bubble-agent: #1e2128;
  --on-agent: #ffffff;
  --shadow: 0 1px 2px rgba(30, 33, 40, 0.06), 0 8px 24px -12px rgba(30, 33, 40, 0.18);
  --radius-l: 18px;
  --radius-m: 12px;
  --radius-s: 8px;
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #15171b;
    --surface: #1d2026;
    --surface-2: #23272e;
    --ink: #eceef1;
    --ink-2: #b7bcc6;
    --muted: #8a909c;
    --line: #2e333b;
    --line-strong: #3b414b;
    --ptt-soft: #3a3214;
    --blue: #7c9df0;
    --green: #4fbf8a;
    --red: #f08a5d;
    --amber: #e6b84a;
    --bubble-caller: #2a2e36;
    --bubble-agent: #eceef1;
    --on-agent: #15171b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #15171b;
  --surface: #1d2026;
  --surface-2: #23272e;
  --ink: #eceef1;
  --ink-2: #b7bcc6;
  --muted: #8a909c;
  --line: #2e333b;
  --line-strong: #3b414b;
  --ptt-soft: #3a3214;
  --blue: #7c9df0;
  --green: #4fbf8a;
  --red: #f08a5d;
  --amber: #e6b84a;
  --bubble-caller: #2a2e36;
  --bubble-agent: #eceef1;
  --on-agent: #15171b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--canvas);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ Gerüst */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 20px;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--ptt); display: grid; place-items: center; color: var(--on-ptt); flex: none; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: 0; }

.tenant-pick label { display: block; font-size: 12px; color: var(--muted); padding: 0 6px 4px; }
.tenant-pick select {
  width: 100%; padding: 9px 10px; border-radius: var(--radius-m);
  border: 1px solid var(--line); background: var(--surface-2); font-weight: 600;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: var(--radius-m);
  text-decoration: none; color: var(--ink-2); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--surface); }
.nav svg { width: 19px; height: 19px; flex: none; }
.nav .count {
  margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
  background: var(--ptt); color: var(--on-ptt);
}
.nav .count:empty { display: none; }

.account { margin-top: auto; display: grid; gap: 8px; padding: 10px; border-radius: var(--radius-m); background: var(--surface-2); }
.account-link { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.account-link > span:last-child { display: grid; min-width: 0; }
.account-link strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-link small { font-size: 12px; color: var(--muted); }
.account-link[aria-current="page"] small { color: var(--ink); }
.account form { margin: 0; }
.account .btn { width: 100%; }
.avatar {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--surface); font-weight: 700; font-size: 13px; text-decoration: none; text-transform: uppercase;
}
.mobile-top .avatar { width: 34px; height: 34px; }
.line-status { margin-top: auto; padding: 12px; border-radius: var(--radius-m); background: var(--surface-2); font-size: 13px; color: var(--ink-2); }
.line-status strong { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 50%, transparent); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.main { min-width: 0; padding: 28px clamp(16px, 3.4vw, 44px) 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: clamp(28px, 3.2vw, 40px); line-height: 1.05; letter-spacing: -0.03em; font-weight: 800; }
.page-head p { margin: 6px 0 0; color: var(--muted); }

/* ------------------------------------------------------------ Bausteine */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 20px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.panel-head a, .link { font-size: 14px; color: var(--ink-2); text-underline-offset: 3px; }
.hint { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; max-width: 70ch; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 15px; border-radius: 999px; border: 1px solid transparent;
  background: var(--ink); color: var(--surface); font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: 0.45; cursor: default; filter: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.ptt { background: var(--ptt); color: var(--on-ptt); }
.btn.danger { background: var(--red); color: #fff; }
.btn.small { padding: 6px 11px; font-size: 13.5px; }
.btn svg { width: 17px; height: 17px; }

.field { display: grid; gap: 5px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12.5px; }
input[type="text"], input[type="url"], input[type="tel"], input[type="email"], input[type="password"], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-m);
  border: 1px solid var(--line); background: var(--surface-2);
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink-2); background: var(--surface); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  padding: 6px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--muted)); }
.o-answered { --dot: var(--ink-2); }
.o-message_taken { --dot: var(--ptt); }
.o-transferred { --dot: var(--blue); }
.o-ended_by_caller { --dot: var(--muted); }
.o-timeout, .o-error { --dot: var(--red); }
.o-open { --dot: var(--green); }

.status { font-size: 13.5px; color: var(--muted); margin-top: 10px; }
.status.err { color: var(--red); }
.empty { padding: 28px 8px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 999px;
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow); z-index: 50;
}

/* ------------------------------------------------------------ Übersicht */
.today { display: grid; grid-template-columns: minmax(170px, 220px) 1fr; gap: 28px; align-items: center; padding: 24px 24px 18px; }
.today-count { font-size: 76px; font-weight: 800; letter-spacing: -0.05em; line-height: 0.9; }
.today-count + span { display: block; margin-top: 8px; color: var(--ink-2); font-weight: 500; }

.dayline { position: relative; }
.dayline-track {
  position: relative; height: 64px; border-radius: var(--radius-m);
  background:
    repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px calc(100% / 24)),
    var(--surface-2);
  overflow: hidden;
}
.dayline-tick {
  position: absolute; bottom: 8px; width: 4px; height: 48px; margin-left: -2px; border-radius: 3px;
  background: var(--dot, var(--ink-2)); border: 0; padding: 0; cursor: pointer;
}
.dayline-tick:hover, .dayline-tick:focus-visible { width: 6px; margin-left: -3px; }
.dayline-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ptt); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ptt) 30%, transparent); }
.dayline-now::after { content: ""; position: absolute; top: -1px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--ptt); }
.dayline-hours { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.dayline-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; }
.dayline-tip {
  position: absolute; bottom: calc(100% + 8px); transform: translateX(-50%);
  width: max-content; max-width: 280px; background: var(--ink); color: var(--surface);
  padding: 8px 11px; border-radius: var(--radius-s); font-size: 13px; pointer-events: none; z-index: 5;
}

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.grid-3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 16px; margin-top: 16px; }

.attention { border-color: color-mix(in srgb, var(--ptt) 70%, var(--line)); }
.attention .panel-head h2::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--ptt); margin-right: 8px; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.row { display: flex; gap: 12px; padding: 11px 2px; align-items: flex-start; text-decoration: none; }
a.row:hover .row-title { text-decoration: underline; text-underline-offset: 3px; }
.row-main { min-width: 0; flex: 1; }
.row-title { font-weight: 600; }
.row-sub { color: var(--ink-2); font-size: 14px; overflow-wrap: anywhere; }
.row-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 120px; }
.bar { display: grid; gap: 6px; justify-items: center; height: 100%; align-content: end; }
.bar i { display: block; width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px; background: var(--ink-2); min-height: 3px; }
.bar.is-today i { background: var(--ptt); }
.bar span { font-size: 12px; color: var(--muted); }
.bar b { font-size: 12.5px; }

.kpi { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; }
.kpi-label { color: var(--muted); font-size: 13.5px; }
.stack { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: 14px 0 10px; }
.stack i { background: var(--dot); }

/* ------------------------------------------------------------ Gespräche */
.split { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 16px; align-items: start; }
.call-list { padding: 8px; max-height: calc(100vh - 190px); overflow: auto; }
.call-item {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; width: 100%;
  padding: 12px; border-radius: var(--radius-m); border: 0; background: transparent; text-align: left; cursor: pointer;
}
.call-item:hover { background: var(--surface-2); }
.call-item[aria-current="true"] { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--ink); }
.call-icon { grid-row: span 3; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.call-item[aria-current="true"] .call-icon { background: var(--surface); }
.call-icon svg { width: 17px; height: 17px; }
.call-when { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.call-sum { font-weight: 500; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.call-sum.is-empty { color: var(--muted); font-style: italic; font-weight: 400; }

.detail { min-height: 300px; }
.detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: start; }
.detail-head h2 { font-size: 22px; letter-spacing: -0.02em; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.summary-box { margin: 16px 0; padding: 14px 16px; border-radius: var(--radius-m); background: var(--surface-2); }
.summary-box p { margin: 0 0 8px; font-size: 16px; font-weight: 500; }
.back { display: none; }

.transcript { display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: min(78%, 62ch); padding: 9px 13px; border-radius: 16px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.caller { align-self: flex-start; background: var(--bubble-caller); border-bottom-left-radius: 5px; }
.bubble.agent { align-self: flex-end; background: var(--bubble-agent); color: var(--on-agent); border-bottom-right-radius: 5px; }
.bubble-who { font-size: 12px; color: var(--muted); margin-bottom: -4px; }
.bubble-who.agent { align-self: flex-end; }
.tool-line { align-self: center; font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; max-width: 90%; text-align: center; }
.tool-line svg { width: 14px; height: 14px; flex: none; }

/* ------------------------------------------------------------ Rückrufe & Anmerkungen */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.cb { display: flex; flex-direction: column; gap: 10px; }
.cb-top { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.cb-name { font-weight: 700; font-size: 17px; }
.cb-phone { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; }
.cb-phone:hover { text-decoration: underline; text-underline-offset: 3px; }
.cb-phone svg { width: 18px; height: 18px; }
.cb-concern { margin: 0; color: var(--ink-2); }
.cb-actions { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 4px; }
.age { font-size: 13px; color: var(--muted); }
.age.is-old { color: var(--red); font-weight: 600; }

.note { display: grid; grid-template-columns: 10px 1fr auto; gap: 14px; align-items: start; padding: 16px 18px; }
.note + .note { border-top: 1px solid var(--line); }
.note-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; background: transparent; }
.note.is-unread .note-dot { background: var(--ptt); }
.note p { margin: 4px 0 6px; font-size: 15.5px; }
.note.is-unread p { font-weight: 600; }

/* ------------------------------------------------------------ Editor */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); width: max-content; max-width: 100%; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--surface); }
.stack-l > * + * { margin-top: 16px; }
.form-grid { display: grid; gap: 14px; }
.row-inline { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.row-inline > .grow { flex: 1; min-width: 200px; }

.test-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.call-stage { display: grid; place-items: center; gap: 14px; padding: 18px 0 6px; text-align: center; }
.call-button {
  width: 92px; height: 92px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ptt); color: var(--on-ptt); display: grid; place-items: center;
  box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--ptt) 80%, transparent);
}
.call-button svg { width: 36px; height: 36px; }
.call-button.is-live { background: var(--red); color: #fff; box-shadow: none; }
.call-button:disabled { opacity: 0.5; cursor: default; }
.wave { display: flex; gap: 4px; align-items: center; height: 28px; }
.wave i { width: 4px; border-radius: 2px; background: var(--ink-2); height: 6px; transition: height 120ms; }
.wave.is-off i { height: 4px !important; opacity: 0.4; }
.log { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; padding: 4px 2px; }
.log:empty { display: none; }
.partial { font-size: 13.5px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius-m); padding: 7px 11px; }
.chat-form { display: flex; gap: 8px; margin-top: 12px; }
.chat-form input { flex: 1; }

.src-list { list-style: none; margin: 0; padding: 0; }
.src-list li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 2px; border-top: 1px solid var(--line); }
.src-list li:first-child { border-top: 0; }
.src-title { font-weight: 600; }
.src-ref { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.src-ok { color: var(--green); font-size: 12.5px; font-weight: 600; margin-left: 6px; }
.src-warn { color: var(--red); font-size: 12.5px; font-weight: 600; margin-left: 6px; }

.targets { display: grid; gap: 10px; }
.target { display: grid; grid-template-columns: 1fr 1fr 1.2fr auto; gap: 8px; align-items: end; }

/* ------------------------------------------------------------ Mobil */
@media (max-width: 1080px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > :first-child { grid-column: 1 / -1; }
  .test-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 20;
    flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); gap: 0;
    border-right: 0; border-top: 1px solid var(--line);
  }
  .brand, .tenant-pick, .line-status, .sidebar .theme-switch, .sidebar .account { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; position: relative; flex: 1; text-align: center; }
  .nav a[aria-current="page"] { background: transparent; color: var(--ink); }
  .nav a[aria-current="page"] svg { color: var(--ink); }
  .nav .count { position: absolute; top: 0; left: calc(50% + 6px); margin: 0; min-width: 18px; line-height: 17px; font-size: 11px; padding: 0 5px; }
  .main { padding-bottom: 96px; }
  .mobile-top { display: flex !important; }
  .today { grid-template-columns: 1fr; gap: 16px; }
  .today-count { font-size: 60px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .src-list li { flex-wrap: wrap; }
  .split { grid-template-columns: 1fr; }
  .split.has-detail .call-list-wrap { display: none; }
  .split:not(.has-detail) .detail { display: none; }
  .back { display: inline-flex; }
  .call-list { max-height: none; }
  .target { grid-template-columns: 1fr 1fr; }
  .bubble { max-width: 88%; }
}
.mobile-top { display: none; align-items: center; justify-content: space-between; gap: 10px; margin: -8px 0 18px; }
.mobile-top select { width: auto; max-width: 70%; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Stimme */
.voice-grid { align-items: start; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 20px; }
.voice-grid > [hidden] { display: none; }
.slider > span { display: flex; justify-content: space-between; gap: 12px; }
.slider output { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--ink); height: 28px; margin: 0; }

/* Darstellung: Hell / Automatisch / Dunkel */
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; border-radius: var(--radius-m); background: var(--surface-2); border: 1px solid var(--line); }
.theme-switch button {
  display: grid; place-items: center; height: 30px; border: 0; border-radius: calc(var(--radius-m) - 3px);
  background: transparent; color: var(--muted); cursor: pointer;
}
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.theme-switch svg { width: 17px; height: 17px; }
.mobile-top .theme-switch { margin-left: auto; }
.mobile-top .theme-switch button { width: 34px; }

/* Sprachtechnik-Wahl */
.segmented { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.segmented button {
  display: grid; gap: 2px; text-align: left; padding: 12px 14px; border-radius: var(--radius-m);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); cursor: pointer; font: inherit;
}
.segmented button strong { color: var(--ink); font-size: 15px; }
.segmented button span { font-size: 13px; }
.segmented button:hover { border-color: var(--line-strong); }
.segmented button[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--surface); }
.sep { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }

/* Anmelden, Einrichten, Verbinden: zweigeteilt, links Marke und ein Gespräch als Beispiel */
.auth-page { min-height: 100vh; }
.auth-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-hero {
  position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 40px 48px 32px;
  background: #1e2128; color: #eceef1; border-right: 1px solid #2e333b;
}
.auth-hero::after {
  content: ""; position: absolute; right: -160px; bottom: -200px; width: 520px; height: 520px; border-radius: 50%;
  border: 64px solid rgb(255 204 0 / 0.07); pointer-events: none;
}
.auth-hero .brand small { color: #8a909c; }
.auth-hero-body { position: relative; z-index: 1; margin: auto 0; max-width: 32rem; padding: 40px 0; }
.auth-hero-body h2 { margin: 0 0 14px; font-size: clamp(30px, 3.4vw, 46px); line-height: 1.05; letter-spacing: -0.03em; font-weight: 800; }
.auth-hero-body > p { margin: 0 0 28px; color: #b7bcc6; font-size: 16px; line-height: 1.6; max-width: 30rem; }
.auth-hero-foot { position: relative; z-index: 1; margin: 0; color: #8a909c; font-size: 13px; }

.call-demo { background: #262a32; border: 1px solid #343a44; border-radius: 18px; padding: 16px; display: grid; gap: 10px; box-shadow: 0 24px 48px -24px rgb(0 0 0 / 0.6); }
.call-demo-head { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #b7bcc6; padding-bottom: 6px; border-bottom: 1px solid #343a44; }
.call-demo-time { margin-left: auto; font-variant-numeric: tabular-nums; }
.call-demo-live { width: 9px; height: 9px; border-radius: 50%; background: #ffcc00; box-shadow: 0 0 0 0 rgb(255 204 0 / 0.6); animation: pulse 2s infinite; }
.call-demo-msg { max-width: 85%; padding: 9px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; }
.call-demo-msg.is-caller { background: #343a44; color: #eceef1; border-bottom-left-radius: 4px; }
.call-demo-msg.is-agent { justify-self: end; background: #eceef1; color: #1e2128; border-bottom-right-radius: 4px; }
.call-demo-done { justify-self: start; font-size: 13px; font-weight: 700; color: #1e2128; background: #ffcc00; border-radius: 999px; padding: 6px 12px; }
.call-demo-done::before { content: "✓  "; }
/* Ein einziger, ruhiger Auftritt: das Gespräch baut sich nacheinander auf */
.call-demo > * { animation: demo-in .5s ease both; }
.call-demo > :nth-child(2) { animation-delay: .3s; }
.call-demo > :nth-child(3) { animation-delay: 1.1s; }
.call-demo > :nth-child(4) { animation-delay: 1.9s; }
.call-demo > :nth-child(5) { animation-delay: 2.5s; }
@keyframes demo-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.auth-card { display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 440px; margin: 0 auto; padding: 56px 28px; }
.auth-card h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: -0.02em; font-weight: 800; }
.auth-card .btn { min-height: 46px; }
.auth-brand-mobile { display: none; }
.auth-lead { color: var(--ink-2); margin: 0 0 22px; }
@media (max-width: 900px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-brand-mobile { display: flex; padding: 0; margin-bottom: 28px; }
  .auth-card { justify-content: flex-start; padding: 32px 20px 40px; }
}
.auth-error { background: color-mix(in srgb, var(--red) 12%, var(--surface)); color: var(--ink); border: 1px solid color-mix(in srgb, var(--red) 40%, transparent); padding: 10px 12px; border-radius: var(--radius-s); margin: 0 0 14px; font-size: 14px; }
.auth-perms { margin: 0 0 18px; padding: 0; list-style: none; display: grid; gap: 8px; }
.auth-perms li { position: relative; padding-left: 26px; }
.auth-perms li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 10px; height: 6px; border: solid var(--ink); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.auth-account { display: grid; gap: 2px; margin: 0; padding: 12px 14px; border-radius: var(--radius-m); background: var(--surface-2); }
.auth-account span { font-size: 12.5px; color: var(--muted); }
.auth-foot { margin: 18px 0 0; font-size: 13px; color: var(--muted); }
.auth-foot a, .auth-card a { color: inherit; }
.tag-x { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 6px; font: inherit; opacity: .6; }
.tag-x:hover { opacity: 1; }
.tenant-static { display: block; padding: 2px 6px; font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-top .tenant-static { padding: 0; margin-right: auto; min-width: 0; }

/* Nachfrage bei ungespeicherten Änderungen */
.leave-dialog {
  border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); color: var(--ink);
  padding: 24px; width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow);
}
.leave-dialog::backdrop { background: rgb(0 0 0 / 0.45); }
.leave-dialog h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.01em; }
.leave-dialog p { margin: 0 0 16px; color: var(--ink-2); }
.leave-dialog .row-inline { margin-top: 8px; flex-wrap: wrap; }
.ext-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ext-head .src-title { margin-right: 8px; }
.webhook { font-size: 13px; padding: 8px 10px; border-radius: var(--radius-s); background: var(--surface-2); border: 1px solid var(--line); overflow-wrap: anywhere; }
.number-big { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.number-big span { font-size: 30px; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.forwarding summary { cursor: pointer; font-weight: 600; }
.forwarding .src-list li { gap: 12px; flex-wrap: wrap; }

/* ---------- Admin-Panel (Support) ---------- */
.support-mark { background: var(--ink); color: var(--ptt); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.support #view > .panel { margin-top: 16px; }
.support .page-head + .panel, .support .page-head + form + .panel { margin-top: 0; }
.kpi-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi-tile .kpi { font-size: 28px; }
.kpi-tile.is-attention { border-color: var(--ptt); box-shadow: inset 0 0 0 1px var(--ptt), var(--shadow); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 76px; }
.spark i { flex: 1; min-width: 3px; background: var(--ink-2); border-radius: 3px 3px 1px 1px; opacity: .55; }
.spark i.is-today { background: var(--ptt); opacity: 1; }
.table-tools { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.table-tools input[type="search"] { width: 100%; padding: 10px 12px; border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table th.num, .data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.th-sort { all: unset; display: block; cursor: pointer; padding: 10px 16px; }
.th-sort:hover { color: var(--ink); }
.th-sort:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.data-table th[aria-sort="ascending"] .th-sort::after { content: " ↑"; }
.data-table th[aria-sort="descending"] .th-sort::after { content: " ↓"; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.click-row { cursor: pointer; }
.click-row:hover td, .click-row:focus-visible td { background: var(--surface-2); }
.click-row:focus-visible { outline: none; }
.cell-title { font-weight: 600; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.facts-list { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; }
.facts-list dt { color: var(--muted); font-size: 13.5px; }
.facts-list dd { margin: 0; }
.back-link { display: inline-block; margin-bottom: 10px; color: var(--muted); text-decoration: none; font-size: 14px; }
.back-link:hover { color: var(--ink); }
.credentials { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px 14px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 12px; }
.form-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; }

/* Hinweis im Kundenkonto, wenn der Support es geöffnet hat */
.imp-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--ptt); color: var(--on-ptt); border-radius: var(--radius-m); padding: 10px 14px; margin: 0 0 18px; font-weight: 600; }
.imp-banner form { margin: 0; }
.imp-banner .btn { background: var(--on-ptt); color: var(--ptt); border-color: transparent; }

/* ---------- Einrichtungsassistent (Tour) ---------- */
.tour-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.tour-layer.is-dim { background: rgb(15 17 21 / 0.55); pointer-events: auto; }
.tour-spot {
  position: fixed; border-radius: var(--radius-l); pointer-events: none;
  box-shadow: 0 0 0 3px var(--ptt), 0 0 0 100vmax rgb(15 17 21 / 0.55);
  transition: top .25s ease, left .25s ease, width .25s ease, height .25s ease;
}
.tour-pop {
  position: fixed; pointer-events: auto; width: min(380px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-l);
  box-shadow: 0 18px 48px -12px rgb(0 0 0 / 0.45); padding: 20px 20px 16px;
}
.tour-pop.is-center { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100vw - 32px)); }
.tour-pop h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: -0.01em; }
.tour-pop p { margin: 0 0 14px; color: var(--ink-2); line-height: 1.55; }
.tour-progress { display: flex; gap: 4px; margin-bottom: 14px; }
.tour-progress i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.tour-progress i.is-on { background: var(--ptt); }
.tour-task { font-size: 13.5px; font-weight: 600; padding: 8px 10px; border-radius: var(--radius-s); background: var(--surface-2); margin-bottom: 14px; }
.tour-task::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ptt); margin-right: 8px; vertical-align: 1px; }
.tour-task.is-done::before { background: var(--green); }
.tour-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tour-actions .grow { flex: 1; }
@media (max-width: 860px) {
  .tour-pop:not(.is-center) { left: 12px !important; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); top: auto !important; width: auto; max-height: 44vh; overflow: auto; padding: 16px; }
  .tour-pop p { margin-bottom: 10px; font-size: 14.5px; }
}
@media (prefers-reduced-motion: reduce) { .tour-spot { transition: none; } }

.setup-card {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit;
  padding: 10px 12px; border-radius: var(--radius-m); border: 1px solid var(--ptt); background: color-mix(in srgb, var(--ptt) 12%, var(--surface));
}
.setup-card:hover { background: color-mix(in srgb, var(--ptt) 22%, var(--surface)); }
.setup-card strong { display: block; font-size: 14px; }
.setup-card small { color: var(--ink-2); font-size: 12.5px; }
.setup-ring {
  --p: 0; flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--ink) calc(var(--p) * 1%), var(--line) 0);
}
.setup-ring span { width: 30px; height: 30px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.setup-pill { display: none; }
@media (max-width: 860px) {
  #setup-card { display: none; }
  .setup-pill {
    display: block; position: fixed; right: 14px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 30;
    background: var(--ptt); color: var(--on-ptt); border: 0; border-radius: 999px; padding: 10px 16px; font: inherit; font-weight: 700;
    box-shadow: 0 8px 24px -8px rgb(0 0 0 / 0.4); cursor: pointer;
  }
}
.setup-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; }
.setup-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-m); background: var(--surface-2); }
.setup-list .grow { flex: 1; font-weight: 600; }
.setup-check { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; }
.setup-list li.is-done .setup-check { background: var(--green); border-color: var(--green); }
.setup-list li.is-done .grow { color: var(--muted); text-decoration: line-through; }
.resume-toast { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Tour-Dialoge in Gelb, damit sie herausstechen (hell und dunkel gleich) */
.tour-pop, .setup-dialog {
  background: var(--ptt); color: var(--on-ptt); border-color: color-mix(in srgb, var(--on-ptt) 25%, var(--ptt));
}
.tour-pop p, .setup-dialog p { color: color-mix(in srgb, var(--on-ptt) 82%, var(--ptt)); }
.tour-progress i { background: color-mix(in srgb, var(--on-ptt) 18%, var(--ptt)); }
.tour-progress i.is-on { background: var(--on-ptt); }
.tour-task, .setup-list li { background: color-mix(in srgb, #fff 45%, var(--ptt)); color: var(--on-ptt); }
.tour-task::before { background: var(--on-ptt); }
.tour-task.is-done::before { background: #1f8a5b; }
.tour-pop .btn, .setup-dialog .btn { background: var(--on-ptt); color: #fff; border-color: var(--on-ptt); }
.tour-pop .btn.ghost, .setup-dialog .btn.ghost { background: transparent; color: var(--on-ptt); border-color: color-mix(in srgb, var(--on-ptt) 45%, var(--ptt)); }
.tour-pop .btn.ghost:hover, .setup-dialog .btn.ghost:hover { background: color-mix(in srgb, var(--on-ptt) 10%, var(--ptt)); }
.tour-pop .btn:focus-visible, .setup-dialog .btn:focus-visible { outline: 2px solid var(--on-ptt); outline-offset: 2px; }
.setup-list li.is-done .grow { color: color-mix(in srgb, var(--on-ptt) 60%, var(--ptt)); }
.setup-check { border-color: var(--on-ptt); }
.setup-list li.is-done .setup-check { background: var(--on-ptt); border-color: var(--on-ptt); }
.tour-spot { box-shadow: 0 0 0 3px var(--ptt), 0 0 0 100vmax rgb(15 17 21 / 0.6); }

/* Dateien hochladen */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dropzone { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; text-align: center; padding: 26px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-m); background: var(--surface-2); color: var(--muted); font-size: 13.5px; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone strong { color: var(--ink); font-size: 15px; font-weight: 600; }
.dropzone:hover, .dropzone.over { border-color: var(--ptt); background: var(--ptt-soft); }
.visually-hidden:focus-visible + .dropzone { outline: 2px solid var(--ink); outline-offset: 2px; }
.dropzone.busy { opacity: .6; pointer-events: none; }

/* ---------- Zwei-Faktor ---------- */
.auth-ok { background: color-mix(in srgb, var(--green, #2e8b57) 12%, var(--surface)); color: var(--ink); border: 1px solid color-mix(in srgb, var(--green, #2e8b57) 40%, transparent); padding: 10px 12px; border-radius: var(--radius-s); margin: 0 0 14px; font-size: 14px; }
.mfa-qr { display: flex; justify-content: center; margin: 0 0 14px; }
.mfa-qr img { background: #fff; padding: 10px; border-radius: var(--radius-m); width: 200px; height: 200px; }
.mfa-secret { margin: 0 0 18px; }
.mfa-secret summary { cursor: pointer; color: var(--ink-2); }
.mfa-secret code { display: block; margin-top: 8px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-s); word-break: break-all; font-size: 14px; letter-spacing: .04em; }
.mfa-secret form { margin-top: 12px; }

/* ---------- Kontingente ---------- */
.usage-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-radius: var(--radius-m); padding: 10px 14px; margin: 0 0 18px; font-weight: 600; border: 1px solid color-mix(in srgb, var(--amber, #c98a00) 50%, transparent); background: color-mix(in srgb, var(--amber, #c98a00) 14%, var(--surface)); color: var(--ink); }
.usage-banner.is-full { border-color: color-mix(in srgb, var(--red) 50%, transparent); background: color-mix(in srgb, var(--red) 12%, var(--surface)); }
.usage-banner a { color: inherit; }
.mfa-hint { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-radius: var(--radius-m); padding: 10px 14px; margin: 0 0 18px; background: var(--surface-2); color: var(--ink); }
.usage-bars { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.usage-bars li { display: grid; gap: 4px; }
.usage-bars .usage-line { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.usage-bars .usage-line small { color: var(--muted); }
.usage-meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.usage-meter i { display: block; height: 100%; background: var(--ink-2); border-radius: 4px; }
.usage-meter i.is-warn { background: var(--amber, #c98a00); }
.usage-meter i.is-full { background: var(--red); }

/* Wissens-Analyse */
.kb-layout { display: grid; gap: 16px; align-items: start; }
.kb-main > * + * { margin-top: 16px; }
.kb-analysis { min-width: 0; }
.tone-ok { color: var(--green); }
.tone-mid { color: var(--amber); }
.tone-low { color: var(--red); }
.kb-score { display: flex; align-items: center; gap: 18px; margin-bottom: 10px; }
.ring { width: 112px; height: 112px; flex: none; }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 10; }
.ring-fg { fill: none; stroke: currentColor; stroke-width: 10; stroke-linecap: round; }
.ring-num { fill: var(--ink); font-size: 34px; font-weight: 700; font-family: inherit; }
.kb-bars { flex: 1; min-width: 0; display: grid; gap: 8px; }
.mini { display: grid; grid-template-columns: 78px 1fr 28px; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.mini b { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.mini-track { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.mini-track i { display: block; height: 100%; border-radius: 4px; background: currentColor; }
.kb-hints { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 8px; }
.kb-hints li { font-size: 13.5px; line-height: 1.4; padding: 8px 10px 8px 12px; border-radius: var(--radius-s); background: var(--surface-2); border-left: 3px solid var(--blue); }
.kb-hints li.warn { border-left-color: var(--amber); }
.kb-topics { margin-top: 8px; }
.kb-topics summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 6px 0; }
.kb-topics ul { list-style: none; margin: 6px 0 0; padding: 0; }
.kb-topics li { padding: 10px 0; border-top: 1px solid var(--line); }
.kb-topic-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kb-chip { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.kb-tip { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
@media (min-width: 1200px) {
  .kb-layout { grid-template-columns: minmax(0, 1fr) 400px; }
  .kb-analysis { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
}
@media (max-width: 1199px) {
  .kb-analysis { order: -1; }
  .kb-topics:not([open]) summary { color: var(--ink-2); }
}
@media (max-width: 480px) {
  .kb-score { flex-direction: column; align-items: stretch; }
  .ring { align-self: center; }
}
