/* Teams Softphone – dunkle Steuerpult-Ästhetik.
   Signatur: das Wähl-Display in Phosphor-Cyan + Tabular-Mono, wie ein echtes
   Telefon-Display. Alles andere bleibt ruhig. */

:root {
  --bg: #0d1014;
  --surface: #151a21;
  --raised: #1c232c;
  --raised-hover: #222b35;
  --border: #283039;
  --text: #e8ecf1;
  --muted: #889099;
  --phosphor: #22d3ee;      /* Display-Akzent (immer auf dunklem Screen) */
  --accent: #22d3ee;        /* UI-Akzent (themenabhängig) */
  --call: #22c55e;
  --hangup: #ef4444;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 30px rgb(0 0 0 / 0.35);
  --mono: "SFMono-Regular", "JetBrains Mono", "Consolas", ui-monospace, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Helles Theme – nur Flächen/Text/Akzent werden überschrieben. Das Wähl-Display
   (.dialer__screen) bleibt bewusst dunkel: ein Telefon-Display wirkt so stimmig. */
:root[data-theme="light"] {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --raised: #eef1f5;
  --raised-hover: #e4e8ee;
  --border: #d7dce3;
  --text: #1a1f26;
  --muted: #5d6673;
  --accent: #0e7490;        /* dunkleres Cyan für Kontrast auf Hell */
  --shadow: 0 8px 24px rgb(15 23 42 / 0.10);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f4f6f9; --surface: #ffffff; --raised: #eef1f5; --raised-hover: #e4e8ee;
    --border: #d7dce3; --text: #1a1f26; --muted: #5d6673; --accent: #0e7490;
    --shadow: 0 8px 24px rgb(15 23 42 / 0.10);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 32px);
  min-height: 100dvh;
}

/* ── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand__mark {
  width: 14px; height: 14px; border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 60%, transparent);
}
.brand__name { font-weight: 600; letter-spacing: 0.2px; }
.session { display: flex; align-items: center; gap: 12px; }
.session__who { color: var(--muted); font-size: 0.9rem; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 360px) 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ── Dialer-Display (Signatur) ──────────────────────────────────────── */
.dialer__screen {
  background: #0a0d11;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.dialer__display {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  text-shadow: 0 0 10px color-mix(in srgb, var(--phosphor) 35%, transparent);
}
.dialer__display::placeholder { color: #3a4654; text-shadow: none; }
.dialer__state {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.dialer__state[data-state="connected"] { color: var(--call); }
.dialer__state[data-state="ringing"],
.dialer__state[data-state="dialing"] { color: var(--phosphor); }
.dialer__state[data-state="disconnected"] { color: var(--hangup); }

/* ── Dialpad ────────────────────────────────────────────────────────── */
.dialpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.key {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease, transform 0.06s ease;
}
.key:hover { background: var(--raised-hover); }
.key:active { transform: scale(0.96); }
.key:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.key__digit { font-size: 1.4rem; font-weight: 500; line-height: 1; }
.key__letters { font-size: 0.6rem; letter-spacing: 1.5px; color: var(--muted); margin-top: 4px; }

/* ── Aktionen ───────────────────────────────────────────────────────── */
.dialer__actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 10px;
  align-items: center;
}
.btn {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--raised);
  color: var(--text);
  padding: 11px 14px;
  cursor: pointer;
  transition: background 0.12s ease, opacity 0.12s ease, transform 0.06s ease;
}
.btn:hover { background: var(--raised-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--sm { padding: 6px 10px; font-size: 0.8rem; }
.btn--wide { width: 100%; margin-top: 10px; }
.btn--ghost { background: transparent; }
.btn--round { border-radius: var(--radius-sm); }
.btn--round.active { background: var(--accent); color: #06222a; border-color: transparent; }
.btn--call {
  background: var(--call); border-color: transparent; color: #052e16; font-weight: 600;
}
.btn--call:hover { background: color-mix(in srgb, var(--call) 88%, white); }
.btn--hangup {
  background: var(--hangup); border-color: transparent; color: #2a0606; font-weight: 600;
}
.btn--hangup:hover { background: color-mix(in srgb, var(--hangup) 88%, white); }

/* ── Verzeichnis ────────────────────────────────────────────────────── */
/* ── Rechte Spalte (Verzeichnis + Anrufliste gestapelt) ─────────────── */
.stack { display: flex; flex-direction: column; gap: 20px; }
.panel__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.panel__title { margin: 0; font-size: 1rem; font-weight: 600; }
.directory__list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.contact {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 10px; cursor: pointer;
  color: var(--text); transition: background 0.12s ease, border-color 0.12s ease;
}
.contact:hover { background: var(--raised); border-color: var(--border); }
.contact:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.contact__avatar {
  flex: none; width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--raised); color: var(--accent);
  font-size: 0.8rem; font-weight: 600;
}
.contact__body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.contact__name { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact__meta { font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact__call { font-size: 0.78rem; color: var(--accent); opacity: 0; transition: opacity 0.12s ease; }
.contact:hover .contact__call { opacity: 1; }
.empty { color: var(--muted); font-size: 0.88rem; padding: 8px 2px; }

/* ── Toasts ─────────────────────────────────────────────────────────── */
.toasts {
  position: fixed; top: 16px; right: 16px; z-index: 50;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--raised); border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 0.85rem; max-width: 320px;
  opacity: 0; transform: translateX(12px); transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast--show { opacity: 1; transform: none; }
.toast--success { border-left-color: var(--call); }
.toast--error { border-left-color: var(--hangup); }
.toast--info { border-left-color: var(--accent); }

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

/* ── Anrufliste ─────────────────────────────────────────────────────── */
.calllog__list { display: flex; flex-direction: column; gap: 4px; max-height: 36vh; overflow-y: auto; }
.logrow {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px; border-radius: var(--radius-sm);
}
.logrow:hover { background: var(--raised); }
.logrow__dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.logrow__dot--ok { background: var(--call); }
.logrow__dot--miss { background: var(--hangup); }
.logrow__dot--rej { background: var(--muted); }
.logrow__body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.logrow__name { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logrow__meta { font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logrow__status { font-size: 0.72rem; letter-spacing: 0.3px; color: var(--muted); white-space: nowrap; }
.logrow__status--ok { color: var(--call); }
.logrow__status--miss { color: var(--hangup); }
.logrow__cb {
  flex: none; background: transparent; border: 1px solid var(--border);
  color: var(--accent); border-radius: 8px; padding: 4px 9px;
  font-size: 0.72rem; cursor: pointer; opacity: 0; transition: opacity 0.12s ease;
}
.logrow:hover .logrow__cb { opacity: 1; }
.logrow__cb:hover { background: var(--raised-hover); }

/* ── Overlay (Eingehend + Transfer) ─────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  background: rgb(5 7 10 / 0.72); backdrop-filter: blur(4px);
  padding: 20px;
}
.overlay[hidden] { display: none; }

/* Eingehender Anruf */
.incoming-card {
  width: min(360px, 92vw);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px; text-align: center;
  box-shadow: var(--shadow); position: relative;
}
.incoming-card__pulse {
  display: block; width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 50%; background: color-mix(in srgb, var(--call) 22%, transparent);
  position: relative;
}
.incoming-card__pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--call); animation: ring 1.6s ease-out infinite;
}
@keyframes ring {
  0% { transform: scale(0.7); opacity: 0.9; }
  100% { transform: scale(1.5); opacity: 0; }
}
.incoming-card__label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1.5px; margin: 0 0 8px; }
.incoming-card__name { font-size: 1.35rem; font-weight: 600; margin: 0 0 4px; }
.incoming-card__number { font-family: var(--mono); color: var(--accent); margin: 0 0 22px; font-variant-numeric: tabular-nums; }
.incoming-card__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Transfer-Modal */
.modal {
  width: min(440px, 94vw); max-height: 86vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.modal__title { margin: 0; font-size: 1.05rem; font-weight: 600; }
.modal__close {
  background: transparent; border: none; color: var(--muted);
  font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0 4px;
}
.modal__close:hover { color: var(--text); }
.modal__body { padding: 18px 20px; overflow-y: auto; }

.tr-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tr-mode {
  text-align: left; background: var(--raised); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; gap: 3px; transition: border-color 0.12s ease, background 0.12s ease;
}
.tr-mode:hover { background: var(--raised-hover); }
.tr-mode.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--raised)); }
.tr-mode__t { font-size: 0.9rem; font-weight: 600; }
.tr-mode__d { font-size: 0.74rem; color: var(--muted); }

.tr-search {
  width: 100%; background: #0a0d11; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text);
  font-family: var(--sans); font-size: 0.88rem; margin-bottom: 12px; outline: none;
}
.tr-search:focus { border-color: var(--accent); }
.tr-list { display: flex; flex-direction: column; gap: 4px; max-height: 38vh; overflow-y: auto; }
.tr-contact {
  text-align: left; background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 9px 10px; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; gap: 2px; transition: background 0.12s ease, border-color 0.12s ease;
}
.tr-contact:hover { background: var(--raised); border-color: var(--border); }
.tr-contact__name { font-size: 0.9rem; }
.tr-contact__meta { font-size: 0.75rem; color: var(--muted); }

.tr-consult { text-align: center; padding: 8px 0; }
.tr-consult__lead { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1px; margin: 0 0 6px; }
.tr-consult__name { font-size: 1.2rem; font-weight: 600; margin: 0 0 10px; }
.tr-consult__status { color: var(--accent); font-size: 0.85rem; margin: 0 0 22px; }
.tr-consult__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Theme-Umschalter ───────────────────────────────────────────────── */
.theme-toggle {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  cursor: pointer; transition: background 0.12s ease, border-color 0.12s ease;
}
.theme-toggle:hover { background: var(--raised); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 18px; height: 18px; }
/* Sonne im Dunkelmodus (Klick -> hell), Mond im Hellmodus (Klick -> dunkel) */
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: block; }
}

