/* ============================================================
   MARKETPLACE. — Global Stylesheet
   Cross-browser compatible: Chrome, Firefox, Safari, Edge,
   Samsung Internet, UC Browser, Opera Mini
   Responsive: xs ≤ 360px | sm ≤ 480px | md ≤ 640px
               lg ≤ 768px | xl ≤ 1024px | 2xl ≤ 1280px
   FIXES APPLIED:
   - admin-product-table-wrap: overflow-x scroll restored
   - dash-main padding-top accounts for fixed navbar on all phones
   - sidebar-toggle-btn position changed from absolute→fixed so it
     stays visible when page scrolls
   - auth-card on mobile: min-height prevents card clipping on short
     phones; bottom-sheet only on phones taller than 500px
   - table horizontal scroll wrapper added (.table-scroll)
   - .co-stepper wraps to multiline on very small screens
   - toast z-index raised above modal (9999→10001)
   - qty-btn min tap target 44×44 px on mobile (was 36×36)
   - remove-btn tap target padded to 44px
   - cart-img size reduced on small phones to prevent overflow
   - products-grid starts at 5 col, drops to 1 on ≤360px
   - notif-close tap target padded to 44×44px
   - filter-bar scroll-snap improved with padding-right
   - nav-drawer z-index above sidebar (150→160)
   - page-btn minimum 44×44 on mobile
   - .form-control, .form-input always font-size 16px (prevents iOS zoom)
   - safe-area-inset applied to bottom of page for iPhone home bar
   - .admin-product-table-wrap overflow-x:auto restored (was hidden)
   - added .table-responsive wrapper utility
   - hero min-height: 100svh fallback with 100vh for older browsers
   ============================================================ */

/* ── Reset & base ── */
*,
*::before,
*::after {
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
  margin: 0;
  padding: 0;
  min-width: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
      -ms-text-size-adjust: 100%;
          text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100%;
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
  display: block;
  border-style: none;
}

body {
  font-family: 'Outfit', 'Inter', 'Segoe UI', Arial, sans-serif;
  background: #fff;
  color: #1a1a1a;
  min-height: 100vh;
  overflow-x: hidden;
  /* iPhone home bar padding */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font-family: inherit;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
}

