@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --red: #ff0000;
  --red-dark: #cc0000;
  --red-dim: rgba(255,0,0,0.12);
  --red-glow: rgba(255,0,0,0.35);
  --black: #080808;
  --dark: #111111;
  --card: #181818;
  --border: #2a2a2a;
  --muted: #888;
  --white: #ffffff;
  --off-white: #f0f0f0;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'Outfit', sans-serif;

  /* Border-radius scale (Phase 6 / B1 tokenization) */
  --r-xs: 2px; --r-chip: 3px; --r-button: 4px; --r-input: 6px; --r-card: 8px;
  --r-md: 10px; --r-kpi: 12px; --r-modal: 14px; --r-rounded: 20px; --r-pill: 999px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Phase 1: Mobile-friendly image reset ──
 * User-uploaded covers/avatars can be wider than the viewport on phones.
 * Cap to the container width so they never trigger horizontal scroll. */
img, video, svg { max-width: 100%; height: auto; }

body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--white);
  min-height: 100vh;
  /* Phase 1: a brief red flash on tap gives haptic-like feedback on phones. */
  -webkit-tap-highlight-color: rgba(255, 0, 0, 0.18);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--dark); }
::-webkit-scrollbar-thumb { background: var(--red); border-radius: var(--r-chip, 3px); }

/* ── Nav ── */
.nav-main {
  position: sticky; top: 0; z-index: 999;
  background: rgba(8,8,8,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 2px;
  color: var(--white);
  text-decoration: none;
}
.nav-logo span { color: var(--red); }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
  color: var(--muted); text-decoration: none;
  font-size: 0.9rem; font-weight: 500; letter-spacing: 0.5px;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--white); }
.nav-actions { display: flex; gap: 0.75rem; align-items: center; }

/* ── Buttons ── */
.btn-red {
  background: var(--red); color: var(--white);
  border: none; border-radius: var(--r-button, 4px);
  padding: 0.65rem 1.5rem;
  font-family: var(--font-body); font-weight: 600;
  font-size: 0.9rem; letter-spacing: 0.5px;
  cursor: pointer; transition: all 0.2s;
  text-decoration: none; display: inline-block;
}
.btn-red:hover { background: var(--red-dark); transform: translateY(-1px); box-shadow: 0 4px 20px var(--red-glow); color: var(--white); }

.btn-outline {
  background: transparent; color: var(--white);
  border: 1px solid var(--border); border-radius: var(--r-button, 4px);
  padding: 0.65rem 1.5rem;
  font-family: var(--font-body); font-weight: 500;
  font-size: 0.9rem; cursor: pointer; transition: all 0.2s;
  text-decoration: none; display: inline-block;
}
.btn-outline:hover { border-color: var(--white); color: var(--white); }

.btn-ghost {
  background: transparent; color: var(--muted);
  border: none; padding: 0.5rem 1rem;
  font-family: var(--font-body); font-size: 0.85rem;
  cursor: pointer; transition: color 0.2s;
  text-decoration: none;
}
.btn-ghost:hover { color: var(--white); }

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card, 8px);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.card:hover { border-color: var(--red); transform: translateY(-2px); }

