/* ============================================
   SmartBite - Global Design System
   Diseño claro premium inspirado en iOS / macOS
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Brand Colors - iOS Palette */
  /* Brand Colors - User Palette */
  --primary: #314254;
  --primary-hover: #1e2935;
  --primary-light: rgba(49, 66, 84, 0.1);
  --accent: #314254;
  --accent-hover: #1e2935;
  --accent-light: rgba(49, 66, 84, 0.1);
  --danger: #ff453a;
  --danger-hover: #ff3b30;
  --danger-light: rgba(255, 69, 58, 0.15);
  --warning: #ff9f0a;
  --warning-hover: #ff9500;
  --warning-light: rgba(255, 159, 10, 0.15);
  --info: #0a84ff;
  --info-light: rgba(10, 132, 255, 0.15);
  --apple-green: #34C759;

  /* Table States - iOS Palette */
  --table-free: #34C759;
  --table-occupied: #ff453a;
  --table-reserved: #ff9f0a;
  --table-waiting: #5e5ce6;
  --table-requesting: #ff375f;

  /* Dark Theme Backgrounds */
  /* Dark Theme Backgrounds */
  --bg-primary: #2f2f31;
  --bg-secondary: #262628;
  --bg-tertiary: #1c1c1e;
  --bg-card: #2f2f31;
  --bg-card-hover: #3a3a3c;
  --bg-elevated: #3a3a3c;
  --bg-input: #262628;
  --bg-sidebar: #262628;

  /* Borders */
  --border-color: #2a2f42;
  --border-light: #353a50;
  --border-focus: #6366f1;

  /* Text Colors */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-muted: #475569;
  --text-inverse: #0f172a;

  /* Shadows - iOS Soft */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow-green: 0 0 16px rgba(52, 199, 89, 0.4);
  --shadow-glow-red: 0 0 16px rgba(255, 69, 58, 0.4);
  --shadow-glow-amber: 0 0 16px rgba(255, 159, 10, 0.4);
  --shadow-glow-purple: 0 0 16px rgba(94, 92, 230, 0.4);

  /* Spacing - Modern Soft Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Glassmorphism Variables */
  --glass-bg-dark: rgba(22, 25, 35, 0.7);
  --glass-bg-light: rgba(255, 255, 255, 0.75);
  --glass-border-dark: rgba(255, 255, 255, 0.1);
  --glass-border-light: rgba(0, 0, 0, 0.05);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;

  /* Scrollbar Colors */
  --scrollbar-thumb: #4a4a4c;
  --scrollbar-thumb-hover: #5a5a5c;

  /* Z-index layers */
  --z-dropdown: 5000;
  --z-modal-backdrop: 10000;
  --z-modal: 10001;
  --z-toast: 10002;
  --z-tooltip: 10003;
  /* macOS / MacBook Inspired Colors */
  --macos-bg-start: #2f2f31;
  --macos-bg-end: #3a3a3c;
  --macos-border: rgba(255, 255, 255, 0.1);
  --action-btn-bg: #2f2f31;
  --macos-text: rgba(255, 255, 255, 0.95);
  --macos-text-secondary: rgba(255, 255, 255, 0.6);

  /* Nav active appearance */
  --nav-active-bg: #2f2f31;
  --nav-active-color: #ffffff;
}

/* ============================================
   Light Theme Override
   ============================================ */
[data-theme="light"] {
  /* Premium iOS Light Backgrounds */
  --bg-primary: #f2f2f7; 
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f1f6;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f1f6;
  --bg-elevated: #ffffff;
  --bg-input: #ffffff;
  --bg-sidebar: #ffffff;

  /* Borders */
  --border-color: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.04);
  --border-focus: var(--primary);

  /* Light Theme Glassmorphism */
  --glass-bg-dark: rgba(255, 255, 255, 0.7);
  --glass-border-dark: rgba(0, 0, 0, 0.06);
  --glass-bg-light: rgba(255, 255, 255, 0.8);
  --glass-border-light: rgba(0, 0, 0, 0.04);

  /* Text Colors - User Requested Palette (Gris/Azul) */
  --text-primary: #2f2f31; 
  --text-secondary: #2f2f31;
  --text-tertiary: #64748b;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  /* macOS Elements Overrides for Light Mode */
  --macos-bg-start: #ffffff;
  --macos-bg-end: #ffffff;
  --macos-border: rgba(0, 0, 0, 0.06);
  --macos-text: #2f2f31;
  --macos-text-secondary: #2f2f31;

  /* Nav active appearance */
  --nav-active-bg: #2f2f31;
  --nav-active-color: #ffffff;

  /* Shadows for light mode */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(49, 66, 84, 0.08);
  --shadow-lg: 0 8px 24px rgba(49, 66, 84, 0.12);
  --shadow-xl: 0 16px 48px rgba(49, 66, 84, 0.16);

  /* Scrollbar light mode override */
  --scrollbar-thumb: #2f2f31;
  --scrollbar-thumb-hover: #1c1c1e;
}

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

html {
  font-size: 14px;
}

html, body {
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv05", "cv11", "ss01";
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

.custom-cursor, .custom-cursor body {
  cursor: url('../assets/mousedark/arrow.cur'), default;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px; /* Slightly wider for better visibility */
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border: 2px solid var(--bg-secondary);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Global Icon Styling */
[data-lucide], .lucide, svg.lucide {
  stroke-width: 1.8px !important;
  transition: stroke-width 0.2s ease;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family);
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
}

h1, .topbar-title { color: var(--text-primary); font-weight: 800; font-size: 1.75rem; letter-spacing: -0.02em; }
h2, .settings-section-title { color: var(--text-primary); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.01em; }
h3 { color: var(--text-primary); font-weight: 600; font-size: 1.15rem; }
h4 { color: var(--text-secondary); font-weight: 600; font-size: 1rem; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
  cursor: pointer;
}
.custom-cursor a {
  cursor: url('../assets/mousedark/hand.cur'), pointer;
}
a:hover { color: var(--primary-hover); }

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  min-height: 44px;
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  outline: none;
  background: #2f2f31;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.custom-cursor .btn {
  cursor: url('../assets/mousedark/hand.cur'), pointer;
}
.btn:active { transform: scale(0.97); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow-glow-green);
}

