:root {
  /* Primary Colors - Warm Restaurant Theme */
  --primary: #E65100;
  --primary-dark: #BF360C;
  --primary-light: #FFF3E0;
  --primary-glow: rgba(230, 81, 0, 0.2);

  /* Secondary */
  --secondary: #2E7D32;
  --secondary-light: #E8F5E9;

  /* Sidebar - Always Dark */
  --sidebar-bg: #1A1A2E;
  --sidebar-secondary: #16213E;
  --sidebar-text: #A0AEC0;
  --sidebar-text-hover: #FFFFFF;
  --sidebar-active-bg: rgba(230, 81, 0, 0.15);
  --sidebar-border: rgba(255,255,255,0.06);
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;

  /* Surfaces */
  --bg: #F0F2F5;
  --surface: #FFFFFF;
  --surface-2: #F8F9FA;
  --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
  --card-shadow-hover: 0 8px 24px rgba(0,0,0,0.12);

  /* Text */
  --text: #1A202C;
  --text-secondary: #718096;
  --text-muted: #A0AEC0;

  /* Borders */
  --border: #E2E8F0;
  --border-focus: var(--primary);

  /* Status Colors */
  --success: #2E7D32;
  --success-bg: #E8F5E9;
  --warning: #F57F17;
  --warning-bg: #FFF8E1;
  --danger: #C62828;
  --danger-bg: #FFEBEE;
  --info: #1565C0;
  --info-bg: #E3F2FD;

  /* Order Status */
  --status-pending: #F57F17;
  --status-preparing: #1565C0;
  --status-ready: #2E7D32;
  --status-served: #6A1B9A;
  --status-completed: #27AE60;
  --status-cancelled: #C62828;

  /* Navbar */
  --navbar-h: 64px;

  /* Transitions */
  --transition: 200ms ease;
  --transition-slow: 300ms ease;

  /* Border Radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ============================================
   APP LAYOUT
============================================ */
#app { display: flex; height: 100vh; overflow: hidden; }
#app.auth-mode { display: block; height: 100vh; }

/* ============================================
   SIDEBAR
============================================ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: width var(--transition-slow), min-width var(--transition-slow);
  overflow: hidden;
  z-index: 100;
  position: relative;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

.sidebar-logo {
  height: 84px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo-img {
  height: 62px;
  width: auto;
  max-width: 72px;
  object-fit: contain;
  flex-shrink: 0;
  transition: height var(--transition-slow);
  filter: brightness(1.05);
}

.sidebar-logo-text {
  overflow: hidden;
  transition: opacity var(--transition), width var(--transition-slow);
  white-space: nowrap;
  min-width: 0;
}

.sidebar-logo-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.5px;
  margin-top: 4px;
  font-style: italic;
}

.sidebar.collapsed .sidebar-logo-img { height: 40px; max-width: 44px; }
.sidebar.collapsed .sidebar-logo-text { opacity: 0; width: 0; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.3);
  padding: 16px 18px 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition);
}

.sidebar.collapsed .sidebar-section-title { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  color: var(--sidebar-text);
  cursor: pointer;
  border-radius: 0;
  transition: all var(--transition);
  text-decoration: none;
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--sidebar-text-hover);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--primary);
  border-left-color: var(--primary);
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition);
}

.nav-item:hover .nav-icon { transform: scale(1.1); }

.nav-item .nav-label {
  font-size: 13.5px;
  font-weight: 500;
  transition: opacity var(--transition);
}

.sidebar.collapsed .nav-label { opacity: 0; width: 0; }

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
  transition: opacity var(--transition);
}

.sidebar.collapsed .nav-badge { opacity: 0; }

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .nav-item:hover::after {
  content: attr(data-label);
  position: absolute;
  left: calc(var(--sidebar-collapsed) + 8px);
  background: var(--sidebar-bg);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  white-space: nowrap;
  z-index: 1000;
  border: 1px solid var(--sidebar-border);
  box-shadow: 4px 4px 12px rgba(0,0,0,0.3);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  overflow: hidden;
}

.user-info:hover { background: rgba(255,255,255,0.05); }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #FF8F00);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-details { overflow: hidden; flex: 1; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--sidebar-text); }
.sidebar.collapsed .user-details, .sidebar.collapsed .user-info .fa-sign-out-alt { opacity: 0; width: 0; overflow: hidden; }

/* ============================================
   MAIN AREA
============================================ */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ============================================
   NAVBAR
============================================ */
.navbar {
  height: var(--navbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  z-index: 50;
}

.navbar-toggle {
  width: 38px; height: 38px;
  border: none;
  background: var(--surface-2);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}

.navbar-toggle:hover { background: var(--primary-light); color: var(--primary); }

.navbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.navbar-breadcrumb .page-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.navbar-spacer { flex: 1; }

.navbar-search {
  position: relative;
  display: none;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-btn {
  width: 38px; height: 38px;
  border: none;
  background: var(--surface-2);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
}

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

.notif-badge {
  position: absolute;
  top: 5px; right: 5px;
  width: 16px; height: 16px;
  background: var(--danger);
  border-radius: 50%;
  font-size: 9px;
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

/* ============================================
   CONTENT AREA
============================================ */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ============================================
   CARDS
============================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(0,0,0,0.04);
  overflow: hidden;
}

.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }

/* Stat Cards */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(0,0,0,0.04);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
  cursor: default;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.orange { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--secondary-light); color: var(--secondary); }
.stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-icon.purple { background: #F3E5F5; color: #6A1B9A; }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.2; margin: 2px 0; }
.stat-change { font-size: 12px; display: flex; align-items: center; gap: 4px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================
   GRIDS
============================================ */
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* ============================================
   BUTTONS
============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 9px; width: 36px; height: 36px; justify-content: center; }
.btn-icon.btn-sm { padding: 6px; width: 30px; height: 30px; }

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px var(--primary-glow); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px var(--primary-glow); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #1B5E20; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B71C1C; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #E65100; }

.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #0D47A1; }

.btn-purple { background: #6A1B9A; color: #fff; }
.btn-purple:hover { background: #4A148C; }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-outline-primary { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn:disabled, .btn[disabled] { opacity: 0.6; cursor: not-allowed; transform: none !important; }

.w-100 { width: 100%; justify-content: center; }
.mt-8 { margin-top: 8px; }
.mb-20 { margin-bottom: 20px; }
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center; }
.no-wrap { white-space: nowrap; }


/* ============================================
   FORMS
============================================ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-label span { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 10px 13px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
  line-height: 1.5;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder { color: var(--text-muted); }

.form-control-sm { padding: 7px 10px; font-size: 13px; }

select.form-control { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

textarea.form-control { resize: vertical; min-height: 80px; }

.input-group { display: flex; gap: 0; }
.input-group .form-control { border-radius: 0; flex: 1; }
.input-group .form-control:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .form-control:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.input-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.input-group-text { display: flex; align-items: center; padding: 0 13px; background: var(--surface-2); border: 1.5px solid var(--border); color: var(--text-secondary); font-size: 14px; }

/* ============================================
   TABLES
============================================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  background: var(--surface-2);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid rgba(0,0,0,0.04);
  transition: background var(--transition);
}

tbody tr:hover { background: rgba(0,0,0,0.02); }
tbody tr:last-child { border-bottom: none; }

tbody td {
  padding: 14px 16px;
  color: var(--text);
  vertical-align: middle;
}

.td-actions { display: flex; gap: 6px; align-items: center; }

/* ============================================
   BADGES / STATUS CHIPS
============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-secondary { background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-purple { background: #F3E5F5; color: #6A1B9A; }

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ============================================
   MODALS
============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title { font-size: 16px; font-weight: 600; }

.modal-close {
  width: 32px; height: 32px;
  border: none;
  background: var(--surface-2);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ============================================
   TOASTS
============================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  border-left: 4px solid var(--info);
  animation: slideIn 300ms ease;
  max-width: 360px;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.toast-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast-info-icon { color: var(--info); }

.toast-content { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; font-size: 13.5px; }
.toast-message { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }

.toast-close {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  padding: 0;
  line-height: 1;
  margin-top: 2px;
}

@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { to { transform: translateX(120%); opacity: 0; } }
.toast.removing { animation: slideOut 300ms ease forwards; }

/* ============================================
   PAGE HEADER
============================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-left h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header-left p { color: var(--text-secondary); font-size: 13.5px; margin-top: 3px; }
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ============================================
   FILTERS & SEARCH
============================================ */
.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}

.search-box input {
  padding-left: 36px;
}

/* ============================================
   POS SPECIFIC
============================================ */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  height: calc(100vh - var(--navbar-h) - 48px);
}

.pos-left { display: flex; flex-direction: column; gap: 16px; overflow: hidden; }
.pos-right { background: var(--surface); border-radius: var(--radius-lg); display: flex; flex-direction: column; box-shadow: var(--card-shadow); overflow: hidden; }

.pos-categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.pos-categories::-webkit-scrollbar { display: none; }

.cat-chip {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px var(--primary-glow); }

.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  overflow-y: auto;
  padding: 0 4px 8px 2px;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  flex: 1;
  min-height: 0;
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 12px 10px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  box-shadow: var(--card-shadow);
  text-align: center;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 120px;
}

