/* ============================================================
   El Chiringuito de Jugones Sport Bar - Design System
   Paleta: Fondo crema/blanco, rojo coral, dorado, tipografía oscura
   ============================================================ */

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

/* --- Variables --- */
:root {
  --primary:        #0d9488; /* Verde Turquesa Suave */
  --primary-dark:   #0f766e;
  --primary-light:  #ccfbf1;
  --gold:           #d4a017;
  --gold-light:     #f1c40f;
  --bg:             #f8fafc;
  --bg-card:        #ffffff;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --border:         #e2e8f0;
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;
  --shadow-xs:      0 1px 3px rgba(0,0,0,0.06);
  --shadow-sm:      0 2px 8px rgba(0,0,0,0.07);
  --shadow-md:      0 6px 20px rgba(0,0,0,0.10);
  --shadow-lg:      0 12px 36px rgba(0,0,0,0.14);
  --radius:         12px;
  --radius-sm:      8px;
  --font:           'Poppins', sans-serif;
  --sidebar-w:      0px; /* Sin sidebar lateral */
  --transition:     .22s cubic-bezier(0.16, 1, 0.3, 1);

  /* Horizontal Header System */
  --h-top-bg:       #0f172a; /* Deep Slate Luxury */
  --h-nav-bg:       #1e293b; /* Sleek Navy Navigation */
  --h-nav-text:     #cbd5e1;
  --h-nav-hover:    rgba(255, 255, 255, 0.09);
  --h-border:       rgba(255, 255, 255, 0.08);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 14.5px;
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100vw;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
}

/* ============================================================
   LAYOUT - Horizontal Master Header & Full Width Main
   ============================================================ */
.app-wrapper,
.app-layout-horizontal {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* --- Master Horizontal Header --- */
.h-header-master {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.16);
  font-family: var(--font);
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--h-top-bg);
}

/* --- Fila 1: Top Bar (Marca, Badges & Usuario) --- */
.h-top-bar {
  background: var(--h-top-bg);
  border-bottom: 1px solid var(--h-border);
  padding: 0 18px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-sizing: border-box;
}

.h-brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 1;
}

.h-mobile-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-radius: 9px;
  width: 38px;
  height: 38px;
  min-width: 38px;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.h-mobile-btn:hover, .h-mobile-btn:active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  transform: scale(1.02);
}

.h-global-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  border-radius: 8px;
  height: 38px;
  padding: 0 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  -webkit-tap-highlight-color: transparent;
}
.h-global-back-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
  color: #ffffff;
  transform: translateX(-2px);
}
.h-global-back-btn:active {
  transform: scale(0.96);
}
@media (max-width: 576px) {
  .h-global-back-btn {
    padding: 0 8px;
    width: 38px;
  }
  .h-global-back-btn .back-text {
    display: none;
  }
}


.h-brand-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  user-select: none;
  min-width: 0;
}
.h-brand-logo {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  padding: 3px;
  flex-shrink: 0;
  transition: var(--transition);
}
.h-brand-identity:hover .h-brand-logo {
  border-color: var(--primary);
  transform: scale(1.04);
}
.h-brand-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.h-brand-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.h-brand-name {
  font-size: 0.98rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.h-brand-sub {
  font-size: 0.68rem;
  font-weight: 500;
  color: #5eead4; /* Soft Turquoise */
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Herramientas & Badges en Top Bar --- */
.h-tools-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.h-badge-icon {
  font-size: 0.95rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.h-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  background: rgba(100, 116, 139, 0.15);
  border: 1px solid rgba(100, 116, 139, 0.3);
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  white-space: nowrap;
}
.h-badge-btn:hover {
  background: rgba(100, 116, 139, 0.25);
  color: #f1f5f9;
}
.h-badge-btn.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.h-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  user-select: none;
  white-space: nowrap;
}
.h-badge-status.status-open {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}
.h-badge-status.status-closed {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
}
.status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-open .status-indicator {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseOpen 2s infinite ease-in-out;
}
.status-closed .status-indicator {
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}
@keyframes pulseOpen {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.h-badge-rate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(13, 148, 136, 0.15);
  border: 1px solid rgba(45, 212, 191, 0.35);
  color: #2dd4bf;
  white-space: nowrap;
}
.h-badge-rate .rate-val {
  font-weight: 700;
  color: #5eead4;
}
.h-badge-rate .rate-date {
  color: rgba(94, 234, 212, 0.7);
  font-size: 0.72rem;
  margin-left: 2px;
}

.h-time-badge {
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 500;
  color: #94a3b8;
  padding: 4px 8px;
}

.h-lock-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.h-lock-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

/* --- Perfil de Usuario con Menú Desplegable --- */
.h-user-dropdown {
  position: relative;
}
.h-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px 2px 3px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.h-user-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}
.h-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}
.h-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}
.h-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.h-user-role {
  font-size: 0.68rem;
  color: #94a3b8;
}
.h-chevron-icon {
  color: #94a3b8;
  transition: transform 0.2s ease;
}
.h-user-dropdown.open .h-chevron-icon {
  transform: rotate(180deg);
}

