/* Reports and workforce.
   Intercom-style area overrides. Loaded after every other desk stylesheet. */

/* ---------- Report icons (line icons drawn to match /icons.png) ---------- */
.i-rp-ticket, .i-rp-phone, .i-rp-smile, .i-rp-target, .i-rp-shield { position: relative; background: none; mask: none; }
.i-rp-ticket::before { content: ''; position: absolute; inset: 4px 1.5px; border: 1.6px solid currentColor; border-radius: 3px; }
.i-rp-ticket::after { content: ''; position: absolute; top: 6px; bottom: 6px; left: 11px; border-left: 1.6px dotted currentColor; }
.i-rp-phone::before { content: ''; position: absolute; inset: 1.5px 4.5px; border: 1.6px solid currentColor; border-radius: 3px; }
.i-rp-phone::after { content: ''; position: absolute; left: 7.5px; right: 7.5px; bottom: 4px; height: 1.6px; border-radius: 1px; background: currentColor; }
.i-rp-smile::before { content: ''; position: absolute; inset: 1.5px; border: 1.6px solid currentColor; border-radius: 50%; }
.i-rp-smile::after { content: ''; position: absolute; left: 6px; right: 6px; top: 7px; height: 4px; border: 1.6px solid currentColor; border-top: 0; border-radius: 0 0 5px 5px; }
.i-rp-target::before { content: ''; position: absolute; inset: 1.5px; border: 1.6px solid currentColor; border-radius: 50%; }
.i-rp-target::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: currentColor; }
.i-rp-shield::before { content: ''; position: absolute; inset: 1.5px 3px; background: currentColor;
  clip-path: polygon(50% 0, 100% 16%, 100% 52%, 50% 100%, 0 52%, 0 16%); }
.i-rp-shield::after { content: ''; position: absolute; inset: 3.4px 4.7px; background: var(--subnav, var(--surface));
  clip-path: polygon(50% 0, 100% 17%, 100% 52%, 50% 100%, 0 52%, 0 17%); }
.segment-link:hover .i-rp-shield::after { background: var(--hover); }
.segment-link[aria-pressed="true"] .i-rp-shield::after { background: var(--selected); }
.report-plus { position: relative; display: block; width: 14px; height: 14px; }
.report-plus::before, .report-plus::after { content: ''; position: absolute; top: 6.25px; left: 0; width: 14px; height: 1.5px; border-radius: 1px; background: currentColor; }
.report-plus::after { transform: rotate(90deg); }

/* ---------- Reports: secondary sidebar ---------- */
.workspace #reports-view .report-menu-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 8px; padding-inline: 8px 0; }
.workspace #reports-view .report-menu-title h2 { margin: 0; padding: 0; }
.workspace #reports-view .report-menu-title #new-report { width: 28px; min-height: 28px; }
#reports-view #report-list { display: block; overflow: visible; }
#reports-view #report-list > div, #reports-view .report-menu-group { display: grid; gap: 2px; }
.workspace #reports-view :is(#report-list h3, .report-menu-heading) { margin: 16px 8px 4px; color: var(--quiet); font-size: 12px; font-weight: 600; line-height: 1.4; letter-spacing: 0; }
.workspace #reports-view :is(#report-list, .report-menu-group) .segment-link { flex-shrink: 1; width: 100%; max-width: none; min-height: 32px; padding: 6px 8px; line-height: 1.3; }
.workspace #reports-view :is(#report-list, .report-menu-group) .segment-link > span:last-child { overflow: visible; white-space: normal; text-overflow: clip; overflow-wrap: anywhere; }
#reports-view .report-menu-group:not(:has(button:not([hidden]))) { display: none; }

