/* ============================================================
   KIIWIS DASHBOARD — Mobile Stylesheet v1
   Loaded after site.css, automations.css, campaigns.css.
   Desktop styles untouched. All rules scoped to breakpoints.
   ============================================================ */

/* ─────────────────────────────────────────────────────────────
   GLOBAL OVERRIDES (no @media — always applied)
   ──────────────────────────────────────────────────────────── */

/* step-kicker: circle style matching campaigns step-num */
.step-kicker {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  font-size: .72rem;
}

/* builder-step step-head: flex-start so circle aligns with first line of title */
.builder-step .step-head {
  align-items: flex-start;
  gap: 10px;
}
.builder-step .step-head > div:last-child {
  flex: 1;
  min-width: 0;
}

/* ─────────────────────────────────────────────────────────────
   1. SHARED CONTENT PADDING
   Fixes the hardcoded `style="padding:24px 28px 0"` and
   `style="padding:0 28px 28px"` inline divs that ignore the
   existing @media(max-width:600px) rule in site.css.
   Applied via a utility class added to every page's wrapper div.
   ──────────────────────────────────────────────────────────── */
.content-pad-top  { padding-top: 24px; padding-left: 0; padding-right: 0; }
.content-pad-main { padding: 0 0 40px; }

@media (max-width: 600px) {
  .content-pad-top  { padding-top: 16px; padding-left: 16px; padding-right: 16px; }
  .content-pad-main { padding: 0 16px 32px; }
}


/* ─────────────────────────────────────────────────────────────
   2. MOBILE TOPBAR — standardized header: ☰ · Title · [bell+CTA]
   Desktop .topbar is HIDDEN on mobile. The mobile-topbar takes
   over completely with: hamburger left, page title center-left
   (flex:1), and a .mob-actions group on the right (bell + CTA).
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  /* Hide the desktop topbar completely on mobile */
  .topbar {
    display: none !important;
  }

  /* Mobile topbar: always a single row, full width */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 0;
  }

  /* Page title — takes all available space */
  .mob-title {
    flex: 1;
    font-size: var(--k-fs-card, 18px);
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  /* Actions group: bell + optional CTA */
  .mob-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
  }

  /* Compact CTA buttons inside mob-actions */
  .mob-actions .btn {
    padding: 7px 12px;
    font-size: .79rem;
    border-radius: var(--radius-sm);
  }
  .mob-actions .btn-primary {
    padding: 7px 12px;
    font-size: .79rem;
  }
}

@media (max-width: 600px) {
  .mob-title {
    font-size: var(--k-fs-card, 18px);
  }
  .mob-actions .btn {
    padding: 6px 10px;
    font-size: .76rem;
  }
}


/* ─────────────────────────────────────────────────────────────
   3. ONBOARDING CARD (index.html)
   ob-steps collapses to 1col at 700px but the header and
   step content break at narrower widths. Full mobile treatment.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .ob-card {
    border-radius: 14px;
  }
  .ob-header {
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px 14px;
  }
  .ob-title {
    font-size: 1.05rem;
    line-height: 1.3;
  }
  .ob-sub {
    font-size: .79rem;
  }
  .ob-prog-wrap {
    align-self: flex-start;
  }
  /* Steps: single column, horizontal separator instead of vertical */
  .ob-steps {
    grid-template-columns: 1fr;
  }
  .ob-step {
    border-right: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    padding: 14px 18px 16px;
  }
  .ob-step:last-child {
    border-bottom: none;
  }
  .ob-step-title {
    font-size: .82rem;
  }
  .ob-step-desc {
    font-size: .74rem;
    margin-bottom: 10px;
  }
  .ob-btn {
    font-size: .77rem;
    padding: 7px 12px;
  }
}


/* ─────────────────────────────────────────────────────────────
   4. KPI STRIP — all pages
   At ≤600px: 1 column, larger numbers, more padding.
   Matches the card-per-row style shown in the mockup.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .kpi-strip {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }
  .kpi-card {
    padding: 16px 14px 14px;
    display: flex;
    flex-direction: column;
  }
  .kpi-value {
    font-size: 1.55rem;
    margin-bottom: 6px;
  }
  .kpi-human {
    font-size: .78rem;
    min-height: 30px;
  }
  .kpi-delta {
    font-size: .78rem;
  }
  /* Make the decorative glow circle a bit larger to fill the card */
  .kpi-glow {
    width: 86px;
    height: 86px;
    bottom: -22px;
    right: -22px;
  }
}


/* ─────────────────────────────────────────────────────────────
   5. OVERVIEW GRID & BOTTOM GRIDS (index.html)
   overview-grid, btm-grid, act-grid already collapse to 1 col
   at 960px via inline styles. Just tighten spacing below 600px.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .overview-grid,
  .btm-grid,
  .act-grid {
    gap: 12px;
    margin-bottom: 14px;
  }
  /* Panel section heads on mobile */
  .section-head {
    padding: 14px 16px 0;
  }
  .section-head h3 {
    font-size: .88rem;
  }
  .section-body {
    padding: 12px 16px 16px;
  }
}


/* ─────────────────────────────────────────────────────────────
   6. WIZARD STEPS (automations.html + campaigns.html)
   6 or 7 step dots in a single row — they shrink below 10px
   on small phones and become untappable. Horizontal scroll
   instead, with labels hidden at very small widths.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .wizard-wrap {
    padding: 14px 14px 0;
    overflow: hidden;
  }
  .wizard-steps {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    scrollbar-width: none;
    /* ensure dots don't shrink below useful size */
    gap: 0;
  }
  .wizard-steps::-webkit-scrollbar {
    display: none;
  }
  /* Each step node gets a minimum width so dots stay tappable */
  .wsn {
    min-width: 56px;
    flex: 0 0 auto;
  }
  .wsn-dot {
    width: 28px;
    height: 28px;
    font-size: .72rem;
  }
  .wsn-label {
    font-size: .6rem;
    white-space: nowrap;
  }
  /* Campaigns phase labels */
  .wizard-phases {
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
  }
  .wizard-phases::-webkit-scrollbar { display: none; }

  .builder-body {
    padding: 6px 14px 16px;
  }
  /* Step cards: tighten head padding for mobile */
  .step-card-head,
  .step-head {
    padding: 11px 14px;
    gap: 10px;
  }
}