.product-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

.product-card.unavailable { opacity: 0.5; cursor: not-allowed; }

.product-card-img {
  width: 54px;
  height: 54px;
  border-radius: var(--radius);
  object-fit: cover;
  margin: 0 auto 8px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.product-card-category {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.product-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
  line-height: 1.3;
  word-break: break-word;
  /* Allow up to 2 lines, always visible */
  display: block;
  max-height: 2.6em;
  overflow: hidden;
  width: 100%;
}

.product-card-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-top: auto;
}

/* Cart */
.cart-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
}

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

.order-type-tab {
  padding: 5px 12px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  transition: all var(--transition);
}

.order-type-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px var(--primary-glow);
}

.cart-body { flex: 1; overflow-y: auto; padding: 12px; scrollbar-width: thin; }

.cart-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.cart-empty .cart-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }

.cart-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  transition: border-color var(--transition);
}

.cart-item:hover { border-color: var(--primary); }

.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-weight: 600; font-size: 13px; color: var(--text); }
.cart-item-price { font-size: 12.5px; color: var(--text-secondary); }
.cart-item-total { font-weight: 700; color: var(--primary); font-size: 14px; min-width: 60px; text-align: right; }

.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}

.qty-btn {
  width: 24px; height: 24px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  transition: all var(--transition);
}

