/* ─── Input fields y Selects con fondo oscuro ──────────────── */

.input-field {
  background: rgba(255,255,255,0.08) !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,0.12);
}

.input-field option {
  background: #1e1e2e;
  color: #fff;
}

select.input-field {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 32px;
}

/* ─── Enlaces para Compartir ──────────────── */

.enlaces-compartir {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.enlace-compartir-item {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  align-items: flex-start;
  transition: border-color 0.2s;
}

.enlace-compartir-item:hover {
  border-color: var(--primary-light);
}

.enlace-compartir-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.enlace-compartir-info {
  flex: 1;
  min-width: 0;
}

.enlace-compartir-info strong {
  display: block;
  font-size: 0.92rem;
  color: var(--secondary);
  margin-bottom: 2px;
}

.enlace-compartir-info small {
  display: block;
  font-size: 0.78rem;
  color: var(--text-light);
  margin-bottom: 8px;
}

.enlace-compartir-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.enlace-compartir-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: inherit;
  background: white;
  color: var(--text);
  cursor: default;
  outline: none;
}

.enlace-compartir-input:focus {
  border-color: var(--primary);
}

/* ─── Códigos QR para Compartir ──────────── */

.qr-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.qr-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.qr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.qr-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.qr-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.qr-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 4px;
}

.qr-card-subtitle {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-bottom: 12px;
}

.qr-code-container {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  min-height: 140px;
  align-items: center;
}

.qr-code-container canvas,
.qr-code-container img {
  border-radius: 8px;
  max-width: 140px;
  height: auto;
}

.qr-card-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.qr-card-actions .btn {
  font-size: 0.75rem;
  padding: 5px 10px;
}

.qr-loading {
  color: var(--text-light);
  font-size: 0.78rem;
  padding: 20px 0;
}

@media (max-width: 600px) {
  .qr-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── QR Estilo Carboncito (Rojo y Blanco) ── */

.qr-section-carboncito {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.qr-carboncito-container {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.3);
  position: relative;
  overflow: hidden;
}

.qr-carboncito-container::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 60%);
  pointer-events: none;
}