.btn-success {
  background: #27ae60;
  color: white;
  border-color: #27ae60;
}
.btn-success:hover:not(:disabled) {
  background: #219653;
  box-shadow: var(--shadow-glow-green);
}

.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow-purple);
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
  box-shadow: var(--shadow-glow-red);
}

.btn-warning {
  background: var(--warning);
  color: var(--text-inverse);
}
.btn-warning:hover:not(:disabled) {
  background: var(--warning-hover);
}

.btn-ghost {
  background: #2f2f31;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.1);
}
.btn-ghost:hover:not(:disabled) {
  background: #3e3e40;
  color: #ffffff;
  border-color: rgba(255,255,255,0.2);
}

.btn-black {
  background: #000000;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.1);
}
.btn-black:hover:not(:disabled) {
  background: #1c1c1e;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-outline:hover:not(:disabled) {
  background: var(--primary-light);
}

.btn-sm {
  padding: 6px 12px;
  min-height: 32px;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  width: 36px;
  height: 36px;
}
.btn-icon:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.btn-icon-round {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  padding: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  display: flex !important;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.btn-icon-round:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ============================================
   Form Elements - Premium iOS Path
   ============================================ */
input, select, textarea {
  font-family: var(--font-family);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--macos-border);
  border-radius: 12px;
  padding: 10px 16px;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  cursor: text;
}
.custom-cursor input, 
.custom-cursor select, 
.custom-cursor textarea {
  cursor: url('../assets/mousedark/ibeam.cur'), text;
}

[data-theme="light"] input, 
[data-theme="light"] select, 
[data-theme="light"] textarea {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
  color: #1d1d1f;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

input:focus, select:focus, textarea:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.15);
}

[data-theme="light"] input:focus, 
[data-theme="light"] select:focus, 
[data-theme="light"] textarea:focus {
  background: #ffffff;
  border-color: var(--primary);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form-group {
  margin-bottom: 16px;
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all var(--transition-fast);
}
.card:hover {
  border-color: var(--border-light);
}

/* ============================================
   Badges
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: #34C759;
  color: white;
}
.badge-danger {
  background: var(--danger);
  color: white;
}
.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}
.badge-info {
  background: var(--info-light);
  color: var(--info);
}
.badge-purple {
  background: var(--accent-light);
  color: var(--accent);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  left: auto;
  bottom: auto;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #2f2f31; 
  color: #ffffff;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  animation: iosSlideIn 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  min-width: 220px;
  max-width: 320px;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .toast {
  /* Fondo ya es oscuro por defecto */
  border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes iosSlideIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.toast.hide {
  animation: iosSlideOut 0.4s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

@keyframes iosSlideOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(40px) scale(0.9); }
}