@media (max-width: 600px) {
  .wsn-label {
    display: none; /* show only dots on very small screens */
  }
  .wsn {
    min-width: 36px;
  }
  /* Phase divider label compact */
  .phase-divider {
    margin: 4px 0 8px;
    padding-bottom: 8px;
  }
  .phase-divider-label {
    font-size: .62rem;
    padding: 2px 7px;
  }
}


/* ─────────────────────────────────────────────────────────────
   7. PROTO-LAYOUT (automations sidebar)
   Already collapses at 1080px but the breakpoint in
   automations.css is isolated. Reinforce for consistency.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .proto-layout {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
}


/* ─────────────────────────────────────────────────────────────
   8. CAMPAIGNS LAYOUT
   campaigns-layout already collapses — just refine spacing.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .campaigns-layout {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
  /* Recent campaigns list full-width */
  .camp-list {
    overflow-x: hidden;
  }
}


/* ─────────────────────────────────────────────────────────────
   9. CARDS GRID (automation cards, campaign cards)
   Already goes 1col at 800px. Improve card touch targets.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 800px) {
  .cards-grid,
  .cards-grid.three-col {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
}


/* ─────────────────────────────────────────────────────────────
   10. COUNTER MODE (counter.html)
   The counter is used by staff at the register on tablet/phone.
   Larger touch targets, full-width inputs, tighter header.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* Header */
  .counter-header {
    padding: 10px 14px;
  }
  .counter-header-inner {
    flex-wrap: wrap;
    gap: 8px;
  }
  .counter-kpi-bar {
    display: none; /* already hidden at 600 — reinforce */
  }
  .counter-brand h1 {
    font-size: .82rem;
  }

  /* Main panel */
  .counter-main {
    padding: 12px 12px 20px;
    gap: 12px;
  }
  .cstep-head {
    padding: 12px 14px;
    gap: 10px;
  }
  .cstep-body {
    padding: 14px 14px;
  }
  .cstep-title {
    font-size: .84rem;
  }

  /* Lookup row: full-width stacked layout */
  .lookup-row {
    flex-wrap: wrap;
    gap: 7px;
  }
  .lookup-input {
    width: 100%;
    padding: 13px 14px;
    font-size: .92rem;
  }
  .lookup-select {
    flex: 1;
    padding: 12px 10px;
    font-size: .82rem;
  }
  .lookup-btn {
    flex: 1;
    padding: 12px 14px;
    font-size: .88rem;
    min-height: 46px; /* tappable */
  }

  /* Reward cards: bigger touch area */
  .reward-card {
    padding: 14px 14px;
  }
  .rc-name {
    font-size: .88rem;
  }
  .rc-select-btn {
    padding: 11px;
    min-height: 44px;
    font-size: .82rem;
  }

  /* Confirm actions: full-width buttons */
  .confirm-actions {
    flex-direction: column;
    gap: 8px;
  }
  .confirm-cancel {
    width: 100%;
    text-align: center;
    padding: 12px;
  }
  .confirm-btn {
    width: 100%;
    padding: 15px;
    font-size: .96rem;
  }

  /* Success screen */
  .success-cel {
    padding: 20px 16px;
  }
  .success-emoji {
    font-size: 2.4rem;
    margin-bottom: 8px;
  }
  .success-title {
    font-size: 1rem;
  }
  .success-next-btn {
    width: 100%;
    padding: 13px;
    font-size: .88rem;
  }

  /* Admin/session links in counter header — compact */
  .counter-admin-link {
    font-size: .7rem;
    padding: 5px 9px;
  }
}


/* ─────────────────────────────────────────────────────────────
   11. CUSTOMERS PAGE — mobile layout
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  /* cust-grid: single column (table then right col) */
  .cust-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── Filter bar ── */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .filter-search {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100%;
    font-size: .88rem;
  }
  /* Chips: one horizontal scrollable row */
  .filter-chips-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 3px;
  }
  .filter-chips-row::-webkit-scrollbar { display: none; }
  .filter-chip {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 11px;
    font-size: .76rem;
  }

  /* ── Table: hide low-priority columns so table fits without scroll ── */
  /* Shown: Customer (1), Stage (2), Reward progress (3) */
  /* Hidden: Visits (4), Last visit (5), Actions (6) */
  .cust-table th:nth-child(4),
  .cust-table td:nth-child(4),
  .cust-table th:nth-child(5),
  .cust-table td:nth-child(5),
  .cust-table th:nth-child(6),
  .cust-table td:nth-child(6) {
    display: none;
  }
  .cust-table      { min-width: 0 !important; }
  .cust-table-wrap { overflow-x: visible; }
  .cust-cell       { min-width: 0 !important; gap: 8px; }
  .cust-av         { width: 32px; height: 32px; font-size: .72rem; }
  .cust-name       { font-size: .83rem; }
  .cust-sub        { font-size: .71rem; }
  .stage           { font-size: .68rem; padding: 3px 7px; }
  .prog-wrap       { min-width: 0 !important; }
  .prog-label      { font-size: .75rem; }
  .prog-meta       { font-size: .7rem; }

  /* ── Right column ── */
  .hm-row { grid-template-columns: 1fr !important; }

  /* KPI strip on customers: 2×2 */
  .kpi-strip { grid-template-columns: 1fr 1fr !important; }
}


