/* House reports vocabulary (it-61). The shared filter/stat-tile/detail-expander
   chrome for every report-shaped surface: the Reports section (Emails, and later
   SMS/Webhooks), the webhook delivery log, and the landing-page submission log.
   Promoted here from webhooks.css so there is exactly ONE definition — no per-
   surface clone. The card/table shell itself lives in floating.css (.float-card,
   .float-table); this file is only the reports-specific chrome on top of it. */

/* The whole filter panel: stat tiles on top, a divider, then the refine row. */
.report-filter { display: grid; gap: .85rem; margin-bottom: 1rem; }
.report-filter__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .75rem; align-items: end;
  border-top: 1px solid var(--md-sys-color-outline-variant, #ddd); padding-top: .85rem;
}
/* A fixed N-column variant (the email report packs many filters — 5 per row). Collapses to the
   auto-fit flow on narrow screens. */
.report-filter__row--cols4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.report-filter__row--cols5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .report-filter__row--cols4,
  .report-filter__row--cols5 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
/* The panel's actions (Apply, Export, Clear) — on their own row, bottom-right; --incell sits them in the row. */
.report-filter__actions { display: flex; justify-content: flex-end; gap: var(--space-2, 0.5rem); margin-top: .85rem; }
/* Even columns: let each cell shrink and its control fill the cell (no per-field inline widths). */
.report-filter__row .field-input { min-width: 0; }
.report-filter__row .field-input > input,
.report-filter__row .field-input md-outlined-select,
.report-filter__row .field-input md-outlined-text-field { width: 100%; }
/* Apply sits in its own cell, bottom-aligned, natural width (not stretched across the column). */
.report-filter__row > .btn { justify-self: start; }
/* A wide cell: one field that takes two of the row's columns (a free-text question beside narrower pickers). */
.report-filter__wide { grid-column: span 2; }
/* A note under the row's fields (what the dates mean, what a count includes) spans the whole row. */
.report-filter__row > .field-input__hint { grid-column: 1 / -1; }
/* A paired filter cell (From + To) that stays side-by-side as one unit in the auto-fit filter grid,
   instead of splitting across a row boundary. Spans two grid columns; holds two equal fields.
   (Promoted from sms-report.css by it-280: the staff console's company filters pair theirs too.) */
.report-filter__pair { grid-column: span 2; display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.report-filter__pair .field-input { min-width: 0; }
/* A filter row at the very TOP of its card (no stat tiles above it): the house divider/top-padding the row normally
   carries is dropped, and the Apply cell aligns to the row. */
.report-filter__row--top { border-top: none; padding-top: 0; }
.report-filter__actions--incell { margin-top: 0; align-self: end; }
/* The search bar, its filter toggle and badge, the panel and the applied chips (first: the console's Companies, it-280
   — Aldo's wireframe "Console Companies — filters wireframe"; Gmail's pattern: one way in, one way to apply). The bar
   is one outlined box: the magnifier (a submit) on the left, the text, then a rule and the panel's toggle on the right,
   whose badge counts the panel's filters in use. */
.report-filter__searchbar {
  display: flex; align-items: center; box-sizing: border-box; height: 56px;
  border: 1px solid var(--md-sys-color-outline); border-radius: var(--md-sys-shape-corner-extra-small, 4px);
  background: var(--md-sys-color-surface-container-lowest);
}
.report-filter__searchbar:has(> input:focus) { border-color: var(--md-sys-color-primary); box-shadow: inset 0 0 0 1px var(--md-sys-color-primary); }
.report-filter__searchbar > input {
  flex: 1 1 auto; min-width: 0; height: 100%; padding: 0 .5rem 0 .25rem; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 1rem; color: var(--md-sys-color-on-surface);
}
.report-filter__searchbar > input::placeholder { color: var(--md-sys-color-on-surface-variant); opacity: 1; }
.report-filter__go { --icon-btn-size: 44px; flex: none; margin-left: 6px; color: var(--md-sys-color-on-surface-variant); }
.report-filter__searchbar-rule { flex: none; width: 1px; height: 28px; background: var(--md-sys-color-outline-variant); }
.report-filter__toggle {
  flex: none; margin: 0 8px; padding: 9px 10px 9px 12px; border: 0; background: transparent;
  color: var(--md-sys-color-primary); font-size: .875rem;
}
.report-filter__count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box;
  border-radius: var(--r-full); background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
  font-size: .75rem; font-weight: 600; z-index: 1;
}
.report-filter__count[hidden] { display: none; }
/* The panel: a soft inset under the search row, one filter to a row on one grid — its name, then its field. A range's
   two boxes take the same two columns on every row, joined by a dash; a single field (.report-filter__wide) spans
   both; a row's extra (Users added's "at least") trails. Each row is a .report-filter__item, which dissolves into the
   panel's grid (display: contents) — its name pinned to the first column starts each row. Fields are the compact
   48px, on the card's white. */
