/* ==========================================================================
   ThichGaPOS 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;
}

/* 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
   ========================================================================== */
.top-header {
  height: var(--header-height);
  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);
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  border-radius: var(--radius-md);
  color: #fff;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--primary);
  line-height: 1.1;
}

.store-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.store-select-header {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  outline: none;
  cursor: pointer;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-shift-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--success-light);
  color: #065f46;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: var(--radius-full);
}

.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); }
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-muted);
  color: var(--text-main);
  font-size: 14px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-muted);
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-full);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge-role {
  font-size: 10px;
  font-weight: 700;
  background: var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
}

.btn-logout {
  color: var(--text-muted);
  font-size: 14px;
  padding: 4px;
}

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

/* ==========================================================================
   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: space-between;
  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;
  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: 5px 12px;
  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;
  align-items: center;
  gap: 6px;
}

.btn-kds-cancel {
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  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 {
  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-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: 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: 14px; font-weight: bold; margin: 4px 0; }
.receipt-divider { text-align: center; overflow: hidden; margin: 4px 0; }
.receipt-items-table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.receipt-items-table th, .receipt-items-table td { padding: 3px 0; }
.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: 13px; }

/* ==========================================================================
   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);
}

@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 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
}

/* 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;
}

/* Subpanels (Transfer / Merge select boxes) */
.action-subpanel {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
  margin: -4px 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 + env(safe-area-inset-top));
    --bottom-nav-height: calc(64px + env(safe-area-inset-bottom));
  }

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

  body {
    padding-right: env(safe-area-inset-right);
    padding-left: env(safe-area-inset-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: env(safe-area-inset-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,
  .admin-view-container {
    padding: 10px 12px calc(92px + env(safe-area-inset-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: env(safe-area-inset-right);
    bottom: var(--bottom-nav-height);
    left: env(safe-area-inset-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 + env(safe-area-inset-bottom));
  }

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

  .bottom-nav-bar {
    min-height: var(--bottom-nav-height);
    height: var(--bottom-nav-height);
    padding: 4px max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-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: env(safe-area-inset-top) 0 0;
  }

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

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

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

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

  .toast-container,
  #toastContainer {
    top: calc(10px + env(safe-area-inset-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 + env(safe-area-inset-top));
    --bottom-nav-height: calc(54px + env(safe-area-inset-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: env(safe-area-inset-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 + env(safe-area-inset-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;
  }
}
