/* ===========================================================
   Zahn+Zentrum Moers -- Anrufzentrale
   Farbwelt: echtes Corporate Design des Kunden (Petrol/Türkis +
   Pink/Magenta), Light/Dark umschaltbar per Knopf oben rechts.
   Die Anmeldeseite bleibt bewusst im bisherigen dunklen
   eIT-Call-Assistent-Design (siehe eigener Abschnitt unten) und
   ist von diesem Farbsystem unabhängig.
   =========================================================== */

:root {
  --font: 'Inter', -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Barlow Condensed', -apple-system, "Segoe UI", sans-serif;

  --bg: #F3F6F5;
  --card: #FFFFFF;
  --card-alt: #FAFBFB;
  --border: #E3E8E6;
  --border-strong: #D2DAD7;
  --ink: #182420;
  --ink-soft: #5C6B67;
  --ink-muted: #93A19D;

  --teal: #0E8F86;
  --teal-dark: #0B6E67;
  --teal-tint: #E3F4F2;
  --teal-tint-text: #0B6E67;
  --on-teal: #FFFFFF;

  --pink: #E5127E;
  --pink-dark: #A80E5E;
  --pink-tint: #FCE7F1;
  --pink-tint-text: #A80E5E;

  --success: #1E7A4C;
  --success-tint: #E6F5EC;
  --amber: #96650A;
  --amber-tint: #FFF3DE;
  --gray-badge: #5C6B67;
  --gray-tint: #EDEFEE;
  --info: #35507A;
  --info-tint: #EAF0F8;
  --danger: #C0304A;
  --danger-tint: #FBE6EA;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20,30,28,0.04), 0 4px 14px rgba(20,30,28,0.05);
}

