/* ========== MOBILE RESPONSIVE FIXES ========== */
@media (max-width: 959px) {
  /* App shell: single column on mobile */
  .app-shell {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--midnight);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
  }
  .sidebar.active {
    transform: translateX(0);
  }
  
  .app-main {
    padding: 80px 16px 60px !important;
    width: 100%;
  }
  
  .app-header {
    padding: 12px 0 20px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .search-box {
    width: 100% !important;
    max-width: 100% !important;
    order: 2;
  }
  
  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  /* Make tables scrollable */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
  }
  
  table {
    min-width: 600px;
    font-size: 12px;
  }
  
  /* Cards full width on mobile */
  .card {
    padding: 20px;
  }
  
  /* Grid adjustments */
  .sector-grid {
    grid-template-columns: 1fr;
  }
  
  .welcome-card {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
  }
  
  .welcome-card::before {
    display: none;
  }
  
  /* Stats grid on mobile */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .stat-card {
    padding: 16px;
  }
  .stat-card .value {
    font-size: 26px;
  }
  .stat-card .icon {
    display: none;
  }
  
  /* CRM responsive */
  .crm-split {
    grid-template-columns: 1fr;
  }
  .customer-list {
    max-height: 300px;
  }
  
  /* KV grid */
  .kv-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Contact form */
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .contact-info {
    order: 2;
  }
  
  /* Pricing tiers */
  .tiers {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }
  .tier-popular {
    transform: none;
  }
  
  /* Testimonials */
  .testimonials {
    grid-template-columns: 1fr;
  }
  
  /* FAQ */
  .faq-q {
    font-size: 16px;
    padding: 16px 0;
  }
  
  /* Bookings */
  .booking-grid {
    grid-template-columns: 1fr;
  }
  .booking-summary {
    position: static;
  }
  
  /* Chart stage */
  .chart-stage {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  
  /* Transit strip */
  .transit-strip {
    grid-template-columns: 1fr;
  }
  
  /* Slots */
  .slots {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Consultan grid */
  .consultant-grid {
    grid-template-columns: 1fr;
  }
  
  /* Year strip */
  .year-strip {
    grid-template-columns: repeat(4, 1fr);
  }
  
  /* Architecture */
  .arch-grid.cols-2,
  .arch-grid.cols-3,
  .arch-grid.cols-4 {
    grid-template-columns: 1fr;
  }
  
  /* Hero */
  .hero {
    padding: 64px 0 40px;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .hero-trust {
    flex-wrap: wrap;
    gap: 16px;
  }
  
  /* Auth page */
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-hero {
    min-height: 200px;
    padding: 32px 24px;
  }
  .auth-card {
    padding: 32px 24px;
  }
  
  /* Process steps */
  .process {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .process::before {
    display: none;
  }
  
  /* Status bar */
  .status-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  /* Queue item */
  .queue-item {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
  }
  
  /* Schedule row */
  .schedule-row {
    grid-template-columns: auto 1fr;
    gap: 8px;
  }
  
  /* Earnings */
  .earning-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .earning-hero .big {
    font-size: 32px;
  }
  
  /* Bar chart */
  .bar-chart {
    grid-template-columns: repeat(7, 1fr);
    height: 80px;
  }
  
  /* Investor deck */
  .slide {
    padding: 48px 5vw;
  }
  .slide h1.slide-title {
    font-size: clamp(32px, 8vw, 60px);
  }
  
  /* Contact info */
  .contact-row {
    flex-direction: column;
    gap: 4px;
  }
  
  /* Footer */
  footer {
    padding: 48px 0 24px;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  
  /* Fix avatar sizing */
  .avatar {
    width: 36px !important;
    height: 36px !important;
    font-size: 12px !important;
  }
  
  /* Prevent horizontal overflow */
  body {
    overflow-x: hidden;
  }
  
  /* Nav hamburger button */
  .mobile-nav-toggle {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  
  /* Fix inline width styles */
  img, svg {
    max-width: 100%;
    height: auto;
  }
}

/* ═══════════════════════════════════════════════════════
   COMPREHENSIVE MOBILE FIXES - ALL 4 VIEWS
   ═══════════════════════════════════════════════════════ */

/* Public nav mobile open state */
@media (max-width: 960px) {
  .nav-menu li a {
    display: block;
    padding: 12px 16px;
    border-radius: var(--r-sm);
    font-size: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  .nav-menu li a:last-child { border-bottom: none; }
  .nav-cta { display: none; } /* Hidden on mobile, shown in nav dropdown */
  .mobile-nav-toggle { display: flex !important; }
}

/* App shell mobile - sidebar slides from left */
@media (max-width: 959px) {
  .app-shell { grid-template-columns: 1fr !important; }

  .sidebar {
    position: fixed !important;
    top: 0; left: 0;
    width: 280px !important;
    height: 100vh !important;
    background: #0a0b2e !important;
    z-index: 999 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1) !important;
    overflow-y: auto !important;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5) !important;
  }
  .sidebar.active {
    transform: translateX(0) !important;
  }

  .mobile-nav-toggle {
    display: flex !important;
    position: fixed;
    top: 14px; right: 14px;
    width: 44px; height: 44px;
    background: rgba(10,11,46,0.95);
    border: 1px solid rgba(229,180,55,0.3);
    border-radius: 50%;
    padding: 0;
    z-index: 1000;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
  }
  .mobile-nav-toggle span {
    display: block;
    width: 20px; height: 2px;
    background: #e5b437;
    border-radius: 1px;
    transition: all 0.28s ease;
  }
  .mobile-nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
  .mobile-nav-toggle.active span:nth-child(2) { opacity: 0; }
  .mobile-nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

  .app-main {
    padding: 72px 14px 60px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .app-header {
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 16px;
  }
  .app-header h1 { font-size: clamp(20px, 5vw, 28px); }

  .search-box { width: 100% !important; order: 3; }
  .header-actions { gap: 6px; }

  /* Stat grid: 2 columns on mobile */
  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }

  /* Widget grids: single column */
  .grid, [class*="grid-template-columns"] {
    /* Override inline grid with 2+ cols */
  }
  .app-main .grid { grid-template-columns: 1fr !important; }

  /* Watchlist row */
  .watchlist-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Welcome card */
  .welcome-card { grid-template-columns: 1fr !important; padding: 20px 16px !important; }
  .welcome-card h2 { font-size: clamp(20px, 5vw, 28px); }

  /* Status bar */
  .status-bar { flex-direction: column; gap: 10px; align-items: flex-start; }

  /* Sector grid: 2 columns */
  .sector-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* CRM split */
  .crm-split { grid-template-columns: 1fr !important; }
  .customer-list { max-height: 300px; overflow-y: auto; }

  /* Queue items */
  .queue-item { flex-wrap: wrap; gap: 8px; }
  .queue-item .btn { width: 100%; }

  /* Booking grid */
  .booking-grid { grid-template-columns: 1fr !important; }
  .booking-summary { order: -1; }

  /* Kanban */
  .kanban { grid-template-columns: 1fr !important; overflow-x: auto; }

  /* Analysis grid in chart viewer */
  .analysis-grid { grid-template-columns: 1fr !important; }

  /* Viewer layout: chart page */
  .viewer-layout { grid-template-columns: 1fr !important; }
  .viewer-sidebar { border-right: none; border-bottom: 1px solid var(--hairline); max-height: 60vh; overflow-y: auto; }
  .viewer-main { min-height: 0; }

  /* Chat layout */
  .chat-shell { grid-template-columns: 1fr !important; }
  .chart-panel { display: none !important; } /* hidden on mobile chat */

  /* Tabs: scrollable on mobile */
  .tab-bar { overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tab-bar::-webkit-scrollbar { display: none; }
  .tab-btn { flex-shrink: 0; }

  /* Cards */
  .card { padding: 16px; }
  .widget { padding: 16px; }

  /* Nav menu in header overlay mode */
  .nav-menu a:hover { background: rgba(229,180,55,0.1); }
}

/* Extra small - phones */
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr !important; }
  .app-main { padding: 68px 12px 48px !important; }
  .welcome-card p { font-size: 13px; }
  .natal-chips { flex-wrap: wrap; gap: 6px; }
  .sector-grid { grid-template-columns: repeat(2,1fr) !important; }
  .kv-grid { grid-template-columns: 1fr 1fr; }
  .year-strip { grid-template-columns: repeat(3,1fr); font-size: 11px; }
  .schedule-row { flex-wrap: wrap; }
  .transit-strip { grid-template-columns: 1fr !important; }
  .chart-stage { grid-template-columns: 1fr !important; }
  .rate-row { flex-wrap: wrap; }
  .forecast-card { padding: 16px; }
  .sidebar-menu a { font-size: 14px; padding: 10px 14px; }
}

/* Animation for nav slide-down */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

