:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --panel-2: #232732;
  --border: #2c313c;
  --text: #e6e9ef;
  --muted: #8b93a3;
  --primary: #4f8cff;
  --green: #2ecc71;
  --red: #ff5b6e;
  --amber: #f5a623;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 { font-size: 18px; margin: 0; }

.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}
.badge.on { color: var(--green); border-color: rgba(46,204,113,.4); }
.badge.off { color: var(--muted); }

main {
  flex: 1;
  padding: 24px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}
.view { display: none; flex-direction: column; gap: 20px; }
.view.active { display: flex; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h2 { font-size: 15px; margin: 0; }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; align-items: center; }
.row input, .row select { flex: 1; min-width: 140px; }

input, select, textarea {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input:hover, select:hover, textarea:hover { border-color: #3a4150; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,140,255,.18);
  background: var(--panel);
}
input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; }
input[type="date"], input[type="time"] { color-scheme: dark; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  background: var(--panel-2);
  color: var(--text);
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.secondary { background: var(--panel-2); border: 1px solid var(--border); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.tnx-presets { flex-wrap: wrap; align-items: center; gap: 6px; }

/* ===== Agenten: Qualität / Setup ===== */
.quality-block {
  margin-top: 6px; padding: 14px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--panel-2);
}
.quality-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg .seg-btn {
  padding: 6px 12px; font-size: 13px; background: var(--panel);
  color: var(--text); border: none; cursor: pointer; border-right: 1px solid var(--border);
}
.seg .seg-btn:last-child { border-right: none; }
.seg .seg-btn.active { background: var(--primary); color: #fff; }
.info-badge {
  font-size: 12px; color: var(--muted); background: rgba(120,160,255,.08);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin: 8px 0;
}
.info-badge code { background: rgba(255,255,255,.06); padding: 1px 4px; border-radius: 4px; }
.pro-grid { margin-top: 6px; }
.budget-banner {
  border-radius: 10px;
  padding: 10px 14px;
  margin: 8px 0 12px;
  font-size: 14px;
}
.budget-banner.ok { background: #1f6f3f22; border: 1px solid #2ea04388; color: #5fd089; }
.budget-banner.warn { background: #8a6d1a22; border: 1px solid #d2992288; color: #f0c560; }
.budget-banner.over { background: #7a1f1f22; border: 1px solid #d2444488; color: #ff8585; }

.engine-block {
  border: 1px solid var(--border, #2a2f3a);
  border-radius: 10px;
  padding: 12px;
  margin: 10px 0;
  background: rgba(124, 58, 237, 0.05);
}
.engine-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.engine-pill.openai { background: #1f6feb22; color: #58a6ff; }
.engine-pill.eleven { background: #7c3aed22; color: #b388ff; }

.tier-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); }
.tier-low { color: #7bd88f; border-color: rgba(123,216,143,.4); }
.tier-mid { color: var(--amber); border-color: rgba(245,166,35,.45); }
.tier-high { color: #6db5ff; border-color: rgba(109,181,255,.45); }
.tier-custom { color: var(--muted); }

/* ===== Stimmen-Badges ===== */
.voice-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.voice-badge {
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--border); letter-spacing: .02em;
}
.vb-natural { color: #34c759; border-color: rgba(52,199,89,.55); background: rgba(52,199,89,.12); font-weight: 700; }
.vb-new { color: #6db5ff; border-color: rgba(109,181,255,.5); background: rgba(109,181,255,.1); }
.vb-clear { color: #7bd88f; border-color: rgba(123,216,143,.5); background: rgba(123,216,143,.1); }
.vb-std { color: var(--muted); }
.checkbox-row.mini { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.btn.voice-play.playing { background: var(--red); color: #fff; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: var(--panel-2); cursor: pointer; }

.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }

.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.tag.INTERESTED, .tag.APPOINTMENT, .tag.CLOSED { color: var(--green); border-color: rgba(46,204,113,.4); }
.tag.CALLBACK { color: var(--amber); border-color: rgba(245,166,35,.4); }
.tag.NOT_INTERESTED, .tag.WRONG_PERSON, .tag.VOICEMAIL { color: var(--red); border-color: rgba(255,91,110,.4); }

.live-controls { display: flex; align-items: center; gap: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 1.4s infinite; }
.dot.off { background: var(--muted); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.transcript {
  max-height: 320px; overflow-y: auto; margin-top: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.bubble { padding: 8px 12px; border-radius: 10px; max-width: 80%; font-size: 14px; }
.bubble.agent { background: var(--primary); color: #fff; align-self: flex-end; border-bottom-right-radius: 2px; }
.bubble.customer { background: var(--panel-2); align-self: flex-start; border-bottom-left-radius: 2px; }
.bubble .who { font-size: 10px; opacity: .7; display: block; margin-bottom: 2px; }

.tools-log { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.tool-item { font-size: 12px; padding: 6px 10px; border-radius: 8px; background: var(--panel-2); border-left: 3px solid var(--amber); }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-content {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  max-width: 640px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 24px; position: relative;
}
.modal-close { position: absolute; top: 12px; right: 16px; background: none; border: none; color: var(--muted); font-size: 26px; cursor: pointer; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.settings-grid label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; }
.settings-grid label input,
.settings-grid label select,
.settings-grid label textarea { width: 100%; }
label.full select, label.full textarea, label.full input { width: 100%; }
.checkbox-row { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--text) !important; font-size: 14px !important; }
.checkbox-row input { width: auto !important; }

label.full {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--muted); margin-bottom: 10px;
}
textarea { width: 100%; resize: vertical; line-height: 1.5; }

select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b93a3' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}
select option { background: var(--panel-2); color: var(--text); }
@media (max-width: 600px) { .settings-grid { grid-template-columns: 1fr; } }

/* ===== Formular-Bausteine ===== */
.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
code {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px; font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text);
}
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
}

/* ===== Geschwindigkeits-Regler ===== */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; padding: 0; border: none;
  background: var(--border); border-radius: 999px; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff; cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff; cursor: pointer;
}
#agent-speed-val { color: var(--text); font-weight: 600; }

/* ===== Anruf-Detailansicht ===== */
.cd-head { margin-bottom: 14px; }
.cd-head h2 { margin: 0 0 4px; }
.cd-sub { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.cd-section { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 20px 0 8px; }
.cd-meta {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.cd-meta-item { background: var(--panel-2); padding: 9px 12px; display: flex; flex-direction: column; gap: 2px; }
.cd-meta-k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.cd-meta-v { font-size: 13px; }
.cd-cost { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--muted); }
.cd-cost strong { color: var(--text); }
.cd-analysis p { margin: 6px 0; font-size: 14px; }
.cd-flags { color: var(--muted); }
.cd-transcript { max-height: 50vh; }
.pause-divider {
  display: flex; align-items: center; justify-content: center;
  margin: 2px 0; gap: 8px; color: var(--muted); font-size: 11px;
}
.pause-divider::before, .pause-divider::after {
  content: ''; height: 1px; flex: 1; background: var(--border);
}
.pause-divider span {
  white-space: nowrap; padding: 1px 8px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.pause-divider.mid span { color: var(--amber); border-color: rgba(245,166,35,.45); }
.pause-divider.long span { color: var(--red); border-color: rgba(255,91,110,.45); }
.cd-open { color: var(--primary); font-weight: 600; white-space: nowrap; text-align: right; }

/* Nächste Schritte / Wiedervorlage */
.cd-nextsteps { margin: 6px 0; font-size: 14px; }
.cd-steps { margin: 4px 0 0; padding-left: 20px; }
.cd-steps li { margin: 2px 0; }
.cd-followup {
  margin-top: 10px; padding: 8px 12px; font-size: 13px;
  background: rgba(74,144,226,.10); border: 1px solid rgba(74,144,226,.35); border-radius: 8px;
}

/* Gesprächsanteil */
.cd-share { margin: 4px 0 8px; }
.cd-share-bar {
  display: flex; height: 14px; border-radius: 999px; overflow: hidden;
  background: var(--panel-2); border: 1px solid var(--border);
}
.cd-share-bar .seg.agent { background: var(--primary); }
.cd-share-bar .seg.cust { background: var(--green, #34c759); }
.cd-share-legend {
  display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px;
  font-size: 12px; color: var(--text);
}
.cd-share-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.cd-share-legend .dot.agent { background: var(--primary); }
.cd-share-legend .dot.cust { background: var(--green, #34c759); }

/* Entscheidungen-Toggle + Einträge */
.cd-transcript-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cd-toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.cd-toggle input { accent-color: var(--primary); }
.cd-transcript .decision { display: none; }
.cd-transcript.show-decisions .decision {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 4px auto; padding: 5px 10px; font-size: 12px;
  background: rgba(245,166,35,.08); border: 1px dashed rgba(245,166,35,.4);
  border-radius: 8px; color: var(--text); max-width: 90%;
}
.cd-transcript .decision .dec-ic { font-size: 13px; }
.cd-transcript .decision .dec-lb { font-weight: 600; }
.cd-transcript .decision .dec-dt { color: var(--muted); }

@media (max-width: 600px) { .cd-meta { grid-template-columns: repeat(2, 1fr); } }

/* ===== Performance ===== */
.perf-good, .good { color: var(--green, #34c759) !important; }
.perf-ok, .ok { color: var(--amber) !important; }
.perf-bad, .bad { color: var(--red) !important; }

/* Live-Chips */
.live-perf { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.perf-chip {
  display: flex; flex-direction: column; gap: 2px; padding: 6px 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; min-width: 96px;
}
.perf-chip .perf-k { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.perf-chip .perf-v { font-size: 15px; font-weight: 700; }

/* Detail-Popup Performance */
.cd-perf { display: flex; flex-direction: column; gap: 8px; }
.perf-stat { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.perf-stat-h { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.perf-stat-vals { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.perf-stat-vals > span:first-child { font-weight: 700; }

/* Aggregat-KPIs in Historie */
.perf-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.perf-kpi { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.perf-kpi-k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.perf-kpi-v { font-size: 22px; font-weight: 800; margin: 4px 0; }
.perf-kpi-s { font-size: 11px; }

/* ===== Wiedervorlagen ===== */
.followups { display: flex; flex-direction: column; gap: 8px; }
.fu-item {
  display: grid; grid-template-columns: 120px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--border);
  border-left: 3px solid var(--border); border-radius: 10px;
}
.fu-item.overdue { border-left-color: var(--red); }
.fu-item.today { border-left-color: var(--amber); }
.fu-item.upcoming { border-left-color: var(--primary); }
.fu-date { display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.fu-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-weight: 600; font-size: 11px;
  background: rgba(74,144,226,.15); color: var(--primary); width: fit-content;
}
.fu-badge.overdue { background: rgba(255,91,110,.15); color: var(--red); }
.fu-badge.today { background: rgba(245,166,35,.15); color: var(--amber); }
.fu-who { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fu-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 600px) {
  .fu-item { grid-template-columns: 1fr; }
  .fu-actions { justify-content: flex-start; }
}

/* ===== Stimmen-Vorschau ===== */
.voice-row { display: flex; gap: 8px; align-items: stretch; }
.voice-row select { flex: 1; min-width: 0; }
.voice-play { flex-shrink: 0; white-space: nowrap; align-self: stretch; }

/* ===== Skript-/Phasen-Editor ===== */
#phases-editor { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 12px; }
.phase-row {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 11px; padding: 12px 14px; position: relative;
  border-left: 3px solid var(--primary);
}
.phase-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.phase-head .phase-key { flex: 0 0 200px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; text-transform: uppercase; }
.phase-head .phase-name { flex: 1; min-width: 120px; }
.phase-del {
  flex-shrink: 0; width: 30px; height: 30px; padding: 0; font-size: 18px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.phase-row textarea { width: 100%; }
@media (max-width: 600px) {
  .phase-head { flex-wrap: wrap; }
  .phase-head .phase-key { flex: 1 1 100%; }
}

/* ===== Wissensdatenbank ===== */
.kb-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; margin-top: 12px; align-items: start; }
.kb-sections { background: var(--panel-2); border: 1px solid var(--border); border-radius: 11px; padding: 12px; }
.kb-sections-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }
.kb-section-list { display: flex; flex-direction: column; gap: 4px; max-height: 460px; overflow-y: auto; }
.kb-section {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 1px solid transparent; border-radius: 8px;
  padding: 8px 10px; cursor: pointer; color: var(--text); font-size: 13px;
}
.kb-section:hover { background: var(--panel); border-color: var(--border); }
.kb-section-i { flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px; background: var(--panel); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); }
.kb-section-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-section-n { flex-shrink: 0; font-size: 11px; color: var(--muted); }
.kb-editor { display: flex; flex-direction: column; }
.kb-textarea {
  width: 100%; min-height: 460px; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.6;
  tab-size: 2;
}
.kb-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .kb-layout { grid-template-columns: 1fr; }
  .kb-section-list { max-height: 200px; }
  .kb-textarea { min-height: 320px; }
}

/* ===== Finanzen ===== */
.tag.clickable { cursor: pointer; user-select: none; }
.tag.clickable:hover { border-color: var(--primary); color: var(--primary); }

.kpi-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 6px 0 18px;
}
.kpi {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 2px;
}
.kpi-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 20px; font-weight: 700; }
.kpi-sub { font-size: 11px; }
@media (max-width: 820px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.chart-head { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.chart-head h3 { margin: 0; font-size: 14px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-btn {
  background: var(--panel-2); border: none; color: var(--muted);
  padding: 6px 12px; cursor: pointer; font-size: 12px;
}
.seg-btn.active { background: var(--primary); color: #fff; }

.chart { margin: 10px 0 4px; overflow-x: auto; }
.bars-svg { display: block; }
.bars-svg .grid { stroke: var(--border); stroke-width: 1; }
.bars-svg .axis { fill: var(--muted); font-size: 10px; }
.bars-svg .bartotal { fill: var(--text); font-size: 10px; font-weight: 600; }
.bars-svg .bar.oai { fill: var(--primary); }
.bars-svg .bar.tnx { fill: var(--amber); }

.chart-legend { display: flex; gap: 18px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.chart-legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-legend .sw.oai { background: var(--primary); }
.chart-legend .sw.tnx { background: var(--amber); }

.model-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.model-card-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.model-card .model-label { font-weight: 600; white-space: nowrap; }
.model-card select { flex: 1; min-width: 220px; padding: 9px 10px; }
.model-card .muted { margin: 8px 0 0; font-size: 12px; }
@media (max-width: 560px) { .model-card .model-label { white-space: normal; } }
.pricing-box { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.pricing-box summary { cursor: pointer; font-size: 13px; color: var(--muted); margin-bottom: 10px; }

/* ===== Kalender ===== */
.cal-events { display: flex; flex-direction: column; gap: 8px; }
.cal-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
}
.cal-when { flex: 0 0 190px; font-size: 13px; color: var(--text); font-weight: 600; }
.cal-body { flex: 1; min-width: 0; }
.cal-title { font-size: 14px; }
.cal-sub { font-size: 12px; }
.cal-meet { font-size: 12px; color: var(--primary); text-decoration: none; }
.cal-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cal-actions a.btn { text-decoration: none; display: inline-flex; align-items: center; }
@media (max-width: 860px) {
  .cal-item { flex-direction: column; align-items: stretch; }
  .cal-when { flex: none; }
}

/* ===== App-Layout & Sidebar ===== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  transition: width .2s ease, transform .25s ease;
  z-index: 40;
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--border); min-height: 61px;
}
.logo { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; }
.nav { display: flex; flex-direction: column; padding: 10px 8px; gap: 4px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: none; border: none; color: var(--muted);
  border-radius: 8px; cursor: pointer; font-size: 14px; text-align: left; width: 100%;
  white-space: nowrap; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-ico { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; }

.icon-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--primary); }

/* Eingeklappt (Desktop, nur Icons) */
.sidebar.collapsed { width: 66px; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label { display: none; }
.sidebar.collapsed .sidebar-head { justify-content: center; padding: 16px 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; }
.sidebar.collapsed #sidebar-collapse { transform: rotate(180deg); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hamburger { display: none; }
.sidebar-overlay { display: none; }

header { gap: 12px; }
header h1 { flex: 1; }

/* ===== Mobil ===== */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; width: 250px;
    transform: translateX(-100%); box-shadow: 4px 0 24px rgba(0,0,0,.4);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: 250px; }
  .sidebar.collapsed .logo-text, .sidebar.collapsed .nav-label { display: inline; }
  .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 10px 12px; }
  #sidebar-collapse { display: none; }
  .hamburger { display: inline-flex; }
  .sidebar-overlay.show {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,.55); z-index: 35;
  }
  main { padding: 16px; }
  header { padding: 12px 16px; }
  header h1 { font-size: 16px; }
  .badges { display: none; }
  .row { flex-direction: column; align-items: stretch; }
  .row input, .row select, .row .btn { width: 100%; min-width: 0; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-head { flex-wrap: wrap; gap: 8px; }
}

/* ===== Telefon-Eingabe (intl-tel-input) Dark-Theme ===== */
.iti { flex: 1; min-width: 140px; display: flex; }
.iti > input, .iti input[type=tel] { width: 100%; }
.iti__dropdown-content,
.iti__country-list {
  background: var(--panel-2) !important; color: var(--text) !important;
  border: 1px solid var(--border) !important; border-radius: 8px;
}
.iti__country.iti__highlight,
.iti__country:hover { background: var(--panel) !important; }
.iti__search-input {
  background: var(--panel) !important; color: var(--text) !important;
  border-bottom: 1px solid var(--border) !important;
}
.iti__dial-code { color: var(--muted); }
.iti__selected-country { border-radius: 8px 0 0 8px; }

/* ===== Login-Overlay ===== */
.login-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2030, var(--bg));
  padding: 24px;
}
.login-overlay.hidden { display: none; }
.login-card {
  width: 100%; max-width: 360px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px 26px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  display: flex; flex-direction: column;
}
.login-logo { font-size: 22px; font-weight: 700; letter-spacing: .02em; }
.login-logo span { color: var(--primary); }
.login-sub { margin: 4px 0 20px; color: var(--muted); font-size: 14px; }
.login-label { font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
.login-input {
  width: 100%; padding: 11px 12px; font-size: 15px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
}
.login-input:focus { outline: none; border-color: var(--primary); }
.login-error { color: var(--red); font-size: 13px; min-height: 18px; margin: 10px 0 2px; }
.login-submit { margin-top: 8px; width: 100%; padding: 12px; font-size: 15px; }

/* ===== Sidebar-Footer / Logout ===== */
.sidebar-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); }
.nav-item.logout { width: 100%; color: var(--muted); }
.nav-item.logout:hover { color: var(--red); }
