/* ═══════════════════════════════════════════════
   SwiftBite — Main Stylesheet
   Mobile-first, production-grade
═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --primary: #FF4500;
  --primary-dark: #CC3700;
  --primary-light: #FF6B35;
  --primary-bg: #FFF3EF;
  --secondary: #1A1A2E;
  --accent: #FFB800;
  --success: #22C55E;
  --success-bg: #F0FDF4;
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --info: #3B82F6;
  --info-bg: #EFF6FF;

  --bg: #F8F7F5;
  --surface: #FFFFFF;
  --surface-2: #F3F2F0;
  --border: #E8E6E3;
  --border-strong: #D1CFC9;

  --text-primary: #1A1A1A;
  --text-secondary: #6B6866;
  --text-muted: #A09E9A;
  --text-invert: #FFFFFF;

  --font-display: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
  --shadow-xl: 0 16px 48px rgba(0,0,0,.16);

  --nav-h: 60px;
  --bottom-nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --transition: 0.18s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; object-fit: cover; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
  border: none;
  background: none;
}
button { cursor: pointer; }
ul, ol { list-style: none; }

/* ── Typography ───────────────────────────────── */
h1, h2, h3, h4, h5 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
h5 { font-size: .9rem; }
p { font-size: .9rem; color: var(--text-secondary); }
small { font-size: .78rem; }
.label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }

/* ── App Layout ───────────────────────────────── */
.app-wrapper {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 8px);
  overflow-x: hidden;
}

/* ── Top Nav ──────────────────────────────────── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}
.top-nav .logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--primary);
  flex: 1;
}
.top-nav .logo span { color: var(--secondary); }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}
.icon-btn:active { background: var(--border); }
.icon-btn .badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--surface);
}
.icon-btn .badge-count {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  background: var(--primary);
  border-radius: var(--radius-full);
  font-size: .65rem;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 1.5px solid var(--surface);
}

/* ── Bottom Nav ───────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 100;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 500;
  position: relative;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a svg { transition: transform var(--transition); }
.bottom-nav a.active svg { transform: scale(1.1); }
.bottom-nav .nav-dot {
  position: absolute;
  top: 8px;
  right: 50%;
  transform: translateX(8px);
  width: 5px; height: 5px;
  background: var(--primary);
  border-radius: 50%;
}

/* ── Buttons ──────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: .88rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 16px rgba(255,69,0,.3); }
.btn-primary:active { background: var(--primary-dark); transform: scale(.98); }
.btn-secondary { background: var(--surface-2); color: var(--text-primary); }
.btn-secondary:active { background: var(--border); }
.btn-outline { background: transparent; border: 1.5px solid var(--border-strong); color: var(--text-primary); }
.btn-outline:active { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: .8rem; }
.btn-lg { padding: 15px 28px; font-size: .95rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn-loading { position: relative; color: transparent !important; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ── Forms ────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: .82rem; font-weight: 600; color: var(--text-secondary); }
.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
  font-size: .9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,69,0,.12);
}
.form-control::placeholder { color: var(--text-muted); }
.input-group { position: relative; }
.input-group .form-control { padding-left: 42px; }
.input-group .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.input-group .input-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
}
.form-error { font-size: .78rem; color: var(--danger); }
.form-hint { font-size: .78rem; color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Cards ────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 14px; }
.card-footer { padding: 12px 14px; border-top: 1px solid var(--border); }

/* ── Restaurant Card ──────────────────────────── */
.restaurant-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.restaurant-card:active { transform: scale(.985); }
.restaurant-card .cover {
  width: 100%; height: 140px;
  background: var(--surface-2);
  position: relative;
}
.restaurant-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.restaurant-card .cover-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,.45));
}
.restaurant-card .badge-row {
  position: absolute; top: 10px; left: 10px;
  display: flex; gap: 6px;
}
.restaurant-card .info { padding: 12px; }
.restaurant-card .info h3 { font-size: .95rem; margin-bottom: 4px; }
.restaurant-card .meta {
  display: flex; align-items: center; gap: 10px;
  font-size: .78rem; color: var(--text-muted);
}
.restaurant-card .meta span { display: flex; align-items: center; gap: 3px; }