/* ---------- Reports: page header ---------- */
#reports-view .report-content { background: var(--surface); }
.workspace #reports-view .report-header { align-items: flex-start; margin-bottom: 20px; }
#reports-view .report-heading { flex: 1 1 320px; min-width: 0; }
.workspace #reports-view .report-heading h2 { margin: 0; }
#reports-view .report-heading .desk-page-description { max-width: 640px; margin: 4px 0 0; }
#reports-view #report-description:empty { display: none; }
#reports-view .report-header .desk-page-actions { justify-content: flex-end; }
#reports-view .report-export-menu .desk-actions-items { min-width: 264px; }
.workspace #reports-view .report-export-menu .desk-actions-items .button { min-height: 48px; padding-block: 6px; }
#reports-view .report-menu-text { display: grid; gap: 1px; text-align: start; }
#reports-view .report-menu-text strong { color: var(--ink); font-size: 13px; font-weight: 500; }
#reports-view .report-menu-text small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.35; }

/* ---------- Reports: filter bar (pill selects) ---------- */
.workspace #reports-view .report-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 0; border: 0; border-radius: 0; background: none; }
.workspace #reports-view .report-filters .report-filter {
  display: inline-flex; align-items: center; min-width: 0; height: 32px; margin: 0; padding: 0 0 0 12px;
  border: 1px solid var(--control-line); border-radius: 999px; background: var(--surface);
  color: var(--muted); font-size: 13px; font-weight: 400; line-height: 1; white-space: nowrap;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}
.workspace #reports-view .report-filters .report-filter:hover { border-color: var(--control-line-hover, var(--control-line)); background: var(--hover); }
.workspace #reports-view .report-filters .report-filter:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring, var(--accent-soft)); }
.workspace #reports-view .report-filters .report-filter :is(select, input) {
  min-width: 0; height: 30px; min-height: 30px; margin: 0; padding: 0 10px 0 6px; border: 0; border-radius: 999px;
  background: transparent; box-shadow: none; color: var(--ink); font-size: 13px; font-weight: 500; line-height: 1; field-sizing: content;
}
.workspace #reports-view .report-filters .report-filter select { align-items: center; }
.workspace #reports-view .report-filters .report-filter :is(select, input):focus-visible { box-shadow: none; }
.workspace #reports-view .report-filters .report-filter input[type="number"] { width: 72px; field-sizing: fixed; }
#reports-view .report-filter-end { display: inline-flex; align-items: center; gap: 4px 12px; margin-inline-start: auto; }
.workspace #reports-view .report-filters .report-compare { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; margin: 0; color: var(--ink); font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; }
#reports-view .report-compare input[role="switch"] {
  position: relative; flex: 0 0 auto; width: 28px; height: 16px; min-width: 28px; min-height: 16px; margin: 0;
  border: 0; border-radius: 999px; background: var(--control-line); appearance: none; cursor: pointer; transition: background-color 120ms ease;
}
#reports-view .report-compare input[role="switch"]::before {
  content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform 120ms ease;
}
#reports-view .report-compare input[role="switch"]:checked { background: var(--accent); }
#reports-view .report-compare input[role="switch"]:checked::before { transform: translateX(12px); }
#reports-view .report-compare input[role="switch"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
#reports-view #report-filter-presets { min-height: 32px; }
#reports-view .report-cohort { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
#reports-view .report-cohort:empty { display: none; }

/* ---------- Reports: cards ---------- */
#reports-view #report-charts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; container-type: inline-size; }
#reports-view .report-row { display: grid; gap: 16px; min-width: 0; }
#reports-view .report-row-metrics { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
#reports-view .report-row-metrics:has(> :only-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#reports-view .report-row-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#reports-view .report-row-charts > :last-child:nth-child(odd) { grid-column: 1 / -1; }
@container (max-width: 840px) {
  #reports-view .report-row-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 760px) {
  #reports-view .report-row-charts { grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 420px) {
  #reports-view .report-row-metrics { grid-template-columns: minmax(0, 1fr); }
}
#reports-view .report-chart {
  display: flex; flex-direction: column; grid-column: auto; min-width: 0; min-height: 0; padding: 20px;
  border: 1px solid var(--line); border-radius: var(--radius-lg, 12px); background: var(--surface); box-shadow: none;
}
#reports-view .report-chart.report-number { padding: 16px 20px; background: var(--surface); }
#reports-view .report-chart-heading { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: nowrap; gap: 12px; margin-bottom: 16px; }
#reports-view .report-chart-heading > div:first-child { min-width: 0; }
#reports-view .report-chart-heading h3 { margin: 0; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.35; }
#reports-view .report-chart-heading > div > span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
#reports-view .report-number .report-chart-heading { margin-bottom: 6px; }
#reports-view .report-number .report-chart-heading h3 { color: var(--muted); font-size: 13px; font-weight: 500; }