/* ─────────────────────────────────────────────────────────────
   12. ANALYTICS PAGE
   kpi-strip + layout already decent. Fine-tune chart panels.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .analytics-layout {
    grid-template-columns: 1fr;
  }
  .bar-row {
    grid-template-columns: 72px 1fr 44px;
    font-size: .78rem;
  }
}


/* ─────────────────────────────────────────────────────────────
   13. SETTINGS PAGE
   settings-layout already collapses at 1200px. Tighten
   the live preview panel and form rows on mobile.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .settings-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .form-grid {
    grid-template-columns: 1fr !important;
  }
  /* Service card checkboxes: single column */
  .service-cards {
    grid-template-columns: 1fr 1fr;
  }
  /* KPI strip on settings stays 2×2 */
  .kpi-strip {
    grid-template-columns: 1fr 1fr !important;
  }
}


/* ─────────────────────────────────────────────────────────────
   14. QR CENTER PAGE
   The QR code preview panel and asset list need breathing room.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .qr-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .scanner-grid {
    grid-template-columns: 1fr !important;
  }
  /* KPI strip on QR page — 2×2 */
  .kpi-strip {
    grid-template-columns: 1fr 1fr !important;
  }
}


/* ─────────────────────────────────────────────────────────────
   15. RECEIPTS PAGE
   Upload drop zone and receipt list tighten nicely already.
   Just fix the layout grid and KPI strip.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .receipts-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  /* KPI strip on receipts — 2×2 */
  .kpi-strip {
    grid-template-columns: 1fr 1fr !important;
  }
}


/* ─────────────────────────────────────────────────────────────
   16. BILLING PAGE
   billing-layout already collapses. Tighten plan cards.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .billing-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  /* KPI strip on billing — 2×2 */
  .kpi-strip {
    grid-template-columns: 1fr 1fr !important;
  }
}


/* ─────────────────────────────────────────────────────────────
   17. HELP PAGE
   Already collapses at 680px (sidenav disappears).
   Just add safe-area padding for phones with notches.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}


/* ─────────────────────────────────────────────────────────────
   18. GLOBAL POLISH
   Small universal fixes that apply across all pages.
   ──────────────────────────────────────────────────────────── */

/* Notification panel: full-width on small screens */
@media (max-width: 480px) {
  .notif-panel {
    width: calc(100vw - 28px);
    right: 0;
    left: 0;
    margin: 0 14px;
  }
}

/* Buttons: ensure minimum tap target everywhere */
@media (max-width: 960px) {
  .btn {
    min-height: 40px;
  }
  .btn-sm {
    min-height: 34px;
  }
  .icon-btn {
    width: 40px;
    height: 40px;
  }
}

/* Panel padding: slightly tighter on mobile */
@media (max-width: 600px) {
  .panel {
    border-radius: 12px;
  }
}

/* Safe-area insets for iOS notch/home bar */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 960px) {
    .app .main {
      padding-bottom: calc(28px + env(safe-area-inset-bottom));
    }
    .counter-main {
      padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
  }
}


/* ─────────────────────────────────────────────────────────────
   CONTENT-PAD-FULL — single wrapper pages (customers, analytics,
   settings, billing, qr-center, receipts)
   ──────────────────────────────────────────────────────────── */
.content-pad-full {
  padding: 24px 0 40px;
}

@media (max-width: 600px) {
  .content-pad-full {
    padding: 16px 14px 32px;
  }
}


/* ─────────────────────────────────────────────────────────────
   AUTOMATIONS & CAMPAIGNS — main content area side padding
   proto-layout and campaigns-layout sit inside .main which
   already handles padding via site.css @media. The wizard-wrap
   has its own 20px padding that we tighten above (rule 6).
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .proto-layout,
  .campaigns-layout {
    /* main padding already drops to 16px — no extra needed */
    gap: 12px;
  }
}


/* ─────────────────────────────────────────────────────────────
   GLOBAL WIDTH + PADDING FIX
   Problem: .main has padding:28px desktop, overridden to 16px
   at ≤600px. content-pad-* wrappers add ANOTHER 14-28px on top.
   = double padding, content looks narrow.
   Fix: zero out .main horizontal padding on mobile so only the
   content-pad wrappers own the side spacing. Desktop untouched.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  /* Clip at body level — does NOT kill internal scrollable children */
  body { overflow-x: hidden; }
  .app {
    width: 100%;
  }
  /* Zero .main side padding — content-pad-* classes handle it */
  .app .main {
    padding-left: 0;
    padding-right: 0;
    width: 100%;
    min-width: 0;
  }
  /* content-pad wrappers: 16px sides at 960px */
  .content-pad-top {
    padding-left: 16px;
    padding-right: 16px;
  }
  .content-pad-main {
    padding-left: 16px;
    padding-right: 16px;
  }
  .content-pad-full {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 600px) {
  .app .main {
    padding-left: 0;
    padding-right: 0;
    /* No overflow-x:hidden here — kills table scroll */
  }
  /* Tighter at small phones */
  .content-pad-top {
    padding-left: 14px;
    padding-right: 14px;
    padding-top: 14px;
  }
  .content-pad-main {
    padding-left: 14px;
    padding-right: 14px;
  }
  .content-pad-full {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* Billing Upgrade plan btn — now handled by .mob-actions */


/* ─────────────────────────────────────────────────────────────
   INDEX — Mobile content reorder
   "Launch readiness" and "Business status" cards need to appear
   ABOVE the kpi-strip on mobile. We duplicate them in the HTML
   inside .mob-top-cards (mobile-only container inserted before
   kpi-strip), and hide the originals inside overview-grid.
   On desktop: mob-top-cards is display:none; originals show.
   ──────────────────────────────────────────────────────────── */

/* Desktop: hide the mobile-only duplicate block */
.mob-top-cards {
  display: none;
}

@media (max-width: 960px) {
  /* Show the mobile block above kpi-strip */
  .mob-top-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }

  /* Hide the originals inside overview-grid on mobile */
  .mob-readiness,
  .mob-biz-status {
    display: none !important;
  }

  /* Style the cloned biz-sc inside mob-top-cards */
  .mob-top-cards .biz-sc {
    border-radius: var(--radius);
    padding: 13px 16px;
  }

  /* Style the cloned readiness panel */
  .mob-top-cards .panel {
    margin-bottom: 0;
  }
}

/* ob-wrap banner now handled via CSS classes in HTML */

/* ─────────────────────────────────────────────────────────────
   INDEX — mob-top-cards (Business status + Launch readiness)
   When setup is complete the green banner replaces ob-wrap.
   The readiness + status cards are still useful for context
   but should be more compact on mobile.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  /* Business status clone in mob-top-cards */
  .mob-top-cards .biz-sc {
    padding: 12px 14px;
    gap: 10px;
  }
  .mob-top-cards .biz-sc .lbl {
    font-size: .66rem;
    margin-bottom: 2px;
  }
  .mob-top-cards .biz-sc .val {
    font-size: .88rem;
    margin-bottom: 1px;
  }
  .mob-top-cards .biz-sc .note {
    font-size: .72rem;
  }
  /* Launch readiness clone — compact section head */
  .mob-top-cards .panel .section-head {
    padding: 12px 14px 0;
  }
  .mob-top-cards .panel .section-head h3 {
    font-size: .88rem;
  }
  .mob-top-cards .panel .section-head p {
    font-size: .74rem;
  }
  .mob-top-cards .panel .section-body {
    padding: 10px 14px 14px;
  }
}


