:root {
  --primary: #1e3a5f;
  --primary-light: #2d5286;
  --primary-dark: #142844;
  --accent: #c9a84c;
  --accent-light: #e2c46d;
  --bg: #f0f3f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --text: #1a2332;
  --text-muted: #64748b;
  --border: #dde3ec;
  --success: #16a34a;
  --error: #dc2626;
  --warning: #d97706;
  --info: #2563eb;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 3px 10px rgba(0,0,0,0.10);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.14);
  --transition: 0.2s ease;
  --nav-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── NAVIGATION ──────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--primary);
  display: flex; align-items: center;
  padding: 0 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}
.nav-brand {
  display: flex; align-items: center; gap: 12px;
  color: white; font-size: 1.1rem; font-weight: 700;
  flex-shrink: 0;
}
.nav-brand .shield {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--primary);
  flex-shrink: 0;
}
.nav-links {
  display: flex; align-items: center; gap: 4px;
  margin-left: 32px; flex: 1;
}
.nav-links a {
  color: rgba(255,255,255,0.8);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}
.nav-links a:hover,
.nav-links a.active { color: white; background: rgba(255,255,255,0.12); }
.nav-links a.active { color: var(--accent-light); }
.nav-right {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
}
.nav-user {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  display: flex; align-items: center; gap: 6px;
}
.nav-user span { font-weight: 600; color: white; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  border: none; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-accent { background: var(--accent); color: var(--primary-dark); }
.btn-accent:hover { background: var(--accent-light); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-outline {
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--border); color: var(--text); }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* ── FORMS ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,95,0.1); }
.form-control::placeholder { color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 20px 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-primary { background: rgba(30,58,95,0.1); color: var(--primary); }
.badge-accent { background: rgba(201,168,76,0.15); color: #8a6f1e; }
.badge-success { background: rgba(22,163,74,0.1); color: var(--success); }
.badge-error { background: rgba(220,38,38,0.1); color: var(--error); }
.badge-warning { background: rgba(217,119,6,0.1); color: var(--warning); }
.badge-muted { background: var(--border); color: var(--text-muted); }

/* ── ALERTS ──────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-error { background: rgba(220,38,38,0.08); border: 1px solid rgba(220,38,38,0.2); color: #991b1b; }
.alert-success { background: rgba(22,163,74,0.08); border: 1px solid rgba(22,163,74,0.2); color: #15803d; }
.alert-info { background: rgba(37,99,235,0.08); border: 1px solid rgba(37,99,235,0.2); color: #1d4ed8; }
.alert-warning { background: rgba(217,119,6,0.08); border: 1px solid rgba(217,119,6,0.2); color: #92400e; }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
#crop-editor-modal { z-index: 600; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none; border: none;
  color: var(--text-muted); font-size: 1.4rem;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── SPINNER ─────────────────────────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
.spinner-sm { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PROGRESS ────────────────────────────────────────────── */
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar {
  height: 100%; background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ── DIVIDER ─────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── LAYOUT UTILITIES ────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 760px; margin: 0 auto; padding: 0 24px; }
.section { padding: 48px 0; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
}
.login-hero {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.login-box {
  width: 100%; max-width: 420px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.login-header {
  background: var(--primary);
  padding: 32px;
  text-align: center;
}
.login-logo {
  width: 64px; height: 64px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 900;
  color: var(--primary);
  margin: 0 auto 16px;
}
.login-title { color: white; font-size: 1.3rem; font-weight: 800; }
.login-subtitle { color: rgba(255,255,255,0.65); font-size: 0.85rem; margin-top: 4px; }
.login-body { padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.login-footer {
  background: var(--surface-2);
  padding: 16px 32px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   PUBLIC — HERO
═══════════════════════════════════════════════════════════ */
.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  padding: 80px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-content { position: relative; max-width: 700px; margin: 0 auto; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(201,168,76,0.2);
  border: 1px solid rgba(201,168,76,0.4);
  color: var(--accent-light);
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 0.8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 20px;
}
.hero h1 {
  color: white;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 16px;
}
.hero h1 em { color: var(--accent-light); font-style: normal; }
.hero p { color: rgba(255,255,255,0.7); font-size: 1.1rem; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  display: flex; gap: 40px; justify-content: center;
  margin-top: 48px; padding-top: 32px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.hero-stat { text-align: center; }
.hero-stat-value { font-size: 2rem; font-weight: 900; color: var(--accent-light); }
.hero-stat-label { font-size: 0.8rem; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.05em; }

/* ═══════════════════════════════════════════════════════════
   PUBLIC — SEARCH
═══════════════════════════════════════════════════════════ */
.search-bar {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex; align-items: center;
  overflow: hidden;
  max-width: 640px; margin: 0 auto;
}
.search-bar input {
  flex: 1; border: none; outline: none;
  padding: 14px 18px;
  font-size: 1rem; color: var(--text);
  background: transparent;
}
.search-bar button {
  background: var(--primary); color: white; border: none;
  padding: 14px 22px;
  font-size: 1rem;
  transition: var(--transition);
}
.search-bar button:hover { background: var(--primary-light); }
.search-filters {
  display: flex; gap: 12px; flex-wrap: wrap;
  max-width: 640px; margin: 12px auto 0;
}
.search-filter-select {
  flex: 1; min-width: 160px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}
.search-filter-select:focus { border-color: var(--primary); }
.search-results { margin-top: 32px; }
.search-count { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 16px; }

/* ── STUDENT CARDS GRID ──────────────────────────────────── */
.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}
.student-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}
.student-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--primary); }
.student-photo {
  width: 100%; aspect-ratio: 3/4;
  object-fit: cover; object-position: center top;
  background: var(--surface-2);
}
.student-photo-placeholder {
  width: 100%; aspect-ratio: 3/4;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: rgba(255,255,255,0.4);
}
.student-info { padding: 6px 8px 8px; }
.student-name { font-size: 0.72rem; font-weight: 700; line-height: 1.25; margin-bottom: 2px; }
.student-meta { font-size: 0.65rem; color: var(--text-muted); }

/* ── STUDENT DETAIL MODAL ────────────────────────────────── */
.student-detail-photo {
  width: 160px; height: 200px;
  object-fit: cover; object-position: center top;
  border-radius: var(--radius);
  border: 3px solid var(--border);
  float: left; margin: 0 20px 16px 0;
}
.student-detail-info { overflow: hidden; }
.student-detail-info h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; }
.student-detail-attrs { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.student-detail-attr { font-size: 0.9rem; display: flex; gap: 8px; }
.student-detail-attr strong { color: var(--text-muted); min-width: 80px; }

/* ═══════════════════════════════════════════════════════════
   PUBLIC — ORLAS GALLERY
═══════════════════════════════════════════════════════════ */
.section-header { margin-bottom: 28px; }
.section-title { font-size: 1.6rem; font-weight: 800; }
.section-subtitle { font-size: 0.95rem; color: var(--text-muted); margin-top: 4px; }
.orlas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.orla-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}
.orla-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.orla-thumbnail {
  width: 100%; height: 110px;
  object-fit: cover;
  background: var(--primary);
}
.orla-thumbnail-placeholder {
  width: 100%; height: 110px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.3); font-size: 2rem;
}
.orla-info { padding: 8px 10px 6px; }
.orla-title { font-size: 0.82rem; font-weight: 700; }
.orla-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.orla-footer {
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between;
}

/* ── VIEW TOGGLE ─────────────────────────────────────────── */
.view-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}
.view-toggle-btn {
  border: none; background: transparent;
  padding: 8px 14px;
  font-size: 1.05rem; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  min-width: 42px;
}
.view-toggle-btn:hover { background: var(--surface-2); }
.view-toggle-btn.active { background: var(--primary); color: white; }

