:root {
  --fondo: #fbf7f0; --papel: #ffffff; --tinta: #2b2622; --suave: #6f665e; --linea: #e8dfd2;
  --acento: #d9603b; --acento-hover: #c24f2c; --acento-claro: #fbe6dc;
  --verde: #3f7d5a; --verde-claro: #e3f1e8; --rojo: #b3261e; --rojo-claro: #fbe4e2;
  --radio: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fondo); color: var(--tinta); font: 16px/1.5 "Nunito", system-ui, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-family: "Fraunces", Georgia, serif; font-size: clamp(28px, 6vw, 38px); margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--suave); margin: 0 0 16px; }
a { color: var(--acento-hover); }

/* Barra superior */
.barra { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.marca { font-family: "Fraunces", Georgia, serif; font-size: 20px; color: var(--tinta); text-decoration: none; }
.marca-texto span { color: var(--acento); }
.enlace { background: none; border: 0; font: inherit; color: var(--suave); cursor: pointer; text-decoration: underline; padding: 4px; }

.subtitulo { color: var(--suave); font-size: 15px; margin-bottom: 24px; }
.tarjeta { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); padding: 24px; margin-bottom: 20px; }
@media (max-width: 520px) { .tarjeta { padding: 18px; } }

/* Formularios */
label { display: block; font-weight: 700; margin-bottom: 6px; }
.ayuda { font-weight: 400; color: var(--suave); font-size: 14px; }
.campo { margin-bottom: 20px; }
.campo:last-child { margin-bottom: 0; }
input, select, textarea { width: 100%; font: inherit; color: inherit; background: #fffdfa; border: 1.5px solid var(--linea); border-radius: 10px; padding: 11px 13px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-claro); }
textarea { min-height: 110px; resize: vertical; }
.fila { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fila-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .fila, .fila-3 { grid-template-columns: 1fr; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--linea); background: #fffdfa; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 15px; cursor: pointer; color: var(--tinta); }
.chip[aria-pressed="true"] { background: var(--acento-claro); border-color: var(--acento); color: var(--acento-hover); font-weight: 700; }
.agregar { display: flex; gap: 8px; }
.agregar input { flex: 1; }
.quitar { margin-left: 6px; font-weight: 700; }

/* Botones */
.principal { display: block; width: 100%; text-align: center; text-decoration: none; background: var(--acento); color: #fff; border: 0; border-radius: 12px; padding: 16px; font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; }
.principal:hover { background: var(--acento-hover); }
.principal:disabled, .principal[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.secundario { border: 1.5px solid var(--linea); background: #fffdfa; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 700; cursor: pointer; color: var(--tinta); }
.secundario:hover { border-color: var(--acento); }

/* Mensajes */
.aviso { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: 15px; }
.aviso.ok { background: var(--verde-claro); color: var(--verde); }
.aviso.error { background: var(--rojo-claro); color: var(--rojo); }
.oculto { display: none !important; }

/* Estado de generación */
.trabajando { display: flex; gap: 14px; align-items: center; }
.giro { width: 28px; height: 28px; border: 3px solid var(--acento-claro); border-top-color: var(--acento); border-radius: 50%; animation: g 1s linear infinite; flex: none; }
@keyframes g { to { transform: rotate(360deg); } }
.listo { border-color: var(--verde); background: var(--verde-claro); }
.fallo { border-color: var(--rojo); background: var(--rojo-claro); color: var(--rojo); }
.descargar { display: inline-block; background: var(--verde); color: #fff; text-decoration: none; font-weight: 700; border-radius: 10px; padding: 12px 18px; margin: 8px 0 14px; }
ul.detalle { margin: 6px 0 0; padding-left: 20px; }

/* Historial */
.historial a { display: block; color: var(--tinta); text-decoration: none; padding: 10px 0; border-bottom: 1px solid var(--linea); }
.historial a:last-child { border-bottom: 0; }
.historial a:hover { color: var(--acento); }
.vacio { color: var(--suave); margin: 0; }
.item-historial { padding: 12px 0; border-bottom: 1px solid var(--linea); }
.item-historial:last-child { border-bottom: 0; }
.item-historial .nombre-plan { font-weight: 700; margin-bottom: 4px; }
.item-historial .acciones { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 15px; }
.item-historial .acciones a, .item-historial .acciones .enlace { color: var(--acento-hover); text-decoration: none; padding: 0; font-size: 15px; }
.item-historial .acciones a:hover, .item-historial .acciones .enlace:hover { text-decoration: underline; }

/* Resumen de perfil */
.resumen-perfil { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.resumen-perfil .nombre { font-weight: 700; font-size: 18px; }
.resumen-perfil .detalle-escuela { color: var(--suave); font-size: 15px; }

/* Login */
.centro { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.caja-login { width: 100%; max-width: 400px; }
.caja-login h1 { text-align: center; margin-bottom: 4px; }
.caja-login .subtitulo { text-align: center; }

/* ---------- Menú común ---------- */
.nav-arriba { position: sticky; top: 0; z-index: 20; background: rgba(251, 247, 240, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--linea); }
.nav-contenido { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 20px; }
.nav-enlaces { display: flex; gap: 4px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; color: var(--tinta); text-decoration: none; font-weight: 700; font-size: 15px; }
.nav-item:hover { background: var(--acento-claro); }
.nav-item[aria-current="page"] { background: var(--acento); color: #fff; }
.nav-abajo { display: none; }
.pie-portal { text-align: center; color: var(--suave); font-size: 13px; padding: 20px 16px 28px; }
.pie-portal a, .pie-portal .enlace { color: var(--suave); font-size: 13px; }
@media (max-width: 720px) {
  .nav-enlaces, .nav-contenido > .nav-salir { display: none; }
  .nav-abajo { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid var(--linea); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .nav-abajo .nav-item { flex: 1; flex-direction: column; gap: 2px; font-size: 12px; padding: 6px 4px; text-align: center; }
  .nav-abajo .nav-icono { font-size: 20px; }
  body { padding-bottom: 72px; }
}

/* ---------- Panel ---------- */
.accesos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
@media (max-width: 560px) { .accesos { grid-template-columns: 1fr; } }
.acceso { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--tinta); background: var(--papel); border: 1.5px solid var(--linea); border-radius: var(--radio); padding: 18px; }
.acceso:hover { border-color: var(--acento); box-shadow: 0 4px 16px rgba(217, 96, 59, .12); }
.acceso .icono-grande { font-size: 30px; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 14px; background: var(--acento-claro); flex: none; }
.acceso.verde .icono-grande { background: var(--verde-claro); }
.acceso strong { display: block; font-size: 18px; }
.acceso span { color: var(--suave); font-size: 14px; }
.cabecera-seccion { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.cabecera-seccion h2 { margin: 0; }
.cabecera-seccion input { max-width: 260px; padding: 8px 12px; }

/* ---------- Banco: dos columnas ---------- */
.banco-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.banco-lado { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto; }
.banco-lado .tarjeta { margin-bottom: 14px; }
.vista-previa { background: #e9e3da; border-radius: 10px; padding: 10px; text-align: center; min-height: 120px; display: grid; place-items: center; }
.vista-previa img { width: 100%; height: auto; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); border-radius: 2px; display: block; }
.vista-pie { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--suave); margin-top: 8px; }
.vista-pie button { border: 1px solid var(--linea); background: #fff; border-radius: 8px; width: 30px; height: 28px; cursor: pointer; }
.cajon-boton { display: none; }
@media (max-width: 900px) {
  .banco-layout { grid-template-columns: 1fr; }
  .banco-lado { position: fixed; left: 0; right: 0; bottom: 64px; top: auto; max-height: 72vh; z-index: 15; background: var(--fondo);
                border-top: 2px solid var(--acento); border-radius: 18px 18px 0 0; padding: 0 12px 12px; transform: translateY(calc(100% - 52px));
                transition: transform .25s ease; box-shadow: 0 -6px 24px rgba(0, 0, 0, .12); }
  .banco-lado.abierto { transform: none; }
  .cajon-boton { display: flex; justify-content: space-between; align-items: center; width: 100%; height: 52px; background: none; border: 0;
                 font: inherit; font-weight: 700; color: var(--tinta); cursor: pointer; position: sticky; top: 0; background: var(--fondo); z-index: 1; }
  main.banco { padding-bottom: 140px; }
}
@media (min-width: 721px) and (max-width: 900px) { .banco-lado { bottom: 0; } }

/* ---------- Inicio (rediseño) ---------- */
main.inicio { max-width: 1040px; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap;
        background: linear-gradient(135deg, #fff 0%, #fdf1ea 100%); border: 1px solid var(--linea); border-radius: 20px;
        padding: 28px 30px; margin-bottom: 22px; }
.hero h1 { margin: 2px 0 6px; }
.hero-fecha { margin: 0; color: var(--acento-hover); font-weight: 700; font-size: 14px; }
.hero-bajada { margin: 0; color: var(--suave); font-size: 17px; }
.hero-escuela { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; font-size: 14px; color: var(--suave); }
.hero-escuela strong { color: var(--tinta); font-size: 16px; }
.etiqueta { display: inline-block; background: var(--acento); color: #fff; font-weight: 700; font-size: 13px; padding: 3px 12px; border-radius: 999px; margin-bottom: 4px; }
@media (max-width: 640px) { .hero { padding: 22px 20px; } .hero-escuela { align-items: flex-start; text-align: left; } }

.acciones-grandes { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 16px; margin-bottom: 28px; }
@media (max-width: 860px) { .acciones-grandes { grid-template-columns: 1fr; } }
.accion { display: flex; align-items: center; gap: 16px; padding: 22px 20px; min-height: 112px; text-align: left; font: inherit;
          background: var(--papel); color: var(--tinta); text-decoration: none; border: 1.5px solid var(--linea); border-radius: 18px;
          cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.accion:hover { transform: translateY(-2px); border-color: var(--acento); box-shadow: 0 10px 24px rgba(43, 38, 34, .08); }
.accion-icono { flex: none; width: 58px; height: 58px; display: grid; place-items: center; font-size: 30px; border-radius: 16px; background: var(--acento-claro); }
.accion-icono.verde { background: var(--verde-claro); }
.accion-icono.gris { background: #f1ece5; }
.accion-texto { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.accion-texto strong { font-size: 19px; line-height: 1.2; }
.accion-texto small { font-size: 14px; color: var(--suave); line-height: 1.35; }
.accion-flecha { font-size: 22px; color: var(--suave); }
.accion-principal { background: var(--acento); border-color: var(--acento); color: #fff; }
.accion-principal .accion-icono { background: rgba(255, 255, 255, .22); }
.accion-principal .accion-texto small, .accion-principal .accion-flecha { color: rgba(255, 255, 255, .9); }
.accion-principal:hover { border-color: var(--acento-hover); background: var(--acento-hover); }

.bloque { background: var(--papel); border: 1px solid var(--linea); border-radius: 20px; padding: 24px; margin-bottom: 22px; }
.bloque-cabecera { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.titulo-bloque { font-family: "Fraunces", Georgia, serif; font-size: 24px; text-transform: none; letter-spacing: 0; color: var(--tinta); margin: 0; }
.bloque-cabecera .ayuda { margin: 2px 0 0; }
.buscador { display: flex; align-items: center; gap: 8px; background: #fffdfa; border: 1.5px solid var(--linea); border-radius: 12px; padding: 0 12px; min-width: 260px; margin: 0; font-weight: 400; }
.buscador:focus-within { border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-claro); }
.buscador input { border: 0; background: transparent; padding: 11px 0; box-shadow: none !important; }
@media (max-width: 560px) { .buscador { min-width: 0; width: 100%; } }

.lista-planeaciones { display: flex; flex-direction: column; gap: 10px; }
.fila-plan { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--linea); border-radius: 14px; background: #fffdfa; }
.fila-plan:hover { border-color: #e2c9b8; }
.fila-plan-icono { flex: none; width: 44px; height: 44px; display: grid; place-items: center; font-size: 22px; border-radius: 12px; background: var(--acento-claro); }
.fila-plan-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fila-plan-texto strong { font-size: 16px; }
.fila-plan-texto span { font-size: 14px; color: var(--suave); }
.fila-plan-botones { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 680px) { .fila-plan { flex-wrap: wrap; } .fila-plan-botones { width: 100%; justify-content: stretch; } .fila-plan-botones .boton { flex: 1; } }

.boton { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px;
         font: inherit; font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.boton-solido { background: var(--acento); color: #fff; border: 1.5px solid var(--acento); }
.boton-solido:hover { background: var(--acento-hover); }
.boton-borde { background: #fff; color: var(--tinta); border: 1.5px solid var(--linea); }
.boton-borde:hover { border-color: var(--acento); color: var(--acento-hover); }
.boton:disabled { opacity: .6; cursor: progress; }
.vacio-grande { text-align: center; padding: 30px 10px; color: var(--suave); }
.vacio-grande span { font-size: 40px; }
.vacio-grande p { margin: 8px 0 0; }

/* ---------- Banco (rediseño) ---------- */
.formatos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .formatos { grid-template-columns: 1fr 1fr; } }
.formato { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px; text-align: center; font: inherit;
           background: #fffdfa; color: var(--tinta); border: 2px solid var(--linea); border-radius: 16px; cursor: pointer;
           transition: border-color .12s ease, background .12s ease; }
.formato:hover { border-color: #e7b9a6; }
.formato[aria-pressed="true"] { border-color: var(--acento); background: var(--acento-claro); }
.formato-icono { font-size: 30px; line-height: 1; margin-bottom: 4px; }
.formato strong { font-size: 16px; }
.formato small { font-size: 13px; color: var(--suave); line-height: 1.3; }
.segmentos { display: inline-flex; background: #f1ece5; border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.segmento { border: 0; background: transparent; font: inherit; font-weight: 700; padding: 9px 16px; border-radius: 9px; cursor: pointer; color: var(--suave); }
.segmento[aria-pressed="true"] { background: #fff; color: var(--tinta); box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
.figura { position: relative; }
.figura.elegida::after { content: "✓"; position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
                         background: var(--verde); color: #fff; font-weight: 700; font-size: 14px; display: grid; place-items: center; }
.banco h2 { font-size: 13px; }

/* ---------- Íconos de línea (Lucide) ---------- */
.icono { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.marca { display: inline-flex; align-items: center; gap: 8px; font-family: "Fraunces", Georgia, serif; font-size: 20px; color: var(--tinta); text-decoration: none; }
.marca-logo { width: 32px; height: 32px; border-radius: 9px; background: var(--acento); color: #fff; display: grid; place-items: center; }
.marca-logo .icono { width: 19px; height: 19px; }
.nav-icono { display: inline-flex; }
.nav-icono .icono { width: 19px; height: 19px; }
.nav-abajo .nav-icono .icono { width: 22px; height: 22px; }
.nav-salir { display: inline-flex; align-items: center; gap: 6px; }
.accion-icono .icono { width: 28px; height: 28px; }
.accion-icono { color: var(--acento-hover); }
.accion-icono.verde { color: var(--verde); }
.accion-icono.gris { color: #7a6f65; }
.accion-principal .accion-icono { color: #fff; }
.accion-flecha { display: inline-flex; }
.accion-flecha .icono { width: 22px; height: 22px; }
.buscador > .icono { color: var(--suave); width: 18px; height: 18px; }
.fila-plan-icono { color: var(--acento-hover); }
.fila-plan-icono .icono { width: 22px; height: 22px; }
.boton .icono { width: 17px; height: 17px; }
.vacio-grande .icono { width: 42px; height: 42px; color: #c9bdb0; }
.formato-icono { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: #f3ede6; color: #7a6f65; margin-bottom: 6px; }
.formato-icono .icono { width: 26px; height: 26px; }
.formato[aria-pressed="true"] .formato-icono { background: var(--acento); color: #fff; }
.segmento { display: inline-flex; align-items: center; gap: 7px; }
.segmento .icono { width: 18px; height: 18px; }
.vista-pie button { display: grid; place-items: center; }
.vista-pie button .icono { width: 16px; height: 16px; }
.principal .icono { width: 20px; height: 20px; margin-right: 4px; }
.descargar .icono { width: 18px; height: 18px; margin-right: 2px; }
.logo-login { width: 64px; height: 64px; border-radius: 18px; background: var(--acento); color: #fff; display: grid; place-items: center; margin: 0 auto 12px; }
.logo-login .icono { width: 34px; height: 34px; }

/* ---------- Ajustes para celulares angostos ---------- */
/* Los campos (sobre todo los de fecha) traen un ancho mínimo propio que los saca de su caja. */
input, select, textarea { min-width: 0; max-width: 100%; }
input[type="date"] { -webkit-appearance: none; appearance: none; display: block; min-height: 46px; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.fila > *, .fila-3 > *, .banco-layout > *, .formatos > *, .accion-texto, .fila-plan-texto { min-width: 0; }
.agregar { flex-wrap: wrap; }
.agregar input { flex: 1 1 170px; }
.agregar .secundario { flex: 0 0 auto; min-height: 46px; }
.segmentos { display: flex; width: 100%; max-width: 420px; }
.segmento { flex: 1; justify-content: center; min-width: 0; padding: 9px 10px; }
@media (max-width: 400px) {
  main { padding-left: 12px; padding-right: 12px; }
  .tarjeta, .bloque { padding: 16px; }
  .hero { padding: 20px 16px; }
  .accion { padding: 16px; gap: 12px; }
  .accion-icono { width: 48px; height: 48px; }
  .formato { padding: 12px 6px; }
  .formato small { font-size: 12px; }
  .rejilla { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
  .chip { padding: 6px 11px; font-size: 14px; }
}
