@layer features {
  .reports-page { display:grid; gap:var(--cx-space-5); }
  .reports-tabs {
    display:flex; align-items:center; gap:.65rem; overflow:auto; padding:.65rem;
    border:1px solid var(--cx-border); border-radius:var(--cx-radius-xl); background:var(--cx-panel-bg); box-shadow:var(--cx-shadow-soft);
  }
  .reports-tab {
    border:1px solid transparent; border-radius:999px; background:transparent; color:var(--cx-muted); padding:.72rem 1rem;
    cursor:pointer; font-weight:950; white-space:nowrap; transition:background var(--cx-transition), color var(--cx-transition), border-color var(--cx-transition), transform var(--cx-transition);
  }
  .reports-tab:hover { color:var(--cx-text); background:var(--cx-sem-neutral-soft); }
  .reports-tab.is-active { color:var(--cx-brand-strong); background:var(--cx-brand-soft); border-color:color-mix(in srgb, var(--cx-brand-accent) 25%, var(--cx-border)); box-shadow:inset 0 -2px 0 var(--cx-brand-accent); }
  .reports-insights-card .cx-card-body { padding:var(--cx-space-4); }
  .reports-alert-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); gap:var(--cx-space-4); }
  .reports-alert {
    display:flex; justify-content:space-between; gap:var(--cx-space-3); min-height:118px; padding:var(--cx-space-4);
    border:1px solid var(--cx-border); border-radius:var(--cx-radius-lg); background:var(--cx-surface); box-shadow:var(--cx-shadow-soft);
  }
  .reports-alert h3 { margin:.55rem 0 .3rem; font-size:1rem; color:var(--cx-text); }
  .reports-alert p { margin:0; color:var(--cx-muted); line-height:1.7; font-weight:750; }
  .reports-alert strong { align-self:flex-start; color:var(--cx-text); font-size:1.05rem; }
  .reports-alert[data-severity="danger"] { border-color:color-mix(in srgb, var(--cx-sem-loss) 28%, var(--cx-border)); background:var(--cx-sem-loss-soft); }
  .reports-alert[data-severity="warning"] { border-color:color-mix(in srgb, var(--cx-sem-cost) 28%, var(--cx-border)); background:var(--cx-sem-cost-soft); }
  .reports-alert[data-severity="ok"] { border-color:color-mix(in srgb, var(--cx-sem-profit) 24%, var(--cx-border)); background:var(--cx-sem-profit-soft); }
  .reports-detail-modal pre { max-height:62vh; overflow:auto; direction:ltr; text-align:left; white-space:pre-wrap; }
  @media (max-width: 760px) {
    .reports-tabs { padding:.5rem; gap:.45rem; }
    .reports-tab { padding:.62rem .78rem; font-size:.9rem; }
    .reports-alert { min-height:unset; flex-direction:column; }
  }
}

@layer features {
  .reports-metric-grid .reports-metric-card { position:relative; }
  .reports-metric-link {
    border:0; background:transparent; color:inherit; font:inherit; font-weight:1000; cursor:pointer;
    padding:0; border-radius:.7rem; text-align:inherit; line-height:1.2; text-decoration:none;
  }
  .reports-metric-link:hover,
  .reports-metric-link:focus-visible { color:var(--cx-brand-strong); outline:2px solid color-mix(in srgb, var(--cx-brand-accent) 30%, transparent); outline-offset:4px; }
  .reports-decision-grid { grid-template-columns:repeat(auto-fit, minmax(300px, 1fr)); }
  .reports-decision { align-items:stretch; min-height:190px; }
  .reports-decision-main { display:grid; gap:.45rem; }
  .reports-decision-main p { margin:0; }
  .reports-decision-main b { color:var(--cx-text); }
  .reports-decision-side { display:flex; flex-direction:column; align-items:flex-end; justify-content:space-between; gap:var(--cx-space-3); min-width:110px; }
  .reports-decision-side strong { font-size:1.25rem; }
  .reports-detail-modal .cx-modal-body { padding:0; }
  .reports-detail-layout { display:grid; gap:var(--cx-space-4); padding:var(--cx-space-5); }
  .reports-detail-layout .cx-table-wrap { max-height:min(54vh, 560px); overflow:auto; }
  .reports-detail-layout .cx-table thead th { position:sticky; top:0; z-index:1; }
  .reports-executive-card .cx-card-body { padding:var(--cx-space-4); }
  .reports-page .cx-table td .reports-metric-link { width:100%; text-align:inherit; }
  .reports-page .cx-table td .reports-metric-link::after { content:' ↗'; font-size:.78em; opacity:.55; }
  @media (max-width: 760px) {
    .reports-decision { min-height:unset; }
    .reports-decision-side { align-items:flex-start; }
    .reports-detail-layout { padding:var(--cx-space-3); }
  }
}

/* phase35ap css load hotfix */