/* ── ORLAS PILLS VIEW ────────────────────────────────────── */
.orlas-pills { display: flex; flex-direction: column; gap: 10px; }
.orla-pill {
  display: flex; align-items: stretch; gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.orla-pill:hover { box-shadow: var(--shadow); border-color: var(--primary); transform: translateX(2px); }
.orla-pill-photo {
  width: 46px; min-width: 46px; height: 46px;
  object-fit: cover;
  background: var(--primary);
  align-self: center;
  margin: 6px;
  border-radius: var(--radius);
}
.orla-pill-photo-ph {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: rgba(255,255,255,0.3); font-size: 1.1rem;
}
.orla-pill-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 6px 12px;
}
.orla-pill-title { font-size: 0.9rem; font-weight: 700; line-height: 1.2; }
.orla-pill-meta { font-size: 0.76rem; color: var(--text-muted); margin-top: 1px; }
.orla-pill-badge {
  align-self: center;
  margin-right: 12px;
  flex-shrink: 0;
}

/* ── MOBILE BACK BUTTON ──────────────────────────────────── */
.mobile-back {
  display: none;
  align-items: center; gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 0.88rem; font-weight: 600;
  color: var(--primary);
  margin-bottom: 16px;
  cursor: pointer;
  transition: var(--transition);
}
.mobile-back:hover { background: var(--primary); color: white; }