.qr-carboncito-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.qr-carboncito-icon {
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.qr-carboncito-title {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
  letter-spacing: 0.5px;
}

.qr-carboncito-brand {
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  letter-spacing: -0.5px;
}

.qr-carboncito-code {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  min-height: 180px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.qr-carboncito-code canvas,
.qr-carboncito-code img {
  border-radius: 12px;
  max-width: 180px;
  height: auto;
  background: #ffffff;
  padding: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.qr-carboncito-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.btn-carboncito {
  background: #ffffff;
  color: #dc2626;
  border: 2px solid #ffffff;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-carboncito:hover {
  background: #fef2f2;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-carboncito-outline {
  background: transparent;
  color: #ffffff;
  border: 2px solid rgba(255,255,255,0.6);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-carboncito-outline:hover {
  background: rgba(255,255,255,0.1);
  border-color: #ffffff;
  transform: translateY(-1px);
}

.qr-carboncito-footer {
  display: block;
  color: rgba(255,255,255,0.7);
  font-size: 0.72rem;
  margin-top: 12px;
  line-height: 1.4;
  position: relative;
  z-index: 1;
}

/* ─── Enlace Público / Chat IA ───────────── */

.enlace-publico-container {
  margin-top: 4px;
}

.enlace-publico-input-group {
  display: flex;
  align-items: center;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.enlace-publico-input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.08);
}

.enlace-publico-prefix {
  padding: 10px 0 10px 14px;
  font-size: 0.82rem;
  color: var(--text-light);
  background: var(--bg);
  white-space: nowrap;
  user-select: none;
  border-right: 1px solid var(--border);
}

.enlace-publico-input {
  flex: 1;
  padding: 10px 14px;
  border: none;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  background: white;
  min-width: 0;
}

.enlace-publico-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ============================================
   Estilos del Panel de Administración
   ============================================ */

:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --glass-bg: rgba(255,255,255,0.7);
  --glass-border: rgba(255,255,255,0.2);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.06);
}

.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────── */

.sidebar {
  width: var(--sidebar-collapsed-width);
  background: linear-gradient(180deg, var(--secondary) 0%, #1a1a2e 100%);
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:hover {
  width: var(--sidebar-width);
}

/* ─── Sidebar Colapsable: textos ocultos por defecto ──── */

.sidebar .sidebar-header h3,
.sidebar .nav-label,
.sidebar .sse-text,
.sidebar .logout-btn span:not(.nav-icon) {
  opacity: 0;
  visibility: hidden;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:hover .sidebar-header h3,
.sidebar:hover .nav-label,
.sidebar:hover .sse-text,
.sidebar:hover .logout-btn span:not(.nav-icon) {
  opacity: 1;
  visibility: visible;
  width: auto;
  overflow: visible;
  white-space: nowrap;
}

.sidebar-header {
  padding: 16px 0;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:hover .sidebar-header {
  padding: 24px 20px 20px;
}

.sidebar-logo-img {
  width: 40px;
  height: 40px;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  border: 2px solid rgba(255,255,255,0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:hover .sidebar-logo-img {
  width: 64px;
  height: 64px;
  margin-bottom: 10px;
}

.sidebar-logo-img:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}

.sidebar-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  letter-spacing: -0.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0;
  color: rgba(255,255,255,0.6);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  margin: 2px 8px;
  border-radius: 10px;
  position: relative;
}

.sidebar:hover .nav-item {
  justify-content: flex-start;
  padding: 12px 20px;
}

.nav-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  opacity: 0;
  transition: opacity 0.2s;
}

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

.nav-item:hover {
  color: white;
}

.nav-item.active {
  background: rgba(231, 76, 60, 0.15);
  color: white;
  border-left-color: var(--primary);
  font-weight: 600;
}

.nav-item.active::after {
  opacity: 0;
}

.nav-item-secondary {
  font-size: 0.82rem !important;
  padding-left: 24px !important;
  opacity: 0.85;
}

.sidebar:hover .nav-item-secondary {
  padding-left: 32px !important;
}

.nav-icon {
  font-size: 1.3rem;
  width: auto;
  text-align: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:hover .nav-icon {
  width: 28px;
  font-size: 1.2rem;
}

.nav-label {
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:hover .sidebar-footer {
  padding: 16px 20px;
}

.sse-status {
  font-size: 0.8rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:hover .sse-status {
  justify-content: flex-start;
  padding: 8px 12px;
}

.sse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

.sse-status.disconnected .sse-dot {
  background: var(--danger);
  animation: none;
}

.sse-text {
  font-weight: 500;
}

.sse-status.connected .sse-text {
  color: var(--success);
}

.sse-status.disconnected .sse-text {
  color: var(--danger);
}

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

.logout-btn {
  width: 100%;
  padding: 10px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-family: inherit;
}

.sidebar:hover .logout-btn {
  padding: 10px 16px;
}

.logout-btn:hover {
  background: rgba(231, 76, 60, 0.2);
  border-color: rgba(231, 76, 60, 0.4);
  color: white;
  transform: translateY(-1px);
}

/* ─── Main Content ─────────────────────── */

.main-content {
  flex: 1;
  padding: 28px 32px;
  background: var(--bg);
  overflow-y: auto;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.main-header-left h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--secondary);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.main-header-subtitle {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 400;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ─── Stats Cards ──────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card-total::before {
  background: linear-gradient(90deg, #3498db, #2980b9);
  opacity: 1;
}

.stat-card-pending::before {
  background: linear-gradient(90deg, #f39c12, #e67e22);
  opacity: 1;
}

.stat-card-preparing::before {
  background: linear-gradient(90deg, #9b59b6, #8e44ad);
  opacity: 1;
}

.stat-card-revenue::before {
  background: linear-gradient(90deg, #27ae60, #2ecc71);
  opacity: 1;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.stat-card:hover .stat-card-icon {
  transform: scale(1.1);
}

.stat-card-total .stat-card-icon {
  background: rgba(52, 152, 219, 0.12);
}

.stat-card-pending .stat-card-icon {
  background: rgba(243, 156, 18, 0.12);
}

.stat-card-preparing .stat-card-icon {
  background: rgba(155, 89, 182, 0.12);
}

.stat-card-revenue .stat-card-icon {
  background: rgba(39, 174, 96, 0.12);
}

.stat-card-info {
  display: flex;
  flex-direction: column;
}

.stat-card-number {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--secondary);
  line-height: 1.2;
  letter-spacing: -0.5px;
  transition: color 0.3s ease;
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ─── Configuración WhatsApp ──────────── */

.whatsapp-config-card {
  margin-bottom: 28px;
}

.whatsapp-config-body {
  padding: 20px 24px;
}

.whatsapp-config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
}

.whatsapp-config-info {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
}

.whatsapp-config-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(37, 211, 102, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.whatsapp-config-text {
  flex: 1;
}

.whatsapp-config-text strong {
  font-size: 0.95rem;
  color: var(--secondary);
  display: block;
  margin-bottom: 2px;
}

.whatsapp-config-desc {
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.5;
  margin: 0;
}

.whatsapp-config-desc strong {
  font-size: inherit;
  display: inline;
  color: var(--text);
}

.whatsapp-config-divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

/* ─── Toggle Switch ────────────────────── */

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 26px;
  transition: all 0.3s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Badge WhatsApp ───────────────────── */

.whatsapp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.whatsapp-badge-active {
  background: rgba(37, 211, 102, 0.12);
  color: #1e8449;
}

/* ─── Details/Explanation ──────────────── */

.whatsapp-config-details {
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.whatsapp-config-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--secondary);
  background: rgba(250, 250, 250, 0.5);
  user-select: none;
  transition: background 0.2s;
}

.whatsapp-config-summary:hover {
  background: rgba(231, 76, 60, 0.04);
}

.details-arrow {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

.whatsapp-config-details[open] .details-arrow {
  transform: rotate(180deg);
}

.whatsapp-config-explanation {
  padding: 16px 20px;
  background: #fafafa;
  border-top: 1px solid var(--border);
}

.explanation-section {
  margin-bottom: 20px;
}

.explanation-section:last-child {
  margin-bottom: 0;
}

.explanation-section h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 10px;
}

.explanation-section ol,
.explanation-section ul {
  margin: 0;
  padding-left: 20px;
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.7;
}

.explanation-section li {
  margin-bottom: 4px;
}

.explanation-section code {
  background: rgba(231, 76, 60, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--primary);
}

.explanation-tip {
  margin-top: 10px;
  padding: 12px 16px;
  background: rgba(52, 152, 219, 0.08);
  border-left: 4px solid var(--info);
  border-radius: 8px;
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.6;
}

.explanation-tip strong {
  color: var(--secondary);
}

/* ─── Card contenedor ──────────────────── */

.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(250, 250, 250, 0.5);
}

.card-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--secondary);
}

.card-badge {
  font-size: 0.8rem;
  color: var(--text);
  background: var(--bg);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 500;
}

/* ─── Tabla de Pedidos ─────────────────── */

.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.table-container thead {
  background: var(--bg);
}

.table-container th {
  padding: 14px 16px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.table-container td {
  padding: 14px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

.table-container tbody tr {
  transition: background 0.2s ease;
}

.table-container tbody tr:hover {
  background: rgba(231, 76, 60, 0.03);
}

.table-container tbody tr:last-child td {
  border-bottom: none;
}

/* ─── Pedido nuevo highlight ──────────── */

.pedido-nuevo {
  animation: highlightNew 2.5s ease;
}

@keyframes highlightNew {
  0% { background: rgba(231, 76, 60, 0.08); }
  100% { background: transparent; }
}

/* ─── Badges de estado ────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.badge-nuevo {
  background: rgba(243, 156, 18, 0.12);
  color: #b7950b;
  border: 1px solid rgba(243, 156, 18, 0.2);
}

.badge-preparando {
  background: rgba(155, 89, 182, 0.12);
  color: #7d3c98;
  border: 1px solid rgba(155, 89, 182, 0.2);
}

.badge-listo {
  background: rgba(52, 152, 219, 0.12);
  color: #1a5276;
  border: 1px solid rgba(52, 152, 219, 0.2);
}

.badge-entregado {
  background: rgba(39, 174, 96, 0.12);
  color: #1e8449;
  border: 1px solid rgba(39, 174, 96, 0.2);
}

.badge-activa {
  background: rgba(39, 174, 96, 0.12);
  color: #1e8449;
  border: 1px solid rgba(39, 174, 96, 0.2);
}

.badge-inactiva {
  background: rgba(149, 165, 166, 0.12);
  color: #7f8c8d;
  border: 1px solid rgba(149, 165, 166, 0.2);
}

.badge-cancelada {
  background: rgba(231, 76, 60, 0.12);
  color: #c0392b;
  border: 1px solid rgba(231, 76, 60, 0.2);
}

.badge-expirada {
  background: rgba(243, 156, 18, 0.12);
  color: #b7950b;
  border: 1px solid rgba(243, 156, 18, 0.2);
}

/* ─── Select de estado ────────────────── */

.estado-select {
  padding: 6px 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  background: white;
  min-width: 130px;
  font-family: inherit;
  font-weight: 500;
  transition: border-color 0.2s;
}

.estado-select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* ─── Empty state tabla ───────────────── */

.table-empty {
  text-align: center !important;
  padding: 60px 20px !important;
}

.table-empty-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.table-empty-icon {
  font-size: 3rem;
  opacity: 0.5;
}

.table-empty-content p {
  color: var(--text);
  font-size: 0.95rem;
}

/* ─── Menú Admin ───────────────────────── */

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.menu-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all 0.3s ease;
}

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

.menu-card .card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: linear-gradient(135deg, #f0f0f0, #e8e8e8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #ccc;
  position: relative;
}

.menu-card .card-body {
  padding: 16px 18px;
}

.menu-card .card-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--secondary);
}

.menu-card .card-body .card-categoria {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
  padding: 2px 10px;
  background: rgba(231, 76, 60, 0.08);
  border-radius: 4px;
  margin-bottom: 8px;
}

.menu-card .card-body .card-desc {
  font-size: 0.88rem;
  color: var(--text-light);
  margin: 8px 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.menu-card .card-body .card-precio {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
}

.menu-card .card-actions {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: rgba(250, 250, 250, 0.5);
}

.menu-card .card-actions button {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s;
  font-family: inherit;
}

.menu-card .card-actions .btn-edit {
  background: var(--info);
  color: white;
}

.menu-card .card-actions .btn-edit:hover {
  background: #2980b9;
  transform: translateY(-1px);
}

.menu-card .card-actions .btn-delete {
  background: var(--danger);
  color: white;
}

.menu-card .card-actions .btn-delete:hover {
  background: #c0392b;
  transform: translateY(-1px);
}

.menu-card .card-actions .btn-toggle {
  background: var(--warning);
  color: var(--secondary);
}

.menu-card .card-actions .btn-toggle:hover {
  background: #d4ac0d;
  transform: translateY(-1px);
}

.menu-card.agotado {
  opacity: 0.6;
}

.menu-card.agotado .card-image::after {
  content: 'AGOTADO';
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--danger);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ─── Botones ──────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(231, 76, 60, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: #e0e0e0;
  color: var(--secondary);
  border: 1px solid #d0d0d0;
}

.btn-secondary:hover {
  background: #d0d0d0;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.82rem;
  border-radius: 10px;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg);
}

/* ─── Modal Detalle ────────────────────────── */

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

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

.modal-header h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

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

.modal-body {
  color: var(--text);
}

.modal-body h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 12px;
}

.modal-body p {
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.6;
}

.modal-body strong {
  color: var(--secondary);
}

.modal-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text);
  font-size: 0.95rem;
}

.modal-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.modal-detalle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 576px) {
  .modal-detalle-grid {
    grid-template-columns: 1fr;
  }
}

.detalle-seccion {
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.detalle-seccion h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 10px;
}

.detalle-seccion p {
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.5;
}

.detalle-seccion p strong {
  color: var(--secondary);
}

.detalle-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.detalle-items-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
}

.detalle-items-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.detalle-items-table tbody tr:hover {
  background: rgba(231, 76, 60, 0.03);
}

.historial-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  border: 3px solid var(--border);
  background: white;
}

.timeline-dot.nuevo { border-color: #f39c12; }
.timeline-dot.preparando { border-color: #9b59b6; }
.timeline-dot.listo { border-color: #3498db; }
.timeline-dot.entregado { border-color: #27ae60; }
.timeline-dot.cancelado { border-color: #e74c3c; }

.timeline-content {
  flex: 1;
  min-width: 0;
}

.timeline-content strong {
  font-size: 0.9rem;
  color: var(--secondary);
  display: block;
  margin-bottom: 2px;
}

.timeline-content small {
  font-size: 0.78rem;
  color: var(--text);
}

.timeline-razon {
  font-size: 0.82rem;
  color: var(--text);
  margin-top: 4px;
  padding: 6px 10px;
  background: rgba(243, 156, 18, 0.08);
  border-radius: 6px;
}

.modal-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.modal-acciones-secundarias {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ─── Modal ────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: white;
  border-radius: var(--radius);
  padding: 32px;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.25s ease;
  color: var(--text);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal h2 {
  margin-bottom: 24px;
  color: var(--secondary);
  font-size: 1.3rem;
  font-weight: 800;
}

.modal p {
  color: var(--text);
  line-height: 1.6;
}

.modal small {
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.modal-actions button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.2s;
}

.modal-actions .btn-cancel {
  background: var(--border);
  color: var(--text);
}

.modal-actions .btn-cancel:hover {
  background: #ccc;
}

/* ─── Widget IA con Acciones ──────────── */

.ayuda-fab {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom, 24px));
  right: max(24px, env(safe-area-inset-right, 24px));
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 24px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
  z-index: 1000;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.ayuda-fab:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 8px 30px rgba(231, 76, 60, 0.5);
}

.ayuda-fab-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.3);
  display: block;
}

.ayuda-modal {
  position: fixed;
  bottom: max(96px, env(safe-area-inset-bottom, 96px));
  right: max(24px, env(safe-area-inset-right, 24px));
  width: 380px;
  height: 540px;
  background: white;
  border-radius: 18px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.25);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  animation: ayudaSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes ayudaSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ayuda-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
}

.ayuda-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.95rem;
}

.ayuda-header-logo {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
}

.ayuda-header-sub {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.75);
  font-weight: 400;
  flex: 1;
  min-width: 120px;
}

.ayuda-close-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
  margin-left: auto;
}