/* ── Menu Item Card ───────────────────────────── */
.item-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.item-card:active { transform: scale(.985); }
.item-card .item-image {
  width: 72px; height: 72px;
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
}
.item-card .item-image img { width: 100%; height: 100%; object-fit: cover; }
.item-card .item-info { flex: 1; min-width: 0; }
.item-card .item-info h4 { font-size: .9rem; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-card .item-info p { font-size: .78rem; color: var(--text-muted); -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.item-card .item-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.item-card .item-price { font-family: var(--font-display); font-size: .9rem; font-weight: 700; color: var(--primary); }

/* ── Quantity Control ─────────────────────────── */
.qty-control {
  display: flex; align-items: center; gap: 8px;
}
.qty-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  transition: background var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.qty-btn:active { transform: scale(.9); }
.qty-btn.minus { background: var(--surface-2); color: var(--text-primary); }
.qty-count { font-family: var(--font-display); font-weight: 700; font-size: .9rem; min-width: 20px; text-align: center; }

/* ── Badges ───────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: .72rem;
  font-weight: 600;
  line-height: 1;
}
.badge-primary { background: var(--primary); color: #fff; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-gray { background: var(--surface-2); color: var(--text-muted); }
.badge-featured { background: var(--accent); color: var(--secondary); }

/* ── Tabs ─────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
}
.tab-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
  text-align: center;
}
.tab-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ── Category Pills ───────────────────────────── */
.category-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 4px;
  scrollbar-width: none;
}
.category-scroll::-webkit-scrollbar { display: none; }
.cat-pill {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.cat-pill.active {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.cat-pill .cat-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.cat-pill span { font-size: .75rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.cat-pill.active span { color: var(--primary); }

/* ── Section Headers ──────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 10px;
}
.section-header h2 { font-size: 1rem; }
.section-header a { font-size: .8rem; font-weight: 600; color: var(--primary); }

/* ── Status Pill ──────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 600;
}
.status-pending    { background: #FFF3CD; color: #856404; }
.status-confirmed  { background: var(--info-bg); color: var(--info); }
.status-preparing  { background: #FFF3CD; color: #856404; }
.status-ready      { background: var(--success-bg); color: var(--success); }
.status-picked_up  { background: var(--info-bg); color: var(--info); }
.status-on_the_way { background: var(--primary-bg); color: var(--primary); }
.status-delivered  { background: var(--success-bg); color: var(--success); }
.status-cancelled  { background: var(--danger-bg); color: var(--danger); }

/* ── Avatar ───────────────────────────────────── */
.avatar {
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm  { width: 32px; height: 32px; font-size: .8rem; }
.avatar-md  { width: 42px; height: 42px; font-size: .95rem; }
.avatar-lg  { width: 60px; height: 60px; font-size: 1.2rem; }
.avatar-xl  { width: 80px; height: 80px; font-size: 1.6rem; }

/* ── Cart FAB ─────────────────────────────────── */
.cart-fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 448px;
  background: var(--secondary);
  color: #fff;
  border-radius: var(--radius-full);
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-xl);
  z-index: 90;
  cursor: pointer;
  transition: transform var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.cart-fab:active { transform: translateX(-50%) scale(.98); }
.cart-fab .cart-count {
  background: var(--primary);
  border-radius: var(--radius-full);
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700;
}
.cart-fab .cart-label { font-family: var(--font-display); font-size: .9rem; font-weight: 700; }
.cart-fab .cart-total { font-family: var(--font-display); font-size: .9rem; font-weight: 700; }

/* ── Bottom Sheet ─────────────────────────────── */
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.sheet-overlay.open { opacity: 1; pointer-events: all; }
.bottom-sheet {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%; max-width: 480px;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 201;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  max-height: 90dvh;
  overflow-y: auto;
  padding-bottom: calc(16px + var(--safe-bottom));
}
.bottom-sheet.open { transform: translateX(-50%) translateY(0); }
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  margin: 12px auto 0;
}
.sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 1;
}

/* ── Toast ────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 70px; left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  width: calc(100% - 32px);
  max-width: 448px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--secondary);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .85rem;
  font-weight: 500;
  animation: toastIn .25s ease forwards;
  pointer-events: all;
}
.toast.success { background: var(--success); }
.toast.danger  { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--secondary); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-12px) scale(.96); }
}

/* ── Loading ──────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner {
  width: 24px; height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.page-loader {
  display: flex; align-items: center; justify-content: center;
  height: 200px;
}

/* ── Empty State ──────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
}
.empty-state .empty-icon {
  width: 72px; height: 72px;
  background: var(--surface-2);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.empty-state h3 { font-size: .95rem; }
.empty-state p  { font-size: .82rem; max-width: 240px; }

/* ── Divider ──────────────────────────────────── */
.divider {
  height: 8px;
  background: var(--surface-2);
  margin: 0 -16px;
}

/* ── Rating Stars ─────────────────────────────── */
.stars { display: flex; gap: 2px; color: var(--accent); }
.stars svg { fill: var(--accent); }
.stars .empty svg { fill: var(--border-strong); }

/* ── Order Timeline ───────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; padding: 0 16px; }
.timeline-item {
  display: flex; gap: 12px;
  padding-bottom: 20px;
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 15px; top: 28px;
  bottom: 0; width: 2px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-item.done::before { background: var(--success); }
.timeline-dot {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  z-index: 1;
}
.timeline-item.done .timeline-dot { background: var(--success); color: #fff; }
.timeline-item.active .timeline-dot { background: var(--primary); color: #fff; animation: pulse 1.4s ease infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,69,0,.4); } 50% { box-shadow: 0 0 0 8px rgba(255,69,0,0); } }
.timeline-content h4 { font-size: .88rem; }
.timeline-content p  { font-size: .78rem; color: var(--text-muted); }

/* ── Map Tracker ──────────────────────────────── */
#delivery-map {
  width: 100%; height: 280px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-2);
}

