/* ---------------------------------------------------------------------------
 *  Call Analytics (call-analytics.php)
 * ------------------------------------------------------------------------- */
.ca { --ca-ill-1: #eef2f8; --ca-ill-2: #c9d3e3; margin: -8px 0 0; border: 1px solid var(--border); border-radius: var(--radius-lg, 14px); background: var(--surface-2); color: var(--text); overflow: hidden; }
[data-theme="dark"] .ca { --ca-ill-1: rgba(148, 163, 184, .12); --ca-ill-2: rgba(148, 163, 184, .45); }
.ca-i { width: 18px; height: 18px; flex: none; }
.ca-tri { width: 9px; height: 6px; flex: none; }
.ca-head { padding: 22px 48px 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.ca-back { display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-size: 14.5px; font-weight: 600; text-decoration: none; }
.ca-back:hover { color: var(--brand); text-decoration: underline; }
.ca-head h1 { margin: 6px 0 0; font-size: 22px; font-weight: 500; }
.ca-body { padding: 28px 48px 40px; }
.ca-filters { display: flex; align-items: center; gap: 8px 22px; flex-wrap: wrap; margin-bottom: 22px; }
.ca-fbtn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 2px; border: 0; border-radius: 4px; background: none; color: var(--text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.ca-fbtn:hover, .ca-fbtn.is-open { color: var(--brand); }
.ca-fbtn.is-on { color: var(--brand); }
.ca-clear, .ca-link { padding: 4px 6px; border: 0; border-radius: 4px; background: none; color: var(--brand); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.ca-clear:hover, .ca-link:hover { text-decoration: underline; }
.ca :is(button, a, input, select):focus-visible, .ca-pop :is(button, input):focus-visible { outline: 0; box-shadow: var(--focus-ring); }
.ca-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.ca-card { display: flex; flex-direction: column; min-width: 0; min-height: 520px; padding: 22px 20px 24px; border: 1px solid var(--border-strong); border-radius: 16px; background: var(--surface); }
.ca-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ca-card__head h2 { margin: 0; font-size: 19px; font-weight: 500; }
.ca-card__body { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.ca-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--text); cursor: pointer; }
.ca-icon:hover { background: var(--surface-hover); }
.ca-menu-wrap { position: relative; }
.ca-menu { position: absolute; top: 34px; right: -8px; z-index: 20; min-width: 160px; padding: 6px 0; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); }
.ca-menu button { display: block; width: 100%; padding: 10px 16px; border: 0; background: none; color: var(--text); font: inherit; font-size: 14.5px; text-align: left; cursor: pointer; }
.ca-menu button:hover, .ca-menu button:focus-visible { background: var(--surface-hover); }
.ca-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 14px; }
.ca-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 4px; background: var(--surface-2); font-size: 13px; font-weight: 600; }
.ca-sub { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 14.5px; }
.ca-tip { display: inline-flex; color: var(--text-muted); }
.ca-tip .ca-i { width: 15px; height: 15px; }
.ca-strong { margin: 14px 0 0; font-size: 15px; font-weight: 700; }
.ca-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 10px; padding: 0; list-style: none; font-size: 13.5px; }
.ca-legend li { display: inline-flex; align-items: center; gap: 6px; }
.ca-legend i { width: 10px; height: 10px; border-radius: 50%; }
.ca-goal-key { width: 16px !important; height: 0 !important; border-top: 2px dashed var(--text-muted); border-radius: 0 !important; }
/* palette: brand first, then distinct hues */
.ca-c0 { background: var(--brand); } .ca-c1 { background: #f59e0b; } .ca-c2 { background: #10b981; } .ca-c3 { background: #8b5cf6; }
.ca-c4 { background: #ef4444; } .ca-c5 { background: #06b6d4; } .ca-c6 { background: #94a3b8; } .ca-c7 { background: #ec4899; }
/* horizontal bars */
.ca-hbar { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.ca-hbar__row { display: grid; grid-template-columns: 130px minmax(0, 1fr); align-items: center; gap: 10px; font-size: 13px; }
.ca-hbar__lbl { overflow: hidden; color: var(--text); text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.ca-hbar__track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ca-hbar__track b { flex: none; font-size: 12.5px; font-weight: 700; }
.ca-hbar__bar { display: block; height: 14px; border-radius: 0 3px 3px 0; background: var(--brand); }
.ca-stack { display: flex; height: 14px; border-radius: 0 3px 3px 0; overflow: hidden; }
.ca-stack span { min-width: 2px; }
.ca-axis { margin: 8px 0 0 140px; color: var(--text-muted); font-size: 12.5px; font-weight: 600; text-align: center; }
/* svg charts */
.ca-svg { display: block; width: 100%; height: auto; margin-top: 4px; overflow: visible; }
.ca-grid-l { stroke: var(--border); stroke-width: 1; }
.ca-tick { fill: var(--text-muted); font-size: 11px; }
.ca-val { fill: var(--text); font-size: 11px; font-weight: 700; }
.ca-ylab { fill: var(--text-muted); font-size: 11.5px; font-weight: 600; }
.ca-col { fill: var(--brand); }
.ca-line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; }
.ca-goal { fill: none; stroke: var(--text-muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
/* KPI tiles */
.ca-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px; }
.ca-kpi { display: flex; flex-direction: column; gap: 6px; padding: 20px 16px; border-bottom: 1px solid var(--border); }
.ca-kpi:nth-child(odd) { border-right: 1px solid var(--border); }
.ca-kpi:nth-last-child(-n+2) { border-bottom: 0; }
.ca-kpi span { font-size: 14px; }
.ca-kpi strong { font-size: 28px; font-weight: 500; }
.ca-kpi small { display: inline-flex; align-items: center; gap: 2px; font-size: 13.5px; }
.ca-kpi small .ca-i { width: 15px; height: 15px; }
.ca-kpi .is-up { color: #12803d; } .ca-kpi .is-down { color: var(--danger, #d92d20); }
[data-theme="dark"] .ca-kpi .is-up { color: #4ade80; }
/* empty */
.ca-empty { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 30px 12px; text-align: center; }
.ca-empty__img { width: 150px; height: auto; }
.ca-empty p { margin: 0; font-size: 15px; }
/* filter dropdown */
.ca-pop { position: absolute; z-index: 1300; display: flex; flex-direction: column; width: 300px; max-width: calc(100vw - 16px); border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 14px 36px rgba(16, 24, 40, .18); overflow: hidden; }
.ca-search { position: relative; display: block; padding: 12px 12px 6px; }
.ca-search input { width: 100%; height: 38px; padding: 0 38px 0 14px; border: 2px solid var(--brand); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: 14.5px; }
.ca-search input:focus { outline: 0; }
.ca-search .ca-i { position: absolute; top: 22px; right: 24px; color: var(--text-muted); pointer-events: none; }
.ca-list { display: flex; flex-direction: column; max-height: 260px; padding: 4px 0; overflow-y: auto; }
.ca-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; border: 0; background: none; color: var(--text); font: inherit; font-size: 14.5px; text-align: left; cursor: pointer; }
.ca-opt[hidden], .ca-none[hidden] { display: none; }
.ca-opt:hover, .ca-opt:focus-visible { outline: 0; background: var(--surface-hover); }
.ca-opt--2 { flex-direction: column; align-items: flex-start; gap: 2px; }
.ca-opt--2 small { color: var(--text-muted); font-size: 12.5px; }
.ca-opt--2[aria-selected="true"] { background: var(--brand-soft); }
.ca-cb { display: grid; place-items: center; width: 18px; height: 18px; flex: none; border: 1.5px solid var(--text); border-radius: 4px; }
.ca-cb .ca-i { width: 13px; height: 13px; opacity: 0; color: #fff; }
.ca-cb.is-on { border-color: var(--brand); background: var(--brand); }
.ca-cb.is-on .ca-i { opacity: 1; }
.ca-none { margin: 0; padding: 12px 16px; color: var(--text-muted); font-size: 14px; }
.ca-pop__reset { align-self: flex-start; margin: 4px 10px 10px; }
/* save report - right side panel (2 steps) */
.ca-pan-ov { position: fixed; inset: 0; z-index: 1400; background: rgba(16, 24, 40, 0); transition: background .18s ease; }
.ca-pan-ov[hidden] { display: none; }
.ca-pan-ov.is-open { background: rgba(16, 24, 40, .45); }
.ca-pan { position: absolute; top: 0; right: 0; bottom: 0; display: flex; flex-direction: column; width: min(540px, 100%); border-left: 1px solid var(--border); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .18s ease; }
.ca-pan-ov.is-open .ca-pan { transform: none; }
.ca-pan__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 20px 40px; border-bottom: 1px solid var(--border); }
.ca-pan__head h2 { margin: 0; font-size: 22px; font-weight: 600; }
.ca-pan__form { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.ca-pan__body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 40px; }
.ca-step { display: flex; flex-direction: column; gap: 22px; }
.ca-step[hidden] { display: none; }
.ca-pan__intro { margin: 0 0 -6px; font-size: 15px; line-height: 1.6; }
.ca-pan__foot { display: flex; align-items: center; gap: 8px; padding: 16px 40px; border-top: 1px solid var(--border); }
.ca-pan__foot .btn-crm { display: inline-flex; align-items: center; gap: 6px; }
.ca-pan__foot [hidden] { display: none; }
.ca-pan__go { margin-left: auto; }
.ca-pan__go:disabled { opacity: .45; cursor: not-allowed; }
.ca-f { display: flex; flex-direction: column; gap: 8px; font-size: 15px; font-weight: 600; }
.ca-f b { color: var(--text); font-weight: 600; }
.ca-f input[type="text"], .ca-f select, .ca-f textarea, .ca-rad select { width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm, 8px); background: var(--surface); color: var(--text); font: inherit; font-size: 15px; font-weight: 400; }
.ca-f textarea { height: auto; min-height: 96px; padding: 10px 14px; line-height: 1.5; resize: vertical; }
.ca-f textarea.is-loading { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-hover) 50%, var(--surface-2) 75%) 0 0 / 200% 100%; animation: ca-shim 1s linear infinite; }
@keyframes ca-shim { to { background-position: -200% 0; } }
.ca-f small, .ca-rad small { color: var(--danger, #d92d20); font-size: 13px; font-weight: 500; }
.ca-f small[hidden], .ca-rad small[hidden], .ca-rad__sub[hidden], [data-ca-newdash][hidden] { display: none; }
.ca-f__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-top: -2px; }
.ca-f__meta .ca-count { color: var(--text); font-weight: 400; }
.ca-gen { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px; border: 0; border-radius: 4px; background: none; color: var(--text); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.ca-gen .ca-i { width: 14px; height: 14px; }
.ca-gen:hover { color: var(--brand); }
.ca-gen:disabled { opacity: .5; cursor: progress; }
.ca-tags { position: relative; }
.ca-sel { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm, 8px); background: var(--surface); color: var(--text); font: inherit; font-size: 15px; font-weight: 400; text-align: left; cursor: pointer; }
.ca-sel span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-dd { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 5; padding: 6px 0 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-lg); }
.ca-dd[hidden] { display: none; }
.ca-dd__opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 16px; border: 0; background: none; color: var(--text); font: inherit; font-size: 14.5px; font-weight: 400; text-align: left; cursor: pointer; }
.ca-dd__opt:hover, .ca-dd__opt:focus-visible { background: var(--surface-hover); }
.ca-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: #8b5cf6; }
.ca-dot--1 { background: #0ea5e9; } .ca-dot--2 { background: #f59e0b; } .ca-dot--3 { background: #10b981; }
.ca-dd__foot { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 12px 16px 14px; width: 100%; border-top: 1px solid var(--border); color: var(--brand); font-size: 14px; font-weight: 600; text-decoration: none; }
.ca-dd__foot:hover { text-decoration: underline; }
.ca-rad { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; border: 0; }
.ca-rad legend { margin-bottom: 12px; padding: 0; font-size: 15px; font-weight: 600; }
.ca-rad label { display: flex; align-items: center; gap: 12px; font-size: 16px; cursor: pointer; }
.ca-rad input[type="radio"], .ca-rad input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--text); cursor: pointer; }
.ca-rad__sub { display: flex; flex-direction: column; gap: 12px; padding-left: 24px; }
.ca-rad__sub select { padding-left: 12px; }
.ca-users > div { display: flex; flex-direction: column; gap: 10px; max-height: 220px; overflow-y: auto; padding: 4px 2px; }
.ca-users label { font-size: 15px; }
.ca-users em { color: var(--text-muted); font-style: normal; }
.ca-pan :is(button, a, input, select, textarea):focus-visible { outline: 0; box-shadow: var(--focus-ring); }
@media (max-width: 600px) { .ca-pan__head, .ca-pan__body, .ca-pan__foot { padding-left: 20px; padding-right: 20px; } }
@media (max-width: 1100px) { .ca-head, .ca-body { padding-left: 24px; padding-right: 24px; } .ca-grid { gap: 20px; } }
@media (max-width: 900px) { .ca-grid { grid-template-columns: 1fr; } .ca-card { min-height: 0; } }
@media (max-width: 520px) { .ca-head, .ca-body { padding-left: 14px; padding-right: 14px; } .ca-hbar__row { grid-template-columns: 96px minmax(0, 1fr); } .ca-axis { margin-left: 106px; } }
.ca-sep { height: 0; margin: 4px 0; border: 0; border-top: 1px solid var(--border); }