/* ═══════════════════════════════════════════════════════════
   PUBLIC — COURSES
═══════════════════════════════════════════════════════════ */
.courses-list { display: flex; flex-direction: column; gap: 12px; }
.course-item {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px 20px;
  display: flex; align-items: center; gap: 16px;
  cursor: pointer;
  transition: var(--transition);
}
.course-item:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.course-year {
  background: var(--primary);
  color: var(--accent-light);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.8rem; font-weight: 800;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.course-name { font-weight: 700; font-size: 1rem; flex: 1; }
.course-count { font-size: 0.85rem; color: var(--text-muted); flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════
   ADMIN PANEL
═══════════════════════════════════════════════════════════ */
.admin-layout {
  display: flex; min-height: calc(100vh - var(--nav-h));
}
.admin-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.admin-sidebar-section { padding: 0 16px; margin-bottom: 8px; }
.admin-sidebar-label {
  font-size: 0.72rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em;
  padding: 12px 8px 6px;
}
.admin-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 500;
  color: var(--text);
  transition: var(--transition);
  cursor: pointer;
}
.admin-nav-link:hover { background: var(--bg); }
.admin-nav-link.active { background: rgba(30,58,95,0.08); color: var(--primary); font-weight: 700; }
.admin-nav-link .icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.admin-main { flex: 1; padding: 32px; min-width: 0; }
.admin-page { display: none; }
.admin-page.active { display: block; }
.admin-page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px;
}
.admin-page-title { font-size: 1.5rem; font-weight: 800; }
.admin-page-subtitle { font-size: 0.9rem; color: var(--text-muted); margin-top: 4px; }

/* ── STEPS ───────────────────────────────────────────────── */
.steps {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 32px;
}
.step {
  display: flex; align-items: center; gap: 10px;
  flex: 1;
}
.step:not(:last-child)::after {
  content: '';
  flex: 1; height: 2px;
  background: var(--border);
  margin: 0 8px;
  transition: var(--transition);
}
.step.done:not(:last-child)::after { background: var(--success); }
.step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--border); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700;
  flex-shrink: 0;
  transition: var(--transition);
}
.step.active .step-num { background: var(--primary); color: white; }
.step.done .step-num { background: var(--success); color: white; }
.step-label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.step.active .step-label { color: var(--primary); }
.step.done .step-label { color: var(--success); }

