/* ==========================================================================
   OnesoftPOS v1.0 - Modern Mobile-First Design System
   Color Palette: Warm Flame Amber, Emerald Success, Dark Obsidian, Clean White
   ========================================================================== */

:root {
  /* Brand Primary Colors */
  --primary: #f97316;
  --primary-hover: #ea580c;
  --primary-light: #ffedd5;
  --primary-glow: rgba(249, 115, 22, 0.25);

  /* Secondary & Accents */
  --secondary: #0f172a;
  --accent: #f59e0b;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Neutrals (Light Theme Default) */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-muted: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #cbd5e1;

  /* Text Colors */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sub: #94a3b8;
  --text-inverse: #ffffff;

  /* Shadows & Glassmorphism */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-sheet: 0 -10px 25px -5px rgba(0, 0, 0, 0.1);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* Layout dimensions */
  --header-height: 62px;
  --bottom-nav-height: 64px;

  /* Safe Area Insets (Edge-to-Edge for Android & iOS) */
  --safe-top: max(env(safe-area-inset-top, 0px), var(--android-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--android-inset-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--android-inset-left, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--android-inset-right, 0px));
}

/* Dark Theme */
body.theme-dark {
  --bg-app: #090d16;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-muted: #1e293b;
  --border-color: #2e384d;
  --border-focus: #475569;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #64748b;
  --text-inverse: #0f172a;

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 20px -5px rgba(0, 0, 0, 0.6);
  --shadow-sheet: 0 -10px 25px -5px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  background-color: var(--bg-app);
  color: var(--text-main);
  height: 100%;
  overflow: hidden;
  line-height: 1.5;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
  transition: var(--transition-fast);
}

button:active {
  transform: scale(0.97);
}

/* Utilities */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }

/* ==========================================================================
   App Layout Container
   ========================================================================== */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   Header Bar
   ========================================================================== */
/* ==========================================================================
   Header Bar (Chào Mừng Thân Thiện Phong Cách Mới)
   ========================================================================== */
