* {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, #ffe1e1 0, transparent 30%),
    linear-gradient(135deg, #f8f9fb, #eef1f6);
  margin: 0;
  padding: 18px;
  color: #222;
}

.contenedor {
  max-width: 980px;
  margin: auto;
}

header {
  text-align: center;
  background: linear-gradient(135deg, #b30000, #e53935);
  color: white;
  padding: 34px 22px;
  border-radius: 24px;
  margin-bottom: 18px;
  box-shadow: 0 12px 28px rgba(179, 0, 0, 0.25);
}

header h1 {
  margin: 0;
  font-size: 34px;
}

header p {
  margin: 10px 0 0;
  font-size: 17px;
  opacity: 0.95;
}

.avance-card {
  background: white;
  padding: 18px;
  border-radius: 18px;
  margin-bottom: 20px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  position: sticky;
  top: 10px;
  z-index: 10;
}

.avance-texto {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 15px;
}

.avance-texto span {
  color: #666;
}

.avance-texto strong {
  color: #b30000;
}

.barra-avance {
  height: 14px;
  background: #eee;
  border-radius: 999px;
  overflow: hidden;
}

#progresoAvance {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #b30000, #ff6b6b);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.card {
  background: rgba(255,255,255,0.96);
  padding: 26px;
  margin-bottom: 22px;
  border-radius: 22px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.04);
}

.card h2 {
  margin-top: 0;
  color: #b30000;
  font-size: 24px;
}

.descripcion-area {
  margin-top: -8px;
  color: #666;
  line-height: 1.4;
}

.area-ch {
  border-top: 6px solid #b30000;
}

.area-tp {
  border-top: 6px solid #333;
}

label {
  display: block;
  margin-top: 14px;
  font-weight: 700;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 14px 15px;
  margin-top: 7px;
  border: 1px solid #d2d2d2;
  border-radius: 14px;
  background: white;
  font-size: 16px;
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
  border-color: #b30000;
  box-shadow: 0 0 0 4px rgba(179, 0, 0, 0.12);
}

.mensaje-error {
  color: #b30000;
  font-size: 14px;
  margin-top: 6px;
  font-weight: bold;
}

.input-error {
  border: 2px solid #b30000 !important;
  background: #fff0f0 !important;
}

.pregunta {
  background: #fff;
  border: 1px solid #eee;
  padding: 20px;
  border-radius: 18px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
}

.pregunta p {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.35;
  margin-top: 0;
}

.opciones {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 15px;
}

.opcion-respuesta {
  margin: 0;
  font-weight: 700;
  cursor: pointer;
}

.opcion-respuesta input {
  display: none;
}

.opcion-respuesta span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px;
  border-radius: 14px;
  background: #f3f4f6;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  text-align: center;
}

.opcion-respuesta:hover span {
  background: #ffecec;
  border-color: #ffb3b3;
}

.opcion-respuesta input:checked + span {
  background: #b30000;
  color: white;
  border-color: #b30000;
  box-shadow: 0 6px 16px rgba(179, 0, 0, 0.28);
  transform: translateY(-2px);
}

button {
  width: 100%;
  padding: 17px;
  background: linear-gradient(135deg, #b30000, #e53935);
  color: white;
  border: none;
  font-size: 18px;
  font-weight: 800;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(179, 0, 0, 0.25);
}

button:hover {
  filter: brightness(0.95);
}

.resultado {
  background: white;
  padding: 30px;
  border-radius: 24px;
  margin-top: 25px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.1);
}

.resultado h2 {
  color: #b30000;
  margin-top: 0;
}

.barra {
  background: #eee;
  height: 28px;
  border-radius: 20px;
  margin-bottom: 18px;
  overflow: hidden;
}

.progreso {
  height: 100%;
  background: linear-gradient(90deg, #b30000, #ff6b6b);
  color: white;
  text-align: center;
  line-height: 28px;
  font-weight: bold;
  border-radius: 20px;
}

.tendencia {
  background: #fff0f0;
  border-left: 5px solid #b30000;
  padding: 16px;
  border-radius: 14px;
  font-size: 21px;
  font-weight: 800;
  color: #b30000;
  margin-top: 20px;
}

.oculto {
  display: none;
}

/* PANEL ADMIN */

.resumen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.resumen-card {
  background: #f8f8f8;
  border-left: 5px solid #b30000;
  padding: 18px;
  border-radius: 12px;
}

.resumen-card span {
  display: block;
  font-size: 14px;
  color: #666;
}

.resumen-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  color: #b30000;
}

.establecimientos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.establecimiento-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.establecimiento-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.14);
}

.establecimiento-card h3 {
  margin-top: 0;
  color: #222;
  font-size: 17px;
}

.cantidad-respuestas {
  color: #666;
  font-size: 14px;
  margin-bottom: 18px;
}

.mini-barra-label {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin: 10px 0 5px;
}

.mini-barra {
  background: #e5e5e5;
  height: 12px;
  border-radius: 20px;
  overflow: hidden;
}

.mini-progreso {
  height: 100%;
  border-radius: 20px;
}

.ch-barra {
  background: #b30000;
}

.tp-barra {
  background: #333;
}

.badge {
  display: inline-block;
  margin-top: 16px;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: bold;
}

.badge.ch {
  background: #ffe5e5;
  color: #b30000;
}

.badge.tp {
  background: #e8e8e8;
  color: #222;
}

.badge.equilibrada {
  background: #fff3cd;
  color: #8a6d00;
}

.btn-secundario {
  width: auto;
  padding: 10px 16px;
  background: #333;
  margin-bottom: 15px;
}

.btn-secundario:hover {
  background: #111;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

th {
  background: #b30000;
  color: white;
  padding: 10px;
}

td {
  border: 1px solid #ddd;
  padding: 10px;
}

tr:nth-child(even) {
  background: #f4f4f4;
}

/* MOVIL */

@media (max-width: 700px) {
  body {
    padding: 10px;
  }

  header {
    padding: 26px 16px;
    border-radius: 20px;
  }

  header h1 {
    font-size: 25px;
  }

  header p {
    font-size: 15px;
  }

  .card {
    padding: 18px;
    border-radius: 18px;
  }

  .card h2 {
    font-size: 21px;
  }

  .pregunta {
    padding: 17px;
  }

  .pregunta p {
    font-size: 16px;
  }

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

  .opcion-respuesta span {
    min-height: 52px;
    font-size: 16px;
  }

  .avance-card {
    top: 6px;
  }

  table {
    font-size: 13px;
  }

  th,
  td {
    padding: 7px;
  }

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