/* ── Agenten-Verfügbarkeit (Call Queue) ─────────────────────────────── */
.agent-toggle {
  display: flex; align-items: center; gap: 8px;
  width: 100%; margin-bottom: 16px;
  background: var(--raised); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  color: var(--text); font: inherit; font-size: 0.85rem; cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.agent-toggle:hover:not(:disabled) { background: var(--raised-hover); }
.agent-toggle:disabled { opacity: 0.5; cursor: not-allowed; }
.agent-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.agent-toggle__dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
.agent-toggle[aria-pressed="true"] { border-color: var(--call); }
.agent-toggle[aria-pressed="true"] .agent-toggle__dot {
  background: var(--call); box-shadow: 0 0 8px color-mix(in srgb, var(--call) 70%, transparent);
}
.agent-toggle [data-agent-state] { margin-left: auto; color: var(--muted); }
.agent-toggle[aria-pressed="true"] [data-agent-state] { color: var(--call); }

/* ── Presence-Punkte im Verzeichnis ─────────────────────────────────── */
.contact__avatar { position: relative; }
/* Presence-Punkt: deutlich sichtbar am Avatar (Grösse über --presence-size). */
.presence {
  --presence-size: 16px;
  position: absolute; right: -4px; bottom: -4px;
  width: var(--presence-size); height: var(--presence-size); border-radius: 50%;
  border: 3px solid var(--surface, #ffffff); background: var(--muted);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.presence--avail { background: #22c55e; }
.presence--busy  { background: #ef4444; }
.presence--away  { background: #eab308; }
.presence--off   { background: var(--muted); }

/* ── Eingehend: "über <Resource-Account>" ───────────────────────────── */
.incoming-card__via {
  margin: 2px 0 0; font-size: 0.8rem; color: var(--accent); font-weight: 600;
}

/* ── Verwaltung (Resource-Accounts) ─────────────────────────────────── */
.modal--wide { max-width: 720px; width: min(720px, 94vw); }
.adm-hint { font-size: 0.8rem; color: var(--muted); margin: 0 0 12px; }
.adm-add {
  display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px;
  margin-bottom: 16px;
}
.adm-add input, .adm-ra__head input {
  background: var(--raised); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; font-size: 0.85rem;
  min-width: 0;
}
.adm-ra {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 12px; background: var(--raised);
}
.adm-ra__head { display: grid; grid-template-columns: 1fr 1fr 1fr auto auto; gap: 8px; }
.adm-ra__label { font-size: 0.78rem; color: var(--muted); display: block; margin: 10px 0 6px; }
/* Zuweisung: Suche (links) + Auswahlliste (rechts) */
.picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.picker__col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.picker__label { font-size: 0.78rem; color: var(--muted); }
.picker__search {
  background: #ffffff; border: 1px solid var(--border); color: #111827;
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; font-size: 0.85rem;
}
.picker__search::placeholder { color: #6b7280; }
.picker__results {
  height: 168px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface, #ffffff); padding: 4px;
}
.picker__hit {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name add" "upn add";
  width: 100%; text-align: left; gap: 0 8px; align-items: center;
  background: none; border: none; border-radius: 6px; padding: 6px 8px;
  font: inherit; color: var(--text); cursor: pointer;
}
.picker__hit:hover, .picker__hit:focus-visible { background: var(--raised); outline: none; }
.picker__hit-name { grid-area: name; font-size: 0.86rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker__hit-upn { grid-area: upn; font-size: 0.75rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker__hit-add { grid-area: add; font-size: 1.1rem; font-weight: 700; color: var(--accent); }
.picker__list {
  height: 168px; background: var(--surface, #ffffff); color: #111827;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px; font: inherit; font-size: 0.86rem;
}
.picker__list option { padding: 5px 7px; border-radius: 5px; }
.picker__remove { align-self: flex-start; }
@media (max-width: 640px) { .picker { grid-template-columns: 1fr; } }
.btn--danger { color: #ef4444; border-color: #ef4444; }
@media (max-width: 640px) {
  .adm-add, .adm-ra__head { grid-template-columns: 1fr; }
}

/* ── Board-Layout (Skizze: Felder 1–10) ─────────────────────────────── */
.board { display: flex; flex-direction: column; gap: 16px; }
.board__top { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.board__right { display: flex; flex-direction: column; gap: 10px; }
.board__controls { display: flex; gap: 10px; flex-wrap: wrap; }
.board__bottom { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; }
@media (max-width: 860px) {
  .board__top, .board__bottom { grid-template-columns: 1fr; }
}

/* (1) Aktueller Anruf – Schatten = im Fokus */
.callcard {
  transition: box-shadow 0.15s ease, border-color 0.15s ease; min-height: 150px;
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start;
}
.callcard__main { min-width: 0; }
.callcard[data-active="true"] {
  border-color: var(--accent);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 35%, transparent);
}
.callcard__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.callcard__label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.callcard__name { font-size: 1.35rem; font-weight: 700; margin: 4px 0 0; }
.callcard__number { color: var(--muted); margin: 2px 0 0; }
.callcard__via { margin: 4px 0 0; font-size: 12pt; color: var(--accent); font-weight: 600; }
.callcard__actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* Anrufsteuerung als Spalte am rechten Rand der Anrufkarte */
.callcard__controls {
  display: flex; flex-direction: column; gap: 8px;
  padding-left: 14px; border-left: 1px solid var(--border);
  align-self: stretch; width: 150px;
}
.ctrl--card { width: 100%; min-width: 0; padding: 9px 10px; font-size: 0.84rem; }
@media (max-width: 860px) {
  .callcard { grid-template-columns: 1fr; }
  .callcard__controls {
    flex-direction: row; flex-wrap: wrap; width: auto;
    padding-left: 0; padding-top: 12px;
    border-left: none; border-top: 1px solid var(--border);
  }
  .ctrl--card { width: auto; flex: 1 1 45%; }
}

/* (2) Suche + Ergebnisliste */
.search { position: relative; }
.search__input {
  width: 100%; background: #ffffff; border: 1px solid var(--border);
  color: #111827; border-radius: var(--radius-sm); padding: 12px 14px;
  font: inherit; font-size: 0.95rem;
}
.search__input::placeholder { color: #6b7280; }
.search__input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.search__results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  /* Deckender Hintergrund: --panel existiert nicht (Themes definieren
     --surface) – mit var(--panel) blieb das Feld transparent. */
  background: var(--surface, #ffffff); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  max-height: 300px; overflow: auto; padding: 6px;
}
.search__results .contact { width: 100%; }

/* (3) Transferziel – Schatten = im Fokus */
.transfercard { flex: 1; transition: box-shadow 0.15s ease, border-color 0.15s ease; min-height: 84px; }
.transfercard[data-active="true"] {
  border-color: var(--call);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--call) 35%, transparent);
}
.transfercard__name { font-size: 1.1rem; font-weight: 700; margin: 6px 0 0; }
.transfercard__status { color: var(--muted); font-size: 0.85rem; margin: 2px 0 0; }

/* (4)–(8) Steuerleiste */
.ctrl { min-width: 128px; padding: 12px 16px; }
.ctrl.active { border-color: var(--accent); color: var(--accent); }
.ctrl--hangup { margin-left: auto; color: #fff; background: var(--hangup, #dc2626); border-color: transparent; }
.ctrl--hangup:disabled { opacity: 0.45; }

/* (8) Kalender-Modal */
.cal-date { color: var(--muted); font-size: 0.85rem; margin: 0 0 10px; }
.cal-item {
  display: grid; grid-template-columns: 110px 90px 1fr; gap: 10px;
  padding: 8px 10px; border-left: 3px solid var(--muted);
  background: var(--raised); border-radius: 6px; margin-bottom: 6px; font-size: 0.9rem;
}
.cal-item--busy { border-left-color: #ef4444; }
.cal-item--tentative { border-left-color: #eab308; }
.cal-item--oof { border-left-color: #a855f7; }
.cal-item--free { border-left-color: #22c55e; }
.cal-item__time { font-variant-numeric: tabular-nums; }
.cal-item__status { color: var(--muted); }

/* Resource-Account-Kennzeichnung in der Anrufliste */
.logrow__via { color: var(--accent); font-weight: 600; }

/* Sprachauswahl */
.lang-select {
  background: var(--raised); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; font-size: 0.85rem;
  cursor: pointer;
}
.lang-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Fallback-Konfiguration in der Verwaltung */
.adm-fb { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.adm-fb__col { display: flex; flex-direction: column; gap: 6px; }
.adm-fb select, .adm-fb input {
  background: var(--raised); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; font-size: 0.85rem;
}
@media (max-width: 640px) { .adm-fb { grid-template-columns: 1fr; } }

/* Leitungsauswahl im Dialer (Anrufen als …) */
.line-select {
  width: 100%; margin-bottom: 10px;
  background: var(--raised); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 10px; font: inherit; font-size: 0.85rem;
}

/* Lizenzbelegung in der Verwaltung */
.adm-lic {
  font-size: 0.82rem; color: var(--muted); margin: 0 0 12px;
  padding: 8px 10px; background: var(--raised); border-radius: var(--radius-sm);
}

/* ── Verwaltungs-Unterseite (/admin) ────────────────────────────────── */
.brand__sub {
  font-size: 0.78rem; color: var(--muted); border-left: 1px solid var(--border);
  margin-left: 10px; padding-left: 10px;
}
.admin-main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.admin-gate { color: var(--muted); padding: 40px 0; text-align: center; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); font: inherit; font-size: 0.92rem; font-weight: 600;
  padding: 10px 14px; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabpanel { animation: fade 0.15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.upload { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.upload input[type="file"] {
  background: var(--raised); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; font-size: 0.85rem;
}
.adm-file {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 8px; background: var(--raised);
}
.adm-file__name { font-weight: 600; min-width: 180px; }
.adm-file__meta { color: var(--muted); font-size: 0.82rem; flex: 1; }
.adm-file audio { height: 32px; }
.btn--sm { padding: 6px 10px; font-size: 0.8rem; }

.adm-logtable { overflow-x: auto; margin: 0 0 12px; }
.logtable { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.logtable th, .logtable td {
  text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.logtable th { color: var(--muted); font-weight: 600; }

/* Chat-Dialog */
.chat-text {
  width: 100%; background: var(--raised); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm); padding: 10px;
  font: inherit; font-size: 0.9rem; resize: vertical;
}
.chat-actions { display: flex; justify-content: flex-end; margin-top: 10px; }

/* ── Chat-Empfang ───────────────────────────────────────────────────── */
.btn.has-unread { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.chat-history {
  max-height: 260px; overflow-y: auto; margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.chat-msg { display: flex; flex-direction: column; max-width: 85%; }
.chat-msg--own { align-self: flex-end; text-align: right; }
.chat-msg__meta { font-size: 0.72rem; color: var(--muted); }
.chat-msg__text {
  background: var(--raised); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 10px; font-size: 0.88rem;
  white-space: pre-wrap; word-break: break-word;
}
.chat-msg--own .chat-msg__text { border-color: var(--accent); }
.inbox-row {
  display: grid; grid-template-columns: 150px 1fr auto; gap: 10px; width: 100%;
  align-items: baseline; text-align: left; background: var(--raised);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 11px; margin-bottom: 6px; cursor: pointer; font: inherit; color: var(--text);
}
.inbox-row:hover { border-color: var(--accent); }
.inbox-row__name { font-weight: 600; }
.inbox-row__text { color: var(--muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-row__time { color: var(--muted); font-size: 0.78rem; }
@media (max-width: 640px) { .inbox-row { grid-template-columns: 1fr; } }

/* ── E-Mail-Fenster (Softphone) ─────────────────────────────────────── */
.mail-label { display: block; font-size: 0.78rem; color: var(--muted); margin: 10px 0 4px; }
.mail-input, .mail-select, .mail-text {
  width: 100%; background: var(--raised); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm); padding: 9px 10px;
  font: inherit; font-size: 0.88rem;
}
.mail-text { resize: vertical; white-space: pre-wrap; }
.mail-input[readonly] { color: var(--muted); }
.mail-cc { display: inline-flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 0.85rem; }

/* ── E-Mail-Vorlagen (Verwaltung) ───────────────────────────────────── */
.ph-box {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 10px 12px; margin-bottom: 14px;
  background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.ph-box__title { font-size: 0.8rem; color: var(--muted); margin-right: 4px; }
.ph-chip {
  font-family: Consolas, monospace; font-size: 0.8rem;
  background: var(--surface, #ffffff); border: 1px solid var(--border);
  border-radius: 5px; padding: 3px 7px; cursor: pointer; color: var(--accent);
}
.ph-chip:hover { border-color: var(--accent); }
.tpl-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-bottom: 8px; }
.tpl-grid input, .tpl-body {
  background: var(--raised); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; font-size: 0.85rem;
}
.tpl-body { width: 100%; resize: vertical; white-space: pre-wrap; }
.tpl-actions { display: flex; gap: 8px; margin-top: 8px; }
@media (max-width: 640px) { .tpl-grid { grid-template-columns: 1fr; } }