.top-header {
  height: 74px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 20;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

/* Banner Chào Mừng chuẩn theo hình ảnh người dùng */
.header-banner-welcome {
  background: linear-gradient(135deg, #022c22 0%, #064e3b 35%, #065f46 70%, #047857 100%);
  border-bottom: none;
  box-shadow: 0 4px 18px rgba(2, 44, 34, 0.35);
}

/* Decorative Sky, Moon & Lanterns */
.header-banner-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.decor-stars {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(1.5px 1.5px at 12% 25%, #ffffff 100%, transparent),
    radial-gradient(1px 1px at 28% 65%, #fef08a 100%, transparent),
    radial-gradient(1.8px 1.8px at 48% 20%, #ffffff 100%, transparent),
    radial-gradient(1.2px 1.2px at 62% 70%, #fde047 100%, transparent),
    radial-gradient(2px 2px at 22% 80%, #ffffff 100%, transparent),
    radial-gradient(1.4px 1.4px at 78% 30%, #fef08a 100%, transparent),
    radial-gradient(1px 1px at 88% 75%, #ffffff 100%, transparent);
  opacity: 0.85;
}

.decor-moon {
  position: absolute;
  right: 20px;
  top: -30px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffdf2 22%, #fef08a 58%, rgba(253, 224, 71, 0.35) 78%, transparent 100%);
  box-shadow: 0 0 50px rgba(254, 240, 138, 0.6);
  opacity: 0.95;
}

.decor-lantern {
  position: absolute;
  border-radius: 6px 6px 14px 14px;
  background: linear-gradient(180deg, #ea580c 0%, #f97316 60%, #fef08a 100%);
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.8), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

.decor-lantern::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px #fef08a;
}

.lantern-1 {
  width: 36px;
  height: 44px;
  right: 60px;
  top: 14px;
  transform: rotate(-8deg);
  animation: lanternFloat 4s ease-in-out infinite alternate;
}

.lantern-2 {
  width: 24px;
  height: 30px;
  right: 110px;
  top: -4px;
  transform: rotate(10deg);
  opacity: 0.88;
  animation: lanternFloat 5s ease-in-out 1s infinite alternate;
}

.lantern-3 {
  width: 16px;
  height: 20px;
  right: 155px;
  top: -6px;
  transform: rotate(5deg);
  opacity: 0.65;
  animation: lanternFloat 6s ease-in-out 2s infinite alternate;
}

@keyframes lanternFloat {
  0% { transform: translateY(0) rotate(-8deg); }
  100% { transform: translateY(-5px) rotate(-4deg); }
}

/* Cụm Chào Mừng Bên Trái */
.header-welcome-left {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 2;
}

.header-avatar-wrapper {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  border: 2.5px solid #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  background: #065f46;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.fallback-avatar {
  width: 100%;
  height: 100%;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #10b981, #059669);
}

.header-welcome-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-greeting {
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.2px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.header-wishes {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* Cụm Tiện Ích Bên Phải */
.header-welcome-right {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 2;
}

.header-shift-pill {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.32);
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-full);
}

.header-glass-btn {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-glass-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.btn-header-note {
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  color: #ffffff;
}

.btn-header-note:hover {
  background: rgba(255, 255, 255, 0.28);
}

.header-store-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  color: #ffffff;
}

.header-store-name {
  color: #ffffff;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@media (max-width: 600px) {
  .top-header {
    height: 70px;
    padding: 0 12px;
  }
  .header-greeting {
    font-size: 16px;
  }
  .header-wishes {
    font-size: 12px;
  }
  .header-store-pill {
    display: none;
  }
  .decor-moon {
    width: 90px;
    height: 90px;
    right: 10px;
    top: -20px;
  }
  .lantern-1 {
    right: 36px;
    top: 10px;
  }
  .lantern-2 {
    right: 76px;
  }
  .lantern-3 {
    display: none;
  }
}

/* ==========================================================================
   Store Banner & Feature Pills
   ========================================================================== */
.store-banner {
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-color);
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  overflow-x: auto;
  white-space: nowrap;
}

.store-badge-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-pill {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.3px;
}

.store-type-pill {
  background: var(--primary-light);
  color: var(--primary-hover);
}

.store-address-text {
  color: var(--text-muted);
  font-size: 11px;
}

.feature-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}

.feature-chip {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.feature-chip.active {
  background: var(--success-light);
  color: #065f46;
  font-weight: 600;
}

@media (max-width: 767px) {
  .store-banner {
    min-height: 38px;
    padding: 6px 10px;
    gap: 8px;
    overflow: hidden;
  }

  .store-badge-info {
    min-width: 0;
    flex: 1 1 auto;
  }

  .store-address-text {
    display: none;
  }

  .store-type-pill {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .feature-pills {
    flex: 0 0 auto;
    gap: 5px;
  }

  .feature-chip {
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
  }

  .feature-chip i {
    font-size: 14px;
  }

  .feature-chip-label {
    display: none;
  }
}

/* ==========================================================================
   Main Content Views
   ========================================================================== */
.main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  margin-bottom: var(--bottom-nav-height);
}

.app-view {
  display: none;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.app-view.active-view {
  display: block;
}

/* ==========================================================================
   POS View (Mobile-First Layout)
   ========================================================================== */
.pos-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pos-catalog {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Order Context Bar (Takeaway / Dine-in Tabs) */
.order-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.order-type-tabs {
  display: flex;
  background: var(--bg-muted);
  padding: 3px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.type-tab-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.type-tab-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.selected-table-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary-hover);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
}

.btn-change-table {
  color: var(--primary);
  padding: 2px;
}

/* Search Bar */
.search-bar-wrapper {
  position: relative;
  padding: 10px 16px 6px;
}

.search-input {
  width: 100%;
  height: 42px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0 38px;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  transition: var(--transition-fast);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.btn-clear-search {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Category Carousel */
.category-carousel-wrapper {
  padding: 6px 16px;
  overflow: hidden;
}

.category-carousel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  padding-bottom: 4px;
}

.category-carousel::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

.cat-pill {
  white-space: nowrap;
  padding: 7px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.cat-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 10px var(--primary-glow);
}

/* Products Grid */
.products-grid-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 20px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
  cursor: pointer;
}

.product-card:active {
  transform: scale(0.97);
}

.product-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.product-emoji {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
}

.product-badge-kitchen {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text-muted);
}

.product-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-price {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
}

.btn-add-prod {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 2px 6px var(--primary-glow);
}

/* ==========================================================================
   Mobile Cart Bottom Sheet
   ========================================================================== */
.pos-cart-panel {
  position: fixed;
  bottom: var(--bottom-nav-height);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  box-shadow: var(--shadow-sheet);
  border-top: 1px solid var(--border-color);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal);
  transform: translateY(calc(100% - 66px)); /* Peek view */
  max-height: 80vh;
}

.pos-cart-panel.expanded {
  transform: translateY(0);
}

.cart-sheet-handle {
  padding: 8px 16px;
  cursor: pointer;
}

.handle-bar {
  width: 40px;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  margin: 0 auto 8px;
}

.mobile-cart-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-summary-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-icon-badge {
  position: relative;
  width: 40px;
  height: 40px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.cart-icon-badge .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-summary-text {
  display: flex;
  flex-direction: column;
}

.cart-summary-text .text-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.cart-summary-text .text-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.btn-toggle-cart {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-muted);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

/* Cart Items Container */
.cart-items-container {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
  min-height: 120px;
  max-height: 38vh;
}

.cart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
  text-align: center;
}

.cart-empty-illustration {
  font-size: 40px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.empty-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
}

.empty-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.cart-item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-color);
  gap: 12px;
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
}

.cart-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 3px 0;
}

.cart-item-tag {
  font-size: 10px;
  background: var(--bg-muted);
  color: var(--text-muted);
  padding: 1px 5px;
  border-radius: 3px;
}

.cart-item-note {
  font-size: 11px;
  color: var(--accent);
  font-style: italic;
}

.cart-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.cart-item-price {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
}

.cart-qty-control {
  display: flex;
  align-items: center;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.cart-btn-qty {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-main);
}

.cart-qty-val {
  width: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
}

/* Cart Footer */
.cart-footer {
  padding: 12px 16px;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-color);
}

.cart-tools {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.btn-tool {
  flex: 1;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.price-breakdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.breakdown-row.text-discount {
  color: var(--danger);
  font-weight: 600;
}

.breakdown-row.total-row {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  padding-top: 4px;
  border-top: 1px dashed var(--border-color);
}

.grand-total {
  color: var(--primary);
}

.checkout-actions {
  display: flex;
  gap: 8px;
}

.btn-checkout {
  flex: 2;
  height: 46px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-checkout:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-badge-amount {
  background: rgba(255, 255, 255, 0.25);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.btn-send-kitchen {
  flex: 1;
  height: 46px;
  background: var(--secondary);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ==========================================================================
   Bottom Navigation Bar
   ========================================================================== */
.bottom-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 60;
  box-shadow: var(--shadow-lg);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 0;
  position: relative;
}

.nav-item i {
  font-size: 18px;
}

.nav-item.active {
  color: var(--primary);
  font-weight: 800;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  width: 24px;
  height: 3px;
  background: var(--primary);
  border-radius: var(--radius-full);
}

/* ==========================================================================
   Tables View & Sơ Đồ Bàn (Rule 21, 22, 23)
   ========================================================================== */
.tables-view-container {
  padding: 16px;
}

.view-header {
  margin-bottom: 14px;
}

.view-header h2 {
  font-size: 18px;
  font-weight: 800;
}

.tables-legend {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 11px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-empty { background: var(--success); }
.dot-occupied { background: var(--danger); }
.dot-reserved { background: var(--warning); }

.area-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
}

.area-tab {
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.area-tab.active {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}

.tables-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.table-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
  transition: var(--transition-fast);
}

.table-card.status-EMPTY {
  border-color: rgba(16, 185, 129, 0.4);
}

.table-card.status-OCCUPIED {
  border-color: rgba(239, 68, 68, 0.5);
  background: linear-gradient(to bottom, var(--bg-surface), rgba(239, 68, 68, 0.05));
}

.table-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.table-code-badge {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.table-status-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.table-card.status-EMPTY .table-status-pill {
  background: var(--success-light);
  color: #065f46;
}

.table-card.status-OCCUPIED .table-status-pill {
  background: var(--danger-light);
  color: #991b1b;
}

.table-order-info {
  margin-top: 8px;
  font-size: 11px;
}

.table-amount {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
}

/* ==========================================================================
   Kitchen Display System (KDS) View (Rule 26)
   ========================================================================== */
.kds-view-container {
  padding: 16px;
}

.kds-filter-tabs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.kds-tab {
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.kds-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.kds-orders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}

.kds-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.kds-card-header {
  background: var(--bg-muted);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.kds-order-title {
  font-weight: 800;
  font-size: 14px;
}

.kds-timer {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}

.kds-card-items {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kds-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kds-item-left {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.kds-qty-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
}

.btn-kds-action {
  padding: 10px 12px;
  min-height: 40px;
  white-space: nowrap;
  background: var(--success);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
}

.btn-kds-action.status-PENDING {
  background: var(--warning);
  color: #fff;
}

.btn-kds-action.status-PREPARING {
  background: var(--success);
  color: #fff;
}

.kds-item-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 16px;
}

.btn-kds-cancel {
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  width: 36px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
  background: #fff1f2;
  color: #be123c;
  cursor: pointer;
  font-weight: 700;
}

.btn-kds-cancel:disabled {
  opacity: .55;
  cursor: wait;
}

/* Completed dishes waiting for payment */
.completed-items-view-container {
  padding: 16px;
}

.completed-items-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.completed-items-summary {
  display: flex;
  gap: 8px;
  margin: 12px 0 14px;
  color: var(--text-muted);
  font-size: 12px;
}

.completed-summary-chip {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
}

.completed-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.completed-order-card {
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--success);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.completed-order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--success-light) 55%, var(--bg-surface));
}

.completed-order-place {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}

.completed-order-time {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-muted);
}

.completed-order-items {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 14px;
}

.completed-item-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border-color);
}

.completed-item-row:last-child {
  border-bottom: 0;
}

.completed-item-details {
  min-width: 0;
}

.completed-item-details strong {
  display: block;
  font-size: 13px;
}

.completed-item-details small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
}

.completed-status-badge {
  padding: 4px 7px;
  border-radius: var(--radius-full);
  background: var(--success-light);
  color: var(--success);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

/* ==========================================================================
   Orders View & History Table (Rule 25)
   ========================================================================== */
.orders-view-container {
  padding: 16px;
}

.order-status-tabs {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
}

.status-tab {
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-tab.active {
  background: var(--secondary);
  color: #fff;
}

.orders-list-table-wrapper {
  margin-top: 14px;
  overflow-x: auto;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.orders-table th {
  padding: 12px 14px;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
}

.orders-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

#ordersTable .order-history-row:hover {
  background: color-mix(in srgb, var(--primary-light) 24%, var(--bg-surface));
}

.order-time-cell {
  color: var(--text-muted) !important;
  white-space: nowrap;
}

.order-time-cell i {
  margin-right: 4px;
}

.order-type-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  white-space: nowrap;
}

.order-customer-cell {
  min-width: 260px;
  line-height: 1.35;
}

.order-customer-cell small {
  color: var(--text-muted);
}

.order-total-cell {
  white-space: nowrap;
}

.order-cell-label {
  display: none;
}

.order-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.order-row-actions .btn-sm {
  min-height: 40px;
  border-radius: 12px;
}

.order-row-actions .btn-reprint {
  min-width: 42px;
}

.order-row-actions .btn-pay-now {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding-inline: 14px;
}

.order-row-actions .is-repayment {
  background: var(--secondary);
}

.order-row-actions .action-label {
  display: none;
}

/* ==========================================================================
   Admin View & Subtabs
   ========================================================================== */
.admin-view-container {
  padding: 16px;
}

.admin-tabs-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 16px;
  padding-bottom: 4px;
}

.admin-nav-tab {
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-nav-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.admin-subview {
  display: none;
}

.admin-subview.active {
  display: block;
}

.report-revenue-header {
  margin-bottom: 16px;
}

.report-revenue-header h3 {
  margin: 0 0 12px;
}

.report-date-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 220px)) auto;
  align-items: end;
  gap: 10px;
}

