/* ── Overview ─────────────────────────────────────────────────────────────────
 * How every call in the workspace went (templates/overview.html, overview.js).
 * Built from app.css's tokens and its existing pieces only: the view head, the
 * segmented control's tinted track and raised thumb, the history tiles' figure
 * treatment, the .stm-table, the state marks (○ fine, ▨ open, ■ bad). No new
 * hues: the chart is ink, a lighter ink and the alarm red, the same three a
 * call row already uses for connected, not reached and failed.
 *
 * The first screen is the glance (head, health, five numbers, the days), so
 * it is kept tight; everything after the chart is detail. Motion is the
 * console's: a refetch dims what is there instead of blanking it, and nothing
 * moves on arrival. */
.ov [hidden] { display: none !important; }
/* sized by its own column, not the window (see "a narrower content column") */
.ov { container: ov / inline-size; }
.ov-body { transition: opacity 180ms ease; }
.ov.is-loading .ov-body, .ov.is-loading .ov-health { opacity: .55; }

/* the head: title and one line on the left, the period on the right */
.ov-head { margin-bottom: 16px; }
.ov-period { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 2px;
             border-radius: 9px; background: var(--ui-fill); flex: none; }
.ov-period-opt { min-height: 30px; padding: 6px 12px; border: 0; border-radius: 7px; background: none;
                 color: var(--c-ink-2); font-size: 12.5px; font-weight: 500; letter-spacing: -0.004em;
                 white-space: nowrap; transition: background-color 150ms ease, color 150ms ease; }
.ov-period-opt:active { transform: none; }
.ov-period-opt[aria-checked="true"] { background: var(--c-surface); color: var(--c-ink); font-weight: 600;
                                      box-shadow: var(--ui-raise); }
@media (hover: hover) and (pointer: fine) {
  .ov-period-opt[aria-checked="false"]:hover { color: var(--c-ink); }
}

/* ── health ───────────────────────────────────────────────────────────────── */
.ov-health { margin: 0 0 14px; }
.ov-health-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin: 0 0 10px; }
.ov-health-line { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.016em; color: var(--c-ink); }
/* ○ all clear: the calm case has its own shape (app.css rule 2) */
.ov-health.is-clear .ov-health-line::before { content: ""; display: inline-block; width: 8px; height: 8px;
  margin-right: 8px; vertical-align: 1px; border: 1px solid var(--c-ink-4); border-radius: 50%; }
.ov-reply { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--c-ink-2); font-variant-numeric: tabular-nums; }
.ov-reply.is-quiet { color: var(--c-ink-3); }
.ov-reply-short, .ov-narrow { display: none; }
.ov-attn { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px;
           grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.ov-attn:empty { display: none; }
.ov-attn-item { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 11px 12px 11px 14px;
                background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-md); }
.ov-attn-copy { flex: 1; min-width: 0; }
.ov-attn-title { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--c-ink);
                 letter-spacing: -0.006em; }
.ov-attn-meta { margin: 2px 0 0; font-size: 12px; line-height: 1.45; color: var(--c-ink); font-variant-numeric: tabular-nums; }
.ov-attn-why { margin: 2px 0 0; font-size: 12px; line-height: 1.5; color: var(--c-ink-3); }
.ov-attn-item > button { flex: none; min-height: 32px; border-radius: var(--ui-r-control); }

/* ── the five numbers: the history tiles' figure, sized for five ─────────── */
.ov-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.ov-tile { min-width: 0; padding: 12px 14px 11px; background: var(--c-surface); border: 1px solid var(--c-line);
           border-radius: var(--r-md); display: flex; flex-direction: column; gap: 6px; }
