/* ============================================================
   Pase Escolar — hoja de estilo base (referencia: muestra.jpg)
   Paleta clara, tarjetas blancas redondeadas, azul primario.
   ============================================================ */

:root {
  --azul: #2f6bff;
  --azul-600: #2457d6;
  --azul-050: #eef3ff;
  --tinta: #1a2233;
  --tinta-60: #5b6577;
  --tinta-40: #8b93a3;
  --linea: #e8ecf3;
  --fondo: #f4f7fb;
  --blanco: #ffffff;
  --ok: #17a673;
  --ok-bg: #e5f6ef;
  --warn: #d9822b;
  --warn-bg: #fbefe0;
  --err: #d64545;
  --err-bg: #fbe6e6;
  --sombra: 0 1px 2px rgba(20, 30, 55, .04), 0 8px 24px rgba(20, 30, 55, .06);
  --radio: 16px;
  --radio-sm: 10px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--fondo);
  color: var(--tinta);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; }

/* ---------- Layout con sidebar ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--blanco);
  border-right: 1px solid var(--linea);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; }
.brand-badge {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--azul); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; letter-spacing: .5px;
}
.brand-name { font-weight: 700; font-size: 15px; }
.sidebar .brand { justify-content: center; padding: 4px 4px 18px; }
.sidebar .brand-logo { height: auto; width: 100%; max-width: 150px; object-fit: contain; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radio-sm);
  color: var(--tinta-60);
  font-weight: 500;
}
.nav-item:hover { background: var(--fondo); text-decoration: none; color: var(--tinta); }
.nav-item.is-active { background: var(--azul-050); color: var(--azul-600); font-weight: 600; }
.nav-logout { margin-top: auto; color: var(--tinta-40); }
.ico { width: 19px; height: 19px; flex-shrink: 0; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 32px;
}
.topbar-title { font-size: 22px; margin: 0; }
.topbar-sub { margin: 2px 0 0; color: var(--tinta-40); font-size: 13px; }
.user-chip { display: flex; align-items: center; gap: 9px; background: var(--blanco); border: 1px solid var(--linea); padding: 6px 12px 6px 6px; border-radius: 999px; box-shadow: var(--sombra); }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--azul-050); color: var(--azul-600); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.user-name { font-weight: 600; font-size: 13px; }

.content { padding: 0 32px 48px; max-width: 1080px; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--blanco);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 22px;
  margin-bottom: 20px;
}
.card h2 { font-size: 16px; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.card-title-row h2 { margin: 0; }
.muted { color: var(--tinta-40); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat { background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio); padding: 18px; box-shadow: var(--sombra); }
.stat-num { font-size: 26px; font-weight: 700; }
.stat-label { color: var(--tinta-40); font-size: 12px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--linea); }
table.data th { color: var(--tinta-40); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .4px; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--fondo); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-err { background: var(--err-bg); color: var(--err); }
.badge-mut { background: var(--fondo); color: var(--tinta-60); }

/* ---------- Pills de filtro ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pill {
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--linea); background: var(--blanco);
  color: var(--tinta-60); font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.pill:hover { background: var(--fondo); color: var(--tinta); }
.pill.is-active { background: var(--azul); border-color: var(--azul); color: #fff; }

/* ---------- Formularios ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.field .hint { color: var(--tinta-40); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=time], input[type=date], input[type=search], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--linea);
  border-radius: var(--radio-sm);
  font: inherit;
  color: var(--tinta);
  background: var(--blanco);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-050); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radio-sm);
  border: 1px solid transparent;
  font: inherit; font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--azul); color: #fff; }
.btn-primary:hover { background: var(--azul-600); text-decoration: none; }
.btn-ghost { background: var(--blanco); border-color: var(--linea); color: var(--tinta); }
.btn-ghost:hover { background: var(--fondo); text-decoration: none; }
.btn-danger { background: var(--err-bg); color: var(--err); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---------- Alertas ---------- */
.alert { padding: 12px 16px; border-radius: var(--radio-sm); margin-bottom: 18px; font-weight: 500; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--err-bg); color: var(--err); }
.alert-info { background: var(--azul-050); color: var(--azul-600); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- Login / landing ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); padding: 32px; }
.auth-card .brand { justify-content: center; padding-bottom: 8px; }
.auth-card .brand-logo { height: 135px; width: auto; max-width: 100%; object-fit: contain; }
.auth-card h1 { text-align: center; font-size: 19px; }
.auth-card p.sub { text-align: center; color: var(--tinta-40); margin-top: 0; margin-bottom: 22px; }
.auth-card .btn { width: 100%; justify-content: center; }

