  /* ─────────────────────────────────────────────────────────────
     Responsive reflow. Placed after overrides.css so these win.
     Side panels auto-collapse via JS (matchMedia); these rules
     reflow the inner multi-column grids as the content area shrinks.
     ───────────────────────────────────────────────────────────── */

  /* ~1200px: content area is tight once the dock has collapsed.
     Stack the side-by-side detail/chart panels and thin the dense rows. */
  @media (max-width: 1200px) {
    .portfolio-kpis { grid-template-columns: repeat(3, 1fr); }
    .dual { grid-template-columns: 1fr; }
    .dual .left { border-right: 0; }
    .axis-panel { grid-template-columns: 1fr; }
    .axis-side { border-top: 1px solid var(--line); }
    .detail-scoreboard { grid-template-columns: repeat(2, 1fr); }
    .uw-pick-grid,
    .watchlist-grid,
    .flow-stepper,
    .data-form { grid-template-columns: 1fr; }
    .task-sequence { grid-template-columns: repeat(2, 1fr); }
    /* Dense data tables have an intrinsic min-width (columns + aligned action
       buttons). Rather than break their layout, let them scroll horizontally
       inside their own panel so they never push the whole page wider. The
       min-width floors stop the table shrinking to 100% and crushing its
       columns into an unreadable mess. */
    .panel:has(.data-table) { overflow-x: auto; }
    .dataset-table { min-width: 900px; }
    .catalogue-table { min-width: 820px; }
    .watchlist-table { min-width: 940px; }
    .task-table { min-width: 1000px; }
    .task-table-uw { min-width: 1080px; }
    .picker-dataset-table { min-width: 860px; }
  }

  /* ~900px: single-column for the remaining multi-column blocks, and
     let the page header stack so the action buttons don't get squeezed. */
  @media (max-width: 900px) {
    .pg-head { flex-direction: column; align-items: flex-start; gap: 14px; }
    .pg-actions { flex-wrap: wrap; }
    .portfolio-kpis { grid-template-columns: repeat(2, 1fr); }
    .filter-grid { grid-template-columns: 1fr 1fr; }
    .uw-field { grid-template-columns: 1fr; gap: 6px; }
    .funnel { grid-template-columns: repeat(2, 1fr); }
  }

  /* ════════════════════════════════════════════════════════════════
     PHONE-WIDTH TABLE STRATEGIES (≤ 700px) — three options, switched
     by a body class. TEMP: a floating switcher lets you compare them;
     remove the switcher + the unused options once one is chosen.
     ════════════════════════════════════════════════════════════════ */
  @media (max-width: 700px) {

    /* Cancel the desktop min-width floors + panel scroll so the table
       reflows to the phone width with no horizontal scrollbar. */
    body.mtab-cards .data-table { min-width: 0; width: 100%; }
    body.mtab-cards .panel:has(.data-table) { overflow: visible; }
    body.mtab-cards .data-table thead { display: none; }
    body.mtab-cards .data-table tbody,
    body.mtab-cards .data-table tr,
    body.mtab-cards .data-table td { display: block; }
    body.mtab-cards .data-table .row-checkbox { display: none; }

    /* STACKED CARDS — label on top, value below (full width, so short
       values can never be squeezed into a 1-char column). */
    body.mtab-cards .data-table tbody tr {
      border: 1px solid var(--line-2); border-radius: var(--radius-card);
      background: var(--color-white); padding: 6px 14px; margin-bottom: 12px;
      box-shadow: var(--shadow-xs, 0 1px 2px color-mix(in srgb, var(--color-purple-01) 4%, transparent));
    }
    body.mtab-cards .data-table td {
      display: block; padding: 9px 0; border: 0;
      border-bottom: 1px dashed var(--line);
      text-align: left; font-size: var(--text-app-lg); line-height: 1.4;
      overflow-wrap: break-word;
    }
    body.mtab-cards .data-table td:last-child { border-bottom: 0; }
    body.mtab-cards .data-table td::before {
      content: attr(data-label); display: block; margin-bottom: 3px;
      font-family: var(--font-mono); font-size: var(--text-app-2xs); letter-spacing: .05em;
      text-transform: uppercase; color: var(--muted);
    }
    body.mtab-cards .data-table td:has(.row-actions) {
      padding-top: 11px; margin-top: 3px; border-top: 1px solid var(--line);
    }
    body.mtab-cards .data-table td:has(.row-actions)::before { display: none; }
    body.mtab-cards .data-table .row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
    
    
  }