.report-date-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.report-date-field .form-input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
}

.report-filter-button {
  min-height: 42px;
  white-space: nowrap;
}

.btn-print-draft,
.btn-print-order-slip {
  flex: 1;
  min-width: 132px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-muted);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn-print-draft:disabled,
.btn-print-order-slip:disabled,
.btn-send-kitchen:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .checkout-actions {
  flex-wrap: wrap;
}

.takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .btn-send-kitchen {
  flex: 2 1 220px;
  background: var(--primary);
}

.takeaway-fulfillment-panel {
  margin: 10px 0;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.fulfillment-type-group > label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
}

.fulfillment-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.fulfillment-details .form-group { margin-bottom: 0; }
.fulfillment-address-field { grid-column: 1 / -1; }

@media (max-width: 640px) {
  .fulfillment-details { grid-template-columns: 1fr; }
  .fulfillment-address-field { grid-column: auto; }
}

.reports-summary-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.report-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.report-card .card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.card-revenue .card-icon { background: var(--primary-light); color: var(--primary); }
.card-orders .card-icon { background: var(--info); color: #fff; }
.card-avg .card-icon { background: var(--success-light); color: var(--success); }

.report-card .card-data {
  display: flex;
  flex-direction: column;
}

.card-label {
  font-size: 11px;
  color: var(--text-muted);
}

.card-value {
  font-size: 18px;
  font-weight: 800;
}

.reports-split-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.report-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.box-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 12px;
}

.top-products-list, .payment-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-prod-row, .pay-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 12px;
}

/* Feature Toggles List (Rule 40 & 46) */
.store-types-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.store-type-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.features-toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.feature-toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

/* Switch Toggle UI */
.switch-input {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch-input input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

/* ==========================================================================
   Modals & Bottom Sheet Dialogs
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end; /* Bottom sheet on mobile */
  justify-content: center;
}

.modal-sheet-dialog {
  background: var(--bg-surface);
  width: 100%;
  max-height: 85vh;
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-dialog {
  background: var(--bg-surface);
  width: 92%;
  max-width: 480px;
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  margin: auto;
  animation: scaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  max-height: 90vh;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-box h3 {
  font-size: 15px;
  font-weight: 800;
}

.modal-price {
  font-size: 13px;
  color: var(--primary);
  font-weight: 700;
}

.btn-close-modal {
  font-size: 24px;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
}

/* Modifiers Layout */
.modifier-group {
  margin-bottom: 16px;
}

.group-title {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.badge-req {
  font-size: 10px;
  color: var(--danger);
  margin-left: 4px;
}

.badge-opt {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 4px;
}

.size-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.size-option-btn {
  padding: 10px 8px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.size-option-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-hover);
}

.toppings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topping-checkbox-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
}

.modifier-quantity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}

