/* ═══════════════════════════════════════════════════════════════
   Deal Drop — Mobile App Shell
   Activates ONLY when <body class="mobile-app"> is present.
   The mobile-app.js sets that class at viewports ≤ 768 px.
   All rules wrapped in @media (max-width: 768px) for safety —
   desktop renders identically to before.
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ---------- 1. iOS auto-zoom prevention + base font sizing ---------- */
  body.mobile-app {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
    overscroll-behavior-y: none;
  }
  body.mobile-app input,
  body.mobile-app select,
  body.mobile-app textarea {
    font-size: 16px;
  }

  /* ---------- 2. Hide desktop chrome ---------- */
  body.mobile-app .gov-strip,
  body.mobile-app .gov-strip-auth,
  body.mobile-app .gov-inner,
  body.mobile-app .navbar,
  body.mobile-app nav.nav,
  body.mobile-app .nav,
  body.mobile-app .nav-burger,
  body.mobile-app .bc {
    display: none !important;
  }

  /* Collapse the demo banner into a slim 4 px gold accent stripe at top */
  body.mobile-app .banner-demo {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 4px;
    padding: 0;
    margin: 0;
    overflow: hidden;
    text-indent: -9999px;
    background: linear-gradient(90deg, #C9A84C 0%, #E8CC80 50%, #C9A84C 100%);
    border: none;
    z-index: 110;
  }
  body.mobile-app.has-banner { padding-top: 0 !important; }

  /* Push body content to clear top header + bottom tab bar */
  body.mobile-app {
    padding-top: 54px !important;
    padding-bottom: calc(60px + env(safe-area-inset-bottom)) !important;
  }
  body.mobile-app.has-cta {
    padding-bottom: calc(120px + env(safe-area-inset-bottom)) !important;
  }

  /* ---------- 3. Top app header ---------- */
  .m-app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 54px;
    background: #0A1628;
    color: #fff;
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 8px;
    box-shadow: 0 1px 8px rgba(10,22,40,0.18);
    border-bottom: 1px solid rgba(201,168,76,0.22);
  }
  .m-app-header .m-h-slot {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    border-radius: 8px;
    text-decoration: none;
    transition: background .12s;
  }
  .m-app-header .m-h-slot:active {
    background: rgba(255,255,255,0.10);
  }
  .m-app-header .m-h-slot[hidden] { display: none; }
  .m-app-header .m-h-title {
    flex: 1 1 auto;
    text-align: center;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 6px;
  }
  .m-app-header .m-h-title em,
  .m-app-header .m-h-title .gold {
    color: #C9A84C;
    font-style: normal;
    font-weight: 700;
  }
  .m-app-header .m-h-title small {
    display: block;
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: rgba(201,168,76,0.85);
    margin-top: -2px;
  }

  /* ---------- 4. Bottom tab bar ---------- */
  .m-tab-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(60px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(10,22,40,0.08);
    z-index: 100;
    display: flex;
    align-items: stretch;
    box-shadow: 0 -2px 14px rgba(10,22,40,0.06);
  }
  .m-tab {
    flex: 1 1 20%;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px 4px;
    border: 0;
    background: transparent;
    color: #6B7C93;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    transition: color .12s;
  }
  .m-tab:active { background: rgba(201,168,76,0.06); }
  .m-tab .m-tab-icon {
    font-size: 22px;
    line-height: 1;
    position: relative;
  }
  .m-tab .m-tab-label {
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: inherit;
  }
  .m-tab .m-tab-badge {
    position: absolute;
    top: 2px;
    right: 22%;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #C0392B;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(192,57,43,0.4);
  }
  .m-tab.active {
    color: #C9A84C;
  }
  .m-tab.active .m-tab-label { color: #8A6E28; }
  .m-tab.active::before {
    content: '';
    position: absolute;
    top: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #C9A84C;
    box-shadow: 0 0 6px rgba(201,168,76,0.6);
  }

  /* ---------- 5. Bottom sheet ---------- */
  .m-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10,22,40,0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
    z-index: 199;
  }
  .m-sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }
  .m-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    transform: translateY(100%);
    transition: transform .25s cubic-bezier(.32,.72,0,1);
    z-index: 200;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    background: #fff;
    box-shadow: 0 -8px 32px rgba(10,22,40,0.18);
    padding: 8px 20px calc(28px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
  }
  .m-sheet.open {
    transform: translateY(0);
    animation: m-slide-up .28s cubic-bezier(.32,.72,0,1);
  }
  .m-sheet::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(0,0,0,0.18);
    border-radius: 2px;
    margin: 8px auto 18px;
  }
  .m-sheet h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 18px;
    font-weight: 600;
    color: #0A1628;
    margin-bottom: 14px;
  }
  .m-sheet .m-sheet-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 4px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    cursor: pointer;
    min-height: 50px;
    color: #0A1628;
  }
  .m-sheet .m-sheet-row:last-child { border-bottom: 0; }
  .m-sheet .m-sheet-row:active { background: rgba(201,168,76,0.06); }
  .m-sheet .m-sheet-row.active { color: #8A6E28; font-weight: 600; }
  .m-sheet .m-sheet-row.active::after {
    content: '✓';
    margin-left: auto;
    color: #C9A84C;
    font-weight: 700;
    font-size: 16px;
  }

  /* ---------- 6. Sticky bottom CTA ---------- */
  .m-bottom-cta {
    position: fixed;
    bottom: calc(60px + env(safe-area-inset-bottom));
    left: 0; right: 0;
    padding: 12px 16px;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(10,22,40,0.08);
    z-index: 90;
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: 0 -4px 16px rgba(10,22,40,0.06);
  }
  .m-bottom-cta .m-cta-meta {
    flex: 0 0 auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    font-weight: 600;
    color: #C0392B;
    background: #FDECEA;
    padding: 8px 10px;
    border-radius: 8px;
    line-height: 1.1;
    white-space: nowrap;
    text-align: center;
  }
  .m-bottom-cta .m-cta-meta small {
    display: block;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(192,57,43,0.7);
    margin-bottom: 2px;
  }
  .m-bottom-cta .m-cta-btn {
    flex: 1 1 auto;
    min-height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #C9A84C 0%, #8A6E28 100%);
    color: #fff;
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(201,168,76,0.32);
    transition: transform .12s, box-shadow .12s;
  }
  .m-bottom-cta .m-cta-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(201,168,76,0.3);
  }

  /* ---------- 7. iOS-style settings list ---------- */
  .m-list {
    background: #fff;
    margin: 12px 16px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(10,22,40,0.05);
  }
  .m-list-h {
    padding: 14px 18px 6px;
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: #6B7C93;
    margin: 8px 16px -6px;
  }
  .m-list-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    min-height: 54px;
    cursor: pointer;
    transition: background .12s;
    color: #0A1628;
    text-decoration: none;
  }
  .m-list-row:last-child { border-bottom: 0; }
  .m-list-row:active { background: rgba(201,168,76,0.08); }
  .m-list-row .m-li-icon {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
  }
  .m-list-row .m-li-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .m-list-row .m-li-label {
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 14.5px;
    font-weight: 600;
    color: #0A1628;
    line-height: 1.25;
  }
  .m-list-row .m-li-sub {
    font-size: 12px;
    color: #6B7C93;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .m-list-row .m-li-val {
    font-size: 13px;
    color: #6B7C93;
    margin-left: auto;
    white-space: nowrap;
  }
  .m-list-row .m-li-chev {
    flex: 0 0 auto;
    color: #9BAABA;
    font-size: 18px;
    line-height: 1;
    margin-left: 4px;
  }
  .m-list-row.danger .m-li-label { color: #C0392B; }

  /* ---------- 8. Filter chip horizontal scroller ---------- */
  .m-chips {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    background: #F2EEE6;
    position: sticky;
    top: 54px;
    z-index: 95;
    border-bottom: 1px solid rgba(201,168,76,0.15);
  }
  .m-chips::-webkit-scrollbar { display: none; }
  .m-chip {
    padding: 7px 14px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    color: #2C3E50;
    white-space: nowrap;
    flex-shrink: 0;
    scroll-snap-align: start;
    cursor: pointer;
    transition: background .12s, border-color .12s;
    -webkit-tap-highlight-color: transparent;
  }
  .m-chip:active { background: rgba(201,168,76,0.1); }
  .m-chip.active {
    background: #0A1628;
    color: #fff;
    border-color: #0A1628;
  }
  .m-chip.m-chip-sort {
    margin-left: auto;
    background: #fff;
    color: #C9A84C;
    border-color: rgba(201,168,76,0.4);
    font-weight: 700;
  }
  .m-chip.m-chip-sort::before {
    content: '⇅ ';
    margin-right: 2px;
  }

  /* ---------- 9. Page-load fade-in ---------- */
  .m-fade-in {
    animation: m-fade-in 0.18s ease-out both;
  }
  @keyframes m-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes m-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  @keyframes m-pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.6; transform: scale(0.85); }
  }

  /* Live status dot */
  .m-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0A7A5A;
    box-shadow: 0 0 0 2px rgba(10,122,90,0.18);
    animation: m-pulse-dot 1.4s ease-in-out infinite;
  }

  /* ---------- 10. Page-specific overrides ---------- */

  /* listings.html — hide sidebar, full-bleed grid */
  body.mobile-app .results { display: block !important; padding: 0 !important; }
  body.mobile-app .sidebar { display: none !important; }
  body.mobile-app .toolbar { display: none !important; }
  body.mobile-app .page-head { padding: 14px 16px 4px !important; }
  body.mobile-app .grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    padding: 12px 16px 24px !important;
  }

  /* listing.html — drop right rail to bottom; CTA replaces panel */
  body.mobile-app .detail-wrap {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 12px !important;
  }
  body.mobile-app .offer-panel {
    position: relative !important;
    top: 0 !important;
    margin-top: 12px !important;
  }
  body.mobile-app .offer-panel.m-hide-on-mobile { display: none !important; }

  /* signin.html / signup.html — full-bleed auth shell */
  body.mobile-app .auth-shell {
    max-width: 100% !important;
    width: 100% !important;
    padding: 16px 0 0 !important;
    min-height: calc(100vh - 54px - 60px) !important;
    display: flex !important;
    flex-direction: column !important;
  }
  body.mobile-app .auth-card {
    border-radius: 16px 16px 0 0 !important;
    margin: 0 !important;
    flex: 1 1 auto;
    border-left: 0 !important;
    border-right: 0 !important;
  }
  body.mobile-app .trust-strip { display: none !important; }
  body.mobile-app .demo-pick.m-hide-on-mobile { display: none !important; }

  /* Hide the page footer on mobile — bottom tab bar replaces it */
  body.mobile-app .dd-footer,
  body.mobile-app footer.footer,
  body.mobile-app .footer-shared { display: none !important; }

  /* Card adjustments for mobile (smaller headlines, reduced padding) */
  body.mobile-app .h1 { font-size: 26px !important; line-height: 1.15 !important; }
  body.mobile-app .h1-sub { font-size: 13px !important; }
  body.mobile-app .eyebrow { font-size: 10px !important; }

  /* Dashboard role cards — list-mode override (added by per-page CSS hooks) */
  body.mobile-app .m-list-mode .role-card,
  body.mobile-app .m-list-mode .dash-card,
  body.mobile-app .m-list-mode .role-grid > * {
    margin: 0 !important;
    border-radius: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
    box-shadow: none !important;
  }

  /* Tap targets — make all .btn taller */
  body.mobile-app .btn,
  body.mobile-app .submit-btn {
    min-height: 46px;
    font-size: 14px;
  }

  /* notifications.html — list-style rows */
  body.mobile-app .notif-wrap { padding: 8px 0 24px !important; max-width: 100% !important; }
  body.mobile-app .notif-wrap > h1 { padding: 12px 16px 0 !important; font-size: 22px !important; }
  body.mobile-app .notif-wrap > .subtitle { padding: 0 16px 8px !important; }
  body.mobile-app .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding: 8px 16px;
    background: #F2EEE6;
    position: sticky;
    top: 54px;
    z-index: 90;
    margin: 0 !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  body.mobile-app .filter-bar::-webkit-scrollbar { display: none; }
  body.mobile-app .filter-bar .chip {
    flex-shrink: 0 !important;
    white-space: nowrap;
  }
  body.mobile-app .notif-list {
    background: #fff;
    margin: 12px 16px;
    border-radius: 14px;
    overflow: hidden;
    gap: 0 !important;
    box-shadow: 0 1px 4px rgba(10,22,40,0.05);
  }
  body.mobile-app .notif {
    border-radius: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
    border-left: 3px solid transparent !important;
    padding: 14px 16px !important;
    min-height: 56px;
  }
  body.mobile-app .notif:last-child { border-bottom: 0 !important; }
  body.mobile-app .notif.unread { border-left-color: #C9A84C !important; }

  /* upload.html — list-style file rows + card-style dropzone */
  body.mobile-app .upload-wrap,
  body.mobile-app .files-wrap {
    padding: 8px 0 24px !important;
    max-width: 100% !important;
  }
  body.mobile-app .upload-wrap > h1,
  body.mobile-app .files-wrap > h1 {
    padding: 12px 16px 0 !important;
    font-size: 22px !important;
  }
  body.mobile-app #dropzone {
    margin: 12px 16px !important;
    border-radius: 14px !important;
  }
  body.mobile-app .file-list,
  body.mobile-app .uploads-list {
    background: #fff;
    margin: 12px 16px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(10,22,40,0.05);
  }
  body.mobile-app .file-row,
  body.mobile-app .uploads-list > * {
    border-radius: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
    padding: 14px 16px !important;
    min-height: 56px;
  }
  body.mobile-app .file-row:last-child,
  body.mobile-app .uploads-list > *:last-child { border-bottom: 0 !important; }

  /* dashboard.html — KPI grid stays visible but more compact */
  body.mobile-app .dash {
    padding: 8px 0 24px !important;
    max-width: 100% !important;
  }
  body.mobile-app .dash > h1,
  body.mobile-app .dash > .subtitle {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  body.mobile-app .kpi-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin: 8px 16px 16px !important;
  }
  body.mobile-app .kpi {
    padding: 12px !important;
  }
  body.mobile-app .kpi-num { font-size: 22px !important; }
  body.mobile-app .kpi-label { font-size: 10.5px !important; }
  body.mobile-app .section-row {
    padding: 0 16px !important;
    margin-bottom: 18px !important;
  }
  body.mobile-app .list-table {
    font-size: 12px;
  }
  body.mobile-app .list-table th,
  body.mobile-app .list-table td {
    padding: 8px 6px !important;
  }
  /* Hide noisy table cols on tiny screens */
  @media (max-width: 480px) {
    body.mobile-app .list-table th:nth-child(2),
    body.mobile-app .list-table td:nth-child(2),
    body.mobile-app .list-table th:nth-child(6),
    body.mobile-app .list-table td:nth-child(6) {
      display: none;
    }
  }

  /* settings.html — section-card single-column, full-bleed */
  body.mobile-app .settings-wrap {
    padding: 8px 0 24px !important;
    max-width: 100% !important;
  }
  body.mobile-app .settings-wrap > h1 {
    padding: 12px 16px 0 !important;
    font-size: 22px !important;
  }
  body.mobile-app .settings-wrap > .subtitle {
    padding: 0 16px !important;
  }
  body.mobile-app .section-card {
    margin: 12px 16px !important;
    border-radius: 14px !important;
    padding: 16px !important;
  }
  body.mobile-app .field-grid {
    grid-template-columns: 1fr !important;
  }

  /* listing.html — sticky offer CTA bumps content up — already in body padding */

}