.report-filter__panel {
  display: grid; grid-template-columns: 10rem minmax(0, 13rem) 1.25rem minmax(0, 13rem) auto;
  column-gap: .75rem; row-gap: .75rem; align-items: center;
  padding: 1.25rem 1.5rem 1rem; border-radius: var(--r-md, 12px); background: var(--md-sys-color-surface-container-low);
}
.report-filter__item { display: contents; }
.report-filter__name {
  grid-column: 1; font-size: var(--md-sys-typescale-body-medium-size, .875rem); font-weight: 500;
  color: var(--md-sys-color-on-surface);
}
.report-filter__wide { grid-column: 2 / 5; min-width: 0; }
.report-filter__dash { text-align: center; color: var(--md-sys-color-on-surface-variant); }
.report-filter__extra {
  display: inline-flex; align-items: center; gap: .625rem; padding-left: .75rem;
  font-size: var(--md-sys-typescale-body-medium-size, .875rem); color: var(--md-sys-color-on-surface-variant);
}
/* A hint (Min, Max, From, To) is the outline's grey, so it never reads as a value typed in (4.6:1 on white). */
.report-filter__panel md-outlined-text-field {
  width: 100%; min-width: 0; --md-outlined-field-top-space: 12px; --md-outlined-field-bottom-space: 12px;
  --md-outlined-text-field-input-text-placeholder-color: var(--md-sys-color-outline);
  background: var(--md-sys-color-surface-container-lowest); border-radius: var(--md-sys-shape-corner-extra-small, 4px);
}
.report-filter__extra md-outlined-text-field { width: 4.5rem; }
/* A day: the house date field at the panel's height, a calendar icon inside on the right (decoration — the field
   opens its calendar). flatpickr copies .field-input__date onto the field it shows; the date stylesheet loads after
   this one, hence the panel in each selector. */
.report-filter__date { position: relative; display: block; min-width: 0; }
.report-filter__panel .field-input__date {
  min-height: 48px; height: 48px; padding-right: 40px; background: var(--md-sys-color-surface-container-lowest);
}
.report-filter__panel .field-input__date::placeholder,
.report-filter__panel .chip-multiselect__input::placeholder { color: var(--md-sys-color-outline); opacity: 1; }
.report-filter__date > .material-symbols-rounded {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 18px;
  color: var(--md-sys-color-on-surface-variant); pointer-events: none;
}
.report-filter__panel .chip-multiselect__box {
  min-height: 48px; padding: 6px 40px 6px 12px; background: var(--md-sys-color-surface-container-lowest);
}
.report-filter__panel .chip-multiselect__chip { white-space: nowrap; }
.report-filter__foot {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
  min-height: 2rem; margin-top: .25rem;
}
.report-filter__hint {
  display: inline-flex; align-items: center; gap: .375rem; font-size: .78rem; color: var(--md-sys-color-on-surface-variant);
}
.report-filter__hint > .material-symbols-rounded { font-size: 16px; }
.report-filter__foot-actions { display: inline-flex; align-items: center; gap: .5rem; margin-left: auto; }
/* The closed panel's filters in use, under the search row: an input chip each — its sentence opens the panel, × clears
   it. */
