.metalex-report { display: grid; gap: var(--space-md); min-width: 0; color: var(--color-text); }
.metalex-report *, .metalex-report *::before, .metalex-report *::after { box-sizing: border-box; min-width: 0; }
.metalex-report :is(h1, h2, h3, p, dl, dt, dd) { margin: 0; }
.metalex-report h1 { font-size: var(--text-2xl); }
.metalex-report h2 { font-size: var(--text-lg); }
.metalex-report h3 { font-size: var(--text-sm); }
.metalex-report :is(p, strong, small) { overflow-wrap: anywhere; }
.mr-muted { color: var(--color-text-muted); font-size: var(--text-sm); }
.mr-context { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-md); align-items: end; padding: var(--space-sm) var(--space-md); }
.mr-context label, .mr-traffic-filter { display: grid; gap: var(--space-xs); color: var(--color-text-subtle); font-size: var(--text-xs); font-weight: 600; }
.mr-context select, .mr-traffic-filters select { width: 100%; min-height: var(--control-height); padding: var(--space-xs) var(--space-sm); border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); background: var(--surface-card-item); color: var(--color-text); font: inherit; font-size: var(--text-md); font-weight: 400; }
.mr-context .custom-select, .mr-context .custom-select-trigger { width: 100%; }
.mr-refresh { width: var(--control-height); height: var(--control-height); min-width: var(--control-height); display: grid; place-items: center; padding: 0; }
.mr-refresh .ui-icon { width: var(--space-md); height: var(--space-md); }
.metalex-report :is(button, input, select, a):focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.metalex-report > .empty-state { margin: 0; }
.mr-report-actions { display: flex !important; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-xs) !important; }
.mr-report-actions button { white-space: nowrap; }
.mr-print-meta, .mr-print-table { display: none; }
.mr-content { display: grid; gap: var(--space-md); }
.mr-notice { grid-column: 1 / -1; color: var(--color-text-muted); font-size: var(--text-sm); }
.metalex-report .metalex-panel { min-width: 0; }
.metalex-report .metalex-panel-heading { align-items: center; }
.metalex-report .metalex-panel-heading > div { display: grid; gap: var(--space-xxs); }
.filter-bar.mr-followup-filter { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "summary search"; }
.mr-followup-summary { grid-area: summary; display: flex; align-items: center; gap: var(--space-xs); min-height: var(--control-height); padding: var(--space-xs) var(--space-sm); border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); background: var(--surface-card-item); }
.mr-followup-summary h2 { font-size: var(--text-md); font-weight: 400; }
.mr-followup-summary .count-pill { flex-shrink: 0; font-weight: 400; }
.mr-followup-filter .search-box.wide { grid-area: search; width: 100%; min-width: 0; }
.mr-panel-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); background: var(--color-status-quoted-bg); color: var(--surface-card-accent); }
.mr-panel-icon .ui-icon { width: var(--space-md); height: var(--space-md); }
.mr-followup-table table { min-width: 640px; }
.mr-followup-table th:first-child { width: 30%; }
.mr-followup-table th:last-child { width: 18%; }
.mr-followup-table tbody tr, .mr-table-wrap tbody tr { cursor: default; }
.mr-customer, .mr-cell-detail, .mr-contact { display: grid; gap: var(--space-xxs); }
.mr-customer strong { font-size: var(--text-md); }
.mr-contact, .mr-cell-detail { font-size: var(--text-sm); }
.mr-contact { color: var(--color-text-muted); }
.mr-contact a { width: fit-content; color: var(--surface-card-accent); text-decoration: none; overflow-wrap: anywhere; }
.mr-contact a:hover { text-decoration: underline; }
.mr-cell-detail small { color: var(--color-text-muted); font-size: var(--text-xs); }
.mr-status { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: var(--space-xxs) var(--space-xs); border: 1px solid var(--color-border); border-radius: var(--radius-pill); background: var(--surface-card-item); color: var(--color-text-muted); font-size: var(--text-xs); white-space: nowrap; }
.mr-status.is-converted { border-color: var(--color-border-strong); background: var(--color-status-quoted-bg); color: var(--surface-card-accent); }
.mr-analysis { display: flex; flex-wrap: wrap; gap: var(--space-md); align-items: stretch; }
.mr-scorecard { flex: 1.2 1 560px; }
.mr-funnel { flex: 1 1 300px; }
.mr-scorecard, .mr-funnel { display: flex; flex-direction: column; }
.metalex-report .mr-scorecard > .mr-table-wrap { display: flex; flex-direction: column; flex: 1; }
.metalex-report .mr-scorecard .table-pagination, .metalex-report .mr-funnel-attributions { margin-top: auto; }
.mr-table-wrap table { min-width: 520px; font-variant-numeric: tabular-nums; }
.mr-table-wrap th { white-space: normal; overflow-wrap: anywhere; }
.mr-table-wrap th:first-child { width: 30%; }
.mr-table-wrap th:not(:first-child), .mr-table-wrap td:not(:first-child) { text-align: end; }
.mr-table-wrap th:not(:first-child) .table-sort-button { justify-content: flex-end; }
.mr-funnel-list { display: grid; gap: var(--space-md); padding: var(--space-md); margin: 0; list-style: none; }
.mr-funnel-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-xs); align-items: center; font-size: var(--text-sm); }
.mr-funnel-list strong { font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.mr-bar { grid-column: 1 / -1; margin-top: 0; }
.mr-traffic-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); padding: var(--space-md); }
.mr-traffic-filters > :only-child { grid-column: 1 / -1; }
.mr-traffic-filters .custom-select, .mr-traffic-filters .custom-select-trigger { width: 100%; }
.mr-traffic-body { display: grid; gap: var(--space-md); padding: 0 var(--space-md) var(--space-md); }
.mr-hourly { overflow-x: auto; padding-block: var(--space-sm) var(--space-md); }
.mr-day-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); }
.mr-day-summary .metric-card { display: grid; align-content: center; gap: var(--space-xs); }
.mr-day-summary dt { color: var(--color-text-subtle); font-size: var(--text-sm); }
.mr-hourly-heading { display: flex; justify-content: space-between; gap: var(--space-sm); }
.mr-hourly-heading span { color: var(--color-text-muted); font-size: var(--text-xs); }
.mr-hour-bars { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: var(--space-xxs); min-width: 550px; height: 120px; align-items: end; border-bottom: 1px solid var(--color-border); }
.mr-hour { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; border: 0; padding: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.mr-hour-tooltip { display: none; position: fixed; inset: auto; margin: 0; width: max-content; max-width: calc(100vw - 16px); padding: var(--space-xs) var(--space-sm); border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); background: var(--color-surface-2); color: var(--color-text); box-shadow: var(--shadow-surface); font-size: var(--text-xs); text-align: start; pointer-events: none; }
.mr-hour-tooltip strong { color: var(--surface-card-accent); }
.mr-hour-tooltip:popover-open { display: grid; gap: var(--space-xxs); }
.mr-hour-tooltip::backdrop { background: transparent; pointer-events: none; }
.mr-hour-bar { display: block; width: 100%; max-width: 22px; min-height: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--surface-card-accent); }
.mr-hour small { min-height: 16px; color: var(--color-text-muted); font-size: var(--text-xs); }
.mr-attributions { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-sm); font-size: var(--text-xs); text-align: start; }
.mr-attributions > div { display: flex; flex-wrap: wrap; gap: var(--space-xxs); }
.mr-attributions dt { color: var(--color-text-muted); }
.mr-attributions dd { font-variant-numeric: tabular-nums; }
.mr-attributed-person + .mr-attributed-person { margin-top: var(--space-xs); }
.mr-funnel-attributions { display: grid; gap: var(--space-xs); padding: var(--space-md); border-top: 1px solid var(--color-border); }
.metalex-report .metalex-panel > .empty-state { margin: var(--space-md); }
@media (pointer: coarse) {
  .mr-hour-bars { grid-template-columns: repeat(24, minmax(44px, 1fr)); min-width: calc(24 * 44px + 23 * var(--space-xxs)); }
}
@media (max-width: 820px) {
  .mr-report-actions { width: 100%; justify-content: stretch; }
  .mr-report-actions button { flex: 1 1 150px; }
  .filter-bar.mr-followup-filter { grid-template-columns: minmax(0, 1fr); grid-template-areas: "summary" "search"; }
  .mr-followup-summary { justify-content: space-between; }
  .mr-contact a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; max-width: 100%; }
  .mr-followup-table table, .mr-table-wrap table { min-width: 0; }
  .mr-followup-table td[data-column="customer"], .mr-table-wrap td[data-column="name"] { grid-template-columns: minmax(0, 1fr); }
  .mr-table-wrap td[data-column="name"]::before { display: none; }
  .mr-table-wrap td:not(:first-child) { text-align: start; }
  .mr-traffic-filters { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 460px) {
  .mr-context { gap: var(--space-sm); }
}
@media print {
  @page metalex-report { size: A4 landscape; margin: 10mm; }
  body:has(#metalex-reportView.active .metalex-report) { background: var(--print-surface) !important; color-scheme: light; }
  body:has(#metalex-reportView.active .metalex-report)::before, body:has(#metalex-reportView.active .metalex-report)::after,
  body:has(#metalex-reportView.active .metalex-report) :is(.atlas-circuit-canvas, .atlas-topbar, #primaryDock, .web-status-stack, .page-refresh-loading) { display: none !important; }
  body:has(#metalex-reportView.active .metalex-report) .shell { min-height: 0 !important; margin: 0 !important; page: metalex-report; }
  body[data-shell="flow-atlas"]:has(#metalex-reportView.active .metalex-report) .content { width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0 !important; }
  .metalex-report {
    --color-text: var(--print-text);
    --color-text-muted: var(--print-text-muted);
    --color-text-subtle: var(--print-text-subtle);
    --color-border: var(--print-border);
    --color-border-strong: var(--print-border-strong);
    --color-surface-2: var(--print-surface);
    --surface-card-item: var(--print-surface);
    --table-row-surface: var(--print-surface);
    --surface-card-accent: var(--print-accent);
    --color-status-quoted-bg: var(--print-accent-bg);
    --workload-track: var(--print-border);
    --workload-progress: var(--print-accent);
    --color-primary: var(--print-accent);
    gap: 5mm;
    color: var(--print-text);
    color-scheme: light;
    page: metalex-report;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .metalex-report .view-intro { margin: 0; align-items: start; }
  .metalex-report .view-intro h1 { font-size: 20pt; }
  .metalex-report .view-intro > div:first-child { gap: 1mm; }
  .mr-print-meta { display: flex; flex-wrap: wrap; gap: 1mm 4mm; color: var(--print-text-muted); font-size: 9pt; }
  .mr-report-actions, .mr-context, .mr-followup-filter .search-box, [data-mr-screen-table], .mr-hour-details, .mr-panel-icon, .mr-hour-tooltip { display: none !important; }
  .mr-content { gap: 5mm; }
  .mr-analysis { display: grid; grid-template-columns: minmax(0, 2fr) minmax(55mm, 1fr); gap: 5mm; align-items: stretch; }
  .metalex-report .metalex-panel { border: 1px solid var(--print-border-strong); background: var(--print-surface); box-shadow: none; }
  .metalex-report :is(.mr-funnel, .mr-traffic) { break-inside: avoid; }
  .mr-followup-filter { padding: 3mm; }
  .metalex-report .metalex-panel-heading { padding: 3mm; }
  .mr-print-table { display: block; }
  .mr-print-table table { width: 100%; border-collapse: collapse; font-size: 8pt; }
  .mr-print-table thead { display: table-header-group; }
  .mr-print-table tr { break-inside: avoid; }
  .mr-print-table :is(th, td) { padding: 2mm; border-top: 1px solid var(--print-border); text-align: start; vertical-align: top; }
  .mr-print-table th:not(:first-child), .mr-print-table td:not(:first-child) { text-align: end; }
  .mr-print-table .mr-attributions { gap: 1mm 3mm; }
  .mr-funnel-list { gap: 3mm; padding: 3mm; }
  .mr-funnel-attributions { padding: 3mm; }
  .mr-traffic-filters { padding: 3mm; }
  .mr-traffic-body { gap: 3mm; padding: 0 3mm 3mm; }
  .mr-day-summary .metric-card { min-height: 0; padding: 3mm; border: 1px solid var(--print-border); background: var(--print-surface); box-shadow: none; }
  .mr-hourly { overflow: visible; padding-block: 2mm; }
  .mr-hour-bars { min-width: 0; height: 32mm; }
  .mr-hour { color: var(--print-text); }
}
