:root {
  --primario: #4f46e5; --primario-oscuro: #3730a3; --primario-claro: #eef2ff;
  --cian: #0ea5e9; --verde: #10b981; --verde-osc: #047857; --rojo: #ef4444; --rojo-osc: #b91c1c;
  --ambar: #f59e0b; --ambar-osc: #b45309; --violeta: #8b5cf6; --rosa: #ec4899;
  --gris: #f3f5fb; --borde: #e3e7f0; --texto: #1e2437; --muted: #6b7489;
  --azul: var(--primario); --azul-claro: var(--primario-claro);
  --sombra: 0 1px 2px rgba(30,36,55,.05), 0 6px 20px rgba(30,36,55,.06);
  --radio: 14px; --lateral: 260px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       font-size: 15px; color: var(--texto); background: var(--gris); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0 0 .6em; letter-spacing: -.01em; }
h2 { font-size: 1.5rem; } h3 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.error { color: var(--rojo); min-height: 1.2em; }
.ico { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; flex: none; }

/* ---------- Layout con barra lateral ---------- */
#app { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--lateral); z-index: 30; display: flex; flex-direction: column;
  background: linear-gradient(175deg, #1e1b4b 0%, #312e81 55%, #4338ca 100%); color: #e0e7ff; transition: transform .25s; }
.brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.1rem 1rem; }
.brand-logo { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; overflow: hidden;
  background: #fff; color: #fff; font-size: 1.4rem; box-shadow: 0 4px 14px rgba(0,0,0,.25); padding: 3px; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-logo .ico { width: 24px; height: 24px; }
.brand-nombre { font-weight: 700; font-size: .85rem; color: #fff; line-height: 1.1; }
.brand-sub { font-size: .75rem; color: #a5b4fc; }
#menu { flex: 1; overflow-y: auto; padding: .25rem .7rem 1rem; }
#menu::-webkit-scrollbar { width: 6px; } #menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }
.menu-grupo { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: #818cf8; margin: 1rem .6rem .35rem; font-weight: 700; }
#menu a { display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border-radius: 10px; cursor: pointer;
  color: #c7d2fe; text-decoration: none; margin-bottom: 2px; font-weight: 500; transition: background .15s, color .15s, transform .15s; }
#menu a .ico { width: 1.25rem; height: 1.25rem; opacity: .9; }
#menu a:hover { background: rgba(255,255,255,.1); color: #fff; transform: translateX(2px); }
#menu a.activo { background: linear-gradient(90deg, #6366f1, #8b5cf6); color: #fff; font-weight: 600; box-shadow: 0 4px 14px rgba(99,102,241,.45); }
.sidebar-pie { display: flex; align-items: center; gap: .5rem; padding: .9rem; border-top: 1px solid rgba(255,255,255,.12); }
.user-chip { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none;
  background: linear-gradient(135deg, #f472b6, #8b5cf6); }
.user-datos { min-width: 0; }
.user-email { font-size: .8rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-rol { font-size: .7rem; color: #a5b4fc; text-transform: capitalize; }
.btn-salir { background: rgba(255,255,255,.1); border: 0; color: #fff; width: 36px; height: 36px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.btn-salir:hover { background: rgba(239,68,68,.6); }
.contenido { margin-left: var(--lateral); min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .75rem; padding: .85rem 1.5rem;
  background: rgba(243,245,251,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--borde); }
.topbar-titulo { font-weight: 700; font-size: 1.05rem; flex: 1; }
.topbar-fecha { color: var(--muted); font-size: .85rem; text-transform: capitalize; }
.burger { display: none; background: #fff; border: 1px solid var(--borde); border-radius: 10px; width: 40px; height: 40px; cursor: pointer; place-items: center; }
.sidebar-velo { display: none; }
main { max-width: 1280px; margin: 1.25rem auto; padding: 0 1.5rem 3rem; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.abierto { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .sidebar.abierto + .sidebar-velo { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 25; }
  .contenido { margin-left: 0; }
  .burger { display: grid; }
  main { padding: 0 .9rem 3rem; }
  .topbar-fecha { display: none; }
}

/* ---------- Tarjetas, formularios, botones ---------- */
.card { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--sombra); }
.card h3 { display: flex; align-items: center; gap: .5rem; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); font-weight: 500; }
input, select, textarea { font: inherit; padding: .6rem .75rem; border: 1px solid var(--borde); border-radius: 10px; color: var(--texto); background: #fff; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primario); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .85rem; }
.grid .full { grid-column: 1 / -1; }
.acciones { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; margin: .75rem 0; }
.acciones .espacio { flex: 1; }
.btn { font: inherit; font-weight: 600; font-size: .9rem; border: 1px solid var(--borde); background: #fff; color: var(--texto);
  padding: .55rem 1rem; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; transition: transform .1s, box-shadow .15s, filter .15s; text-decoration: none; }
.btn:hover { filter: brightness(.97); box-shadow: 0 3px 10px rgba(30,36,55,.1); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; border-color: transparent; }
.btn.ok { background: linear-gradient(135deg, #10b981, #059669); color: #fff; border-color: transparent; }
.btn.danger { color: var(--rojo-osc); border-color: #fecaca; background: #fef2f2; }
.btn.small { padding: .3rem .65rem; font-size: .8rem; border-radius: 8px; }
.btn.grande { padding: .8rem 1rem; font-size: 1rem; justify-content: center; }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }

/* ---------- Tablas ---------- */
.tabla-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: .65rem .7rem; border-bottom: 1px solid var(--borde); vertical-align: middle; }
th { background: #f8f9fd; font-size: .74rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
tbody tr { transition: background .12s; } tbody tr:hover td { background: #f7f8ff; }
td.num, th.num { text-align: right; white-space: nowrap; }
.vacio { text-align: center; color: var(--muted); padding: 2.5rem; }

/* ---------- Etiquetas ---------- */
.tag { display: inline-block; padding: .18rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 700; text-transform: capitalize; }
.tag.pagada, .tag.presente, .tag.aprobado { background: #d1fae5; color: var(--verde-osc); }
.tag.pendiente, .tag.tardanza { background: #fef3c7; color: var(--ambar-osc); }
.tag.vencida, .tag.ausente, .tag.reprobado, .tag.anulado { background: #fee2e2; color: var(--rojo-osc); }
.tag.anulada, .tag.baja { background: #e5e7eb; color: #4b5563; }
.tag.activa, .tag.admin { background: #e0e7ff; color: var(--primario-oscuro); }
.tag.justificado, .tag.secretaria { background: #cffafe; color: #0e7490; }

/* ---------- Inicio: indicadores ---------- */
.saludo { background: linear-gradient(120deg, #4f46e5 0%, #7c3aed 55%, #db2777 100%); color: #fff; border-radius: 18px; padding: 1.5rem 1.75rem;
  margin-bottom: 1.1rem; position: relative; overflow: hidden; box-shadow: 0 10px 30px rgba(79,70,229,.3); }
.saludo::after { content: ""; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.12); }
.saludo::before { content: ""; position: absolute; right: 90px; bottom: -80px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.09); }
.saludo h2 { margin: 0 0 .2rem; font-size: 1.6rem; } .saludo p { margin: 0; opacity: .9; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.kpi { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.1rem 1.2rem; display: flex; gap: .9rem; align-items: center;
  box-shadow: var(--sombra); transition: transform .15s, box-shadow .15s; }
.kpi:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(30,36,55,.12); }
.kpi-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; flex: none; }
.kpi-ico .ico { width: 24px; height: 24px; }
.kpi .muted { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi > div:last-child { min-width: 0; }
.kpi .valor { font-size: clamp(1.05rem, 1.5vw, 1.3rem); white-space: nowrap; font-weight: 800; margin-top: .1rem; letter-spacing: -.02em; }
.c-indigo .kpi-ico { background: linear-gradient(135deg, #818cf8, #4f46e5); }
.c-verde .kpi-ico { background: linear-gradient(135deg, #34d399, #059669); }
.c-ambar .kpi-ico { background: linear-gradient(135deg, #fbbf24, #d97706); }
.c-rojo .kpi-ico { background: linear-gradient(135deg, #fb7185, #dc2626); }
.c-cian .kpi-ico { background: linear-gradient(135deg, #22d3ee, #0284c7); }
.c-violeta .kpi-ico { background: linear-gradient(135deg, #c084fc, #7c3aed); }
.c-rosa .kpi-ico { background: linear-gradient(135deg, #f472b6, #db2777); }
.fila-graficos { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; margin-top: 1rem; }
.fila-graficos.iguales { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .fila-graficos, .fila-graficos.iguales { grid-template-columns: 1fr; } }
.grafico { position: relative; height: 290px; }
.grafico.alto { height: 340px; }
.barra-prog { height: 10px; border-radius: 6px; background: #e5e7eb; overflow: hidden; min-width: 90px; }
.barra-prog > i { display: block; height: 100%; background: linear-gradient(90deg, #34d399, #059669); border-radius: 6px; }
.acceso-rapido { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin-top: 1rem; }
.acceso { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1rem .5rem; border-radius: var(--radio); background: #fff;
  border: 1px solid var(--borde); cursor: pointer; font-weight: 600; box-shadow: var(--sombra); transition: transform .15s, border-color .15s; }
.acceso:hover { transform: translateY(-3px); border-color: var(--primario); }
.acceso .kpi-ico { width: 44px; height: 44px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #1e1b4b, #4338ca 55%, #7c3aed); }
.login-fondo span { position: absolute; border-radius: 50%; background: rgba(255,255,255,.07); }
.login-fondo span:nth-child(1) { width: 420px; height: 420px; left: -120px; top: -140px; }
.login-fondo span:nth-child(2) { width: 300px; height: 300px; right: -80px; bottom: -80px; background: rgba(34,211,238,.15); }
.login-fondo span:nth-child(3) { width: 160px; height: 160px; right: 18%; top: 12%; background: rgba(244,114,182,.15); }
.login-fondo span:nth-child(4) { width: 90px; height: 90px; left: 12%; bottom: 10%; background: rgba(250,204,21,.15); }
.login-panel { position: relative; display: grid; grid-template-columns: 1.05fr 1fr; width: min(880px, 94vw); background: #fff; border-radius: 26px; overflow: hidden; box-shadow: 0 30px 70px rgba(0,0,0,.4); }
.login-marca { background: linear-gradient(160deg, #312e81, #4f46e5 60%, #7c3aed); color: #fff; padding: 2.2rem 2rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .6rem; position: relative; overflow: hidden; }
.login-marca::before { content: ""; position: absolute; width: 280px; height: 280px; border-radius: 50%; background: rgba(255,255,255,.07); right: -90px; top: -90px; }
.login-marca::after { content: ""; position: absolute; width: 200px; height: 200px; border-radius: 50%; background: rgba(34,211,238,.14); left: -70px; bottom: -70px; }
.login-marca > * { position: relative; z-index: 1; }
.login-logo { width: 150px; height: 150px; display: grid; place-items: center; background: #fff; border-radius: 28px; padding: 10px; overflow: hidden; box-shadow: 0 10px 28px rgba(0,0,0,.3); }
.login-logo .ico { width: 36px; height: 36px; } .login-logo img { width: 100%; height: 100%; object-fit: contain; }
.login-marca h1 { margin: .8rem 0 0; font-family: inherit; font-size: 1.7rem; letter-spacing: .05em; font-weight: 800; }
.login-lema { margin: 0; color: #c7d2fe; line-height: 1.5; font-size: .95rem; }
.login-puntos { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .45rem; font-size: .9rem; color: #e0e7ff; }
.login-puntos li::before { content: "✓"; display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: .5rem; border-radius: 50%; background: rgba(255,255,255,.18); font-size: .7rem; }
.login-lugar { margin: 1rem 0 0; font-size: .8rem; color: #a5b4fc; letter-spacing: .08em; text-transform: uppercase; }
.login-card { display: flex; flex-direction: column; justify-content: center; gap: .9rem; padding: 2.4rem 2.4rem 1.6rem; }
.login-card h2 { margin: 0; font-size: 1.7rem; }
.login-sub { color: var(--muted); margin: -.4rem 0 .4rem; }
.login-card .campo { position: relative; display: flex; align-items: center; }
.login-card .campo svg { position: absolute; left: .8rem; width: 18px; height: 18px; color: #9aa3b8; pointer-events: none; }
.login-card .campo input { width: 100%; padding-left: 2.5rem; }
.login-card .ver-pass { position: absolute; right: .5rem; border: 0; background: none; color: var(--primario); font-weight: 600; font-size: .8rem; cursor: pointer; padding: .3rem .4rem; }
.login-card .grande { padding: .8rem 1rem; font-size: 1rem; margin-top: .3rem; }
.login-pie { text-align: center; color: #9aa3b8; font-size: .8rem; margin: .4rem 0 0; }
@media (max-width: 760px) {
  .login { padding: 1rem 0; }
  .login-panel { grid-template-columns: 1fr; width: min(420px, 94vw); }
  .login-marca { padding: 1.4rem 1rem; } .login-puntos, .login-lugar { display: none; }
  .login-logo { width: 96px; height: 96px; padding: 8px; border-radius: 20px; } .login-marca h1 { font-size: 1.4rem; margin-top: .4rem; }
  .login-card { padding: 1.6rem 1.4rem 1.2rem; }
}

/* ---------- Modal y avisos ---------- */
dialog { border: none; border-radius: 18px; padding: 1.5rem; width: min(760px, 95vw); box-shadow: 0 30px 80px rgba(15,23,42,.35); max-height: 92vh; }
dialog::backdrop { background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); }
.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%) translateY(20px); background: #1e2437; color: #fff; padding: .8rem 1.3rem;
  border-radius: 12px; opacity: 0; transition: all .25s; pointer-events: none; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.toast.ver { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--rojo-osc); }

/* ---------- Asistencia / notas ---------- */
.asist-btns { display: inline-flex; gap: 4px; }
.asist-btns button { border: 1px solid var(--borde); background: #fff; border-radius: 8px; padding: .3rem .6rem; font-size: .78rem; font-weight: 700; cursor: pointer; color: var(--muted); }
.asist-btns button.on.presente { background: #10b981; color: #fff; border-color: #10b981; }
.asist-btns button.on.ausente { background: #ef4444; color: #fff; border-color: #ef4444; }
.asist-btns button.on.tardanza { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.asist-btns button.on.justificado { background: #0ea5e9; color: #fff; border-color: #0ea5e9; }
input.nota { width: 78px; text-align: center; font-weight: 700; }
input.nota.baja-nota { border-color: var(--rojo); background: #fef2f2; }

/* ---------- Recibo imprimible ---------- */
.recibo { font-size: 1rem; line-height: 1.55; border: 2px solid var(--texto); border-radius: 10px; padding: 1.25rem; }
.recibo .cab { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--texto); margin-bottom: 1rem; padding-bottom: .75rem; }
.recibo .cab img { height: 56px; margin-right: .75rem; vertical-align: middle; }
.recibo .anulado-sello { position: absolute; font-size: 3rem; color: rgba(239,68,68,.35); transform: rotate(-20deg); font-weight: 900; border: 6px solid rgba(239,68,68,.35); padding: .2rem 1rem; border-radius: 12px; right: 3rem; top: 45%; }
.recibo { position: relative; }
.boletin h2 { text-align: center; }
@media print {
  body * { visibility: hidden; }
  #modal, #modal * { visibility: visible; }
  #modal { position: absolute; inset: 0; width: 100%; max-height: none; box-shadow: none; }
  .no-print { display: none !important; }
}

/* Historial del alumno y pase de año */
.historial { list-style: none; margin: .4rem 0 .8rem; padding: 0; display: grid; gap: .3rem; font-size: .9rem; }
.historial li { padding-left: .9rem; position: relative; }
.historial li::before { content: ""; position: absolute; left: 0; top: .55em; width: 6px; height: 6px; border-radius: 50%; background: var(--primario, #6366f1); }
.pase-fila.ya { opacity: .55; }
.pase-resumen { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
.pase-resumen span { background: #eef2ff; color: #3730a3; border-radius: 999px; padding: .15rem .7rem; font-size: .85rem; font-weight: 600; }

/* nombres de alumnos más discretos en las tablas */
td b, td strong, .modal b, .modal h3 { font-weight: 600; }
td b, td strong { font-size: .85rem; }
.modal h3 { font-size: 1.05rem; }
td { font-size: .9rem; }

.grafico canvas { cursor: pointer; }
.card-cab { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.card-cab h3 { margin: 0; }
.card-cab select { padding: .3rem .5rem; font-size: .85rem; width: auto; }

/* barras de filtros: todo alineado abajo y los casilleros a la altura de los campos */
.acciones { align-items: flex-end; }
.acciones > h3 { align-self: center; }
.acciones > label[style*="flex-direction:row"] { min-height: 40px; align-self: flex-end; }
.ayuda { margin: -.4rem 0 1rem; color: var(--muted); font-size: .9rem; max-width: 70ch; }