/* ── ORLA UPLOAD ZONE ────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(30,58,95,0.03);
}
.upload-zone .upload-icon { font-size: 3rem; margin-bottom: 12px; color: var(--text-muted); }
.upload-zone h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.upload-zone p { font-size: 0.88rem; color: var(--text-muted); }
.upload-zone input[type=file] { display: none; }
.upload-preview {
  position: relative; display: inline-block;
  max-width: 100%;
}
.upload-preview img {
  max-height: 400px; border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.upload-preview-remove {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.6); color: white;
  border: none; border-radius: 50%;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer;
  transition: var(--transition);
}
.upload-preview-remove:hover { background: var(--error); }

/* ── PROMPT BOX ──────────────────────────────────────────── */
.prompt-box {
  background: #0f1923;
  color: #e0e8f0;
  border-radius: var(--radius);
  padding: 20px;
  font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  white-space: pre-wrap;
  position: relative;
  border: 1px solid rgba(255,255,255,0.08);
}
.prompt-copy-btn {
  position: absolute; top: 12px; right: 12px;
  background: var(--accent); color: var(--primary-dark);
  border: none; border-radius: var(--radius);
  padding: 6px 14px; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; transition: var(--transition);
}
.prompt-copy-btn:hover { background: var(--accent-light); }
.prompt-copy-btn.copied { background: var(--success); color: white; }

/* ── JSON INPUT ──────────────────────────────────────────── */
.json-textarea {
  width: 100%; min-height: 180px;
  background: #0f1923; color: #e0e8f0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 16px;
  font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: var(--transition);
}
.json-textarea:focus { border-color: var(--accent); }

/* ── PREVIEW GRID ────────────────────────────────────────── */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  max-height: 600px;
  overflow-y: auto;
  padding: 4px;
}
.preview-student {
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}
.preview-student.excluded { opacity: 0.4; border-color: var(--error); }
.draft-student-img-wrap {
  position: relative; cursor: pointer;
}
.draft-student-img-wrap:hover img { opacity: .85; }

/* Zona del nombre (modo cuadrícula) */
.name-zone-img {
  display: block; width: 100%;
  border-top: 1px solid var(--border);
  border-radius: 0 0 2px 2px;
  opacity: .85;
  margin-top: 4px;
}

/* ── Editor de cuadrícula ── */
.gline { transition: opacity .1s; }
.gline:hover { opacity: .8; }
#grid-editor-container { min-height: 200px; }
#grid-editor-container img { display: block; width: 100%; pointer-events: none; }
.draft-crop-hint {
  position: absolute; bottom: 3px; right: 3px;
  background: rgba(0,0,0,.55); color: white;
  font-size: .6rem; padding: 1px 4px; border-radius: 3px;
  pointer-events: none;
}
.preview-student img {
  width: 100%; aspect-ratio: 3/4;
  object-fit: cover; object-position: center top;
}
.preview-student-info { padding: 8px; }
.preview-student-info input {
  width: 100%; border: none; outline: none;
  background: transparent; font-size: 0.78rem;
  font-weight: 600; color: var(--text);
  padding: 0;
}
.preview-student-info input:focus { color: var(--primary); }
.preview-exclude-btn {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,0.5); color: white;
  border: none; border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; cursor: pointer;
  transition: var(--transition);
}
.preview-exclude-btn:hover { background: var(--error); }

/* ── ORLA TABLE ──────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse;
  font-size: 0.9rem;
}
thead th {
  background: var(--surface-2);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
.td-thumb {
  width: 60px; height: 40px;
  object-fit: cover; border-radius: 4px;
  background: var(--border);
}

/* ── STATS CARDS ─────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px 24px;
  display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon-primary { background: rgba(30,58,95,0.1); }
.stat-icon-accent { background: rgba(201,168,76,0.15); }
.stat-icon-success { background: rgba(22,163,74,0.1); }
.stat-value { font-size: 1.8rem; font-weight: 900; line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 0.9rem; max-width: 360px; margin: 0 auto; }

/* ═══════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════ */
.footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 24px;
  font-size: 0.82rem;
  margin-top: auto;
}
.footer strong { color: rgba(255,255,255,0.8); }