#reports-view .chart-drill-button { padding: 2px 4px; border: 0; border-radius: var(--radius-sm, 6px); background: none; color: var(--ink); font: inherit; text-align: start; }
#reports-view .chart-drill-button:not(:disabled) { cursor: pointer; }
#reports-view .chart-drill-button:not(:disabled):hover { background: var(--hover); }
#reports-view .chart-drill-button:disabled { opacity: 1; cursor: default; }
#reports-view .metric-value { margin-inline: -4px; }
#reports-view .metric-value .chart-drill-button { color: var(--ink); font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
#reports-view .metric-value.is-empty .chart-drill-button { color: var(--quiet); }
#reports-view .report-chart-total { flex: 0 0 auto; margin: -2px -4px 0 0; }
#reports-view .report-chart-total .chart-drill-button { font-size: 20px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }

#reports-view .report-comparison { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 8px 0 0; color: var(--muted); font-size: 12px; }
#reports-view .report-chart:not(.report-number) .report-comparison { margin: -8px 0 16px; }
#reports-view .report-delta { gap: 3px; font-variant-numeric: tabular-nums; }
#reports-view .report-delta-arrow { font-size: 12px; line-height: 1; }
#reports-view .report-definition { margin-top: auto; padding-top: 12px; color: var(--muted); font-size: 12px; }
#reports-view .report-definition summary { width: fit-content; color: var(--muted); font-weight: 500; cursor: pointer; }
#reports-view .report-definition summary:hover { color: var(--ink); }
#reports-view .report-definition p { max-width: 60ch; margin-top: 6px; line-height: 1.45; }

/* Column chart (time breakdowns). One series in the accent; recessive hairline grid. */
#reports-view .report-plot { padding: 8px 0 28px 44px; }
#reports-view .report-plot-area { position: relative; height: 184px; }
#reports-view .report-gridlines { position: absolute; inset: 0; }
#reports-view .report-gridline { position: absolute; left: 0; right: 0; bottom: var(--at); height: 0; border-top: 1px solid var(--soft-line); }
#reports-view .report-gridline:first-child { border-top-color: var(--line); }
#reports-view .report-gridline > span { position: absolute; right: calc(100% + 8px); top: 0; transform: translateY(-50%); color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#reports-view .report-columns { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--count), minmax(0, 1fr)); }
#reports-view .report-column { position: relative; display: flex; align-items: flex-end; justify-content: center; min-width: 0; height: 100%; margin: 0; padding: 0 1px; border: 0; border-radius: 0; background: none; color: inherit; }
#reports-view button.report-column:not(:disabled):hover,
#reports-view button.report-column:focus-visible { background: color-mix(in srgb, var(--hover) 75%, transparent); }
#reports-view button.report-column:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
#reports-view .report-column-bar { position: relative; display: block; width: min(24px, 100%); height: var(--value); border-radius: 4px 4px 0 0; background: var(--accent); }
#reports-view .report-column-bar[data-zero] { height: 0; min-height: 0; }
#reports-view button.report-column:hover .report-column-bar { background: var(--accent-hover); }
#reports-view .report-column-label { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 11px; white-space: nowrap; pointer-events: none; }
#reports-view .report-column-tip {
  position: absolute; z-index: 3; bottom: calc(100% + 6px); left: 50%; display: none; transform: translateX(-50%);
  padding: 6px 9px; border: 1px solid var(--dialog-border, transparent); border-radius: var(--radius-md, 8px);
  background: var(--elevated, var(--surface)); box-shadow: var(--shadow-pop); color: var(--ink);
  font-size: 12px; font-weight: 500; line-height: 1.35; text-align: start; font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none;
}
#reports-view .report-column:last-child .report-column-tip { left: auto; right: -4px; transform: none; }
#reports-view .report-column:first-child .report-column-tip { left: -4px; transform: none; }
#reports-view .report-column-tip strong { display: block; color: var(--muted); font-weight: 500; }
#reports-view .report-column:is(:hover, :focus-visible) .report-column-tip { display: block; }