/* ─────────────────────────────────────────────────────────────
   CUSTOMERS PAGE — mobile layout
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  /* ── Filter bar ── */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .filter-search {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100%;
    font-size: .88rem;
  }
  /* Chips scroll horizontally in one row */
  .filter-chips-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 3px;
  }
  .filter-chips-row::-webkit-scrollbar { display: none; }
  .filter-chip {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 11px;
    font-size: .76rem;
  }

  /* ── Table: hide low-priority columns, no horizontal scroll needed ── */
  /* Keep: Customer (col1), Stage (col2), Reward progress (col3) */
  /* Hide: Visits (col4), Last visit (col5), Actions (col6) */
  .cust-table th:nth-child(4),
  .cust-table td:nth-child(4),
  .cust-table th:nth-child(5),
  .cust-table td:nth-child(5),
  .cust-table th:nth-child(6),
  .cust-table td:nth-child(6) {
    display: none;
  }
  /* Table now fits in screen — no horizontal scroll needed */
  .cust-table {
    min-width: 0 !important;
  }
  .cust-table-wrap {
    overflow-x: visible;
  }
  /* Customer cell: compact */
  .cust-cell {
    min-width: 0 !important;
    gap: 8px;
  }
  .cust-av {
    width: 32px;
    height: 32px;
    font-size: .74rem;
  }
  .cust-name { font-size: .83rem; }
  .cust-sub  { font-size: .71rem; }
  /* Stage pill: compact */
  .stage { font-size: .68rem; padding: 3px 7px; }
  /* Reward progress: compact */
  .prog-wrap { min-width: 0 !important; }
  .prog-label { font-size: .75rem; }
  .prog-meta  { font-size: .7rem; }

  /* ── Right column (hm-row, sum-card, panels) ── */
  .hm-row { grid-template-columns: 1fr !important; }

  /* Segment snapshot CTA — keep but make compact */
  .section-head a.btn-secondary { font-size: .75rem; padding: 5px 9px; }
}