.ayuda-close-btn:hover {
  background: rgba(255,255,255,0.25);
}

.ayuda-mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ayuda-mensajes .msg {
  margin-bottom: 4px;
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 88%;
  line-height: 1.5;
  font-size: 0.88rem;
  animation: msgIn 0.25s ease;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ayuda-mensajes .msg.bot {
  background: white;
  color: #333;
  border: 1px solid #e8e8e8;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.ayuda-mensajes .msg.user {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.ayuda-input {
  display: flex;
  padding: 12px 14px;
  border-top: 1px solid #e8e8e8;
  background: white;
  gap: 8px;
}

.ayuda-input input {
  flex: 1;
  padding: 10px 16px;
  border: 2px solid #e8e8e8;
  border-radius: 24px;
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.ayuda-input input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.08);
}

.ayuda-send-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ayuda-send-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* ─── Estado Abierto/Cerrado ──────────── */

.estado-toggle {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.estado-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #f5f5f5;
  transition: all 0.2s;
  user-select: none;
  font-family: inherit;
}

.estado-label input[type="radio"] {
  accent-color: var(--success);
}

.estado-label span {
  font-weight: 600;
  font-size: 0.9rem;
}

.estado-abierto {
  border-color: var(--success);
}

.estado-abierto.active {
  background: #e8f5e9;
}