/* Horizontal bars (categorical breakdowns), sorted by value. */
#reports-view .report-bars { display: grid; gap: 2px; max-height: 320px; overflow: auto; margin: 0 -8px; }
#reports-view .report-bars .chart-drill-button {
  display: grid; grid-template-columns: minmax(72px, 32%) minmax(0, 1fr) minmax(44px, auto); align-items: center; gap: 12px;
  min-height: 32px; padding: 4px 8px; font-size: 13px;
}
#reports-view .report-bar-label { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
#reports-view .report-bar-track { display: block; min-width: 0; }
#reports-view .report-bar-track > span { display: block; width: var(--value); min-width: 2px; height: 12px; border-radius: 0 4px 4px 0; background: var(--accent); }
#reports-view .report-bars .chart-drill-button:not(:disabled):hover .report-bar-track > span { background: var(--accent-hover); }
#reports-view .report-bar-value { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; text-align: end; }

/* Breakdown tables: flush to the card edges, .desk-table look. */
#reports-view .report-table:has(> .report-table-wrap) { padding-bottom: 0; overflow: hidden; }
#reports-view .report-table-wrap { max-height: 360px; margin: 0 -20px; overflow: auto; border-top: 1px solid var(--line); }
#reports-view .report-table .report-definition { padding-bottom: 16px; }
#reports-view .report-breakdown { width: 100%; border-collapse: collapse; font-size: 13px; text-align: start; }
#reports-view .report-breakdown thead th { position: sticky; top: 0; z-index: 1; height: 36px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--inset); color: var(--muted); font-size: 12px; font-weight: 500; text-align: start; white-space: nowrap; }
#reports-view .report-breakdown tbody :is(th, td) { height: 40px; padding: 4px 20px; border-bottom: 1px solid var(--soft-line); }
#reports-view .report-breakdown tbody tr:last-child > * { border-bottom: 0; }
#reports-view .report-breakdown tbody tr:hover { background: var(--hover); }
#reports-view .report-breakdown tbody th { color: var(--ink); font-weight: 500; text-align: start; }
#reports-view .report-breakdown :is(td, th):last-child { text-align: end; }
#reports-view .report-breakdown td .chart-drill-button { margin-inline-end: -4px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* Intentional no-data state inside a card. */
#reports-view .report-chart-empty { display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 184px; padding: 16px; color: var(--muted); font-size: 13px; text-align: center; }
#reports-view .report-chart-empty strong { color: var(--ink); font-size: 14px; font-weight: 600; }
#reports-view .report-chart-empty-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 8px; border-radius: 50%; background: var(--hover); color: var(--muted); }

@media (max-width: 760px) {
  #reports-view .report-sidebar { display: flex; align-items: center; gap: 4px; overflow-x: auto; }
  .workspace #reports-view .report-menu-title { flex: 0 0 auto; margin: 0 4px 0 0; }
  #reports-view #report-list, #reports-view #report-list > div, #reports-view .report-menu-group { display: flex; flex: 0 0 auto; gap: 4px; }
  .workspace #reports-view :is(#report-list h3, .report-menu-heading) { display: none; }
  .workspace #reports-view :is(#report-list, .report-menu-group) .segment-link { width: auto; max-width: none; white-space: nowrap; }
  .workspace #reports-view :is(#report-list, .report-menu-group) .segment-link > span:last-child { white-space: nowrap; }
  #reports-view .report-filter-end { margin-inline-start: 0; }
}