.h-user-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  max-width: calc(100vw - 20px);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 1150;
  overflow: hidden;
  animation: fadeInDown 0.18s ease-out;
}
.h-user-dropdown.open .h-user-menu {
  display: block;
}
.h-user-menu-header {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.user-name-full {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
}
.user-badge-role {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 2px;
}
.h-user-menu-items {
  padding: 6px;
}
.h-user-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: #334155;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 8px;
  transition: var(--transition);
}
.h-user-link:hover {
  background: #f1f5f9;
  color: var(--primary-dark);
}
.h-user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}
.link-logout {
  color: #ef4444 !important;
}
.link-logout:hover {
  background: #fef2f2 !important;
  color: #dc2626 !important;
}

/* ============================================================
   Fila 2: Barra de Navegación Horizontal y Menús Desplegables
   ============================================================ */
.h-nav-bar {
  background: var(--h-nav-bg);
  border-bottom: 1px solid var(--h-border);
  padding: 0 16px;
}
.h-nav-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}
.h-nav-list {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 4px;
  margin: 0;
  padding: 4px 0;
  flex-wrap: nowrap;
  overflow-x: visible;
}

.h-nav-item {
  position: relative;
}

.h-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--h-nav-text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: var(--transition);
  user-select: none;
}
.h-nav-link:hover {
  background: var(--h-nav-hover);
  color: #ffffff;
}

/* Estado Activo en la barra superior */
.h-nav-item.active > .h-nav-link,
.h-nav-link.active {
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(13, 148, 136, 0.4);
}
.h-nav-item.active > .h-nav-link .dropdown-arrow,
.h-nav-link.active .dropdown-arrow {
  color: #ffffff;
}

.h-nav-link .nav-icon {
  font-size: 1rem;
  line-height: 1;
}
.dropdown-arrow {
  margin-left: 2px;
  color: #94a3b8;
  transition: transform 0.2s ease;
}
.h-nav-item.open > .h-nav-link .dropdown-arrow {
  transform: rotate(180deg);
}

/* --- Menús Desplegables (Dropdowns & Mega-menús) --- */
.h-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  z-index: 1050;
  animation: dropdownSlideIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownSlideIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hover & Click support */
.h-nav-item.open > .h-dropdown-menu {
  display: block;
}
@media (min-width: 1025px) {
  .h-nav-item:hover > .h-dropdown-menu {
    display: block;
  }
  .h-nav-item:hover > .h-nav-link .dropdown-arrow {
    transform: rotate(180deg);
  }
}

/* Single Column Dropdown */
.h-dropdown-menu.single-column {
  min-width: 270px;
  padding: 8px;
}
.h-dropdown-header {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 6px 12px 6px 12px;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 6px;
}

/* Mega Menu Grid (Multi-column) */
.h-dropdown-menu.mega-menu-grid {
  display: none;
  grid-template-columns: repeat(3, 260px);
  gap: 12px;
  padding: 14px;
  min-width: 810px;
  left: 0;
}
.h-nav-item:last-child .h-dropdown-menu.mega-menu-grid,
.h-nav-item:nth-last-child(2) .h-dropdown-menu.mega-menu-grid {
  left: auto;
  right: 0;
}

.h-nav-item.open > .h-dropdown-menu.mega-menu-grid {
  display: grid;
}
@media (min-width: 1025px) {
  .h-nav-item:hover > .h-dropdown-menu.mega-menu-grid {
    display: grid;
  }
}

