/* ============================================================
   Phase 3 — Shared page shell styles (≥1024px)
   ------------------------------------------------------------
   Applies across the operator pages — Jobs, Schedule, Customers,
   Call Center, etc. — to bring them in line with the new design
   tokens (white panels, soft borders, mono numerals, flat CTAs)
   without rewriting each individual template.

   Mobile (≤1023px) keeps existing styling — every selector here
   is gated to ≥1024px.
   ============================================================ */

@media (min-width: 1024px) {

  /* ── Page chrome ────────────────────────────────────────────── */
  .main .page {
    padding: 1rem 1.25rem 2rem;
  }

  /* Eyebrow labels (UPPERCASE micro-text above an h1) duplicated
     the breadcrumb on most pages — hide them and let the topbar
     breadcrumb carry the page-context cue. */
  .main :where(.eyebrow, .page-eyebrow) {
    display: none !important;
  }

  /* Sentence-case any UPPERCASE >12px text inside .main page bodies
     (KPI section labels like "REVENUE BREAKDOWN", "QUICK LINKS"
     etc). Keep micro-labels (≤11px) uppercase via explicit class. */
  .main :where(h1, h2, h3, h4, h5, h6, .section-title, .panel-title) {
    text-transform: none !important;
    letter-spacing: -0.01em !important;
  }

  /* Kill gradient backgrounds on common quick-link / report card
     classes so nothing reads as a teal/orange tile against the
     flat page bg. */
  .main :where(
    .quick-link, .quick-link-card, .quick-link.is-active,
    .report-tile, .breakdown-tile,
    .stat-card, .ud-stat
  ) {
    background-image: none !important;
    background: var(--panel) !important;
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
    color: var(--text) !important;
  }
  .main :where(.quick-link, .quick-link-card) :where(i, span, div) {
    color: inherit !important;
  }

  /* ── Page header (h1 + meta + actions row) ─────────────────── */
  .main .page-header,
  .main .jobs-header,
  .main .customers-header,
  .main .calls-header {
    margin-bottom: 1.25rem;
  }
  .main .page-header h1,
  .main .jobs-header h1,
  .main .customers-header h1,
  .main .calls-header h1 {
    font-family: 'Public Sans', 'Public Sans', sans-serif !important;
    font-size: 24px !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em !important;
    color: var(--text) !important;
    text-transform: none !important;
  }

  /* Sentence-case every UPPERCASE >12px heading inside .page. */
  .main :where(h1, h2, h3, h4) {
    text-transform: none !important;
    letter-spacing: -0.01em;
  }

  /* ── Cards / panels ─────────────────────────────────────────── */
  .main :where(
    .card, .glass-panel, .glass-card,
    .surface, .panel, .data-card,
    .fv-card, .pnl-card
  ) {
    background: var(--panel) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* ── Tables ─────────────────────────────────────────────────── */
  .main :where(table.data-table, table.fv-table, .data-grid table) {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    border-spacing: 0;
    border-collapse: separate;
    overflow: hidden;
    width: 100%;
  }
  .main :where(table.data-table, table.fv-table) thead th,
  .main :where(table.data-table, table.fv-table) th {
    background: transparent !important;
    border-bottom: 1px solid var(--border) !important;
    color: var(--text-muted) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
    text-transform: uppercase !important;   /* micro-label rule */
    padding: 12px 16px !important;
    text-align: left;
  }
  .main :where(table.data-table, table.fv-table) tbody td,
  .main :where(table.data-table, table.fv-table) td {
    padding: 14px 16px !important;
    border-top: 1px solid var(--border) !important;
    color: var(--text) !important;
    font-size: 14px !important;
    vertical-align: middle;
  }
  .main :where(table.data-table, table.fv-table) tbody tr:hover {
    background: var(--panel-soft);
  }

  /* Numeric / ID / date cells get the mono treatment. Marking a
     class on the cell is the canonical path; this fallback also
     monos cells whose first child is a `<code>` or `.mono`. */
  .main .page td.mono,
  .main .page td > .mono,
  .main .page td > code {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
  }

  /* ── Filter tabs / chips / view switchers ──────────────────── */
  .main :where(.filter-tabs, .fv-tabs, .tab-row, .view-switcher) {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 1rem;
    padding: 4px;
    background: var(--panel) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
  }
  /* Inline filter tabs (Jobs page) keep the existing inline style:
     individual pills, no shared track. */
  .main :where(.filter-tabs, .fv-tabs, .tab-row) {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    gap: 6px;
  }
  .main :where(.filter-tab, .fv-tab, .view-switcher button) {
    background: transparent !important;
    border: 1px solid transparent !important;
    color: var(--text-muted) !important;
    border-radius: calc(var(--radius-md) - 2px) !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    cursor: pointer;
  }
  .main :where(.filter-tabs, .fv-tabs, .tab-row) :where(.filter-tab, .fv-tab) {
    background: var(--panel) !important;
    border-color: var(--border) !important;
  }
  .main :where(
    .filter-tab.active, .fv-tab.active, .filter-tab.is-active,
    .view-switcher button.active, .view-switcher .active
  ) {
    background: var(--text) !important;
    border-color: var(--text) !important;
    color: white !important;
  }
  .main :where(.filter-tab .count, .fv-tab .count) {
    font-family: var(--font-mono);
    font-size: 11px;
    margin-left: 6px;
    opacity: 0.7;
  }

  /* ── Settings tab nav (.stabs) — match the dashboard pill style.
         The legacy CSS used colour-coded variants (teal Portal,
         purple VIO AI, red Error Log) on a dark theme; on the new
         light shell those reads as inconsistent. Flatten to the
         shared filter-pill look. ───────────────────────────────── */
  .main .stabs {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-bottom: 1.25rem !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
  }
  .main :where(.stab) {
    background: var(--panel) !important;
    background-image: none !important;
    border: 1px solid var(--border) !important;
    color: var(--text-muted) !important;
    border-radius: var(--radius-md) !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    box-shadow: none !important;
  }
  .main :where(.stab:hover) {
    background: var(--panel-soft) !important;
    border-color: var(--border-strong) !important;
    color: var(--text) !important;
  }
  .main :where(.stab.active, .stab.is-active) {
    background: var(--text) !important;
    border-color: var(--text) !important;
    color: white !important;
  }
  .main :where(.stab i) {
    color: inherit !important;
    font-size: 13px !important;
  }
  /* Force the colour-coded variants (.portal-tab, .vio-tab,
     .error-tab, etc.) to use the shared neutral pill. */
  .main :where(
    .stab.portal-tab, .stab.vio-tab, .stab.error-tab,
    .stab.danger-tab, .stab.warn-tab
  ) {
    background: var(--panel) !important;
    border-color: var(--border) !important;
    color: var(--text-muted) !important;
  }
  .main :where(
    .stab.portal-tab.active, .stab.vio-tab.active, .stab.error-tab.active,
    .stab.danger-tab.active, .stab.warn-tab.active,
    .stab.portal-tab:hover, .stab.vio-tab:hover, .stab.error-tab:hover
  ) {
    background: var(--text) !important;
    border-color: var(--text) !important;
    color: white !important;
  }

  /* ── Status pills ───────────────────────────────────────────── */
  .main :where(.status-pill, .fv-status, .ud-status-pill) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px !important;
    border-radius: var(--radius-pill) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    background: var(--panel-soft);
    color: var(--text-muted);
  }
  .main :where(.status-pill.s-pending, .status-pill.is-pending, .ud-status-pill.s-pending) {
    background: rgba(245, 158, 11, 0.12);
    color: rgb(180, 83, 9);
  }
  .main :where(.status-pill.s-scheduled, .status-pill.is-scheduled) {
    background: rgba(59, 130, 246, 0.12);
    color: rgb(29, 78, 216);
  }
  .main :where(.status-pill.s-progress, .status-pill.is-en-route, .ud-status-pill.s-progress) {
    background: rgba(13, 115, 119, 0.12);
    color: var(--brand);
  }
  .main :where(.status-pill.s-done, .status-pill.is-completed, .ud-status-pill.s-done) {
    background: rgba(34, 197, 94, 0.12);
    color: rgb(21, 128, 61);
  }
  .main :where(.status-pill.s-cancel, .status-pill.is-cancelled, .ud-status-pill.s-cancel) {
    background: var(--panel-soft);
    color: var(--text-muted);
  }
  .main :where(.status-pill.s-acceptance, .status-pill.is-acceptance) {
    background: rgba(245, 158, 11, 0.12);
    color: rgb(180, 83, 9);
  }

  /* ── Primary CTAs (flat black per design directive) ─────────── */
  .main :where(
    .btn-brand, .btn-primary, .btn-new,
    button.btn-brand, a.btn-brand
  ) {
    background: var(--text) !important;
    color: white !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--text) !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    box-shadow: none !important;
    background-image: none !important;
  }
  .main :where(.btn-brand:hover, .btn-primary:hover, .btn-new:hover) {
    filter: brightness(1.18);
    opacity: 1 !important;
  }

  /* Empty-state CTA in the inner card — keep it inline-sized so it
     doesn't render as a 300×80 big black slab. */
  .main :where(.empty-state, .fv-empty) :where(.btn-brand, .btn-primary, .btn-new) {
    display: inline-flex !important;
    width: auto !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 8px 14px !important;
    height: auto !important;
    font-size: 13px !important;
  }
  .main :where(.empty-state, .fv-empty) :where(.btn-brand, .btn-primary, .btn-new) i {
    font-size: 13px !important;
    line-height: 1 !important;
  }

  /* ── Secondary CTAs (outline / ghost) ───────────────────────── */
  .main :where(.btn-ghost, button.btn-ghost, a.btn-ghost) {
    background: var(--panel) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    box-shadow: none !important;
    background-image: none !important;
  }
  .main :where(.btn-ghost:hover) {
    background: var(--panel-soft) !important;
    border-color: var(--border-strong) !important;
  }

  /* ── Mono helpers, scoped to .page so they work even without
         per-cell class wrappers in legacy templates ─────────── */
  .main :where(.id-cell, .when-cell, .amount-cell, .phone-cell, .date-cell) {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
  }
}
