/* Anrufprotokoll (Fallakte), zentrale Ansicht „Anrufe“, Dialoge und Anruf-Banner (call-log.js). Baut auf .wm (workspace-modules.css) auf.
   Lila-Familie, Cardo nur für Titel, Dark Mode über die --wm-/--compact-Tokens, 390 px ohne Überlauf. */
@media screen {
  /* Kopf */
  .call-log-wm, .call-center { --call-in:#2f6a4c; --call-in-bg:#e6f2ea; --call-out:#643182; --call-out-bg:#f2ebf7; --call-open:#8c520b; --call-open-bg:#fff1db; }
  html[data-workspace-theme="dark"] :is(.call-log-wm, .call-center) { --call-in:#99d5b3; --call-in-bg:#1f3a2c; --call-out:#d6b1eb; --call-out-bg:#382941; --call-open:#e9c27b; --call-open-bg:#453314; }
  .call-log-head, .call-center .wm-page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
  .call-log-head h2, .call-center h1 { margin:0; font:400 24px/1.2 'Cardo', Georgia, "Times New Roman", serif; color:var(--wm-text); }
  .call-log-head p, .call-center .wm-page-head p { margin:4px 0 0; font-size:13.5px; color:var(--wm-muted); }
  .call-center .wm-page-head p .status { margin-left:6px; vertical-align:middle; }
  /* Lila-Fallakte setzt bereits Eyebrow und Bereichstitel über den Inhalt – eigenen Kopf dann auf Zusammenfassung und Aktion reduzieren. */
  .lila-record-content .call-log-head .wm-eyebrow, .lila-record-content .call-log-head h2 { display:none; }
  .lila-record-content .call-log-head p { margin:0; }
  .lila-record-content .call-log-head { align-items:center; padding-bottom:10px; }
  .call-log-metrics, .call-center-metrics { grid-template-columns:repeat(4, minmax(0, 1fr)); }
  .call-metric-small { font-size:15px !important; }
  .call-center-metrics small { display:block; margin-top:2px; font-size:11.5px; color:var(--wm-muted); }
  .call-center-metrics > button { text-align:left; cursor:pointer; }

  /* Zeitleiste mit Richtungssymbol */
  .call-timeline { position:relative; margin:0; padding:0; list-style:none; border:1px solid var(--wm-line); border-radius:10px; background:var(--wm-surface); box-shadow:var(--wm-shadow); }
  .call-item { position:relative; display:grid; grid-template-columns:40px minmax(0, 1fr); gap:12px; padding:14px 16px 14px 14px; border-bottom:1px solid var(--wm-line); }
  .call-item:last-child { border-bottom:0; }
  .call-item::before { content:""; position:absolute; left:33px; top:0; bottom:0; width:2px; background:var(--wm-line); }
  .call-item:first-child::before { top:14px; }
  .call-item:last-child::before { bottom:auto; height:14px; }
  .call-item:first-child:last-child::before { display:none; }
  .call-mark { position:relative; z-index:1; display:grid; place-items:center; width:40px; height:40px; border-radius:50%; background:var(--call-in-bg); color:var(--call-in); }
  .call-mark svg { width:17px; height:17px; }
  .call-arrow { position:absolute; right:-4px; bottom:-4px; display:grid; place-items:center; width:18px; height:18px; border-radius:50%; background:var(--wm-surface); color:inherit; box-shadow:0 0 0 2px var(--wm-surface); }
  .call-arrow svg { width:12px; height:12px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
  .call-item.out .call-mark { background:var(--call-out-bg); color:var(--call-out); }
  .call-item.is-open .call-mark { box-shadow:0 0 0 2px var(--call-open); }
  .call-body { min-width:0; display:grid; gap:5px; }
  .call-head { display:flex; flex-wrap:wrap; align-items:center; gap:4px 10px; font-size:12px; color:var(--wm-muted); }
  .call-head time { font-weight:700; color:var(--wm-text); font-variant-numeric:tabular-nums; }
  .call-dir { font-weight:700; letter-spacing:.04em; text-transform:uppercase; font-size:10.5px; color:var(--call-in); }
  .call-item.out .call-dir { color:var(--call-out); }
  .call-source { padding:1px 7px; border-radius:999px; background:var(--wm-soft); border:1px solid var(--wm-line); font-size:11px; }
  .call-actions { margin-left:auto; display:inline-flex; gap:4px; }
  .call-action { display:inline-flex; align-items:center; gap:4px; padding:3px 6px; border:0; border-radius:6px; background:transparent; color:var(--wm-muted); font:inherit; font-size:12px; cursor:pointer; }
  .call-action svg { width:14px; height:14px; }
  .call-action:hover { background:var(--wm-soft); color:var(--wm-accent); }
  .call-action.call-log-delete:hover { color:var(--wm-danger); }
  .call-partner { display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; margin:0; font-size:14px; color:var(--wm-text); }
  .call-partner strong { font-weight:650; }
  .call-type { padding:2px 9px; border-radius:999px; background:var(--wm-tint); color:var(--wm-accent); font-size:11.5px; font-weight:600; }
  .call-phone { color:var(--wm-accent); text-decoration:none; font-variant-numeric:tabular-nums; }
  .call-phone:hover { text-decoration:underline; }
  .call-ref { display:inline-flex; align-items:center; gap:5px; max-width:100%; padding:2px 9px 2px 6px; border:1px solid var(--wm-border); border-radius:999px; background:var(--wm-surface); color:var(--wm-text); font:inherit; font-size:12px; cursor:pointer; }
  .call-ref svg { width:13px; height:13px; color:var(--wm-accent); }
  .call-ref span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .call-ref:hover { border-color:var(--wm-accent); color:var(--wm-accent); }
  .call-ref.is-static { cursor:default; }
  .call-ref.is-static:hover { border-color:var(--wm-border); color:inherit; }
  .call-ref.muted { color:var(--wm-muted); border-style:dashed; }
  .call-ref.muted svg { color:var(--wm-muted); }
  .call-reason { margin:0; font-size:13.5px; line-height:1.5; color:var(--wm-text); overflow-wrap:anywhere; }
  .call-reason.is-open { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; color:var(--call-open); }
  .call-reason.is-open em { font-style:italic; }
  .call-outcome { margin:0; padding:8px 12px; border-left:3px solid var(--wm-accent); border-radius:0 8px 8px 0; background:var(--wm-soft); font-size:13px; line-height:1.5; color:var(--wm-text); }
  .call-outcome span { display:block; margin-bottom:2px; font-size:10.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--wm-muted); }
  .call-empty { list-style:none; }
  .call-item.is-unknown .call-partner strong { color:var(--wm-muted); font-style:italic; }

  /* Zentrale Ansicht */
  .call-filters { display:grid; gap:10px; padding:12px 14px; border:1px solid var(--wm-line); border-radius:10px; background:var(--wm-surface); }
  .call-filters-row { display:flex; flex-wrap:wrap; align-items:center; gap:8px 10px; }
  .call-filters select, .call-filters input[type="date"], .call-filters input[type="search"] { min-height:34px; padding:6px 10px; border:1px solid var(--wm-border); border-radius:8px; background:var(--wm-surface); color:var(--wm-text); font:inherit; font-size:13.5px; }
  .call-filters select { max-width:100%; }
  .call-filters-range { display:inline-flex; align-items:center; gap:6px; color:var(--wm-muted); font-size:12.5px; }
  .call-filters-range.hidden { display:none; }
  .call-filter-search { display:flex; align-items:center; gap:6px; flex:1 1 240px; min-width:0; padding:0 10px; border:1px solid var(--wm-border); border-radius:8px; background:var(--wm-surface); color:var(--wm-muted); }
  .call-filter-search input { flex:1; min-width:0; border:0 !important; padding-left:0 !important; background:transparent !important; }
  .call-filter-search input:focus { outline:none; }
  .call-filter-check { display:inline-flex; align-items:center; gap:6px; font-size:13px; color:var(--wm-text); white-space:nowrap; }
  .call-filter-check input { width:16px; height:16px; accent-color:#643182; }
  .call-center-list { display:grid; gap:18px; }
  .call-day h3 { display:flex; align-items:baseline; gap:10px; margin:0 0 8px; font:400 17px/1.3 'Cardo', Georgia, "Times New Roman", serif; color:var(--wm-text); }
  .call-day h3 small { font:inherit; font-family:inherit; font-size:12px; color:var(--wm-muted); font-family:system-ui, sans-serif; }

  /* Dialoge */
  .call-entry-top { display:flex; flex-wrap:wrap; align-items:flex-end; justify-content:space-between; gap:12px 18px; }
  .call-entry-direction .wm-segments button { display:inline-flex; align-items:center; gap:6px; min-height:36px; }
  .call-entry-direction .wm-segments svg { width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
  .call-entry-direction .wm-segments button.active[data-direction="Eingehend"] { color:var(--call-in, #2f6a4c); }
  .call-entry-direction .wm-segments button.active[data-direction="Ausgehend"] { color:var(--call-out, #643182); }
  .call-entry-when { display:grid; grid-template-columns:minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, .9fr); gap:10px; flex:1 1 320px; }
  .call-entry-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .call-entry-static { display:flex; align-items:center; gap:6px; min-height:38px; padding:8px 10px; border:1px dashed var(--wm-border); border-radius:8px; background:var(--wm-soft); font-size:13.5px; color:var(--wm-text); }
  .call-entry-static svg { color:var(--wm-accent); }
  .call-entry-quick { margin-top:8px; }
  .call-entry-quick .wm-chip { max-width:100%; }
  .call-entry-note { display:flex; align-items:center; gap:8px; }
  .call-entry-note svg { flex:none; }
  .call-assign-results { display:grid; gap:6px; max-height:260px; overflow:auto; padding:4px; border:1px solid var(--wm-line); border-radius:10px; background:var(--wm-soft); }
  .call-assign-option { display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:8px; background:var(--wm-surface); cursor:pointer; }
  .call-assign-option:hover { outline:1px solid var(--wm-accent); }
  .call-assign-option input { width:16px; height:16px; margin:0; flex:none; accent-color:#643182; }
  .call-assign-option span { display:grid; min-width:0; }
  .call-assign-option strong { font-size:13.5px; }
  .call-assign-option small { font-size:12px; color:var(--wm-muted); }
  .call-assign-form .wm-chip.active { border-color:var(--wm-accent); background:var(--wm-tint); }
  .modal.call-entry-modal, .modal.call-assign-modal { width:min(820px, calc(100vw - 48px)); }

  /* Anruf-Banner (Anruferkennung) */
  .call-banner-root { position:fixed; top:14px; left:50%; transform:translateX(-50%); z-index:260; display:grid; gap:10px; width:min(520px, calc(100vw - 24px)); pointer-events:none; }
  .call-banner { display:grid; grid-template-columns:44px minmax(0, 1fr); gap:10px 12px; padding:12px 14px; border:1px solid var(--compact-line, #e3dce8); border-left:5px solid #2f6a4c; border-radius:12px; background:var(--compact-surface, #fff); color:var(--compact-text, #28212e); box-shadow:0 18px 44px rgba(28, 16, 36, .22); pointer-events:auto; animation:call-banner-in .22s ease-out; }
  .call-banner.out { border-left-color:#643182; }
  .call-banner.is-unknown { border-left-color:#8c520b; }
  .call-banner-mark { position:relative; display:grid; place-items:center; width:44px; height:44px; border-radius:50%; background:#e6f2ea; color:#2f6a4c; }
  .call-banner.out .call-banner-mark { background:#f2ebf7; color:#643182; }
  .call-banner.is-unknown .call-banner-mark { background:#fff1db; color:#8c520b; }
  .call-banner-mark svg { width:20px; height:20px; }
  .call-banner-mark i { position:absolute; right:-3px; bottom:-3px; display:grid; place-items:center; width:18px; height:18px; border-radius:50%; background:var(--compact-surface, #fff); }
  .call-banner-mark i svg { width:12px; height:12px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
  .call-banner-text { display:grid; gap:2px; min-width:0; }
  .call-banner-text strong { font-size:14.5px; }
  .call-banner-text span { font-size:13px; line-height:1.4; color:var(--compact-muted, #6e6576); overflow-wrap:anywhere; }
  .call-banner-actions { grid-column:1 / -1; display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
  .call-banner-actions .icon-button { margin-left:auto; }
  html[data-workspace-theme="dark"] .call-banner { box-shadow:0 18px 44px rgba(0, 0, 0, .5); }
  @keyframes call-banner-in { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:none; } }

  @media (max-width: 900px) {
    .call-log-metrics, .call-center-metrics { grid-template-columns:repeat(2, minmax(0, 1fr)); }
    .call-log-metrics > :nth-child(-n+2), .call-center-metrics > :nth-child(-n+2) { border-bottom:1px solid var(--wm-line); }
    .call-log-metrics > :nth-child(2n), .call-center-metrics > :nth-child(2n) { border-right:0; }
  }
  @media (max-width: 720px) {
    .call-log-head, .call-center .wm-page-head { flex-direction:column; align-items:stretch; }
    .call-log-head .head-actions .button, .call-center .wm-page-head .head-actions .button { flex:1 1 auto; justify-content:center; }
    .call-item { grid-template-columns:34px minmax(0, 1fr); gap:10px; padding:12px 12px 12px 10px; }
    .call-item::before { left:26px; }
    .call-mark { width:34px; height:34px; }
    .call-mark > svg { width:15px; height:15px; }
    .call-actions { margin-left:0; width:100%; justify-content:flex-start; }
    .call-action span { display:none; }
    .call-entry-when, .call-entry-grid { grid-template-columns:minmax(0, 1fr); }
    .call-filters-row { flex-direction:column; align-items:stretch; }
    .call-filter-search { flex-basis:auto; }
    .call-filters .wm-segments { display:grid; grid-template-columns:repeat(auto-fit, minmax(96px, 1fr)); }
    .call-filters-range { flex-wrap:wrap; }
    .call-filters-range input { flex:1 1 120px; min-width:0; }
    .call-filter-check { white-space:normal; }
    .call-banner-root { top:auto; bottom:12px; right:12px; left:12px; width:auto; transform:none; }
    .call-banner { padding:10px 12px; }
    .call-banner-actions .button { flex:1 1 auto; justify-content:center; }
  }
}

/* Einstellungen → Kommunikation & Webseite → Telefonanlage (telephony-settings.js) */
@media screen {
  .tel-form { gap:16px; }
  .tel-status { border-left:5px solid #9a8fa3; }
  .tel-status.is-on { border-left-color:#2f6a4c; }
  .tel-status-body { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px 16px; padding:14px 16px; }
  .tel-status-meta { font-size:12px; color:var(--wm-muted); }
  .tel-switch { display:flex; align-items:center; gap:12px; cursor:pointer; }
  .tel-switch input { position:absolute; opacity:0; width:0; height:0; }
  .tel-switch-track { position:relative; flex:none; width:42px; height:24px; border-radius:999px; background:#c9bfd1; transition:background .15s; }
  .tel-switch-track::after { content:""; position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%; background:#fff; transition:transform .15s; box-shadow:0 1px 2px rgba(0,0,0,.2); }
  .tel-switch input:checked + .tel-switch-track { background:#643182; }
  .tel-switch input:checked + .tel-switch-track::after { transform:translateX(18px); }
  .tel-switch input:focus-visible + .tel-switch-track { outline:2px solid var(--wm-accent); outline-offset:2px; }
  .tel-switch strong { display:block; font-size:15px; }
  .tel-switch small { display:block; margin-top:2px; font-size:12.5px; line-height:1.45; color:var(--wm-muted); }
  .tel-panel .panel-head { flex-wrap:wrap; }
  .tel-fields { display:grid; gap:14px; padding:14px 16px; }
  .tel-choices { display:grid; gap:8px; }
  .tel-choices .wm-confirm { cursor:pointer; }
  .tel-choices .wm-confirm:has(input:checked) { border-color:var(--wm-accent); box-shadow:inset 0 0 0 1px var(--wm-accent); }
  .tel-choices small { color:var(--wm-muted); }
  .tel-grid { grid-template-columns:repeat(3, minmax(0, 1fr)); }
  .tel-grid small, .tel-fields .field > small { display:block; margin-top:4px; font-size:11.5px; }
  .tel-key { margin-bottom:8px; }
  .tel-key code { display:inline-block; max-width:100%; padding:6px 10px; border-radius:8px; background:var(--wm-soft); font-size:13px; letter-spacing:.04em; overflow-wrap:anywhere; }
  .tel-key-actions { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:6px; }
  .tel-inline { display:flex; align-items:center; gap:8px; }
  .tel-inline input { max-width:120px; }
  .tel-test { display:flex; flex-wrap:wrap; align-items:flex-end; gap:10px 14px; }
  .tel-test .field { flex:1 1 220px; margin:0; }
  .tel-test input { width:100%; min-height:38px; padding:8px 10px; border:1px solid var(--wm-border); border-radius:8px; background:var(--wm-surface); color:var(--wm-text); font:inherit; }
  .tel-test-result { font-size:13px; }
  .tel-help summary { cursor:pointer; font-weight:600; color:var(--wm-accent); }
  .tel-help summary svg { vertical-align:-3px; margin-right:4px; }
  .tel-help ol { margin:10px 0; padding-left:20px; font-size:13.5px; line-height:1.55; }
  .tel-help pre { white-space:pre-wrap; overflow-wrap:anywhere; }
  .tel-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
  @media (max-width: 720px) {
    .tel-grid { grid-template-columns:minmax(0, 1fr); }
    .tel-status-body { flex-direction:column; align-items:stretch; }
    .tel-test { flex-direction:column; align-items:stretch; }
    .tel-actions .button { flex:1 1 auto; justify-content:center; }
  }
}