.estado-cerrado {
  border-color: var(--danger);
}

.estado-cerrado.active {
  background: #ffebee;
}

.estado-cerrado span {
  color: var(--danger);
}

.estado-abierto span {
  color: var(--success);
}

/* ─── Form Groups ─────────────────────── */

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--secondary);
}

/* ─── Sidebar Toggle (Mobile) ─────────── */

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1001;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(231, 76, 60, 0.4);
  align-items: center;
  justify-content: center;
  transition: left 0.3s ease;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 998;
  backdrop-filter: blur(4px);
}

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

/* ─── Responsive ───────────────────────── */

/* === Tablet portrait (<=768px) === */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 999;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0,0,0,0.2);
  }
  .sidebar.open {
    left: 0;
  }

  /* Resetear colapso en móvil: siempre mostrar textos completos */
  .sidebar .sidebar-header h3,
  .sidebar .nav-label,
  .sidebar .sse-text,
  .sidebar .logout-btn span:not(.nav-icon) {
    opacity: 1;
    visibility: visible;
    width: auto;
    overflow: visible;
    white-space: nowrap;
  }

  .sidebar .sidebar-header {
    padding: 24px 20px 20px;
  }

  .sidebar .sidebar-logo-img {
    width: 64px;
    height: 64px;
    margin-bottom: 10px;
  }

  .sidebar .nav-item {
    justify-content: flex-start;
    padding: 12px 20px;
  }

  .sidebar .nav-icon {
    width: 28px;
    font-size: 1.2rem;
  }

  .sidebar .sidebar-footer {
    padding: 16px 20px;
  }

  .sidebar .sse-status {
    justify-content: flex-start;
    padding: 8px 12px;
  }

  .sidebar .logout-btn {
    padding: 10px 16px;
  }

  .sidebar-toggle {
    display: flex;
  }
  .sidebar-toggle.menu-open {
    left: 272px;
  }

  .main-content {
    padding: 20px;
    margin-left: 0;
  }

  .main-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  .main-header-left h1 {
    font-size: 1.3rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 16px 18px;
  }
  .stat-card-number {
    font-size: 1.3rem;
  }

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

  /* ─── Widget IA ─── */
  .ayuda-modal {
    width: calc(100% - 32px);
    height: 60vh;
    bottom: 84px;
    right: 16px;
  }
  .ayuda-header-sub {
    display: none;
  }

  .card-header {
    padding: 14px 18px;
  }
  .table-container th,
  .table-container td {
    padding: 10px 12px;
  }
}