.report-filter__applied {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding-top: .875rem; border-top: 1px solid var(--md-sys-color-outline-variant, #ddd);
}
.report-filter__applied[hidden] { display: none; }
.report-filter__chip {
  display: inline-flex; align-items: center; height: 32px; box-sizing: border-box; overflow: hidden;
  border: 1px solid var(--md-sys-color-outline-variant); border-radius: var(--md-sys-shape-corner-small, 8px);
  background: var(--md-sys-color-surface-container-lowest); font-size: .84rem;
}
.report-filter__chip-open {
  height: 100%; padding: 0 4px 0 12px; border: 0; background: transparent; color: var(--md-sys-color-on-surface);
  font: inherit; cursor: pointer; white-space: nowrap;
}
.report-filter__chip-open strong { font-weight: 600; }
.report-filter__chip-open:hover, .report-filter__chip-clear:hover { background: var(--md-sys-color-surface-container); }
.report-filter__chip-clear {
  display: grid; place-items: center; width: 28px; height: 28px; margin-right: 2px; padding: 0; border: 0;
  border-radius: var(--r-full); background: transparent; color: var(--md-sys-color-on-surface-variant); cursor: pointer;
}
.report-filter__chip-clear > .material-symbols-rounded { font-size: 16px; }
/* A narrow card: each row its own box — the name above, a range's two boxes sharing the width, the extra on its own
   line. The form is the container (the console's card, not the window, decides). */
.report-filter:has(> .report-filter__panel) { container-type: inline-size; }
@container (max-width: 44rem) {
  .report-filter__panel { display: flex; flex-direction: column; align-items: stretch; gap: 1rem; padding: 1rem; }
  .report-filter__item {
    display: grid; grid-template-columns: minmax(0, 1fr) 1.25rem minmax(0, 1fr); column-gap: .5rem; row-gap: .375rem;
    align-items: center;
  }
  .report-filter__item > .report-filter__name,
  .report-filter__item > .report-filter__wide,
  .report-filter__item > .report-filter__extra { grid-column: 1 / -1; }
  .report-filter__extra { padding-left: 0; }
}

/* Stat tiles — the date window's outcome/engagement breakdown. A tile can be a
   clickable filter (webhook/landing status buckets) or a read-only KPI (email
   rates); the visual is identical either way. The active tile is ringed so its
   relationship to the (filtered) table below is obvious. */
.report-stats { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0; }
.report-stat {
  position: relative; flex: 1 1 0; min-width: 130px; padding: .7rem .9rem;
  border-radius: var(--r-md, 12px);
  background: var(--md-sys-color-surface-container-high, #ece6f0);
  border: 1px solid transparent; display: grid; gap: .1rem;
}
/* Clickable variants: a tile rendered as a <button> IS the status filter for its bucket (webhook +
   landing logs); a tile rendered as an <a> drills into the list behind its number (the call report's
   outcomes → Call log, the text report's Unsubscribed → contacts). A tile rendered as a plain element
   (read-only KPI, e.g. the email report) shows the same visual but carries no interactive affordance. */
button.report-stat, a.report-stat {
  font: inherit; color: inherit; text-align: left; text-decoration: none; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  transition: box-shadow .15s ease, transform .05s ease;
}
button.report-stat:hover, a.report-stat:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
button.report-stat:active, a.report-stat:active { transform: translateY(1px); }
.report-stat__num { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.report-stat__label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--md-sys-color-on-surface-variant, #555);
}
.report-stat__icon { position: absolute; top: .6rem; right: .65rem; font-size: 20px; opacity: .5; }
.report-stat--success { background: color-mix(in srgb, var(--chart-ok) 16%, transparent); }
.report-stat--success .report-stat__num, .report-stat--success .report-stat__icon { color: var(--chart-ok); }
/* The one tile that matters (it-180: the wizard's "Will be called"). */
.report-stat--hero { background: var(--md-sys-color-primary); }
.report-stat--hero .report-stat__num { color: var(--md-sys-color-on-primary); }
.report-stat--hero .report-stat__label { color: var(--md-sys-color-primary-container); }
/* A tile for what's left out — the number recedes. */
.report-stat--muted .report-stat__num { color: var(--md-sys-color-on-surface-variant); }
.report-stat--failed { background: var(--md-sys-color-error-container, #fdd); }
.report-stat--failed .report-stat__num, .report-stat--failed .report-stat__icon { color: var(--md-sys-color-on-error-container, #8c1d18); }
.report-stat--nomatch { background: rgb(246 236 214); }
.report-stat--nomatch .report-stat__num, .report-stat--nomatch .report-stat__icon { color: rgb(154 101 22); }
.report-stat--active { border-color: var(--md-sys-color-primary); box-shadow: 0 0 0 1px var(--md-sys-color-primary); }

/* Row drill-down: an expander below a table row with tabbed panels (request/
   response on webhooks, payload on submissions). */
.report-detail { padding: .5rem 0 .75rem; display: grid; gap: .5rem; }
.report-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--md-sys-color-outline-variant, #ddd); }
.report-tab {
  background: none; border: none; cursor: pointer; font: inherit; padding: .4rem .85rem;
  color: var(--md-sys-color-on-surface-variant, #555); border-bottom: 2px solid transparent;
  margin-bottom: -1px; border-radius: var(--r-sm, 8px) var(--r-sm, 8px) 0 0;
}
.report-tab:hover { background: var(--md-sys-color-surface-variant, #f1edf5); }
.report-tab--active { color: var(--md-sys-color-primary); border-bottom-color: var(--md-sys-color-primary); font-weight: 600; }
.report-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .4rem 0 .3rem; font-size: .8rem; }
.report-copy { padding: .1rem .35rem; min-width: 0; }
.report-pre {
  white-space: pre-wrap; overflow-x: auto; margin: 0; padding: .65rem .75rem;
  background: var(--md-sys-color-surface-variant, #f4f1f7); border-radius: var(--r-sm, 8px);
  font-size: .78rem; line-height: 1.45;
}

/* An engagement-tally cell (it-61.1): a prominent count with its last-occurrence muted beneath. */
.report-tally__n { font-weight: 600; line-height: 1.15; display: block; }
.report-tally__t { font-size: .72rem; color: var(--md-sys-color-on-surface-variant, #555); display: block; }

/* it-61.2: a tally cell that drills into the Engagements feed — reads as text, not a link, until hover.
   (The per-event Type chip reuses the house .badge / .badge--* component — no new chip family.) */
.report-tally-link { color: inherit; text-decoration: none; display: inline-block; }
.report-tally-link:hover .report-tally__n { text-decoration: underline; }

/* it-61.2: the per-event feed's Detail cell — a video keyframe thumbnail, or a link truncated to keep the
   row height stable (22ch ≈ the column width; longer URLs ellipsize and reveal on hover via title). */
.report-thumb {
  width: 120px; max-height: 70px; object-fit: cover; object-position: top;
  border-radius: var(--r-sm); vertical-align: middle; display: block;
}
/* it-61.2: a play row's thumbnail is a button — click opens the video popup. Play glyph overlays the frame. */
.report-thumb-btn {
  position: relative; display: inline-flex; padding: 0; border: 0; background: none;
  cursor: pointer; border-radius: var(--r-sm); overflow: hidden;
}
.report-thumb-btn__play {
  position: absolute; inset: 0; margin: auto; width: 1.5rem; height: 1.5rem;
  color: #fff; font-size: 1.5rem; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .55)); pointer-events: none;
}
/* it-61.2: one-line cells so the dense per-event feed doesn't wrap a repeated subject/URL onto two rows.
   .report-truncate ellipsizes (full value on hover via title); .report-nowrap just keeps a short label intact. */
.report-truncate {
  display: inline-block; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: middle;
}
.report-nowrap { white-space: nowrap; }
/* it-61.2: the Detail cell stacks its content over the event timestamp (a muted footer) so the feed drops
   the separate When column. */
.report-detail-cell { display: flex; flex-direction: column; gap: .15rem; align-items: flex-start; }
.report-when { font-size: .72rem; white-space: nowrap; }

/* it-61.2: the dismissible send-scope chip above the feed (?send=). Not a filter — a scope banner. */
.report-scope {
  display: inline-flex; align-items: center; gap: .5rem; margin: 0 0 1rem;
  padding: .4rem .5rem .4rem .75rem; border-radius: var(--r-full);
  background: var(--md-sys-color-surface-variant); font-size: var(--md-sys-typescale-label-large-size);
}
.report-scope .material-symbols-rounded { font-size: 1.25rem; color: var(--md-sys-color-on-surface-variant); }
.report-scope__clear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: var(--r-full);
  text-decoration: none; color: var(--md-sys-color-on-surface-variant); font-size: 1.25rem; line-height: 1;
}

/* An answer's provenance sentences (what was counted, filters, window, scope, total — the API's own words): under a
   report card's title, in the report-rows export dialog, on a report-rows job. Here, not in assistant.css, because
   Report Jobs shows them to people who may not have the Assistant. */
.prov-lines {
  list-style: none;
  margin: 0.25rem 0 0.5rem;
  padding: 0;
  font-size: var(--md-sys-typescale-body-small-size);
  color: var(--md-sys-color-on-surface-variant);
}