.mega-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f8fafc;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
}
.mega-col-title {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #0f766e;
  padding: 4px 8px 8px 8px;
  letter-spacing: 0.06em;
  border-bottom: 2px solid #ccfbf1;
  margin-bottom: 6px;
}

/* Links dentro del menú desplegable */
.h-dropdown-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: #334155;
  transition: all 0.15s ease;
}
.h-dropdown-link:hover {
  background: #ffffff;
  color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transform: translateX(3px);
}
.h-dropdown-link.active {
  background: #f0fdfa;
  color: #0f766e;
  font-weight: 700;
  border-left: 3px solid #0d9488;
}
.h-dropdown-link .item-icon {
  font-size: 1.1rem;
  min-width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.h-dropdown-link .item-details {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.h-dropdown-link .item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: inherit;
}
.h-dropdown-link .item-desc {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 400;
}
.dropdown-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 6px 0;
}

/* ============================================================
   DRAWER MÓVIL (Off-Canvas para teléfonos y tablets)
   ============================================================ */
.mobile-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 9990;
  transition: opacity 0.25s ease;
}
.mobile-drawer-overlay.show {
  display: block !important;
  opacity: 1 !important;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  max-width: 86vw;
  background: #0b1329;
  color: #ffffff;
  z-index: 9995;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-nav-drawer.open {
  transform: translateX(0) !important;
}

.m-drawer-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #070c1a;
  padding-top: max(16px, env(safe-area-inset-top));
}
.m-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.m-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
}
.m-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.m-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: #ffffff;
  letter-spacing: 0.02em;
}
.m-sub {
  font-size: 0.68rem;
  color: #5eead4;
}
.m-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #94a3b8;
  font-size: 1.4rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.m-close-btn:hover, .m-close-btn:active {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.m-user-box {
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.m-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}
.m-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.m-user-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
}
.m-user-role {
  font-size: 0.72rem;
  color: #5eead4;
  text-transform: capitalize;
}

/* Quick Stats Bar inside Mobile Drawer */
.m-quick-stats {
  display: flex;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.m-stat-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  white-space: nowrap;
}
.m-stat-open {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}
.m-stat-closed {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}
.m-stat-bcv {
  background: rgba(13, 148, 136, 0.15);
  border-color: rgba(45, 212, 191, 0.35);
  color: #5eead4;
}
.m-stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.m-drawer-nav {
  padding: 12px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.m-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  min-height: 42px;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
  box-sizing: border-box;
}
.m-nav-item:hover, .m-nav-item.active {
  background: var(--primary);
  color: #ffffff;
}
.m-icon {
  font-size: 1.1rem;
  min-width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Acordeón Móvil */
.m-accordion-group {
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}
.m-accordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  min-height: 42px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}
.m-accordion-toggle:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}
.m-accordion-group.open .m-accordion-toggle {
  background: rgba(255, 255, 255, 0.08);
  color: #5eead4;
}
.m-acc-arrow {
  margin-left: auto;
  transition: transform 0.2s ease;
  color: #64748b;
}
.m-accordion-group.open .m-acc-arrow {
  transform: rotate(180deg);
  color: #5eead4;
}

.m-accordion-content {
  display: none;
  padding: 4px 8px 8px 8px;
  flex-direction: column;
  gap: 2px;
  background: rgba(0, 0, 0, 0.2);
}
.m-accordion-group.open .m-accordion-content {
  display: flex;
}

.m-section-subhead {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #0f766e;
  padding: 8px 10px 3px 10px;
  letter-spacing: 0.06em;
}
.m-sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  min-height: 38px;
  border-radius: 6px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  transition: var(--transition);
  box-sizing: border-box;
}
.m-sub-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}
.m-sub-item.active {
  background: rgba(13, 148, 136, 0.2);
  color: #5eead4;
  font-weight: 700;
  border-left: 3px solid #0d9488;
}

.m-drawer-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 10px;
  background: #070c1a;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.m-footer-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  min-height: 42px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}
.m-footer-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}
.m-logout-btn {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}
.m-logout-btn:hover {
  background: #ef4444;
  color: #ffffff;
}

/* ============================================================
   MAIN CONTENT & PAGE BODY - Ancho Completo
   ============================================================ */
.main-content {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 100px);
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