/* === Mobile grande (<=576px) === */
@media (max-width: 576px) {
  .sidebar {
    width: 100%;
    left: -100%;
  }
  .sidebar.open {
    left: 0;
  }
  .sidebar-toggle.menu-open {
    left: auto;
    right: 16px;
  }

  .main-content {
    padding: 14px;
  }
  .main-header-left h1 {
    font-size: 1.15rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat-card {
    padding: 14px;
    gap: 12px;
  }
  .stat-card-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  .stat-card-number {
    font-size: 1.15rem;
  }
  .stat-card-label {
    font-size: 0.7rem;
  }

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

  .modal {
    padding: 24px 16px;
    width: 95%;
  }
  .modal-actions {
    flex-direction: column;
  }

  .menu-card .card-image {
    height: 140px;
  }

  .ayuda-modal {
    width: calc(100% - 16px);
    height: 70vh;
    bottom: 78px;
    right: 8px;
    border-radius: 14px;
  }
  .ayuda-fab {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
  }
  .ayuda-fab-logo {
    width: 30px;
    height: 30px;
  }

  .card-header {
    padding: 12px 14px;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }
  .table-container th,
  .table-container td {
    padding: 8px 10px;
    font-size: 0.82rem;
  }
  .estado-select {
    min-width: 100px;
    font-size: 0.78rem;
    padding: 4px 8px;
  }
}

/* ─── Layout 2 Columnas ──────────────────── */

.form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
}

