:root {
  --bg: #ffffff;
  --bg-card: #f5f5f5;
  --bg-elevated: #ffffff;
  --bg-hover: #eeeeee;
  --bg-header: #831a1a;
  --accent: #831a1a;
  --accent-hover: #a52222;
  --accent-dim: rgba(131, 26, 26, 0.08);
  --accent-glow: rgba(131, 26, 26, 0.15);
  --text: #3f3f3f;
  --text-sec: #6b6b6b;
  --text-muted: #aaaaaa;
  --border: rgba(0, 0, 0, 0.06);
  --border-light: rgba(0, 0, 0, 0.10);
  --success: #2da66e;
  --danger: #831a1a;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --radius-pill: 100px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --dock-height: 66px;
}

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

body {
  font-family: 'Montserrat', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font-family: inherit; border: none; outline: none; background: none; color: inherit; }
button, .card, .chip, .dock-item, .menu-item { touch-action: manipulation; -webkit-tap-highlight-color: transparent; cursor: pointer; }

/* Location selector */
.location-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; height: 100dvh; padding: 24px; text-align: center; }
.location-logo { width: 140px; margin-bottom: 8px; }
.location-subtitle { font-size: 14px; color: var(--text-sec); margin-bottom: 40px; letter-spacing: 0.5px; }
.location-title { font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.location-cards { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; }
.location-card { padding: 20px; border-radius: var(--radius); background: var(--bg-card); border: 2px solid var(--border-light); text-align: center; transition: all 0.15s; }
.location-card:active { background: var(--accent-dim); border-color: var(--accent); }
.location-card-name { font-size: 16px; font-weight: 700; color: var(--text); }
.location-card-city { font-size: 13px; color: var(--text-sec); margin-top: 4px; }

/* Location bar */
.location-bar { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px; margin: 0 16px 8px; border-radius: var(--radius-xs); background: var(--accent-dim); font-size: 12px; color: var(--accent); font-weight: 600; cursor: pointer; }
.location-bar::after { content: ''; display: inline-block; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--accent); margin-left: 2px; }

/* Layout */
#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; position: relative; max-width: 100%; overflow: hidden; }
#pages { flex: 1; overflow: hidden; position: relative; }

.page {
  position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 16px calc(var(--dock-height) + var(--safe-bottom) + 16px);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.page.active { opacity: 1; pointer-events: auto; }
.page::-webkit-scrollbar { display: none; }
.page { scrollbar-width: none; }

/* Dock — fixed bottom */
#dock {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--dock-height) + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border-top: 1px solid var(--border); display: flex; align-items: flex-start;
  justify-content: space-around; padding-top: 8px; padding-bottom: var(--safe-bottom); z-index: 100;
}
.dock-item { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-muted); transition: color 0.2s; padding: 4px 16px; position: relative; }
.dock-item.active { color: var(--accent); }
.dock-item svg { width: 24px; height: 24px; transition: transform 0.12s; }
.dock-item:active svg { transform: scale(0.85); }
.dock-label { font-size: 10px; font-weight: 500; letter-spacing: 0.03em; }

.dock-badge {
  position: absolute; top: 0; right: 8px; min-width: 18px; height: 18px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  padding: 0 5px; transform: scale(0); transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.dock-badge.visible { transform: scale(1); }

/* Brand Header — black */
.brand-header {
  background: var(--bg-header);
  display: flex; flex-direction: column; align-items: center;
  margin: 0 -16px 20px; padding: 20px 16px 18px;
}
.brand-logo { height: 40px; width: auto; margin-bottom: 6px; }
.brand-greeting { font-size: 11px; font-weight: 600; letter-spacing: 0.18em; color: rgba(255,255,255,0.5); text-transform: uppercase; }

/* Typography */
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 20px; padding-top: 20px; }
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.text-sec { color: var(--text-sec); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 13px; }