/* Call Answer Status (by Workspace) - theme-matched hover popovers */
.ca-chip-tip { position: relative; cursor: pointer; outline: none; }
.ca-theme-pop { position: absolute; z-index: 1500; left: 0; top: calc(100% + 11px); display: block; width: max-content; min-width: 210px; max-width: min(300px, calc(100vw - 36px)); padding: 10px 12px; border: 1px solid #30343a; border-radius: 7px; background: #202124; color: #fff; box-shadow: 0 8px 22px rgba(0,0,0,.24); font-size: 13px; font-weight: 400; line-height: 1.45; text-align: left; white-space: normal; opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-3px); transition: opacity .12s ease, transform .12s ease, visibility .12s ease; }
.ca-theme-pop::before { content: ""; position: absolute; top: -7px; left: 16px; width: 12px; height: 12px; border-top: 1px solid #30343a; border-left: 1px solid #30343a; background: #202124; transform: rotate(45deg); }
.ca-theme-pop strong { display: block; margin-bottom: 4px; color: #fff; font-size: 13px; font-weight: 700; }
.ca-theme-pop ul { margin: 3px 0 0; padding: 0; list-style: none; }
.ca-theme-pop li { position: relative; margin: 2px 0; padding-left: 12px; }
.ca-theme-pop li::before { content: "·"; position: absolute; left: 1px; top: 0; color: #fff; }
.ca-chip-tip:hover .ca-theme-pop,
.ca-chip-tip:focus .ca-theme-pop,
.ca-chip-tip:focus-within .ca-theme-pop { opacity: 1; visibility: visible; transform: translateY(0); }
.ca-chip-tip:nth-child(2) .ca-theme-pop { left: 0; }
.ca-workspace-chart { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 300px; padding: 18px 8px; }
.ca-workspace-chart .ca-hbar { width: 100%; max-width: 560px; margin: 0 auto; gap: 18px; }
.ca-workspace-chart .ca-hbar__row { grid-template-columns: minmax(110px, 150px) minmax(0, 1fr); gap: 14px; font-size: 13.5px; }
.ca-workspace-chart .ca-hbar__lbl { white-space: normal; }
.ca-workspace-chart .ca-hbar__bar { background: var(--brand); opacity: .82; }
.ca-workspace-chart .ca-axis { margin-top: 14px; }
@media (max-width: 520px) {
  .ca-theme-pop { max-width: min(280px, calc(100vw - 28px)); }
  .ca-workspace-chart .ca-hbar__row { grid-template-columns: 105px minmax(0, 1fr); gap: 8px; }
}