/* ─────────────────────────────────────────────────────────────
   CUSTOMERS — right column overflow fixes
   All content inside cust-grid right col (.stack) was overflowing
   because: justify-content:space-between pushed badges off-screen,
   min-width on cells wasn't constrained, hm-row had no max-width.
   All fixes scoped to ≤960px. Desktop untouched.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {

  /* ── Constrain the right column entirely ── */
  .cust-grid > div,
  .cust-grid .stack {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  /* ── hm (metric cards) ── */
  .hm {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .hm > div {
    min-width: 0;
    overflow: hidden;
  }
  .hm-lbl,
  .hm-sub {
    white-space: normal;
    word-break: break-word;
  }

  /* ── sum-card / sum-line ──
     Desktop: label left, value right (space-between)
     Mobile: stack vertically so nothing overflows           */
  .sum-card {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  .sum-card > p {
    white-space: normal;
    word-break: break-word;
  }
  .sum-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .sum-line span {
    text-align: left;
    font-size: .8rem;
  }
  .sum-line strong {
    font-size: .78rem;
  }

  /* ── seg-item (Segment snapshot + Customer health) ──
     Desktop: title left, badge right (space-between)
     Mobile: badge moves below title text                    */
  .seg-item {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  .seg-item-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .seg-item h5 {
    font-size: .82rem;
  }
  .seg-item p {
    font-size: .74rem;
    white-space: normal;
    word-break: break-word;
    /* Remove text truncation — let it wrap fully */
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }
  .seg-pills {
    flex-wrap: wrap;
  }
  .pill {
    font-size: .73rem;
    padding: 4px 8px;
  }

  /* ── panel section-head inside right col ──
     "Use in campaign" btn: compact               */
  .stack .section-head {
    flex-wrap: wrap;
    gap: 8px;
  }
  .stack .section-head p {
    white-space: normal;
    word-break: break-word;
    overflow: visible;
  }

  /* ── drawer: full-width on mobile ── */
  .drawer {
    width: 100% !important;
    max-width: 480px;
  }
}

/* Customers table rows: tappable on mobile */
@media (max-width: 960px) {
  .cust-table tbody tr:active td {
    background: var(--green-soft);
  }
}


/* ─────────────────────────────────────────────────────────────
   AUTOMATIONS — card style box + review step mobile fixes
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {

  /* ── 3. Card style box: stack vertically on mobile ── */
  .visual-toggle-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .vtoggle {
    width: 100%;
    justify-content: stretch;
    border-radius: var(--radius-sm);
    padding: 3px;
  }
  .vtoggle-btn {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    font-size: .68rem;
    white-space: nowrap;
  }

  /* ── 5. Review step: summary above, card preview below ── */
  .review-summary-grid {
    grid-template-columns: 1fr !important;
  }
  /* Reorder: summary (left col) first, card preview (right col) second */
  /* In single column they already stack: summary top, card bottom ✓ */
  /* Just ensure the card preview comes after the summary */
  #pub-preview {
    margin-top: 4px;
  }
}


/* ─────────────────────────────────────────────────────────────
   AUTOMATIONS — mobile UX improvements
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {

  /* 1. Hide wizard step dots entirely on mobile */
  .wizard-wrap {
    display: none !important;
  }

  /* 2. Center all step CTAs on mobile */
  .step-continue {
    justify-content: center !important;
    flex-wrap: nowrap;
    gap: 8px;
  }
  /* Keep hint text full-width above buttons */
  .step-continue > span[id] {
    width: 100%;
    text-align: center;
    margin-right: 0 !important;
    order: -1;
  }
  /* Make both buttons equal and full-readable */
  .step-continue .btn {
    flex: 1;
    min-width: 0;
    max-width: 200px;
    justify-content: center;
  }

  /* 3. Crop preview + filter panel: stack vertically */
  .crop-flex {
    flex-direction: column !important;
    gap: 12px !important;
  }
  /* Image preview: full width, not fixed 200px */
  .crop-img-wrap {
    width: 100% !important;
    max-width: 100% !important;
    aspect-ratio: 4/5;
  }
  /* Filter thumbnails (image crop panel): horizontal scroll row */
  #cropPreview .filter-bar {
    display: flex;
    flex-direction: row !important;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  #cropPreview .filter-bar::-webkit-scrollbar { display: none; }
  .filter-opt {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
  }
  .filter-opt img {
    width: 52px !important;
    height: 65px !important;
    border-radius: 6px;
    border: 2px solid transparent;
    transition: border-color .15s;
  }
  .filter-opt.active img {
    border-color: var(--green-deep);
  }
  .filter-opt span {
    font-size: .65rem;
    font-weight: 600;
    color: var(--muted);
  }
  .filter-opt.active span {
    color: var(--green-deep);
  }
  /* Use/cancel buttons full width */
  .crop-actions {
    flex-direction: column !important;
  }
  .crop-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* 4. Review summary: clean up pub-details rows */
  #pub-details > div {
    padding: 7px 0 !important;
    font-size: .8rem !important;
  }
  /* Auto name in review: smaller on mobile */
  #pub-auto-name {
    font-size: .85rem !important;
    line-height: 1.3;
  }
  #pub-trigger {
    font-size: .72rem !important;
  }

  /* Review detail rows: stack on mobile for long values */
  .review-detail-row {
    flex-direction: column;
    gap: 2px;
  }
  .review-detail-val {
    text-align: left !important;
    font-size: .8rem;
  }
  .review-summary-panel {
    min-width: 0;
  }
}


/* ─────────────────────────────────────────────────────────────
   AUTOMATIONS — step-card-head mobile fix
   On mobile the step header [num][title+sub][badge] runs out
   of space. Fix: badge drops below title on a second row.
   Also fix oversized CTA buttons text.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {

  /* Step header: allow wrapping so badge drops to second row */
  .step-card-head {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
  }
  /* Number circle: stays top-left */
  .step-num {
    flex-shrink: 0;
    margin-top: 2px;
  }
  /* Title + subtitle: takes available space, wraps naturally */
  .step-card-head > div:nth-child(2) {
    flex: 1;
    min-width: 0;
  }
  .step-title {
    font-size: .84rem;
    white-space: normal;
    word-break: break-word;
  }
  .step-sub {
    font-size: .73rem;
    white-space: normal;
  }
  /* Badge: full width on its own row below title */
  .step-badge {
    width: 100%;
    margin-left: 36px; /* align with title, past the number */
    font-size: .72rem;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
  }

  /* CTA buttons with long text: allow text wrap or shrink font */
  .step-continue .btn-primary,
  .step-continue .btn-secondary {
    font-size: .76rem;
    padding: 7px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}


/* ─────────────────────────────────────────────────────────────
   AUTOMATIONS — step summary badge overflow fix
   .badge has white-space:nowrap globally. On mobile, badges
   inside .step-badge (the summary line below each step title)
   must wrap to avoid horizontal overflow.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .step-badge .badge {
    white-space: normal;
    word-break: break-word;
    text-align: left;
    border-radius: 8px; /* less pill-like when wrapping */
    line-height: 1.4;
    max-width: 100%;
    display: inline-block;
  }
  /* Ensure step-badge container itself doesn't overflow */
  .step-badge {
    max-width: calc(100% - 36px);
    overflow: hidden;
  }
}


