/* ════════════════════════════════════════════════════════════════
   mobile-extra.css — Additional mobile responsive rules
   Loaded by base_public.html and base_dashboard.html
   v2 mobile pass (2026-04-17)
   ════════════════════════════════════════════════════════════════ */

/* ── General: no horizontal overflow ── */
html, body, .page, .main, .layout {
  overflow-x: hidden;
  max-width: 100%;
}

/* ── Tables: horizontal scroll on all tables ── */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 0.5px solid #dcdfe3;
}

/* Auto-wrap any table not already in a wrapper */
@media (max-width: 767px) {
  table {
    min-width: 100%;
  }

  /* KPI grids: 2-col on tablet, 1-col on phone */
  .kpi-row, .kpi-grid, .kpi-cards,
  [class*="kpi-row"], [class*="kpi-grid"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }

  /* Single col below 480px */

  /* Card padding: 12-16px on mobile */
  .card-v2, .card-mint, .card-lavender, .card-coral,
  .section-card > *, .dash-chart-card {
    padding: 16px;
  }

  /* Chart containers: no overflow, min-height */
  .chart-wrap, .chart-container,
  [id*="chart-container"], [id*="chart-wrap"],
  [class*="chart-card"], [class*="chart-wrap"] {
    overflow-x: hidden !important;
    min-height: 160px;
  }

  /* Chart canvas: stay within bounds */
  canvas {
    max-width: 100% !important;
    display: block;
  }

  /* Sliders: larger touch targets */
  input[type="range"] {
    height: 6px;
    cursor: pointer;
  }
  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
  }
  input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
  }

  /* Inputs: full-width, 44px min-height */
  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  select, textarea {
    width: 100% !important;
    min-height: 44px;
  }

  /* Number inputs next to sliders (gameplan pattern) */
  .input-row {
    flex-wrap: wrap;
  }
  .editable-val {
    width: 100% !important;
    text-align: left;
  }

  /* Game plan: single column on mobile */
  .sim-layout {
    grid-template-columns: 1fr !important;
  }

  /* Multi-col grids → single col */
  .two-col-grid,
  .three-col-grid,
  .four-col-grid {
    grid-template-columns: 1fr !important;
  }

  /* Page header actions: hide on mobile (use topbar) */
  .header-actions {
    display: none !important;
  }

  /* Hero typography: scale down */
  .hero-value, .kpi-value, .hero-number,
  .ret-col-value, .big-number, .stat-value {
    font-size: clamp(20px, 7vw, 32px) !important;
    line-height: 1.1;
  }

  /* Body text floor */
  body { font-size: 14px; }
  p, li, td, th { font-size: 13px; }

  /* Labels: 10px minimum */
  .card-label, .kpi-label, .section-eyebrow,
  .eyebrow, .nav-section-label, .form-label,
  .table-label, .chart-label {
    font-size: 10px !important;
  }

  /* Modal: full-width on mobile */
  .modal {
    margin: 12px;
    padding: 24px 16px;
    max-width: calc(100vw - 24px);
    border-radius: 16px;
  }

  /* Topbar: always show on mobile */
  .topbar { display: flex !important; }

  /* Main content: full-width (sidebar is hidden) */
  .main { margin-left: 0 !important; }

  /* Page padding on mobile */
  .page { padding: 20px 16px 48px !important; }
}

@media (max-width: 479px) {
  /* Single col KPI on phone */
  .kpi-row, .kpi-grid, .kpi-cards,
  [class*="kpi-row"], [class*="kpi-grid"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 374px) {
  /* Mobile S: 320-374px */
  .page { padding: 12px 12px 40px !important; }
  body { font-size: 13px; }
  .modal { margin: 8px; padding: 20px 14px; }

  /* Reduce card radius slightly */
  .card-v2, .card-mint, .card-lavender, .card-coral {
    border-radius: 14px;
  }
}

/* ── Public pages: hero section ── */
@media (max-width: 767px) {
  /* Home hero: stack columns */
  .hero-section, .hero-layout,
  [class*="hero-col"], [class*="hero-grid"] {
    grid-template-columns: 1fr !important;
    flex-direction: column !important;
  }

  /* Public page containers: ensure no overflow */
  .container, .page-inner, .content-wrap {
    overflow-x: hidden;
    max-width: 100%;
  }

  /* Budget/forecast/milestones: sidebar responsive */
  .public-layout, .two-panel {
    grid-template-columns: 1fr !important;
    flex-direction: column !important;
  }

  /* Public sidebar → goes to top */
  .public-sidebar {
    width: 100% !important;
    position: static !important;
  }
}

/* ── Auto table scroll (works with JS wrapper below) ── */
.auto-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 0.5px solid #dcdfe3;
  margin-bottom: 16px;
}
.auto-table-scroll table {
  margin-bottom: 0;
  border: none;
}

@media (max-width: 767px) {
  /* data-table-wrap already has overflow-x: auto */
  .data-table-wrap {
    border-radius: 12px;
  }

  /* Any table inside a card on mobile: make card scrollable */
  .card table, .about-section table, .section-card table {
    min-width: 500px; /* force scroll for wide tables */
    overflow-x: auto;
  }
}