/* Ver contrasena */
.pass-wrap { position: relative; display: flex; align-items: center; }
.pass-wrap input { padding-right: 40px; }
.pass-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center;
  height: 26px; width: 26px;
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--tinta-40); line-height: 0;
}
.pass-toggle svg { width: 18px; height: 18px; stroke-width: 1.7; display: block; }
.pass-toggle svg[hidden] { display: none; }
.pass-toggle:hover { color: var(--tinta); }

/* ---------- Vista movil sin sidebar (maestro de puerta) ---------- */
.mobile-body { background: var(--fondo); }
.m-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--blanco);
  border-bottom: 1px solid var(--linea);
}
.m-logo { height: 40px; width: auto; flex-shrink: 0; }
.m-logout { flex-shrink: 0; }
.m-main { max-width: 560px; margin: 0 auto; padding: 16px 14px 88px; }
.m-main .card { margin-bottom: 16px; }
.m-main .m-title { font-size: 20px; margin: 2px 2px 14px; }
.m-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.m-title-row .m-title { margin: 2px 2px 0; }
.m-title-row + * { margin-top: 14px; }
.m-title-row .user-chip { padding: 4px 12px 4px 4px; }
.m-title-row .user-avatar { width: 30px; height: 30px; }
/* Dentro del shell movil las rejillas de dos columnas se apilan */
.m-main .split { grid-template-columns: 1fr; }
.m-main .form-grid { grid-template-columns: 1fr; }

.m-barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; gap: 8px; max-width: 560px; margin: 0 auto;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--blanco); border-top: 1px solid var(--linea);
}
.m-barra .btn { flex: 1; justify-content: center; font-size: 13px; padding: 10px 8px; }

/* Nav inferior con iconos (tutor movil) */
.m-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; max-width: 560px; margin: 0 auto;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--blanco); border-top: 1px solid var(--linea);
}
.m-nav a {
  position: relative; flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px; border-radius: var(--radio-sm);
  color: var(--tinta-40); font-size: 11px; font-weight: 600; text-align: center;
}
.m-nav a:hover { text-decoration: none; }
.m-nav a.is-active { color: var(--azul-600); background: var(--azul-050); }
.m-nav .ico { width: 20px; height: 20px; }
.m-nav-badge {
  position: absolute; top: 2px; left: 50%; transform: translateX(6px);
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--err); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Pantalla de verificacion: foto arriba al centro, luego datos, luego alumnos */
.verif-tutor { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin-bottom: 18px; }
.verif-foto {
  width: 130px; height: 130px; border-radius: 18px; object-fit: cover;
  background: var(--fondo); border: 1px solid var(--linea);
}
.verif-datos { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.verif-nombre { font-size: 19px; font-weight: 700; }
.verif-acciones { margin-top: 18px; justify-content: space-between; }

.alumno-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--linea); border-radius: 10px; padding: 10px 12px;
}
.alumno-row.is-alerta { background: var(--warn-bg); border-color: var(--warn); }
.alumno-info { flex: 1; min-width: 150px; }
.alumno-btn { flex-shrink: 0; }
.alumno-btn.is-done { color: var(--ok); border-color: var(--ok-bg); }
.alumno-acciones { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.alumno-acciones .btn { flex: 1; justify-content: center; }

/* ---------- Utilidades ---------- */
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.stack > * + * { margin-top: 16px; }
.split { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }

/* ---------- Modal (dialog nativo, mismo estilo que las cards) ---------- */
dialog.modal {
  width: calc(100% - 32px); max-width: 520px; margin: auto;
  padding: 0; border: 0; outline: 0; background: transparent; color: var(--tinta);
  box-shadow: none; overflow: visible;
}
dialog.modal:focus, dialog.modal:focus-visible { outline: 0; }
dialog.modal::backdrop { background: rgba(20, 30, 55, .38); backdrop-filter: blur(2px); }
dialog.modal .card { margin-bottom: 0; }
dialog.modal .modal-close {
  background: none; border: 0; font-size: 24px; line-height: 1;
  cursor: pointer; color: var(--tinta-40); padding: 0 2px;
}
dialog.modal .modal-close:hover { color: var(--tinta); }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .sidebar { width: 64px; padding: 22px 10px; }
  .brand-name, .nav-item span { display: none; }
  .nav-item { justify-content: center; }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
}