.toast.success { border-left: 5px solid #34C759; }
.toast.error { border-left: 5px solid #FF3B30; }
.toast.warning { border-left: 5px solid #FF9500; }
.toast.info { border-left: 5px solid #007AFF; }

.toast-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(0,0,0,0.05);
  flex-shrink: 0;
}

[data-theme="dark"] .toast-icon-wrapper {
  background: rgba(255,255,255,0.1);
}

.toast.success .toast-icon-wrapper { color: #34C759; background: rgba(52, 199, 89, 0.1); }
.toast.error .toast-icon-wrapper { color: #FF3B30; background: rgba(255, 59, 48, 0.1); }
.toast.warning .toast-icon-wrapper { color: #FF9500; background: rgba(255, 149, 0, 0.1); }
.toast.info .toast-icon-wrapper { color: #007AFF; background: rgba(0, 122, 255, 0.1); }

.toast-icon { display: none; } /* Hide old icon span */
.toast-message { flex: 1; font-size: 0.8rem; color: #ffffff; font-weight: 500; }
.toast-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  transition: color 0.2s;
}
.toast-close:hover {
  color: #ffffff;
}

/* ============================================
   Modal
   ============================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.modal {
  background: #ffffff !important;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 28px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.3);
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  z-index: var(--z-modal);
  animation: scaleIn 0.35s cubic-bezier(0.19, 1, 0.22, 1);
  overflow: hidden;
}

[data-theme="dark"] .modal {
  background: #1c1c1e !important;
  border-color: rgba(255, 255, 255, 0.1);
}

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

/* Modales Sólidos (para eliminación/críticos) - Ahora con el mismo cristal borroso */
.modal-backdrop.solid {
  background: rgba(0, 0, 0, 0.65) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
}

.modal-backdrop.solid .modal {
  background: #ffffff !important;
  border: 4px solid #000 !important;
  box-shadow: 0 20px 50px rgba(255, 69, 58, 0.2);
}

[data-theme="dark"] .modal-backdrop.solid .modal {
  background: #111111 !important;
  border-color: #ff3b30 !important;
}

.modal.modal-lg {
  max-width: 850px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
}
.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Premium Close Button */
.btn-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--macos-border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  outline: none;
}

.btn-close:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
  transform: rotate(90deg);
  box-shadow: 0 4px 12px rgba(255, 69, 58, 0.3);
}

.btn-close i {
  width: 16px;
  height: 16px;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 10px 24px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}
@keyframes glow {
  0% { box-shadow: 0 0 5px rgba(16, 185, 129, 0.2); }
  50% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.6); }
  100% { box-shadow: 0 0 5px rgba(16, 185, 129, 0.2); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* New specific animations for status feedback */
@keyframes blink-ready {
  0%, 100% { background: linear-gradient(135deg, #27AE60, #1E8449); }
  50% { background: #2ecc71; }
}

@keyframes indicator-flicker {
  0%, 100% { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 2px #ff453a); }
  50% { opacity: 0.8; transform: scale(1.15); filter: drop-shadow(0 0 5px #ff453a); }
}

@keyframes indicator-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes indicator-pulse-status {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

/* Animation Utility Classes */
.animate-spin {
  animation: spin 1s linear infinite;
}
.animate-bounce {
  animation: indicator-bounce 0.6s ease infinite;
}
.animate-pulse {
  animation: pulse 2s ease infinite;
}

/* Sizing Utility Classes */
.w-8  { width: 2rem; }
.h-8  { height: 2rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.w-14 { width: 3.5rem; }
.h-14 { height: 3.5rem; }
.w-16 { width: 4rem; }
.h-16 { height: 4rem; }
.w-20 { width: 5rem; }
.h-20 { height: 5rem; }
.w-24 { width: 6rem; }
.h-24 { height: 6rem; }
.w-full { width: 100%; }
.h-full { height: 100%; }

/* Skeleton Loading System */
.skeleton {
  background: var(--bg-tertiary);
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--bg-card-hover) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.2s infinite ease-in-out;
  border-radius: var(--radius-md);
  color: transparent !important;
  pointer-events: none;
  border: none !important;
  box-shadow: none !important;
  opacity: 0.8;
}

[data-theme="light"] .skeleton {
  background: #e0e0e0; 
  background: linear-gradient(
    90deg,
    #e0e0e0 25%,
    #f8f8f8 50%,
    #e0e0e0 75%
  );
  background-size: 200% 100%;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text { height: 1em; margin-bottom: 0.5rem; width: 100%; }
.skeleton-title { height: 1.5em; margin-bottom: 1rem; width: 60%; }
.skeleton-circle { border-radius: 50%; width: 40px; height: 40px; flex-shrink: 0; }
.skeleton-row-box { height: 20px; width: 100%; }

/* Mesas Skeleton */
.skeleton-table {
  position: absolute;
  border-radius: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.skeleton-table::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  animation: skeleton-loading 1.5s infinite;
}
[data-theme="light"] .skeleton-table::after {
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.05), transparent);
}

/* ============================================
   Utility Classes
   ============================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.w-full { width: 100%; }
.h-full { height: 100%; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.relative { position: relative; }
.absolute { position: absolute; }

.hidden { display: none !important; }
.opacity-0 { opacity: 0; }
.pointer-events-none { pointer-events: none; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.no-select {
  user-select: none;
  -webkit-user-select: none;
}

/* ============================================
   Spinner
   ============================================ */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-tertiary);
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Kitchen Timer Label */
.ki-timer {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.timer-normal { color: var(--primary); }
.timer-urgent { color: var(--warning); border-color: var(--warning); }
.timer-overdue { color: var(--danger); border-color: var(--danger); }
.empty-state-text {
  font-size: 0.95rem;
  max-width: 300px;
}

/* ============================================
   Sidebar Layout
   ============================================ */
.app-layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  background: radial-gradient(circle at top left, rgba(10, 132, 255, 0.1), transparent 40%),
              radial-gradient(circle at bottom right, rgba(10, 132, 255, 0.05), transparent 40%),
              #f2f2f7;
}

.floor-plan-wrapper {
  background: linear-gradient(135deg, rgba(58, 58, 60, 0.1) 0%, rgba(49, 66, 84, 0.1) 100%);
  position: relative;
  overflow: auto;
  flex: 1;
}

.topbar {
  background: linear-gradient(to bottom, var(--macos-bg-start), var(--macos-bg-end));
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border-bottom: 1px solid var(--macos-border);
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-right: 32px;
  padding-bottom: 16px;
  padding-left: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: var(--shadow-md);
}

.sidebar {
  width: 80px;
  height: 100%;
  background: linear-gradient(180deg, var(--macos-bg-start), var(--macos-bg-end));
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-right: 1px solid var(--macos-border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  height: auto;
  margin-bottom: 24px;
}

.sidebar-logo {
  width: 54px;
  height: 54px;
  background: transparent;
  color: white;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin-top: 4px; /* Finely tuned for perceived center with header */
}

.sidebar-logo:hover {
  transform: scale(1.08) rotate(2deg);
}

.sidebar-alert-btn {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #e32636, #9b1c2e) !important;
  color: white !important;
  border: none !important;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 !important;
  box-shadow: 0 4px 15px rgba(227, 38, 54, 0.4);
  position: relative;
  overflow: visible;
}

/* Pulse animation for the notification button */
.sidebar-alert-btn.has-unread::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 18px;
  background: rgba(255, 69, 58, 0.3);
  z-index: -1;
  animation: notification-pulse 2s infinite;
}

@keyframes notification-pulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

.sidebar-alert-btn:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 69, 58, 0.6);
  filter: brightness(1.1);
}

.sidebar-alert-btn i {
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* ============================================
   Horizontal Top Bar System
   Standardized iOS layout for all pages
   ============================================ */
.topbar {
  background: transparent;
  border-bottom: 1px solid var(--macos-border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-shrink: 0;
  z-index: 50;
  min-height: 64px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--macos-text);
  line-height: 1.2;
}

.topbar-subtitle {
  font-size: 0.75rem;
  color: var(--macos-text-secondary);
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Stats bar - Modern iOS Pill Style */
.stats-bar {
  display: flex;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  gap: 4px;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-lg) - 4px);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.stat-chip:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="light"] .stat-chip:hover {
  color: #000000 !important;
}

[data-theme="light"] .stat-chip:hover .stat-count {
  color: #000000 !important;
}

.stat-chip.free {
  background: rgba(52, 199, 89, 0.1) !important;
  border: 1px solid rgba(52, 199, 89, 0.4) !important;
  color: #34C759 !important;
  border-radius: 10px;
  cursor: pointer;
}
.stat-chip.free .stat-count {
  color: #34C759 !important;
}
.stat-chip.free:hover {
  background: rgba(52, 199, 89, 0.2) !important;
  border-color: #34C759 !important;
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.stat-dot.all { background: var(--text-secondary); }
.stat-dot.free { background: var(--table-free); }
.stat-dot.occupied { background: var(--table-occupied); }
.stat-dot.reserved { background: var(--table-reserved); }
.stat-dot.waiting { background: #facc15; } /* Amarillo brillante para solicitudes */

.stat-count {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.85rem;
}

.topbar-clock {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--macos-text);
  background: var(--bg-secondary);
  padding: 6px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
}

.vertical-separator {
  width: 1px;
  height: 24px;
  background: var(--macos-border);
  margin: 0 8px;
}
/* Notification Dropdown / Modal Backdrop fix */
.notification-backdrop {
  position: fixed;
  inset: 0;
  background: transparent; /* Make it transparent to avoid "opaque filter" look */
  z-index: 998;
  display: none;
}

.notification-backdrop.show {
  display: block;
}

.notification-dropdown {
  position: absolute;
  left: 90px;
  top: 80px;
  background: #1c1c1e;
  border: 1px solid var(--macos-border);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  z-index: 1000;
  width: 320px;
  max-height: 480px;
  overflow: hidden;
  backdrop-filter: blur(40px);
  animation: slideInLeft 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  flex: 1;
}

.nav-item {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  color: #000000;
  font-size: 1.4rem;
  transition: all var(--transition-base);
  position: relative;
  margin: 0 auto;
}

.nav-item i, .nav-item svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.5;
}

.nav-item.active {
  background: var(--nav-active-bg) !important;
  color: var(--nav-active-color) !important;
  box-shadow: var(--shadow-md);
  transform: scale(1.05);
}

.user-role-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}

.role-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  color: var(--macos-text-secondary);
  border: 1px solid var(--macos-border);
  box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}

.role-icon-box.admin { background: rgba(52, 199, 89, 0.1); color: var(--primary); border-color: rgba(52, 199, 89, 0.2); }
.role-icon-box.superadmin { background: rgba(255, 215, 0, 0.1); color: #FFD700; border-color: rgba(255, 215, 0, 0.3); }
.role-icon-box.mesero { background: rgba(10, 132, 255, 0.1); color: var(--info); border-color: rgba(10, 132, 255, 0.2); }
.role-icon-box.cocina { background: rgba(255, 159, 10, 0.1); color: var(--warning); border-color: rgba(255, 159, 10, 0.2); }

.role-text {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--macos-text-secondary);
  letter-spacing: 0.1em;
  margin-top: 2px;
}

.app-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  box-shadow: var(--shadow-md);
}

.sidebar-logo .conn-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border: 3px solid var(--bg-sidebar);
  border-radius: 50%;
  background: #ff453a; /* Default to disconnected red */
  z-index: 2;
  transition: all 0.3s ease;
}

.sidebar-logo .conn-dot.online {
  background: #34c759;
  box-shadow: 0 0 8px rgba(52, 199, 89, 0.6);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  flex: 1;
  padding-top: 8px;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
}

.nav-item {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  color: #000000;
  font-size: 1.4rem;
  transition: all var(--transition-fast);
  position: relative;
  cursor: pointer;
}
.custom-cursor .nav-item {
  cursor: url('../assets/mousedark/hand.cur'), pointer;
}

.nav-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-sidebar);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
  padding: 0 4px;
}

.nav-separator {
  width: 24px;
  height: 1px;
  background: var(--border-light);
  margin: 5px 0;
  opacity: 0.5;
}

.nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--nav-active-bg) !important;
  color: var(--nav-active-color) !important;
}

