:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1c2333;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #3b4b8f;
  --primary-dark: #2d3a70;
  --accent: #c9a227;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--ink); min-height: 100vh;
}
a { color: var(--primary); }
h1, h2, h3 { font-weight: 600; }

/* ── Auth ─────────────────────────────────────────── */
.auth-screen {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center;
  background: linear-gradient(140deg, #2d3a70 0%, #3b4b8f 55%, #55639f 100%);
  padding: 16px;
}
.auth-screen.visible { display: flex; }
.auth-card {
  background: var(--surface); border-radius: 16px; padding: 34px 30px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.auth-card h1 { color: var(--primary-dark); margin-bottom: 4px; letter-spacing: .5px; }
.auth-card .sub { color: var(--muted); margin-bottom: 20px; font-size: 14px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.auth-tabs button {
  flex: 1; padding: 9px; border: 1px solid var(--line); background: #f9fafb;
  border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted);
}
.auth-tabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.auth-card input, .auth-card select {
  width: 100%; padding: 11px 12px; margin-bottom: 11px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
}
.auth-card input:focus { outline: 2px solid var(--primary); border-color: transparent; }

/* ── Form controls ────────────────────────────────── */
input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
textarea { resize: vertical; min-height: 70px; }
label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin: 10px 0 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border: none; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600; text-decoration: none; transition: filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-gold { background: var(--accent); color: #2b2405; }
.btn-danger { background: var(--err); color: #fff; }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--line); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Layout panel (sidebar) ───────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 230px; z-index: 40;
  background: #232a45; color: #cbd2ea; display: flex; flex-direction: column;
  transition: transform .2s;
}
.sidebar-logo { padding: 22px 20px 14px; font-size: 19px; font-weight: 700; color: #fff; letter-spacing: 1px; }
.sidebar-logo small { display: block; font-size: 11px; color: #8e97be; font-weight: 400; letter-spacing: 0; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 10px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px; margin-bottom: 2px;
  border-radius: 8px; cursor: pointer; font-size: 14px;
}
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { font-size: 10px; opacity: .7; }
.sidebar-footer { padding: 14px; }
.hamburger {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 50;
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  width: 40px; height: 40px; font-size: 19px; cursor: pointer;
}
.main { margin-left: 230px; padding: 24px 28px 60px; }
.top-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.top-header h1 { font-size: 22px; }

/* ── Layout estudiante (top nav) ──────────────────── */
.student-header {
  background:
    linear-gradient(100deg, rgba(31,38,74,.97) 22%, rgba(36,45,88,.72) 55%, rgba(31,38,74,.45)),
    url('/presentacion/img/las_meninas.jpg') center 30% / cover no-repeat;
  color: #fff; padding: 26px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.student-header .brand { font-weight: 700; font-size: 20px; font-family: Georgia, serif; letter-spacing: .5px; }
.student-header .brand small { display: block; font-weight: 400; font-size: 12.5px; color: #c3cbef; font-family: 'Segoe UI', sans-serif; letter-spacing: 0; }
.student-header .who { font-size: 13px; color: #d5dbf2; text-align: right; }
.student-tabs {
  display: flex; gap: 4px; background: var(--surface); padding: 8px 14px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  overflow-x: auto;
}
.student-tabs button {
  border: none; background: transparent; padding: 9px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.student-tabs button.active { background: #eef1fb; color: var(--primary); }
.student-content { max-width: 860px; margin: 0 auto; padding: 22px 16px 70px; }

/* ── Cards / tables ───────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
}
.card h3 { margin-bottom: 6px; }
.card .meta { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 14px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
th { text-align: left; padding: 11px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); border-bottom: 1px solid var(--line); background: #fafbfc; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .3px;
}
.badge-ok { background: #dcfce7; color: #15803d; }
.badge-warn { background: #fef3c7; color: #b45309; }
.badge-err { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #e0e7ff; color: #3b4b8f; }
.badge-muted { background: #f3f4f6; color: #6b7280; }

/* Timeline ruta pedagógica */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline .card { position: relative; }
.timeline .card::before {
  content: ''; position: absolute; left: -24px; top: 24px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary);
}

/* ── Modal / toast ────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 90; display: none;
  background: rgba(15, 20, 40, .55); align-items: flex-start; justify-content: center;
  padding: 40px 14px; overflow-y: auto;
}
.modal-overlay.visible { display: flex; }
.modal-content {
  background: var(--surface); border-radius: 14px; width: 100%; max-width: 620px;
  padding: 22px; box-shadow: 0 24px 70px rgba(0,0,0,.35);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-close { border: none; background: none; font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1; }

#toast-container { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 11px 16px; border-radius: 10px; color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: 0; transform: translateY(8px); transition: all .25s;
  max-width: 340px;
}
.toast.visible { opacity: 1; transform: none; }
.toast-success { background: var(--ok); }
.toast-error { background: var(--err); }
.toast-info { background: var(--primary); }

.empty { text-align: center; color: var(--muted); padding: 36px 10px; font-size: 14.5px; }
.empty .big { font-size: 46px; margin-bottom: 10px; }

/* ── Vista estudiante: iconos y portadas ─────────── */
.icircle {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 23px;
}
.ic-indigo { background: #e0e7ff; }
.ic-amber { background: #fef3c7; }
.ic-green { background: #dcfce7; }
.ic-rose { background: #ffe4e6; }
.ic-slate { background: #f1f5f9; }

.cover {
  width: 76px; min-height: 100px; border-radius: 10px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; font-family: Georgia, serif; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 3px 8px rgba(16,24,40,.18);
}
.cover b { font-size: 24px; letter-spacing: 1px; }
.cover span { font-size: 15px; margin-top: 4px; opacity: .85; }

.upload-box {
  margin-top: 12px; background: #f8f9fc; border: 1.5px dashed #c6cde3; border-radius: 10px;
  padding: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.upload-box input[type=file] { flex: 1; min-width: 190px; background: transparent; border: none; padding: 4px; }
.upload-box input[type=text] { flex: 1; min-width: 150px; }

.nota-box { margin-top: 12px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 13px 15px; }

/* ── Mural de progreso (Las Meninas por fragmentos) ── */
.mural {
  display: grid; gap: 5px; margin: 0 auto;
  padding: 10px; background: #2b2317; border-radius: 12px;
  box-shadow: inset 0 0 0 3px #8a6d3b, 0 10px 30px rgba(0,0,0,.25);
}
.tile {
  position: relative; aspect-ratio: 1 / 1.15; border-radius: 4px; overflow: hidden;
  background-repeat: no-repeat; cursor: pointer; transition: transform .2s, filter .4s;
}
.tile.open:hover, .tile.done:hover { transform: scale(1.06); z-index: 2; }
.tile.locked { filter: grayscale(1) brightness(.38); cursor: not-allowed; }
.tile.open { filter: none; box-shadow: inset 0 0 0 2px rgba(212,175,55,.65); }
.tile.done { filter: none; box-shadow: inset 0 0 0 2px #16a34a; }
.tile .t-num {
  position: absolute; top: 4px; left: 5px; font-size: 11px; font-weight: 800;
  background: rgba(10,13,26,.75); color: #fff; border-radius: 6px; padding: 1px 6px;
}
.tile .t-ico {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.8);
}
.tile .t-done {
  align-items: flex-end; justify-content: flex-end; padding: 4px 6px; font-size: 15px;
  color: #4ade80; font-weight: 800;
}
.sesion-chip { display: inline-block; background: #eef1fb; color: var(--primary); font-weight: 700; font-size: 12px; border-radius: 6px; padding: 2px 9px; margin-right: 8px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.mt { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .hamburger { display: block; }
  .main { margin-left: 0; padding: 64px 14px 60px; }
}
