/* 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)); }
}
/* Apply on its own row, bottom-right. */
.report-filter__actions { display: flex; justify-content: flex-end; 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; }

/* 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 variant: a tile rendered as a <button> IS the status filter for its bucket (webhook +
   landing logs). 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 {
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  transition: box-shadow .15s ease, transform .05s ease;
}
button.report-stat:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
button.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: rgb(222 241 230); }
.report-stat--success .report-stat__num, .report-stat--success .report-stat__icon { color: rgb(47 125 79); }
.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;
}