.form-grid-2col .form-group {
  margin-bottom: 0;
}

.form-grid-2col .form-group:nth-child(5),
.form-grid-2col .form-group:nth-child(6) {
  grid-column: 1 / -1;
}

/* ─── Tabla de Horarios ──────────────────── */

.horarios-table-wrapper {
  overflow-x: auto;
  margin-top: 8px;
}

.horarios-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.horarios-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
}

.horarios-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.horarios-table td:first-child {
  font-weight: 600;
  color: var(--secondary);
}

.horarios-table input[type="time"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 0.2s;
  width: 110px;
}

.horarios-table input[type="time"]:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.08);
}

.horarios-table .horario-check {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--success);
}

.horarios-table tbody tr:hover {
  background: rgba(231, 76, 60, 0.03);
}

/* ─── Sub-tarjetas WhatsApp ──────────────── */

.wa-subcard {
  padding: 16px 0;
}

.wa-subcard-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.wa-subcard-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.wa-subcard:nth-child(1) .wa-subcard-icon {
  background: rgba(37, 211, 102, 0.12);
}

.wa-subcard:nth-child(3) .wa-subcard-icon {
  background: rgba(243, 156, 18, 0.12);
}

.wa-subcard:nth-child(5) .wa-subcard-icon {
  background: rgba(155, 89, 182, 0.12);
}

.wa-subcard-title {
  flex: 1;
}

.wa-subcard-title strong {
  font-size: 0.95rem;
  color: var(--secondary);
  display: block;
  margin-bottom: 2px;
}

.wa-subcard-desc {
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.5;
  margin: 0;
}

.wa-subcard-body {
  padding-left: 58px;
}

.wa-subcard-list {
  margin: 0 0 14px 0;
  padding: 0;
  list-style: none;
}

.wa-subcard-list li {
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.7;
  padding: 2px 0;
}

.wa-subcard-list li strong {
  color: var(--secondary);
}

.wa-subcard-input-group {
  margin-top: 4px;
}

.wa-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.wa-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.08);
}

.wa-input-hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.5;
}

.wa-hint-icon {
  flex-shrink: 0;
  font-size: 0.85rem;
}

.wa-subcard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wa-subcard-toggle-info {
  flex: 1;
}

.wa-toggle-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--secondary);
  display: block;
  margin-bottom: 2px;
}

.wa-toggle-status {
  font-size: 0.78rem;
  color: var(--success);
  font-weight: 500;
}

/* ─── Status Grid WhatsApp ───────────────── */

.wa-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.wa-status-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.wa-status-item .wa-status-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.wa-status-item .wa-status-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--secondary);
}

.wa-status-value.connected {
  color: var(--success);
}

.wa-status-value.disconnected {
  color: var(--danger);
}

.wa-status-value.warning {
  color: var(--warning);
}

/* ─── Status Row ─────────────────────────── */

.wa-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 14px;
  background: rgba(37, 211, 102, 0.06);
  border-radius: 8px;
  border: 1px solid rgba(37, 211, 102, 0.15);
}

.wa-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.wa-status-dot.wa-status-active {
  background: var(--success);
  animation: pulse 2s infinite;
}