@layer features {
  .reports-page .reports-tabs {
    display:flex; align-items:center; gap:.65rem; overflow:auto; padding:.65rem;
    border:1px solid var(--cx-border); border-radius:var(--cx-radius-xl);
    background:var(--cx-panel-bg); box-shadow:var(--cx-shadow-soft);
  }
  .reports-page .reports-tab,
  .reports-page .reports-metric-link {
    appearance:none; -webkit-appearance:none; border:0; background:transparent;
    box-shadow:none; margin:0; font-family:inherit; color:inherit;
  }
  .reports-page .reports-tab {
    border:1px solid transparent; border-radius:999px; color:var(--cx-muted);
    padding:.72rem 1rem; cursor:pointer; font-weight:950; white-space:nowrap;
  }
  .reports-page .reports-tab:hover { color:var(--cx-text); background:var(--cx-sem-neutral-soft); }
  .reports-page .reports-tab.is-active {
    color:var(--cx-brand-strong); background:var(--cx-brand-soft);
    border-color:color-mix(in srgb, var(--cx-brand-accent) 25%, var(--cx-border));
    box-shadow:inset 0 -2px 0 var(--cx-brand-accent);
  }
  .reports-page .reports-metric-link {
    display:inline; width:auto; min-width:0; min-height:0; padding:0;
    font-size:inherit; font-weight:inherit; line-height:inherit; text-align:inherit;
    cursor:pointer; border-radius:.55rem; text-decoration:none;
  }
  .reports-page .cx-kpi-value .reports-metric-link {
    font-size:inherit; font-weight:inherit; color:inherit;
  }
  .reports-page .reports-metric-link:hover,
  .reports-page .reports-metric-link:focus-visible {
    color:var(--cx-brand-strong); outline:2px solid color-mix(in srgb, var(--cx-brand-accent) 28%, transparent); outline-offset:3px;
  }
}

/* phase40a Cost Control Center inside reports */
@layer features {
  .cost-control-page { display: grid; gap: var(--cx-space-4); }
  .cost-control-page .cx-page-header { padding: var(--cx-space-4); }
  .cost-control-page .cx-page-header h1 { font-size: clamp(1.35rem, 2.35vw, 2rem); }
  .cost-source-strip .cx-card-body { padding: var(--cx-space-3); flex-wrap: wrap; }
  .cost-control-kpis { gap: var(--cx-space-3); }
  .cost-control-kpis .cx-kpi { transition: transform var(--cx-transition), box-shadow var(--cx-transition), border-color var(--cx-transition); }
  .cost-control-kpis .cx-kpi:hover,
  .cost-control-kpis .cx-kpi:focus-visible { transform: translateY(-1px); box-shadow: var(--cx-shadow-card); outline: 2px solid color-mix(in srgb, var(--cx-brand-accent) 28%, transparent); outline-offset: 2px; }
  .cost-control-tabs { padding: .45rem; gap: .45rem; }
  .cost-control-tabs .reports-tab { padding: .55rem .78rem; font-size: .86rem; }
  .cost-control-page .cx-table tbody tr[data-clickable="true"] { cursor: pointer; }
}

/* phase40a3 Cost Control card details use the global modal system, not custom drawers. */
@layer features {
  .cost-control-detail-modal { width: min(1100px, 100%); }
  .cost-control-detail-modal .cx-modal-body { padding: 0; overflow: hidden; }
  .cost-detail-modal-layout {
    display: grid;
    gap: var(--cx-space-4);
    padding: var(--cx-space-5);
    max-height: calc(88vh - 92px);
    overflow: auto;
  }
  .cost-detail-hero .cx-card-body { padding: var(--cx-space-4); }
  .cost-detail-hero h3 { margin: 0 0 .35rem; font-size: 1.05rem; color: var(--cx-text); }
  .cost-detail-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--cx-space-3); }
  .cost-detail-chip .cx-card-body { padding: var(--cx-space-3); display: grid; gap: .25rem; }
  .cost-detail-chip strong { color: var(--cx-text); font-size: 1rem; overflow-wrap: anywhere; }
  .cost-detail-table-card { min-width: 0; overflow: hidden; }
  .cost-detail-table-card > .cx-card-body { padding: 0; }
  .cost-detail-table-card .cx-table-wrap { max-height: 54vh; overflow: auto; }
  .cost-detail-table-card .cx-table thead th { position: sticky; top: 0; z-index: 2; }
  .cost-control-detail-modal .cx-table { font-size: .88rem; }
  .cost-control-detail-modal .cx-table th,
  .cost-control-detail-modal .cx-table td { white-space: nowrap; }
  @media (max-width: 720px) {
    .cost-detail-modal-layout { padding: var(--cx-space-3); max-height: calc(100vh - 84px); }
    .cost-detail-summary { grid-template-columns: 1fr; }
    .cost-detail-table-card .cx-table-wrap { max-height: 48vh; }
  }
}

/* phase42 financial centers formula + insight UI polish */
@layer features {
  .financial-center-page .cx-kpi,
  .cost-control-page .cx-kpi { cursor:pointer; }
  .financial-center-page .cx-kpi:focus-visible,
  .cost-control-page .cx-kpi:focus-visible { outline:3px solid color-mix(in srgb, var(--cx-brand-accent) 34%, transparent); outline-offset:3px; }
  .financial-center-detail-modal .cx-table-wrap,
  .cost-control-detail-modal .cx-table-wrap { max-height:min(54vh, 560px); overflow:auto; }
  .financial-center-detail-modal .cx-table th,
  .cost-control-detail-modal .cx-table th { top:0; z-index:2; }
  .financial-center-detail-modal .cx-table td,
  .cost-control-detail-modal .cx-table td { vertical-align:middle; }
  .financial-center-page .cx-table tbody tr[data-row-semantic="danger"] { box-shadow:inset 4px 0 0 color-mix(in srgb, var(--cx-sem-loss) 65%, transparent); }
  .financial-center-page .cx-table tbody tr[data-row-semantic="profit"] { box-shadow:inset 4px 0 0 color-mix(in srgb, var(--cx-sem-profit) 55%, transparent); }
  .cost-detail-modal-layout { padding:0; max-height:none; overflow:visible; }
}