.qty-btn:hover { border-color: var(--primary); color: var(--primary); }
.qty-num { font-size: 14px; font-weight: 700; min-width: 24px; text-align: center; }

.cart-footer { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }

.cart-totals { font-size: 13.5px; display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.cart-totals .row { display: flex; justify-content: space-between; align-items: center; }
.cart-totals .total-row { font-weight: 700; font-size: 16px; padding-top: 8px; border-top: 1px solid var(--border); margin-top: 4px; color: var(--primary); }
.cart-totals .label { color: var(--text-secondary); }

/* ============================================
   KITCHEN DISPLAY
============================================ */
.kds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  align-content: start;
}

.kds-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  overflow: hidden;
  transition: all var(--transition);
}

.kds-card.pending { border-color: var(--status-pending); }
.kds-card.preparing { border-color: var(--status-preparing); }
.kds-card.ready { border-color: var(--status-ready); }

.kds-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kds-card.pending .kds-header { background: var(--warning-bg); }
.kds-card.preparing .kds-header { background: var(--info-bg); }
.kds-card.ready .kds-header { background: var(--success-bg); }

.kds-order-num { font-weight: 700; font-size: 15px; }
.kds-timer { font-size: 12px; color: var(--text-secondary); }
.kds-type { font-size: 11px; font-weight: 600; text-transform: uppercase; }

.kds-items { padding: 12px 16px; }

.kds-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  gap: 8px;
}

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

.kds-item-name { flex: 1; font-size: 13.5px; font-weight: 500; }
.kds-item-qty { font-weight: 700; color: var(--primary); font-size: 14px; }
.kds-item-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--success);
  transition: all var(--transition);
}