/* ── Design tokens ── */
:root {
  --red:       #e01010;
  --red-dark:  #bb0000;
  --black:     #0a0a0a;
  --dark:      #141414;
  --gray:      #f5f0ee;
  --border:    #e0dbd8;
  --text:      #1a1a1a;
  --muted:     #888888;
  --white:     #ffffff;
  --green:     #22c55e;
  --blue:      #3b82f6;
  --purple:    #8b5cf6;
  --yellow:    #eab308;
  --nav-h:     58px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: -webkit-inline-flex;
  display:         inline-flex;
  -webkit-align-items: center;
          align-items: center;
  -webkit-justify-content: center;
          justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  -webkit-transition: all .15s;
          transition: all .15s;
  letter-spacing: .5px;
  line-height: 1;
  white-space: nowrap;
  font-family: 'Outfit', 'Inter', Arial, sans-serif;
  touch-action: manipulation;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
}
.btn-outline  { background: transparent; border: 1.5px solid var(--white); color: var(--white); }
.btn-outline:hover { background: rgba(255,255,255,.1); }
.btn-red      { background: var(--red); color: var(--white); }
.btn-red:hover{ background: var(--red-dark); }
.btn-black    { background: var(--black); color: var(--white); border: 1.5px solid #444; }
.btn-black:hover{ background: #222222; }
.btn-dark     { background: var(--dark); color: var(--white); }
.btn-sm       { padding: 5px 12px; font-size: 12px; }
.btn-full     { width: 100%; }

/* ============================================================
   TOP NAVBAR
   ============================================================ */
.dash-nav {
  background: var(--black);
  border-bottom: 2px solid var(--red);
  height: var(--nav-h);
  display: -webkit-flex;
  display:         flex;
  -webkit-align-items: center;
          align-items: center;
  -webkit-justify-content: space-between;
          justify-content: space-between;
  padding: 0 28px;
  position: -webkit-sticky;
  position:         sticky;
  top: 0;
  z-index: 100;
  font-family: 'Outfit', 'Inter', Arial, sans-serif;
  /* safe area for notched phones — applied per-breakpoint below too */
  padding-left: max(28px, env(safe-area-inset-left));
  padding-right: max(28px, env(safe-area-inset-right));
}
.dash-nav-brand {
  font-family: 'Bebas Neue', Impact, 'Arial Narrow', sans-serif;
  font-size: 26px;
  letter-spacing: 2px;
  color: #fff;
  text-decoration: none;
  font-weight: 400;
  -webkit-flex-shrink: 0;
          flex-shrink: 0;
}
.dash-nav-brand span { color: var(--red); }
.dash-nav-right {
  display: -webkit-flex;
  display:         flex;
  -webkit-align-items: center;
          align-items: center;
  gap: 10px;
}

.dash-cart-btn {
  position: relative;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #fff;
  display: -webkit-flex;
  display:         flex;
  -webkit-align-items: center;
          align-items: center;
  /* 44px tap target */
  padding: 10px 8px;
  text-decoration: none;
  touch-action: manipulation;
}
.dash-cart-count {
  position: absolute;
  top: 4px;
  right: 2px;
  background: var(--red);
  color: #fff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 10px;
  font-weight: 700;
  display: -webkit-flex;
  display:         flex;
  -webkit-align-items: center;
          align-items: center;
  -webkit-justify-content: center;
          justify-content: center;
}
.dash-nav-btn {
  background: transparent;
  border: 1.5px solid #333;
  border-radius: 4px;
  color: #fff;
  font-family: 'Outfit', 'Inter', Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3px;
  padding: 7px 16px;
  cursor: pointer;
  text-decoration: none;
  -webkit-transition: border-color .15s, background .15s;
          transition: border-color .15s, background .15s;
  touch-action: manipulation;
}
.dash-nav-btn:hover { border-color: #666; background: rgba(255,255,255,.05); }

.dash-user-badge {
  display: -webkit-flex;
  display:         flex;
  -webkit-align-items: center;
          align-items: center;
  gap: 9px;
  border: 1.5px solid #2a2a2a;
  border-radius: 5px;
  padding: 5px 12px;
  background: #111;
}
.dash-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  display: -webkit-flex;
  display:         flex;
  -webkit-align-items: center;
          align-items: center;
  -webkit-justify-content: center;
          justify-content: center;
  font-size: 11px;
  font-weight: 700;
  -webkit-flex-shrink: 0;
          flex-shrink: 0;
  overflow: hidden;
}
.dash-avatar img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  border-radius: 50%;
}
.dash-user-info  { line-height: 1.2; }
.dash-user-name  { font-size: 13px; font-weight: 600; color: #fff; }
.dash-user-role  { font-size: 11px; color: var(--red); font-weight: 500; }

/* ── Hamburger button ── */
.nav-hamburger {
  display: none;
  -webkit-flex-direction: column;
          flex-direction: column;
  -webkit-justify-content: center;
          justify-content: center;
  -webkit-align-items: center;
          align-items: center;
  gap: 5px;
  background: transparent;
  border: 1.5px solid #333;
  border-radius: 4px;
  /* 44×44 tap target */
  min-width: 44px;
  min-height: 44px;
  padding: 7px 9px;
  cursor: pointer;
  z-index: 200;
  -webkit-flex-shrink: 0;
          flex-shrink: 0;
  touch-action: manipulation;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
}
.nav-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  -webkit-transition: all .25s ease;
          transition: all .25s ease;
}
.nav-hamburger.open span:nth-child(1) {
  -webkit-transform: translateY(7px) rotate(45deg);
          transform: translateY(7px) rotate(45deg);
}
.nav-hamburger.open span:nth-child(2) {
  opacity: 0;
  -webkit-transform: scaleX(0);
          transform: scaleX(0);
}
.nav-hamburger.open span:nth-child(3) {
  -webkit-transform: translateY(-7px) rotate(-45deg);
          transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile nav drawer ── */
.nav-drawer {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: #111;
  border-bottom: 2px solid var(--red);
  z-index: 160;
  padding: 16px 20px 20px;
  -webkit-flex-direction: column;
          flex-direction: column;
  gap: 6px;
  -webkit-box-shadow: 0 8px 32px rgba(0,0,0,.5);
          box-shadow: 0 8px 32px rgba(0,0,0,.5);
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}
.nav-drawer.open { display: -webkit-flex; display: flex; }
.nav-drawer a,
.nav-drawer .nav-drawer-btn {
  display: block;
  width: 100%;
  /* 44px min tap target */
  min-height: 44px;
  padding: 11px 16px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px;
  -webkit-transition: background .15s;
          transition: background .15s;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: 'Outfit', 'Inter', Arial, sans-serif;
}
.nav-drawer a:hover,
.nav-drawer .nav-drawer-btn:hover { background: rgba(255,255,255,.08); }
.nav-drawer-divider { height: 1px; background: #222; margin: 4px 0; }
.nav-drawer-user {
  display: -webkit-flex;
  display:         flex;
  -webkit-align-items: center;
          align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #1a1a1a;
  border-radius: 6px;
  margin-bottom: 8px;
}
.drawer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  display: -webkit-flex;
  display:         flex;
  -webkit-align-items: center;
          align-items: center;
  -webkit-justify-content: center;
          justify-content: center;
  font-size: 13px;
  font-weight: 700;
  -webkit-flex-shrink: 0;
          flex-shrink: 0;
  overflow: hidden;
}
.drawer-avatar img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  border-radius: 50%;
}
.drawer-info  { line-height: 1.3; }
.drawer-name  { font-size: 14px; font-weight: 700; color: #fff; }
.drawer-role  { font-size: 12px; color: var(--red); }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.dash-layout {
  display: -webkit-flex;
  display:         flex;
  min-height: calc(100vh - var(--nav-h));
  background: var(--gray);
  font-family: 'Outfit', 'Inter', Arial, sans-serif;
}

/* ── Sidebar ── */
.dash-sidebar {
  width: 180px;
  min-width: 180px;
  background: #fff;
  border-right: 1px solid #e8e3e0;
  padding: 32px 0 24px;
  -webkit-transition: left .28s cubic-bezier(.4,0,.2,1);
          transition: left .28s cubic-bezier(.4,0,.2,1);
  -webkit-flex-shrink: 0;
          flex-shrink: 0;
}
.dash-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #bbb;
  padding: 0 24px 18px;
}
.dash-sidebar-nav {
  display: -webkit-flex;
  display:         flex;
  -webkit-flex-direction: column;
          flex-direction: column;
}
.dash-sidebar-link {
  display: block;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  color: #444;
  text-decoration: none;
  border-left: 3px solid transparent;
  -webkit-transition: all .12s;
          transition: all .12s;
  touch-action: manipulation;
  /* 44px tap target */
  min-height: 44px;
  display: -webkit-flex;
  display:         flex;
  -webkit-align-items: center;
          align-items: center;
}
.dash-sidebar-link:hover { color: var(--red); background: #fef5f5; }
.dash-sidebar-link.active {
  color: var(--red);
  font-weight: 600;
  border-left-color: var(--red);
  background: #fff;
}
.admin-sidebar { padding: 40px 0 24px; border-right: 1px solid #ebebeb; }
.admin-sidebar .dash-sidebar-nav { gap: 2px; }
.admin-sidebar .dash-sidebar-link { padding: 9px 28px; font-size: 15px; font-weight: 400; }

/* ── Sidebar toggle (mobile) ── */
.sidebar-toggle-btn {
  display: none;
  -webkit-align-items: center;
          align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e8e3e0;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  margin-bottom: 16px;
  width: 100%;
  font-family: 'Outfit', 'Inter', Arial, sans-serif;
  touch-action: manipulation;
  min-height: 44px;
}
.sidebar-toggle-btn svg { width: 18px; height: 18px; -webkit-flex-shrink: 0; flex-shrink: 0; }

/* ── Sidebar overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,.4);
  z-index: 90;
}
.sidebar-overlay.open { display: block; }

/* ── Main content area ── */
.dash-main {
  -webkit-flex: 1;
          flex: 1;
  padding: 32px 40px;
  background: var(--gray);
  min-width: 0;
}
.dash-page-title { font-size: 30px; font-weight: 800; margin-bottom: 4px; }
.dash-page-sub   { color: var(--muted); font-size: 14px; margin-bottom: 28px; }

/* ── Stat grids ── */
.dash-stat-grid {
  display: -ms-grid;
  display:     grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.admin-stat-grid {
  display: -ms-grid;
  display:     grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-grid {
  display: -ms-grid;
  display:     grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.dash-stat-card {
  background: #fff;
  border: 1px solid #e8e3e0;
  border-radius: 8px;
  padding: 32px 24px;
  text-align: center;
}
.dash-stat-num {
  font-family: 'Bebas Neue', Impact, 'Arial Narrow', sans-serif;
  font-size: 56px;
  font-weight: 400;
  color: var(--red);
  line-height: 1;
  letter-spacing: 1px;
}
.dash-stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #aaa;
  margin-top: 10px;
}
.admin-stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 18px;
}
.admin-stat .num { font-size: 36px; font-weight: 900; color: var(--red); }
.admin-stat .lbl {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--muted); margin-top: 4px;
}
.stat-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; padding: 28px 24px; text-align: center;
}
.stat-card .stat-num   { font-size: 48px; font-weight: 900; color: var(--red); line-height: 1; }
.stat-card .stat-label {
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--muted); margin-top: 8px;
}

/* ── Weekly chart ── */
.dash-chart-card {
  background: #fff; border: 1px solid #e0dbd8;
  border-radius: 16px; padding: 28px 32px 24px; margin-bottom: 24px;
}
.dash-chart-title {
  font-size: 22px; font-weight: 800; color: #111; margin-bottom: 32px;
  font-family: 'Outfit', 'Inter', Arial, sans-serif;
}
.dash-bar-chart {
  display: -webkit-flex;
  display:         flex;
  -webkit-flex-direction: row;
          flex-direction: row;
  -webkit-align-items: flex-end;
          align-items: flex-end;
  -webkit-justify-content: space-between;
          justify-content: space-between;
  gap: 10px;
  height: 180px;
}
.dash-bar-col {
  -webkit-flex: 1;
          flex: 1;
  display: -webkit-flex;
  display:         flex;
  -webkit-flex-direction: column;
          flex-direction: column;
  -webkit-align-items: center;
          align-items: center;
  -webkit-justify-content: flex-end;
          justify-content: flex-end;
  height: 100%;
  gap: 8px;
}
.dash-bar-wrap {
  -webkit-flex: 1;
          flex: 1;
  width: 100%;
  display: -webkit-flex;
  display:         flex;
  -webkit-align-items: flex-end;
          align-items: flex-end;
  min-height: 0;
}
.dash-bar {
  width: 100%;
  background: var(--red);
  border-radius: 10px 10px 4px 4px;
  min-height: 20px;
  -webkit-transition: height .3s ease;
          transition: height .3s ease;
}
.dash-bar-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: #aaa;
}