/* ── Event grid card (used on home + browse grid view) ── */
.event-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-card, 8px); overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer; text-decoration: none; color: inherit;
  display: block;
}
.event-card:hover { border-color: var(--red); transform: translateY(-3px); }
.event-card-img {
  width: 100%; height: 180px;
  background: linear-gradient(135deg, #1a0000 0%, #2a0000 100%);
  position: relative; overflow: hidden;
}

/* ── Heart save button (overlay on event-card-img) ── */
.event-heart {
  position: absolute; top: 10px; right: 10px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.85);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 2;
  font-size: 1.05rem; padding: 0;
  transition: all 0.18s ease;
  backdrop-filter: blur(4px);
}
.event-heart:hover {
  background: rgba(255,0,0,0.18);
  border-color: rgba(255,0,0,0.5);
  color: #ff5050;
  transform: scale(1.08);
}
.event-heart.saved {
  background: var(--red);
  border-color: var(--red);
  color: white;
}
.event-heart.saved:hover {
  background: var(--red-dark);
  transform: scale(1.08);
}
@keyframes vltxHeartPop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.45); }
  100% { transform: scale(1); }
}
.event-heart.popping { animation: vltxHeartPop 0.4s cubic-bezier(0.34,1.56,0.64,1); }
.event-card-img-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 5rem; color: rgba(255,0,0,0.15);
  letter-spacing: -3px;
}
.event-card-date-badge {
  position: absolute; top: 12px; left: 12px;
  background: var(--red); border-radius: var(--r-button, 4px);
  padding: 0.25rem 0.6rem; font-size: 0.72rem;
  font-weight: 700; letter-spacing: 0.5px;
  color: var(--white);
}
.event-card-body { padding: 1.25rem; }
.event-card-meta {
  font-size: 0.75rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 0.5rem;
}
.event-card-title {
  font-family: var(--font-display); font-size: 1.4rem;
  letter-spacing: 0.5px; line-height: 1.1; margin-bottom: 0.5rem;
}
.event-card-venue { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
.event-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 1rem; border-top: 1px solid var(--border);
}
.event-card-price { font-weight: 700; font-size: 1rem; }
.event-card-price span { font-size: 0.75rem; color: var(--muted); font-weight: 400; }
/* "from" prefix on event-card prices — see eventCard() in home.js and
   gridCard() in browse.js. Subtler than the price itself so the number
   still reads as the dominant value; the prefix just clarifies that other
   tiers may cost more. Uppercase + letter-spacing matches the other
   small-cap labels in the design system. */
.event-card-price .event-card-price-from {
  font-size: 0.62rem; font-weight: 500; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; margin-right: 0.25rem;
}

/* ── Section Headers ── */
.section-label {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 3px;
  text-transform: uppercase; color: var(--red);
  margin-bottom: 0.5rem;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: 1px; line-height: 1;
  margin-bottom: 1rem;
}

/* ── Form Controls ── */
.form-control, .form-select {
  background: var(--dark); border: 1px solid var(--border);
  border-radius: var(--r-button, 4px); color: var(--white);
  padding: 0.75rem 1rem; font-family: var(--font-body);
  font-size: 0.9rem; width: 100%; outline: none;
  transition: border-color 0.2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-dim);
}
.form-control::placeholder { color: var(--muted); }
/* Override Chrome/Edge autofill background — without this, autofilled fields
   turn white/yellow regardless of the .form-control background rule. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px var(--dark) inset !important;
  -webkit-text-fill-color: var(--white) !important;
  transition: background-color 5000s ease-in-out 0s;
  border-color: var(--border) !important;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.55);
  cursor: pointer;
  padding: 3px;
  border-radius: var(--r-chip, 3px);
  transition: filter 0.15s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  filter: invert(1) opacity(1);
  background: rgba(255,255,255,0.08);
}
.form-label {
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.5px;
  color: var(--muted); text-transform: uppercase; margin-bottom: 0.4rem;
  display: block;
}
.form-group { margin-bottom: 1.25rem; }

/* ── Stat Blocks ── */
.stat-block {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-card, 8px); padding: 1.5rem;
}
.stat-block .stat-val {
  font-family: var(--font-display);
  font-size: 2.5rem; color: var(--white); line-height: 1;
}
.stat-block .stat-label {
  font-size: 0.8rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; margin-top: 0.25rem;
}
.stat-block .stat-change {
  font-size: 0.8rem; font-weight: 600; margin-top: 0.5rem;
}
.stat-block .stat-change.up { color: #22c55e; }
.stat-block .stat-change.down { color: var(--red); }

/* ── Badge ── */
.badge {
  display: inline-block; padding: 0.25rem 0.65rem;
  border-radius: var(--r-rounded, 20px); font-size: 0.72rem;
  font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase;
}
.badge-red { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,0,0,0.3); }
.badge-green { background: rgba(34,197,94,0.12); color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.badge-yellow { background: rgba(234,179,8,0.12); color: #eab308; border: 1px solid rgba(234,179,8,0.3); }
.badge-muted { background: rgba(255,255,255,0.06); color: var(--muted); border: 1px solid var(--border); }

/* ── Table ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 0.72rem; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
  text-align: left;
}
.data-table td {
  padding: 1rem; border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.9rem; vertical-align: middle;
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Red line accent ── */
.red-line {
  width: 48px; height: 3px;
  background: var(--red); margin-bottom: 1.5rem;
}

/* ── Sidebar Layout ── */
/* Pages with a sidebar are rendered AFTER the sticky 64px .nav-main, so the
 * sidebar must offset by that height to stay aligned. */
.layout-sidebar {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 64px);
}
.sidebar {
  background: var(--dark);
  border-right: 1px solid var(--border);
  padding: 2rem 0;
  position: sticky; top: 64px; height: calc(100vh - 64px);
  overflow-y: auto;
}
.sidebar-logo {
  font-family: var(--font-display);
  font-size: 1.6rem; letter-spacing: 2px;
  padding: 0 1.5rem 2rem;
  display: block; text-decoration: none; color: var(--white);
}
.sidebar-logo span { color: var(--red); }
.sidebar-section {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 2px;
  text-transform: uppercase; color: var(--muted);
  padding: 0 1.5rem; margin-bottom: 0.5rem; margin-top: 1.5rem;
}
.sidebar-nav { list-style: none; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1.5rem;
  color: var(--muted); text-decoration: none;
  font-size: 0.9rem; font-weight: 500;
  transition: all 0.15s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  color: var(--white);
  background: rgba(255,255,255,0.04);
}
.sidebar-nav a.active { border-left: 2px solid var(--red); color: var(--red); }
.main-content { padding: 2rem 2.5rem; overflow-y: auto; min-height: calc(100vh - 64px); }
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-family: var(--font-display); font-size: 2.5rem; letter-spacing: 1px; }
.page-header p { color: var(--muted); margin-top: 0.25rem; }