.ov-tile-k { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600;
             line-height: 1; color: var(--c-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-tile strong { font-size: 24px; font-weight: 600; letter-spacing: -0.025em; line-height: 1; color: var(--c-ink);
                  white-space: nowrap; }
.ov-tile-s { font-size: 11.5px; line-height: 1.35; color: var(--c-ink-3); min-height: 1.35em; }

/* ── calls per day ────────────────────────────────────────────────────────── */
.ov .card h3 { margin: 0 0 12px; font-size: 13px; font-weight: 600; letter-spacing: -0.01em; color: var(--c-ink); }
.ov-daily { position: relative; margin-bottom: 14px; padding-bottom: 12px; }
.ov-card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.ov-card-head h3 { margin-bottom: 8px; }
.ov-legend { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px;
             font-size: 11.5px; color: var(--c-ink-2); }
.ov-legend li { display: inline-flex; align-items: center; gap: 6px; }
.ov-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.ov-key-connected { background: var(--c-ink-2); }
.ov-key-missed { background: var(--c-ink-4); }
.ov-key-failed { background: var(--c-alarm); }
.ov-chart { min-height: 172px; }
.ov-svg { display: block; overflow: visible; outline: none; }
.ov-svg:focus-visible { outline: 2px solid var(--c-ink); outline-offset: 4px; border-radius: 4px; }
.ov-seg-connected { fill: var(--c-ink-2); }
.ov-seg-missed { fill: var(--c-ink-4); }
.ov-seg-failed { fill: var(--c-alarm); }
.ov-grid { stroke: var(--c-line); stroke-width: 1; }
.ov-base { stroke: var(--c-line-strong); stroke-width: 1; }
.ov-axis { font-size: 10.5px; fill: var(--c-ink-3); font-variant-numeric: tabular-nums; }
.ov-hot { fill: var(--c-sunk); transition: opacity 120ms ease; }
.ov-chart-none { margin: 0; padding: 40px 0; text-align: center; color: var(--c-ink-3); font-size: 12.5px; }
.ov-tip { position: absolute; z-index: 2; min-width: 150px; padding: 9px 11px; pointer-events: none;
          background: var(--c-surface); border-radius: var(--ui-r-control); box-shadow: var(--ui-float);
          font-size: 12px; line-height: 1.45; color: var(--c-ink-2); font-variant-numeric: tabular-nums; }
.ov-tip p { margin: 0; }
.ov-tip-day { font-weight: 600; color: var(--c-ink); margin-bottom: 4px !important; }
.ov-tip-row { display: flex; align-items: center; gap: 7px; }
.ov-tip-row strong { min-width: 2.6em; text-align: right; color: var(--c-ink); font-weight: 600; }
.ov-tip-key { display: inline-block; width: 10px; height: 2px; border-radius: 1px; }
.ov-tip-key.ov-key-connected { background: var(--c-ink-2); }
.ov-tip-key.ov-key-missed { background: var(--c-ink-4); }
.ov-tip-key.ov-key-failed { background: var(--c-alarm); }
.ov-tip-foot { margin-top: 5px !important; padding-top: 5px; border-top: 1px solid var(--ui-sep); color: var(--c-ink-3); }

/* ── below the fold ───────────────────────────────────────────────────────── */
.ov-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px;
           align-items: start; }
.ov-agents, .ov-numbers { margin-bottom: 14px; }
.ov-table .ov-name { color: var(--c-ink); font-weight: 500; white-space: normal; min-width: 9em; }
.ov-table :is(th, td).r { padding-left: 14px; }
.ov-table tr.ov-link { cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  .ov-table tr.ov-link:hover td { background: var(--ui-fill-2); }
}
.ov-rowbtn { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left;
             line-height: inherit; cursor: pointer; }
.ov-rowbtn:active { transform: none; }
@media (hover: hover) and (pointer: fine) {
  .ov-rowbtn:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
}
.ov-state { white-space: nowrap; }

.ov-money-list { display: grid; grid-template-columns: auto 1fr; gap: 0; margin: 0 0 12px; font-size: 12.5px; }
.ov-money-list dt { padding-right: 16px !important; }
.ov-money-list dt, .ov-money-list dd { padding: 7px 0; border-bottom: 1px solid var(--c-line); margin: 0; }
.ov-money-list dt { color: var(--c-ink-2); }
.ov-money-list dd { text-align: right; color: var(--c-ink); font-weight: 600; }
.ov-money-note { display: block; font-weight: 400; font-size: 11px; color: var(--c-ink-3); }
.ov-human { padding: 12px 12px 10px; border-radius: var(--ui-r-control); background: var(--c-open-bg);
            box-shadow: inset 0 0 0 1px var(--c-open-line); }
.ov-human-k { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--c-ink); }
/* ▨ an estimate: the hatch the console uses for "rests on a number we chose" */
.ov-est { display: inline-flex; align-items: center; gap: 5px; margin-right: 4px; font-size: 10px;
          letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-open-ink); }
.ov-est::before { content: ""; width: 8px; height: 8px; border: 1px solid var(--c-open-line); border-radius: 1px;
  background-color: var(--c-open-bg);
  background-image: repeating-linear-gradient(45deg, var(--c-open-hatch) 0 3px, transparent 3px 7px); }