/* ── Tables ── */
.dash-table-card {
  background: #fff; border: 1px solid #e8e3e0;
  border-radius: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.table-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
/* FIX: responsive table wrapper utility */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: -ms-autohiding-scrollbar;
}
.dash-table-header,
.table-card-header {
  padding: 13px 20px; font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; color: #aaa;
  background: #fef5f5; border-bottom: 1px solid #e8e3e0;
}
.dash-table,
table {
  width: 100%; border-collapse: collapse; min-width: 540px;
}
.dash-table thead th,
thead th {
  padding: 11px 18px; background: #fef5f5;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: #bbb; text-align: left;
  border-bottom: 1px solid #ede8e5; white-space: nowrap;
}
.dash-table tbody tr,
tbody tr { border-top: 1px solid #f0ebe8; -webkit-transition: background .1s; transition: background .1s; }
.dash-table tbody tr:hover,
tbody tr:hover { background: #fafafa; }
.dash-table tbody td,
tbody td { padding: 13px 18px; font-size: 14px; color: #333; }

/* FIX: admin-product-table-wrap — was overflow-x:hidden, now auto */
.admin-product-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}
.admin-product-cards * {
  max-width: 100%;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
}

/* ── Two-column admin grid ── */
.admin-two-col-grid {
  display: -ms-grid;
  display:     grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ── Section helpers ── */
.section-header {
  display: -webkit-flex;
  display:         flex;
  -webkit-align-items: center;
          align-items: center;
  -webkit-justify-content: space-between;
          justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 18px; font-weight: 700; }
.top-actions {
  display: -webkit-flex;
  display:         flex;
  -webkit-justify-content: flex-end;
          justify-content: flex-end;
  margin-bottom: 20px;
}
.action-btns {
  display: -webkit-flex;
  display:         flex;
  gap: 6px;
  -webkit-flex-wrap: wrap;
          flex-wrap: wrap;
}
.page-title    { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.page-subtitle { color: var(--muted); font-size: 14px; margin-bottom: 28px; }

/* ── Filter row ── */
.page-filter-row {
  display: -webkit-flex;
  display:         flex;
  -webkit-align-items: center;
          align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  -webkit-flex-wrap: wrap;
          flex-wrap: wrap;
}

/* ============================================================
   FORMS & AUTH
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
/* FIX: Always 16px to prevent iOS Safari zoom-on-focus */
.form-control {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 4px; font-size: 16px; outline: none;
  -webkit-transition: border .15s; transition: border .15s;
  background: #fff; font-family: 'Outfit', 'Inter', Arial, sans-serif;
  color: var(--text); -webkit-appearance: none; -moz-appearance: none;
  appearance: none; -webkit-box-shadow: none; box-shadow: none;
}
.form-control:focus { border-color: var(--red); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-grid-2 {
  display: -ms-grid;
  display:     grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; padding: 28px 28px 32px; margin-bottom: 20px;
}
.form-card-title { font-size: 20px; font-weight: 700; margin-bottom: 20px; }

/* Auth page */
.auth-page {
  background: radial-gradient(ellipse at 50% 0%, #8b0000 0%, #3d0000 30%, var(--black) 70%);
  background-color: var(--black);
  min-height: calc(100vh - var(--nav-h));
  display: -webkit-flex;
  display:         flex;
  -webkit-align-items: center;
          align-items: center;
  -webkit-justify-content: center;
          justify-content: center;
  padding: 40px 16px;
}
.auth-card {
  background: #fff; border-radius: 10px; padding: 36px 36px 40px;
  width: 100%; max-width: 440px;
  -webkit-box-shadow: 0 20px 60px rgba(0,0,0,.4);
          box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.auth-card .brand {
  font-size: 24px; font-weight: 900;
  letter-spacing: -1px; text-transform: uppercase;
}
.auth-card .brand span { color: var(--red); }
.auth-card .subtitle { color: var(--muted); font-size: 14px; margin-top: 2px; }

.tab-switch {
  display: -webkit-flex;
  display:         flex;
  border: 1.5px solid var(--border);
  border-radius: 4px; margin: 20px 0 24px; overflow: hidden;
}
.tab-switch button {
  -webkit-flex: 1; flex: 1;
  padding: 9px; border: none; background: #fff;
  font-size: 14px; font-weight: 500; cursor: pointer; color: var(--muted);
  min-height: 44px; -webkit-appearance: none; touch-action: manipulation;
  font-family: 'Outfit', 'Inter', Arial, sans-serif;
}
.tab-switch button.active { background: var(--black); color: #fff; font-weight: 700; }

.role-select {
  display: -webkit-flex;
  display:         flex;
  gap: 10px; margin-bottom: 20px;
}
.role-card {
  -webkit-flex: 1; flex: 1;
  border: 2px solid var(--border); border-radius: 6px;
  padding: 16px 12px; cursor: pointer; text-align: center;
  -webkit-transition: all .15s; transition: all .15s; touch-action: manipulation;
  /* 44px minimum height */
  min-height: 44px;
}
.role-card:hover,
.role-card.active { border-color: var(--red); background: #fff5f5; }
.role-card .role-icon { font-size: 28px; display: block; margin-bottom: 6px; }
.role-card .role-name {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}

/* ============================================================
   BROWSE / PRODUCTS GRID
   ============================================================ */
.browse-header { margin-bottom: 20px; }
.search-bar-wrap {
  position: relative; margin-bottom: 14px;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
}
/* FIX: 16px prevents iOS Safari zoom on focus */
.search-bar-wrap input {
  width: 100%; padding: 10px 44px 10px 14px;
  border: 1.5px solid var(--border); border-radius: 4px;
  font-size: 16px; outline: none; background: #fff;
  -webkit-appearance: none; color: var(--text);
  font-family: 'Outfit', 'Inter', Arial, sans-serif;
}
.search-bar-wrap input:focus { border-color: var(--red); }
.search-bar-wrap .search-icon {
  position: absolute; right: 14px; top: 50%;
  -webkit-transform: translateY(-50%);
          transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}

.filter-bar {
  display: -webkit-flex;
  display:         flex;
  gap: 8px; overflow-x: auto;
  -webkit-flex-wrap: nowrap; flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  /* FIX: padding-right so last pill isn't cut off on iOS */
  padding-bottom: 6px;
  padding-right: 16px;
  scrollbar-width: thin; scrollbar-color: #ccc transparent;
  -ms-overflow-style: -ms-autohiding-scrollbar;
  -webkit-scroll-snap-type: x mandatory;
          scroll-snap-type: x mandatory;
}
.filter-bar::-webkit-scrollbar { height: 3px; }
.filter-bar::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.filter-btn {
  padding: 8px 16px; border: 1.5px solid var(--border);
  border-radius: 4px; font-size: 13px; font-weight: 600;
  cursor: pointer; background: #fff;
  -webkit-transition: all .12s; transition: all .12s;
  white-space: nowrap;
  -webkit-scroll-snap-align: start; scroll-snap-align: start;
  -webkit-flex-shrink: 0; flex-shrink: 0;
  display: -webkit-inline-flex; display: inline-flex;
  -webkit-align-items: center; align-items: center;
  min-height: 44px;
  font-family: 'Outfit', 'Inter', Arial, sans-serif;
  touch-action: manipulation;
}
.filter-btn.active,
.filter-btn:hover { background: var(--black); color: #fff; border-color: var(--black); }

/* 5-col → 4 → 3 → 2 → 1 */
.products-grid {
  display: -ms-grid;
  display:     grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
@media (max-width: 1280px) { .products-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1024px) { .products-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width:  640px) { .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
@media (max-width:  360px) { .products-grid { grid-template-columns: 1fr; } }

.product-card {
  background: #fff; border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
/* aspect-ratio with safe fallback for Safari < 15 */
.product-img {
  width: 100%; background: #e5e7eb;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  overflow: hidden; position: relative;
}
@supports (aspect-ratio: 1) {
  .product-img { aspect-ratio: 1; }
}
@supports not (aspect-ratio: 1) {
  .product-img::before { content: ''; display: block; padding-bottom: 100%; }
  .product-img img,
  .product-img > svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
}
.product-img svg { width: 40px; height: 40px; color: #9ca3af; }
.product-img img {
  width: 100%; height: 100%;
  -o-object-fit: cover; object-fit: cover;
}
.product-info   { padding: 12px; }
.product-cat    { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.product-name   {
  font-size: 14px; font-weight: 600; margin-bottom: 2px;
  line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.product-price  { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.product-seller { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.product-card .btn { font-size: 12px; padding: 7px 10px; width: 100%; letter-spacing: .3px; }

.pagination {
  display: -webkit-flex; display: flex;
  gap: 6px; -webkit-justify-content: center; justify-content: center;
  margin-top: 28px; -webkit-flex-wrap: wrap; flex-wrap: wrap;
}
/* FIX: 44×44 tap target on mobile (overridden in media query below) */
.page-btn {
  width: 34px; height: 34px; border: 1.5px solid var(--border);
  border-radius: 4px;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  font-size: 13px; font-weight: 600; cursor: pointer; background: #fff;
  touch-action: manipulation;
}
.page-btn.active { background: var(--black); color: #fff; border-color: var(--black); }
.page-btn:hover:not(.active) { background: #f3f4f6; }

/* ============================================================
   CART PAGE
   ============================================================ */
.cart-wrap {
  padding: 32px 40px; background: var(--gray); min-height: calc(100vh - var(--nav-h));
  width: 100%; -webkit-box-sizing: border-box; box-sizing: border-box; overflow-x: hidden;
}
.cart-title  { font-size: 28px; font-weight: 800; margin-bottom: 20px; }
.cart-layout {
  display: -ms-grid; display: grid;
  grid-template-columns: 1fr 320px; gap: 24px;
  -webkit-align-items: start; align-items: start;
}
.cart-card {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 16px 20px;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  gap: 16px; margin-bottom: 12px;
}
.cart-img {
  width: 72px; height: 72px; border-radius: 6px;
  background: #e5e7eb; -o-object-fit: cover; object-fit: cover;
  -webkit-flex-shrink: 0; flex-shrink: 0;
}
.cart-info      { -webkit-flex: 1; flex: 1; min-width: 0; }
.cart-name      { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.cart-sub       { font-size: 13px; color: var(--muted); }
.cart-price-tag { font-size: 15px; font-weight: 700; color: var(--red); margin-top: 4px; }
.cart-controls {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  gap: 10px; margin-left: auto; -webkit-flex-shrink: 0; flex-shrink: 0;
}
.qty-box {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  border: 1.5px solid var(--border); border-radius: 4px; overflow: hidden;
}
/* FIX: 44×44 minimum tap target on mobile (enforced in media query) */
.qty-btn {
  width: 30px; height: 30px; background: var(--gray); border: none;
  cursor: pointer; font-size: 16px;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  touch-action: manipulation;
}
.qty-num    { width: 36px; text-align: center; font-size: 14px; font-weight: 600; }
/* FIX: remove-btn 44×44 tap target with negative margin trick */
.remove-btn {
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 18px; -webkit-transition: color .12s; transition: color .12s;
  touch-action: manipulation;
  padding: 10px;
  margin: -10px;
}
.remove-btn:hover { color: var(--red); }
.cart-continue {
  display: -webkit-inline-flex; display: inline-flex;
  -webkit-align-items: center; align-items: center;
  gap: 6px; color: var(--muted); font-size: 14px;
  text-decoration: underline; cursor: pointer; background: none; border: none;
}
.cart-empty       { text-align: center; padding: 60px 20px; color: var(--muted); }
.cart-empty-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; color: var(--text); }

.summary-card  { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 24px; }
.summary-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.summary-row {
  display: -webkit-flex; display: flex;
  -webkit-justify-content: space-between; justify-content: space-between;
  -webkit-align-items: center; align-items: center;
  margin-bottom: 12px; font-size: 14px;
}
.summary-item    { color: var(--muted); }
.s-price         { font-weight: 600; }
.summary-divider { height: 1px; background: var(--border); margin: 16px 0; }
.summary-total {
  display: -webkit-flex; display: flex;
  -webkit-justify-content: space-between; justify-content: space-between;
  -webkit-align-items: center; align-items: center;
  font-size: 18px; font-weight: 800;
}
.checkout-btn { margin-top: 16px; }

/* ============================================================
   CHECKOUT PAGE
   ============================================================ */
.co-wrap {
  padding: 32px 40px 60px; background: var(--gray); min-height: calc(100vh - var(--nav-h));
  width: 100%; -webkit-box-sizing: border-box; box-sizing: border-box; overflow-x: hidden;
}
.co-back {
  display: -webkit-inline-flex; display: inline-flex;
  -webkit-align-items: center; align-items: center;
  gap: 6px; font-size: 14px; color: var(--muted);
  margin-bottom: 20px; text-decoration: none; background: none; border: none;
  cursor: pointer; min-height: 44px;
}
.co-title   { font-size: 28px; font-weight: 800; margin-bottom: 24px; }
.co-stepper {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  margin-bottom: 32px; overflow-x: auto;
  -webkit-overflow-scrolling: touch; padding-bottom: 4px;
  /* FIX: allow wrapping on very small screens */
  -webkit-flex-wrap: wrap;
          flex-wrap: wrap;
  gap: 8px;
}
.co-step {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  gap: 8px; -webkit-flex-shrink: 0; flex-shrink: 0;
}
.co-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.co-step-num.active  { background: var(--red); color: #fff; }
.co-step-num.done    { background: var(--green); color: #fff; }
.co-step-num.pending { background: #e5e7eb; color: var(--muted); }
.co-step-label         { font-size: 13px; font-weight: 600; }
.co-step-label.active  { color: var(--red); }
.co-step-label.done    { color: var(--green); }
.co-step-label.pending { color: var(--muted); }
.co-step-line      { height: 2px; width: 40px; -webkit-flex-shrink: 0; flex-shrink: 0; background: #e5e7eb; margin: 0 8px; }
.co-step-line.done { background: var(--green); }
.co-layout {
  display: -ms-grid; display: grid;
  grid-template-columns: 1fr 340px; gap: 24px;
  -webkit-align-items: start; align-items: start;
}
.co-panel       { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 28px; }
.co-panel-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.form-row       { margin-bottom: 16px; }
.form-row-2 {
  display: -ms-grid; display: grid;
  grid-template-columns: 1fr 1fr; gap: 16px;
}
/* FIX: Always 16px — prevents iOS auto-zoom */
.form-input {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 4px; font-size: 16px; outline: none;
  -webkit-transition: border .15s; transition: border .15s;
  -webkit-appearance: none; color: var(--text); background: #fff;
  font-family: 'Outfit', 'Inter', Arial, sans-serif;
}
.form-input:focus { border-color: var(--red); }

/* ============================================================
   PROFILE PAGES
   ============================================================ */
.profile-grid {
  display: -ms-grid; display: grid;
  grid-template-columns: 300px 1fr; gap: 20px;
  -webkit-align-items: start; align-items: start;
}
.profile-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 28px 24px; }
.profile-avatar-wrap {
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column;
  -webkit-align-items: center; align-items: center;
  text-align: center; margin-bottom: 20px;
}
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: -webkit-linear-gradient(315deg, #6366f1, #8b5cf6);
  background:         linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  font-size: 28px; font-weight: 700; margin-bottom: 12px; overflow: hidden;
}
.profile-avatar img {
  width: 100%; height: 100%; -o-object-fit: cover; object-fit: cover; border-radius: 50%;
}
.avatar-upload-btn {
  font-size: 12px; font-weight: 600; color: var(--red);
  cursor: pointer; background: none; border: 1.5px solid var(--red);
  border-radius: 4px; padding: 4px 12px; margin-top: 4px;
  -webkit-transition: all .12s; transition: all .12s; touch-action: manipulation;
  min-height: 44px;
}
.avatar-upload-btn:hover { background: var(--red); color: #fff; }
.avatar-upload-input { display: none; }
.product-img-upload {
  border: 2px dashed var(--border); border-radius: 6px; padding: 18px;
  text-align: center; cursor: pointer;
  -webkit-transition: border-color .12s; transition: border-color .12s; background: #fafafa;
}
.product-img-upload:hover { border-color: var(--red); }
.product-img-upload img {
  max-height: 100px; max-width: 100%; border-radius: 4px;
  margin-bottom: 6px; display: block; margin-left: auto; margin-right: auto;
}
.product-img-upload span { font-size: 12px; color: var(--muted); display: block; }
.profile-name       { font-size: 20px; font-weight: 700; }
.profile-email      { font-size: 13px; color: var(--muted); }
.profile-role-badge { margin: 8px 0; }
.profile-contact {
  margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px;
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column;
  gap: 8px; font-size: 13px; color: var(--muted);
}
.profile-contact span {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center; gap: 6px;
}
.account-info       { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; }
.account-info-title {
  font-size: 11px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.info-row {
  display: -webkit-flex; display: flex;
  -webkit-justify-content: space-between; justify-content: space-between;
  -webkit-align-items: center; align-items: center;
  font-size: 13px; margin-bottom: 6px;
}
.info-row .label { color: var(--muted); }

/* ============================================================
   NOTIFICATIONS
   ============================================================ */
.notif-filters {
  display: -webkit-flex; display: flex;
  gap: 8px; overflow-x: auto;
  -webkit-flex-wrap: nowrap; flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  /* FIX: right padding so last item isn't cut off on iOS */
  padding-right: 16px;
  margin-bottom: 20px;
  -webkit-scroll-snap-type: x mandatory; scroll-snap-type: x mandatory;
  scrollbar-width: thin; scrollbar-color: #ccc transparent;
}
.notif-filter {
  padding: 7px 16px; border: 1.5px solid var(--border);
  border-radius: 4px; font-size: 13px; font-weight: 600;
  cursor: pointer; background: #fff;
  -webkit-transition: all .12s; transition: all .12s;
  -webkit-scroll-snap-align: start; scroll-snap-align: start;
  -webkit-flex-shrink: 0; flex-shrink: 0; min-height: 44px;
  font-family: 'Outfit', 'Inter', Arial, sans-serif; touch-action: manipulation;
}
.notif-filter.active,
.notif-filter:hover { background: var(--black); color: #fff; border-color: var(--black); }

.notif-list {
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column; gap: 12px;
}
.notif-item {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 18px 20px;
  display: -webkit-flex; display: flex;
  -webkit-align-items: flex-start; align-items: flex-start;
  gap: 16px; position: relative;
}
.notif-icon {
  width: 40px; height: 40px;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  -webkit-flex-shrink: 0; flex-shrink: 0;
}
.notif-icon svg { width: 24px; height: 24px; }
.notif-text { -webkit-flex: 1; flex: 1; min-width: 0; }
.notif-msg  { font-size: 14px; margin-bottom: 6px; }
.notif-meta {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  gap: 8px; -webkit-flex-wrap: wrap; flex-wrap: wrap;
}
.notif-time  { font-size: 12px; color: var(--muted); }
/* FIX: 44×44 tap target for notif close button */
.notif-close {
  position: absolute; top: 6px; right: 6px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 18px; touch-action: manipulation;
  width: 44px; height: 44px;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: -webkit-inline-flex; display: inline-flex;
  -webkit-align-items: center; align-items: center;
  padding: 3px 10px; border-radius: 20px; font-size: 11px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap;
}
.badge-delivered { background: var(--green);  color: #fff; }
.badge-shipped   { background: var(--blue);   color: #fff; }
.badge-paid      { background: var(--purple); color: #fff; }
.badge-pending   { background: #f59e0b;       color: #fff; }
.badge-cancelled { background: #ef4444;       color: #fff; }
.badge-active    { background: var(--green);  color: #fff; }
.badge-inactive  { background: var(--muted);  color: #fff; }
.badge-sold_out  { background: #6b7280;       color: #fff; }
.badge-customer  { background: var(--green);  color: #fff; }
.badge-seller    { background: var(--blue);   color: #fff; }
.badge-admin     { background: var(--red);    color: #fff; }
.badge-super-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 45%, #d97706 100%);
  color: #78350f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  padding: 5px 14px 5px 12px;
  border-radius: 999px;
  border: 1px solid #fbbf24;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}
.badge-super-admin::before {
  content: '★';
  font-size: 11px;
  color: #92400e;
  line-height: 1;
}
.badge-order     { background: #3b82f6;       color: #fff; }
.badge-review    { background: #eab308;       color: #fff; }
.badge-promo     { background: #8b5cf6;       color: #fff; }
.badge-system    { background: #6b7280;       color: #fff; }

/* ============================================================
   ALERTS / FLASH
   ============================================================ */
.alert         { padding: 10px 14px; border-radius: 4px; font-size: 13px; margin-bottom: 16px; }
.alert-danger  { background: #fff0f0; color: #cc0000; border: 1px solid #ffcccc; }
.alert-success { background: #f0fff4; color: #166534; border: 1px solid #bbf7d0; }
.flash         { padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,.5); z-index: 200;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: -webkit-flex; display: flex; }
.modal {
  background: #fff; border-radius: 10px; padding: 32px;
  width: 100%; max-width: 500px; position: relative;
  max-height: 90vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  -webkit-box-shadow: 0 20px 60px rgba(0,0,0,.3); box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
/* FIX: 44×44 tap target for modal close */
.modal-close {
  position: absolute; top: 8px; right: 8px;
  background: none; border: none; font-size: 22px;
  cursor: pointer; color: var(--muted); touch-action: manipulation;
  width: 44px; height: 44px;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
}

/* ============================================================
   TOAST
   ============================================================ */
#mp-toast-wrap {
  position: fixed; bottom: 20px; right: 20px;
  /* FIX: raised above modals */
  z-index: 10001;
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column;
  gap: 8px; max-width: calc(100vw - 40px); pointer-events: none;
  /* FIX: account for iPhone home bar */
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}
.mp-toast {
  background: #222; color: #fff; padding: 12px 18px; border-radius: 6px;
  font-size: 14px; font-weight: 500; max-width: 340px;
  -webkit-box-shadow: 0 4px 16px rgba(0,0,0,.3); box-shadow: 0 4px 16px rgba(0,0,0,.3);
  -webkit-animation: toastIn .25s ease; animation: toastIn .25s ease; pointer-events: auto;
}
@-webkit-keyframes toastIn {
  from { opacity: 0; -webkit-transform: translateY(8px); transform: translateY(8px); }
  to   { opacity: 1; -webkit-transform: translateY(0);   transform: translateY(0); }
}
@keyframes toastIn {
  from { opacity: 0; -webkit-transform: translateY(8px); transform: translateY(8px); }
  to   { opacity: 1; -webkit-transform: translateY(0);   transform: translateY(0); }
}
.mp-toast.success { border-left: 4px solid var(--green); }
.mp-toast.error   { border-left: 4px solid #ef4444; }
.mp-toast.info    { border-left: 4px solid var(--blue); }

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .4; }
.user-badge {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  gap: 8px; background: transparent; border: 1.5px solid #444;
  border-radius: 4px; padding: 5px 10px; color: #fff;
}
.avatar-circle {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--red); color: #fff;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.user-badge .uname { font-size: 13px; font-weight: 600; }
.user-badge .urole { font-size: 11px; color: var(--red); }
.text-red   { color: var(--red); }
.text-muted { color: var(--muted); }
.fw-bold    { font-weight: 700; }
.info-grid {
  display: -ms-grid; display: grid;
  grid-template-columns: 1fr 1fr; gap: 16px;
}
.receipt-detail-grid {
  display: -ms-grid; display: grid;
  grid-template-columns: 1fr 1fr; gap: 16px;
}

/* ============================================================
   NAVBAR (legacy landing page)
   ============================================================ */
.navbar {
  background: var(--black);
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: space-between; justify-content: space-between;
  padding: 0 32px; height: 56px; border-bottom: 2px solid var(--red);
  position: -webkit-sticky; position: sticky; top: 0; z-index: 100;
  padding-left: max(32px, env(safe-area-inset-left));
  padding-right: max(32px, env(safe-area-inset-right));
}
.navbar-brand { font-size: 22px; font-weight: 900; color: #fff; letter-spacing: -1px; text-transform: uppercase; }
.navbar-brand span { color: var(--red); }
.navbar-actions {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center; gap: 10px;
}
.cart-btn {
  background: transparent; border: none; cursor: pointer;
  color: #fff; position: relative;
  /* 44×44 tap target */
  padding: 10px; touch-action: manipulation;
}
.cart-btn svg { width: 22px; height: 22px; }
.cart-count {
  position: absolute; top: 2px; right: 2px;
  background: var(--red); color: #fff; border-radius: 50%;
  width: 16px; height: 16px; font-size: 10px; font-weight: 700;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
}

/* Hero — FIX: use 100svh with 100vh fallback for iOS Safari address-bar handling */
.hero {
  background: radial-gradient(ellipse at 50% 0%, #8b0000 0%, #3d0000 30%, var(--black) 70%);
  background-color: var(--black);
  min-height: calc(100vh - 56px);
  min-height: calc(100svh - 56px);
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  text-align: center; padding: 60px 20px;
}
.hero h1 { font-size: clamp(42px, 7vw, 72px); font-weight: 800; color: #fff; line-height: 1.1; margin-bottom: 10px; }
.hero h1 span { color: var(--red); display: block; }
.hero p { color: rgba(255,255,255,.7); font-size: 18px; max-width: 560px; margin: 24px auto 0; line-height: 1.6; }
.hero .cta-group {
  margin-top: 40px;
  display: -webkit-flex; display: flex;
  gap: 12px; -webkit-justify-content: center; justify-content: center;
  -webkit-flex-wrap: wrap; flex-wrap: wrap;
}

/* ============================================================
   SALES REPORT
   ============================================================ */
.toolbar {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: space-between; justify-content: space-between;
  -webkit-flex-wrap: wrap; flex-wrap: wrap; gap: 12px; margin-bottom: 24px;
}
.toolbar-brand   { font-size: 22px; font-weight: 800; }
.toolbar-actions {
  display: -webkit-flex; display: flex; gap: 8px; -webkit-flex-wrap: wrap; flex-wrap: wrap;
}
.report-wrapper { max-width: 900px; margin: 0 auto; }
.report-paper   {
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 40px;
  -webkit-box-shadow: 0 2px 8px rgba(0,0,0,.06); box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.stats-grid {
  display: -ms-grid; display: grid;
  grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px;
}
.stat-value { font-size: 28px; font-weight: 900; color: var(--red); }
.stat-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--muted); margin-top: 4px;
}
.filter-sep      { color: var(--muted); }
.meta-filter     { font-size: 13px; color: var(--muted); margin-bottom: 28px; }
.section-heading { font-size: 16px; font-weight: 700; margin: 28px 0 12px; }
.paper-size-group {
  display: -webkit-flex; display: flex; gap: 8px;
  -webkit-align-items: center; align-items: center;
}
.paper-size-label { font-size: 13px; color: var(--muted); }
.paper-size-btn {
  padding: 6px 14px; border: 1.5px solid var(--border); border-radius: 4px;
  font-size: 12px; font-weight: 600; cursor: pointer; background: #fff;
  font-family: 'Outfit', 'Inter', Arial, sans-serif; touch-action: manipulation;
  min-height: 44px;
}
.paper-size-btn.active { background: var(--black); color: #fff; border-color: var(--black); }
.rank-badge {
  display: -webkit-inline-flex; display: inline-flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; font-size: 11px; font-weight: 700;
}
.rank-1     { background: #fbbf24; color: #fff; }
.rank-2     { background: #94a3b8; color: #fff; }
.rank-3     { background: #cd7c4f; color: #fff; }
.rank-other { background: var(--gray); color: var(--muted); }
.cat-tag {
  display: -webkit-inline-flex; display: inline-flex;
  padding: 2px 8px; background: var(--gray); border-radius: 3px; font-size: 11px; color: var(--muted);
}

/* ============================================================
   ABOUT PAGE
   ============================================================ */
.about-section { padding: 40px; }
.about-grid {
  display: -ms-grid; display: grid; grid-template-columns: 1fr 1fr; gap: 32px;
}
.about-hero { padding: 60px 40px; text-align: center; }
.dev-card   { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 28px 24px; }

/* ============================================================
   ██████████  RESPONSIVE  ██████████
   ============================================================ */

/* ── Desktop: hide mobile-only elements ── */
@media (min-width: 769px) {
  .nav-hamburger      { display: none !important; }
  .nav-drawer         { display: none !important; }
  .sidebar-toggle-btn { display: none !important; }
  .sidebar-overlay    { display: none !important; }
  .dash-sidebar {
    position: relative !important;
    left: auto !important; top: auto !important;
    height: auto !important;
    -webkit-transform: none !important; transform: none !important;
  }
}

/* ── Large tablets (769px – 1024px) ── */
@media (min-width: 769px) and (max-width: 1024px) {
  .dash-sidebar      { width: 150px; min-width: 150px; }
  .dash-sidebar-link { padding: 9px 16px; font-size: 13px; }
  .dash-main         { padding: 24px; }
  .dash-stat-grid    { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .admin-stat-grid   { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .stat-grid         { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .profile-grid      { grid-template-columns: 240px 1fr; }
  .dash-page-title   { font-size: 26px; }
  .dash-nav          { padding: 0 20px; }
  .dash-user-info    { display: none; }
  .admin-two-col-grid{ grid-template-columns: 1fr; }
  .stats-grid        { grid-template-columns: repeat(2, 1fr); }
}

/* ── Small laptops (1025px – 1280px) ── */
@media (min-width: 1025px) and (max-width: 1280px) {
  .dash-sidebar    { width: 160px; min-width: 160px; }
  .dash-main       { padding: 28px; }
  .admin-stat-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Tablet / large phone (≤ 768px) ── */
@media (max-width: 768px) {
  :root { --nav-h: 56px; }

  .dash-layout {
    -webkit-flex-direction: column; flex-direction: column;
    position: relative; overflow-x: hidden;
    width: 100vw; max-width: 100vw;
  }

  /* Full-width main content — sidebar is fixed overlay, not in flow */
  .dash-main {
    padding: 16px 16px 20px;
    padding-top: calc(var(--nav-h) + 16px);
    width: 100vw; max-width: 100vw;
    -webkit-box-sizing: border-box; box-sizing: border-box;
    overflow-x: hidden;
    -webkit-flex: 1; flex: 1;
  }

  /* Sidebar slides in from left as overlay */
  .dash-sidebar {
    position: fixed !important; top: var(--nav-h); left: -220px;
    width: 210px !important; min-width: 0 !important;
    height: calc(100vh - var(--nav-h)); z-index: 95;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 20px 0 24px;
    -webkit-box-shadow: 4px 0 20px rgba(0,0,0,.12); box-shadow: 4px 0 20px rgba(0,0,0,.12);
  }
  .dash-sidebar.open { left: 0; }
  .dash-sidebar-nav {
    -webkit-flex-direction: column !important; flex-direction: column !important;
    -webkit-flex-wrap: nowrap !important; flex-wrap: nowrap !important;
  }
  .dash-sidebar-link {
    padding: 12px 24px !important;
    border-left: 3px solid transparent !important;
    border-bottom: none !important; border-radius: 0 !important;
    font-size: 15px !important;
    min-height: 48px !important;
  }
  .dash-sidebar-link.active {
    border-left-color: var(--red) !important;
    border-bottom: none !important; background: #fff5f5 !important;
  }

  /* FIX: sidebar-toggle-btn in normal flow (not absolute),
     so it doesn't overlap content when page scrolls */
  .sidebar-toggle-btn {
    display: -webkit-inline-flex; display: inline-flex;
    position: relative;
    top: auto; left: auto;
    width: 100%; margin-bottom: 16px; z-index: 10;
  }

  /* Nav */
  .dash-nav {
    padding: 0 14px; gap: 8px; height: 56px;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
  .dash-nav-brand { font-size: 19px; letter-spacing: 1px; }
  .nav-hamburger  { display: -webkit-flex; display: flex; }
  .dash-nav .dash-nav-right > a.dash-nav-btn { display: none; }
  .dash-nav .dash-user-badge                 { display: none; }

  /* Stat grids */
  .dash-stat-grid  { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .admin-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-grid       { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stats-grid      { grid-template-columns: repeat(2, 1fr); }

  /* Profile & form */
  .profile-grid         { grid-template-columns: 1fr; }
  .form-grid-2          { grid-template-columns: 1fr !important; }
  .info-grid            { grid-template-columns: 1fr !important; }
  .receipt-detail-grid  { grid-template-columns: 1fr !important; }

  /* Tables — horizontal scroll */
  .dash-table, table { min-width: 520px; }
  .dash-page-title { font-size: 24px; }

  /* Section header */
  .section-header {
    -webkit-flex-direction: column; flex-direction: column;
    -webkit-align-items: flex-start; align-items: flex-start; gap: 10px;
  }
  .section-header .btn { width: 100%; -webkit-justify-content: center; justify-content: center; }
  .top-actions { -webkit-justify-content: stretch; justify-content: stretch; }
  .top-actions .btn { width: 100%; -webkit-justify-content: center; justify-content: center; }

  /* Cart */
  .cart-wrap    { padding: 20px 14px; width: 100vw; max-width: 100vw; -webkit-box-sizing: border-box; box-sizing: border-box; }
  .cart-title   { font-size: 22px; }
  .cart-layout  { grid-template-columns: 1fr; }
  .cart-card    { -webkit-flex-wrap: wrap; flex-wrap: wrap; gap: 10px; }
  /* FIX: smaller cart image on mobile to avoid overflow */
  .cart-img     { width: 60px; height: 60px; }
  .cart-controls{ margin-left: 0; width: 100%; -webkit-justify-content: flex-end; justify-content: flex-end; }

  /* Checkout */
  .co-wrap    { padding: 16px 14px 40px; width: 100vw; max-width: 100vw; -webkit-box-sizing: border-box; box-sizing: border-box; }
  .co-layout  { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }

  /* Chart */
  .dash-chart-card { padding: 20px 16px; }
  .dash-bar-chart  { height: 130px; gap: 6px; }

  /* Modal — bottom sheet */
  .modal-overlay { -webkit-align-items: flex-end; align-items: flex-end; padding: 0; }
  .modal {
    border-radius: 14px 14px 0 0; max-width: 100%; width: 100%;
    margin: 0; max-height: 85vh;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 24px 18px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  /* Auth card — centered card on all phones (portrait & landscape) */
  .auth-page {
    -webkit-align-items: center;
            align-items: center;
    -webkit-justify-content: center;
            justify-content: center;
    padding: 20px 16px;
    min-height: 100vh;
    min-height: 100svh;
  }
  .auth-card {
    padding: 28px 20px;
    border-radius: 12px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 420px;
  }

  /* Admin two-col */
  .admin-two-col-grid { grid-template-columns: 1fr; }

  /* Page filter row */
  .page-filter-row {
    -webkit-flex-direction: column; flex-direction: column;
    -webkit-align-items: stretch; align-items: stretch;
  }
  .page-filter-row form { width: 100%; }

  /* Inline flex space-between rows */
  [style*="display:flex"][style*="justify-content:space-between"],
  [style*="display: flex"][style*="justify-content: space-between"] {
    -webkit-flex-wrap: wrap; flex-wrap: wrap; gap: 10px;
  }

  /* Hero */
  .hero { padding: 40px 16px 60px; min-height: auto; }
  .hero p { font-size: 16px; margin-top: 16px; }
  .hero .cta-group { margin-top: 28px; gap: 10px; }

  /* About */
  .about-section { padding: 28px 16px; }
  .about-grid    { grid-template-columns: 1fr; gap: 20px; }
  .about-hero    { padding: 40px 16px; }
  .dev-card      { width: 100%; }

  /* Sales report */
  .toolbar {
    -webkit-flex-direction: column; flex-direction: column;
    -webkit-align-items: flex-start; align-items: flex-start;
  }
  .report-paper   { padding: 24px 18px; }
  .report-wrapper { padding: 0 8px; }

  /* Toast */
  #mp-toast-wrap { right: 12px; left: 12px; }
  .mp-toast      { max-width: 100%; }

  /* Navbar (landing) */
  .navbar {
    padding: 0 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .navbar-actions { gap: 6px; }

  /* Nav drawer safe area */
  .nav-drawer {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
}

/* ── Small phones (≤ 480px) ── */
@media (max-width: 480px) {
  :root { --nav-h: 52px; }
  .dash-nav       { height: 52px; }
  .dash-nav-brand { font-size: 16px; }
  .nav-drawer     { top: 52px; }

  .dash-stat-grid  { grid-template-columns: 1fr; }
  .stat-grid       { grid-template-columns: 1fr; }
  .admin-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid      { grid-template-columns: repeat(2, 1fr) !important; }

  .dash-main       { padding: 12px; padding-top: calc(var(--nav-h) + 12px); width: 100vw; max-width: 100vw; -webkit-box-sizing: border-box; box-sizing: border-box; }
  .dash-page-title { font-size: 20px; }
  .dash-stat-num   { font-size: 42px; }
  .admin-stat .num { font-size: 28px; }
  .dash-sidebar    { width: 180px !important; }

  .hero h1         { font-size: clamp(32px, 9vw, 48px); }
  .hero p          { font-size: 15px; }
  .hero .cta-group { -webkit-flex-direction: column; flex-direction: column; -webkit-align-items: center; align-items: center; }

  .auth-page {
    -webkit-align-items: center !important;
            align-items: center !important;
    -webkit-justify-content: center !important;
            justify-content: center !important;
    padding: 20px 16px !important;
    min-height: 100vh;
    min-height: 100svh;
  }
  .auth-card {
    padding: 24px 16px !important;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
    border-radius: 12px !important;
    max-width: 420px;
    width: 100%;
  }
  .role-select { -webkit-flex-direction: column; flex-direction: column; }
  .role-card   { -webkit-flex: none; flex: none; }
  .role-card .role-icon { font-size: 22px; }
  .role-card .role-name { font-size: 12px; }

  .notif-item { padding: 14px; gap: 10px; }
  .notif-msg  { font-size: 13px; }
  .notif-icon { width: 32px; height: 32px; }
  .notif-icon svg { width: 20px; height: 20px; }

  .dash-chart-card  { padding: 16px 12px; }
  .dash-chart-title { font-size: 16px; margin-bottom: 20px; }
  .dash-bar-chart   { height: 100px; gap: 4px; }
  .dash-bar-label   { font-size: 9px; letter-spacing: 0; }

  .pagination  { gap: 4px; }

  .action-btns .btn { font-size: 11px; padding: 4px 8px; }
  .stat-value  { font-size: 22px; }
  .co-title    { font-size: 22px; }
  .cart-wrap   { padding: 12px 10px; width: 100vw; max-width: 100vw; -webkit-box-sizing: border-box; box-sizing: border-box; }
  .co-wrap     { padding: 12px 10px 40px; width: 100vw; max-width: 100vw; -webkit-box-sizing: border-box; box-sizing: border-box; }
}

/* ── Very small phones (≤ 360px) ── */
@media (max-width: 360px) {
  .products-grid   { grid-template-columns: 1fr !important; }
  .admin-stat-grid { grid-template-columns: 1fr; }
  .stats-grid      { grid-template-columns: 1fr !important; }
  .dash-nav-brand  { font-size: 14px; }
}

/* ============================================================
   TOUCH / iOS / ANDROID HELPERS
   ============================================================ */
@media (max-width: 768px) {
  /* 44px touch targets (Apple HIG & Material Design) */
  .btn,
  .filter-btn,
  .notif-filter,
  .tab-switch button { min-height: 44px; }
  /* FIX: page-btn and qty-btn 44×44 on mobile */
  .page-btn { width: 44px; height: 44px; }
  .qty-btn  { width: 44px; height: 44px; }

  /* Prevent iOS font zoom on inputs (must be ≥16px) */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  input[type="date"],
  .form-control,
  .form-input,
  textarea,
  select { font-size: 16px !important; }

  /* Momentum scroll for horizontal bars */
  .filter-bar,
  .notif-filters { -webkit-overflow-scrolling: touch; }

  /* Disable text selection on interactive controls */
  .btn, .filter-btn, .notif-filter, .tab-switch button,
  .page-btn, .qty-btn, .nav-hamburger, .role-card {
    -webkit-user-select: none;
       -moz-user-select: none;
        -ms-user-select: none;
            user-select: none;
  }
}

/* ── Landscape on small phones ── */
@media (max-height: 480px) and (orientation: landscape) {
  /* FIX: center-align auth card in landscape (not bottom-sheet) */
  .auth-page  { -webkit-align-items: center; align-items: center; padding: 16px; min-height: 100vh; }
  .auth-card  { border-radius: 10px; padding-bottom: 24px; max-height: 90vh; }
  .hero       { min-height: auto; padding: 30px 20px; }
  .modal      { max-height: 80vh; }
  .nav-drawer { max-height: calc(100vh - var(--nav-h)); }
}

/* ============================================================
   PRINT (sales report)
   ============================================================ */
@media print {
  .toolbar, .sidebar-toggle-btn, .nav-hamburger, .dash-nav { display: none !important; }
  .report-paper { -webkit-box-shadow: none; box-shadow: none; border: none; }
  body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a    { text-decoration: none; }
}
