/* Raporlar (web/app/pages/reports.js): range bar, hourly columns, status bars, legends. Charts are plain boxes
   (strict CSP: no chart library). The agent statuses use the status colours of every screen (app.css --st-*, test
   note 11 Kas: one status, one colour); stacked parts are split by a 2px gap and every chart has a table twin and a
   legend, so no value is read from colour alone. */
.rp-body { gap: 16px; }
.rp-busy { opacity: 0.6; transition: opacity 0.15s; }
.rp-scroll { overflow-x: auto; }
.rp-scroll-x { max-width: 100%; overflow-x: auto; }
.rp-scroll-x .seg button { white-space: nowrap; }
.rp-dates { display: inline-flex; align-items: center; gap: 6px; }
.rp-dates .input { width: 160px; }
.rp-sl { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.rp-sl .input { width: 74px; }
.rp-asof { font-size: 12px; }
.rp-foot { margin: 0; font-size: 12.5px; }
.rp-table td:first-child, .rp-table td.num { white-space: nowrap; }
.rp-table tfoot td { font-weight: 600; color: var(--ink); border-top: 1px solid var(--line); border-bottom: 0; }
.rp-table td.rp-pct { min-width: 110px; }
.rp-table td.rp-pct .bar { margin-top: 4px; height: 6px; }
.rp-details summary { cursor: pointer; font-size: 12.5px; color: var(--blue); width: fit-content; }
.rp-details[open] summary { margin-bottom: 8px; }

/* legends: a swatch beside dark text, never coloured text */
.rp-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text); }
.rp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rp-legend i { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* series colours: answered / unanswered calls; agent statuses in stack order (the shared status colours) */
.rp-ans { background: var(--f-4e7009); }
.rp-un { background: var(--amber); }
.s-talking { background: var(--st-talk); }
.s-dialing { background: var(--st-dial); }
.s-wrapup { background: var(--st-wrap); }
.s-ready { background: var(--st-ready); }
.s-break { background: var(--st-break); }
.s-missed { background: var(--st-missed); }
.s-not_ready { background: var(--st-nready); }

/* KPI tiles: a title with its (i); the popover keeps its own text colour */
.rp-stat-l { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.stat .info-pop { color: var(--text); }
.rp-legend i.k-positive { background: var(--green); }
.rp-legend i.k-callback { background: var(--violet); }
.rp-legend i.k-negative { background: var(--f-7c8ba3); }
.rp-legend i.k-neutral { background: var(--p-b9c0cb); }
.rp-legend i.k-failed { background: var(--p-d6d6d6); }

/* hourly columns: one baseline, thin columns with a 2px gap between the stacked parts, rounded top */
.rp-chart { display: flex; flex-direction: column; gap: 8px; }
.rp-readout { min-height: 18px; font-size: 12.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.rp-plot { position: relative; height: 160px; margin-top: 14px; display: flex; align-items: stretch; gap: 2px;
  border-bottom: 1px solid var(--p-d9d9d9); }
.rp-plot::before { content: ""; position: absolute; left: 0; right: 0; top: 0; border-top: 1px solid var(--line-soft); }
.rp-max { position: absolute; top: -16px; left: 0; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rp-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  border-radius: 4px 4px 0 0; }
.rp-col.on { background: var(--p-f3f5f0); }
.rp-stack { width: 70%; max-width: 24px; min-height: 3px; display: flex; flex-direction: column; gap: 2px; }
.rp-stack > span { flex: 1 1 0; min-height: 1px; }
.rp-stack > span:first-child { border-radius: 4px 4px 0 0; }
.rp-col.on .rp-stack { filter: brightness(1.12); }
.rp-axis { display: flex; gap: 2px; }
.rp-axis span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* status time per agent: 100% bars of the logged-in time */
.rp-status { display: flex; flex-direction: column; gap: 10px; }
.rp-srow { display: grid; grid-template-columns: 150px minmax(0, 1fr) 116px; gap: 12px; align-items: center; font-size: 12.5px;
  color: var(--ink); }
.rp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-sbar { display: flex; gap: 2px; height: 12px; }
.rp-sbar > span { flex: 1 1 0; min-width: 2px; }
.rp-sbar > span:last-child { border-radius: 0 4px 4px 0; }
.rp-occ { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-occ b { color: var(--ink); }

/* result codes: count and share on the right */
.rp-bars .bar-row { grid-template-columns: minmax(120px, 190px) minmax(0, 1fr) 100px; }
.rp-bars .bar-row b { font-weight: 600; }

@media (max-width: 720px) {
  .rp-dates .input { width: 138px; }
  .rp-srow { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .rp-srow .rp-sbar { grid-column: 1 / -1; order: 3; }
  .rp-axis span:not(:nth-child(3n + 1)) { visibility: hidden; }
  .rp-bars .bar-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .rp-bars .bar-row .bar { grid-column: 1 / -1; order: 3; }
}
