/* ── Paleta JHMC Oficial ───────────────────────────────────── */
:root {
  --azul:   #1C3154;
  --gold:   #C9A84C;
  --gold2:  #F1C400;
  --negro:  #1A1A1A;
  --blanco: #FFFFFF;
  --azul-oscuro: #111E33;
  --azul-claro:  #E8EDF5;
  --gris:   #F4F6F9;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--gris); color: var(--negro); font-size: 14px; }
a { text-decoration: none; color: inherit; }

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  background: var(--azul);
  color: var(--blanco);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  border-bottom: 3px solid var(--gold);
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-brand img { height: 44px; width: auto; object-fit: contain; }
.topbar-sub { font-size: 11px; opacity: .7; color: var(--gold2); }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.btn-logout {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.28);
  color: var(--blanco);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background .2s;
}
.btn-logout:hover { background: rgba(255,255,255,.22); }

/* ── Layout ────────────────────────────────────────────────── */
.layout { display: flex; min-height: calc(100vh - 60px); }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--azul-oscuro);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar a {
  display: block;
  padding: 10px 20px;
  color: rgba(255,255,255,.72);
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all .2s;
}
.sidebar a:hover, .sidebar a.active {
  background: rgba(201,168,76,.12);
  color: var(--blanco);
  border-left-color: var(--gold);
}

/* ── Main ──────────────────────────────────────────────────── */
.main-content { flex: 1; padding: 24px; overflow-x: auto; }
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--azul);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gold);
}

/* ── Cards ─────────────────────────────────────────────────── */
.card { background: var(--blanco); border-radius: 8px; padding: 20px; box-shadow: 0 1px 4px rgba(28,49,84,.1); margin-bottom: 20px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--azul); }