/* ═══════════════════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  font-size: 0.9rem; font-weight: 500;
  min-width: 280px; max-width: 400px;
  border-left: 4px solid transparent;
  animation: toast-in 0.3s ease;
}
.toast-success { border-color: var(--success); }
.toast-error { border-color: var(--error); }
.toast-info { border-color: var(--info); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── ADMIN STUDENT GRID ──────────────────────────────────────── */
.admin-students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.admin-student-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: var(--transition);
}
.admin-student-card:hover { box-shadow: var(--shadow); border-color: var(--primary); }
.admin-student-card.unknown { border-color: var(--warning); background: rgba(217,119,6,.04); }
.admin-student-card img {
  width: 100%; aspect-ratio: 3/4;
  object-fit: cover; object-position: top;
  display: block;
}
.admin-student-no-photo {
  width: 100%; aspect-ratio: 3/4;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: var(--text-muted);
}
.admin-student-info { padding: 8px 10px 4px; flex: 1; }
.admin-student-name { font-size: .78rem; font-weight: 700; line-height: 1.25; }
.admin-student-unknown { font-size: .68rem; color: var(--warning); font-weight: 700; margin-top: 2px; }
.admin-student-edit-btn {
  width: 100%; padding: 7px;
  border: none; border-top: 1px solid var(--border);
  background: var(--surface-2); color: var(--primary);
  font-size: .78rem; font-weight: 700;
  cursor: pointer; transition: var(--transition);
}
.admin-student-edit-btn:hover { background: var(--primary); color: white; }
.admin-student-card.unknown .admin-student-edit-btn {
  background: rgba(217,119,6,.1); color: var(--warning);
  border-top-color: rgba(217,119,6,.2);
}
.admin-student-card.unknown .admin-student-edit-btn:hover {
  background: var(--warning); color: white;
}

/* ── ORLA REFERENCE PANEL ───────────────────────────────────── */
.orla-ref-panel {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(201,168,76,0.12);
}
.orla-ref-thumb {
  height: 56px; width: 90px;
  object-fit: cover;
  border-radius: 4px;
  cursor: zoom-in;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: var(--transition);
}
.orla-ref-thumb:hover { border-color: var(--accent); transform: scale(1.04); }
.orla-ref-info { flex: 1; min-width: 0; }
.orla-ref-label { font-size: .75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.orla-ref-filename { font-size: .85rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

/* ── ORLA ZOOM MODAL ─────────────────────────────────────── */
#orla-zoom-modal {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.96);
  display: none; flex-direction: column;
}
.orla-zoom-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}
.orla-zoom-controls {
  display: flex; align-items: center; gap: 6px;
}
.orla-zoom-filename {
  color: rgba(255,255,255,0.5); font-size: .82rem;
  margin-right: 8px;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.orla-zoom-btn {
  color: rgba(255,255,255,0.8) !important;
  font-size: 1.1rem !important;
  width: 32px; height: 32px; padding: 0 !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
  border-radius: var(--radius) !important;
}
.orla-zoom-btn:hover { background: rgba(255,255,255,0.1) !important; }
.orla-zoom-level {
  color: rgba(255,255,255,0.7); font-size: .85rem; font-weight: 700;
  min-width: 44px; text-align: center;
}
.orla-zoom-close {
  color: rgba(255,255,255,0.8) !important;
  font-size: .9rem !important;
}
#orla-zoom-container {
  flex: 1; overflow: auto;
  display: flex; align-items: flex-start; justify-content: flex-start;
  padding: 20px;
  cursor: grab;
}
#orla-zoom-container:active { cursor: grabbing; }
#orla-zoom-img {
  display: block;
  transform-origin: top left;
  transition: transform 0.08s ease;
  pointer-events: none;
  max-width: none;
  user-select: none;
}

/* ── IMPORT MODE SWITCHER ────────────────────────────────── */
.mode-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.mode-option {
  display: flex; align-items: center; gap: 14px;
  text-align: left;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  cursor: pointer;
  transition: var(--transition);
}
.mode-option:hover { border-color: var(--primary-light); }
.mode-option.active { border-color: var(--primary); background: rgba(30,58,95,0.04); }
.mode-icon { font-size: 1.6rem; flex-shrink: 0; }
.mode-text { display: flex; flex-direction: column; min-width: 0; }
.mode-text strong { font-size: .95rem; }
.mode-text small { font-size: .78rem; color: var(--text-muted); line-height: 1.3; }