.kds-item.done .kds-item-check { background: var(--success); border-color: var(--success); color: #fff; }
.kds-item.done .kds-item-name { text-decoration: line-through; opacity: 0.5; }

.kds-actions { padding: 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

/* ============================================
   TABLE FLOOR PLAN
============================================ */
.floor-plan {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  align-content: start;
}

.table-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: all var(--transition);
  box-shadow: var(--card-shadow);
  position: relative;
}

/* Delete button appears on hover */
.table-card .table-delete-btn {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: transparent;
  color: transparent;
  border: none;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.table-card:hover .table-delete-btn {
  background: var(--danger-bg);
  color: var(--danger);
}

.table-card.available { border-color: var(--success); }
.table-card.occupied { border-color: var(--danger); background: var(--danger-bg); }
.table-card.reserved { border-color: var(--warning); background: var(--warning-bg); }
.table-card.cleaning { border-color: var(--info); background: var(--info-bg); }

.table-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }

.table-icon { font-size: 28px; margin-bottom: 8px; }
.table-num { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.table-cap { font-size: 11px; color: var(--text-secondary); margin-bottom: 6px; }
.table-zone { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.table-card.available .table-zone { color: var(--success); }
.table-card.occupied .table-zone { color: var(--danger); }
.table-card.reserved .table-zone { color: var(--warning); }
.table-card.cleaning .table-zone { color: var(--info); }

/* ============================================
   PAGINATION
============================================ */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: flex-end; padding-top: 16px; }
.page-btn { width: 34px; height: 34px; border: 1.5px solid var(--border); background: var(--surface); border-radius: var(--radius); cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; transition: all var(--transition); }
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================
   LOADING
============================================ */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  flex-direction: column;
  gap: 16px;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, rgba(255,255,255,0.8) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================
   LOGIN PAGE
============================================ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1A1A2E 0%, #16213E 50%, #0F3460 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 48px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo img {
  height: 110px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 32px rgba(230, 81, 0, 0.4));
  display: block;
  margin: 0 auto 12px;
}

.login-logo .login-subtitle { color: rgba(255,255,255,0.4); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; margin-top: 6px; }


.login-card .form-label { color: rgba(255,255,255,0.7); }
.login-card .form-control { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); color: #fff; }
.login-card .form-control:focus { background: rgba(255,255,255,0.12); border-color: var(--primary); }
.login-card .form-control::placeholder { color: rgba(255,255,255,0.3); }

.login-demo {
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 20px;
  border: 1px solid rgba(255,255,255,0.1);
}

.login-demo h4 { color: rgba(255,255,255,0.7); font-size: 12px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.login-demo .cred-row { display: flex; justify-content: space-between; font-size: 12px; color: rgba(255,255,255,0.5); padding: 3px 0; }

/* ============================================
   EMPTY STATES
============================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 56px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13.5px; margin-bottom: 20px; }

/* ============================================
   DROPDOWN
============================================ */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  border: 1px solid var(--border);
  min-width: 200px;
  padding: 6px;
  z-index: 500;
  display: none;
  animation: dropdownIn 150ms ease;
}

.dropdown-menu.open { display: block; }
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text);
  transition: background var(--transition);
  text-decoration: none;
}

.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-bg); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Menu layout */
.menu-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: start;
}

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

