/* page-typography.css
 * Phase 4 page-type refinement.
 * Target common page families that still show visible font-size drift after
 * global/module normalization: list/detail pages, search/filter bars,
 * summary cards, audit/debug panels, and dashboard-like center pages.
 */

@media screen {
  :root {
    --cp-fs-page-title: clamp(1.32rem, 1.16rem + 0.38vw, 1.58rem);
    --cp-fs-page-subtitle: 0.94rem;
    --cp-fs-page-kpi: clamp(1.35rem, 1.12rem + 0.46vw, 1.78rem);
    --cp-fs-page-h2: clamp(1.08rem, 1.02rem + 0.2vw, 1.18rem);
    --cp-fs-page-h3: 1rem;
    --cp-fs-page-body: 0.96rem;
    --cp-fs-page-small: 0.88rem;
    --cp-fs-page-tiny: 0.82rem;
  }

  /* Common page-family containers */
  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .cart-audit-page,
    .employee-map-page,
    .gbuy-top-tools,
    .gbuy-search-box,
    .ao-detail-box,
    .ao-debug-box,
    .pc-head,
    .nc-head,
    .fb-center-hero,
    .hufa-wrap,
    .receipt-app,
    .dpa-wrap
  ) {
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
  }

  /* Page-level titles */
  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) > :where(h1, .page-title, .module-title, .brand) {
    font-size: var(--cp-fs-page-title) !important;
    line-height: 1.22;
    letter-spacing: 0.01em;
  }

  body :where(
    .pc-head h1,
    .nc-head h1,
    .fb-center-hero h1,
    .ao-detail-title,
    .brand
  ) {
    font-size: var(--cp-fs-page-title) !important;
    line-height: 1.22 !important;
  }

  body :where(
    .subtitle,
    .submuted,
    .status-text,
    .ao-detail-subtitle,
    .ao-import-note,
    .ao-import-meta,
    .pc-help,
    .pc-date-group__meta,
    .pc-group-card__date,
    .pc-group-card__foot,
    .nc-card__sub,
    .nc-note,
    .nc-card__stats,
    .nc-request-item__sub,
    .fbc-mini-note,
    .fbc-list-item__sub,
    .fb-center-hero p
  ) {
    font-size: var(--cp-fs-page-small) !important;
    line-height: 1.65 !important;
  }

  /* Secondary titles / section headings */
  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(h2, .section-title, .list-title, .tool-title, .notes-title, .nc-card h2, .fbc-panel-card__head h2, .pc-date-group__title) {
    font-size: var(--cp-fs-page-h2) !important;
    line-height: 1.35 !important;
  }

  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(h3, .card-title, .block-title, .fbc-selected-card__body h3) {
    font-size: var(--cp-fs-page-h3) !important;
    line-height: 1.4 !important;
  }

  /* Dashboard / KPI numbers */
  body :where(
    .pc-summary-card__num,
    .nc-summary-card__num,
    .fbc-stat-card__num,
    .ao-total-bar-value
  ) {
    font-size: var(--cp-fs-page-kpi) !important;
    line-height: 1.05 !important;
  }

  /* Tables / toolbars / filters */
  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(
    table,
    .table,
    .grid-table,
    .archive-table,
    .list-table,
    .cart-table,
    #expenseTable
  ) {
    font-size: var(--cp-fs-page-body) !important;
    line-height: 1.55;
  }

  body :where(
    .filter-bar,
    .gbuy-top-tools,
    .search-box,
    .toolbar,
    .table-toolbar,
    .pc-head-actions,
    .nc-head-actions,
    .fb-center-hero-actions,
    .ao-range-row,
    .ao-total-bar,
    .field,
    .row,
    .form-row
  ) {
    font-size: var(--cp-fs-page-body) !important;
    line-height: 1.5 !important;
  }

  body :where(
    input,
    select,
    textarea,
    button,
    .btn,
    .tool-btn,
    .pc-btn,
    .nc-btn,
    .fbc-btn,
    .ao-range-btn
  ) {
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
  }

  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(
    input,
    select,
    textarea,
    button,
    .btn,
    .tool-btn,
    .pc-btn,
    .nc-btn,
    .fbc-btn,
    .ao-range-btn
  ) {
    font-size: var(--cp-fs-page-body) !important;
    line-height: 1.45 !important;
  }

  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(
    .badge,
    .ao-badge,
    .nc-badge,
    .pc-date-group__status,
    .status,
    .status-pill,
    .chip,
    .tag,
    .pill
  ) {
    font-size: var(--cp-fs-page-tiny) !important;
    line-height: 1.35 !important;
  }

  body :where(
    .debug-box pre,
    .ao-debug-box pre,
    .debug-panel__pre,
    .sql-preview,
    .log,
    .mono,
    .monospace
  ) {
    font-size: 0.84rem !important;
    line-height: 1.52 !important;
  }

  /* Bring tiny inline values back into a readable range for the page families above. */
  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(div, span, p, td, th, label, a, small, strong, em)[style*='font-size:8px'],
  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(div, span, p, td, th, label, a, small, strong, em)[style*='font-size: 8px'] {
    font-size: 0.78rem !important;
  }

  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(div, span, p, td, th, label, a, small, strong, em)[style*='font-size:9px'],
  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(div, span, p, td, th, label, a, small, strong, em)[style*='font-size: 9px'] {
    font-size: 0.8rem !important;
  }

  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(div, span, p, td, th, label, a, small, strong, em)[style*='font-size:10px'],
  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(div, span, p, td, th, label, a, small, strong, em)[style*='font-size: 10px'] {
    font-size: 0.83rem !important;
  }

  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(div, span, p, td, th, label, a, small, strong, em)[style*='font-size:11px'],
  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(div, span, p, td, th, label, a, small, strong, em)[style*='font-size: 11px'] {
    font-size: 0.86rem !important;
  }

  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(div, span, p, td, th, label, a, small, strong, em)[style*='font-size:12px'],
  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(div, span, p, td, th, label, a, small, strong, em)[style*='font-size: 12px'] {
    font-size: 0.89rem !important;
  }

  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(div, span, p, td, th, label, a, small, strong, em)[style*='font-size:13px'],
  body :where(
    .main-content,
    .sub-container,
    .order-list-container,
    .push-center-page,
    .notice-center-page,
    .fb-center-page,
    .receipt-app,
    .dpa-wrap
  ) :where(div, span, p, td, th, label, a, small, strong, em)[style*='font-size: 13px'] {
    font-size: 0.92rem !important;
  }

  @media (max-width: 768px) {
    :root {
      --cp-fs-page-title: clamp(1.18rem, 1.08rem + 0.24vw, 1.34rem);
      --cp-fs-page-kpi: clamp(1.22rem, 1.08rem + 0.34vw, 1.44rem);
      --cp-fs-page-h2: 1.03rem;
      --cp-fs-page-body: 0.94rem;
      --cp-fs-page-small: 0.86rem;
      --cp-fs-page-tiny: 0.8rem;
    }
  }
}