.wa-status-dot.wa-status-inactive {
  background: var(--text-light);
  animation: none;
}

.wa-status-label {
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 500;
}

.wa-status-time {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-left: auto;
}

/* ─── Help Link ──────────────────────────── */

.wa-help-link {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.wa-help-link a {
  font-size: 0.84rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.wa-help-link a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ─── Membresía Badge ────────────────────── */

.main-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.main-header-left h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--secondary);
  letter-spacing: -0.5px;
  margin-bottom: 0;
}

.main-header-subtitle {
  font-size: 0.82rem;
  font-weight: 500;
  padding: 3px 12px;
  border-radius: 6px;
  display: inline-block;
  width: fit-content;
}

.main-header-subtitle.membresia-activa {
  background: rgba(39, 174, 96, 0.1);
  color: #1e8449;
}

.main-header-subtitle.membresia-trial {
  background: rgba(243, 156, 18, 0.1);
  color: #b7950b;
}

.main-header-subtitle.sin-membresia {
  background: rgba(231, 76, 60, 0.08);
  color: #c0392b;
}

/* ─── Responsive ─────────────────────────── */

/* === Tablet portrait (<=768px) === */
@media (max-width: 768px) {
  .form-grid-2col {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .form-grid-2col .form-group:nth-child(5),
  .form-grid-2col .form-group:nth-child(6) {
    grid-column: 1;
  }

  .horarios-table {
    display: none;
  }

  #horarios-container-mobile {
    display: block !important;
  }

  .wa-subcard-body {
    padding-left: 0;
  }

  .wa-status-grid {
    grid-template-columns: 1fr;
  }

  .wa-subcard-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================
   Kanban Board
   ============================================ */

.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-top: 20px;
  min-height: 400px;
}

.kanban-column {
  background: rgba(255,255,255,0.5);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 300px;
}

.kanban-column-header {
  padding: 12px 14px;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kanban-count {
  background: rgba(255,255,255,0.25);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
}

.kanban-cards {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-empty {
  text-align: center;
  color: var(--text);
  font-size: 0.82rem;
  padding: 30px 10px;
}

/* ─── Tarjeta Kanban ──────────────────── */

.kanban-card {
  background: white;
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  position: relative;
  overflow: hidden;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  border-color: var(--primary-light);
}

.kanban-card.card-urgente {
  border-left: 4px solid var(--danger);
  animation: pulseUrgente 2s infinite;
}

.kanban-card.card-advertencia {
  border-left: 4px solid var(--warning);
}

@keyframes pulseUrgente {
  0%, 100% { box-shadow: 0 1px 4px rgba(231,76,60,0.1); }
  50% { box-shadow: 0 1px 12px rgba(231,76,60,0.25); }
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.card-id {
  font-size: 0.95rem;
  color: var(--secondary);
}

.card-tiempo {
  font-size: 0.72rem;
  color: var(--text);
  font-weight: 500;
}

.card-cliente {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 4px;
}

.card-items {
  font-size: 0.78rem;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.card-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-total {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
}

.card-actions-mini {
  display: flex;
  gap: 4px;
}

.btn-icon {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--border);
  transform: scale(1.1);
}

.card-notas {
  margin-top: 6px;
  padding: 4px 8px;
  background: rgba(243, 156, 18, 0.08);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text);
  line-height: 1.4;
}

/* ─── Drag & Drop ─────────────────────────── */

/* Tarjeta mientras se arrastra (mouse) */
.kanban-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}

/* Columna resaltada cuando un elemento está sobre ella (drop zone válida) */
.kanban-column.drag-over {
  background: rgba(52, 152, 219, 0.12);
  border-color: var(--primary);
  border-style: dashed;
}

/* Columna donde no se puede soltar (estados finales) */
.kanban-column.drop-disabled {
  opacity: 0.5;
  background: rgba(231, 76, 60, 0.05);
}

/* Fantasma visual para touch drag (sigue al dedo) */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.9;
  transform: rotate(3deg) scale(1.05);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 260px;
  transition: none;
  background: white;
  border-radius: 10px;
  padding: 12px 14px;
  border: 2px solid var(--primary);
}

/* ─── Filtros ─────────────────────────── */

.filtros-body {
  padding: 16px 24px;
}

.filtros-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}

.filtro-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filtro-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.filtro-group select,
.filtro-group input {
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  background: white;
  transition: border-color 0.2s;
}

.filtro-group select:focus,
.filtro-group input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(231,76,60,0.08);
}

.auto-refresh-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 0;
}

.auto-refresh-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--success);
  cursor: pointer;
}

