/* cea.alems.tech — móvil primero. El uso real es el celular en el CEA. */

:root {
  --fondo: #0f172a;
  --superficie: #1e293b;
  --superficie-alta: #334155;
  --borde: #334155;
  --texto: #e2e8f0;
  --texto-tenue: #94a3b8;
  --acento: #38bdf8;
  --ok: #4ade80;
  --alerta: #fbbf24;
  --radio: 14px;
}

* { box-sizing: border-box; }

/* Las reglas de autor con display: grid/flex le ganan al [hidden] del navegador.
   Sin esto, #login, #ajustes, .campo-fecha y .campo-reemplaza nunca se ocultan. */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 0 0 3rem;
  background: var(--fondo);
  color: var(--texto);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1 { font-size: 1.25rem; margin: 0; }

/* --- pantalla de clave --- */
.login { display: grid; place-items: center; min-height: 100dvh; padding: 1.5rem; }
.login-caja {
  width: 100%; max-width: 22rem; display: grid; gap: .75rem;
  background: var(--superficie); padding: 1.75rem; border-radius: var(--radio);
}
.login-ayuda { margin: 0; color: var(--texto-tenue); font-size: .9rem; }
.login-error { margin: 0; color: #fca5a5; font-size: .9rem; }

input[type="password"], input[type="date"], select, textarea {
  width: 100%; padding: .7rem .8rem; font: inherit;
  background: var(--fondo); color: var(--texto);
  border: 1px solid var(--borde); border-radius: 10px;
}
textarea { resize: vertical; }

button {
  font: inherit; cursor: pointer; border: 0; border-radius: 10px;
  padding: .7rem 1rem; background: var(--acento); color: #06283d; font-weight: 600;
}
.btn-icono {
  background: transparent; color: var(--texto-tenue);
  font-size: 1.25rem; padding: .35rem .6rem; min-width: 44px; min-height: 44px;
}
.btn-texto {
  background: transparent; color: var(--texto-tenue);
  padding: .5rem 0; text-align: left; text-decoration: underline;
}

/* --- cabecera --- */
.cabecera {
  position: sticky; top: 0; z-index: 5;
  background: var(--fondo); padding: 1rem 1rem .75rem;
  border-bottom: 1px solid var(--borde);
}
.cabecera-fila { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }

.barra {
  height: 8px; margin: .75rem 0 .5rem; overflow: hidden;
  background: var(--superficie-alta); border-radius: 99px;
}
.barra-relleno {
  height: 100%; width: 0; background: var(--ok);
  border-radius: 99px; transition: width .35s ease;
}
.resumen { margin: 0; font-size: .95rem; font-weight: 600; }

.estado-linea {
  display: flex; justify-content: space-between; gap: .5rem;
  margin: .35rem 0 0; font-size: .78rem; color: var(--texto-tenue);
  min-height: 1.2em;
}
.estado-guardado[data-estado="guardando"] { color: var(--texto-tenue); }
.estado-guardado[data-estado="guardado"]  { color: var(--ok); }
.estado-guardado[data-estado="pendiente"] { color: var(--alerta); }
.estado-guardado[data-estado="error"]     { color: #fca5a5; }

.ajustes {
  margin-top: .75rem; padding-top: .75rem;
  border-top: 1px solid var(--borde); display: grid; gap: .5rem;
}
.switch { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.switch input { width: 1.15rem; height: 1.15rem; accent-color: var(--acento); }
.ajustes-nota { margin: 0; font-size: .78rem; color: var(--texto-tenue); }

/* --- listas --- */
.grupo { padding: 1rem 1rem 0; }
.grupo-titulo {
  margin: 0 0 .6rem; font-size: .75rem; letter-spacing: .09em;
  text-transform: uppercase; color: var(--texto-tenue);
}
.grupo ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }

.clase {
  background: var(--superficie); border: 1px solid transparent;
  border-radius: var(--radio); padding: .85rem;
}
.clase.vista { border-color: var(--ok); }
.clase-cabecera { display: flex; gap: .75rem; align-items: flex-start; }

/* El check es la acción principal: objetivo táctil grande. */
.check { flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; position: relative; }
.check input { position: absolute; opacity: 0; width: 44px; height: 44px; margin: 0; cursor: pointer; }
.check-caja {
  width: 26px; height: 26px; border: 2px solid var(--texto-tenue);
  border-radius: 8px; display: grid; place-items: center;
}
.check input:checked + .check-caja { background: var(--ok); border-color: var(--ok); }
.check input:checked + .check-caja::after { content: "✓"; color: #06283d; font-weight: 700; }
.check input:focus-visible + .check-caja { outline: 2px solid var(--acento); outline-offset: 2px; }

.clase-texto { min-width: 0; }
.clase-titulo { margin: .35rem 0 .25rem; font-size: 1rem; }
.clase-temas { margin: 0; padding-left: 1.1rem; color: var(--texto-tenue); font-size: .84rem; }
.clase-temas li { margin: .1rem 0; }

.clase-controles {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .7rem;
}
.campo-fecha, .campo-reemplaza { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--texto-tenue); }
.campo-fecha input, .campo-reemplaza select { width: auto; padding: .4rem .5rem; font-size: .85rem; }
.btn-nota { margin-left: auto; background: var(--superficie-alta); color: var(--texto); font-size: .8rem; padding: .45rem .8rem; }
.btn-nota.con-contenido::after { content: " ·"; color: var(--acento); }
.clase-nota { margin-top: .6rem; }

@media (min-width: 620px) {
  .cabecera, .grupo { max-width: 46rem; margin-inline: auto; }
  h1 { font-size: 1.4rem; }
}