/* ── AUTO FILE LIST ──────────────────────────────────────── */
.auto-file-list {
  max-height: 320px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.auto-file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: .85rem;
  border-left: 3px solid transparent;
}
.auto-file-row.status-processing { border-left-color: var(--info); background: rgba(37,99,235,.05); }
.auto-file-row.status-done { border-left-color: var(--success); }
.auto-file-row.status-error { border-left-color: var(--error); background: rgba(220,38,38,.05); }
.auto-file-row.status-skipped { border-left-color: var(--warning); opacity: .7; }
.auto-file-icon { flex-shrink: 0; width: 20px; text-align: center; }
.auto-file-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auto-file-status { flex-shrink: 0; font-size: .78rem; color: var(--text-muted); }

/* ── DRAFT CARDS ─────────────────────────────────────────── */
.draft-thumb {
  width: 64px; height: 42px;
  object-fit: cover; border-radius: 4px;
  cursor: zoom-in; flex-shrink: 0;
  border: 1px solid var(--border);
}
.draft-collapse-btn {
  background: transparent; border: none;
  color: var(--text-muted); font-size: .9rem;
  cursor: pointer; padding: 6px 10px;
  border-radius: var(--radius);
}
.draft-collapse-btn:hover { background: var(--surface-2); }
.draft-card.draft-uploaded { opacity: .65; border-color: var(--success); }
.draft-card.draft-uploaded .draft-thumb { border-color: var(--success); }

/* ── JSON COMPARE PANEL ──────────────────────────────────── */
.json-compare-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.json-compare-panel summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: .85rem; font-weight: 600;
  background: var(--surface-2);
  user-select: none;
}
.json-compare-panel summary:hover { background: var(--border); }
.json-compare-body {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border-top: 1px solid var(--border);
}
.json-compare-col { display: flex; flex-direction: column; }
.json-compare-col:first-child { border-right: 1px solid var(--border); }
.json-compare-label {
  padding: 6px 12px;
  font-size: .72rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.json-pre {
  margin: 0; padding: 12px;
  background: #0f1923; color: #e0e8f0;
  font-size: .72rem; line-height: 1.5;
  overflow: auto; max-height: 260px;
  white-space: pre; tab-size: 2;
}
.json-compare-col .json-textarea {
  flex: 1; min-height: 200px; border-radius: 0;
  border: none; border-top: none;
  font-size: .72rem;
}
.json-diff-output {
  padding: 12px 14px;
  background: #0f1923; color: #9fdb8f;
  font-family: monospace; font-size: .75rem;
  line-height: 1.6; white-space: pre;
  border-top: 1px solid rgba(255,255,255,.08);
  overflow-x: auto;
}
@media (max-width: 768px) {
  .json-compare-body { grid-template-columns: 1fr; }
  .json-compare-col:first-child { border-right: none; border-bottom: 1px solid var(--border); }
}

/* ── HAMBURGER BUTTON ─────────────────────────────────────── */
.nav-hamburger {
  display: none;
  background: transparent; border: none;
  color: white; font-size: 1.3rem;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  border-radius: var(--radius);
  transition: var(--transition);
  flex-shrink: 0;
  cursor: pointer;
}
.nav-hamburger:hover { background: rgba(255,255,255,0.1); }

/* ── MOBILE MENU ─────────────────────────────────────────── */
.mobile-menu {
  position: fixed;
  top: var(--nav-h); left: 0; right: 0; bottom: 0;
  background: var(--primary-dark);
  z-index: 90;
  display: none; flex-direction: column;
  padding: 12px 16px;
  gap: 4px;
  overflow-y: auto;
}
.mobile-menu.active { display: flex; }
.mobile-menu-link {
  display: flex; align-items: center; gap: 14px;
  color: rgba(255,255,255,0.85);
  font-size: 1.05rem; font-weight: 600;
  padding: 15px 16px;
  border-radius: var(--radius);
  transition: var(--transition);
  cursor: pointer;
}
.mobile-menu-link:hover,
.mobile-menu-link.active {
  background: rgba(255,255,255,0.1);
  color: var(--accent-light);
}
.mobile-menu-divider {
  height: 1px; background: rgba(255,255,255,0.1);
  margin: 8px 0;
}
#mobile-auth {
  padding: 8px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
#mobile-auth .btn { justify-content: center; }
#mobile-auth .nav-user {
  color: rgba(255,255,255,0.6);
  font-size: .9rem;
  padding: 8px 0;
}

