:root {
  --mecan: #D7141F;
  --mecan-claro: #EF3E3E;
  --gris-fondo: #f1f5f9;
  --gris-texto: #1e293b;
  --gris-borde: #cbd5e1;
  --verde: #059669;
  --rojo: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--gris-fondo);
  color: var(--gris-texto);
}

a { color: inherit; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid var(--gris-borde);
}

.topbar-marca { display: flex; align-items: center; gap: 12px; }

.logo { display: block; }

.topbar h1 { font-size: 1.1rem; margin: 0; }

.topbar nav a {
  margin-left: 16px;
  text-decoration: none;
  color: var(--mecan);
  font-weight: 600;
  font-size: 0.9rem;
}

.contenedor {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

/* ---- Kiosco ---- */
.kiosco-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.boton-sector {
  padding: 48px 16px;
  border: none;
  border-radius: 16px;
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.boton-sector:active { transform: scale(0.97); }

.kiosco-titulo {
  text-align: center;
  font-size: 2rem;
  margin-top: 24px;
}

.ticket-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.85);
  display: none;
  align-items: center;
  justify-content: center;
}

.ticket-overlay.visible { display: flex; }

.ticket-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px 64px;
  text-align: center;
  min-width: 320px;
}

.ticket-codigo {
  font-size: 5rem;
  font-weight: 800;
  margin: 16px 0;
  color: var(--mecan);
}

/* ---- Panel empleado ---- */
.panel-config {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.panel-config select, .panel-config input {
  padding: 10px;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid var(--gris-borde);
}

.panel-turno-actual {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  margin-bottom: 24px;
}

.panel-turno-actual .codigo {
  font-size: 4rem;
  font-weight: 800;
  color: var(--mecan);
}

.panel-acciones { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: var(--mecan);
}

.btn-verde { background: var(--verde); }
.btn-rojo { background: var(--rojo); }
.btn-gris { background: #64748b; }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.cola-info { text-align: center; color: #64748b; margin-bottom: 16px; }

/* ---- TV ---- */
.tv-body {
  background: #0f172a;
  color: #fff;
  min-height: 100vh;
  padding: 32px;
}

.tv-header { text-align: center; font-size: 1.8rem; margin-bottom: 32px; letter-spacing: 2px; }

.tv-actual-card {
  max-width: 640px;
  margin: 0 auto;
  border-radius: 24px;
  padding: 48px;
  text-align: center;
  background: #1e293b;
  border-top: 12px solid var(--mecan);
}

.tv-actual-card .sector-nombre { font-size: 2rem; opacity: 0.85; }
.tv-actual-card .codigo { font-size: 7rem; font-weight: 800; margin: 16px 0; line-height: 1; }
.tv-actual-card .mostrador { font-size: 1.6rem; opacity: 0.85; }
.tv-actual-card .sin-turno { font-size: 1.8rem; opacity: 0.4; padding: 40px 0; }

.tv-actual-card.flash { animation: flash 1s ease-in-out 2; }

@keyframes flash {
  0%, 100% { background: #1e293b; }
  50% { background: #334155; }
}

.tv-historial {
  margin-top: 40px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 0.7;
  font-size: 1rem;
}

.tv-historial span { background: #1e293b; padding: 6px 14px; border-radius: 8px; }

/* ---- Carrusel de promociones (TV) ---- */
.tv-promos {
  max-width: 1400px;
  margin: 40px auto 0;
  position: relative;
  height: 480px;
}

.tv-promo {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}

.tv-promo.visible { opacity: 1; }

.tv-promo img {
  max-width: 100%;
  max-height: 420px;
  border-radius: 16px;
  object-fit: contain;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.tv-promo-titulo { margin-top: 10px; font-size: 1.1rem; opacity: 0.85; }

/* ---- Admin / Metricas ---- */
table { width: 100%; border-collapse: collapse; margin-top: 16px; background: #fff; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--gris-borde); }
th { background: #f8fafc; }

form.inline { display: inline; }

.card { background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 20px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-top: 16px; }

.kpi { background: #fff; border-radius: 12px; padding: 18px; text-align: center; }
.kpi .valor { font-size: 2rem; font-weight: 800; color: var(--mecan); }
.kpi .etiqueta { color: #64748b; font-size: 0.85rem; }

.barra-fila { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.barra-fila .etiqueta-hora { width: 40px; font-size: 0.85rem; color: #64748b; }
.barra-fondo { flex: 1; background: #e2e8f0; border-radius: 6px; overflow: hidden; height: 18px; }
.barra-relleno { background: var(--mecan); height: 100%; }