/* Promo Banner */
.promo-banner {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 20px; position: relative; overflow: hidden;
}
.promo-banner::before {
  content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
  background: var(--accent);
}
.promo-label { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.promo-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.promo-desc { font-size: 13px; color: var(--text-sec); line-height: 1.4; }

/* Chips / Category tabs */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; -ms-overflow-style: none; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 8px 18px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; color: var(--text-sec);
  transition: all 0.2s; white-space: nowrap;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Menu Cards */
.menu-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; margin-bottom: 10px; display: flex; align-items: center;
  gap: 12px; transition: transform 0.12s;
}
.menu-card:active { transform: scale(0.985); }

.menu-card-img {
  width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex-shrink: 0;
  background: var(--bg-hover);
}

.menu-card-info { flex: 1; min-width: 0; }
.menu-card-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.menu-card-desc { font-size: 12px; color: var(--text-sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.menu-card-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.menu-card-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.menu-card-price { font-size: 15px; font-weight: 700; white-space: nowrap; }

.add-btn {
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, background 0.15s; flex-shrink: 0;
}
.add-btn:active { transform: scale(0.85); }
.add-btn svg { width: 18px; height: 18px; color: #fff; }
.add-btn.in-cart { background: var(--bg-hover); border: 1.5px solid var(--accent); }
.add-btn.in-cart svg { color: var(--accent); }
.add-btn-qty { font-size: 13px; font-weight: 700; color: var(--accent); }

/* Menu card inline qty controls */
.menu-card-qty {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.qty-btn-mini {
  width: 30px; height: 30px; border-radius: 50%; background: var(--bg-hover);
  border: 1px solid var(--border-light); display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s;
}
.qty-btn-mini:active { transform: scale(0.85); }
.qty-btn-mini svg { width: 14px; height: 14px; }
.qty-num-mini { font-size: 15px; font-weight: 700; min-width: 18px; text-align: center; }

/* Cart */
.cart-item {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 15px; font-weight: 600; }
.cart-item-meta { font-size: 13px; color: var(--text-sec); margin-top: 2px; }

.qty-controls { display: flex; align-items: center; gap: 12px; }
.qty-btn {
  width: 30px; height: 30px; border-radius: 50%; background: var(--bg-card);
  border: 1px solid var(--border-light); display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s;
}
.qty-btn:active { transform: scale(0.85); }
.qty-btn svg { width: 14px; height: 14px; }
.qty-num { font-size: 15px; font-weight: 700; min-width: 18px; text-align: center; }

.cart-total { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; margin: 8px 0 20px; border-top: 1px solid var(--border); }
.cart-total-label { font-size: 16px; font-weight: 600; }
.cart-total-value { font-size: 20px; font-weight: 800; color: var(--accent); }

/* Format Chips */
.format-section { margin-bottom: 20px; }
.format-chips { display: flex; gap: 8px; }
.format-chip {
  flex: 1; padding: 12px; background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; text-align: center; transition: all 0.2s;
}
.format-chip.active { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }

/* Comment */
.comment-input {
  width: 100%; padding: 12px 14px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text); resize: none;
  margin-bottom: 20px; min-height: 44px;
}
.comment-input::placeholder { color: var(--text-muted); }

/* Order Button */
.order-btn {
  width: 100%; padding: 16px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 700;
  border-radius: var(--radius-sm); transition: opacity 0.15s, transform 0.12s; margin-top: 8px;
}
.order-btn:active { opacity: 0.85; transform: scale(0.98); }
.order-btn:disabled { opacity: 0.4; pointer-events: none; }

/* Order Cards */
.order-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.order-card.past { opacity: 0.5; }
.order-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.order-number { font-size: 15px; font-weight: 700; }
.order-status { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--accent); }
.order-status.done { color: var(--success); }
.order-status.completed { color: var(--text-sec); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.status-dot.pulse { animation: pulse 1.5s ease infinite; }
.order-status.done .status-dot { background: var(--success); }
.order-items-list { font-size: 13px; color: var(--text-sec); line-height: 1.6; margin-bottom: 10px; }
.order-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px solid var(--border); }
.order-time { font-size: 12px; color: var(--text-muted); }
.order-total { font-size: 15px; font-weight: 700; }

.repeat-btn {
  margin-top: 10px; padding: 10px 20px; background: var(--bg-hover); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; color: var(--text-sec); transition: all 0.2s;
}
.repeat-btn:active { border-color: var(--accent); color: var(--accent); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Profile */
.profile-header { display: flex; flex-direction: column; align-items: center; margin-bottom: 24px; }
.avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8B1A1A);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: #fff; margin-bottom: 12px;
}
.profile-name { font-size: 20px; font-weight: 700; }
.profile-username { font-size: 13px; color: var(--text-sec); margin-top: 2px; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px; }
.stat-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 10px; text-align: center; }
.stat-value { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.stat-label { font-size: 11px; color: var(--text-sec); font-weight: 500; }

/* Loyalty Progress */
.loyalty-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 24px;
}
.loyalty-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.loyalty-cups { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; }
.loyalty-cup {
  width: 36px; height: 36px; padding: 6px;
  background: var(--bg-hover); border: 1.5px solid var(--border);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.loyalty-cup svg { width: 22px; height: 22px; }
.loyalty-cup.filled { background: var(--accent-dim); border-color: var(--accent); }
.loyalty-cup.free { background: rgba(45, 166, 110, 0.08); border-color: var(--success); }
.loyalty-hint { font-size: 12px; color: var(--text-sec); text-align: center; }

/* Confirm Overlay */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 500; background: rgba(0, 0, 0, 0.85);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.confirm-overlay.active { opacity: 1; pointer-events: auto; }

.confirm-circle {
  width: 92px; height: 92px; border-radius: 50%; background: var(--accent-dim);
  border: 2.5px solid var(--accent); display: flex; align-items: center; justify-content: center;
  margin-bottom: 28px; opacity: 0; transform: scale(0.5);
}
.confirm-overlay.active .confirm-circle { animation: popIn 0.4s 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.confirm-check { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 36; stroke-dashoffset: 36; }
.confirm-overlay.active .confirm-check { animation: drawCheck 0.35s 0.5s ease-out forwards; }
.confirm-text { font-size: 24px; font-weight: 800; color: #fff; margin-bottom: 8px; opacity: 0; }
.confirm-overlay.active .confirm-text { animation: fadeUp 0.3s 0.65s ease-out forwards; }
.confirm-details { font-size: 14px; color: rgba(255,255,255,0.6); text-align: center; line-height: 1.5; margin-bottom: 36px; opacity: 0; }
.confirm-overlay.active .confirm-details { animation: fadeUp 0.3s 0.75s ease-out forwards; }
.confirm-btn { padding: 15px 52px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 700; border-radius: var(--radius-sm); opacity: 0; }
.confirm-overlay.active .confirm-btn { animation: fadeUp 0.3s 0.9s ease-out forwards; }
.confirm-btn:active { opacity: 0.85; transform: scale(0.98); }

@keyframes popIn { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }
@keyframes drawCheck { to { stroke-dashoffset: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Empty State */
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 48px 24px; text-align: center; }
.empty-state svg { width: 48px; height: 48px; color: var(--text-muted); margin-bottom: 16px; }
.empty-state p { font-size: 15px; color: var(--text-sec); margin-bottom: 16px; }
.btn-secondary { padding: 12px 28px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; transition: border-color 0.2s; }
.btn-secondary:active { border-color: var(--accent); }

/* Toast */
.toast {
  position: fixed; top: 16px; left: 16px; right: 16px; background: var(--bg-header);
  border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm); padding: 14px 16px;
  font-size: 14px; font-weight: 600; color: #fff; text-align: center; z-index: 400;
  opacity: 0; transform: translateY(-20px); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); pointer-events: none;
}
.toast.visible { opacity: 1; transform: translateY(0); }

/* Bottom Sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.sheet-backdrop.active { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 201; background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0; padding: 12px 16px calc(24px + var(--safe-bottom));
  transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 85vh; overflow-y: auto;
}
.sheet.active { transform: translateY(0); }
.sheet-handle { width: 36px; height: 4px; background: var(--text-muted); border-radius: 2px; margin: 0 auto 16px; }

.sheet-img {
  width: 100%; height: auto; max-height: 300px; object-fit: contain; border-radius: var(--radius-sm);
  margin-bottom: 16px; background: var(--bg-card);
}
.sheet-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.sheet-desc { font-size: 14px; color: var(--text-sec); line-height: 1.5; margin-bottom: 12px; }
.sheet-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; display: flex; gap: 16px; }
.sheet-meta-item { display: flex; align-items: center; gap: 4px; }
.sheet-price { font-size: 18px; font-weight: 700; margin-bottom: 16px; }

/* Size Picker */
.size-picker { display: flex; gap: 8px; margin-bottom: 16px; }
.size-option {
  flex: 1; padding: 10px; background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); text-align: center; transition: all 0.2s;
}
.size-option.active { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.size-option-name { font-size: 14px; font-weight: 700; }
.size-option-price { font-size: 12px; color: var(--text-sec); margin-top: 2px; }
.size-option.active .size-option-price { color: var(--accent); }

.sheet-add-btn {
  width: 100%; padding: 15px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 700;
  border-radius: var(--radius-sm); transition: opacity 0.15s;
}
.sheet-add-btn:active { opacity: 0.85; }

/* Sheet qty controls */
.sheet-qty-row {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  padding: 12px; background: var(--bg-card); border-radius: var(--radius-sm);
}
.qty-btn-sheet {
  width: 40px; height: 40px; border-radius: 50%; background: var(--bg-hover);
  border: 1px solid var(--border-light); display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s;
}
.qty-btn-sheet:active { transform: scale(0.85); }
.qty-btn-sheet svg { width: 18px; height: 18px; }
.qty-num-sheet { font-size: 20px; font-weight: 800; min-width: 30px; text-align: center; }

/* Loading */
.loading { display: flex; justify-content: center; padding: 40px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Utils */
.mb-24 { margin-bottom: 24px; }
.mb-20 { margin-bottom: 20px; }
.mb-16 { margin-bottom: 16px; }
.mb-12 { margin-bottom: 12px; }
.mb-8 { margin-bottom: 8px; }
.hidden { display: none !important; }

@keyframes bump { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }
.bump { animation: bump 0.25s ease; }

/* AI Recommendation Block */
.ai-block {
  position: relative; padding: 16px; margin-bottom: 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.ai-block::before {
  content: ''; position: absolute; inset: -1px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), rgba(229, 30, 47, 0.05), transparent, rgba(229, 30, 47, 0.05), var(--accent));
  background-size: 300% 300%; animation: aiGlow 6s ease infinite; z-index: -1;
  opacity: 0.3;
}
.ai-block-inner { display: flex; gap: 12px; align-items: flex-start; }
.ai-sparkle { flex-shrink: 0; width: 20px; height: 20px; color: var(--accent); margin-top: 1px; }
.ai-text { font-size: 14px; color: var(--text-sec); line-height: 1.5; }

@keyframes aiGlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Usual Order */
.usual-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between;
}
.usual-info { flex: 1; min-width: 0; }
.usual-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.usual-items { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.usual-price { font-size: 13px; color: var(--text-sec); }
.usual-btn {
  flex-shrink: 0; padding: 10px 18px; background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700; border-radius: var(--radius-sm); transition: transform 0.12s, opacity 0.15s;
}
.usual-btn:active { transform: scale(0.95); opacity: 0.85; }

/* Popular Items */
.popular-section { margin-bottom: 20px; }
.popular-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; -ms-overflow-style: none; scrollbar-width: none; }
.popular-scroll::-webkit-scrollbar { display: none; }
.popular-item {
  flex-shrink: 0; width: 140px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 12px; transition: transform 0.12s; overflow: hidden;
}
.popular-item:active { transform: scale(0.97); }
.popular-img { width: 100%; height: 80px; object-fit: cover; border-radius: var(--radius-xs); margin-bottom: 8px; background: var(--bg-hover); }
.popular-rank { font-size: 11px; font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.popular-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popular-price { font-size: 13px; color: var(--text-sec); }

/* Coffee Profile */
.coffee-profile {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 24px;
}
.coffee-profile-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.coffee-profile-title svg { width: 16px; height: 16px; color: var(--accent); }
.coffee-profile-text { font-size: 13px; color: var(--text-sec); line-height: 1.6; }

.coffee-profile-locked {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 16px; margin-bottom: 24px; text-align: center;
}
.coffee-profile-locked-icon { font-size: 24px; margin-bottom: 8px; opacity: 0.4; }
.coffee-profile-locked-title { font-size: 14px; font-weight: 600; color: var(--text-sec); margin-bottom: 4px; }
.coffee-profile-locked-hint { font-size: 12px; color: var(--text-muted); }
.coffee-profile-locked-bar { margin-top: 12px; height: 4px; background: var(--bg-hover); border-radius: 2px; overflow: hidden; }
.coffee-profile-locked-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s; }

/* AI Chat FAB */
.chat-fab {
  position: fixed; bottom: calc(var(--dock-height) + var(--safe-bottom) + 16px); right: 16px;
  width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(229, 30, 47, 0.35); z-index: 150;
  transition: transform 0.2s, opacity 0.2s;
}
.chat-fab:active { transform: scale(0.9); }
.chat-fab svg { width: 24px; height: 24px; }
.chat-fab.hidden { transform: scale(0); opacity: 0; pointer-events: none; }

/* Chat Backdrop */
.chat-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 250;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.chat-backdrop.active { opacity: 1; pointer-events: auto; }

/* Chat Panel */
.chat-panel {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 251;
  background: var(--bg); border-radius: var(--radius) var(--radius) 0 0;
  display: flex; flex-direction: column; height: 70vh; max-height: 600px;
  transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.1);
}
.chat-panel.active { transform: translateY(0); }