/* ── ADMIN MOBILE TABS ───────────────────────────────────── */
.admin-mobile-tabs {
  display: none;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}
.admin-mobile-tab {
  flex: 1; padding: 14px 8px;
  border: none; background: transparent;
  font-size: 0.9rem; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.admin-mobile-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Nav */
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .nav-brand-text { font-size: .95rem; }
  .nav-right #nav-auth { display: none; } /* auth va al menú mobile */

  /* Hero */
  .hero { padding: 48px 16px 40px; }
  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: .95rem; }
  .hero-actions { flex-direction: column; align-items: center; }
  .hero-actions .btn { width: 100%; max-width: 320px; }
  .hero-stats { gap: 16px; flex-wrap: wrap; justify-content: center; }
  .hero-badge { font-size: .72rem; }

  /* Botón volver (solo móvil) */
  .mobile-back { display: inline-flex; }

  /* Search */
  .search-filters { flex-direction: column; }
  .search-filter-select { min-width: 0; }

  /* Grids: mínimo 5 fotos de alumnos por fila */
  .students-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .student-name { font-size: .62rem; }
  .student-meta { font-size: .56rem; }
  .orlas-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .admin-students-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }

  /* Orla pills en móvil */
  .orla-pill-photo { width: 42px; min-width: 42px; height: 42px; }
  .orla-pill-title { font-size: .85rem; }
  .orla-pill-meta { font-size: .72rem; }
  .orla-pill-badge { margin-right: 10px; font-size: .66rem; }

  /* Admin */
  .admin-mobile-tabs { display: flex; }
  .admin-sidebar { display: none; }
  .admin-main { padding: 16px; }
  .admin-page-header { flex-direction: column; align-items: flex-start; gap: 12px; }

  /* Steps: solo números */
  .steps .step-label { display: none; }
  .step-num { width: 28px; height: 28px; font-size: .8rem; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; }

  /* Upload */
  .upload-zone { padding: 32px 16px; }
  .upload-zone h3 { font-size: 1rem; }

  /* Mode switcher en columna */
  .mode-switcher { grid-template-columns: 1fr; }

  /* Preview grid */
  .preview-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

  /* Stats */
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .stat-card { padding: 14px 12px; gap: 10px; flex-direction: column; text-align: center; }
  .stat-icon { width: 36px; height: 36px; font-size: 1.1rem; }
  .stat-value { font-size: 1.4rem; }

  /* Modal */
  .modal { margin: 12px; max-width: calc(100vw - 24px) !important; }
  .modal-body { padding: 16px; }

  /* Prompt box */
  .prompt-box { font-size: .75rem; padding: 14px; }
  .prompt-copy-btn { position: static; display: block; margin-bottom: 12px; }

  /* Courses */
  .course-item { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .container, .container-sm { padding: 0 14px; }
  .section { padding: 32px 0; }
  .admin-main { padding: 12px; }
  .card-body { padding: 16px; }
  .card-footer { padding: 12px 16px; }
  .hero-stats { gap: 12px; }
  .hero-stat-value { font-size: 1.6rem; }
  .students-grid { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .stats-row { grid-template-columns: 1fr; }
  /* Nav: ocultar email en pantallas muy pequeñas */
  .nav-user { display: none; }
  .nav-brand-text { display: none; }
}