/* ── Grid Layouts ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }

/* ── Footer ── */
.footer {
  background: var(--dark); border-top: 1px solid var(--border);
  padding: 3rem 2rem 1.5rem;
}

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.5s ease forwards; }
.fade-up-1 { animation-delay: 0.1s; opacity: 0; }
.fade-up-2 { animation-delay: 0.2s; opacity: 0; }
.fade-up-3 { animation-delay: 0.3s; opacity: 0; }
.fade-up-4 { animation-delay: 0.4s; opacity: 0; }

/* ── Utilities ── */
.text-red { color: var(--red); }
.text-muted { color: var(--muted); }
.text-white { color: var(--white); }
.gap-1 { gap: 1rem; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mt-1 { margin-top: 1rem; } .mt-2 { margin-top: 2rem; } .mt-3 { margin-top: 3rem; }
.mb-1 { margin-bottom: 1rem; } .mb-2 { margin-bottom: 2rem; }
.p-1 { padding: 1rem; } .p-2 { padding: 2rem; }
.w-full { width: 100%; }

/* ─────────────────────────────────────────────────────────────────────
 * PHASE 1 — Mobile-friendly foundation
 *
 * This block is intentionally at the bottom of theme.css so it overrides
 * any earlier rule in this file. Goals:
 *   1. Tap targets ≥ 44×44 px (Apple/WCAG minimum) on all interactive
 *      elements that humans poke at on phones.
 *   2. Inputs/selects/textareas at 16px font-size so iOS Safari does NOT
 *      auto-zoom on focus (anything < 16px triggers the zoom).
 *   3. A `@media (max-width: 768px)` breakpoint that:
 *        - collapses .layout-sidebar (240px sidebar + content → stacked)
 *        - stacks .grid-2/3/4 into a single column
 *        - shrinks .nav-main horizontal padding and hides .nav-links
 *        - tightens .section and .footer padding
 *
 * Page-specific tweaks (browse filter drawer, event-detail tier picker,
 * checkin-scanner viewport, etc.) live in Phase 2-5.
 * ───────────────────────────────────────────────────────────────────── */

/* 1.2 — Tap target minimums (applies everywhere, not just mobile, because
 * a 30-px button on desktop is also annoying — just less critical). */
button,
.btn-red,
.btn-outline,
.btn-ghost,
a.btn,
.nav-link,
.cat-pill {
  min-height: 44px;
  /* Don't enforce min-width — .btn-ghost on inline rows would suddenly
   * gain a 44px tracking gap. Height is the part iOS Human Interface
   * Guidelines care about most. */
}

/* 1.3 — 16px form font-size (applies everywhere). The transition to
 * mobile is so smooth that bumping desktop inputs from 0.9rem to 16px is
 * fine; if anything, desktop forms look a little more legible too. */
input,
textarea,
select,
.form-control,
.form-select {
  font-size: 16px;
}

/* Phase 5.1: hamburger toggle default-hidden on desktop. The mobile
 * @media block below flips it to `display: inline-flex` at <= 768px.
 * IMPORTANT: this default rule MUST come BEFORE the @media block —
 * equal-specificity rules resolve by source order, so a default placed
 * AFTER the @media would override the mobile rule and keep the toggle
 * hidden at every viewport (bug fixed: 2026-05-15). */
.sidebar-toggle { display: none; }

/* Nav hamburger: hidden on desktop, shown on mobile. Same ordering rule
 * as .sidebar-toggle — must precede the @media block. */
.nav-hamburger { display: none; }

/* ── Mobile breakpoint ── */
@media (max-width: 768px) {

  /* 1.2 mobile padding — bigger pads make taps reliable on phones. */
  button,
  .btn-red,
  .btn-outline,
  .btn-ghost,
  a.btn {
    padding: 0.85rem 1.1rem;
  }

  /* Nav: hide the desktop links bar, tighten padding so the logo +
   * action buttons fit on a 360-px Galaxy S20.
   * Keep the EVENTBRICKS wordmark visible on mobile, sized to match the
   * badge (the condensed display face is only ~122px wide at 1.8rem, so it
   * fits beside Sign In + hamburger with margin even at 360px). Matches the
   * login page's mobile brand and the desktop logo proportions. */
  .nav-main {
    padding: 0 1rem;
  }
  .nav-logo {
    font-size: 1.8rem;
    letter-spacing: 1px;
  }
  .nav-logo > span {
    display: inline-block;
  }
  .nav-links {
    display: none;
  }
  .nav-actions {
    gap: 0.5rem;
  }
  /* Hide the low-priority Help ghost button so only Sign In remains. */
  .nav-actions .btn-ghost {
    display: none;
  }
  /* Hide Get Started on mobile — Sign In covers both paths and frees
   * space for the hamburger button at 360px. */
  .nav-actions .btn-red {
    display: none;
  }
  /* Tighten Sign In padding to leave room for the hamburger. */
  .nav-actions .btn-outline {
    padding: 0.55rem 0.75rem;
    font-size: 0.82rem;
  }

  /* ── Nav hamburger (NEW-01 fix) ── */
  .nav-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r-input, 6px);
    color: var(--white);
    cursor: pointer;
    font-size: 1.1rem;
    flex-shrink: 0;
    padding: 0;
    font-family: inherit;
  }

  /* Mobile nav dropdown — slides down from the sticky nav bar.
   * position:fixed keeps it viewport-relative so horizontal overflow on
   * the page (which shifts position:absolute/sticky elements) cannot push
   * the panel off-screen. top:64px = nav bar height. width:100vw is
   * explicit so the panel is never narrower than the visible viewport. */
  .nav-links.is-open {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: fixed;
    top: 64px;
    left: 0;
    width: 100vw;
    background: rgba(8, 8, 8, 0.97);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
    z-index: 998;
    list-style: none;
    margin: 0;
  }
  .nav-links.is-open li a {
    display: block;
    padding: 0.9rem 1.5rem;
    font-size: 0.95rem;
    color: var(--muted);
    text-decoration: none;
  }
  .nav-links.is-open li a:hover,
  .nav-links.is-open li a.active {
    color: var(--white);
    background: rgba(255, 255, 255, 0.04);
  }

  /* Condense the logged-in user pill to avatar-circle only so it coexists
   * with the bell and hamburger at 360px without overflow. */
  .vltx-user-pill-name,
  .vltx-user-pill-caret { display: none; }
  .vltx-user-pill-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
  }

  /* Nav dropdowns — clamp so they don't clip off the right edge on
   * narrow phones. Overrides the min-width baked into nav.js. */
  .vltx-bell-menu,
  .vltx-user-menu {
    min-width: 0 !important;
    max-width: calc(100vw - 1rem) !important;
  }

  /* Sidebar layout — collapse to single column. The sidebar itself stays
   * rendered but becomes non-sticky and full-width above the content.
   * Phase 5.1 will replace this with a hamburger drawer; for now the
   * goal is "no horizontal scroll on dashboards." */
  .layout-sidebar {
    grid-template-columns: 1fr;
  }
  /* Phase 5.1: .sidebar becomes a slide-in drawer on mobile. Hidden
   * off-screen by default (transform: translateX(-100%)). When the
   * organizer-sidebar.js hamburger is tapped, `.is-open` is toggled and
   * the drawer slides in. position:fixed takes it out of grid flow so
   * `.layout-sidebar { grid-template-columns: 1fr }` (also in this
   * block) gives main content the full viewport width. */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(280px, 85vw);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    border-right: 1px solid var(--border);
    border-bottom: none;
    padding: 1.25rem 0;
    overflow-y: auto;
  }
  .sidebar.is-open {
    transform: translateX(0);
  }

  /* Phase 5.1: hamburger toggle button. Injected into .nav-main by
   * organizer-sidebar.js so it appears on every sidebar page without
   * touching individual HTML files. 44x44 = WCAG/iOS tap-target. */
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r-input, 6px);
    color: var(--white);
    cursor: pointer;
    font-size: 1.2rem;
    margin-right: 0.5rem;
    -webkit-tap-highlight-color: var(--red-dim);
  }
  .sidebar-toggle:hover { border-color: var(--red); color: var(--red); }
  .main-content {
    padding: 1.25rem 1rem;
  }

  /* Grids — auto-fit so 1- or 2-column layouts emerge naturally. */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Section + footer padding — keep usable width on a 360-px viewport. */
  .footer {
    padding: 2rem 1.25rem 1rem;
  }

  /* Page-header */
  .page-header h1 {
    font-size: 1.85rem;
  }

  /* ─── Universal table + column overflow (Phase 7/global) ───
   * Every page that uses .data-table OR a plain <table> on mobile
   * becomes horizontally scrollable instead of squashing columns.
   * Users can slide left-to-right to see all columns. Without this,
   * tables with 5+ columns at 360px viewport collapse text into
   * 30px-wide unreadable slivers or trigger horizontal page scroll
   * that breaks the rest of the layout. */
  /* ─── Mobile table scroll (revised) ───
   *
   * Previous attempt set `display: block !important` on the table itself
   * to make it a scroll container. That fought with inline `min-width:`
   * styles AND with `.card { overflow: hidden }` parents that clipped
   * the scrollbar. Result: tables overflowed silently with no scroll bar.
   *
   * Correct pattern: keep the table as `display: table`. Make sure
   * containers that hold a .data-table (.card, .panel, inline-styled
   * wrappers) allow inner horizontal scroll. Use :has() to give every
   * element that directly contains a .data-table its own overflow-x:auto.
   * Cells stay `white-space: nowrap` so columns push the table wide and
   * trigger the scroll. */

  /* ─── Mobile table scroll WITHOUT :has() ───
   *
   * Previous attempts used `*:has(> .data-table)` to make the table's
   * parent the scroll container. That only works in Chrome 105+,
   * Safari 15.4+, Firefox 121+. Older mobile Safari (iOS 14-15.3)
   * silently ignores :has() and the entire rule fails.
   *
   * No-:has() strategy: make the TABLE ITSELF the scroll container by
   * setting display: block + overflow-x: auto. The browser creates an
   * anonymous table context for thead/tbody/tr. Cells stay
   * `white-space: nowrap` so content pushes wider than the block's
   * width, triggering the scroll. ALL cards on mobile relax their
   * overflow:hidden clip so scroll bars at the bottom of the table can
   * actually render. */

  .data-table,
  table.data-table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
  }
  .data-table th,
  .data-table td,
  table.data-table th,
  table.data-table td {
    white-space: nowrap !important;
  }

  /* Plain unstyled tables get the same treatment. */
  main table:not(.data-table):not([class*="event-"]) {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
  }
  main table:not(.data-table):not([class*="event-"]) th,
  main table:not(.data-table):not([class*="event-"]) td {
    white-space: nowrap !important;
  }

  /* ALL cards on mobile relax their rounded-corner overflow clip so
   * scroll bars inside them render. This was the silent killer on
   * admin-sales: .card { overflow: hidden } was clipping the table's
   * own scroll bar at the card's bottom edge. */
  .card {
    overflow: visible !important;
  }

  /* Lock page-level horizontal scroll at multiple layers. If a child
   * inside .main-content / .as-main / body still overflows, this
   * traps it. */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
  }
  .main-content,
  .as-main,
  .admin-main {
    overflow-x: hidden !important;
    max-width: 100%;
  }

  /* ─── Universal toolbar / filter-bar wrap ───
   * Pages with horizontal filter rows (Search box + dropdowns +
   * Action buttons) wrap their children onto multiple rows instead
   * of overflowing the viewport. */
  .toolbar,
  [data-toolbar],
  [class*="filter-bar"],
  [class*="filter-row"] {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }
  .toolbar > *,
  [data-toolbar] > * {
    min-width: 0;
  }

  /* ─── Universal inline-grid stack ───
   * Pages that hand-wrote `style="display:grid;grid-template-columns:
   * 1fr 1fr"` (common on settings forms + modal layouts) collapse to
   * single column on mobile via attribute selector. */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Site footer link grid — 2-up at tablet/mobile.
   * The brand column spans both cells so it gets full width before
   * the link columns pair up beneath it. */
  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 1.5rem !important;
  }
  .footer-grid > :first-child {
    grid-column: 1 / -1;
  }
  .footer-grid > :first-child p {
    max-width: 100% !important;
  }

  /* ─── Universal modal/drawer clamp ───
   * Any modal/drawer/overlay that uses these common class/data hooks
   * clamps to the viewport so it doesn't overflow on a 360px phone. */
  .modal-content,
  .modal-card,
  [data-modal-content],
  [data-drawer-panel],
  [data-modal] > div:first-child {
    max-width: calc(100vw - 1.5rem) !important;
    width: 100% !important;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }

  /* ─── Universal action-button row stack ───
   * Rows of action buttons (Edit / Delete / Archive / Export) wrap
   * 2-up at 44px tap targets instead of squashing to unreadable
   * widths. Works with the most common class + data hooks. */
  [data-actions],
  .row-actions,
  .action-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  [data-actions] > .btn-red,
  [data-actions] > .btn-outline,
  [data-actions] > .btn-ghost,
  .row-actions > button,
  .row-actions > a {
    flex: 1 1 calc(50% - 0.25rem);
    min-height: 44px;
    text-align: center;
  }

  /* ─── Universal KPI strip 2-up ───
   * Stat strips named *kpi-strip* / *kpi-row* / [data-stats-row]
   * wrap 2-up on mobile so each card is readable at 360px. */
  [data-stats-row],
  .stats-strip,
  [class*="kpi-strip"],
  [class*="kpi-row"] {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.75rem !important;
  }

  /* ─── Universal form-row inputs full-width ───
   * Form fields inside `.form-row` containers stretch to row width. */
  .form-row input,
  .form-row select,
  .form-row textarea {
    width: 100% !important;
  }

  /* ─── Tighten panel/section padding ─── */
  .page-section,
  .panel,
  [data-section] {
    padding: 1rem !important;
  }
}