:root[data-theme="dark"] {
  --bg: #10161A;
  --card: #182123;
  --card-alt: #1D2729;
  --border: #263332;
  --border-strong: #34433F;
  --ink: #E9F1EE;
  --ink-soft: #A7BAB4;
  --ink-muted: #6E8681;

  --teal: #2FBBAE;
  --teal-dark: #229488;
  --teal-tint: rgba(47,187,174,0.16);
  --teal-tint-text: #5DD9CC;
  --on-teal: #08201D;

  --pink: #FF4FA3;
  --pink-dark: #E5127E;
  --pink-tint: rgba(255,79,163,0.18);
  --pink-tint-text: #FF8FC3;

  --success: #45CC8B;
  --success-tint: rgba(69,204,139,0.16);
  --amber: #E7B24E;
  --amber-tint: rgba(231,178,78,0.16);
  --gray-badge: #A7BAB4;
  --gray-tint: rgba(167,186,180,0.14);
  --info: #7AA0D6;
  --info-tint: rgba(122,160,214,0.16);
  --danger: #F0708A;
  --danger-tint: rgba(240,112,138,0.16);

  --shadow: 0 1px 2px rgba(0,0,0,0.35), 0 6px 18px rgba(0,0,0,0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-dark); }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* =============== Anmeldeseite (bleibt eigenständig dunkel) =============== */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0a0c10, #14171b 60%);
  font-family: 'Inter', -apple-system, sans-serif;
}
.login-card {
  width: 100%; max-width: 380px; background: #1c2027; border: 1px solid #2a2f38;
  border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); padding: 36px 32px;
}
.login-logo { font-family: 'Sora', sans-serif; font-size: 22px; font-weight: 700; color: #e7eaee; margin-bottom: 20px; }
.login-logo span { color: #7c8cff; font-weight: 400; }
.login-card h1 { font-size: 17px; margin: 0 0 18px; color: #8a94a3; font-weight: 500; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #8a94a3; }
.login-form input {
  padding: 10px 12px; border: 1px solid #2a2f38; border-radius: 8px; font-size: 14px;
  background: #21262e; color: #e7eaee;
}
.login-error { background: rgba(255,107,107,0.12); color: #ff6b6b; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.login-hint { margin-top: 18px; font-size: 12px; color: #8a94a3; }
.login-body :focus-visible { outline-color: #7c8cff; }
.login-body .btn { border: 1px solid #2a2f38; background: #1c2027; padding: 10px 14px; border-radius: 8px; font-size: 14px; cursor: pointer; color: #e7eaee; }
.login-body .btn-block { width: 100%; }
.login-body .btn-primary { background: #7c8cff; border-color: #7c8cff; color: #10121a; font-weight: 600; }
.login-body .btn-primary:hover { background: #6070f0; }

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

/* ---- Sidebar ---- */
.sidebar {
  width: 250px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 22px 18px;
}
.logo-row { display: flex; align-items: center; gap: 10px; padding: 0 4px 6px; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--teal); color: var(--on-teal);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 19px; flex-shrink: 0;
}
.logo-text { line-height: 1.15; }
.logo-text .l1 { font-size: 10.5px; letter-spacing: 0.06em; color: var(--teal-dark); font-weight: 600; text-transform: uppercase; }
.logo-text .l2 { font-family: var(--font-display); font-weight: 800; font-size: 16.5px; letter-spacing: 0.01em; color: var(--ink); text-transform: uppercase; }
.sidebar-sub { font-size: 11.5px; color: var(--ink-muted); padding: 8px 4px 20px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }

nav.main-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px;
  color: var(--ink-soft); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none;
  background: none; border: none; width: 100%; text-align: left;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item.active { background: var(--teal-tint); color: var(--teal-tint-text); font-weight: 600; }
.nav-item:not(.active):hover { background: var(--card-alt); }
.nav-item.soon { opacity: 0.6; cursor: default; }
.nav-item .soon-tag { margin-left: auto; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); background: var(--gray-tint); padding: 2px 6px; border-radius: 999px; }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--pink-tint); color: var(--pink-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.sidebar-footer .name { font-size: 13px; font-weight: 600; color: var(--ink); }
.sidebar-footer .role { font-size: 11.5px; color: var(--ink-muted); }
.sidebar-footer a.icon-btn { margin-left: auto; }

/* ---- Main / Topbar ---- */
.main { flex: 1; min-width: 0; padding: 26px 32px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.topbar-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-title { font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: 0.01em; color: var(--ink); }
.status-pill { display: flex; align-items: center; gap: 6px; background: var(--teal-tint); color: var(--teal-tint-text); font-size: 12.5px; font-weight: 600; padding: 5px 11px 5px 9px; border-radius: 999px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 9px; padding: 8px 12px; width: 240px; color: var(--ink-muted); }
.search-box svg { width: 16px; height: 16px; flex-shrink: 0; }
.search-box span { font-size: 13px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 9px; background: var(--card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--ink-soft); position: relative; flex-shrink: 0; cursor: pointer; text-decoration: none;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--pink); border: 1.5px solid var(--card); }
.topbar .avatar { width: 36px; height: 36px; font-size: 13px; }
#theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] #theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] #theme-toggle .icon-moon { display: none; }

/* ---- KPI ---- */
.kpi-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 22px; }
.kpi-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi-label { font-size: 12.5px; color: var(--ink-soft); font-weight: 500; margin-bottom: 8px; }
.kpi-value { font-family: var(--font-display); font-weight: 700; font-size: 32px; color: var(--ink); line-height: 1; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--ink-muted); }
.kpi-sub.up { color: var(--success); }

/* ---- Content grid / Panels ---- */
.content-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 20px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 14px; border-bottom: 1px solid var(--border); }
.panel-title { font-size: 15px; font-weight: 600; color: var(--ink); }

.filter-bar { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.filter-chip { display: flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }
.filter-chip select { border: none; background: none; color: inherit; font: inherit; cursor: pointer; }
.filter-chip svg { width: 12px; height: 12px; color: var(--ink-muted); }
.filter-reset { margin-left: auto; font-size: 12.5px; color: var(--teal-dark); font-weight: 600; padding: 6px 4px; background: none; border: none; cursor: pointer; }

table.calls { width: 100%; border-collapse: collapse; }
table.calls th { text-align: left; font-size: 11.5px; color: var(--ink-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; padding: 10px 20px; border-bottom: 1px solid var(--border); }
table.calls td { padding: 12px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 13px; }
table.calls tr:last-child td { border-bottom: none; }
table.calls tr.selected td { background: var(--teal-tint); }
table.calls tr.call-row { cursor: pointer; }
table.calls tr.call-row:not(.selected):hover td { background: var(--card-alt); }
.t-time { color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.caller-name { font-weight: 600; color: var(--ink); }
.caller-phone { font-size: 12px; color: var(--ink-muted); }
.concern { color: var(--ink); }
.concern-sub { font-size: 11.5px; color: var(--ink-muted); }
.assigned { color: var(--ink-soft); font-size: 12.5px; }

.badge { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.badge-ki_beantwortet { background: var(--teal-tint); color: var(--teal-tint-text); }
.badge-rueckruf_offen { background: var(--amber-tint); color: var(--amber); }
.badge-an_mitarbeitende { background: var(--info-tint); color: var(--info); }
.badge-erledigt { background: var(--success-tint); color: var(--success); }
.badge-verpasst { background: var(--gray-tint); color: var(--gray-badge); }
.badge-eskaliert { background: var(--pink-tint); color: var(--pink-dark); }
.badge-in_bearbeitung { background: var(--info-tint); color: var(--info); }
.badge-dringend { background: var(--pink-tint); color: var(--pink-dark); }

.ki-chip { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 20px; border-radius: 6px; background: var(--teal); color: var(--on-teal); font-size: 10px; font-weight: 700; letter-spacing: 0.02em; }
.ki-none { color: var(--ink-muted); font-size: 12px; text-align: center; display: block; }

/* ---- Detail panel ---- */
.detail-head { padding: 18px 20px 16px; border-bottom: 1px solid var(--border); }
.detail-badges { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.detail-name { font-family: var(--font-display); font-weight: 700; font-size: 21px; color: var(--ink); }
.detail-phone { font-size: 12.5px; color: var(--ink-muted); margin-top: 2px; }

.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--card-alt); }
.meta-item .meta-label { font-size: 11px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 3px; }
.meta-item .meta-value { font-size: 13px; font-weight: 600; color: var(--ink); }

.section { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.section:last-child { border-bottom: none; }
.section-title { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 10px; }
.summary-text { font-size: 13.5px; color: var(--ink); line-height: 1.65; }
.placeholder-text { font-size: 12.5px; color: var(--ink-muted); font-style: italic; }

.next-step { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--pink-tint); border-radius: 9px; padding: 11px 14px; flex-wrap: wrap; }
.next-step-text { font-size: 12.5px; font-weight: 600; color: var(--pink-dark); }
.priority-tag { font-size: 11px; font-weight: 700; color: var(--pink-dark); background: var(--card); border-radius: 999px; padding: 3px 9px; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-muted); font-size: 13px; }
.hint { font-size: 12px; color: var(--ink-muted); margin-top: -8px; margin-bottom: 14px; }

/* =============== Stage 2: Dashboard / Aufgaben / Kontakte / Wissensbasis / Berichte =============== */

/* Zeitverlauf-Chart (Anrufe pro Tag) */
.spark-chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; }
.spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; min-width: 4px; }
.spark-value { font-size: 10.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.spark-bar { width: 100%; max-width: 22px; background: var(--teal); border-radius: 4px 4px 1px 1px; min-height: 3px; transition: background 0.15s; }
.spark-col:hover .spark-bar { background: var(--teal-dark); }
.spark-label { font-size: 9.5px; color: var(--ink-muted); white-space: nowrap; }

/* Horizontale Balkendiagramme (Status/Fachbereich/Team) */
.chart-bars { display: flex; flex-direction: column; gap: 11px; }
.chart-bar-row { display: grid; grid-template-columns: 128px 1fr 32px; align-items: center; gap: 10px; }
.chart-bar-label { font-size: 12.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-bar-track { background: var(--card-alt); border-radius: 6px; height: 9px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 6px; min-width: 3px; }
.chart-bar-value { font-size: 12.5px; font-weight: 600; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }

/* Aufgaben */
.task-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 8px; border-bottom: 1px solid var(--border); cursor: default; }
.task-row:last-child { border-bottom: none; }
.task-row input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--teal); cursor: pointer; flex-shrink: 0; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.task-row.done .task-title { text-decoration: line-through; color: var(--ink-muted); }
.task-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--ink-muted); margin-top: 3px; }
.task-overdue { color: var(--danger); font-weight: 600; }
.task-notes { font-size: 12.5px; color: var(--ink-soft); margin-top: 5px; }
.task-delete { flex-shrink: 0; }

/* =============== Wiederverwendete Komponenten (Einstellungen/Konto) =============== */
.page-legacy { max-width: 1180px; }
.page-legacy h1 { font-family: var(--font-display); font-size: 24px; margin: 0 0 18px; }

.subtabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.subtabs button { background: none; border: none; padding: 10px 14px; font-size: 14px; color: var(--ink-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtabs button.active { color: var(--teal-dark); border-bottom-color: var(--teal); font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card h2 { font-size: 15px; margin: 0 0 14px; color: var(--ink); }
.card h3 { font-size: 12px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 10px; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; }
.field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=date],
.field input[type=time], .field input[type=number], .field input[type=password], .field textarea, .field select {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; color: var(--ink);
  background: var(--card); font-family: inherit;
}
.field textarea { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

.btn { border: 1px solid var(--border); background: var(--card); padding: 8px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--ink); }
.btn:hover { background: var(--card-alt); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: var(--on-teal); font-weight: 600; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-block { width: 100%; }
.btn-danger { color: var(--danger); border-color: var(--danger-tint); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--border); }
.switch-row:first-child { border-top: none; }
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; cursor: pointer; transition: background .15s; }
.switch .track::before { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.switch input:checked + .track { background: var(--teal); }
.switch input:checked + .track::before { transform: translateX(18px); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; color: #fff; font-weight: 600; white-space: nowrap; }

.cat-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; background: var(--card); }
.cat-item-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; }
.cat-item-head .swatch { width: 10px; height: 10px; border-radius: 50%; }
.cat-item-head .label { flex: 1; font-size: 14px; font-weight: 500; color: var(--ink); }
.cat-item-body { padding: 0 16px 16px; border-top: 1px solid var(--border); }
.tpl-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.tpl-item:first-child { border-top: none; }
.tpl-item .tpl-title { font-weight: 600; font-size: 13px; color: var(--ink); }
.tpl-item .tpl-body { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.tpl-actions { display: flex; gap: 6px; flex-shrink: 0; }

.hours-day { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.hours-day:first-child { border-top: none; }
.hours-day .day-label { width: 110px; font-size: 13px; font-weight: 500; color: var(--ink); }
.hours-slot { display: flex; align-items: center; gap: 6px; }
.hours-slot input[type=time] { width: 92px; }

.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  opacity: 0; transform: translateY(8px); transition: all .2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 12px 16px; overflow-x: auto; }
  .sidebar-sub, .sidebar-footer { display: none; }
  nav.main-nav { flex-direction: row; }
  .main { padding: 18px; }
  .kpi-row { grid-template-columns: repeat(2,1fr); }
}