/* ── Stats ─────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--blanco); border-radius: 8px; padding: 16px; text-align: center; box-shadow: 0 1px 4px rgba(28,49,84,.1); border-top: 3px solid var(--azul); }
.stat-num   { font-size: 32px; font-weight: 800; color: var(--azul); }
.stat-label { font-size: 12px; color: #64748b; margin-top: 4px; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert { padding: 10px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.alert-info    { background: var(--azul-claro); color: var(--azul); border: 1px solid #b8c9e0; }

/* ── Botones ───────────────────────────────────────────────── */
.btn { display: inline-block; padding: 7px 16px; border-radius: 5px; border: none; cursor: pointer; font-size: 13px; font-weight: 600; transition: opacity .2s; }
.btn:hover { opacity: .85; }
.btn-primary   { background: var(--azul); color: var(--blanco); }
.btn-success   { background: #16a34a; color: var(--blanco); }
.btn-danger    { background: #dc2626; color: var(--blanco); }
.btn-warning   { background: #d97706; color: var(--blanco); }
.btn-secondary { background: #64748b; color: var(--blanco); }
.btn-sm        { padding: 4px 10px; font-size: 12px; }

/* ── Formularios ───────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: #374151; }
.form-control { width: 100%; padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 5px; font-size: 13px; }
.form-control:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 2px rgba(28,49,84,.15); }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }

/* ── Tablas ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table       { border-collapse: collapse; width: 100%; font-size: 13px; }
thead th    { background: var(--azul); color: var(--blanco); padding: 9px 12px; text-align: left; white-space: nowrap; font-weight: 600; }
tbody tr:hover { background: var(--azul-claro); }
tbody td    { padding: 8px 12px; border-bottom: 1px solid #e2e8f0; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red   { background: #fee2e2; color: #991b1b; }
.badge-gray  { background: #f1f5f9; color: #475569; }
.badge-blue  { background: var(--azul-claro); color: var(--azul); }

/* ── Tabla notas docente ────────────────────────────────────── */
.notas-table th { font-size: 11px; padding: 6px 4px; white-space: normal; max-width: 90px; word-break: break-word; line-height: 1.3; vertical-align: bottom; text-align: center; }
.notas-table td { padding: 4px; }
.nota-input {
  width: 52px; text-align: center; padding: 4px;
  border: 1px solid #d1d5db; border-radius: 4px;
  font-size: 13px; text-transform: uppercase;
}
.nota-input:focus    { outline: none; border-color: var(--azul); background: var(--azul-claro); }
.nota-input.ok       { border-color: #16a34a; background: #f0fdf4; }
.nota-input.ausente  { border-color: #d97706; background: #fffbeb; color: #92400e; }
.nota-input.sinexamen{ border-color: #94a3b8; background: #f8fafc; color: #475569; }
.nota-input.error    { border-color: #dc2626; background: #fef2f2; }

/* ── Notas alumno ───────────────────────────────────────────── */
.aprobado    { color: #16a34a; font-weight: 700; }
.desaprobado { color: #dc2626; font-weight: 700; }

/* ── Login ──────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, var(--azul-oscuro) 0%, var(--azul) 60%, #2a4a7f 100%);
}
.login-card {
  background: #1C3154 !important;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  border-top: 5px solid #C9A84C;
}
.login-card .form-group label { color: rgba(255,255,255,.8); }
.login-card .form-control { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
.login-card .form-control::placeholder { color: rgba(255,255,255,.4); }
.login-card .form-control:focus { border-color: var(--gold); background: rgba(255,255,255,.15); }
.login-card .btn-primary { background: var(--gold); color: var(--negro); }
.login-card .btn-primary:hover { background: var(--gold2); }
.login-card .alert-error { background: rgba(220,38,38,.2); border-color: rgba(220,38,38,.4); color: #fca5a5; }
.login-logo { text-align: center; margin-bottom: 24px; overflow: hidden; }
.login-logo img  { max-width: 200px; width: 100%; height: auto; object-fit: contain; display: block; margin: 0 auto; }
.login-logo .logo-sub { font-size: 11px; color: rgba(255,255,255,.6); margin-top: 8px; display: block; }
.login-card h2 { font-size: 15px; font-weight: 600; margin-bottom: 20px; text-align: center; color: rgba(255,255,255,.9); }
.login-card a { color: var(--gold2); }

/* ── Alumno topbar ──────────────────────────────────────────── */
.alumno-topbar {
  background: var(--azul);
  color: var(--blanco);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 58px;
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
}
.alumno-topbar img { height: 42px; width: auto; object-fit: contain; }
.alumno-topbar .nombre-al { font-size: 12px; opacity: .85; }
.btn-salir { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); color: var(--blanco); padding: 4px 12px; border-radius: 4px; font-size: 12px; cursor: pointer; }

/* ── Alumno card ────────────────────────────────────────────── */
.alumno-card { max-width: 960px; margin: 0 auto; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 24px rgba(28,49,84,.2); }
.alumno-header { background: var(--azul); color: var(--blanco); text-align: center; padding: 24px 16px 18px; border-bottom: 4px solid var(--gold); }
.alumno-header img { height: 56px; width: auto; object-fit: contain; margin-bottom: 10px; display: block; margin-left: auto; margin-right: auto; }
.titulo-principal { font-size: clamp(13px,4vw,18px); font-weight: 800; letter-spacing: .5px; line-height: 1.3; }
.titulo-sub { font-size: clamp(10px,2.5vw,12px); color: var(--gold2); margin-top: 4px; }
.alumno-body { background: var(--blanco); padding: clamp(14px,4vw,28px); }

.info-alumno { background: var(--azul-claro); border-radius: 8px; padding: 12px 16px; margin-bottom: 20px; display: flex; flex-wrap: wrap; gap: 10px 24px; border-left: 4px solid var(--gold); }
.info-item label { font-size: 10px; color: #64748b; display: block; text-transform: uppercase; }
.info-item span  { font-weight: 700; font-size: 14px; color: var(--azul); }

/* ── Tabla notas alumno ─────────────────────────────────────── */
.notas-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; border: 1px solid #e2e8f0; }
.notas-scroll table { border-collapse: collapse; width: 100%; min-width: 320px; font-size: clamp(11px,2.5vw,13px); }
.notas-scroll thead th { background: var(--azul); color: var(--blanco); padding: 8px 5px; text-align: center; white-space: normal; font-size: clamp(10px,2vw,12px); max-width: 80px; word-break: break-word; line-height: 1.3; vertical-align: bottom; }
.notas-scroll thead th:first-child { text-align: left; padding-left: 10px; min-width: 70px; max-width: none; white-space: nowrap; }
.notas-scroll .th-prom { background: var(--azul-oscuro) !important; }
.notas-scroll tbody td { padding: 7px 5px; border-bottom: 1px solid #f1f5f9; text-align: center; }
.notas-scroll tbody td:first-child { text-align: left; padding-left: 10px; font-weight: 600; white-space: nowrap; font-size: 12px; }
.notas-scroll tbody tr:hover { background: var(--azul-claro); }
.td-prom   { background: #f0fdf4; font-weight: 700; }
.fila-prom { background: var(--azul-claro) !important; font-weight: 700; }
.fila-prom td:first-child { color: var(--azul); }
.val-aprobado    { color: #16a34a; font-weight: 700; }
.val-desaprobado { color: #dc2626; font-weight: 700; }
.val-guion       { color: #9ca3af; }
.val-ausente     { color: #d97706; font-style: italic; }
.leyenda { font-size: 11px; color: #94a3b8; margin-top: 12px; text-align: center; line-height: 1.8; }

/* Búsqueda alumno */
.busqueda-wrap { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.busqueda-wrap input { flex: 1; min-width: 160px; padding: 10px 14px; border: 2px solid #d1d5db; border-radius: 8px; font-size: 16px; outline: none; transition: border-color .2s; }
.busqueda-wrap input:focus { border-color: var(--azul); box-shadow: 0 0 0 3px rgba(28,49,84,.1); }
.busqueda-wrap button { padding: 10px 20px; background: var(--azul); color: var(--blanco); border: none; border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; transition: background .2s; }
.busqueda-wrap button:hover { background: var(--azul-oscuro); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 700px) {
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .alumno-wrap { padding: 10px 6px; }
  .alumno-body { padding: 12px 8px; }
}