/* Phase 5.1: drawer backdrop + desktop-hidden hamburger. These live
 * outside @media because the .is-open hook class needs to be reachable
 * regardless of viewport — and `display: none` on the toggle keeps it
 * invisible on desktop. */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 998;
}
.sidebar-backdrop.is-open { display: block; }

/* Mobile nav-links backdrop — dims page content while the hamburger menu
 * is open. z-index 997: above page, below the sticky nav (999) and dropdown (998). */
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 997;
}
.nav-backdrop.is-open { display: block; }

/* Tablet breakpoint — between 768px and 1024px keep 2-up grids so
 * dashboards still feel productive on an iPad. */
@media (min-width: 769px) and (max-width: 1024px) {
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }
}

/* Small-phone breakpoint — keep the footer link grid 2-up (the brand column
 * still spans both columns via the <=768px rule above), and stack the
 * copyright bar so it doesn't overflow on 375px and below. */
@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 1.25rem !important;
  }
  .footer {
    padding: 1.5rem 1rem 1rem;
  }
  /* Copyright bar — stack vertically so the two items don't squish. */
  .footer > div:last-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
  }
}

/* Smallest phones (<=360px): the logged-in nav row is the tight case
 * (badge + wordmark + avatar pill + bell + hamburger). Trim the wordmark
 * slightly (still badge-matched) so EVENTBRICKS never forces overflow,
 * with headroom down to ~320px. */
@media (max-width: 360px) {
  .nav-logo {
    font-size: 1.6rem;
    letter-spacing: 0.5px;
  }
}