.nav-item.active i, .nav-item.active svg {
  color: #ffffff !important;
}

/* Sidebar Submenu */
.nav-item-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.sidebar-submenu {
  position: absolute;
  left: 76px; /* Cobertura extra de 4px sobre el sidebar para evitar huecos */
  top: 0;
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--macos-border) !important;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  min-width: 170px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: translateX(-8px);
  z-index: 2000;
  /* Elminar blur para color sólido solicitado */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Puente de hover: Crea un área invisible entre el sidebar y el submenu 
   para permitir movimientos diagonales sin que se cierre */
.sidebar-submenu::before {
  content: '';
  position: absolute;
  top: -20px;
  bottom: -20px;
  left: -30px;
  right: 0;
  background: transparent;
  z-index: -1;
}

.has-submenu:hover .sidebar-submenu {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.submenu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.submenu-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.submenu-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.submenu-item i {
  width: 16px;
  height: 16px;
  stroke-width: 1.5;
}

.nav-tooltip {
  position: absolute;
  left: 60px;
  background: var(--bg-elevated);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.nav-item:hover .nav-tooltip {
  opacity: 1;
}

.main-content {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ============================================
   Kitchen Status Indicators (on table)
   ============================================ */
.kitchen-indicator {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 32px;
  height: 32px;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  z-index: 30;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.kitchen-indicator svg, .kitchen-indicator i {
  width: 18px !important;
  height: 18px !important;
}

.ki-new { color: #ff453a; border-color: #ff453a; }
.ki-new i, .ki-new svg { animation: indicator-flicker 0.8s infinite; }

.ki-prep { color: #5fb8ff; border-color: #5fb8ff; }
.ki-prep i, .ki-prep svg { animation: indicator-bounce 1s ease-in-out infinite; }

.ki-ready { color: #27ae60; border-color: #27ae60; }
.ki-ready i, .ki-ready svg { animation: indicator-pulse-status 1.2s infinite; }

.ki-draft { color: #f2d600; border-color: #f2d600; }

/* Bar Indicator (Left Side) */
.bar-indicator {
  position: absolute;
  top: -12px;
  left: -12px;
  width: 32px;
  height: 32px;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  z-index: 30;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bar-indicator svg, .bar-indicator i {
  width: 18px !important;
  height: 18px !important;
}

.ki-bar-ready {
  color: #27ae60 !important;
  border-color: #27ae60 !important;
  box-shadow: 0 0 15px rgba(39, 174, 96, 0.6), 0 4px 12px rgba(0,0,0,0.5) !important;
  animation: ready-bar-glow 1.5s infinite !important;
}

@keyframes ready-bar-glow {
  0%, 100% { 
    transform: rotate(calc(-1 * var(--table-rotation, 0deg))) scale(1);
    border-color: #27ae60;
  }
  50% { 
    transform: rotate(calc(-1 * var(--table-rotation, 0deg))) scale(1.1);
    border-color: #ffffff;
    box-shadow: 0 0 20px rgba(52, 199, 89, 0.8), 0 4px 12px rgba(0,0,0,0.5);
  }
}

.pulsing {
  animation: glow 1.5s infinite;
}

/* ============================================
   Notification Dropdown
   ============================================ */
.notification-dropdown {
  position: fixed;
  width: 320px;
  max-height: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleIn 0.2s ease;
}

.notification-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.notification-header span {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.notification-list {
  max-height: 340px;
  overflow-y: auto;
  flex: 1;
}

/* Inner body wrapper used by sidebar.js dropdown */
.notif-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.notif-body .notification-list {
  max-height: 340px;
  overflow-y: auto;
  flex: 1;
}

.notification-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.2s;
}
.custom-cursor .notification-item {
  cursor: url('../assets/mousedark/hand.cur'), pointer;
}

.notification-item:hover {
  background: var(--bg-tertiary);
}

.notification-item.unread {
  background: var(--primary-light);
}

.notification-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-body {
  flex: 1;
}

.notification-msg {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 2px;
}

.notification-time {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.notification-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.btn-load-more {
  display: block;
  width: calc(100% - 32px);
  margin: 10px auto;
  padding: 8px 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s, color 0.2s;
}

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

/* User Role Badges */
.user-info-mini {
  padding: 10px;
  display: flex;
  justify-content: center;
  margin-bottom: 5px;
}

.role-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

.role-badge.admin {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.role-badge.mesero {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.role-badge.cocina {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-link:hover {
  text-decoration: underline;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  border-radius: inherit;
  animation: fadeInLoading 0.2s ease-out;
}

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

.loading-text {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
}

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

@keyframes fadeInLoading {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   Ticket Printing Styles
   ============================================ */
@media print {
  body > *:not(#print-area) {
    display: none !important;
  }
  
  #print-area {
    display: block !important;
    position: static; /* Let it flow normally to avoid extra blank space */
    width: 58mm;
    margin: 0 auto;
    padding: 0;
    color: black !important;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  }
}

#print-area {
  display: none;
}

.ticket-header {
  text-align: center;
  margin-bottom: 5mm;
  border-bottom: 1px dashed #000;
  padding-bottom: 2mm;
}

.ticket-title {
  font-size: 16pt;
  font-weight: bold;
  margin-bottom: 2mm;
}

.ticket-info {
  margin-bottom: 5mm;
  font-size: 10pt;
}

.ticket-items {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 5mm;
}

.ticket-items th {
  text-align: left;
  border-bottom: 1px solid #000;
  padding: 1mm 0;
}

.ticket-items td {
  padding: 1mm 0;
  vertical-align: top;
}

.ticket-item-name {
  width: 60%;
}

.ticket-item-qty {
  width: 15%;
  text-align: center;
}

.ticket-item-total {
  width: 25%;
  text-align: right;
}

.ticket-totals {
  border-top: 1px solid #000;
  padding-top: 2mm;
}

.ticket-total-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1mm;
}

.ticket-total-row.grand-total {
  font-weight: bold;
  font-size: 14pt;
  margin-top: 2mm;
  border-top: 1px dashed #000;
  padding-top: 2mm;
}

.ticket-footer {
  text-align: center;
  margin-top: 10mm;
  font-size: 10pt;
  border-top: 1px dashed #000;
  padding-top: 5mm;
}

.qr-placeholder {
  margin: 5mm auto;
  width: 30mm;
  height: 30mm;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8pt;
}

/* ============================================
   Unified Order Design (Waiter Panel)
   ============================================ */
.order-item-unified {
  transition: background var(--transition-fast);
}

.order-item-unified:hover {
  background: rgba(255, 255, 255, 0.02);
}

.item-note-input-mini {
  width: 100%;
  background: rgba(49, 66, 84, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  outline: none;
  transition: all 0.2s;
}

.item-note-input-mini:focus {
  background: #fff;
  border-color: var(--primary);
  color: var(--text-primary);
}

.order-item-qty-mini {
  display: flex;
  align-items: center;
  gap: 1px;
  background: var(--bg-tertiary);
  padding: 1px 2px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.qty-btn-mini {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.1s;
}

.qty-btn-mini:active {
  transform: scale(0.9);
  background: var(--bg-card-hover);
}

.qty-val-mini {
  font-size: 0.7rem;
  font-weight: 800;
  min-width: 12px;
  text-align: center;
  color: var(--text-primary);
  padding: 0 2px;
}

.remove-btn-mini {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  opacity: 0.8;
  transition: opacity 0.2s, transform 0.1s;
}

.remove-btn-mini:hover {
  opacity: 1;
}

.remove-btn-mini:active {
  transform: scale(0.9);
}

/* Badge specific shadows for extra depth */
.badge[style*="background"] {
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Divider for panel sessions */
.divider-session {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border-color), transparent);
  margin: 20px 0;
}

.sidebar-brand-footer {
  margin-top: 10px;
  font-size: 0.6rem;
  opacity: 0.6;
  text-align: center;
  color: var(--text-tertiary);
  width: 100%;
  padding: 0 4px;
  line-height: 1.2;
}

.sidebar-brand-footer a {
  display: block;
  font-weight: 700;
  color: #314254;
  margin-top: 2px;
}
/* iOS Style Switch */
.ios-switch {
  position: relative; display: inline-block; width: 44px; height: 24px;
}
.ios-switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; cursor: pointer; inset: 0; background-color: #E9E9EB;
  transition: .3s; border-radius: 24px;
}
.switch-slider:before {
  position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background-color: white; transition: .3s; border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
input:checked + .switch-slider { background-color: #34C759; }
input:checked + .switch-slider:before { transform: translateX(20px); }/* Custom Dropdown for Categories */
.custom-dropdown-container {
  position: relative;
  width: 100%;
}

.custom-dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  z-index: 2000;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 5px;
  display: none;
}

.custom-dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: background 0.2s;
}

.custom-dropdown-item:hover {
  background: var(--bg-tertiary);
}

.custom-dropdown-item:active {
  background: var(--primary-light);
}

/* ============================================
   Premium Selection UI (Payments, Options)
   Sintonizado con el diseño de Mesas
   ============================================ */
.payment-methods-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.currency-btn-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.selectable-item {
  position: relative;
  display: flex !important;
}

.selectable-item input {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  cursor: pointer !important;
  z-index: 10 !important;
  margin: 0 !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

.selection-card {
  flex: 1;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 6px !important;
  border-radius: 14px !important;
  background: #000000 !important;
  border: 2px solid transparent !important;
  color: #ffffff !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  min-height: 65px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.selectable-item input:checked + .selection-card {
  background: #000000 !important;
  border-color: #34C759 !important;
  border-width: 3px !important;
  box-shadow: 0 4px 15px rgba(52, 199, 89, 0.3);
  transform: translateY(-1px);
}

.selectable-item input:checked + .selection-card i {
  color: #34C759 !important;
  transform: scale(1.1);
  opacity: 1 !important;
}

.selectable-item input:checked + .selection-card span {
  color: #ffffff !important;
  font-weight: 800 !important;
}

.selection-card i {
  color: #ffffff !important;
  opacity: 0.8;
  transition: all 0.2s;
}

.selection-card span {
  font-size: 0.75rem;
  font-weight: 600;
  color: #ffffff !important;
  opacity: 0.9;
}

.compact-form-group {
  margin-bottom: 16px;
}

.bank-account-selection {
  margin-top: 8px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(49, 66, 84, 0.05);
  border: 1px solid rgba(49, 66, 84, 0.1);
  animation: slideDown 0.2s ease-out;
}

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

.hidden { display: none !important; }

/* Letter spacing utilities */
.letter-spacing-1 { letter-spacing: 0.5px; }

/* ============================================
   User Profile & Sidebar Logo Styles
   ============================================ */
.sidebar-logo {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.sidebar-logo:hover {
  transform: scale(1.05);
}

.sidebar-logo:active {
  transform: scale(0.95);
}

.profile-overlay-hint {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: 12px;
  pointer-events: none;
}

.sidebar-logo:hover .profile-overlay-hint {
  opacity: 1;
}

.app-icon-img {
  transition: filter 0.3s ease;
}

.sidebar-logo:hover .app-icon-img {
  filter: brightness(0.8);
}

/* User Profile Modal Custom Styles */
.user-profile-modal .form-group label {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.user-profile-modal input {
  border-radius: 14px;
}

.password-section {
  background: var(--bg-tertiary);
  padding: 20px;
  border-radius: 18px;
  border: 1px solid var(--border-light);
}

.password-section input {
  background: var(--bg-secondary);
}

.profile-pic-editor {
  position: relative;
  box-shadow: var(--shadow-lg);
  border-radius: 28px;
  background: var(--bg-secondary);
}

.modal-header { border-top-left-radius: 28px; border-top-right-radius: 28px; }
.modal-footer { border-bottom-left-radius: 28px; border-bottom-right-radius: 28px; }


/* --- CUSTOM PREMIUM SELECTS --- */
.custom-select-wrapper { position: relative; user-select: none; width: 100%; }
.custom-select-wrapper .selected-display { width: 100%; height: 52px; background: white; color: #1d1d1f; border: 1px solid #d2d2d7; padding: 0 44px 0 16px; border-radius: 16px; font-size: 0.95rem; cursor: pointer; display: flex; align-items: center; font-weight: 500; transition: all 0.2s ease; box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
.custom-select-wrapper .options-list { display: none; position: absolute; top: calc(100% + 8px); left: 0; width: 100%; background: rgba(255, 255, 255, 0.95); border: 1px solid #d2d2d7; border-radius: 18px; overflow: hidden; z-index: 2000; box-shadow: 0 12px 40px rgba(0,0,0,0.12); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); max-height: 250px; overflow-y: auto; }
.custom-select-wrapper .custom-option-item { padding: 14px 16px; font-size: 0.95rem; color: #1d1d1f; font-weight: 500; border-bottom: 1px solid rgba(0,0,0,0.05); cursor: pointer; transition: background 0.2s; }
.custom-select-wrapper .custom-option-item:hover { background: rgba(0, 0, 0, 0.04) !important; }
.custom-select-wrapper .custom-option-item:active { background: rgba(0, 0, 0, 0.08) !important; }
@keyframes slideInSelect { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }


/* ============================================
   RESPONSIVE DESIGN (Tablets & Mobile)
   ============================================ */

/* Tablet Optimization (768px to 1024px) */
@media (max-width: 1024px) {
  .topbar {
    padding: 12px 20px;
    gap: 15px;
  }
}

/* Room Selector Global Style */
.room-selector {
  background-color: #2f2f31;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
  position: relative;
}

.room-selector:hover {
  background-color: #3f3f41;
}

#room-current-label {
  white-space: nowrap;
}

/* Mobile Utilities */
.show-mobile-only { display: none !important; }
.mobile-actions-menu { position: relative; }
.mobile-dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: #ffffff;
  min-width: 200px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  border: 1px solid rgba(0,0,0,0.1);
  z-index: 2000;
  overflow: hidden;
  animation: slideInSelect 0.2s ease-out;
}
.mobile-dropdown-content.show { display: block; }
.mobile-dropdown-content .dropdown-item {
  width: 100%;
  padding: 16px 20px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1d1d1f;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.mobile-dropdown-content .dropdown-item:last-child { border-bottom: none; }
.mobile-dropdown-content .dropdown-item:active { background: #f5f5f7; }
.mobile-dropdown-content .dropdown-item i { width: 18px; height: 18px; color: #007aff; }

/* Tablet & Mobile Optimization (< 1024px) */
@media (max-width: 1024px) {
  .show-mobile-only { display: flex !important; }
  .hide-mobile { display: none !important; }
  .app-layout {
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available;
  }

  /* Sidebar transforms into a compact lateral menu (PC style) */
  .sidebar {
    width: 85px !important;
    height: 100vh !important;
    height: 100dvh !important;
    position: fixed !important;
    top: 0 !important;
    left: -85px !important; /* Hidden off-canvas */
    flex-direction: column !important;
    padding: 20px 0 !important;
    background: #ffffff !important;
    z-index: 5000 !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1) !important;
    border-radius: 0 24px 24px 0 !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    visibility: visible !important;
  }

  .sidebar.active {
    left: 0 !important;
  }

  .sidebar-overlay {
    background: rgba(0,0,0,0.3) !important;
    backdrop-filter: blur(2px) !important;
    -webkit-backdrop-filter: blur(2px) !important;
  }

  .sidebar-header {
    flex-direction: column !important;
    margin-bottom: 25px !important;
    padding: 0 !important;
    height: auto !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    gap: 15px !important;
  }

  .sidebar-logo-container {
    flex-direction: column !important;
    gap: 0 !important;
    justify-content: center !important;
    display: flex !important;
    align-items: center !important;
    flex: initial !important;
  }

  .sidebar-logo {
     width: 46px !important;
     height: 46px !important;
     border-radius: 14px !important;
     margin: 0 !important;
  }

  .profile-role-label {
    display: none !important; /* No text, like PC */
  }

  .sidebar-nav {
    flex-direction: column !important;
    justify-content: flex-start !important;
    width: 100% !important;
    gap: 10px !important;
    padding-top: 15px !important;
    border-top: 1px solid rgba(0,0,0,0.05) !important;
    flex: 1 !important;
    height: auto !important;
    align-items: center !important;
    display: flex !important;
  }

  .nav-item {
    width: 48px !important;
    height: 48px !important;
    justify-content: center !important;
    padding: 0 !important;
    gap: 0 !important;
    background: transparent !important;
    border-radius: 15px !important;
    display: flex !important;
    align-items: center !important;
    transition: all 0.2s ease !important;
  }

  .nav-item.active {
    background: #2f2f31 !important;
    color: #ffffff !important;
  }

  .nav-item.active i, .nav-item.active svg {
    color: #ffffff !important;
  }

  .nav-item i, .nav-item svg {
    width: 24px !important;
    height: 24px !important;
    stroke-width: 1.5px !important;
  }

  .nav-tooltip {
    display: none !important; /* No text, like PC */
  }

  .sidebar-footer {
    display: flex !important;
    flex-direction: column !important;
    padding-top: 15px !important;
    gap: 15px !important;
    width: 100% !important;
    align-items: center !important;
  }

  .sidebar-alert-btn {
    background: linear-gradient(135deg, #e32636, #9b1c2e) !important;
    border-radius: 14px !important;
    width: 48px !important;
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    color: white !important;
    position: relative !important;
    box-shadow: 0 4px 15px rgba(227, 38, 54, 0.4) !important;
    padding: 0 !important;
  }

  .sidebar-alert-btn i, .sidebar-alert-btn svg {
    width: 22px !important;
    height: 22px !important;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)) !important;
  }

  .nav-badge {
    background: #ef4444 !important;
    color: white !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.4) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    width: 18px !important;
    height: 18px !important;
    position: absolute !important;
    top: -5px !important;
    right: -5px !important;
    border-radius: 50% !important;
  }

  .sidebar-submenu {
    position: fixed !important;
    /* top is set by JS dynamically to align with the clicked button */
    left: -220px !important; /* Start hidden */
    width: 220px !important;
    height: auto !important;
    max-height: 85vh !important;
    background: #ffffff !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
    box-shadow: 15px 0 40px rgba(0, 0, 0, 0.12) !important;
    padding: 15px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 5002 !important;
    opacity: 0;
    pointer-events: none;
    border-radius: 0 24px 24px 24px !important;
    overflow-y: auto !important;
  }

  .sidebar-submenu.mobile-visible {
    left: 85px !important; /* Flyout to the right */
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .submenu-item {
    padding: 12px 18px !important;
    border-radius: 14px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    color: var(--macos-text) !important;
    background: transparent !important;
    display: block !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
  }

  .submenu-item.active {
    background: rgba(0, 122, 255, 0.08) !important;
    color: #007AFF !important;
  }

  .btn-close-sidebar {
    display: none !important; /* Handled by swipe and overlay now */
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.4);
    z-index: 4999;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    flex: 1 !important;
    height: calc(100vh - 50px) !important;
    margin-bottom: 0 !important;
    display: flex;
    flex-direction: column;
    width: 100vw !important;
    overflow-x: hidden !important;
  }

  .topbar {
    padding: 14px 12px 4px 12px !important;
    padding-top: calc(14px + env(safe-area-inset-top)) !important;
    display: grid !important;
    grid-template-areas: 
      "left menu"
      "stats stats" !important;
    grid-template-columns: 1fr auto !important;
    gap: 4px !important;
    background: var(--bg-primary) !important;
  }

  .topbar-left {
    grid-area: left !important;
    width: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .topbar-actions-mobile {
    grid-area: menu !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .topbar-title {
    font-size: 0.9rem !important;
    white-space: nowrap !important;
    font-weight: 700 !important;
  }

  .room-selector {
    padding: 4px 8px !important;
    font-size: 0.75rem !important;
    border-radius: 8px !important;
  }

  /* Stats bar behavior on mobile - Extra Compact */
  .stats-bar {
    grid-area: stats !important;
    width: auto !important;
    padding: 6px 4px !important;
    margin: 4px 8px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 4px !important;
    background: #000000 !important;
    border-radius: 12px !important;
  }

  .stat-chip {
    padding: 4px 8px !important;
    font-size: 0.6rem !important;
    border-radius: 8px !important;
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.03) !important;
    flex: 0 1 calc(33% - 4px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    color: var(--text-secondary) !important;
    min-width: 85px !important;
  }

  /* Modals on mobile */
  .modal {
    width: 95% !important;
    margin: 10px auto !important;
    max-height: 85vh !important;
    border-radius: 24px !important;
  }
  
  .modal-content {
    padding: 16px !important;
  }
  
  .modal-header {
    padding: 16px 20px !important;
  }
  
  .modal-footer {
    padding: 16px !important;
    flex-direction: column !important;
    gap: 10px !important;
  }
  
  .modal-footer .btn {
    width: 100% !important;
    height: 48px !important;
    margin: 0 !important;
  }
}

/* ============================================
   TABLET & LANDSCAPE OPTIMIZATION
   ============================================ */

/* Small & Medium Tablets (768px to 1280px) */
@media (min-width: 768px) and (max-width: 1280px) {
  :root {
    --sidebar-width: 70px;
    --order-panel-width: 380px;
  }
  
  .sidebar {
    width: var(--sidebar-width);
    padding: 12px 0;
  }
  
  .sidebar-logo-container {
    padding: 10px;
  }
  
  .sidebar .nav-item {
    margin: 8px auto;
    width: 48px;
    height: 48px;
  }
  
  .nav-tooltip {
    display: none !important; /* Tooltips might get in the way on touch tablets */
  }

  .main-content {
    margin-left: 0; /* Let flexbox handle it or adjust as needed */
  }
}

/* Landscape Mode for Tablets & Large Mobiles */
@media (max-width: 1280px) and (orientation: landscape) {
  .app-layout {
    flex-direction: row !important;
    height: 100vh;
    overflow: hidden;
  }

  .main-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
  }

  /* Compact topbar for more vertical space */
  .topbar {
    padding: 6px 16px !important;
    height: auto !important;
    min-height: 50px;
  }

  .topbar-title-section h1 {
    font-size: 1.1rem !important;
  }

  /* Ensure modals don't overflow on short landscape screens */
  .modal {
    max-height: 95vh !important;
    margin: 2vh auto !important;
  }
  
  .modal-body {
    padding: 12px 20px !important;
  }
}

/* Specific fix for sidebar toggle visibility */
@media (max-width: 1024px) {
  #btn-sidebar-toggle {
    display: flex !important;
  }
}

/* PC Mode Cleanup: Hide mobile-only elements */
@media (min-width: 1025px) {
  #btn-sidebar-toggle,
  .profile-role-label,
  .btn-close-sidebar {
    display: none !important;
  }
}

/* Fix: Notification Dropdown Z-index and Mobile Positioning */
.notification-dropdown {
  z-index: 6000 !important; /* Above everything (sidebar 5000, overlay 4999) */
}

@media (max-width: 768px) {
  .notification-dropdown {
    width: calc(100vw - 110px) !important; /* Account for sidebar width + spacing */
    max-width: 320px !important;
    /* left and top are set by JS relative to bell icon */
    transform: none !important;
    max-height: 80vh !important;
    position: fixed !important;
    border-radius: 0 20px 20px 20px !important;
  }
}
/* --- SISTEMA DE COMPRA MULTI-PROVEEDOR --- */
.purchase-action-bar {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  width: 90%;
  max-width: 800px;
  height: 75px;
  border-radius: 20px;
  z-index: 2000;
  padding: 0 25px;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
}

.purchase-action-bar.active {
  transform: translateX(-50%) translateY(0);
}

.purchase-bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.purchase-bar-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.purchase-count-badge {
  background: #000;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
}

.purchase-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Modal Batch Review */
.batch-supplier-block {
  background: var(--bg-secondary);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.batch-supplier-header {
  padding: 12px 20px;
  background: rgba(0,0,0,0.03);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.batch-items-list {
  display: flex;
  flex-direction: column;
}

.batch-item-row {
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0,0,0,0.03);
  gap: 15px;
}

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

.batch-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.batch-item-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.batch-item-details {
  display: flex;
  gap: 15px;
  font-size: 0.75rem;
  opacity: 0.7;
}

.batch-item-subtotal {
  font-weight: 600;
  color: var(--text-primary);
  opacity: 1;
}

.batch-item-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.batch-qty-wrapper {
  width: 80px;
}

.batch-qty-input {
  width: 100%;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0 5px;
}

.batch-qty-input:focus {
  border-color: var(--accent-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.1);
}

.btn-remove-mini {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff3b30;
  background: rgba(255, 59, 48, 0.05);
  border: 1px solid rgba(255, 59, 48, 0.1);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-remove-mini:hover {
  background: rgba(255, 59, 48, 0.15);
  transform: scale(1.05);
}

.btn-remove-mini svg {
  width: 16px;
  height: 16px;
}

/* Mini Chart - Cost Analysis */
.mini-chart {
  display: flex;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: visible;
  margin-top: 10px;
  width: 100%;
  position: relative;
}

.chart-segment {
  height: 100%;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.chart-segment:first-child {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.chart-segment:last-child {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.chart-segment:hover {
  filter: brightness(1.2);
  transform: translateY(-2px);
}

.chart-segment::after {
  content: attr(data-label);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  pointer-events: none;
  margin-bottom: 8px;
  z-index: 100;
}

.chart-segment:hover::after {
  opacity: 1;
  visibility: visible;
}

.chart-legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-primary);
  opacity: 0.8;
}

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

/* Cost Analysis Option Cards */
.option-card {
  padding: 6px 10px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  min-width: 110px;
  justify-content: center;
}

.option-card:hover {
  border-color: rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.option-card.preferred {
  border-color: rgba(52, 199, 89, 0.5);
  background: rgba(52, 199, 89, 0.1) !important;
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.1);
}

.option-price {
  font-weight: 800;
  font-size: 0.85rem;
}

.option-supplier {
  font-size: 0.7rem;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-sparkline {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  border: none;
  border-radius: 6px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  margin-left: 2px;
}

.btn-sparkline:hover {
  background: #6366f1;
  color: white;
  transform: scale(1.1);
}

.history-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.1);
  border-radius: 10px;
}