.qty-control-box {
  display: flex;
  align-items: center;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.btn-qty {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.qty-display {
  width: 36px;
  text-align: center;
  font-weight: 800;
  font-size: 14px;
}

/* Form inputs & buttons */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  height: 42px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 12px;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
}

textarea.form-input {
  min-height: 88px;
  height: auto;
  padding: 10px 12px;
  resize: vertical;
}

.manager-workflow-row {
  margin: 10px 0;
  padding: 12px;
}

.form-input-lg {
  height: 50px;
  font-size: 18px;
  font-weight: 800;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 700;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-secondary {
  background: var(--bg-muted);
  color: var(--text-main);
  border-radius: var(--radius-md);
  font-weight: 700;
  padding: 10px 16px;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 700;
  padding: 10px 16px;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Payment Methods & VietQR (Rule 28) */
.checkout-summary-banner {
  background: var(--primary-light);
  color: var(--primary-hover);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.total-big {
  font-size: 20px;
  font-weight: 800;
}

.payment-method-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.pay-method-btn {
  padding: 10px;
  background: var(--bg-muted);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pay-method-btn.active {
  background: var(--bg-surface);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.quick-cash-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.cash-tag {
  padding: 6px 10px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}

.cash-change-display {
  background: var(--success-light);
  color: #065f46;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-top: 10px;
}

.change-amount {
  font-size: 16px;
  font-weight: 800;
}

.vietqr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.qr-image-wrapper {
  width: 220px;
  height: 220px;
  background: #fff;
  border-radius: var(--radius-md);
  padding: 8px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.vietqr-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-details-box {
  background: var(--bg-muted);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  text-align: left;
  line-height: 1.6;
  margin-top: 8px;
}

/* Receipt Paper Styles (58mm / 80mm Print) */
.receipt-paper {
  background: #fff;
  color: #000;
  font-family: 'Courier New', Courier, monospace;
  padding: 2px 16px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-sm);
  max-width: 320px;
  margin: 0 auto;
}

.receipt-header-center, .receipt-footer-center {
  text-align: center;
}

.receipt-logo { font-size: 28px; }
.receipt-title { font-size: 1.5em; font-weight: bold; margin: 8px 0 6px; }
.receipt-header-center h2 { font-size: 1.7em; }
.receipt-meta { border-top: 1px dashed #888; padding-top: 4px; margin-top: 4px; }
.receipt-meta p { margin: 2px 0; }
.receipt-meta .receipt-row { gap: 8px; font-size: .9em; }
.receipt-meta .receipt-row > :last-child,
.receipt-totals-box .receipt-row > :last-child { flex-shrink: 0; white-space: nowrap; }
.receipt-payment-qr { text-align: center; margin: 4px auto; break-inside: avoid; }
.receipt-payment-qr img { display: block; width: 38mm; max-width: 100%; height: auto; margin: 2px auto; image-rendering: pixelated; }
.receipt-payment-qr p { font-size: .9em; margin: 2px 0; }
.receipt-divider { text-align: center; overflow: hidden; margin: 2px 0; }
.receipt-footer-center { line-height: 1.25; }
.receipt-footer-center p { margin: 0; }
.receipt-software-tag { font-size: .85em; }
.receipt-items-table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.receipt-items-table th, .receipt-items-table td { padding: 4px 2px; border: 1px solid #aaa; vertical-align: top; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.receipt-totals-box { margin: 6px 0; }
.receipt-row { display: flex; justify-content: space-between; padding: 2px 0; }
.receipt-row.grand-total { font-weight: bold; font-size: 1.4em; }
#receiptTotalLabel { font-size: .85em; }

/* ==========================================================================
   Table Action Modal & Action Tiles (Rule 21, 22, 23)
   ========================================================================== */
.table-action-dialog {
  max-width: 480px;
  width: 94%;
  margin: auto;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  background: #ffffff;
  overflow: hidden;
  animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

@keyframes modalPop {
  0% { opacity: 0; transform: scale(0.96) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@media (max-width: 540px) {
  .table-action-dialog {
    max-width: 100%;
    width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    margin-bottom: 0;
    margin-top: auto;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }
}

.table-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-header-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-code-badge {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #ffffff;
  font-size: 19px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.25);
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

.table-meta-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.table-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-name-row h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.table-submeta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.meta-dot {
  color: #cbd5e1;
  font-weight: 700;
}

.table-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}

.table-status-badge.status-occupied {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.table-status-badge.status-reserved {
  background: #e0e7ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
  display: inline-block;
  animation: pulseDot 1.8s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

.table-modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* Overview Bill Card */
.table-bill-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1.5px solid #fed7aa;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.08);
}

.bill-overview-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #9a3412;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
}

.bill-overview-amount {
  font-size: 22px;
  font-weight: 800;
  color: #ea580c;
  line-height: 1.2;
  margin-top: 2px;
}

.bill-overview-extra {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.bill-order-code {
  font-size: 11.5px;
  font-weight: 700;
  color: #0f172a;
  background: #ffffff;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #fed7aa;
}

.bill-time-tag {
  font-size: 11px;
  color: #9a3412;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Action Tiles */
.table-order-details {
  margin: 12px 0 16px;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-surface, #fff);
}

.order-detail-dialog { max-width: 680px; }
#orderDetailItems { display: grid; gap: 10px; max-height: 62vh; overflow-y: auto; }
.history-order-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-left: 4px solid #f59e0b;
  border-radius: 12px;
}
.history-order-item.status-preparing { border-left-color: #3b82f6; }
.history-order-item.status-ready,
.history-order-item.status-served { border-left-color: #10b981; }
.history-order-item.status-cancelled { border-left-color: #ef4444; background: rgba(239,68,68,.04); }
.history-order-item-main { display: grid; gap: 4px; min-width: 0; }
.history-order-item-side { display: grid; justify-items: end; gap: 6px; white-space: nowrap; }
.history-item-status { padding: 4px 8px; border-radius: 999px; background: var(--bg-muted); font-size: 11px; font-weight: 700; }
.status-cancelled .history-item-status { background: #fee2e2; color: #991b1b; }
.status-ready .history-item-status,
.status-served .history-item-status { background: #d1fae5; color: #065f46; }
.cancel-audit { color: #b91c1c; }

.table-order-details-header,
.table-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.table-order-details-header { padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.table-order-details-header span { color: var(--text-muted); font-size: 12px; }
#tableOrderItems { max-height: 240px; overflow-y: auto; }
.table-order-loading { padding: 12px 0; }
.table-order-item { padding: 10px 0; border-bottom: 1px dashed var(--border-color); }
.table-order-item:last-child { border-bottom: 0; }
.table-order-item-main { display: grid; gap: 3px; }
.table-order-item-main small { color: var(--text-muted); }
.table-order-item-side { display: grid; justify-items: end; gap: 5px; white-space: nowrap; }
.order-item-status { padding: 3px 7px; border-radius: 999px; font-size: 11px; background: #fef3c7; color: #92400e; }
.order-item-status.status-preparing { background: #dbeafe; color: #1d4ed8; }
.order-item-status.status-ready,
.order-item-status.status-served { background: #d1fae5; color: #065f46; }
.order-item-status.status-cancelled { background: #fee2e2; color: #991b1b; }
.btn-cancel-order-item {
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 5px 8px;
  background: #fff1f2;
  color: #be123c;
  cursor: pointer;
  font-weight: 700;
}
.btn-cancel-order-item:disabled { opacity: .55; cursor: wait; }

.table-action-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-action-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  cursor: pointer;
  text-align: left !important;
  justify-content: flex-start !important;
  width: 100%;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  outline: none;
  font-family: inherit;
  position: relative;
}

.btn-action-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.btn-action-tile:active {
  transform: translateY(0);
}

.btn-action-tile.active-subpanel {
  border-color: #ea580c !important;
  background: #fffaf5 !important;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15) !important;
}

.btn-action-tile.active-subpanel .tile-arrow-toggle {
  transform: rotate(180deg);
  color: #ea580c;
}

/* Tile Icon Box */
.tile-icon-box {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.btn-action-tile:hover .tile-icon-box {
  transform: scale(1.08);
}

/* Specific themes for tiles */
.tile-pos {
  border-color: #fdba74;
}

.tile-pos:hover {
  border-color: #f97316;
  background: #fffdfb;
}

.tile-pos .tile-icon-box {
  background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
  color: #ea580c;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25);
}

.tile-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tile-badge-recommend {
  background: #ea580c;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 1.5px 6px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.tile-transfer:hover {
  border-color: #60a5fa;
  background: #f8faff;
}

.tile-transfer .tile-icon-box {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.tile-merge:hover {
  border-color: #c084fc;
  background: #faf8ff;
}

.tile-merge .tile-icon-box {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  color: #7c3aed;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2);
}

/* Tile Content */
.tile-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
  text-align: left;
}

.tile-content strong {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
  display: block;
}

.tile-content span {
  font-size: 12px;
  color: #64748b;
  line-height: 1.35;
  display: block;
}

.tile-arrow {
  font-size: 13px;
  color: #94a3b8;
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  margin-left: 4px;
}

.btn-action-tile:hover .tile-arrow {
  color: #ea580c;
}

/* Quick Action Icon Buttons (Thêm món, Chuyển bàn, Ghép bàn) */
.table-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 4px;
}

.btn-quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 6px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.btn-quick-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.07);
}

.btn-quick-action:active {
  transform: translateY(0);
}

.quick-action-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 17px;
  transition: transform 0.2s ease;
}

.btn-quick-action:hover .quick-action-icon {
  transform: scale(1.08);
}

.quick-action-label {
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

/* Specific themes for Quick Actions */
.btn-quick-action.action-pos {
  border-color: #fed7aa;
}
.btn-quick-action.action-pos:hover {
  border-color: #f97316;
  background: #fffdfb;
}
.btn-quick-action.action-pos .quick-action-icon {
  background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
  color: #ea580c;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.22);
}

.btn-quick-action.action-transfer:hover {
  border-color: #60a5fa;
  background: #f8faff;
}
.btn-quick-action.action-transfer .quick-action-icon {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}
.btn-quick-action.action-transfer.active-subpanel {
  border-color: #2563eb !important;
  background: #eff6ff !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

.btn-quick-action.action-merge:hover {
  border-color: #c084fc;
  background: #faf8ff;
}
.btn-quick-action.action-merge .quick-action-icon {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  color: #7c3aed;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2);
}
.btn-quick-action.action-merge.active-subpanel {
  border-color: #7c3aed !important;
  background: #faf5ff !important;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15) !important;
}

/* Modal Footer Actions (In Hóa Đơn & Thanh Toán) */
.table-modal-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.03);
  flex-shrink: 0;
}

.btn-table-action {
  height: 44px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  border: none;
}

.btn-table-print {
  flex: 1;
  background: #ffffff;
  color: #334155;
  border: 1.5px solid #cbd5e1;
}

.btn-table-print:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
}

.btn-table-checkout {
  flex: 1.4;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
}

.btn-table-checkout:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.4);
}

.btn-table-action:disabled {
  opacity: 0.5;
  cursor: not-allowed !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Subpanels (Transfer / Merge select boxes) */
.action-subpanel {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
  margin: 6px 0 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  animation: subpanelSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes subpanelSlide {
  0% { opacity: 0; transform: translateY(-8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.subpanel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: #ea580c;
}

.subpanel-header i {
  font-size: 14px;
}

.subpanel-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.custom-table-select {
  width: 100%;
  height: 42px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: #1e293b;
  background: #f8fafc;
  outline: none;
  margin-bottom: 12px;
  transition: all 0.15s ease;
}

.custom-table-select:focus {
  border-color: #ea580c;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

.subpanel-actions {
  display: flex;
  gap: 10px;
}

.btn-subpanel-cancel {
  flex: 1;
  height: 40px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-subpanel-cancel:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-subpanel-confirm {
  flex: 2;
  height: 40px;
  background: #ea580c;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25);
  transition: opacity 0.15s ease;
}

.btn-subpanel-confirm:hover {
  opacity: 0.92;
}

.btn-subpanel-confirm.btn-merge-confirm {
  background: #7c3aed;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

/* Quick Login buttons */
.quick-login-divider {
  text-align: center;
  margin: 16px 0 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.quick-login-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.btn-quick-login {
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  padding: 8px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.btn-quick-login:hover {
  background: var(--primary-light);
  color: var(--primary-hover);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 24px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast-msg {
  background: var(--secondary);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  box-sizing: border-box;
  text-align: center;
  overflow-wrap: anywhere;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Responsive Tablet & Desktop Layouts (min-width: 768px & 1024px)
   ========================================================================== */
@media (min-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .tables-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .kds-orders-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .reports-summary-cards {
    grid-template-columns: repeat(3, 1fr);
  }
  .reports-split-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  /* POS Split Screen on Desktop */
  .pos-layout {
    flex-direction: row;
    height: 100%;
  }

  .pos-catalog {
    flex: 1;
    overflow-y: hidden;
  }

  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .pos-cart-panel {
    position: static;
    width: 380px;
    height: 100%;
    max-height: 100%;
    transform: none !important;
    border-radius: 0;
    border-top: none;
    border-left: 1px solid var(--border-color);
  }

  .cart-sheet-handle {
    display: none;
  }

  .cart-header.desktop-only {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
  }

  .cart-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
  }

  .btn-clear-cart {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
  }

  .btn-clear-cart:hover {
    color: var(--danger);
  }

  .cart-items-container {
    max-height: none;
    flex: 1;
  }

  .modal-sheet-dialog {
    width: 92%;
    max-width: 480px;
    border-radius: var(--radius-xl);
    margin: auto;
    animation: scaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .tables-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .kds-orders-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================================================
   iPhone / small-screen experience
   ========================================================================== */
@supports (height: 100dvh) {
  html,
  body,
  .app-container {
    height: 100dvh;
    max-height: 100dvh;
  }
}

@media (max-width: 520px) {
  :root {
    --header-height: calc(58px + var(--safe-top));
    --bottom-nav-height: calc(64px + var(--safe-bottom));
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    padding-right: var(--safe-right);
    padding-left: var(--safe-left);
    overscroll-behavior: none;
  }

  button,
  a,
  input,
  select,
  textarea {
    touch-action: manipulation;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  :focus-visible {
    outline: 3px solid rgba(249, 115, 22, 0.35);
    outline-offset: 2px;
  }

  .top-header {
    min-height: var(--header-height);
    padding: var(--safe-top) 8px 0;
    gap: 6px;
  }

  .header-left,
  .header-right {
    gap: 6px;
  }

  .brand-name,
  .user-meta {
    display: none;
  }

  .logo-icon,
  .icon-btn,
  .btn-shift-pill {
    min-width: 42px;
    width: 42px;
    height: 42px;
  }

  .store-selector-wrapper {
    min-width: 112px;
    max-width: 145px;
    height: 42px;
    padding: 0 8px;
  }

  .store-select-header {
    min-width: 0;
    width: 100%;
    height: 100%;
    text-overflow: ellipsis;
  }

  #shiftBadgeText {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .user-profile {
    min-width: 76px;
    width: auto;
    height: 42px;
    padding: 4px;
    justify-content: space-between;
  }

  .avatar {
    width: 34px;
    height: 34px;
  }

  .btn-logout {
    min-width: 38px;
    min-height: 38px;
  }

  .main-content {
    min-height: 0;
    margin-bottom: var(--bottom-nav-height);
  }

  .store-banner {
    min-height: 38px;
    padding: 6px 10px;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
  }

  .store-badge-info {
    min-width: 0;
    flex: 1 1 auto;
  }

  .store-address-text {
    display: none;
  }

  .store-type-pill {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .feature-pills {
    flex: 0 0 auto;
    gap: 5px;
  }

  .feature-chip {
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
  }

  .feature-chip i {
    font-size: 14px;
  }

  .feature-chip-label {
    display: none;
  }

  .tables-view-container,
  .orders-view-container,
  .kds-view-container,
  .completed-items-view-container,
  .admin-view-container {
    padding: 10px 12px calc(92px + var(--safe-bottom));
  }

  .pos-catalog {
    min-width: 0;
  }

  .order-type-tabs,
  .area-tabs,
  .kds-filter-tabs,
  .order-status-tabs,
  .admin-tabs-nav {
    width: 100%;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .order-type-tabs::-webkit-scrollbar,
  .area-tabs::-webkit-scrollbar,
  .kds-filter-tabs::-webkit-scrollbar,
  .order-status-tabs::-webkit-scrollbar,
  .admin-tabs-nav::-webkit-scrollbar,
  .category-carousel::-webkit-scrollbar,
  .bottom-nav-bar::-webkit-scrollbar {
    display: none;
  }

  .type-tab-btn,
  .area-tab,
  .kds-tab,
  .status-tab,
  .admin-nav-tab {
    min-height: 40px;
    flex: 1 0 auto;
    scroll-snap-align: start;
  }

  .takeaway-fulfillment-panel {
    padding: 10px;
    border-radius: 12px;
  }

  .fulfillment-details {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .search-input {
    min-height: 44px;
  }

  .category-carousel {
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .cat-pill {
    min-height: 40px;
    scroll-snap-align: start;
  }

  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding-bottom: 104px;
  }

  .product-card {
    min-width: 0;
  }

  .product-title {
    display: -webkit-box;
    min-height: 2.6em;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .btn-add-prod {
    min-width: 38px;
    min-height: 38px;
  }

  .pos-cart-panel {
    right: var(--safe-right);
    bottom: var(--bottom-nav-height);
    left: var(--safe-left);
    max-height: calc(100dvh - var(--header-height) - 10px);
    border-radius: 18px 18px 0 0;
    transform: translateY(calc(100% - 72px));
  }

  .pos-cart-panel.expanded {
    transform: translateY(0);
  }

  .cart-header.desktop-only {
    display: none;
  }

  .cart-sheet-handle {
    min-height: 44px;
  }

  .btn-toggle-cart,
  .btn-tool {
    min-height: 40px;
  }

  .cart-items-container {
    overscroll-behavior: contain;
  }

  .cart-btn-qty,
  .btn-remove-cart-item {
    min-width: 38px;
    min-height: 38px;
  }

  .cart-footer {
    padding-bottom: calc(12px + var(--safe-bottom));
  }

  .btn-checkout,
  .btn-send-kitchen,
  .btn-print-order-slip,
  .pay-method-btn {
    min-height: 48px;
  }

  .bottom-nav-bar {
    min-height: var(--bottom-nav-height);
    height: var(--bottom-nav-height);
    padding: 4px max(4px, var(--safe-right)) var(--safe-bottom) max(4px, var(--safe-left));
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .nav-item {
    min-width: 62px;
    min-height: 54px;
    padding: 5px 4px;
    gap: 3px;
  }

  .nav-item i {
    font-size: 19px;
  }

  .nav-item span {
    max-width: 68px;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .orders-list-table-wrapper,
  .table-responsive {
    overflow: visible;
  }

  #ordersTable,
  .admin-products-table-wrapper .orders-table,
  .admin-staff-table-wrapper .orders-table {
    display: block;
    min-width: 0;
  }

  #ordersTable thead,
  .admin-products-table-wrapper .orders-table thead,
  .admin-staff-table-wrapper .orders-table thead {
    display: none;
  }

  #ordersTable tbody,
  .admin-products-table-wrapper .orders-table tbody,
  .admin-staff-table-wrapper .orders-table tbody {
    display: grid;
    gap: 10px;
  }

  #ordersTable tr,
  .admin-products-table-wrapper .orders-table tr,
  .admin-staff-table-wrapper .orders-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-surface);
  }

  #ordersTable td,
  .admin-products-table-wrapper .orders-table td,
  .admin-staff-table-wrapper .orders-table td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  #ordersTable td:last-child,
  .admin-products-table-wrapper .orders-table td:last-child,
  .admin-staff-table-wrapper .orders-table td:last-child {
    grid-column: 1 / -1;
  }

  #ordersTable .order-history-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    padding: 14px;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 3px 14px rgba(15, 23, 42, 0.08);
  }

  #ordersTable .order-code-cell {
    align-self: center;
    color: var(--text-main);
    font-size: 15px;
  }

  #ordersTable .order-time-cell {
    align-self: center;
    text-align: right;
  }

  #ordersTable .order-type-cell {
    grid-column: 1 / -1;
  }

  #ordersTable .order-type-chip {
    min-height: 28px;
    padding: 4px 9px;
    color: var(--primary-hover);
    background: var(--primary-light);
    font-size: 11px;
    font-weight: 700;
  }

  #ordersTable .order-customer-cell {
    grid-column: 1 / -1;
    min-width: 0;
    padding: 10px 11px;
    border-radius: 10px;
    background: var(--bg-muted);
  }

  #ordersTable .order-total-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  #ordersTable .order-cell-label {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  #ordersTable .order-payment-cell {
    align-self: end;
    text-align: right;
  }

  #ordersTable .order-status-cell {
    grid-column: 1 / -1;
  }

  #ordersTable .order-actions-cell {
    padding-top: 2px;
  }

  #ordersTable .order-row-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
  }

  #ordersTable .order-row-actions .btn-sm {
    min-height: 46px;
  }

  #ordersTable .order-row-actions .btn-reprint {
    min-width: 46px;
  }

  #ordersTable .order-row-actions .btn-pay-now,
  #ordersTable .order-row-actions .btn-confirm-order {
    width: 100%;
  }

  .kds-orders-grid {
    grid-template-columns: 1fr;
  }

  .reports-summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .subview-header,
  .view-header {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .subview-header button,
  .view-header button {
    min-height: 44px;
  }

  .report-revenue-header {
    display: block;
  }

  .report-date-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    width: 100%;
  }

  .feature-grid,
  .permissions-grid {
    grid-template-columns: 1fr;
  }

  .modal-overlay,
  .modal {
    align-items: flex-end;
    padding: var(--safe-top) 0 0;
  }

  .modal-dialog,
  .modal-sheet-dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - var(--safe-top));
    margin: 0;
    border-radius: 20px 20px 0 0;
  }

  .modal-body {
    overscroll-behavior: contain;
  }

  .modal-footer,
  .modal-actions {
    padding-bottom: calc(14px + var(--safe-bottom));
  }

  .modal-footer button,
  .modal-actions button {
    min-height: 48px;
  }

  .toast-container,
  #toastContainer {
    top: calc(10px + var(--safe-top));
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    transform: none;
    align-items: center;
  }

  .toast-msg {
    width: fit-content;
  }
}

@media (max-width: 520px) {
  .report-date-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-filter-button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 374px) {
  .products-grid,
  .reports-summary-cards {
    grid-template-columns: 1fr;
  }

  .report-date-filter {
    grid-template-columns: 1fr;
  }

  .report-filter-button {
    grid-column: auto;
  }

  .avatar {
    display: none;
  }
}

@media (orientation: landscape) and (min-width: 700px) and (max-height: 520px) {
  :root {
    --header-height: calc(50px + var(--safe-top));
    --bottom-nav-height: calc(54px + var(--safe-bottom));
  }

  .store-banner {
    display: none;
  }

  .pos-layout {
    display: flex;
    padding: 8px 356px 8px 10px;
  }

  .products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pos-cart-panel {
    top: var(--header-height);
    right: var(--safe-right);
    bottom: var(--bottom-nav-height);
    left: auto;
    width: 346px;
    max-height: none;
    border-radius: 0;
    transform: none;
  }

  .cart-header.desktop-only {
    display: flex;
  }

  .cart-sheet-handle {
    display: none;
  }
}

/* ==========================================================================
   Takeaway multi-customer order workspace
   ========================================================================== */
.takeaway-workspace-tabs {
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 54px;
  padding: 7px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
}

.takeaway-workspace-tab,
.takeaway-new-customer-btn {
  min-height: 40px;
  padding: 8px 13px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.takeaway-workspace-tab {
  position: relative;
  background: var(--bg-muted);
}

.takeaway-workspace-tab.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 4px 10px var(--primary-glow);
}

.takeaway-new-customer-btn {
  margin-left: auto;
  color: var(--primary);
  background: var(--primary-light);
}

.takeaway-draft-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 10px;
  color: var(--primary);
  background: #fff;
  font-size: 10px;
}

.takeaway-active-order-hint {
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 16px 0;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border-color));
  border-radius: var(--radius-md);
  color: var(--text-main);
  background: var(--primary-light);
  font-size: 12px;
}

.takeaway-active-order-hint button {
  min-height: 34px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--primary);
  font-weight: 700;
  white-space: nowrap;
}

.takeaway-drafts-panel {
  flex: 0 0 auto;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
}

.takeaway-drafts-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.takeaway-drafts-heading button,
.takeaway-only-store .cart-header .btn-clear-cart {
  min-height: 40px;
  padding: 7px 10px;
}

.takeaway-drafts-heading > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.takeaway-drafts-heading small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10px;
}

.takeaway-draft-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 9px;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-color: var(--primary) var(--bg-muted);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.takeaway-draft-list::-webkit-scrollbar {
  height: 8px;
}

.takeaway-draft-list::-webkit-scrollbar-track {
  background: var(--bg-muted);
  border-radius: 999px;
}

.takeaway-draft-list::-webkit-scrollbar-thumb {
  background: var(--primary);
  border: 2px solid var(--bg-muted);
  border-radius: 999px;
}

.takeaway-draft-chip {
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
  overflow: hidden;
  scroll-snap-align: start;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.takeaway-draft-chip.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.takeaway-draft-select {
  display: flex;
  min-width: 128px;
  min-height: 48px;
  padding: 7px 10px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.takeaway-draft-select small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10px;
}

.takeaway-draft-remove {
  min-width: 36px;
  color: var(--text-muted);
  border-left: 1px solid var(--border-color);
}

.takeaway-draft-remove:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.takeaway-only-store #viewPos.active-view {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.takeaway-only-store #posWorkspace {
  flex: 1 1 auto;
  min-height: 0;
}

.takeaway-only-store .order-context-bar {
  display: none;
}

.takeaway-only-store #posWorkspace[data-takeaway-pane="menu"] .pos-cart-panel {
  display: none;
}

.takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .pos-catalog {
  display: none;
}

.takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] {
  display: block;
  overflow: hidden;
  padding: 12px;
}

.takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .pos-cart-panel {
  position: static;
  display: flex;
  width: min(100%, 920px);
  height: 100%;
  min-height: 0;
  max-height: none;
  margin: 0 auto;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior-y: contain;
  scrollbar-color: var(--primary) var(--bg-muted);
  scrollbar-gutter: stable;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transform: none !important;
  -webkit-overflow-scrolling: touch;
}

.takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .pos-cart-panel::-webkit-scrollbar {
  width: 10px;
}

.takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .pos-cart-panel::-webkit-scrollbar-track {
  background: var(--bg-muted);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .pos-cart-panel::-webkit-scrollbar-thumb {
  background: var(--primary);
  border: 2px solid var(--bg-muted);
  border-radius: 999px;
}

.takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .cart-sheet-handle {
  display: none;
}

.takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .cart-header.desktop-only {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .takeaway-fulfillment-panel {
  flex: 0 0 auto;
  margin: 10px 16px;
}

.takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .cart-items-container {
  flex: 0 0 auto;
  min-height: 90px;
  max-height: none;
  overflow: visible;
}

.takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .cart-footer {
  flex: 0 0 auto;
}

@media (max-width: 520px) {
  .takeaway-workspace-tabs {
    padding: 7px 8px;
  }

  .takeaway-workspace-tab,
  .takeaway-new-customer-btn {
    min-height: 42px;
    padding: 7px 10px;
  }

  .takeaway-new-customer-btn {
    font-size: 0;
  }

  .takeaway-new-customer-btn i {
    font-size: 14px;
  }

  .takeaway-active-order-hint {
    margin-right: 12px;
    margin-left: 12px;
  }

  .takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] {
    padding: 0;
  }

  .takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .pos-cart-panel {
    width: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
  }

  .takeaway-drafts-panel {
    padding: 10px 12px 7px;
  }

  .takeaway-drafts-heading small {
    display: none;
  }

  .takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .takeaway-fulfillment-panel {
    flex: 0 0 auto;
    margin: 8px 12px;
  }

  .takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .takeaway-fulfillment-panel .form-input {
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    font-size: 16px;
  }

  .takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .cart-items-container {
    flex: 0 0 auto;
    min-height: 90px;
    overflow: visible;
  }

  .takeaway-only-store #posWorkspace[data-takeaway-pane="orders"] .cart-footer {
    flex: 0 0 auto;
    padding-bottom: calc(12px + var(--safe-bottom));
  }
}

/* ==========================================================================
   Print Thermal Receipt (@media print)
   ========================================================================== */
@media print {
  body * {
    visibility: hidden;
  }
  #receiptPaper, #receiptPaper * {
    visibility: visible;
  }
  #receiptPaper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    box-shadow: none;
    padding: 0;
  }
}

/* ==========================================================================
   More Menu Hub (Giao diện "Nhiều hơn" theo mẫu thiết kế)
   ========================================================================== */
.more-menu-hub {
  max-width: 680px;
  margin: 0 auto;
  padding: 4px 0 40px 0;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* User & Store Header Card */
.more-menu-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.05);
}

.more-menu-user-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.more-user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #f59e0b);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(249, 115, 22, 0.3);
}

.more-user-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.more-user-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.more-store-name {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Quick Management Grid */
.more-quick-management {
  margin-bottom: 22px;
}

.more-quick-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  padding-left: 0;
}

.more-quick-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.more-quick-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.more-quick-btn i {
  font-size: 20px;
}

.more-quick-btn:hover {
  background: var(--bg-muted);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

@media (max-width: 480px) {
  .more-quick-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Groups and Cards (Chuẩn 100% theo hình) */
.more-menu-group {
  margin-bottom: 24px;
}

.more-menu-group-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 12px 0;
  letter-spacing: -0.3px;
}

.more-menu-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 18px -3px rgba(15, 23, 42, 0.04);
}

.more-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.1s ease;
  user-select: none;
}

.more-menu-item:last-child {
  border-bottom: none;
}

.more-menu-item:hover {
  background: var(--bg-muted);
}

.more-menu-item:active {
  background: rgba(0, 0, 0, 0.04);
}

.more-item-left {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
  min-width: 0;
}

/* Rounded Square Icon Badges (Pastel Colors từ hình) */
.more-item-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: transform 0.18s ease;
}

.more-menu-item:hover .more-item-icon {
  transform: scale(1.05);
}

/* Hình 1: Cửa hàng */
.icon-printer { background: #fff1eb; color: #c2410c; }
.icon-workflow { background: #e6f9f0; color: #059669; }
.icon-shipping { background: #e6f8f6; color: #0d9488; }
.icon-calculator { background: #e0f4ff; color: #0284c7; }
.icon-einvoice { background: #ebf1ff; color: #4f46e5; }
.icon-website { background: #fff7e6; color: #d97706; }
.icon-loyalty { background: #f3ecff; color: #8b5cf6; }
.icon-speaker { background: #fff1eb; color: #ea580c; }

/* Hình 2: Tài khoản */
.icon-store-list { background: #e6f9f0; color: #10b981; }
.icon-password { background: #e8faf0; color: #16a34a; }
.icon-account { background: #eaf1ff; color: #2563eb; }
.icon-delete-account { background: #ffedf0; color: #ef4444; }
.icon-logout { background: #ffedf0; color: #ef4444; }

/* Dark theme icon adjustments */
body.theme-dark .icon-printer { background: rgba(194, 65, 12, 0.22); color: #fb923c; }
body.theme-dark .icon-workflow { background: rgba(5, 150, 105, 0.22); color: #34d399; }
body.theme-dark .icon-shipping { background: rgba(13, 148, 136, 0.22); color: #2dd4bf; }
body.theme-dark .icon-calculator { background: rgba(2, 132, 199, 0.22); color: #38bdf8; }
body.theme-dark .icon-einvoice { background: rgba(79, 70, 229, 0.22); color: #818cf8; }
body.theme-dark .icon-website { background: rgba(217, 119, 6, 0.22); color: #fbbf24; }
body.theme-dark .icon-loyalty { background: rgba(139, 92, 246, 0.22); color: #a78bfa; }
body.theme-dark .icon-speaker { background: rgba(234, 88, 12, 0.22); color: #fb923c; }
body.theme-dark .icon-store-list { background: rgba(16, 185, 129, 0.22); color: #34d399; }
body.theme-dark .icon-password { background: rgba(22, 163, 74, 0.22); color: #4ade80; }
body.theme-dark .icon-account { background: rgba(37, 99, 235, 0.22); color: #60a5fa; }
body.theme-dark .icon-delete-account { background: rgba(239, 68, 68, 0.22); color: #f87171; }
body.theme-dark .icon-logout { background: rgba(239, 68, 68, 0.22); color: #f87171; }

.more-item-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-logout .more-item-label,
.more-item-label.text-danger {
  color: #ef4444 !important;
  font-weight: 600;
}

.more-item-arrow {
  color: #cbd5e1;
  font-size: 13px;
  transition: transform 0.18s ease, color 0.18s ease;
}

.more-menu-item:hover .more-item-arrow {
  color: var(--primary);
  transform: translateX(3px);
}

/* Subview Back Header */
.subview-back-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.btn-back-hub {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-back-hub:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.subview-back-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

/* Store Selection Cards trong Modal */
.store-select-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  background: var(--bg-surface);
  transition: border-color 0.2s ease;
}

.store-select-card.active-store {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.04);
}

.store-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.store-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #e6f9f0;
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.store-card-info {
  display: flex;
  flex-direction: column;
}

.store-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

/* Switch Toggles cho các cài đặt */
.setting-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.setting-switch-row:last-child {
  border-bottom: none;
}

.setting-switch-label {
  display: flex;
  flex-direction: column;
}

.setting-switch-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.setting-switch-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   Header Themes & Customizer Modal
   ========================================================================== */

/* Các phông nền Header theo chủ đề */
.top-header.theme-moon-lantern {
  background: linear-gradient(135deg, #022c22 0%, #064e3b 35%, #065f46 70%, #047857 100%) !important;
  box-shadow: 0 4px 18px rgba(2, 44, 34, 0.35);
}

.top-header.theme-sunrise-amber {
  background: linear-gradient(135deg, #7c2d12 0%, #c2410c 35%, #ea580c 70%, #f59e0b 100%) !important;
  box-shadow: 0 4px 18px rgba(194, 65, 12, 0.35);
}
.top-header.theme-sunrise-amber .decor-moon {
  background: radial-gradient(circle, #fffbeb 20%, #fef08a 55%, rgba(251, 191, 36, 0.4) 80%, transparent 100%);
  box-shadow: 0 0 55px rgba(251, 191, 36, 0.8);
}
.top-header.theme-sunrise-amber .decor-lantern {
  background: linear-gradient(180deg, #b45309 0%, #d97706 60%, #fef08a 100%);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.85);
}

.top-header.theme-ocean-blue {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 35%, #1d4ed8 70%, #0284c7 100%) !important;
  box-shadow: 0 4px 18px rgba(30, 58, 138, 0.35);
}
.top-header.theme-ocean-blue .decor-moon {
  background: radial-gradient(circle, #f0fdf4 20%, #e0f2fe 55%, rgba(56, 189, 248, 0.4) 80%, transparent 100%);
  box-shadow: 0 0 50px rgba(56, 189, 248, 0.7);
}
.top-header.theme-ocean-blue .decor-lantern {
  background: linear-gradient(180deg, #0369a1 0%, #0284c7 60%, #bae6fd 100%);
  box-shadow: 0 0 16px rgba(14, 165, 233, 0.85);
}

.top-header.theme-twilight-purple {
  background: linear-gradient(135deg, #3b0764 0%, #581c87 35%, #7e22ce 70%, #c026d3 100%) !important;
  box-shadow: 0 4px 18px rgba(126, 34, 206, 0.35);
}
.top-header.theme-twilight-purple .decor-moon {
  background: radial-gradient(circle, #faf5ff 20%, #f3e8ff 55%, rgba(216, 180, 254, 0.4) 80%, transparent 100%);
  box-shadow: 0 0 50px rgba(216, 180, 254, 0.75);
}
.top-header.theme-twilight-purple .decor-lantern {
  background: linear-gradient(180deg, #9333ea 0%, #c026d3 60%, #fbcfe8 100%);
  box-shadow: 0 0 16px rgba(192, 38, 211, 0.85);
}

.top-header.theme-slate-modern {
  background: linear-gradient(135deg, #090d16 0%, #111827 35%, #1e293b 70%, #334155 100%) !important;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.5);
}
.top-header.theme-slate-modern .decor-moon {
  background: radial-gradient(circle, #f8fafc 20%, #e2e8f0 55%, rgba(148, 163, 184, 0.35) 80%, transparent 100%);
  box-shadow: 0 0 40px rgba(203, 213, 225, 0.4);
}
.top-header.theme-slate-modern .decor-lantern {
  background: linear-gradient(180deg, #334155 0%, #475569 60%, #94a3b8 100%);
  box-shadow: 0 0 14px rgba(148, 163, 184, 0.6);
}

/* Modal Customizer Styles */
.customizer-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.customizer-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.customizer-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text-main);
}

.wishes-suggestions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.btn-suggestion-pill {
  padding: 6px 12px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.btn-suggestion-pill:hover {
  background: var(--primary-light);
  color: var(--primary-hover);
  border-color: var(--primary);
}

.btn-suggestion-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 700;
}

.modal-avatar-preview-box {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  background: #065f46;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-presets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.avatar-preset-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-surface);
  text-align: center;
  user-select: none;
}

.avatar-preset-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.avatar-preset-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px var(--primary);
}

.avatar-preset-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.avatar-preset-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fef3c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.avatar-preset-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
}

.theme-presets-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.theme-preset-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-surface);
  position: relative;
  user-select: none;
}

.theme-preset-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.theme-preset-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px var(--primary);
}

.theme-color-bar {
  width: 60px;
  height: 42px;
  min-width: 60px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.2);
}

.theme-icon-hint {
  font-size: 14px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.theme-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.theme-details strong {
  font-size: 13px;
  color: var(--text-main);
}

.theme-details small {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.theme-check-icon {
  color: var(--primary);
  font-size: 18px;
  margin-left: auto;
}

/* ==========================================================================
   Account Modal & Integrated Header Customizer Tabs
   ========================================================================== */
.account-tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
  background: var(--bg-surface);
}

.account-tab-btn {
  padding: 11px 18px;
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  user-select: none;
}

.account-tab-btn:hover {
  color: var(--primary);
}

.account-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.account-tab-pane {
  display: none;
}

.account-tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* Tab 1: Profile Header Card */
.account-profile-header-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.account-avatar-wrapper {
  position: relative;
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.acc-profile-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
  display: block;
}

.acc-profile-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #f59e0b);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
}

.avatar-change-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: 2px solid var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  transition: transform 0.18s ease;
}

.avatar-change-badge:hover {
  transform: scale(1.15);
}

.account-profile-header-info {
  flex: 1;
}

/* Quick Customize Callout in Tab 1 */
.account-customize-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  transition: all 0.2s ease;
  user-select: none;
}

.account-customize-callout:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.callout-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Account Details Grid */
.account-details-grid {
  display: grid;
  gap: 12px;
  font-size: 14px;
}

.account-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-color);
}

.account-detail-row:last-child {
  border-bottom: none;
}

.account-detail-row .text-muted {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}




/* Printer settings: one destination for each print purpose. */
#printerSettingsModal .printer-settings-dialog { min-width: 0; min-height: 0; max-height: 100%; }
#printerSettingsModal .modal-header { background: var(--bg-surface); color: var(--text-main); flex-shrink: 0; }
#printerSettingsModal .printer-settings-body { min-height: 0; min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 18px; display: grid; align-content: start; gap: 12px; }
#printerSettingsModal .printer-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 14px; min-width: 0; }
#printerSettingsModal .printer-card-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
#printerSettingsModal h4 { font-size: 16px; margin: 0; }
#printerSettingsModal .printer-toggle { position: relative; width: 48px; height: 28px; flex-shrink: 0; cursor: pointer; }
#printerSettingsModal .printer-toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; }
#printerSettingsModal .printer-toggle span { display: block; height: 100%; border-radius: 20px; background: #aaa; pointer-events: none; }
#printerSettingsModal .printer-toggle span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; background: white; border-radius: 50%; transition: transform .15s; }
#printerSettingsModal .printer-toggle input:checked + span { background: var(--primary); }
#printerSettingsModal .printer-toggle input:checked + span::after { transform: translateX(20px); }
#printerSettingsModal input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 3px; }
#printerSettingsModal .printer-device { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; }
#printerSettingsModal [hidden] { display: none !important; }
#printerSettingsModal .printer-device-info { display: grid; gap: 5px; min-width: 0; overflow-wrap: anywhere; }
#printerSettingsModal .printer-device-info span { color: var(--text-muted); font-size: 14px; }
#printerSettingsModal .printer-actions { display: flex; gap: 18px; }
#printerSettingsModal .printer-actions button, #printerSettingsModal .printer-add { color: var(--primary); background: transparent; border: 0; padding: 5px 0; font: inherit; cursor: pointer; }
#printerSettingsModal .printer-actions .printer-delete { color: var(--danger); }
#printerSettingsModal .printer-empty { text-align: center; color: var(--text-muted); padding: 12px 0; }
#printerSettingsModal .printer-editor { border-top: 1px solid var(--border-color); margin-top: 16px; padding-top: 16px; }
#printerSettingsModal .printer-help { font-size: 12px; line-height: 1.6; }
#printerSettingsModal .form-group, #printerSettingsModal .form-input { min-width: 0; max-width: 100%; }
#printerSettingsModal .setting-switch-row { gap: 12px; }
#printerSettingsModal .setting-switch-row input[type="checkbox"] { flex-shrink: 0; }
#printerSettingsModal .printer-settings-footer { display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; padding: 12px 18px; }

.cart-add-flyer {
  position: fixed;
  z-index: 10000;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary, #ff7a00);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(255, 122, 0, .3);
  pointer-events: none;
}
