/* Reporting › Call report (public/call-report.js). Builds on the Attribution
   Report's toolbar, buttons, date range and menus (attribution-report.css);
   colours come from the theme variables. */

.cr { display: flex; flex-direction: column; gap: 16px; }
.cr.busy .cr-charts, .cr.busy .cr-table-card { opacity: .65; }
.cr-title { margin: 8px 0 0; font-size: 32px; font-weight: 600; line-height: 1.2; }
.cr-muted { color: var(--muted); }
.cr-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.cr-note { padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 13px; }

/* ----- the toolbar ----- */
.cr-toolbar { position: sticky; top: 0; z-index: 20; padding: 8px 0; background: var(--bg, var(--surface)); }
.cr-range { display: flex; align-items: center; gap: 10px; }
.cr-info { position: relative; display: inline-flex; padding: 4px; border: 0; background: none; color: var(--muted); border-radius: 50%; }
.cr-info:hover, .cr-info:focus-visible { color: var(--text); }
.cr-info::after { content: attr(data-tip); position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; width: max-content; max-width: 260px; padding: 6px 10px; border-radius: 6px; background: #1f2937; color: #fff; font-size: 12.5px; text-align: left; opacity: 0; pointer-events: none; transition: opacity .12s; }
.cr-info:hover::after, .cr-info:focus-visible::after { opacity: 1; }
.cr-btn { height: 40px; }
.cr-btn .has-ico, .cr-table-head .has-ico, .ar-menu-foot .has-ico { display: inline-flex; align-items: center; gap: 6px; }
.cr-numbers-btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; width: 220px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 14px; }
.cr-numbers-btn:hover, .cr-numbers-btn[aria-expanded="true"] { border-color: var(--brand); }
.cr-numbers-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cr-numbers-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-numbers-menu { width: 280px; }
.cr-numbers-menu .ar-input, .cr-select-menu .ar-input, .cr-combo-menu .ar-input { margin-bottom: 6px; }
.cr-group { padding: 8px 8px 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: none; }
.cr-option { display: block; width: 100%; padding: 8px; border: 0; border-radius: 6px; background: none; color: var(--text); font-size: 14px; text-align: left; }
.cr-option:hover { background: var(--hover); }
.cr-option.on { color: var(--brand); font-weight: 600; background: var(--brand-soft, var(--hover)); }
.cr-select-list { display: flex; flex-direction: column; }
.cr-select-menu { max-height: 280px; }
.ar-multi-field.is-disabled { opacity: .55; cursor: not-allowed; background: var(--hover); }

/* ----- the charts ----- */
.cr-charts { display: flex; flex-direction: column; gap: 24px; transition: opacity .15s; }
.cr-charts.loading { opacity: .55; }
.cr-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.cr-card { padding: 0; min-width: 0; }
.cr-card-title { margin: 0; padding: 22px 28px 18px; font-size: 20px; font-weight: 500; border-bottom: 1px solid var(--line); }
.cr-card-body { display: flex; flex-direction: column; align-items: center; padding: 16px 20px 24px; }
.cr-donut { display: flex; align-items: center; justify-content: center; width: 100%; max-width: 640px; }
.cr-donut svg { flex: 1 1 auto; min-width: 0; max-height: 280px; }
.cr-slice-label { fill: var(--text); font-size: 14px; }
.cr-center-title { fill: var(--text); font-size: 18px; font-weight: 500; }
.cr-center-sub { fill: var(--text); font-size: 14px; }
.cr-legend { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; white-space: nowrap; }
.cr-legend li { display: flex; align-items: center; gap: 8px; }
.cr-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cr-pill { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; padding: 12px 20px; border-radius: 8px; background: var(--hover); font-size: 15px; }
.cr-pill b { font-weight: 600; }
.cr-pill-sep { color: var(--muted); }
.cr-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; }
.cr-split-l { display: flex; align-items: center; justify-content: center; min-height: 280px; padding: 0 12px; border-right: 1px solid var(--line); }
.cr-split-r { padding: 0 12px 0 20px; min-width: 0; overflow: auto; }
.cr-card:has(.cr-split) .cr-card-body { padding: 24px 20px; align-items: stretch; }
.cr-nodata-text { font-size: 20px; font-weight: 600; }
.cr-nodata { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 16px; color: var(--dim); font-size: 14px; }
.cr-nodata-ico { display: inline-flex; }
.cr-bars { width: 100%; }
.cr-bars svg { display: block; width: 100%; height: auto; max-height: 320px; }
.cr-bar { fill: var(--brand); }
.cr-bar:hover { filter: brightness(1.12); }
.cr-grid-line { stroke: var(--line); stroke-width: 1; }
.cr-axis { fill: var(--muted); font-size: 12px; }
.cr-mini { width: 100%; }
.cr-mini th { white-space: nowrap; background: var(--hover); }
.cr-mini td.num, .cr-mini th.num { text-align: left; }

