@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-Medium.ttf') format('truetype');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-SemiBold.ttf') format('truetype');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --primary: #FF6B35;
  --primary-dark: #e55a26;
  --primary-light: #fff3ef;
  --secondary: #2C3E50;
  --accent: #27AE60;
  --accent-dark: #1e8449;
  --danger: #E74C3C;
  --warning: #F39C12;
  --info: #3498DB;
  --purple: #9B59B6;
  --dark: #1a1a2e;
  --sidebar-bg: #1a1a2e;
  --sidebar-width: 240px;
  --header-height: 60px;
  --bg: #F0F2F5;
  --card-bg: #ffffff;
  --border: #E8EAED;
  --text: #2C3E50;
  --text-muted: #7F8C8D;
  --text-light: #BDC3C7;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== LAYOUT ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 1000;
  transition: width 0.25s ease, transform 0.25s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; margin: 1px 4px; }
.sidebar.collapsed .sidebar-logo { padding: 18px 0; justify-content: center; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar.collapsed .sidebar-user-avatar { margin: 0 auto; }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.sidebar.collapsed .sidebar-footer { padding: 8px 0; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  min-height: 60px;
}
.sidebar-logo-text { font-size:1.2rem;font-weight:700;color:#fff;letter-spacing:-0.5px;white-space:nowrap; }
.sidebar-logo-text span { color:var(--primary); }
.sidebar-collapse-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover { color: #fff; }

.sidebar-nav { flex:1; padding:8px 0; overflow-y:auto; overflow-x:hidden; }
.sidebar-divider { border-top:1px solid rgba(255,255,255,0.07); margin:6px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
  margin: 1px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background:rgba(255,255,255,0.08); color:#fff; }
.nav-item.active { background:var(--primary); color:#fff; }
.nav-item.logout-item { color:rgba(255,100,100,0.75); }
.nav-item.logout-item:hover { background:rgba(231,76,60,0.15); color:#ff6b6b; }
.nav-icon { width:20px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.nav-label { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.nav-badge { margin-left:auto; background:var(--danger); color:#fff; font-size:0.62rem; padding:2px 5px; border-radius:10px; font-weight:700; min-width:16px; text-align:center; flex-shrink:0; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.45);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}
body.sidebar-collapsed .main-content { margin-left: 56px; }
body.sidebar-collapsed .topbar-clock { display: none; }

/* ===== TOPBAR ===== */
.topbar {
  height: var(--header-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 600;
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-clock { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); min-width: 65px; text-align: right; }

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
  font-size: 1rem;
  position: relative;
  text-decoration: none;
}

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

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

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text);
}

/* ===== PAGE CONTENT ===== */
.page-content {
  flex: 1;
  padding: 20px;
}

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

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

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  flex: 1;
}

.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* ===== STATS CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
}

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

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

.stat-icon.orange { background: #fff3ef; }
.stat-icon.green { background: #e8f5e9; }
.stat-icon.blue { background: #e3f2fd; }
.stat-icon.purple { background: #f3e5f5; }
.stat-icon.red { background: #fde8e6; }
.stat-icon.yellow { background: #fffde7; }

.stat-info {}
.stat-value {
  font-size: 1.01rem;
  font-weight: 700;
  line-height: 1.2;
}
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.stat-change {
  font-size: 0.72rem;
  margin-top: 4px;
  font-weight: 600;
}
.stat-change.up { color: var(--accent); }
.stat-change.down { color: var(--danger); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
  font-family: inherit;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-success { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-success:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #c0392b; border-color: #c0392b; color: #fff; }

.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-info { background: var(--info); color: #fff; border-color: var(--info); }
.btn-purple { background: var(--purple); color: #fff; border-color: var(--purple); }

.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--bg); }

.btn-outline-primary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover:not(:disabled) { background: var(--primary); color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }
.btn-xl { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,53,0.12);
}

.form-control::placeholder { color: var(--text-light); }
.form-control:disabled { background: var(--bg); cursor: not-allowed; }

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

.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 4px; }
.form-control.is-invalid { border-color: var(--danger); }

.input-group {
  display: flex;
  align-items: stretch;
}
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); flex: 1; }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group .input-addon {
  padding: 9px 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-left: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex;
  align-items: center;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Grid layout for forms */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== TABLES ===== */
.table-responsive { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.table th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--bg); }
.table tbody tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #e8f5e9; color: var(--accent); }
.badge-danger { background: #fde8e6; color: var(--danger); }
.badge-warning { background: #fffde7; color: #f57f17; }
.badge-info { background: #e3f2fd; color: var(--info); }
.badge-secondary { background: var(--bg); color: var(--text-muted); }
.badge-purple { background: #f3e5f5; color: var(--purple); }

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
}
.alert-success { background: #e8f5e9; color: #2e7d32; border-left: 3px solid var(--accent); }
.alert-danger { background: #fde8e6; color: #c62828; border-left: 3px solid var(--danger); }
.alert-warning { background: #fffde7; color: #f57f17; border-left: 3px solid var(--warning); }
.alert-info { background: #e3f2fd; color: #1565c0; border-left: 3px solid var(--info); }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-sm { max-width: 400px; }

.pay-calc-quick {
  display: none;
  gap: 5px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.pay-calc-quick button {
  flex: 1;
  min-width: 60px;
  padding: 6px 4px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.pay-calc-quick button:hover { border-color: var(--primary); color: var(--primary); }

.pay-calc-keypad {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.pay-calc-keypad button {
  padding: 14px 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.1s;
}
.pay-calc-keypad button:active { background: var(--primary-light); }
.pay-calc-keypad .pay-calc-clear { color: var(--danger); border-color: var(--danger); }
.pay-calc-keypad .pay-calc-exact {
  grid-column: span 3;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-size: 0.85rem;
}

@media (min-width: 769px) {
  .pay-calc-quick,
  .pay-calc-keypad {
    display: flex;
  }
  .pay-calc-keypad { display: grid; }
  #pay-modal .modal-sm { max-width: 360px; }
}
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal-title { font-size: 1rem; font-weight: 600; flex: 1; }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ===== TABS ===== */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; gap: 4px; }
.tab-item {
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab-item:hover { color: var(--primary); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

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

.pos-left { display: flex; flex-direction: column; overflow: hidden; }
.pos-right { display: flex; flex-direction: column; }

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: none;
  flex-shrink: 0;
}
.category-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--card-bg);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  min-width: 80px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}
.cat-tab .cat-icon { font-size: 1.4rem; }
.cat-tab:hover { border-color: var(--primary); color: var(--primary); }
.cat-tab.active { border-color: var(--primary); background: var(--primary); color: #fff; }

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  overflow-y: auto;
  flex: 1;
}

.menu-item-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  position: relative;
  user-select: none;
}
.menu-item-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.menu-item-card:active { transform: scale(0.97); }
.menu-item-card.unavailable { opacity: 0.5; cursor: not-allowed; }
.menu-item-card.unavailable:hover { transform: none; }

.menu-item-img {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  margin: 0 auto 8px;
  display: block;
  background: var(--bg);
}
.menu-item-emoji {
  font-size: 2.5rem;
  margin-bottom: 6px;
  display: block;
}
.menu-item-name {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
}
.menu-item-price { font-size: 0.88rem; color: var(--primary); font-weight: 700; }
.menu-item-weight { font-size: 0.7rem; color: var(--text-muted); }

.menu-item-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: 700;
}

/* Order Panel */
.order-panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.order-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-items-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  transition: all var(--transition);
}
.order-item:hover { background: var(--bg); }

.order-item-name {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 500;
  min-width: 0;
}
.order-item-name small { display: block; color: var(--text-muted); font-size: 0.7rem; font-weight: 400; }

.qty-control {
  display: flex;
  align-items: center;
  gap: 4px;
}
.qty-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-family: inherit;
}
.qty-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.qty-value {
  min-width: 24px;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.order-item-price {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--primary);
  min-width: 60px;
  text-align: right;
}

.order-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: 0.85rem;
  padding: 2px;
  border-radius: 4px;
  transition: all var(--transition);
}
.order-item-remove:hover { color: var(--danger); background: #fde8e6; }

.order-totals {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.order-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.83rem;
  margin-bottom: 6px;
  color: var(--text-muted);
}
.order-total-row.grand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid var(--border);
}

.order-actions {
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border-top: 1px solid var(--border);
}

/* Table Map */
.table-map {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 500px;
  overflow: hidden;
}

.table-item {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.78rem;
  font-weight: 600;
  user-select: none;
}
.table-item.square { border-radius: var(--radius-sm); }
.table-item.round { border-radius: 50%; }
.table-item.rectangle { width: 110px; height: 65px; border-radius: var(--radius-sm); }

.table-item.free { background: #e8f5e9; border-color: var(--accent); color: var(--accent); }
.table-item.occupied { background: #fde8e6; border-color: var(--danger); color: var(--danger); }
.table-item.reserved { background: #fffde7; border-color: var(--warning); color: #e65100; }
.table-item.cleaning { background: #e3f2fd; border-color: var(--info); color: var(--info); }

.table-item:hover { transform: scale(1.05); box-shadow: var(--shadow-md); }

/* Kitchen Display */
.kitchen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.kitchen-ticket {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 2px solid var(--border);
  overflow: hidden;
}
.kitchen-ticket.new { border-color: var(--info); }
.kitchen-ticket.in_progress { border-color: var(--warning); }
.kitchen-ticket.ready { border-color: var(--accent); }

.kitchen-ticket-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}
.kitchen-ticket.new .kitchen-ticket-header { background: #e3f2fd; }
.kitchen-ticket.in_progress .kitchen-ticket-header { background: #fffde7; }
.kitchen-ticket.ready .kitchen-ticket-header { background: #e8f5e9; }

.kitchen-ticket-body { padding: 12px; }
.kitchen-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}
.kitchen-item:last-child { border-bottom: none; }
.kitchen-item.done { text-decoration: line-through; opacity: 0.5; }

.kitchen-timer { font-size: 1.2rem; font-weight: 700; }
.kitchen-timer.warning { color: var(--warning); }
.kitchen-timer.danger { color: var(--danger); animation: pulse 1s infinite; }

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

/* ===== DROPDOWN ===== */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  z-index: 500;
  overflow: hidden;
  display: none;
}
.dropdown-menu.active { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  font-family: inherit;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 4px 0; }

/* ===== SEARCH ===== */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box .search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}
.search-box .form-control { padding-left: 32px; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.page-item {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: var(--text);
}
.page-item:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.page-item.active { background: var(--primary); border-color: var(--primary); color: #fff; cursor: default; }
.page-item.disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  transform: translateX(120%);
  transition: transform 0.3s ease;
  font-size: 0.85rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
}
.toast.show { transform: translateX(0); }
.toast.toast-success { border-left-color: var(--accent); }
.toast.toast-danger { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info { border-left-color: var(--info); }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; margin-bottom: 2px; }
.toast-message { color: var(--text-muted); }
.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2px;
  transition: color var(--transition);
}
.toast-close:hover { color: var(--text); }

/* ===== LOADING ===== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: inherit;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state-title { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.empty-state-text { font-size: 0.85rem; color: var(--text-muted); }

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

.login-box {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

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

.login-logo-text {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
}

.login-logo-text span { color: var(--primary); }

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* PIN Pad */
.pin-display {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
}
.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: all 0.2s;
}
.pin-dot.filled { background: var(--primary); border-color: var(--primary); }

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.pin-key {
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--card-bg);
  font-size: 1.3rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  user-select: none;
}
.pin-key:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.pin-key:active { transform: scale(0.95); }
.pin-key.delete { font-size: 1rem; color: var(--text-muted); }

/* ===== RECEIPT ===== */
.receipt {
  max-width: 300px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
}
.receipt-logo { text-align: center; font-size: 16px; font-weight: bold; margin-bottom: 8px; }
.receipt-divider { border-top: 1px dashed #000; margin: 6px 0; }
.receipt-row { display: flex; justify-content: space-between; }

/* ===== UTILITIES ===== */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }

.p-0 { padding: 0; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 24px; }
.mt-auto { margin-top: auto; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-small { font-size: 0.78rem; }
.text-xs { font-size: 0.7rem; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .pos-layout { grid-template-columns: 1fr; }
  .pos-right { position: fixed; bottom: 0; left: 0; right: 0; max-height: 50vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,0.1); }
  .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  /* Sidebar: off-canvas on mobile */
  .sidebar {
    position: fixed !important;
    left: 0; top: 0; bottom: 0;
    width: 250px !important;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  }
  .sidebar.open { transform: translateX(0) !important; }

  /* When sidebar is open, collapsed class should not hide it on mobile */
  .sidebar.collapsed { transform: translateX(-100%) !important; width: 250px !important; }
  .sidebar.collapsed.open { transform: translateX(0) !important; }

  /* Reset collapsed visual tweaks for mobile */
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .sidebar-logo-text,
  .sidebar.collapsed .sidebar-user-info { display: block !important; }
  .sidebar.collapsed .nav-item { justify-content: flex-start !important; padding: 9px 14px !important; }
  .sidebar.collapsed .sidebar-logo { padding: 16px 14px !important; justify-content: flex-start !important; }

  .main-content { margin-left: 0 !important; }
  .menu-toggle { display: flex; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .menu-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .login-box { padding: 28px 20px; }
  .modal { max-width: 100%; margin: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; position: fixed; bottom: 0; left: 0; right: 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-content { padding: 12px; }
  .topbar { padding: 0 12px; }
}

/* ===== PRINT ===== */
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
  * { box-shadow: none !important; }
}

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}
.sidebar-overlay.active { display: block; }

/* ===== PAGE NAV (light background - settings, inventory sidebar) ===== */
.page-nav-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.88rem;
  margin: 1px 0;
  box-sizing: border-box;
  line-height: 1.4;
}
.page-nav-item:hover { background: var(--bg); color: var(--primary); }
.page-nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

/* ===== MOBILE RESPONSIVE TABLES & PAGES ===== */
@media (max-width: 768px) {
  /* Card grids stack */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Two-column layouts become single */
  [style*="grid-template-columns:220px"],
  [style*="grid-template-columns:200px"],
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns:1fr 340px"],
  [style*="grid-template-columns:1fr 360px"] {
    grid-template-columns: 1fr !important;
  }

  /* Tables: horizontal scroll */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table th, .table td { white-space: nowrap; font-size: 0.78rem; padding: 6px 8px; }

  /* Hide less important columns on mobile */
  .table .col-hide-mobile { display: none; }

  /* Page content padding */
  .page-content { padding: 10px !important; }

  /* Cards */
  .card-header { flex-wrap: wrap; gap: 6px; }
  .card-header .btn { font-size: 0.75rem; padding: 4px 8px; }

  /* Filters row */
  .filter-row { flex-direction: column !important; gap: 6px !important; }
  .filter-row .form-control { width: 100% !important; }

  /* Forms */
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr !important; }
  .form-grid-2 [style*="grid-column:1/-1"] { grid-column: 1 !important; }

  /* Modals full screen on mobile */
  .modal { max-width: 100vw !important; width: 100% !important; margin: 0 !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    position: fixed !important; bottom: 0 !important; left: 0 !important; right: 0 !important; }
  .modal-overlay { align-items: flex-end !important; padding: 0 !important; }
  .modal-body { max-height: 65vh; overflow-y: auto; }

  /* Action buttons: text label only */
  .btn-sm { font-size: 0.72rem; padding: 4px 8px; }

  /* Dashboard quick actions */
  .quick-action-grid { grid-template-columns: repeat(3, 1fr) !important; }

  /* Sidebar: hidden by default on mobile (already handled) */
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .quick-action-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .table th, .table td { font-size: 0.72rem; padding: 5px 6px; }
}

/* Settings nav mobile */
@media (max-width: 768px) {
  .settings-nav { flex-direction: row !important; overflow-x: auto; flex-wrap: nowrap !important; }
  .settings-nav .page-nav-item { white-space: nowrap; flex-shrink: 0; padding: 6px 10px; font-size: 0.78rem; }
}

/* =============================================
   MOBILE PAGES ADAPTATION (max-width: 768px)
   ============================================= */
@media (max-width: 768px) {

  /* ---- TOPBAR ---- */
  /* Topbar mobile rules now live exclusively in mobile.css to avoid conflicts */

  /* ---- PAGE CONTENT ---- */
  .page-content { padding: 8px !important; }

  /* ---- CARDS ---- */
  .card-header { padding: 10px 12px; flex-wrap: wrap; gap: 5px; }
  .card-header .card-title { font-size: 0.9rem; }

  /* ---- STATS GRID ---- */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .stat-card { padding: 12px !important; }
  .stat-value { font-size: 1.1rem !important; }

  /* ---- FILTER ROWS ---- */
  .filters-row { flex-direction: column !important; }
  .filters-row > * { width: 100% !important; }

  /* ---- TABLES ---- */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .table th, .table td { font-size: 0.75rem !important; padding: 5px 7px !important; white-space: nowrap; }
  .table .mobile-hide { display: none !important; }

  /* ---- BUTTONS ---- */
  .btn-sm { font-size: 0.72rem; padding: 4px 7px; }

  /* ---- GRIDS ---- */
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr !important; }

  /* ---- MODALS ---- */
  .modal {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 90vh;
  }
  .modal-overlay { align-items: flex-end !important; padding: 0 !important; }
  .modal-body { max-height: 65vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .modal-lg { max-height: 92vh; }

  /* ---- PAGINATION ---- */
  .pagination { flex-wrap: wrap; gap: 3px; }

  /* ---- SETTINGS TABS ---- */
  .settings-sidebar {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    white-space: nowrap;
    padding: 6px !important;
    gap: 4px;
    border-right: none !important;
    border-bottom: 2px solid var(--border) !important;
  }
  .settings-sidebar .page-nav-item {
    display: inline-flex !important;
    width: auto !important;
    flex-shrink: 0;
    padding: 5px 10px !important;
    font-size: 0.76rem !important;
    border-radius: 20px !important;
    border: 1.5px solid var(--border);
    margin: 0 !important;
  }
  .settings-sidebar .page-nav-item.active {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
  }

  /* Settings layout becomes stacked */
  .settings-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }
  .settings-layout > div:first-child { min-width: unset !important; }

  /* ---- ORDERS PAGE ---- */
  .orders-filter-form { flex-direction: column !important; gap: 6px !important; }
  .orders-filter-form > * { width: 100% !important; }
  .orders-filter-form input[type=date],
  .orders-filter-form select { width: 100% !important; }

  /* ---- SMS PAGE ---- */
  .sms-grid { grid-template-columns: 1fr !important; }

  /* ---- STAFF PAGE ---- */
  .staff-actions { flex-wrap: wrap; }

  /* ---- CUSTOMERS PAGE ---- */
  .customers-search-row { flex-direction: column !important; gap: 6px; }

  /* ---- DASHBOARD ---- */
  .quick-action-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 7px !important; }
  .quick-action-grid a { padding: 10px 5px !important; }
  .quick-action-grid div[style*="font-size:0.8rem"] { font-size: 0.7rem !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .quick-action-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .table th, .table td { font-size: 0.7rem !important; padding: 4px 5px !important; }
}

/* Desktop: show action button label inline */
@media (min-width: 769px) {
  .topbar-action-btn .btn-text { margin-left: 4px; }
}

.app-version-badge {
  position: fixed;
  bottom: 6px;
  right: 8px;
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0.45;
  z-index: 10;
  pointer-events: none;
  user-select: none;
  font-family: monospace;
}
@media (max-width: 768px) {
  .app-version-badge { display: none; }
}