/* phase42c financial human labels + summary statement polish */
@layer features {
  .financial-summary-mini {
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
    gap:var(--cx-space-3);
    margin-block-end:var(--cx-space-4);
  }
  .financial-summary-mini article {
    padding:var(--cx-space-4);
    border:1px solid color-mix(in srgb, var(--cx-brand-accent) 18%, var(--cx-border));
    border-radius:var(--cx-radius-xl);
    background:linear-gradient(135deg, rgba(255,255,255,.92), color-mix(in srgb, var(--cx-brand-soft) 34%, rgba(255,255,255,.72)));
    box-shadow:var(--cx-shadow-soft);
    display:grid;
    gap:.35rem;
  }
  .financial-summary-mini span { color:var(--cx-muted); font-weight:900; font-size:.82rem; }
  .financial-summary-mini strong { color:var(--cx-text); font-size:1.12rem; font-weight:1000; }
  .financial-summary-statement-table td[data-col-type="main"] strong { font-size:.95rem; }
  .financial-summary-statement-table td:nth-child(7) { min-width:220px; color:var(--cx-muted); font-weight:850; line-height:1.75; }
  .financial-center-page .cx-smart-table th,
  .financial-center-page .cx-smart-table td { vertical-align:middle; }
  .financial-center-page .cx-smart-table th[data-col-type="money"],
  .financial-center-page .cx-smart-table th[data-col-type="percent"],
  .financial-center-page .cx-smart-table th[data-col-type="number"],
  .financial-center-page .cx-smart-table td[data-col-type="money"],
  .financial-center-page .cx-smart-table td[data-col-type="percent"],
  .financial-center-page .cx-smart-table td[data-col-type="number"] { text-align:start; white-space:nowrap; }
  .financial-center-page .cx-table-total-row td {
    background:linear-gradient(90deg, color-mix(in srgb, var(--cx-brand-soft) 55%, rgba(255,255,255,.85)), rgba(255,255,255,.94));
    border-block-start:2px solid color-mix(in srgb, var(--cx-brand-accent) 28%, var(--cx-border));
    font-weight:1000;
  }
  .financial-center-page .cx-smart-table-wrap { max-width:100%; }
  @media (max-width: 900px) {
    .financial-summary-mini { grid-template-columns:1fr; }
    .financial-center-page .cx-smart-table th,
    .financial-center-page .cx-smart-table td { min-width:110px; }
    .financial-center-page .cx-smart-table td[data-col-type="main"],
    .financial-center-page .cx-smart-table th[data-col-type="main"] { min-width:160px; }
  }
}

/* phase47x_table_page_size_selector_visibility sales performance drilldown */
@layer features {
  .reports-target-strip {
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
    gap:var(--cx-space-3);
    margin-block:var(--cx-space-4);
  }
  .reports-detail-kv {
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(170px, 1fr));
    gap:var(--cx-space-3);
  }
  .reports-detail-kv > div {
    padding:var(--cx-space-3);
    border:1px solid color-mix(in srgb, var(--cx-brand-accent) 16%, var(--cx-border));
    border-radius:var(--cx-radius-lg);
    background:color-mix(in srgb, var(--cx-brand-soft) 24%, rgba(255,255,255,.86));
    display:grid;
    gap:.25rem;
  }
  .reports-detail-kv span { color:var(--cx-muted); font-weight:900; font-size:.78rem; }
  .reports-detail-kv strong { color:var(--cx-text); font-weight:1000; overflow-wrap:anywhere; }
  .reports-order-detail { display:grid; gap:var(--cx-space-4); }
  .reports-timeline-list { display:grid; gap:var(--cx-space-3); }
  .reports-timeline-item {
    border:1px solid var(--cx-border);
    border-radius:var(--cx-radius-lg);
    padding:var(--cx-space-3);
    background:rgba(255,255,255,.78);
    display:grid;
    gap:.25rem;
  }
  .reports-timeline-item strong { color:var(--cx-text); font-weight:1000; }
  .reports-timeline-item span { color:var(--cx-muted); font-size:.82rem; font-weight:850; }
  .reports-timeline-item p { margin:0; color:var(--cx-muted); line-height:1.7; }
  .reports-detail-modal .cx-table-wrap { max-height:min(56vh, 620px); overflow:auto; }
  .reports-detail-modal .cx-table th { position:sticky; top:0; z-index:2; }
}