.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.chat-header-title { font-size: 16px; font-weight: 700; }
.chat-close { padding: 4px; }
.chat-close svg { width: 20px; height: 20px; color: var(--text-sec); }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px;
  -webkit-overflow-scrolling: touch;
}
.chat-messages::-webkit-scrollbar { display: none; }
.chat-messages { scrollbar-width: none; }

.chat-bubble {
  max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5;
  animation: fadeUp 0.2s ease-out;
}
.chat-bubble.user {
  align-self: flex-end; background: var(--accent); color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble.model {
  align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  border-bottom-left-radius: 4px;
}

/* Chat product cards — compact horizontal cards in vertical list */
.chat-products { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; max-width: 85%; animation: fadeUp 0.25s ease-out; }
.chat-product-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px; overflow: hidden;
}
.chat-product-img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--bg-hover); flex-shrink: 0; }
.chat-product-body { flex: 1; min-width: 0; }
.chat-product-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-product-price { font-size: 12px; color: var(--text-sec); }
.chat-card-action { flex-shrink: 0; display: flex; align-items: center; }
.chat-product-add {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; transition: transform 0.12s;
}
.chat-product-add:active { transform: scale(0.85); }
.chat-product-add svg { width: 16px; height: 16px; }
.chat-card-qty { display: flex; align-items: center; gap: 6px; }
.chat-product-badge {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-hover); border: 1.5px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--accent);
}

/* Chat typing indicator */
.chat-typing { display: flex; gap: 4px; padding: 12px 14px; align-self: flex-start; }
.chat-typing-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.chat-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* Chat input */
.chat-input-row {
  display: flex; gap: 8px; padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border); flex-shrink: 0; background: var(--bg);
}
.chat-input {
  flex: 1; padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-pill); font-size: 14px;
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-send {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: transform 0.12s, opacity 0.15s;
}
.chat-send:active { transform: scale(0.85); }
.chat-send:disabled { opacity: 0.4; pointer-events: none; }
.chat-send svg { width: 18px; height: 18px; }
