/* Telefonassistent – Verwaltung */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e3e7ec;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #8a94a6;
  --accent: #ea580c;
  --accent-hover: #c2410c;
  --accent-soft: #fff1e8;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fef5e4;
  --bad: #dc2626;
  --bad-soft: #fdecec;
  --info: #2563eb;
  --info-soft: #eaf1ff;
  --sidebar: #0f172a;
  --sidebar-2: #1e293b;
  --sidebar-text: #cbd5e1;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, .25);
  --radius: 12px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120; --surface: #111827; --surface-2: #172033; --border: #243045;
    --text: #e5e9f0; --text-2: #a3aec2; --text-3: #6b778c;
    --accent-soft: #3a1d0c; --ok-soft: #0f2a1b; --warn-soft: #33250b; --bad-soft: #3a1414; --info-soft: #13254a;
    --sidebar: #080d18; --sidebar-2: #131c2e;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 12.5px ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--text-3); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 20px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: #fff; font-weight: 700; font-size: 15px; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #fb923c, #ea580c); display: grid; place-items: center; color: #fff; box-shadow: 0 4px 12px rgba(234, 88, 12, .35); }
.brand small { display: block; font-weight: 500; font-size: 11.5px; color: #94a3b8; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--sidebar-text); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--sidebar-2); color: #fff; }
.nav a.active { background: var(--sidebar-2); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav .count { margin-left: auto; font-size: 11.5px; background: #334155; color: #e2e8f0; border-radius: 999px; padding: 0 8px; }
.sidebar-foot { margin-top: auto; }
.agent-card { background: var(--sidebar-2); border-radius: 12px; padding: 14px; }
.agent-card .t { font-size: 12px; color: #94a3b8; margin-bottom: 6px; }
.agent-card .s { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; margin-bottom: 10px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #64748b; flex: none; }
.dot.ok { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); }
.dot.warn { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, .18); animation: pulse 1.4s infinite; }
.dot.bad { background: #ef4444; }
@keyframes pulse { 50% { opacity: .45; } }
.agent-card .btn { width: 100%; justify-content: center; }
.logout { display: flex; align-items: center; gap: 8px; color: #94a3b8; padding: 12px 10px 0; font-size: 13px; cursor: pointer; background: none; border: 0; }
.logout:hover { color: #fff; }

.main { min-width: 0; }
.topbar { display: none; }
.content { max-width: 1160px; margin: 0 auto; padding: 32px 32px 64px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.crumb { font-size: 13px; color: var(--text-3); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.crumb a { color: var(--text-2); }

/* ---------- Cards / Grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 15px; margin: 0; }
.card-head p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.card-body { padding: 20px; }
.card + .card { margin-top: 16px; }
.grid > .card, .grid > * > .card:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.kpi { padding: 18px 20px; }
.kpi .l { color: var(--text-2); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.kpi .l svg { color: var(--text-3); }
.kpi .v { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
.kpi .h { color: var(--text-3); font-size: 12.5px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; font: 600 13.5px var(--font); border-radius: 9px; padding: 8px 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { padding: 11px 18px; font-size: 14.5px; }
.agent-card .btn { background: #fff; color: #0f172a; border-color: #fff; }
.agent-card .btn:hover { background: #e2e8f0; }
.agent-card .btn.stop { background: transparent; color: #e2e8f0; border-color: #334155; }
.agent-card .btn.stop:hover { background: #334155; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field .hint { color: var(--text-3); font-size: 12.5px; margin-top: 5px; }
input, select, textarea { width: 100%; font: 14px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; transition: border-color .12s, box-shadow .12s; }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(234, 88, 12, .15); }
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { display: none; }
.switch .track { width: 40px; height: 23px; border-radius: 999px; background: #cbd5e1; position: relative; flex: none; transition: background .15s; margin-top: 1px; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch b { display: block; font-size: 14px; }
.switch span.d { color: var(--text-2); font-size: 13px; }
.hours { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; align-items: center; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 12px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; display: flex; gap: 7px; align-items: center; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
.cell-title { font-weight: 600; }
.cell-sub { color: var(--text-3); font-size: 12.5px; }
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty svg { width: 36px; height: 36px; color: var(--text-3); margin-bottom: 8px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------- Lists ---------- */
.list { display: grid; }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; flex: none; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }

/* ---------- Callouts ---------- */
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 10px; background: var(--info-soft); color: var(--text); border: 1px solid transparent; }
.callout svg { color: var(--info); margin-top: 2px; }
.callout.warn { background: var(--warn-soft); } .callout.warn svg { color: var(--warn); }
.callout.ok { background: var(--ok-soft); } .callout.ok svg { color: var(--ok); }
.callout.bad { background: var(--bad-soft); } .callout.bad svg { color: var(--bad); }
.callout p { margin: 2px 0 0; color: var(--text-2); }
.steps { display: grid; gap: 10px; }
.step { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; }
.step .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--surface-2); color: var(--text-2); flex: none; }
.step.done .n { background: var(--ok); color: #fff; }
.step .t { font-weight: 600; } .step .d { color: var(--text-2); font-size: 13px; }

/* ---------- Savebar / Modal / Toast ---------- */
.savebar { position: sticky; bottom: 16px; margin-top: 20px; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--sidebar); color: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 5; }
.savebar .btn { background: #fff; color: #0f172a; border-color: #fff; }
.savebar .btn.ghost { background: transparent; color: #cbd5e1; border-color: transparent; }
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .12s; }
.modal { background: var(--surface); border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(760px, 100%); }
.modal-head { padding: 20px 24px 0; display: flex; justify-content: space-between; gap: 12px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 18px 24px; }
.modal-foot { padding: 0 24px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--sidebar); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; max-width: 380px; animation: slide .18s; }
.toast.bad { background: #b91c1c; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Spezielles ---------- */
.phone-big { font-size: 22px; font-weight: 700; letter-spacing: .01em; }
.codebox { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface-2); border-radius: 9px; padding: 10px 12px; font: 600 14px ui-monospace, Consolas, monospace; }
.log { background: #0b1120; color: #cbd5e1; font: 12px/1.55 ui-monospace, Consolas, monospace; padding: 14px; border-radius: 10px; height: 340px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; }
.transcript { display: grid; gap: 10px; max-height: 380px; overflow: auto; padding: 4px; }
.bubble { max-width: 80%; padding: 9px 13px; border-radius: 14px; background: var(--surface-2); }
.bubble.me { justify-self: end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble.ai { border-bottom-left-radius: 4px; }
.call-orb { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin: 8px auto 14px; }
.call-orb.live { background: var(--accent); color: #fff; box-shadow: 0 0 0 0 rgba(234, 88, 12, .45); animation: ring 1.6s infinite; }
.call-orb svg { width: 36px; height: 36px; }
@keyframes ring { 70% { box-shadow: 0 0 0 18px rgba(234, 88, 12, 0); } 100% { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0); } }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 10% -10%, rgba(234, 88, 12, .14), transparent), var(--bg); }
.login .card { width: min(400px, 100%); padding: 32px; }
.login .brand { color: var(--text); padding: 0 0 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3-1 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
  .content { padding: 20px 16px 48px; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; }
  .hours { grid-template-columns: 1fr; gap: 4px; }
  .hide-sm { display: none; }
}

/* Auswahlkarten (Radio) */
.field label.radio-card, .radio-card { display: flex; font-weight: 400; margin: 0; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft, transparent); }
.radio-card input { width: auto; flex: none; margin-top: 3px; accent-color: var(--accent); }
.radio-card b { display: block; font-size: 14px; }
.radio-card span.d { display: block; font-weight: 400; color: var(--text-2); font-size: 13px; }