.toggle-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

/* ─── Modal de Detalle ────────────────── */

.modal-lg {
  max-width: 700px;
  padding: 0;
}

.modal-sm {
  max-width: 420px;
  padding: 0;
}

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

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--secondary);
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: var(--text-light);
}

.modal-close-btn:hover {
  background: var(--border);
  color: var(--text);
}

.modal-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: rgba(250,250,250,0.5);
}

.modal-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

.modal-detalle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.detalle-seccion h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}

.detalle-seccion p {
  font-size: 0.88rem;
  margin-bottom: 6px;
  line-height: 1.5;
}

.detalle-seccion p strong {
  color: var(--secondary);
}

.detalle-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.detalle-items-table th {
  padding: 8px 10px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
}

.detalle-items-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

/* ─── Timeline de Historial ───────────── */

.historial-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 24px;
}

.historial-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: -22px;
  margin-top: 4px;
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--border);
}

.timeline-dot.nuevo { background: #f39c12; }
.timeline-dot.preparando { background: #9b59b6; }
.timeline-dot.listo { background: #3498db; }
.timeline-dot.entregado { background: #27ae60; }
.timeline-dot.cancelado { background: #e74c3c; }

.timeline-content {
  flex: 1;
}

.timeline-content strong {
  font-size: 0.85rem;
  color: var(--secondary);
  display: block;
}

.timeline-content small {
  font-size: 0.72rem;
  color: var(--text-light);
}

.timeline-razon {
  font-size: 0.78rem;
  color: var(--text);
  margin: 2px 0 0 0;
  padding: 4px 8px;
  background: rgba(243,156,18,0.08);
  border-radius: 4px;
}

/* ─── Acciones del Modal ──────────────── */

.modal-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.modal-acciones-secundarias {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-acciones button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Badge cancelado ─────────────────── */

.badge-cancelado {
  background: rgba(231, 76, 60, 0.12);
  color: #c0392b;
  border: 1px solid rgba(231, 76, 60, 0.2);
}

/* ─── Responsive Kanban ───────────────── */

/* === Tablet (≤1200px): scroll horizontal, todas las columnas visibles === */
@media (max-width: 1200px) {
  .kanban-board {
    display: flex;
    overflow-x: auto;
    gap: 14px;
    padding-bottom: 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .kanban-column {
    flex: 0 0 280px;
    min-width: 260px;
    scroll-snap-align: start;
  }
  /* Ya no ocultamos entregado/cancelado */
}

/* === Móvil (≤768px): scroll horizontal con columnas más angostas === */
@media (max-width: 768px) {
  .kanban-board {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding-bottom: 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .kanban-column {
    flex: 0 0 260px;
    min-width: 240px;
    scroll-snap-align: start;
    min-height: auto;
  }
  .kanban-cards {
    max-height: 350px;
  }

  /* ─── Filtros: más compactos en móvil ─── */
  .filtros-body {
    padding: 12px 16px;
  }
  .filtros-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .filtro-group label {
    font-size: 0.7rem;
  }
  .filtro-group select,
  .filtro-group input {
    font-size: 0.85rem;
    padding: 8px 10px;
  }

  /* ─── Modal detalle: 1 columna ─── */
  .modal-detalle-grid {
    grid-template-columns: 1fr;
  }
  .modal-lg {
    width: 95%;
  }
  .modal-body {
    padding: 16px;
  }
  .modal-header {
    padding: 14px 16px;
  }
  .modal-footer {
    padding: 12px 16px;
  }

  /* ─── Modal acciones: grid 3 columnas ─── */
  .modal-acciones {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .modal-acciones .btn {
    font-size: 0.75rem;
    padding: 8px 6px;
    white-space: nowrap;
  }
  .modal-acciones-secundarias {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .modal-acciones-secundarias .btn {
    font-size: 0.75rem;
    padding: 6px 10px;
  }
}

/* === Móvil muy pequeño (≤400px): stats en 1 columna === */
@media (max-width: 400px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ─── Card Body ──────────────────────────── */

.card-body {
  padding: 20px 24px;
}

/* ─── Preferencias de Notificaciones ─────── */

.prefs-section {
  margin-bottom: 4px;
}

.prefs-section strong {
  font-size: 0.85rem;
  color: var(--secondary);
}

.pref-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text);
  transition: opacity 0.2s;
}

.pref-checkbox:hover {
  opacity: 0.8;
}

.pref-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--success);
  cursor: pointer;
  flex-shrink: 0;
}

.pref-checkbox span {
  font-size: 0.88rem;
}