/* phase47x_table_page_size_selector_visibility sales performance runtime-day + compact card completion */
@layer features {
  .reports-page .reports-metric-grid {
    gap: .65rem;
    margin-block: .65rem;
  }
  .reports-page .reports-metric-card {
    min-height: 82px;
    padding: .7rem .85rem;
    display: grid;
    align-content: center;
    gap: .25rem;
  }
  .reports-page .reports-metric-card .cx-kpi-head {
    margin: 0;
    min-height: auto;
  }
  .reports-page .reports-metric-card .cx-kpi-label {
    font-size: .78rem;
    line-height: 1.25;
  }
  .reports-page .reports-metric-card .cx-kpi-value,
  .reports-page .reports-metric-card .cx-kpi-value .reports-metric-link {
    font-size: clamp(1rem, 1.65vw, 1.55rem);
    line-height: 1.15;
  }
  .reports-page .reports-metric-card .cx-help {
    font-size: .72rem;
    line-height: 1.35;
  }
  .reports-page .reports-metric-card[data-report-drilldown="1"] {
    cursor: pointer;
    transition: transform var(--cx-transition), box-shadow var(--cx-transition), border-color var(--cx-transition), background var(--cx-transition);
  }
  .reports-page .reports-metric-card[data-report-drilldown="1"]:hover,
  .reports-page .reports-metric-card[data-report-drilldown="1"]:focus-visible {
    transform: translateY(-1px);
    box-shadow: var(--cx-shadow-card);
    border-color: color-mix(in srgb, var(--cx-brand-accent) 36%, var(--cx-border));
    outline: 2px solid color-mix(in srgb, var(--cx-brand-accent) 28%, transparent);
    outline-offset: 2px;
  }
  .reports-page .reports-metric-card[data-report-drilldown="1"]::after {
    content: '↗';
    position: absolute;
    inset-inline-end: .65rem;
    inset-block-start: .55rem;
    opacity: .42;
    font-size: .82rem;
    font-weight: 1000;
  }
  .reports-page .cx-table tbody tr[data-report-drilldown-row="1"] {
    cursor: pointer;
  }
  .reports-page .cx-table tbody tr[data-report-drilldown-row="1"]:hover td {
    background: color-mix(in srgb, var(--cx-brand-soft) 38%, transparent);
  }
  .reports-page .cx-table tbody tr[data-report-drilldown-row="1"]:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--cx-brand-accent) 42%, transparent);
    outline-offset: -2px;
  }
  .reports-order-detail .reports-detail-kv strong {
    overflow-wrap: anywhere;
  }
  @media (max-width: 920px) {
    .reports-page .reports-metric-card { min-height: 74px; padding: .62rem .72rem; }
  }
}

/* phase47x_table_page_size_selector_visibility real order drilldown hydration clarity */
@layer features {
  .reports-hydration-warning {
    margin: 0;
    font-weight: 900;
  }
  .reports-order-detail .cx-card-body .cx-no-results {
    min-height: auto;
    padding: var(--cx-space-3);
    text-align: start;
  }
}

/* phase66j reports drilldown click-target contract */
@layer features {
  .reports-drilldown-modal .cx-table tbody tr[data-report-drilldown-row="1"] {
    cursor: pointer;
  }
  .reports-drilldown-modal .cx-table tbody tr[data-report-drilldown-row="1"]:hover td {
    background: color-mix(in srgb, var(--cx-brand-soft) 38%, transparent);
  }
  .reports-drilldown-modal .cx-table tbody tr[data-report-drilldown-row="1"]:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--cx-brand-accent) 42%, transparent);
    outline-offset: -2px;
  }
}