/* ─────────────────────────────────────────────────────────────
   CAMPAIGNS — mobile UX (mirrors automations fixes)
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {

  /* 1-3. Step headers: allow badge to drop below title */
  .step-head {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }
  .step-head > div:nth-child(2) {
    flex: 1;
    min-width: 0;
  }
  .step-head .step-title {
    font-size: .84rem;
    white-space: normal;
    word-break: break-word;
  }
  .step-head .step-sub {
    font-size: .73rem;
    white-space: normal;
    word-break: break-word;
  }
  .step-head .step-badge {
    width: 100%;
    margin-left: 34px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
    font-size: .72rem;
  }
  .step-head .step-badge .badge {
    white-space: normal;
    word-break: break-word;
    border-radius: 8px;
    line-height: 1.4;
    max-width: 100%;
    display: inline-block;
    text-align: left;
  }

  /* 4. CTAs centered, compact text */
  .campaigns-layout .step-continue,
  #sc1 .step-continue, #sc2 .step-continue,
  #sc3 .step-continue, #sc4 .step-continue,
  #sc5 .step-continue, #sc6 .step-continue,
  #sc7 .step-continue, #sc8 .step-continue {
    justify-content: center !important;
    flex-wrap: wrap;
    gap: 8px;
  }
  .campaigns-layout .step-continue .btn,
  #sc1 .step-continue .btn, #sc2 .step-continue .btn,
  #sc3 .step-continue .btn, #sc4 .step-continue .btn,
  #sc5 .step-continue .btn, #sc6 .step-continue .btn,
  #sc7 .step-continue .btn, #sc8 .step-continue .btn {
    flex: 1;
    min-width: 110px;
    max-width: 190px;
    justify-content: center;
    font-size: .76rem;
    padding: 7px 10px;
  }
  .campaigns-layout .step-continue > span,
  #sc3 .step-continue > span,
  #sc5 .step-continue > span {
    width: 100%;
    text-align: center;
    order: -1;
    margin-right: 0 !important;
  }

  /* 6. cropPreview: stack vertically (same as automations) */
  .crop-flex {
    flex-direction: column !important;
    gap: 12px !important;
  }
  .crop-img-wrap {
    width: 100% !important;
    max-width: 100% !important;
  }
  #cropPreview .filter-bar {
    display: flex;
    flex-direction: row !important;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  #cropPreview .filter-bar::-webkit-scrollbar { display: none; }
  .crop-actions {
    flex-direction: column !important;
  }
  .crop-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Wizard phases bar: hide on mobile (redundant with step heads) */
  .wizard-phases {
    display: none;
  }
}

@media (max-width: 960px) {
  /* Card design hint: center on mobile */
  .step3-hint {
    text-align: center !important;
  }
  /* Review summary value: word-break on mobile */
  .review-detail-val {
    white-space: normal !important;
    word-break: break-word;
    text-align: left !important;
    max-width: none !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
}


/* ─────────────────────────────────────────────────────────────
   CAMPAIGNS — schedule step + review step mobile fixes
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {

  /* ── Schedule step (step 6) ── */
  /* Header: label left, suggested badge below */
  .sched-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .sched-suggested-badge {
    white-space: normal;
    word-break: break-word;
  }
  /* Date/time grid: 1 col on small mobile */
  .sched-grid {
    grid-template-columns: 1fr 1fr; /* keep 2 cols — they're short */
  }
  /* Duration pills: scroll horizontally */
  .sched-duration-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .sched-duration-row::-webkit-scrollbar { display: none; }
  .sched-dur-pills {
    flex-wrap: nowrap;
  }

  /* ── Review step (step 7) ── */
  /* 2-col grid → 1 col: summary first, card preview below */
  .review-summary-grid {
    grid-template-columns: 1fr !important;
  }
  /* Campaign name input: full width, readable */
  #campNameInput {
    font-size: .82rem !important;
    width: 100% !important;
  }
  /* pub-details rows: stack key/value */
  #pub-details .review-detail-row {
    flex-direction: column;
    gap: 1px;
    padding: 6px 0;
  }
  #pub-details .review-detail-key {
    font-size: .72rem;
  }
  #pub-details .review-detail-val {
    text-align: left !important;
    white-space: normal !important;
    word-break: break-word;
    font-size: .8rem;
  }
  /* pub-segment line: wrap */
  #pub-segment {
    white-space: normal;
    word-break: break-word;
    font-size: .73rem;
  }
  /* Launch button: full width centered */
  #sc8 .step-continue .btn-primary {
    justify-content: center;
  }
}

@media (max-width: 600px) {
  /* On very small screens, date grid goes 1 col */
  .sched-grid {
    grid-template-columns: 1fr;
  }
}


/* ─────────────────────────────────────────────────────────────
   SETTINGS — mobile fixes + status colors
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  /* Receipt hint / service model note: wrap properly */
  .receipt-hint {
    flex-direction: column;
    gap: 4px;
    word-break: break-word;
    white-space: normal;
  }
  .receipt-hint::before {
    display: none; /* remove duplicate emoji since JS also adds 💡 */
  }

  /* Service cards grid: 2 cols works fine, just tighten */
  .service-cards {
    gap: 8px;
  }
  .service-card {
    font-size: .82rem;
  }
  .service-card h5 {
    font-size: .82rem;
  }
  .service-card p {
    font-size: .72rem;
  }

  /* KPI cards in settings: status card with color is already done via JS */
  /* Ensure kpi-value wraps on mobile */
  #kpiStatus, #kpiVerif, #kpiSources, #kpiLogo {
    font-size: 1.15rem !important;
    line-height: 1.2;
    word-break: break-word;
  }
}