@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .pos-layout { grid-template-columns: 1fr 320px; gap: 12px; }
  .products-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .floor-plan { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================
   RESPONSIVE — Tablet Landscape / Small Laptop (≤1024px)
============================================ */
@media (max-width: 1024px) {
  :root { --sidebar-width: 230px; }

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

  .menu-layout { grid-template-columns: 190px 1fr; }

  .pos-layout { grid-template-columns: 1fr 290px; gap: 10px; }

  .stat-value { font-size: 22px; }

  .content-area { padding: 16px; }

  /* POS product grid: 3 cols, tighter gap */
  .products-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }

  /* Navbar */
  .navbar-breadcrumb .page-title { font-size: 15px; }

  /* KDS: 2 col */
  .kds-grid { grid-template-columns: repeat(2, 1fr); }

  /* Table floor plan: 4 per row */
  .floor-plan { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================
   RESPONSIVE — Tablet Portrait (≤768px)
============================================ */
@media (max-width: 768px) {
  /* Sidebar: slide-in drawer */
  .sidebar {
    position: fixed;
    left: -100%;
    height: 100vh;
    z-index: 200;
    transition: left var(--transition-slow);
    width: var(--sidebar-width) !important;
    min-width: var(--sidebar-width) !important;
  }
  .sidebar.mobile-open { left: 0; }
  .sidebar-overlay { display: block; }

  /* Main area full width */
  .main-area { width: 100%; }

  /* Content spacing */
  .content-area { padding: 14px; }

  /* Navbar */
  .navbar { padding: 0 14px; gap: 10px; }
  .navbar-breadcrumb .page-title { font-size: 14px; }

  /* Grids: single column */
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }

  /* Dashboard stat grid: 2 cols on tablet */
  .grid-4 { grid-template-columns: repeat(2, 1fr); }

  /* Menu: stack categories above products */
  .menu-layout { grid-template-columns: 1fr; }

  /* Page header */
  .page-header { flex-direction: column; gap: 10px; }
  .page-header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-header-actions .btn { flex: 1; min-width: 120px; justify-content: center; }

  /* Stat cards */
  .stat-card { padding: 14px; gap: 12px; }
  .stat-value { font-size: 20px; }
  .stat-icon { width: 42px; height: 42px; font-size: 17px; }

  /* Cards */
  .card-header { padding: 14px 16px; flex-wrap: wrap; gap: 8px; }

  /* Filters bar */
  .filters-bar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }

  /* Tables: card-style on mobile */
  thead { display: none; }
  tbody tr {
    display: block;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    background: var(--surface);
  }
  tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border: none;
    font-size: 13px;
  }
  tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    flex-shrink: 0;
    margin-right: 8px;
  }
  .td-actions { justify-content: flex-end; }
  tbody td.td-actions::before { display: none; }

  /* Modals: bottom sheet */
  .modal {
    max-width: 100%;
    width: 100%;
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
  }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }

  /* POS: stacked layout */
  .pos-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .pos-left { height: 50vh; overflow-y: auto; }
  .pos-right { height: auto; max-height: 60vh; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .product-card { padding: 10px 8px; }

  /* KDS: 1 col */
  .kds-grid { grid-template-columns: 1fr; }

  /* Floor plan: 3 per row */
  .floor-plan { grid-template-columns: repeat(3, 1fr); }

  /* Notification dropdown: full width */
  .notif-dropdown { width: calc(100vw - 24px); right: -60px; }

  /* Login */
  .login-card { padding: 28px 20px; }

  /* Sidebar logo on mobile */
  .sidebar-logo { height: 72px; padding: 0 14px; }
  .sidebar-logo-img { height: 50px; }

  /* Form grids in modals */
  .modal-body [style*="grid-template-columns:1fr 1fr"],
  .modal-body [style*="grid-template-columns: 1fr 1fr"] {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
}

/* ============================================
   RESPONSIVE — Mobile (≤480px)
============================================ */
@media (max-width: 480px) {
  .content-area { padding: 10px; }

  /* 1 col for all grids including dashboard stats */
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }

  .stat-value { font-size: 18px; }
  .stat-card { padding: 12px; gap: 10px; }

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

  .floor-plan { grid-template-columns: repeat(2, 1fr); }

  .navbar { padding: 0 10px; gap: 6px; }
  .navbar-actions { gap: 4px; }
  .navbar-btn { width: 34px; height: 34px; }

  /* Hide non-essential navbar items on very small screens */
  #refreshBtn { display: none; }

  .page-header-actions .btn { font-size: 12px; padding: 7px 10px; }

  .btn-lg { padding: 10px 16px; font-size: 14px; }

  .card-header { padding: 12px; }

  .login-card { padding: 20px 16px; border-radius: 16px; }
  .login-logo-img { height: 90px; }
}


.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
}

/* ============================================
   UTILITIES
============================================ */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.fw-bold { font-weight: 700; }
.fw-600 { font-weight: 600; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.p-0 { padding: 0; }
.hidden { display: none !important; }
.w-100 { width: 100%; }
.pointer { cursor: pointer; }
.no-wrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Notification Dropdown */
.notif-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  border: 1px solid var(--border);
  width: 360px;
  z-index: 500;
  display: none;
}

.notif-dropdown.open { display: block; }
.notif-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.notif-title { font-weight: 600; font-size: 14px; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid rgba(0,0,0,0.04); cursor: pointer; transition: background var(--transition); }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--primary-light); }
.notif-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.notif-icon.new_order { background: var(--info-bg); color: var(--info); }
.notif-icon.low_stock { background: var(--warning-bg); color: var(--warning); }
.notif-icon.info { background: var(--success-bg); color: var(--success); }
.notif-text h4 { font-size: 13px; font-weight: 600; }
.notif-text p { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.notif-empty { text-align: center; padding: 30px; color: var(--text-muted); font-size: 13px; }

/* Chart containers */
.chart-wrapper { position: relative; height: 240px; }
.chart-wrapper canvas { max-height: 240px; }

/* Color picker / status indicators */
.status-indicator { display: inline-flex; align-items: center; gap: 6px; }

/* Receipt print styles */
@media print {
  .sidebar, .navbar, .no-print { display: none !important; }
  .content-area { padding: 0; }
  body { background: white; }
}
