/* ==========================================================================
   TourFlow — responsive layer
   Desktop-first. Tablet collapses the sidebar to an overlay drawer; mobile
   adds a bottom nav bar and stacks every grid.
   ========================================================================== */

@media (max-width: 1400px) {
  .grid-5 { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dash-split { grid-template-columns: 1fr !important; }
  .settings-wrap { grid-template-columns: 1fr; }
  .settings-nav {
    position: static; flex-direction: row; overflow-x: auto; gap: 4px;
    padding-bottom: 6px; border-bottom: 1px solid var(--border);
  }
  .settings-nav button { white-space: nowrap; }
}

/* ---------- tablet: sidebar becomes an overlay drawer ---------- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-xl); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .scrim {
    position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 55;
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .main { margin-left: 0; }
  .hamburger { display: inline-flex; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-5 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .view { padding: 20px 18px 90px; }
  .top-date { display: none; }
  /* Two-column screens (calendar, payments, reports, widget) carry their
     column widths inline, so the collapse has to outrank them. */
  .split { grid-template-columns: 1fr !important; }
}

@media (max-width: 720px) {
  /* The top bar has to fit hamburger + search + actions in 375px, so the
     labels and the help icon go and the search takes what is left. */
  .top-right .lbl { display: none; }
  .top-right #helpTop { display: none; }
  .search-wrap { flex: 1 1 auto; min-width: 0; }
  .card-head { flex-wrap: wrap; }
  .card-head .right { margin-left: 0; width: 100%; }
  .seg { flex-wrap: wrap; }
}

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  h1 { font-size: 20px; }
  .page-head h1 { font-size: 20px; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dt { margin-top: 8px; }
  .kbd { display: none; }
  .search-input { padding-right: 12px; }
  .view { padding: 16px 14px 96px; }
  .card-body { padding: 14px; }
  .card-head { padding: 13px 14px; }
  .filter-bar { padding: 10px 14px; }
  .filter-bar .select, .filter-bar .input { flex: 1 1 46%; min-width: 0; }

  .overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 94vh; display: flex; flex-direction: column; }
  .modal-body { max-height: none; }
  .drawer { max-width: 100%; }
  .toast-host { left: 12px; right: 12px; bottom: 80px; align-items: stretch; }
  .toast { max-width: none; }

  .sched-row { flex-wrap: wrap; }
  .sched-cap { flex: 1 1 100%; }
  .sched-rev { margin-left: auto; }

  .cal-cell { min-height: 62px; padding: 4px; }
  .cal-ev { display: none; }
  .cal-cell .cal-dotrow { display: flex; gap: 2px; flex-wrap: wrap; }
  .cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--brand-500); }

  table.tf th, table.tf td { padding: 9px 10px; }
  .hide-sm { display: none !important; }

  /* bottom nav */
  .bottom-nav { display: flex !important; }
  .chart-bars { height: 150px; gap: 6px; }
}

.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 58;
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
}
.bottom-nav button {
  border: 0; background: none; display: flex; flex-direction: column; align-items: center;
  gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--ink-500); cursor: pointer;
  padding: 4px 8px; border-radius: var(--r-sm); flex: 1 1 0;
}
.bottom-nav button svg { width: 20px; height: 20px; }
.bottom-nav button.on { color: var(--brand-600); }

/* ==========================================================================
   Customer booking site (booking.html)
   ========================================================================== */
@media (max-width: 980px) {
  .cust-nav-links { display: none; }
  .cust-burger { display: inline-flex !important; }
  .feature-row { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
  .book-layout { grid-template-columns: 1fr !important; }
  .book-summary { position: static !important; }
  .hero-stats { gap: 18px !important; }
}

@media (max-width: 720px) {
  .cust-hero h1 { font-size: 33px !important; }
  .cust-hero p.lede { font-size: 15px !important; }
  .cust-section { padding: 44px 0 !important; }
  .act-grid { grid-template-columns: 1fr !important; }
  .feature-row { grid-template-columns: 1fr !important; }
  .feature > div { min-width: 0; }
  .steps-rail { overflow-x: auto; }
  .time-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .search-panel { flex-direction: column; }
  .search-panel > * { width: 100%; }
  .cust-foot-grid { grid-template-columns: 1fr !important; gap: 26px !important; }
  .detail-split { grid-template-columns: 1fr !important; }
}