/* ─────────────────────────────────────────────────────────────
   SETTINGS / BUSINESS PROFILE — mobile layout polish
   All scoped to ≤960px. Desktop untouched.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {

  /* ── GLOBAL: sl layout already 1-col at ≤1180px — fine ── */

  /* ── builder-step cards: tighter padding ── */
  .builder-step {
    padding: 16px 14px;
    margin-bottom: 12px;
  }

  /* step-head settings: see section below */

  /* ── LOGO SECTION ── */
  .logo-upload-row {
    flex-direction: column;
    gap: 14px;
  }
  .logo-preview-outer {
    align-self: flex-start;
  }
  .logo-upload-info {
    min-width: 0;
    width: 100%;
  }
  .logo-dz {
    padding: 16px;
  }
  .logo-impact {
    grid-template-columns: 1fr 1fr 1fr; /* keep 3 cols — they're small */
  }
  .logo-impact-item .lb {
    font-size: .6rem;
  }

  /* ── IDENTITY (step 1): form-grid → 1 col ── */
  .builder-step .form-grid {
    grid-template-columns: 1fr !important;
  }
  /* Phone field: stack badge and change link */
  .phone-field-wrap {
    flex-wrap: wrap;
    gap: 6px;
  }
  .phone-field-wrap .input {
    width: 100%;
  }

  /* ── ADDRESS (step 2): keep city/state side by side, zip/country side by side ── */
  .addr-grid {
    grid-template-columns: 1fr 1fr; /* keep 2 cols — 4 fields fit nicely */
  }
  .addr-grid .full {
    grid-column: 1 / -1; /* street = full width */
  }
  .addr-note {
    font-size: .72rem;
    white-space: normal;
    word-break: break-word;
  }

  /* ── LINKS (step 3): 1 col for inputs — each input full width ── */
  /* form-grid already forced to 1fr above — links inputs get full width ✓ */

  /* ── SERVICE MODEL (step 4) ── */
  .service-grid {
    grid-template-columns: 1fr 1fr; /* keep 2 cols */
    gap: 7px;
  }
  .service-card {
    padding: 10px 11px;
  }
  .service-card h5 {
    font-size: .8rem;
  }
  .service-card p {
    font-size: .72rem;
  }
  /* delivery-group-label full row */
  .delivery-group-label {
    grid-column: 1 / -1;
    font-size: .65rem;
  }

  /* receipt-hint: fix duplicate emoji + wrap ── */
  .receipt-hint {
    flex-direction: column;
    gap: 4px;
    word-break: break-word;
    white-space: normal;
    font-size: .74rem;
  }
  .receipt-hint::before {
    display: none; /* JS already injects 💡 in the text */
  }

  /* ── HAPPY HOUR: day pills wrap ── */
  #hhFields > div:first-child > div {
    flex-wrap: wrap;
    gap: 5px;
  }

  /* ── Save/discard CTAs ── */
  .set-actions,
  .settings-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ── Step-head in settings: match campaigns style ──
     Make the kicker (number/emoji box) top-aligned with title,
     and let the title+sub stack naturally like campaigns.      */
  .builder-step .step-head {
    align-items: flex-start;
    gap: 10px;
  }
  /* Make step-kicker look like campaigns step-num: circle, centered */
  .step-kicker {
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    border-radius: 50% !important;  /* circle like campaigns */
    font-size: .72rem !important;
    flex-shrink: 0;
    flex: 0 0 auto !important;
    margin-top: 0;
  }
  /* Only the TEXT div (second child) gets flex:1 — NOT the kicker */
  .builder-step .step-head > div:last-child {
    flex: 1;
    min-width: 0;
  }
  .builder-step .step-head h4 {
    font-size: .88rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 2px;
    white-space: normal;
    word-break: break-word;
  }
  .builder-step .step-head p {
    font-size: .75rem;
    color: var(--muted);
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
    margin: 0;
  }

  /* ── ZIP/Country row: align-items:start so field-note doesn't push ZIP ── */
  .addr-grid .form-row {
    align-items: flex-start;
  }

  /* ── Happy Hour preview box ── */
  .hh-preview-box {
    padding: 12px;
  }
  .hh-preview-row {
    flex-wrap: wrap;
    gap: 4px 6px;
    align-items: flex-start;
    line-height: 1.4;
  }
  /* Each span in the preview wraps naturally */
  .hh-preview-row > span {
    flex-shrink: 0;
  }
  /* The separator dot: hide on wrap since layout handles spacing */
  .hh-preview-row > span[style*="var(--muted)"] {
    display: none;
  }
}

@media (max-width: 600px) {
  /* On very small phones: addr grid goes 1 col */
  .addr-grid {
    grid-template-columns: 1fr;
  }
  .addr-grid .full {
    grid-column: 1;
  }
  /* service-grid: still 2 cols on small — delivery cards have short content */
}

/* ─────────────────────────────────────────────────────────────
   AUTOMATIONS — Review step mobile fix
   The "Listo para activar" banner and bottom bar need better
   spacing and wrapping on narrow viewports.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Review step: ready banner needs breathing room */
  #sc8 .step-body > div[style*="max-width:420px"] {
    max-width: 100% !important;
    padding: 12px 12px !important;
  }
  #sc8 .step-body > div[style*="max-width:420px"] > div {
    font-size: .74rem !important;
    line-height: 1.6 !important;
    word-break: break-word;
  }
  /* Card preview: full width on mobile */
  #sc8 .step-body > div[style*="max-width:340px"] {
    max-width: 100% !important;
  }
  /* Bottom bar buttons: stack on very narrow */
  .wiz-bottombar {
    gap: 8px;
  }
  .step-continue {
    flex-wrap: wrap;
    gap: 8px;
  }
  .step-continue .btn {
    font-size: .76rem !important;
    padding: 9px 14px !important;
  }
}


/* ─────────────────────────────────────────────────────────────
   ONBOARDING & HERO CARDS — mobile polish
   New onboarding is text-only cards (no side images).
   Focus: padding, font sizes, CTA touch targets.
   ──────────────────────────────────────────────────────────── */

/* ── 960px: onboarding cards — layout + breathing ── */
@media (max-width: 960px) {
  /* Welcome hero card */
  #welcomeHero > div {
    border-radius: 16px !important;
    margin-bottom: 16px !important;
  }
  /* GO LIVE card */
  #obWrap > div:first-child {
    padding: 18px 20px 16px !important;
    margin-bottom: 16px !important;
  }
  /* Step cards: breathing between them */
  #os1, #os3 {
    margin-bottom: 16px !important;
  }
  /* Step CTA buttons: centered on mobile */
  #os1 .acc-body a,
  #os3 .acc-body a {
    justify-content: center;
    padding: 12px 18px !important;
    border-radius: 14px;
    box-sizing: border-box;
  }
}