.page-body {
  padding: 20px 24px;
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* --- Page Body --- */
.page-body {
  padding: 16px;
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.page-header {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.page-title small {
  font-size: .8rem;
  font-weight: 400;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* ============================================================
   COMPONENTS
   ============================================================ */

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: visible;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; 
  align-items: center; 
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: linear-gradient(135deg,#fff 60%,#fdf6ee);
  border-top-left-radius: calc(var(--radius) - 1px);
  border-top-right-radius: calc(var(--radius) - 1px);
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px; }

/* --- Stats Cards --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform var(--transition), box-shadow var(--transition);
  min-width: 0;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon.red   { background: #fdecea; }
.stat-icon.gold  { background: #fef9e7; }
.stat-icon.green { background: #e9f7ef; }
.stat-icon.blue  { background: #eaf3fb; }
.stat-info {
  min-width: 0;
  flex: 1;
}
.stat-info .stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-info .stat-label {
  font-size: .76rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- BCV Widget Styles --- */
.bcv-widget-card {
  background: linear-gradient(135deg, #ffffff 60%, #fffbf0);
  border-left: 5px solid var(--gold);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.bcv-widget-body {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.bcv-widget-info-group {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 320px;
  min-width: 0;
}
.bcv-widget-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
  flex-shrink: 0;
}
.bcv-widget-details {
  flex: 1;
  min-width: 0;
}
.bcv-widget-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.bcv-widget-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.bcv-rates-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.bcv-rate-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 700;
}
.bcv-rate-pill .rate-label {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}
.bcv-widget-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
  line-height: 1;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(5, 150, 105, .35); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #b8880f; transform: translateY(-1px); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #1e8449; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--primary-dark); }
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 6px 13px; font-size: .8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; border-radius: 50%; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-header-back {
  background: #334155 !important;
  color: #ffffff !important;
  border: 2px solid #1e293b !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.25) !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  text-decoration: none !important;
  padding: 8px 16px !important;
  transition: all 0.2s ease !important;
}
.btn-header-back:hover {
  background: #1e293b !important;
  border-color: #0f172a !important;
  color: #ffffff !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
  transform: translateY(-1px);
}

.btn-nueva-ronda {
  background: #7c3aed !important;
  color: #ffffff !important;
  border: 2px solid #5b21b6 !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 5px rgba(124, 58, 237, 0.3) !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  text-decoration: none !important;
  padding: 8px 16px !important;
  transition: all 0.2s ease !important;
}
.btn-nueva-ronda:hover {
  background: #6d28d9 !important;
  border-color: #4c1d95 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 10px rgba(109, 40, 217, 0.4) !important;
  transform: translateY(-1px);
}

/* --- Tables --- */
.table-responsive { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.table thead tr {
  background: linear-gradient(135deg, #fdf6ee, #faf4f0);
}
table.table th {
  padding: 10px 12px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
table.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
table.table tbody tr:last-child td { border-bottom: none; }
table.table tbody tr:hover { background: #fdf9f5; }

/* --- Forms --- */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .875rem;
  color: var(--text);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(192,57,43,.12);
}
.form-control::placeholder { color: #aaa; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }

/* --- Badges --- */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger  { background: #f8d7da; color: #721c24; }
.badge-info    { background: #d1ecf1; color: #0c5460; }
.badge-muted   { background: #e2e3e5; color: #383d41; }
.badge-gold    { background: #fef9e7; color: #856404; }

/* --- Alerts --- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 10px;
  border-left: 4px solid;
}
.alert-success { background: #d4edda; color: #155724; border-color: var(--success); }
.alert-danger  { background: #f8d7da; color: #721c24; border-color: var(--danger); }
.alert-warning { background: #fff3cd; color: #856404; border-color: var(--warning); }
.alert-info    { background: #d1ecf1; color: #0c5460; border-color: var(--info); }

/* --- Mesas Grid --- */
.mesas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.mesa-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.mesa-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.mesa-card.libre  { border-color: var(--success); }
.mesa-card.ocupada { border-color: var(--warning); background: #fffef5; }
.mesa-card.por_cobrar { border-color: var(--primary); background: #f0fdfa; }
.mesa-number { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.mesa-name   { font-size: .78rem; font-weight: 600; color: var(--text-muted); }
.mesa-status {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
}
.mesa-card.libre .mesa-status       { background: #d4edda; color: #155724; }
.mesa-card.ocupada .mesa-status     { background: #fff3cd; color: #856404; }
.mesa-card.por_cobrar .mesa-status  { background: #f8d7da; color: #721c24; }
.mesa-icon { font-size: 2rem; }

/* --- Comanda Layout --- */
.comanda-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}

/* --- Comanda / Order items --- */
.order-items { list-style: none; }
.order-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.order-item:last-child { border-bottom: none; }
.order-item-name { flex: 1; font-weight: 600; font-size: .88rem; }
.order-item-qty {
  display: flex; align-items: center; gap: 14px;
  font-size: 1.1rem;
  font-weight: 700;
}
.qty-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  transition: all .15s;
  box-shadow: var(--shadow-sm);
}
.qty-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); transform: scale(1.05); }
.qty-btn:active { transform: scale(0.95); }
.order-item-price { font-weight: 700; color: var(--primary); min-width: 70px; text-align: right; }

/* --- Products Grid --- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.product-btn {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}
.product-btn:hover {
  border-color: var(--primary);
  background: #f0fdf4;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.product-btn .prod-name { font-size: 1rem; font-weight: 700; display: block; line-height: 1.2; }
.product-btn .prod-price { font-size: .9rem; color: var(--primary); font-weight: 700; margin-top: 6px; }
.product-btn .prod-cat   { font-size: .72rem; color: var(--text-muted); }
.prod-img-container {
  width: 100%;
  height: 140px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  background: #fdfaf5;
}
.prod-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}
.product-btn:hover .prod-img-container img {
  transform: scale(1.1);
}

/* --- Totals --- */
.totals-box { background: #fdf6ee; border-radius: var(--radius); padding: 18px; border: 1px solid #f0e6d0; }
.total-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: .9rem; }
.total-row.grand { font-size: 1.2rem; font-weight: 800; color: var(--primary); border-top: 2px solid var(--border); margin-top: 8px; padding-top: 10px; }

/* --- Tabs --- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 22px; }
.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover  { color: var(--text); }
.tab-pane { display: none; } .tab-pane.active { display: block; }

/* --- Modal --- */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 90%; max-width: 540px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  animation: fadeInScale .25s ease;
  overflow: hidden;
}
.modal form {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
@keyframes fadeInScale {
  from { opacity:0; transform:scale(.94); }
  to   { opacity:1; transform:scale(1); }
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg,#fff,#fdf6ee);
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 22px 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* --- Filters Bar --- */
.filters-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--border);
  margin-bottom: 22px;
}
.filters-bar .form-group { margin-bottom: 0; min-width: 160px; }

/* --- Empty State --- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 12px; }
.empty-state p { font-size: 1rem; }

/* --- Toasts --- */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #2c2c2c; color: #fff;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: slideInToast .3s ease;
  min-width: 260px; max-width: 380px;
  border-left: 4px solid var(--primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
@keyframes slideInToast { from { opacity:0; transform:translateX(40px); } to { opacity:1; transform:translateX(0); } }

/* --- Login Page --- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d1b00 50%, #1a1a2e 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content:'';
  position: absolute; inset:0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%; max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
  position: relative; z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-emoji { font-size: 3.2rem; display: block; margin-bottom: 8px; }
.login-logo h1 {
  font-size: 1.1rem; font-weight: 800; color: var(--primary);
  line-height: 1.3;
}
.login-logo p { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.login-card h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 22px; color: var(--text); }

/* --- Responsive Display Helpers & Utilities --- */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-grid { display: grid !important; }

.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-column { flex-direction: column !important; }
.flex-1 { flex: 1 1 0% !important; }

.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }

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

.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-gold { color: var(--gold) !important; }
.fw-bold { font-weight: 700 !important; }
.w-100 { width: 100% !important; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

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

/* Sidebar Close Button */
.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 10;
}
.sidebar-close-btn:hover, .sidebar-close-btn:active {
  background: rgba(255, 255, 255, 0.4);
}

/* Breakpoint: sm (min-width: 576px) */
@media (min-width: 576px) {
  .d-sm-none { display: none !important; }
  .d-sm-block { display: block !important; }
  .d-sm-inline { display: inline !important; }
  .d-sm-inline-block { display: inline-block !important; }
  .d-sm-flex { display: flex !important; }
  .d-sm-inline-flex { display: inline-flex !important; }
}

/* Breakpoint: md (min-width: 768px) */
@media (min-width: 768px) {
  .d-md-none { display: none !important; }
  .d-md-block { display: block !important; }
  .d-md-inline { display: inline !important; }
  .d-md-inline-block { display: inline-block !important; }
  .d-md-flex { display: flex !important; }
  .d-md-inline-flex { display: inline-flex !important; }
}

/* Breakpoint: lg (min-width: 1025px) */
@media (min-width: 1025px) {
  .d-lg-none { display: none !important; }
  .d-lg-block { display: block !important; }
  .d-lg-inline { display: inline !important; }
  .d-lg-inline-block { display: inline-block !important; }
  .d-lg-flex { display: flex !important; }
  .d-lg-inline-flex { display: inline-flex !important; }
}

/* Breakpoint: xl (min-width: 1200px) */
@media (min-width: 1200px) {
  .d-xl-none { display: none !important; }
  .d-xl-block { display: block !important; }
  .d-xl-inline { display: inline !important; }
  .d-xl-inline-block { display: inline-block !important; }
  .d-xl-flex { display: flex !important; }
}

/* --- Tabs / Zona Filters --- */
.tabs-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.tab-btn {
  padding: 8px 20px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 30px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.tab-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f0fdf4;
}
.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}

/* ============================================================
   RESPONSIVE LAYOUT RULES
   ============================================================ */

/* Mobile & Tablet (<= 1024px) */
@media (max-width: 1024px) {
  .h-nav-bar {
    display: none !important;
  }
  .h-mobile-btn {
    display: flex !important;
  }
  .h-top-bar {
    padding: 0 16px;
    height: 56px;
    gap: 10px;
  }
  #printServerToggleContainer {
    display: none !important;
  }
  .brand-sub-full {
    display: none;
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .page-body {
    padding: 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .comanda-layout {
    grid-template-columns: 1fr;
  }
  .comanda-layout > div:nth-child(2) {
    order: -1;
  }
  .mesas-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  
  /* Compact tables in tablets */
  table.table th, table.table td {
    padding: 8px 10px;
    font-size: 0.825rem;
  }
  
  /* Filters */
  .filters-bar {
    padding: 12px;
    gap: 8px;
  }
  .filters-bar form,
  form.filtro-comandas-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    width: 100% !important;
    align-items: flex-end !important;
  }
  .filters-bar .form-group, 
  .filters-bar form .form-group,
  form.filtro-comandas-grid .form-group {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    flex: 1 1 140px !important;
    min-width: 130px !important;
    margin-bottom: 0 !important;
  }
  .filters-bar form .form-control,
  form.filtro-comandas-grid .form-control {
    width: 100% !important;
  }
}

/* Tablets intermedias (<= 768px) */
@media (max-width: 768px) {
  .h-top-bar {
    padding: 0 12px;
    gap: 8px;
  }
  .h-brand-sub {
    display: none !important;
  }
  .h-brand-name {
    font-size: 0.92rem;
  }
  .h-lock-btn {
    display: none !important;
  }
}

/* Mobile Phones (<= 600px) - Encabezado Limpio y Espacioso */
@media (max-width: 600px) {
  .h-top-bar {
    padding: 0 10px;
    height: 52px;
    gap: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .h-brand-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
  }
  .h-mobile-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 8px;
    flex-shrink: 0;
  }
  .h-brand-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }
  .h-brand-logo {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 8px;
    padding: 2px;
    flex-shrink: 0;
  }
  .h-brand-titles {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }
  .h-brand-name {
    font-size: 0.88rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
  }
  .h-brand-sub {
    display: none !important;
  }

  /* Ocultar elementos sobrantes en la barra superior móvil para evitar saturación y montaderas */
  #printServerToggleContainer,
  .h-badge-status,
  .h-lock-btn,
  .h-time-badge,
  .rate-date {
    display: none !important;
  }

  .h-tools-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }
  .h-badge-rate {
    padding: 4px 9px;
    font-size: 0.76rem;
    border-radius: 20px;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .h-badge-rate .rate-val {
    font-size: 0.76rem;
    font-weight: 800;
  }
  .h-user-dropdown {
    position: relative;
    flex-shrink: 0;
  }
  .h-user-pill {
    padding: 0;
    border: none;
    background: transparent;
  }
  .h-user-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 0.82rem;
    border-width: 1.5px;
  }
  .h-user-meta, .h-chevron-icon {
    display: none !important;
  }
  .h-user-menu {
    width: 220px;
    max-width: calc(100vw - 16px);
    right: 0;
  }

  .page-body {
    padding: 12px;
  }
  .page-header {
    margin-bottom: 14px;
    gap: 10px;
  }
  .page-title {
    font-size: 1.25rem;
  }
  .btn-ver-mesas {
    width: 100%;
    justify-content: center;
    padding: 10px;
  }

  /* Stats Grid (Clean 2x2 on Mobile) */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 12px 10px;
    gap: 10px;
  }
  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
    border-radius: 8px;
  }
  .stat-info .stat-value {
    font-size: 1.2rem;
  }
  .stat-info .stat-label {
    font-size: 0.68rem;
  }

  /* BCV Widget */
  .bcv-widget-card {
    margin-bottom: 16px;
  }
  .bcv-widget-body {
    padding: 14px 12px;
    gap: 12px;
  }
  .bcv-widget-icon {
    font-size: 1.8rem;
  }
  .bcv-rates-row {
    gap: 6px;
  }
  .bcv-rate-pill {
    font-size: 0.84rem;
  }
  .bcv-rate-pill .badge {
    font-size: 0.84rem;
    padding: 3px 8px;
  }
  .bcv-widget-actions {
    width: 100%;
    display: flex;
    gap: 6px;
  }
  .bcv-widget-actions .btn {
    flex: 1 1 auto;
    text-align: center;
    padding: 7px 8px;
    font-size: 0.76rem;
    justify-content: center;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-header > button,
  .page-header > a.btn,
  .page-header > div > button,
  .page-header > div > a.btn {
    width: 100%;
    justify-content: center;
  }

  .card-header input[type="text"],
  .card-header input[type="search"] {
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .modal {
    width: 94% !important;
    max-width: 94% !important;
    margin: 10px auto !important;
  }
  .modal-header {
    padding: 14px 16px;
  }
  .modal-body {
    padding: 14px 16px;
  }
  .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  .modal-footer .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
  .login-card {
    padding: 28px 20px;
  }
}

/* Teléfonos compactos (<= 380px) */
@media (max-width: 380px) {
  .h-top-bar {
    padding: 0 8px;
    height: 50px;
    gap: 4px;
  }
  .h-brand-section {
    gap: 6px;
  }
  .h-brand-name {
    font-size: 0.82rem;
  }
  .h-tools-section {
    gap: 4px;
  }
  .h-badge-rate {
    padding: 3px 6px;
    font-size: 0.72rem;
  }
  .h-user-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.76rem;
  }
  .h-user-menu {
    width: 200px;
  }
}

/* Extra small mobile (<= 340px) */
@media (max-width: 340px) {
  .h-top-bar {
    padding: 0 4px;
    gap: 3px;
  }
  .h-brand-name {
    font-size: 0.74rem;
  }
  .h-brand-logo {
    width: 26px;
    height: 26px;
    min-width: 26px;
  }
  .h-mobile-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }
  .h-badge-rate .h-badge-icon {
    display: none;
  }
  .h-badge-rate {
    padding: 3px 5px;
    font-size: 0.7rem;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Desktop (> 1024px) */
@media (min-width: 1025px) {
  :root {
    --sidebar-w: 0px;
  }
  html {
    font-size: 14px;
  }
  .h-mobile-btn {
    display: none !important;
  }
  .h-nav-bar {
    display: block !important;
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
  }
  .page-body {
    padding: 20px 24px;
    max-width: 100%;
    width: 100%;
    margin: 0;
    min-width: 0;
  }
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Print Rules */
@media print {
  .app-wrapper, .app-layout-horizontal, .main-content { display: block !important; height: auto !important; min-height: auto !important; overflow: visible !important; }
  .h-header-master, .mobile-nav-drawer, .mobile-drawer-overlay, .no-print, .filters-bar { display: none !important; }
  .main-content { margin-left: 0 !important; width: 100% !important; }
  body, .page-body { background: #fff; padding: 0; margin: 0; overflow: visible !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc; break-inside: avoid; }
  .table th, .table td { border-bottom: 1px solid #ddd !important; }
  table { page-break-inside: auto; }
  tr { page-break-inside: avoid; page-break-after: auto; }
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }
}