/* phase66i reports performance drilldown modal clean contract: the modal body owns page scroll, each table owns only horizontal/limited vertical table scroll. */
@layer features {
  .reports-drilldown-modal.cx-modal-detail {
    --cx-modal-width: min(1120px, calc(100vw - 2rem));
    --cx-modal-max-height: min(92vh, 920px);
    width: var(--cx-modal-width);
    max-width: calc(100vw - 2rem);
    height: auto;
    max-height: var(--cx-modal-max-height);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .reports-drilldown-modal.cx-modal-detail .cx-modal-header,
  .reports-drilldown-modal.cx-modal-detail .cx-modal-footer {
    flex: 0 0 auto;
  }

  .reports-drilldown-modal.cx-modal-detail .cx-modal-body {
    padding: 0;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable both-edges;
    background: linear-gradient(180deg, rgba(248,250,252,.96), rgba(255,255,255,.98));
  }

  .reports-drilldown-modal .reports-detail-layout {
    padding: var(--cx-space-4);
    display: grid;
    gap: var(--cx-space-3);
    align-content: start;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .reports-drilldown-modal .reports-order-detail,
  .reports-drilldown-modal .reports-order-detail > .reports-metric-grid,
  .reports-drilldown-modal .reports-order-detail > .reports-hydration-warning,
  .reports-drilldown-modal .reports-order-detail > .reports-detail-section {
    min-width: 0;
  }

  .reports-drilldown-modal .reports-detail-section {
    border: 1px solid color-mix(in srgb, var(--cx-brand-accent) 14%, var(--cx-border));
    border-radius: var(--cx-radius-xl);
    background: color-mix(in srgb, var(--cx-panel-bg) 92%, rgba(255,255,255,.92));
    box-shadow: var(--cx-shadow-soft);
    overflow: hidden;
    min-width: 0;
  }

  .reports-drilldown-modal .reports-detail-section-head {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 48px;
    padding: .8rem 1rem;
    border-block-end: 1px solid color-mix(in srgb, var(--cx-brand-accent) 12%, var(--cx-border));
    background: linear-gradient(90deg, color-mix(in srgb, var(--cx-brand-soft) 26%, rgba(255,255,255,.94)), rgba(255,255,255,.92));
  }

  .reports-drilldown-modal .reports-detail-section-head h3 {
    margin: 0;
    color: var(--cx-text);
    font-size: 1rem;
    font-weight: 1000;
    line-height: 1.4;
  }

  .reports-drilldown-modal .reports-detail-section-body {
    padding: var(--cx-space-3);
    min-width: 0;
    overflow: visible;
  }

  .reports-drilldown-modal .reports-detail-section-body > .cx-no-results {
    min-height: auto;
    padding: .85rem 1rem;
    border-radius: var(--cx-radius-lg);
    background: color-mix(in srgb, var(--cx-muted) 6%, transparent);
    text-align: start;
    color: var(--cx-muted);
    font-weight: 850;
  }

  .reports-drilldown-modal .reports-detail-section .cx-table-wrap {
    max-width: 100%;
    max-height: min(44vh, 430px);
    min-height: 0;
    overflow: auto;
    border-radius: var(--cx-radius-lg);
    scrollbar-gutter: stable both-edges;
  }

  .reports-drilldown-modal .reports-detail-section .cx-table {
    min-width: max-content;
  }

  .reports-drilldown-modal .reports-detail-section .cx-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
  }

  .reports-drilldown-modal .reports-detail-kv {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .reports-drilldown-modal .reports-detail-kv strong {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .reports-drilldown-modal .reports-hydration-warning {
    padding: .85rem 1rem;
    border-radius: var(--cx-radius-lg);
  }

  @media (max-width: 760px) {
    .reports-drilldown-modal.cx-modal-detail {
      width: calc(100vw - .75rem);
      max-width: calc(100vw - .75rem);
      max-height: calc(100vh - .75rem);
    }
    .reports-drilldown-modal .reports-detail-layout { padding: var(--cx-space-3); }
    .reports-drilldown-modal .reports-detail-section-body { padding: var(--cx-space-2); }
    .reports-drilldown-modal .reports-detail-kv { grid-template-columns: 1fr; }
    .reports-drilldown-modal .reports-detail-section .cx-table-wrap { max-height: 42vh; }
  }
}

/* Phase 47W: shared table pagination for heavy reports */
.reports-table-pager{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  padding:10px 12px;
  border:1px solid rgba(148,163,184,.22);
  border-top:0;
  border-radius:0 0 14px 14px;
  background:rgba(15,23,42,.025);
  color:var(--cx-muted, #64748b);
  font-size:.86rem;
  direction:rtl;
}
.reports-table-pager.is-small{justify-content:flex-start;border-top:1px solid rgba(148,163,184,.18);border-radius:12px;margin-top:8px;background:transparent;padding:7px 10px;}
.reports-table-pager label{display:inline-flex;align-items:center;gap:8px;white-space:nowrap;}
.reports-table-pager select{min-width:74px;border:1px solid rgba(148,163,184,.35);border-radius:10px;padding:6px 8px;background:var(--cx-card-bg,#fff);color:inherit;}
.reports-pager-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;}
.reports-pager-actions .cx-btn-sm{padding:5px 10px;min-height:30px;font-size:.82rem;}
@media (max-width: 680px){
  .reports-table-pager{align-items:stretch;flex-direction:column;}
  .reports-pager-actions{justify-content:space-between;}
  .reports-pager-actions .cx-btn-sm{flex:1;}
}

/* Phase 47X: visible page-size selector above every heavy report table */
.reports-table-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin:10px 0 8px;
  padding:9px 12px;
  border:1px solid rgba(148,163,184,.24);
  border-radius:14px;
  background:linear-gradient(180deg, rgba(248,250,252,.94), rgba(241,245,249,.78));
  color:var(--cx-text,#0f172a);
  direction:rtl;
}
.reports-page-size-control{
  display:inline-flex;
  align-items:center;
  gap:7px;
  font-weight:800;
  white-space:nowrap;
}
.reports-page-size-control select{
  min-width:78px;
  border:1px solid rgba(37,99,235,.35);
  border-radius:11px;
  padding:7px 10px;
  background:var(--cx-card-bg,#fff);
  color:var(--cx-text,#0f172a);
  font-weight:800;
  cursor:pointer;
}
.reports-page-size-summary{
  color:var(--cx-muted,#64748b);
  font-size:.86rem;
  font-weight:700;
}
.reports-table-pager{margin-top:0;}
@media (max-width:680px){
  .reports-table-toolbar{align-items:stretch;flex-direction:column;}
  .reports-page-size-control{justify-content:space-between;}
  .reports-page-size-control select{flex:0 0 96px;}
}

/* B-Design-Recovery-4.1 — Premium Reports Analytics Tables
   Scope: reports analytics tables only. Visual-only; pagination/data loading remain owned by reports-table-paging.js and API. */
@layer features {
  .reports-page .reports-analytics-table-card {
    --reports-analytics-accent: var(--cx-brand, #6d3df2);
    --reports-analytics-accent-strong: color-mix(in srgb, var(--reports-analytics-accent) 82%, #120b2d);
    --reports-analytics-accent-soft: color-mix(in srgb, var(--reports-analytics-accent) 10%, var(--cx-surface-card, #fff));
    --reports-analytics-head-bg: linear-gradient(180deg,
      color-mix(in srgb, var(--reports-analytics-accent) 92%, #2d1768),
      color-mix(in srgb, var(--reports-analytics-accent) 78%, #160b33));
    --reports-analytics-head-text: #fff;
    --reports-analytics-row-bg: color-mix(in srgb, var(--cx-surface-card, #fff) 98%, var(--reports-analytics-accent));
    --reports-analytics-row-alt: color-mix(in srgb, var(--reports-analytics-accent) 4%, var(--cx-surface-card, #fff));
    --reports-analytics-row-hover: color-mix(in srgb, var(--reports-analytics-accent) 12%, var(--cx-surface-card, #fff));
    --reports-analytics-grid: color-mix(in srgb, var(--reports-analytics-accent) 14%, var(--cx-border-soft, #e7e2f2));
    position: relative;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--reports-analytics-accent) 18%, var(--cx-border-soft, #e7e2f2)) !important;
    border-radius: clamp(18px, 1.5vw, 26px) !important;
    background:
      radial-gradient(circle at 92% 0%, color-mix(in srgb, var(--reports-analytics-accent) 12%, transparent), transparent 38%),
      linear-gradient(180deg, color-mix(in srgb, var(--cx-surface-card, #fff) 96%, var(--reports-analytics-accent-soft)), var(--cx-surface-card, #fff)) !important;
    box-shadow: 0 22px 52px rgba(44, 31, 74, .105) !important;
  }

  .reports-page .reports-analytics-table-card::before {
    content: "";
    position: absolute;
    inset-block-start: 0;
    inset-inline: 0;
    block-size: 3px;
    background: linear-gradient(90deg, transparent, var(--reports-analytics-accent), color-mix(in srgb, var(--reports-analytics-accent) 44%, #34d399), transparent);
    opacity: .95;
    pointer-events: none;
  }

  .reports-page .reports-analytics-table-card > .cx-card-header {
    align-items: center !important;
    gap: 1rem;
    padding: 1rem 1.12rem .86rem !important;
    border-block-end: 1px solid color-mix(in srgb, var(--reports-analytics-accent) 10%, var(--cx-border-soft, #e7e2f2)) !important;
    background: linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.22)) !important;
  }

  .reports-page .reports-analytics-table-card > .cx-card-header h2 {
    display: inline-flex;
    align-items: center;
    gap: .58rem;
    margin: 0;
    color: color-mix(in srgb, var(--cx-text-main, #18112f) 90%, var(--reports-analytics-accent));
    font-size: clamp(1rem, 1.1vw, 1.16rem);
    font-weight: 1000;
    letter-spacing: -.022em;
  }

  .reports-page .reports-analytics-table-card > .cx-card-header h2::before {
    content: "";
    inline-size: .78rem;
    block-size: .78rem;
    border-radius: 999px;
    background: var(--reports-analytics-accent);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--reports-analytics-accent) 13%, transparent);
    flex: 0 0 auto;
  }

  .reports-page .reports-analytics-table-card > .cx-card-header .cx-help {
    margin-block-start: .18rem;
    color: var(--cx-text-soft, var(--cx-muted, #667085));
    font-size: .82rem;
    font-weight: 800;
  }

  .reports-page .reports-table-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-block-size: 2rem;
    padding: .35rem .76rem;
    border: 1px solid color-mix(in srgb, var(--reports-analytics-accent) 22%, var(--cx-border-soft, #e7e2f2));
    border-radius: 999px;
    background: color-mix(in srgb, var(--reports-analytics-accent) 10%, var(--cx-surface-card, #fff));
    color: color-mix(in srgb, var(--reports-analytics-accent) 84%, var(--cx-text-main, #18112f));
    font-size: .78rem;
    font-weight: 1000;
    white-space: nowrap;
  }

  .reports-page .reports-analytics-table-card > .cx-card-body {
    padding: .88rem 1rem 1rem !important;
    background: transparent !important;
  }

  .reports-page .reports-analytics-table-card .reports-table-toolbar-premium {
    position: relative;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-block-size: 2.65rem;
    margin: 0 0 .64rem !important;
    padding: .46rem .58rem .46rem .72rem !important;
    border: 1px solid color-mix(in srgb, var(--reports-analytics-accent) 12%, var(--cx-border-soft, #e7e2f2)) !important;
    border-radius: 999px !important;
    background: color-mix(in srgb, var(--cx-surface-card, #fff) 92%, var(--reports-analytics-accent-soft)) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.75), 0 10px 24px rgba(44,31,74,.055) !important;
  }

  .reports-page .reports-analytics-table-card .reports-page-size-summary {
    color: var(--cx-text-soft, var(--cx-muted, #667085)) !important;
    font-size: .82rem !important;
    font-weight: 900 !important;
  }

  .reports-page .reports-analytics-table-card .reports-page-size-control {
    gap: .44rem;
    color: color-mix(in srgb, var(--cx-text-main, #18112f) 84%, var(--reports-analytics-accent));
    font-size: .82rem;
    font-weight: 1000;
  }

  .reports-page .reports-analytics-table-card .reports-page-size-control select {
    min-inline-size: 74px !important;
    min-block-size: 2.08rem;
    border-radius: 999px !important;
    border-color: color-mix(in srgb, var(--reports-analytics-accent) 26%, var(--cx-border-soft, #e7e2f2)) !important;
    background: var(--cx-surface-card, #fff) !important;
    color: var(--cx-text-main, #18112f) !important;
    font-weight: 1000 !important;
    text-align: center;
  }

  .reports-page .reports-analytics-table-card :where(.cx-table-wrap, .cx-smart-table-wrap) {
    direction: ltr !important;
    border: 1px solid color-mix(in srgb, var(--reports-analytics-accent) 18%, var(--cx-border-soft, #e7e2f2)) !important;
    border-radius: 18px !important;
    background: var(--reports-analytics-row-bg) !important;
    box-shadow: 0 12px 32px rgba(44,31,74,.07) !important;
    overflow: auto !important;
    scrollbar-gutter: stable both-edges;
    overscroll-behavior: contain;
    max-block-size: min(58vh, 620px) !important;
    min-block-size: 0 !important;
  }

  .reports-page .reports-analytics-table-card :where(.cx-table, .cx-smart-table) {
    direction: rtl !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: transparent !important;
    table-layout: auto !important;
  }

  .reports-page .reports-analytics-table-card :where(.cx-table--reports-analytics, .cx-smart-table) thead th,
  .reports-page .reports-analytics-table-card :where(.cx-table, .cx-smart-table) thead th {
    position: sticky !important;
    inset-block-start: 0 !important;
    z-index: 20 !important;
    min-block-size: 46px !important;
    height: 46px !important;
    padding: .68rem .86rem !important;
    background: var(--reports-analytics-head-bg) !important;
    color: var(--reports-analytics-head-text) !important;
    border-block-end: 1px solid color-mix(in srgb, var(--reports-analytics-accent) 38%, rgba(255,255,255,.2)) !important;
    border-inline-end: 1px solid rgba(255,255,255,.14) !important;
    box-shadow: 0 1px 0 rgba(255,255,255,.18), 0 10px 18px rgba(44,31,74,.11) !important;
    font-size: .82rem !important;
    font-weight: 1000 !important;
    line-height: 1.15 !important;
    text-align: center !important;
    text-shadow: 0 1px 0 rgba(0,0,0,.08);
    white-space: nowrap !important;
  }

  .reports-page .reports-analytics-table-card :where(.cx-table, .cx-smart-table) thead th:first-child {
    border-start-start-radius: 16px;
  }

  .reports-page .reports-analytics-table-card :where(.cx-table, .cx-smart-table) thead th:last-child {
    border-start-end-radius: 16px;
  }

  .reports-page .reports-analytics-table-card :where(.cx-table thead th .cx-th-label, .cx-smart-table thead th .cx-th-label) {
    color: inherit !important;
    font-weight: 1000 !important;
  }

  .reports-page .reports-analytics-table-card :where(.cx-table tbody td, .cx-smart-table tbody td) {
    height: 46px !important;
    min-height: 46px !important;
    padding: .62rem .86rem !important;
    background: var(--reports-analytics-row-bg) !important;
    border-block-end: 1px solid var(--reports-analytics-grid) !important;
    border-inline-end: 1px solid color-mix(in srgb, var(--reports-analytics-grid) 66%, transparent) !important;
    color: var(--cx-text-main, #18112f) !important;
    font-size: .86rem !important;
    font-weight: 760;
    line-height: 1.38 !important;
    vertical-align: middle !important;
  }

  .reports-page .reports-analytics-table-card :where(.cx-table tbody tr:nth-child(even) td, .cx-smart-table tbody tr:nth-child(even) td) {
    background: var(--reports-analytics-row-alt) !important;
  }

  .reports-page .reports-analytics-table-card :where(.cx-table tbody tr:hover td, .cx-smart-table tbody tr:hover td) {
    background: var(--reports-analytics-row-hover) !important;
    color: var(--cx-text-main, #18112f) !important;
  }

  .reports-page .reports-analytics-table-card :where(.cx-table tbody tr, .cx-smart-table tbody tr) {
    transition: background-color .12s ease, box-shadow .12s ease;
  }

  .reports-page .reports-analytics-table-card :where(.cx-table tbody tr:hover, .cx-smart-table tbody tr:hover) {
    box-shadow: inset 4px 0 0 var(--reports-analytics-accent) !important;
  }

  .reports-page .reports-analytics-table-card :where(.cx-money, .cx-number, .cx-num, [data-col-type="money"], [data-col-type="number"], [data-col-type="qty"], [data-col-type="percent"]) {
    font-variant-numeric: tabular-nums;
    font-weight: 950 !important;
    letter-spacing: -.012em;
  }

  .reports-page .reports-analytics-table-card :where(.cx-table-empty, .cx-table-error, .cx-table-loading) {
    min-block-size: 150px !important;
    margin: .85rem !important;
    border: 1px dashed color-mix(in srgb, var(--reports-analytics-accent) 24%, var(--cx-border-soft, #e7e2f2)) !important;
    border-radius: 16px !important;
    background: linear-gradient(180deg, color-mix(in srgb, var(--reports-analytics-accent) 9%, var(--cx-surface-card, #fff)), var(--cx-surface-card, #fff)) !important;
    color: var(--cx-text-soft, var(--cx-muted, #667085)) !important;
    font-weight: 950 !important;
  }

  .reports-page .reports-analytics-table-card .reports-table-pager {
    margin: .68rem 0 0 !important;
    padding: .58rem .7rem !important;
    border: 1px solid color-mix(in srgb, var(--reports-analytics-accent) 12%, var(--cx-border-soft, #e7e2f2)) !important;
    border-radius: 16px !important;
    background: color-mix(in srgb, var(--cx-surface-card, #fff) 94%, var(--reports-analytics-accent-soft)) !important;
    box-shadow: none !important;
  }

  .reports-page .reports-analytics-table-card .reports-table-pager.is-small {
    min-block-size: 2.1rem;
    border-style: dashed !important;
    justify-content: center;
    color: var(--cx-text-soft, var(--cx-muted, #667085));
  }

  .reports-page .reports-analytics-table-card .reports-pager-actions {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
  }

  .reports-page .reports-analytics-table-card .reports-pager-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-block-size: 2rem;
    padding: .32rem .68rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--reports-analytics-accent) 12%, var(--cx-surface-card, #fff));
    color: color-mix(in srgb, var(--reports-analytics-accent) 80%, var(--cx-text-main, #18112f));
    font-size: .8rem;
    font-weight: 1000;
  }

  .reports-page .reports-analytics-table-card .reports-pager-actions .cx-btn-sm {
    min-block-size: 2rem;
    border-radius: 999px !important;
    border-color: color-mix(in srgb, var(--reports-analytics-accent) 16%, var(--cx-border-soft, #e7e2f2)) !important;
    background: var(--cx-surface-card, #fff) !important;
    font-weight: 950 !important;
  }

  .reports-page .reports-analytics-table-card .reports-pager-actions .cx-btn-sm:not(:disabled):hover {
    background: var(--reports-analytics-accent) !important;
    border-color: var(--reports-analytics-accent) !important;
    color: #fff !important;
  }

  [data-theme="dark"] .reports-page .reports-analytics-table-card {
    --reports-analytics-row-bg: color-mix(in srgb, var(--cx-surface-card, #171126) 90%, #080512);
    --reports-analytics-row-alt: color-mix(in srgb, var(--reports-analytics-accent) 7%, #100a1f);
    --reports-analytics-row-hover: color-mix(in srgb, var(--reports-analytics-accent) 17%, #100a1f);
    --reports-analytics-grid: color-mix(in srgb, var(--reports-analytics-accent) 18%, rgba(255,255,255,.08));
  }

  @media (max-width: 760px) {
    .reports-page .reports-analytics-table-card > .cx-card-header,
    .reports-page .reports-analytics-table-card .reports-table-toolbar-premium,
    .reports-page .reports-analytics-table-card .reports-table-pager {
      align-items: stretch !important;
      flex-direction: column;
      border-radius: 16px !important;
    }
    .reports-page .reports-analytics-table-card .reports-page-size-control {
      justify-content: space-between;
    }
  }
}


/* B4.7 — Unified Discounts & Offers analysis */
.reports-discounts-smart-filter,.reports-discounts-view-modes,.reports-discounts-summary-footer{border:1px solid color-mix(in srgb,var(--cx-border,#ded8ee) 86%,transparent);border-radius:18px;background:color-mix(in srgb,var(--cx-surface-card,#fff) 94%,var(--cx-accent-soft,#f1ecff));box-shadow:0 12px 32px rgba(24,17,47,.05)}
.reports-discounts-smart-filter{display:grid;grid-template-columns:minmax(220px,1.4fr) repeat(5,minmax(140px,1fr)) auto;gap:.75rem;align-items:end;padding:.85rem;margin:.9rem 0}
.reports-discounts-smart-filter label{display:grid;gap:.35rem;min-width:0;color:var(--cx-muted,#6d6684);font-size:.78rem;font-weight:800}.reports-discounts-smart-filter input,.reports-discounts-smart-filter select{width:100%;min-height:38px;border:1px solid var(--cx-border,#ded8ee);border-radius:12px;background:#fff;color:var(--cx-text,#18112f);padding:.45rem .65rem;font:inherit}.reports-discounts-smart-filter select[multiple]{min-height:78px;overflow:auto}
.reports-discounts-view-modes{display:flex;flex-wrap:wrap;gap:.45rem;padding:.55rem;margin:0 0 .9rem}.reports-discounts-view-modes button{border:1px solid transparent;border-radius:999px;background:transparent;color:var(--cx-muted,#6d6684);padding:.48rem .85rem;font-weight:850;cursor:pointer}.reports-discounts-view-modes button.is-active{background:var(--cx-accent-soft,#f1ecff);border-color:var(--cx-accent,#7c3aed);color:var(--cx-accent-strong,#5b21b6)}
.reports-discounts-summary-footer{display:grid;grid-template-columns:repeat(4,minmax(120px,1fr));gap:.65rem;padding:.8rem;margin:.9rem 0 1.2rem}.reports-discounts-summary-footer div{border:1px solid color-mix(in srgb,var(--cx-border,#ded8ee) 70%,transparent);border-radius:14px;background:#fff;padding:.65rem .75rem}.reports-discounts-summary-footer span{display:block;color:var(--cx-muted,#6d6684);font-size:.75rem;font-weight:800}.reports-discounts-summary-footer strong{display:block;margin-top:.2rem;color:var(--cx-text-strong,#18112f);font-size:.95rem;font-weight:950}
@media(max-width:1100px){.reports-discounts-smart-filter{grid-template-columns:repeat(2,minmax(0,1fr))}.reports-discounts-summary-footer{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:700px){.reports-discounts-smart-filter,.reports-discounts-summary-footer{grid-template-columns:1fr}}