/* ── Chat Bubbles ─────────────────────────────── */
.chat-area {
  display: flex; flex-direction: column; gap: 12px;
  padding: 12px 16px;
  overflow-y: auto;
}
.bubble-wrap { display: flex; gap: 8px; align-items: flex-end; }
.bubble-wrap.me { flex-direction: row-reverse; }
.bubble {
  max-width: 72%;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: .88rem;
  line-height: 1.4;
  word-break: break-word;
}
.bubble.them {
  background: var(--surface);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}
.bubble.me {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bubble .bubble-time { font-size: .68rem; opacity: .65; margin-top: 3px; display: block; text-align: right; }
.bubble img { max-width: 200px; border-radius: var(--radius); margin-bottom: 4px; }
.typing-indicator {
  display: flex; gap: 4px; align-items: center;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: 16px; border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  width: fit-content;
}
.typing-dot {
  width: 7px; height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.2s ease infinite;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* ── Chat Input ───────────────────────────────── */
.chat-input-bar {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px;
  padding-bottom: calc(10px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: sticky; bottom: 0;
}
.chat-input-wrap {
  flex: 1;
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  padding: 8px 12px;
  border: 1.5px solid transparent;
  transition: border-color var(--transition);
}
.chat-input-wrap:focus-within { border-color: var(--primary); }
.chat-input {
  flex: 1;
  resize: none;
  max-height: 100px;
  min-height: 20px;
  font-size: .9rem;
  background: transparent;
  color: var(--text-primary);
  line-height: 1.4;
}
.chat-send-btn {
  width: 42px; height: 42px;
  background: var(--primary);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
}
.chat-send-btn:active { background: var(--primary-dark); transform: scale(.9); }

/* ── Dashboard Specific ───────────────────────── */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex; gap: 12px; align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-card .stat-value { font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; }
.stat-card .stat-label { font-size: .78rem; color: var(--text-muted); }
.stat-card .stat-change { font-size: .75rem; font-weight: 600; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Search Bar ───────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 10px 14px;
  transition: border-color var(--transition);
}
.search-bar:focus-within { border-color: var(--primary); }
.search-bar input { flex: 1; font-size: .88rem; color: var(--text-primary); background: transparent; }
.search-bar input::placeholder { color: var(--text-muted); }

/* ── Payment UI ───────────────────────────────── */
.payment-method {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
}
.payment-method.selected { border-color: var(--primary); background: var(--primary-bg); }
.payment-method .pm-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.payment-method .pm-info { flex: 1; }
.payment-method .pm-name { font-weight: 600; font-size: .9rem; }
.payment-method .pm-desc { font-size: .78rem; color: var(--text-muted); }
.payment-method .pm-radio {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
}
.payment-method.selected .pm-radio {
  border-color: var(--primary);
  background: var(--primary);
}
.payment-method.selected .pm-radio::after {
  content: '';
  width: 8px; height: 8px;
  background: #fff;
  border-radius: 50%;
}

/* ── Scrollable Grid ──────────────────────────── */
.cards-scroll {
  display: flex; gap: 12px;
  overflow-x: auto;
  padding: 0 16px 4px;
  scrollbar-width: none;
}
.cards-scroll::-webkit-scrollbar { display: none; }
.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px;
}

/* ── Notification Item ────────────────────────── */
.notif-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.notif-item:active { background: var(--surface-2); }
.notif-item.unread { background: var(--primary-bg); }
.notif-item .notif-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.notif-item .notif-text h4 { font-size: .88rem; margin-bottom: 2px; }
.notif-item .notif-text p  { font-size: .78rem; color: var(--text-secondary); }
.notif-item .notif-time    { font-size: .72rem; color: var(--text-muted); white-space: nowrap; margin-left: auto; }

/* ── Settings Item ────────────────────────────── */
.settings-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.settings-item:active { background: var(--surface-2); }
.settings-item .settings-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.settings-item .settings-label { flex: 1; font-size: .9rem; font-weight: 500; }
.settings-item .settings-value { font-size: .82rem; color: var(--text-muted); }

/* ── Map Marker ───────────────────────────────── */
.delivery-marker {
  width: 42px; height: 42px;
  background: var(--primary);
  border-radius: var(--radius-full);
  border: 3px solid #fff;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  animation: markerBounce 2s ease infinite;
}
@keyframes markerBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ── Swipe Actions ────────────────────────────── */
.swipe-container { position: relative; overflow: hidden; border-radius: var(--radius); }
.swipe-actions {
  position: absolute; right: 0; top: 0; bottom: 0;
  display: flex; align-items: stretch;
  transform: translateX(100%);
  transition: transform var(--transition);
}
.swipe-action-btn {
  width: 70px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: #fff; font-size: .72rem; font-weight: 600;
}

/* ── Range input ──────────────────────────────── */
input[type=range] {
  -webkit-appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  outline: none;
  width: 100%;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255,69,0,.35);
}

/* ── Toggle ───────────────────────────────────── */
.toggle {
  position: relative; width: 44px; height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::after { transform: translateX(20px); }

/* ── Misc Utilities ───────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.p-4 { padding: 16px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }
.font-bold { font-weight: 700; }
.font-display { font-family: var(--font-display); }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── Order Summary Box ────────────────────────── */
.order-summary {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.order-summary-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
}
.order-summary-row:last-child { border-bottom: none; }
.order-summary-row.total {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1rem;
  color: var(--primary);
}

/* ── Floating action ──────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  right: 16px;
  width: 52px; height: 52px;
  background: var(--primary);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
  color: #fff; z-index: 89;
  transition: transform var(--transition);
}
.fab:active { transform: scale(.9); }

/* ── Receipt ──────────────────────────────────── */
.receipt-header {
  text-align: center;
  padding: 24px 20px 16px;
  border-bottom: 2px dashed var(--border);
}
.receipt-row {
  display: flex; justify-content: space-between;
  padding: 8px 0;
  font-size: .85rem;
  border-bottom: 1px solid var(--border);
}
.receipt-row:last-child { border-bottom: none; }
.receipt-total { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