/* ---------- Report dialogs ---------- */
/* Shared: muted intro copy, right-aligned submit buttons, quiet notes. */
:is(#report-snapshots-dialog, #report-export-dialog, #report-saved-filters, #report-metric-dialog, #report-archive-dialog) .sequence-trigger-note,
#report-snapshots-dialog > .report-snapshots-intro { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.45; }
:is(#report-metric-form, #report-save-filter) > .button.primary,
#report-archive-dialog .desk-form > .button { justify-self: end; }
#report-metric-form .sequence-trigger-note { margin: -4px 0 0; }

/* Snapshots: underline tabs, list rows, forms, frozen report view. */
#report-snapshots-dialog:modal { width: min(680px, calc(100vw - 24px)); }
#report-snapshots-dialog .report-snapshot-tabs { flex-wrap: nowrap; gap: 0 20px; margin: 0 0 16px; overflow-x: auto; }
#report-snapshots-dialog .report-snapshot-tabs > button { flex: 0 0 auto; }
#report-snapshots-content { min-height: 120px; color: var(--ink); font-size: 14px; }
#report-snapshots-content > .list-empty { display: grid; place-items: center; min-height: 120px; margin: 0; padding: 24px; border: 1px dashed var(--line); border-radius: var(--radius-lg, 12px); color: var(--muted); font-size: 13px; }
#report-snapshots-content > .list-empty:not(:only-child) { min-height: 0; margin-bottom: 16px; padding: 14px 16px; }
#report-snapshots-content .report-snapshot-list { margin: 0 0 16px; border: 1px solid var(--line); border-radius: var(--radius-lg, 12px); overflow: hidden; }
#report-snapshots-content .report-snapshot-list li { min-height: 56px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--soft-line); }
#report-snapshots-content .report-snapshot-list li:last-child { border-bottom: 0; }
#report-snapshots-content .report-snapshot-list li:hover { background: var(--hover); }
#report-snapshots-content .report-snapshot-list strong { font-size: 14px; font-weight: 500; }
#report-snapshots-content .report-snapshot-list p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
#report-snapshots-content .report-snapshot-list .button { flex: 0 0 auto; }
#report-snapshots-content .desk-form { display: grid; gap: 14px; max-width: none; }
#report-snapshots-content .desk-form > .button.primary { justify-self: end; }
#report-snapshots-dialog .report-snapshot-recipients { display: grid; gap: 2px; max-height: 196px; margin: 0; padding: 6px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-md, 8px); background: var(--surface); }
#report-snapshots-dialog .report-snapshot-recipients legend { margin-bottom: 4px; padding: 0 4px; color: var(--ink); font-size: 13px; font-weight: 500; }
#report-snapshots-dialog .report-snapshot-recipients label { display: flex; align-items: center; gap: 8px; min-height: 32px; margin: 0; padding: 0 8px; border-radius: var(--radius-sm, 6px); font-size: 14px; font-weight: 400; cursor: pointer; }
#report-snapshots-dialog .report-snapshot-recipients label:hover { background: var(--hover); }
#report-snapshots-dialog .report-snapshot-recipients label:has(input:checked) { background: var(--selected); font-weight: 500; }
#report-snapshots-content .report-snapshot-view-header { display: grid; justify-items: start; gap: 2px; margin-bottom: 16px; }
#report-snapshots-content .report-snapshot-view-header h3 { margin: 12px 0 0; font-size: 16px; font-weight: 600; }
#report-snapshots-content .report-snapshot-view-header p { margin: 0; color: var(--muted); font-size: 13px; }
#report-snapshots-content .report-snapshot-charts { gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 136px), 1fr)); margin: 0; }
#report-snapshots-content .report-chart { display: grid; align-content: start; gap: 6px; min-height: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg, 12px); background: var(--surface); grid-column: auto; }
#report-snapshots-content .report-chart:has(table) { grid-column: 1 / -1; }
#report-snapshots-content .report-chart h4 { margin: 0; color: var(--muted); font-size: 13px; font-weight: 500; }
#report-snapshots-content .report-chart > strong { color: var(--ink); font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
#report-snapshots-content .report-chart > p { margin: 0; color: var(--muted); font-size: 12px; }
#report-snapshots-content .report-chart details { color: var(--muted); font-size: 12px; }
#report-snapshots-content .report-breakdown { width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 13px; }
#report-snapshots-content .report-breakdown th { font-weight: 500; text-align: start; }
#report-snapshots-content .report-breakdown thead th { color: var(--muted); font-size: 12px; }
#report-snapshots-content .report-breakdown :is(th, td) { height: 36px; padding: 4px 0; border-bottom: 1px solid var(--soft-line); }
#report-snapshots-content .report-breakdown tbody tr:last-child > * { border-bottom: 0; }
#report-snapshots-content .report-breakdown :is(th, td):last-child { text-align: end; font-variant-numeric: tabular-nums; }

/* Dataset export: two-column filters, checkbox grid for columns, preview table. */
#report-export-dialog:modal { width: min(720px, calc(100vw - 24px)); }
#report-export-form { display: grid; gap: 16px; }
#report-export-form .report-export-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
#report-export-form .report-export-filters:empty { display: none; }
#report-export-form .report-export-filters label { min-width: 0; }
#report-export-form .report-export-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 8px; margin: 0; padding: 8px 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-lg, 12px); background: var(--surface); }
#report-export-form .report-export-columns legend { padding: 0 6px; color: var(--ink); font-size: 13px; font-weight: 500; }
#report-export-form .report-export-columns label { display: flex; align-items: center; gap: 8px; min-height: 32px; margin: 0; padding: 0 8px; border-radius: var(--radius-sm, 6px); color: var(--ink); font-size: 13px; font-weight: 400; cursor: pointer; }
#report-export-form .report-export-columns label:hover { background: var(--hover); }
#report-export-form .report-export-actions { justify-content: flex-end; gap: 8px; margin: 4px calc(-1 * var(--editor-space, 24px)) 0; padding: 16px var(--editor-space, 24px) 0; border-top: 1px solid var(--line); }
#report-export-dialog #report-export-preview { margin-top: 16px; max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-lg, 12px); }
#report-export-dialog #report-export-preview > p { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
#report-export-dialog #report-export-preview table { width: 100%; border-collapse: collapse; font-size: 13px; }
#report-export-dialog #report-export-preview th { height: 36px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--inset); color: var(--muted); font-size: 12px; font-weight: 500; text-align: start; white-space: nowrap; }
#report-export-dialog #report-export-preview td { height: 40px; padding: 4px 12px; border-bottom: 1px solid var(--soft-line); white-space: nowrap; }

/* Customize report drawer: details + numbered chart cards. */
#report-editor .report-editor-section-head { display: grid; gap: 2px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
#report-editor .report-editor-section-head h3 { margin: 0; color: var(--ink); font-size: 14px; font-weight: 600; }
#report-editor .report-editor-section-head p { margin: 0; color: var(--muted); font-size: 13px; }
#report-editor #report-editor-charts { display: grid; gap: 12px; }
#report-editor .report-chart-editor { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 12px 16px 16px; background: var(--surface); }
#report-editor .report-chart-editor-head { display: flex; align-items: center; gap: 8px; grid-area: 1 / 1 / 2 / -1; min-height: 32px; margin: 0 0 -4px; }
#report-editor .report-chart-editor-head strong { color: var(--ink); font-size: 13px; font-weight: 600; }
#report-editor .report-chart-editor label:has([data-config="metric"]) { grid-column: span 2; }
#report-editor .report-chart-editor [data-remove-chart] { z-index: 1; grid-area: 1 / 3; justify-self: end; align-self: center; margin-inline-end: -8px; }
#report-editor #add-report-chart { justify-self: start; }
@media (max-width: 640px) {
  #report-editor .report-chart-editor { grid-template-columns: minmax(0, 1fr); }
  #report-editor .report-chart-editor label:has([data-config="metric"]) { grid-column: auto; }
  #report-editor .report-chart-editor [data-remove-chart] { grid-area: 1 / 1; z-index: 1; }
}

/* Conversation drill-down. */
#report-drill:modal { width: min(880px, calc(100vw - 24px)); }
#report-drill #report-drill-results > .contacts-results { max-height: min(60dvh, 560px); overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-lg, 12px); }
#report-drill #report-drill-results > .list-empty { padding: 32px 16px; color: var(--muted); text-align: center; }
#report-drill .people-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 13px; }
#report-drill .people-pagination #report-drill-count { margin-inline-end: auto; }

/* Saved filters: list rows with apply + remove. */
#report-saved-filters:modal { width: min(520px, calc(100vw - 24px)); }
#report-saved-filters #report-filter-list { display: grid; gap: 0; margin: 0 0 16px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg, 12px); overflow: hidden; list-style: none; }
#report-saved-filters #report-filter-list:empty { display: none; }
#report-saved-filters #report-filter-list > li { display: flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; padding: 6px 8px; border: 0; border-bottom: 1px solid var(--soft-line); border-radius: 0; background: none; color: var(--muted); font-size: 13px; }
#report-saved-filters #report-filter-list > li:last-child { border-bottom: 0; }
#report-saved-filters #report-filter-list > li:not(.report-filter-preset) { justify-content: center; min-height: 64px; }
#report-saved-filters .report-filter-preset [data-apply-report-filter] { flex: 1; justify-content: flex-start; border-color: transparent; background: transparent; color: var(--ink); font-weight: 500; }
#report-saved-filters .report-filter-preset [data-apply-report-filter]:hover { background: var(--hover); }
#report-saved-filters .report-filter-preset [data-delete-report-filter] { border-color: transparent; background: transparent; color: var(--danger-ink); }
#report-saved-filters .report-filter-preset [data-delete-report-filter]:hover { background: var(--danger-soft); }
#report-saved-filters #report-save-filter { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; margin: 0; padding-top: 16px; border-top: 1px solid var(--line); }
#report-saved-filters #report-save-filter > .button.primary { justify-self: stretch; }

/* New rate metric. */
#report-metric-dialog:modal { width: min(480px, calc(100vw - 24px)); }

/* Report archive (modal or inline in Settings). */
#report-archive-dialog [data-archive-status]:empty { display: none; }
#report-archive-dialog [data-archive-status] { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
#report-archive-dialog .desk-form { display: grid; gap: 14px; }
#report-archive-dialog [data-archive-run] { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
#report-archive-dialog [data-archive-run] > .button { grid-column: 1 / -1; }
#report-archive-dialog [data-archive-note-field] { display: flex; align-items: center; gap: 8px; font-weight: 400; }
#report-archive-dialog [data-archive-history] .object-definitions { margin: 16px 0 0; }
.i-rp-archive { position: relative; background: none; mask: none; }
.i-rp-archive::before { content: ''; position: absolute; inset: 2px 1.5px auto; height: 5px; border: 1.6px solid currentColor; border-radius: 2px; }
.i-rp-archive::after { content: ''; position: absolute; inset: 7.5px 3px 2px; border: 1.6px solid currentColor; border-top: 0; border-radius: 0 0 2px 2px; }
#report-archive-dialog .report-archive-empty { max-width: 440px; padding: 32px 16px; }
#report-archive-dialog .report-archive-empty p { max-width: 380px; }
#report-archive-dialog .report-archive-empty code { padding: 1px 4px; border-radius: 4px; background: var(--hover); color: var(--ink); font-size: 12px; }
#reports-view .report-chart-total.is-empty .chart-drill-button { color: var(--quiet); }
#report-archive-dialog .report-archive-history-title { margin: 24px 0 8px; color: var(--ink); font-size: 14px; font-weight: 600; }
#report-archive-dialog .report-archive-table { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-lg, 12px); background: var(--surface); }
#report-archive-dialog .report-archive-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
#report-archive-dialog .report-archive-table thead th { height: 36px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--inset); color: var(--muted); font-size: 12px; font-weight: 500; text-align: start; white-space: nowrap; }
#report-archive-dialog .report-archive-table tbody :is(th, td) { height: 44px; padding: 4px 12px; border-bottom: 1px solid var(--soft-line); text-align: start; white-space: nowrap; font-variant-numeric: tabular-nums; }
#report-archive-dialog .report-archive-table tbody tr:last-child > * { border-bottom: 0; }
#report-archive-dialog .report-archive-table tbody th { color: var(--ink); font-weight: 500; }
#report-archive-dialog .report-archive-file { display: inline-block; max-width: 220px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; vertical-align: middle; }