.ov-human-line { margin: 0 0 10px; font-size: 12.5px; line-height: 1.55; color: var(--c-ink-2); font-variant-numeric: tabular-nums; }
.ov-rate { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ov-rate label { margin: 0; }
.ov-rate-field { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; color: var(--c-ink-2); }
.ov-rate-field input { width: 64px; padding: 5px 7px; text-align: right; font-variant-numeric: tabular-nums; }
.ov-rate button.small { margin: 0; }
.ov-rate .linkbtn { padding: 0; }
.ov-rate-hint { margin: 8px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--c-ink-3); }
.ov-rate-hint:empty { display: none; }

.ov-foot { margin: 4px 0 0; font-size: 12.5px; color: var(--c-ink-3); }
.ov-foot .linkbtn { padding: 0; margin-left: 4px; font-size: 12.5px; }

.ov-unavail h2, .ov-empty h2 { margin: 0 0 6px; font-size: 15px; font-weight: 650; letter-spacing: -0.012em; }
.ov-unavail p, .ov-empty p { margin: 0 0 12px; max-width: 60ch; font-size: 12.5px; line-height: 1.6; color: var(--c-ink-2); }
.ov-unavail button { margin: 0; }

/* ── a narrower content column (the test panel open, a small laptop) ───────
 * Measured on the page's own width: with the test panel open a 1440 px window
 * leaves the page ~750 px, which a window query reads as a wide screen (the
 * origin table lost its Spend column and the fifth tile its label there). */
@container ov (max-width: 960px) {
  .ov-tile .ov-wide { display: none; }
  .ov-tile .ov-narrow { display: inline; }
}
@container ov (max-width: 880px) {
  .ov-cols { grid-template-columns: minmax(0, 1fr); }
}
@container ov (max-width: 720px) {
  .ov-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* The tables keep what a row is judged by and what it cost, and drop a column
 * rather than hide one past the edge: talk time and connected are in the
 * tiles, reply time in the health line, calls out on Phone numbers. */
@container ov (max-width: 620px) {
  .ov-table .ov-c-talk { display: none; }
}
@container ov (max-width: 480px) {
  .ov-table :is(.ov-c-conn, .ov-c-reply, .ov-c-out) { display: none; }
  .ov-table .ov-name { min-width: 7em; }
  .ov-table :is(th, td).r { padding-left: 10px; }
}

/* ── phone: the glance in the space between the title bar and the dock ──── */
@media (max-width: 760px) {
  .ov-head { margin-bottom: 10px; gap: 10px; align-items: center; }
  .ov-head p { display: none; }
  .ov-head h1 { margin: 0; font-size: 20px; }
  .ov-period-opt { min-height: 30px; padding: 6px 10px; }
  .ov-health { margin-bottom: 8px; }
  .ov-health-head { margin-bottom: 7px; gap: 2px 12px; }
  .ov-health-line { font-size: 15px; }
  .ov-reply { font-size: 12px; }
  .ov-reply-long, .ov-wide { display: none; }
  .ov-reply-short, .ov-narrow { display: inline; }
  .ov-attn { gap: 6px; }
  .ov-attn-item { padding: 8px 8px 8px 12px; gap: 10px; }
  /* the glance on a phone: what happened, how many, the button */
  .ov-attn-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
  .ov-attn-meta { font-size: 11.5px; }
  .ov-attn-why { display: none; }
  .ov-attn-item > button { min-height: 32px; padding: 7px 10px; font-size: 11.5px; }
  .ov-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
  .ov-tile { grid-column: span 2; padding: 8px 10px 7px; gap: 4px; }
  .ov-tile:nth-child(-n+2) { grid-column: span 3; }
  .ov-tile strong { font-size: 18px; }
  .ov-tile-s { font-size: 10.5px; min-height: 0; }
  .ov-daily { padding: 12px 12px 8px; }
  .ov-card-head { row-gap: 0; }
  .ov-card-head h3 { margin-bottom: 6px; }
  .ov-chart { min-height: 120px; }
  .ov-legend { font-size: 11px; gap: 2px 10px; }
}

/* a row that opens its page says so, quietly */
.ov-rowbtn::after { content: "›"; margin-left: 6px; color: var(--c-ink-4); font-weight: 400; }
.ov-rowbtn.tnum { white-space: nowrap; }