/* ----- the table ----- */
.cr-table-card { padding: 0; transition: opacity .15s; }
.cr-table-card.loading .cr-scroll { opacity: .55; }
.cr-table-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.cr-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cr-seg-btn { padding: 9px 20px; border: 0; border-right: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 15px; }
.cr-seg-btn:last-child { border-right: 0; }
.cr-seg-btn:hover { background: var(--hover); }
.cr-seg-btn.on { background: var(--hover); font-weight: 600; }
.cr-seg-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.cr-scroll { max-height: 480px; overflow: auto; border-top: 1px solid var(--line); }
.cr-table { width: 100%; min-width: 1200px; }
.cr-table th { position: sticky; top: 0; z-index: 1; padding: 12px 16px; background: var(--surface); white-space: nowrap; color: var(--muted); font-weight: 500; }
.cr-table td { padding: 12px 16px; vertical-align: middle; }
.cr-c-dateTime, .cr-c-callStatus, .cr-c-duration { white-space: nowrap; }
.cr-c-recording { min-width: 220px; }
.cr-c-callFlow { white-space: nowrap; }
.cr-trim { display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.cr-qual { display: inline-flex; padding: 4px; border: 0; border-radius: 50%; background: none; color: var(--dim); }
.cr-qual:hover { background: var(--hover); }
.cr-qual.on { color: var(--green, #16a34a); }
.cr-qual:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.cr-nodata-table { padding: 36px 16px; }
.cr-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); }
.cr-showing { color: var(--muted); font-size: 14px; }
.ar-pager-btns { display: flex; align-items: center; gap: 8px; }
.cr-pageno { color: var(--muted); font-size: 13.5px; }
.cr-columns { min-width: 240px; max-height: 400px; }
.cr-menu-head { padding: 6px 8px 8px; font-size: 13px; color: var(--muted); }

/* ----- a recording ----- */
.cr-player { display: flex; flex-direction: column; gap: 6px; min-width: 200px; }
.cr-player-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.cr-player-name { font-weight: 500; }
.cr-player-select { max-width: 120px; border: 0; background: none; color: var(--text); font-size: 13.5px; }
.cr-player-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.cr-player-seek { width: 100%; accent-color: var(--brand); }
.cr-player-bar { display: flex; align-items: center; justify-content: center; gap: 14px; }
.cr-player-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 28px; padding: 0 6px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 13px; }
.cr-player-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.cr-player-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.cr-player-btn:disabled { opacity: .5; }
.cr-player-err { color: var(--red, #dc2626); font-size: 12.5px; text-align: center; }

/* ----- the filter drawer and the modals ----- */
.cr-scrim { position: fixed; inset: 0; z-index: 200; display: flex; justify-content: flex-end; background: rgba(16, 24, 40, .45); }
.cr-modal-scrim { justify-content: center; align-items: center; padding: 16px; }
.cr-drawer { display: flex; flex-direction: column; width: min(520px, 100vw); height: 100%; background: var(--surface); color: var(--text); box-shadow: -12px 0 32px rgba(16, 24, 40, .2); }
.cr-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.cr-drawer-title { margin: 0; font-size: 22px; font-weight: 600; }
.cr-drawer-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.cr-x { display: inline-flex; padding: 6px; border: 0; border-radius: 6px; background: var(--hover); color: var(--text); }
.cr-x:hover { filter: brightness(.95); }
.cr-x:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cr-drawer-body { flex: 1; overflow: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.cr-drawer-foot { display: flex; justify-content: flex-end; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--line); }
.cr-flabel { font-size: 15px; }
.cr-flabel.strong { font-weight: 500; }
.cr-field { display: flex; flex-direction: column; gap: 6px; }
.cr-hint { margin: 0; color: var(--muted); font-size: 14px; }
.cr-hr { width: 100%; margin: 6px 0; border: 0; border-top: 1px solid var(--line); }
.cr-switch-row { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.cr-stepper { position: relative; }
.cr-stepper .ar-input { padding-right: 76px; }
.cr-stepper .cr-step { position: absolute; top: 50%; transform: translateY(-50%); }
.cr-stepper .cr-step:nth-of-type(1) { right: 38px; }
.cr-stepper .cr-step:nth-of-type(2) { right: 6px; }
.cr-step { display: inline-flex; padding: 5px; border: 0; border-radius: 6px; background: none; color: var(--text); }
.cr-step:hover { background: var(--hover); }
.cr-stepper input[type=number]::-webkit-inner-spin-button, .cr-stepper input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cr-stepper input[type=number] { -moz-appearance: textfield; appearance: textfield; }

.cr-modal { display: flex; flex-direction: column; width: min(520px, 100%); max-height: 100%; border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(16, 24, 40, .3); }
.cr-modal.wide { width: min(860px, 100%); }
.cr-modal-head { padding: 22px 24px 8px; }
.cr-modal-title { margin: 0; font-size: 18px; font-weight: 600; }
.cr-modal-desc { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.cr-modal-body { flex: 1; overflow: auto; padding: 8px 24px 16px; display: flex; flex-direction: column; gap: 14px; }
.cr-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); }
.cr-progress { height: 10px; border-radius: 5px; background: var(--hover); overflow: hidden; }
.cr-progress-fill { height: 100%; width: 0; border-radius: 5px; background: var(--brand); transition: width .2s; }
.cr-progress-label { color: var(--muted); font-size: 13.5px; }

.cr-dash { display: flex; flex-direction: column; gap: 6px; max-width: 360px; }
.cr-combo { width: 100%; }
.cr-combo-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 15px; }
.cr-combo-btn:hover, .cr-combo-btn[aria-expanded="true"] { border-color: var(--brand); }
.cr-combo-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cr-combo-menu { min-width: 100%; }
.cr-combo-foot { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.cr-create { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px; border: 0; border-radius: 6px; background: none; color: var(--brand); font-size: 14px; text-align: left; }
.cr-create:disabled { opacity: .55; cursor: not-allowed; }
.cr-create:hover:not(:disabled) { background: var(--hover); }
.cr-banner { padding: 10px 14px; border: 1px solid var(--brand); border-radius: 8px; background: var(--brand-soft, var(--hover)); font-size: 14px; }
.cr-banner[hidden] { display: none; }
.cr-w-box { padding: 16px 20px; border: 1px solid var(--line); border-radius: 10px; }
.cr-w-head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cr-w-count { margin: 0; font-size: 18px; font-weight: 600; }
.cr-w-nav { display: flex; gap: 8px; }
.cr-w-track { display: flex; gap: 20px; overflow-x: auto; padding: 2px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.cr-w-card { flex: 0 0 260px; display: flex; flex-direction: column; gap: 10px; height: 180px; padding: 12px; border: 1px solid var(--brand); border-radius: 8px; scroll-snap-align: start; cursor: pointer; overflow: hidden; }
.cr-w-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cr-w-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.cr-w-big { font-size: 40px; font-weight: 600; line-height: 1.1; }
.cr-w-small { color: var(--muted); font-size: 14px; }

@media (max-width: 900px) {
  .cr-pair, .cr-split { grid-template-columns: 1fr; }
  .cr-split-l { border-right: 0; border-bottom: 1px solid var(--line); }
  .cr-split-r { padding: 12px 0 0; }
  .cr-numbers-btn { width: 100%; }
  .cr-pill-sep { display: none; }
  .cr-table-head { flex-wrap: wrap; }
}

/* ----- a call insight on a dashboard ----- */
.cr-insight-bars { display: flex; flex-direction: column; gap: 8px; }
.cr-insight-row { display: grid; grid-template-columns: minmax(80px, 140px) 1fr 70px; align-items: center; gap: 10px; font-size: 13.5px; }
.cr-insight-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-insight-track { height: 12px; border-radius: 6px; background: var(--hover); overflow: hidden; }
.cr-insight-fill { height: 100%; border-radius: 6px; background: var(--brand); }
.cr-insight-val { text-align: right; font-variant-numeric: tabular-nums; }
