/* ─── Variables ──────────────────────────────────────────────── */
:root {
  --primary: #E74C3C;
  --primary-dark: #C0392B;
  --primary-light: #FFF0EE;
  --primary-soft: #FFDDD6;
  --orange: #F39C12;
  --orange-light: #FFF8E7;
  --orange-soft: #FFE8B8;
  --blue: #3498DB;
  --blue-light: #EBF5FB;
  --blue-soft: #C8E6FA;
  --purple: #9B59B6;
  --bg: #FAFAFA;
  --card: #FFFFFF;
  --text: #1A1A1A;
  --text-secondary: #8C8C8C;
  --text-tertiary: #BFBFBF;
  --border: #F0F0F0;
  --success: #27AE60;
  --success-light: #E8F8EF;
  --warning: #F39C12;
  --warning-light: #FFF8E7;
  --danger-light: #FFF0EE;
  --sidebar-width: 244px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,0.04);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
  --gradient-primary: linear-gradient(135deg, #E74C3C 0%, #C0392B 100%);
}

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--text); background: var(--bg); }
input, select, textarea, button { font-family: inherit; font-size: 14px; }
a { color: var(--primary); text-decoration: none; }

/* ─── Login Page ─────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
}
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-icon {
  width: 64px; height: 64px;
  background: var(--gradient-primary);
  color: white;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(231,76,60,0.25);
}
.login-logo h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}
.login-logo p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.error-text {
  color: var(--primary);
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
}

/* ─── Form Components ────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
  background: var(--card);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}
.form-group textarea {
  resize: vertical;
  min-height: 60px;
}
.form-row {
  display: flex;
  gap: 12px;
}
.form-row .form-group {
  flex: 1;
}
.form-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 20px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.form-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--gradient-primary); color: white; box-shadow: 0 3px 10px rgba(231,76,60,0.2); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--primary); color: white; }
.btn-ghost { background: transparent; color: var(--text-secondary); padding: 8px 12px; }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
  background: var(--bg);
  color: var(--text-secondary);
}
.btn-icon:hover { opacity: 0.7; }

/* ─── App Layout ─────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s;
}
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo {
  width: 42px; height: 42px;
  background: var(--gradient-primary);
  color: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(231,76,60,0.25);
}
.sidebar-header h2 {
  font-size: 18px;
  font-weight: 800;
}
.sidebar-header small {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}
.sidebar-nav {
  flex: 1;
  padding: 12px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  margin-bottom: 4px;
}
.nav-item:hover { background: #F5F5F5; color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; position: relative; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--gradient-primary);
  border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px;
  min-height: 100vh;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 800;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  width: 40px; height: 40px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body { padding: 16px; }

/* Summary cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.summary-card {
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
  cursor: default;
  border: 1px solid transparent;
}
.summary-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}
.summary-card:nth-child(1) { background: linear-gradient(135deg, #FFF0EE, #FFDDD6); border-color: rgba(231,76,60,0.08); }
.summary-card:nth-child(2) { background: linear-gradient(135deg, #FFF8E7, #FFE8B8); border-color: rgba(243,156,18,0.08); }
.summary-card:nth-child(3) { background: linear-gradient(135deg, #EBF5FB, #C8E6FA); border-color: rgba(52,152,219,0.08); }
.summary-card::before {
  content: '';
  position: absolute;
  top: -18px; right: -18px;
  width: 70px; height: 70px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  pointer-events: none;
}
.summary-card .label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  margin-bottom: 10px;
}
.summary-card .value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
}

/* Restaurant cards grid */
.restaurant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.restaurant-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.restaurant-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}
.restaurant-card .r-logo {
  width: 50px; height: 50px;
  border-radius: 12px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.restaurant-card .r-logo.has-img {
  background: var(--bg);
}
.restaurant-card .r-logo img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.restaurant-card .r-info { flex: 1; min-width: 0; }
.restaurant-card .r-name {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.restaurant-card .r-name.inactive { color: var(--text-secondary); }
.restaurant-card .r-desc {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.restaurant-card .r-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.restaurant-card .r-arrow {
  color: var(--text-secondary);
  font-size: 20px;
  flex-shrink: 0;
}

/* ─── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-open { background: var(--success-light); color: var(--success); }
.badge-open::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.badge-closed { background: var(--primary-light); color: var(--primary); }
.badge-closed::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.badge-visible { background: var(--success-light); color: var(--success); }
.badge-hidden { background: var(--border); color: var(--text-secondary); }
.badge-new { background: var(--orange-light); color: var(--orange); }
.badge-pending { background: #fffbe6; color: #b8860b; border: 1px solid #f5c518; }
.badge-combo { background: var(--blue-light); color: var(--blue); }
.badge-pizza { background: var(--primary-light); color: var(--primary); }
.badge-days { background: #eef2ff; color: #3949ab; }
.badge-orders { background: #F8F8F8; color: var(--text-secondary); font-weight: 600; border-radius: 6px; padding: 3px 8px; }

/* ─── Restaurant Detail ──────────────────────────────────────── */
.detail-header {
  background: var(--gradient-primary);
  color: white;
  padding: 24px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.detail-header .d-logo {
  width: 64px; height: 64px;
  background: white;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.detail-header .d-logo img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.detail-header .d-name {
  font-size: 20px;
  font-weight: 800;
}
.detail-header .d-status {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 4px;
}

/* Stats row */
.stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.stat-box {
  flex: 1;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.stat-box:nth-child(1) {
  background: linear-gradient(135deg, #FFF0EE, #FFDDD6);
  border-color: rgba(231,76,60,0.08);
}
.stat-box:nth-child(2) {
  background: linear-gradient(135deg, #FFF8E7, #FFE8B8);
  border-color: rgba(243,156,18,0.08);
}
.stat-box .stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}
.stat-box .stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}
.stat-toggle {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

/* Visibility toggle */
.visibility-row {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.visibility-row .v-info { flex: 1; }
.visibility-row .v-title { font-size: 13px; font-weight: 700; }
.visibility-row .v-subtitle { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.toggle-switch {
  width: 48px; height: 28px;
  border-radius: 14px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-switch.on { background: var(--gradient-primary); }
.toggle-switch.off { background: #CCC; }
.toggle-switch .toggle-knob {
  width: 24px; height: 24px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  transition: left 0.2s;
}
.toggle-switch.on .toggle-knob { left: 22px; }
.toggle-switch.off .toggle-knob { left: 2px; }

/* Action chips */
.actions-row {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.action-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.1s;
}
.action-chip:hover { opacity: 0.85; transform: translateY(-1px); }
.chip-edit { background: var(--blue-light); color: var(--blue); }
.chip-add { background: var(--success-light); color: var(--success); }
.chip-reset { background: var(--orange-light); color: var(--orange); }
.chip-delete { background: var(--primary-light); color: var(--primary); }

/* Menu section */
.menu-section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.menu-section-header {
  padding: 14px 16px 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-secondary);
}
.category-header {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.category-header .cat-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}
.category-header .cat-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}
.category-header .cat-count {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Menu item row */
.menu-item-row {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s;
}
.menu-item-row:hover {
  background: var(--bg);
}
.menu-item-row .mi-img {
  width: 44px; height: 44px;
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.menu-item-row .mi-img img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.menu-item-row .mi-info {
  flex: 1;
  min-width: 0;
}
.menu-item-row .mi-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-item-row .mi-sub {
  font-size: 10px;
  color: var(--primary);
  margin-top: 2px;
}
.menu-item-row .mi-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.menu-item-row .mi-actions {
  display: flex;
  gap: 4px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}
.empty-state svg {
  width: 48px; height: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

/* ─── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}
.modal-overlay.active {
  display: flex;
}
.modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 {
  font-size: 18px;
  font-weight: 800;
}
.modal-body {
  padding: 16px 24px;
  max-height: 65vh;
  overflow-y: auto;
}
.modal-footer {
  padding: 16px 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--border);
}

/* ─── Day Selector ───────────────────────────────────────────── */
.day-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.day-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: white;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.day-btn.selected {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
}

/* ─── Delivery Mode Selector ─────────────────────────────────── */
.mode-selector {
  display: flex;
  gap: 8px;
}
.mode-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.mode-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

/* ─── Combo Slots ────────────────────────────────────────────── */
.combo-slot-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  background: #fafafa;
  position: relative;
}
.combo-slot-card .slot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}
.combo-slot-card .slot-header strong {
  font-size: 14px;
  color: #333;
}
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* Eligible items list in combo */
.eligible-items-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px;
  margin-top: 8px;
  background: #fff;
}
.eligible-cat-group {
  margin-bottom: 6px;
}
.eligible-cat-group:last-child {
  margin-bottom: 0;
}
.eligible-cat-header {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  padding: 6px 0 4px;
  border-bottom: 1px solid #eee;
  margin-bottom: 2px;
}
.eligible-item-label {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 5px 8px !important;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.eligible-item-label:hover {
  background: #f5f5f5;
}
.eligible-item-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* ─── Confirm Dialog ─────────────────────────────────────────── */
.confirm-body {
  text-align: center;
  padding: 20px 0;
}
.confirm-body p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
}
.confirm-body .confirm-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 12px;
}
.confirm-body .confirm-icon.warning { background: var(--warning-light); }
.confirm-body .confirm-icon.danger { background: var(--danger-light); }

/* ─── Toast ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateX(40px);
  transition: all 0.3s;
}
.toast.show {
  opacity: 1;
  transform: translateX(0);
}
.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--primary); color: white; }

/* ─── Back button ────────────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  padding: 6px 0;
  border: none;
  background: none;
}
.back-btn:hover { color: var(--text); }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.active {
    display: block;
  }
  .menu-toggle {
    display: flex;
  }
  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-top: 60px;
  }
  .summary-cards {
    grid-template-columns: 1fr;
  }
  .restaurant-grid {
    grid-template-columns: 1fr;
  }
  .detail-header {
    flex-direction: column;
    text-align: center;
  }
  .actions-row {
    justify-content: center;
  }
  .modal {
    max-width: 100%;
  }
  .modal-body {
    max-height: 75vh;
  }
  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

@media (min-width: 769px) and (max-width: 1200px) {
  .summary-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ─── SVG Icons (inline) ─────────────────────────────────────── */
.icon { display: inline-block; width: 18px; height: 18px; vertical-align: middle; }

/* ─── Image Upload Widget ────────────────────────────────────── */
.image-upload-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.image-preview {
  min-height: 48px;
  display: flex;
  align-items: center;
}
.image-preview .no-image {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}
.upload-status {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ─── Analytics ──────────────────────────────────────────────── */
.analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.analytics-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}
.kpi-card .kpi-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.kpi-card .kpi-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.kpi-card .kpi-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.chart-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.chart-card canvas {
  max-height: 200px;
}
.chart-card.chart-wide canvas {
  max-height: 160px;
}
.chart-card.chart-wide {
  grid-column: 1 / -1;
}
.chart-card h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}
@media (max-width: 900px) {
  .analytics-kpi-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .analytics-grid { grid-template-columns: 1fr; }
  .chart-card.chart-wide { grid-column: auto; }
}

/* ─── Settings / Category Order ──────────────────────────────── */
.settings-section {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 20px;
}
.settings-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.settings-section-header h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
}
.settings-help {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  margin: 0;
  max-width: 540px;
}
.category-order-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.category-order-loading {
  padding: 20px;
  text-align: center;
  color: var(--text-muted, #6b7280);
  font-size: 13px;
}
.category-slot {
  background: #f9fafb;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 14px;
}
.category-slot-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.category-slot-header h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}
.category-slot-range {
  font-size: 11px;
  color: var(--text-muted, #6b7280);
  font-weight: 500;
}
.category-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.category-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  cursor: grab;
  font-size: 13px;
  user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.category-item:hover {
  border-color: #C0392B;
}
.category-item.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.category-item.drag-over {
  border-color: #C0392B;
  background: #fff5f3;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(192, 57, 43, 0.15);
}
.drag-handle {
  color: #9ca3af;
  font-weight: 700;
  letter-spacing: -2px;
  cursor: grab;
}
.category-position {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #C0392B;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.category-name {
  font-weight: 500;
  color: var(--text, #111827);
}
@media (max-width: 700px) {
  .category-order-grid { grid-template-columns: 1fr; }
}

/* ─── Restaurant Monthly History ─────────────────────────────── */
.history-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  margin-top: 16px;
}
.history-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.history-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.history-sub {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}
.history-chart-wrap {
  position: relative;
  height: 220px;
  margin-bottom: 12px;
}
.history-chart-wrap canvas {
  max-height: 220px;
}
.history-table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.history-table th,
.history-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.history-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  font-weight: 600;
}
.history-table th.num,
.history-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.history-table tbody tr:last-child td {
  border-bottom: none;
}
.history-table tbody tr:hover {
  background: var(--bg);
}
.history-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
@media (max-width: 600px) {
  .history-chart-wrap { height: 180px; }
}

/* ─── Users panel ────────────────────────────────────────────── */
.users-shell {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.users-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.users-tab {
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.users-tab:hover { background: var(--bg); color: var(--text); }
.users-tab.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary-soft);
}
.users-tab-ico { font-size: 14px; }
.users-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.users-search {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--card);
}
.users-search:focus { outline: none; border-color: var(--primary); }
.users-count {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.users-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.users-table th,
.users-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.users-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  font-weight: 600;
  background: var(--bg);
}
.users-table tbody tr:last-child td { border-bottom: none; }
.users-table tbody tr:hover { background: var(--bg); }
.users-table td.num,
.users-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.users-table td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.users-table .users-actions-col { width: 132px; }
.users-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.users-actions .btn-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.users-actions .btn-icon:hover {
  background: var(--bg);
  color: var(--primary-dark);
  border-color: var(--border);
}
.users-actions .users-delete:hover { color: var(--primary); }
.users-actions .users-reset:hover { color: var(--blue); }
.users-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.users-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}
.users-open-restaurant {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: none;
}
.users-open-restaurant:hover { text-decoration: underline; }
