[hidden] { display: none !important; }

:root {
  --bg-main: #f1f5f9;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
  --sidebar-bg: #ffffff;
  --primary-blue: #2563eb;
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-dark);
  display: flex;
  height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  position: relative;
}

/* OVERLAY MÓVIL */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* SIDEBAR PERSISTENTE */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
  position: relative;
  z-index: 100;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  padding: 1.25rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  min-height: 70px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  white-space: nowrap;
}

.brand-icon {
  font-size: 1.5rem;
  color: var(--primary-blue);
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text h2 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .menu-text,
.sidebar.collapsed .sidebar-footer-text {
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  margin: 0 !important;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 1.25rem 0;
  cursor: pointer;
}

.sidebar.collapsed .toggle-btn {
  display: none;
}

.toggle-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-btn:hover {
  background-color: #f1f5f9;
  color: var(--text-dark);
}

.menu-list {
  list-style: none;
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.menu-item i {
  font-size: 1.15rem;
  min-width: 32px;
  text-align: center;
}

.menu-item:hover {
  background-color: #f8fafc;
  color: var(--text-dark);
}

.menu-item.active {
  background-color: #eff6ff;
  color: var(--primary-blue);
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem 0.85rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  white-space: nowrap;
  min-height: 65px;
  flex-shrink: 0;
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

.top-header {
  background-color: #ffffff;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
}

.view-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: auto;
}

@media (max-width: 768px) {
  /* En móvil usamos el documento como zona principal de scroll.
     Evita el scroll anidado que algunos navegadores móviles limitan. */
  body {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .main-wrapper {
    display: block;
    width: 100%;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .view-content {
    display: block;
    min-height: 0;
    overflow: visible;
    -webkit-overflow-scrolling: auto;
    overscroll-behavior-y: auto;
  }

  .sidebar-overlay {
    z-index: 1100;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: 260px !important;
    transform: translateX(-100%);
    z-index: 1200;
    box-shadow: 5px 0 25px rgba(0,0,0,0.15);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar.collapsed .toggle-btn {
    display: flex;
  }

  .mobile-menu-btn {
    display: block;
  }
}
.header-left{display:flex;align-items:center;gap:12px;min-width:0}.header-left h2{font-size:1.1rem;font-weight:700}.header-left p{font-size:.8rem;color:var(--text-muted)}.header-actions{display:flex;align-items:center;gap:4px;flex-wrap:wrap;justify-content:flex-end}.content-area{padding:1.5rem 2rem}.historial-page{padding:1.25rem 2rem;overflow:auto}.historial-toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}.historial-list{display:grid;gap:.65rem;max-width:900px}.historial-card{background:#fff;border:1px solid var(--border-color);border-radius:10px;padding:.85rem 1rem;display:flex;justify-content:space-between;gap:1rem}.historial-card strong{display:inline-block;margin-right:.5rem}.historial-card span{font-size:.72rem;color:var(--text-muted);padding:.2rem .4rem;background:#f1f5f9;border-radius:5px}.historial-card p{margin:.35rem 0;font-size:.85rem}.historial-card small{color:var(--text-muted);font-size:.72rem}.icon-delete{border:0;background:none;color:#94a3b8;cursor:pointer}.icon-delete:hover{color:#dc2626}.historial-empty{text-align:center;padding:4rem 1rem;color:var(--text-muted)}.historial-empty i{font-size:2rem;margin-bottom:.7rem}.historial-empty h3{color:var(--text-dark);margin-bottom:.3rem}
@media(max-width:768px){.content-area{padding:.8rem}.historial-page{padding:.8rem}.top-header{padding:.8rem 1rem}.header-left{gap:8px}.header-actions{gap:0}.header-actions .btn-tool{padding:6px}}


/* NAVEGACIÓN JERÁRQUICA */
.menu-group { list-style: none; }
.menu-parent { position: relative; }
.menu-chevron {
  margin-left: auto;
  min-width: auto !important;
  font-size: .75rem !important;
  transition: transform .2s ease;
}
.menu-group:not(.submenu-open) .menu-chevron { transform: rotate(-90deg); }
.submenu {
  list-style: none;
  display: none;
  padding: .25rem 0 .25rem 1rem;
}
.menu-group.submenu-open .submenu { display: block; }
.submenu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: .62rem .75rem;
  margin: .12rem 0;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .84rem;
  cursor: pointer;
}
.submenu-item i { width: 22px; text-align: center; }
.submenu-item:hover { background: #f8fafc; color: var(--text-dark); }
.submenu-item.active { background: #eff6ff; color: var(--primary-blue); font-weight: 600; }
.menu-parent.section-active { color: var(--primary-blue); background: #f8fafc; }
.sidebar.collapsed .submenu,
.sidebar.collapsed .menu-chevron { display: none !important; }
.sidebar.collapsed .menu-parent { justify-content: center; }
.sidebar.collapsed .menu-parent .menu-text { display: none; }

.dashboard-page { max-width: 1200px; }
.welcome-card {
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.welcome-card.compact { padding: 1.5rem 2rem; }
.eyebrow {
  display: inline-block;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--primary-blue);
  margin-bottom: .5rem;
}
.welcome-card h1 { font-size: 1.7rem; margin-bottom: .45rem; }
.welcome-card p { color: var(--text-muted); max-width: 720px; line-height: 1.55; }
.welcome-icon {
  width: 74px; height: 74px; flex: 0 0 74px;
  border-radius: 20px; display: flex; align-items: center; justify-content: center;
  background: #ffffff; color: var(--primary-blue); font-size: 1.9rem;
  box-shadow: 0 8px 24px rgba(15,23,42,.08);
}
.section-heading { margin: .25rem 0 1rem; }
.section-heading h3 { font-size: 1.05rem; }
.section-heading p { color: var(--text-muted); font-size: .82rem; margin-top: .2rem; }
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.quick-card {
  border: 1px solid var(--border-color);
  background: #fff;
  border-radius: 14px;
  padding: 1.15rem;
  display: grid;
  grid-template-columns: 48px 1fr 18px;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.quick-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(15,23,42,.07); border-color: #cbd5e1; }
.quick-card > span:nth-child(2) { display: flex; flex-direction: column; gap: .25rem; }
.quick-card strong { color: var(--text-dark); font-size: .92rem; }
.quick-card small { color: var(--text-muted); font-size: .76rem; line-height: 1.4; }
.quick-card > i { color: #94a3b8; }
.quick-icon, .placeholder-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.placeholder-page { min-height: 100%; display: flex; align-items: center; justify-content: center; }
.placeholder-card {
  background: #fff; border: 1px solid var(--border-color); border-radius: 18px;
  padding: 3rem; text-align: center; max-width: 680px; width: 100%;
}
.placeholder-card .placeholder-icon { margin: 0 auto 1rem; }
.placeholder-card h2 { margin-bottom: .5rem; }
.placeholder-card p { color: var(--text-muted); line-height: 1.6; }
.placeholder-actions { margin-top: 1.5rem; }
.btn-primary-placeholder {
  border: 0; background: var(--primary-blue); color: #fff; padding: .7rem 1rem;
  border-radius: 9px; font-weight: 600; cursor: pointer;
}
.evaluation-banner {
  background: #fff; border: 1px solid var(--border-color); border-radius: 14px;
  padding: 1.1rem 1.25rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.evaluation-banner p { color: var(--text-muted); font-size: .8rem; margin-top: .3rem; max-width: 850px; line-height: 1.45; }
.evaluation-status { white-space: nowrap; color: #16a34a; font-size: .78rem; font-weight: 700; }
.evaluation-status i { font-size: .55rem; margin-right: .25rem; }
.evaluation-toolbar { display:flex; align-items:center; justify-content:space-between; gap:1rem; color:var(--text-muted); font-size:.8rem; }

@media(max-width:768px) {
  .welcome-card { padding: 1.25rem; }
  .welcome-icon { display: none; }
  .quick-grid { grid-template-columns: 1fr; }
  .submenu { padding-left: .5rem; }
  .evaluation-banner { align-items: flex-start; flex-direction: column; }
  .evaluation-toolbar { align-items: flex-start; flex-direction: column; }
}


/* VISTA ALUMNOS */
.alumnos-page { max-width: 1280px; }
.alumnos-layout { display: grid; gap: 1rem; }
.alumno-form-card,
.alumnos-list-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
}
.alumno-form-card { padding: 1.35rem 1.5rem; }
.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
}
.card-heading h3 { font-size: 1.08rem; margin-bottom: .25rem; }
.card-heading p { color: var(--text-muted); font-size: .78rem; line-height: 1.45; }
.form-status {
  padding: .35rem .65rem;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary-blue);
  font-size: .7rem;
  font-weight: 800;
  white-space: nowrap;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.form-field { display: flex; flex-direction: column; gap: .35rem; }
.form-field-full { grid-column: 1 / -1; }
.form-field label {
  font-size: .76rem;
  font-weight: 700;
  color: var(--text-dark);
}
.form-field label span { color: #dc2626; }
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="tel"],
.form-field input[type="number"],
.form-field input[type="search"],
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid #dbe2ea;
  border-radius: 9px;
  padding: .68rem .75rem;
  font: inherit;
  font-size: .82rem;
  color: var(--text-dark);
  background: #fff;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-field textarea { resize: vertical; min-height: 78px; }
.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.form-field small { color: #94a3b8; font-size: .68rem; }
.form-field-status { justify-content: flex-start; }
.switch-row {
  min-height: 39px;
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: .55rem;
  cursor: pointer;
  font-weight: 600 !important;
}
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.fake-switch {
  width: 38px;
  height: 21px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  transition: background .15s ease;
}
.fake-switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 15px; height: 15px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transition: transform .15s ease;
}
.switch-row input:checked + .fake-switch { background: #16a34a; }
.switch-row input:checked + .fake-switch::after { transform: translateX(17px); }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: .65rem;
  border-top: 1px solid #eef2f7;
  margin-top: 1.25rem;
  padding-top: 1rem;
}
.btn-primary-form,
.btn-secondary-form {
  border: 0;
  border-radius: 9px;
  padding: .7rem 1rem;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary-form { background: var(--primary-blue); color: #fff; }
.btn-secondary-form { background: #f1f5f9; color: #475569; }
.list-heading {
  padding: 1.25rem 1.5rem 1rem;
  align-items: center;
}
.alumnos-search {
  width: min(300px, 100%);
  display: flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid #dbe2ea;
  border-radius: 9px;
  padding: .55rem .7rem;
  color: #94a3b8;
}
.alumnos-search input {
  width: 100%;
  border: 0;
  outline: 0;
  font: inherit;
  font-size: .78rem;
  color: var(--text-dark);
}
.table-wrap { overflow-x: auto; }
.alumnos-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.alumnos-table th,
.alumnos-table td {
  padding: .78rem 1rem;
  border-top: 1px solid #eef2f7;
  text-align: left;
  font-size: .76rem;
}
.alumnos-table th {
  background: #f8fafc;
  color: #64748b;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.alumnos-table td { color: #334155; }
.alumno-name-cell { display:flex; align-items:center; gap:.6rem; font-weight:650; }
.alumno-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display:flex; align-items:center; justify-content:center;
  background:#eff6ff; color:var(--primary-blue); font-size:.7rem; font-weight:800;
}
.status-pill {
  display:inline-flex; align-items:center; gap:.35rem;
  border-radius:999px; padding:.28rem .5rem;
  font-size:.66rem; font-weight:750;
}
.status-pill::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }
.status-active { background:#f0fdf4; color:#15803d; }
.status-inactive { background:#f8fafc; color:#64748b; }
.action-btn {
  border: 0; background: transparent; color: #64748b;
  padding: .4rem .5rem; border-radius: 7px; cursor:pointer;
}
.action-btn:hover { background:#f1f5f9; color:var(--primary-blue); }
.table-actions-heading { text-align:right !important; }
.table-actions { text-align:right !important; white-space:nowrap; }
.empty-alumnos {
  padding: 2.5rem 1rem;
  text-align:center;
  color:#94a3b8;
  flex-direction:column;
  align-items:center;
  gap:.35rem;
}
.empty-alumnos[hidden] { display:none; }
.empty-alumnos:not([hidden]) { display:flex; }
.empty-alumnos i { font-size:1.5rem; margin-bottom:.25rem; }
.empty-alumnos strong { color:#475569; font-size:.82rem; }
.empty-alumnos span { font-size:.72rem; }
.php-ready-note {
  display:flex; gap:.75rem; align-items:flex-start;
  padding:.9rem 1rem; border:1px dashed #cbd5e1;
  border-radius:12px; color:#64748b; background:#f8fafc;
}
.php-ready-note > i { color:var(--primary-blue); margin-top:.15rem; }
.php-ready-note strong { color:#475569; font-size:.75rem; }
.php-ready-note p { font-size:.7rem; line-height:1.45; margin-top:.15rem; }
.php-ready-note code { background:#e2e8f0; border-radius:4px; padding:.05rem .25rem; font-size:.66rem; }

@media(max-width:768px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-field-full { grid-column: auto; }
  .list-heading { align-items: stretch; flex-direction: column; }
  .alumnos-search { width: 100%; }
  .form-actions { justify-content: stretch; }
  .btn-primary-form, .btn-secondary-form { flex: 1; }
}
