/* Diario de Campo ISPJB — estilos propios (sin Tailwind, sin build). */

:root {
  --rojo: #e11d22;
  --rojo-oscuro: #b71519;
  --texto: #1a1a1a;
  --gris-borde: #d1d5db;
  --gris-suave: #f3f4f6;
  --gris-texto: #4b5563;
  --gris-tenue: #9ca3af;
  --radio: 12px;
  --sombra: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--texto);
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* Marca de agua institucional: foto del colegio de fondo con capa cálida encima. */
body {
  background-color: #fdfbf7;
  background-image:
    linear-gradient(rgba(250, 240, 225, 0.72), rgba(250, 240, 225, 0.72)),
    url("colegio.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

.contenedor {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* Cabecera */
.cabecera { text-align: center; margin-bottom: 24px; }
.logo {
  width: 88px; height: 88px; object-fit: contain;
  margin: 0 auto 12px; display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}
.cabecera h1 {
  margin: 0; font-size: 1.6rem; line-height: 1.15;
  color: var(--rojo); font-weight: 800;
}
.subtitulo { margin: 2px 0 0; font-size: 0.9rem; font-weight: 600; color: #374151; }
.nota { margin: 2px 0 0; font-size: 0.78rem; color: var(--gris-texto); }
.nota-tenue { margin: 4px 0 0; font-size: 0.72rem; color: var(--gris-tenue); }

/* Alertas */
.alerta {
  margin-bottom: 16px; padding: 12px; border-radius: var(--radio);
  font-size: 0.88rem; border: 1px solid transparent;
}
.alerta-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alerta-ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }

/* Etapas */
.etapa { display: flex; flex-direction: column; gap: 16px; }
.titulo-etapa { margin: 0; font-size: 1.05rem; font-weight: 700; color: #1f2937; }
.subtitulo-bloque { margin: 8px 0 6px; font-size: 0.9rem; font-weight: 700; color: #374151; }

/* Campos de formulario */
.campo { display: flex; flex-direction: column; gap: 4px; }
.campo > span, .campo > label, label.campo > span {
  font-size: 0.8rem; font-weight: 600; color: #374151;
}
.etiqueta-pequena { font-size: 0.72rem !important; font-weight: 600; color: #374151; }

.grid-datos {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

input[type="text"], input[type="search"], textarea, select {
  width: 100%;
  font-size: 16px; /* evita zoom en iOS */
  font-family: inherit;
  color: var(--texto);
  background: #fff;
  border: 1px solid var(--gris-borde);
  border-radius: 10px;
  padding: 10px 12px;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--rojo);
  box-shadow: 0 0 0 3px rgba(225, 29, 34, 0.18);
}
input[type="range"] { width: 100%; accent-color: var(--rojo); }
input[type="checkbox"] { accent-color: var(--rojo); width: 16px; height: 16px; }

.ayuda { margin: 0; font-size: 0.74rem; color: var(--gris-texto); }
.centro { text-align: center; }

/* Acordeón (sistema para seguir) */
.acordeon { border: 1px solid #e5e7eb; border-radius: var(--radio); background: #fff; }
.acordeon > summary {
  cursor: pointer; padding: 10px 12px; font-size: 0.86rem;
  font-weight: 600; color: #1f2937; list-style: none;
}
.acordeon > summary::-webkit-details-marker { display: none; }
.acordeon > summary::before { content: "▸ "; color: var(--gris-tenue); }
.acordeon[open] > summary::before { content: "▾ "; }
.acordeon-cuerpo {
  padding: 12px; border-top: 1px solid #e5e7eb;
  display: flex; flex-direction: column; gap: 8px;
}
.chip-contador { font-size: 0.72rem; color: var(--gris-texto); font-weight: 500; }
.lista-checks { display: flex; flex-direction: column; gap: 6px; }
.lista-checks label {
  display: flex; align-items: flex-start; gap: 8px; font-size: 0.86rem; cursor: pointer;
}
.lista-checks input { margin-top: 2px; }

/* Botones */
.btn {
  width: 100%; padding: 13px 16px; border-radius: var(--radio);
  font-size: 0.95rem; font-weight: 700; cursor: pointer; border: 2px solid transparent;
  transition: background-color .15s, opacity .15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primario { background: var(--rojo); color: #fff; }
.btn-primario:not(:disabled):hover { background: var(--rojo-oscuro); }
.btn-borde { background: #fff; color: var(--rojo); border-color: var(--rojo); }
.btn-borde:not(:disabled):hover { background: #fff5f5; }

.enlace {
  background: none; border: none; color: var(--gris-texto);
  text-decoration: underline; font-size: 0.84rem; cursor: pointer; padding: 8px;
  width: 100%;
}
.enlace:hover { color: #1f2937; }

/* Buscador y filtros */
.buscador { display: flex; flex-direction: column; gap: 10px; }
.filtros-categoria { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-filtro {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--gris-borde);
  background: #fff; font-size: 0.8rem; font-weight: 600; color: var(--gris-texto);
  cursor: pointer;
}
.chip-filtro.activo { background: var(--rojo); border-color: var(--rojo); color: #fff; }

/* Lista de numerales (tarjetas seleccionables) */
.lista-numerales { display: flex; flex-direction: column; gap: 10px; }
.lista-catalogo { max-height: 55vh; overflow-y: auto; padding: 2px; }

.tarjeta-numeral {
  width: 100%; text-align: left; padding: 14px; border-radius: var(--radio);
  border: 2px solid var(--gris-borde); background: #fff; cursor: pointer;
  box-shadow: var(--sombra); font: inherit; color: inherit;
}
.tarjeta-numeral:hover { border-color: var(--gris-tenue); }
.tarjeta-numeral.marcada { border-color: var(--rojo); background: #fff5f5; }
.tn-cab { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.tn-check {
  width: 20px; height: 20px; border-radius: 5px; border: 2px solid var(--gris-tenue);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; color: transparent; flex: none;
}
.tarjeta-numeral.marcada .tn-check { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.tn-num { font-family: ui-monospace, "Courier New", monospace; font-size: 0.86rem; font-weight: 700; }
.tn-texto { margin: 0 0 6px; font-size: 0.86rem; color: #111827; font-style: italic; }
.tn-just { margin: 0; font-size: 0.84rem; color: var(--gris-texto); }

/* Insignias de categoría */
.badge {
  font-size: 0.7rem; padding: 2px 8px; border-radius: 6px; border: 1px solid;
  font-weight: 600; white-space: nowrap;
}
.badge-LEVE { background: #fef9c3; color: #713f12; border-color: #fde047; }
.badge-GRAVE { background: #ffedd5; color: #7c2d12; border-color: #fdba74; }
.badge-GRAVISIMA { background: #fee2e2; color: #7f1d1d; border-color: #fca5a5; }

/* Barra de conteo */
.barra-seleccion { position: sticky; bottom: 0; }
.conteo { font-size: 0.82rem; font-weight: 600; color: #374151; }

/* Tarjetas resumen en etapa 3 */
.tarjeta-gris {
  padding: 12px; border-radius: var(--radio); background: var(--gris-suave);
  border: 1px solid #e5e7eb; display: flex; flex-direction: column; gap: 10px;
}
.tarjeta-gris .tn-num { font-size: 0.84rem; }
.tarjeta-gris .tn-texto { font-size: 0.78rem; }
.tarjeta-azul {
  padding: 12px; border-radius: var(--radio); background: #eff6ff;
  border: 1px solid #bfdbfe; color: #1e3a5f; font-size: 0.76rem;
}
.tarjeta-azul ul { margin: 6px 0 0; padding-left: 18px; }
.tarjeta-azul li { margin-bottom: 2px; }

.fila-refinar { display: flex; gap: 8px; margin-top: 8px; }
.fila-refinar .btn { flex: 1; }
.fila-refinar select { width: auto; }
.fila-pdf { display: flex; gap: 10px; }
.fila-pdf .btn { flex: 1; }

/* Pie */
.pie {
  margin-top: 40px; padding-top: 16px; border-top: 1px solid #e5e7eb;
  font-size: 0.72rem; color: var(--gris-tenue); text-align: center;
}

/* Overlay de carga */
.overlay {
  position: fixed; inset: 0; background: rgba(255, 255, 255, 0.82);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; z-index: 50;
}
.overlay p { margin: 0; font-size: 0.9rem; font-weight: 600; color: #374151; }
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid #f3d1d2; border-top-color: var(--rojo);
  animation: girar 0.8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

[hidden] { display: none !important; }

@media (min-width: 480px) {
  .cabecera h1 { font-size: 1.85rem; }
}