@media (max-width: 600px) {
  /* ── Welcome hero ── */
  #welcomeHero > div {
    margin-bottom: 14px !important;
  }
  #welcomeHero h1 {
    font-size: 1.5rem !important;
  }

  /* ── GO LIVE card ── */
  #obWrap > div:first-child {
    padding: 16px 18px 14px !important;
    margin-bottom: 14px !important;
  }

  /* ── Step cards ── */
  #os1, #os3 {
    margin-bottom: 14px !important;
  }

  /* ── Dashboard hero card ── */
  #heroCard {
    padding: 0 !important;
  }
  #heroCard > div:first-child {
    font-size: 1.1rem !important;
  }
  #heroCard > div:first-child span {
    font-size: 1.3rem !important;
  }

  /* ── Quick actions: tighter on mobile ── */
  .qa-grid {
    gap: 8px !important;
  }
  /* Quick action rows inside card */
  #dcWrap > div[style*="border-radius:16px"] a {
    padding: 14px 16px !important;
  }

  /* ── Onboarding complete banner: stack on narrow ── */
  .ob-complete-banner {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 16px 16px !important;
  }
  .ob-complete-x {
    align-self: flex-start;
  }

  /* ── Hero SVG panels on all pages: shrink ── */
  .main > .content-pad-main > div:first-child > div:last-child {
    min-width: 0;
  }
}

/* ── Customers table: mobile optimization ── */
@media (max-width: 960px) {
  /* ── Customer table: hide columns that don't fit ── */
  .cust-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cust-table-wrap table {
    min-width: 600px;
  }
  /* ── Customer drawer: full width on mobile ── */
  .drawer {
    width: 100% !important;
    max-width: 100vw !important;
  }
  /* ── KPI strip: already handled ── */
}

@media (max-width: 600px) {
  /* ── Filter pills: wrap to 2 rows ── */
  .period-pills {
    flex-wrap: wrap !important;
    gap: 6px;
  }
  .period-pill {
    flex-shrink: 0;
  }

  /* ── Segment snapshot: 1 col ── */
  .seg-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── Human metric row: 1 col ── */
  .hm-grid,
  .hm-row {
    grid-template-columns: 1fr !important;
  }

  /* ── Next best action card: tighter ── */
  .nba {
    padding: 12px 14px !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   ANALYTICS — mobile hero and chart fixes
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* Analytics hero SVG: contain within card */
  .analytics-hero-svg {
    max-width: 80px;
  }
}

/* ─────────────────────────────────────────────────────────────
   RECEIPTS — mobile upload wizard fixes
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* Upload wizard overlay: full screen bottom sheet */
  .receipt-overlay {
    width: 100% !important;
    max-width: 100vw !important;
    border-radius: 16px 16px 0 0 !important;
    bottom: 0 !important;
    top: auto !important;
    max-height: 85vh !important;
  }
  /* How it works card: smaller SVG */
  .receipt-how-svg {
    max-width: 100px;
  }
}

/* ─────────────────────────────────────────────────────────────
   HELP — mobile card grid
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .help-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   BILLING — mobile pricing section
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .billing-feature-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   WIZARD MOBILE — reward types, tone pills, expiration, modals
   ──────────────────────────────────────────────────────────── */
@media (max-width: 400px) {
  /* Reward type grid: 1 col on very narrow phones */
  .rtype-grid {
    grid-template-columns: 1fr !important;
  }
  /* Goal grid in campaigns: 1 col */
  .goal-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 600px) {
  /* Tone pills: horizontal scroll on narrow screens */
  .tone-pills {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .tone-pills::-webkit-scrollbar { display: none; }
  .tone-pill {
    flex-shrink: 0;
  }
  /* Copy variant items: tighter padding */
  .cv-item {
    padding: 8px 10px;
  }
  .cv-tone-tag {
    width: 62px;
    font-size: .52rem;
  }
  /* Expiration pills: wrap gracefully */
  .rexpiry-pills {
    gap: 5px;
  }
  .rexpiry-pill {
    min-width: 60px;
    padding: 7px 10px;
  }
  /* Step continue row: stack on narrow */
  .step-continue {
    flex-wrap: wrap;
    gap: 8px;
  }
  .step-continue .btn {
    flex: 1;
    min-width: 110px;
  }
}

/* ─────────────────────────────────────────────────────────────
   HERO CARDS — keep horizontal but shrink SVG on narrow screens
   ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  /* Available automation cards: shrink hero SVG panel */
  div[style*="flex-shrink:0;width:120px"][style*="place-items:center"] {
    width: 90px !important;
    padding: 8px 10px 8px 0 !important;
  }
  div[style*="flex-shrink:0;width:120px"][style*="place-items:center"] svg {
    width: 70px !important;
    height: 70px !important;
  }
  /* Hero card SVG panels: shrink but stay horizontal */
  div[style*="flex-shrink:0;width:140px"],
  div[style*="flex-shrink:0;width:120px"] {
    width: 90px !important;
    padding: 10px 8px 10px 0 !important;
  }
  div[style*="flex-shrink:0;width:140px"] svg,
  div[style*="flex-shrink:0;width:120px"] svg {
    width: 80px !important;
    height: 80px !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   ONBOARDING IMAGES — constrain PNG sizes on mobile
   Only ob-hero.png is still in use (welcome hero card).
   ob-clock, ob-store, ob-gift removed from HTML in session 10.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* Dashboard hero image (not onboarding) */
  img[src*="dash-hero"] {
    max-height: 100px !important;
    object-fit: contain;
  }
  /* ob-hero: let it flow naturally — width:100% in HTML handles sizing */
}

/* ─────────────────────────────────────────────────────────────
   STATS + THRESHOLD MODALS — mobile full width
   ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #statsModal > div,
  #thresholdModal > div,
  #rcpModal > div {
    max-width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 90vh !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SETTINGS — Happy Hour preview box on mobile
   ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .hh-preview-box {
    padding: 12px 14px !important;
  }
  .hh-preview-box [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}
