* {
  box-sizing: border-box;
}

:root {
  --ada-primary: #1e3a8a;
  --ada-primary-hover: #1d4ed8;
  --ada-secondary: #93c5fd;
  --ada-soft: #eef2ff;
  --ada-bg: #f3f6fb;
  --ada-text: #1e293b;
  --ada-muted: #64748b;
  --ada-border: #e2e8f0;
  --ada-sidebar: #0f172a;
  --ada-gradient: linear-gradient(135deg, #eef2ff, #f8fafc);
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--ada-bg);
  color: var(--ada-text);
}

/* Temas por rol */
.role-admin {
  --ada-primary: #1e3a8a;
  --ada-primary-hover: #1d4ed8;
  --ada-secondary: #93c5fd;
  --ada-soft: #eef2ff;
  --ada-sidebar: #0f172a;
  --ada-gradient: linear-gradient(135deg, #dbeafe, #f8fafc);
}

.role-directivo {
  --ada-primary: #b91c1c;
  --ada-primary-hover: #dc2626;
  --ada-secondary: #fecaca;
  --ada-soft: #fef2f2;
  --ada-sidebar: #450a0a;
  --ada-gradient: linear-gradient(135deg, #fee2e2, #fff7ed);
}

.role-secretaria {
  --ada-primary: #0284c7;
  --ada-primary-hover: #0ea5e9;
  --ada-secondary: #bae6fd;
  --ada-soft: #e0f2fe;
  --ada-sidebar: #082f49;
  --ada-gradient: linear-gradient(135deg, #e0f2fe, #f8fafc);
}

.role-docente {
  --ada-primary: #7e22ce;
  --ada-primary-hover: #9333ea;
  --ada-secondary: #e9d5ff;
  --ada-soft: #faf5ff;
  --ada-sidebar: #3b0764;
  --ada-gradient: linear-gradient(135deg, #f3e8ff, #f8fafc);
}

.role-preceptor {
  --ada-primary: #c2410c;
  --ada-primary-hover: #ea580c;
  --ada-secondary: #fed7aa;
  --ada-soft: #fff7ed;
  --ada-sidebar: #431407;
  --ada-gradient: linear-gradient(135deg, #ffedd5, #f8fafc);
}

.role-familia {
  --ada-primary: #15803d;
  --ada-primary-hover: #16a34a;
  --ada-secondary: #bbf7d0;
  --ada-soft: #f0fdf4;
  --ada-sidebar: #052e16;
  --ada-gradient: linear-gradient(135deg, #dcfce7, #f8fafc);
}

.role-alumno {
  --ada-primary: #4338ca;
  --ada-primary-hover: #2563eb;
  --ada-secondary: #c4b5fd;
  --ada-soft: #eef2ff;
  --ada-sidebar: #111827;
  --ada-gradient: linear-gradient(135deg, #dbeafe 0%, #f3e8ff 35%, #dcfce7 70%, #fff7ed 100%);
}

/* Home y login */
.home {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.hero {
  max-width: 760px;
  background: white;
  padding: 48px;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  text-align: center;
}

.hero h1 {
  font-size: 48px;
  color: var(--ada-primary);
  margin-bottom: 12px;
}

.hero p {
  font-size: 20px;
  color: var(--ada-muted);
  margin-bottom: 32px;
}

.btn-principal,
.btn-primary {
  display: inline-block;
  padding: 14px 24px;
  border-radius: 12px;
  background: var(--ada-primary);
  color: white;
  text-decoration: none;
  font-weight: bold;
  border: none;
  cursor: pointer;
}

.btn-principal:hover,
.btn-primary:hover {
  background: var(--ada-primary-hover);
}

.btn-secondary {
  display: inline-block;
  padding: 12px 18px;
  border-radius: 12px;
  background: white;
  color: var(--ada-primary);
  border: 1px solid var(--ada-secondary);
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--ada-soft);
}

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ada-gradient);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: white;
  padding: 32px;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

.login-card h1 {
  margin-top: 0;
  color: var(--ada-primary);
}

.login-card p {
  color: var(--ada-muted);
}

.login-card form,
.ada-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-card label,
.ada-form label {
  font-weight: bold;
  color: #334155;
}

.login-card input,
.ada-form input,
.ada-form select,
.ada-form textarea {
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 15px;
  width: 100%;
  font-family: inherit;
}

.ada-form textarea {
  min-height: 90px;
  resize: vertical;
}

.login-card button {
  margin-top: 12px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--ada-primary);
  color: white;
  font-weight: bold;
  cursor: pointer;
}

.login-card button:hover {
  background: var(--ada-primary-hover);
}

#loginMensaje,
.form-message {
  margin-top: 16px;
  font-weight: bold;
}

/* Layout dashboard */
.dashboard-body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  background: var(--ada-bg);
  color: var(--ada-text);
}

.sidebar {
  width: 286px;
  min-height: 100vh;
  background: var(--ada-sidebar);
  color: white;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  overflow-y: auto;
}

.sidebar-logo h2 {
  margin: 0;
  font-size: 32px;
  letter-spacing: 2px;
  color: var(--ada-secondary);
}

.sidebar-logo span {
  display: block;
  margin-top: 4px;
  color: #cbd5e1;
  font-size: 14px;
}

.sidebar-nav {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-link,
.sidebar-section-button {
  color: #cbd5e1;
  text-decoration: none;
  padding: 11px 14px;
  border-radius: 12px;
  font-weight: 700;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: var(--ada-primary);
  color: white;
}

.sidebar-section {
  border-radius: 14px;
}

.sidebar-section-button {
  width: 100%;
  border: none;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 11px;
}

.sidebar-section-button:hover {
  background: rgba(255,255,255,0.08);
}

.sidebar-section-button .chevron {
  transition: transform .2s ease;
}

.sidebar-section.open .chevron {
  transform: rotate(90deg);
}

.sidebar-submenu {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0 8px 12px;
}

.sidebar-section.open .sidebar-submenu {
  display: flex;
}

.sidebar-submenu a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar-submenu a:hover,
.sidebar-submenu a.active {
  background: var(--ada-primary);
  color: white;
}

.sidebar-submenu a.module-disabled,
.module-card.module-disabled {
  opacity: 0.35;
  filter: grayscale(1);
  cursor: not-allowed;
}

.sidebar-logout {
  margin-top: 24px;
  padding: 12px;
  border: 1px solid #334155;
  background: transparent;
  color: white;
  border-radius: 12px;
  cursor: pointer;
  font-weight: bold;
}

.sidebar-logout:hover {
  background: rgba(255,255,255,0.08);
}

.dashboard-main {
  margin-left: 286px;
  width: calc(100% - 286px);
  min-height: 100vh;
  padding: 36px;
}

.dashboard-header {
  background: white;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
}

.dashboard-header h1 {
  margin: 6px 0 8px;
  color: var(--ada-primary);
  font-size: 36px;
}

.eyebrow {
  margin: 0;
  color: var(--ada-muted);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 13px;
}

.user-card {
  min-width: 260px;
  background: var(--ada-soft);
  border: 1px solid var(--ada-secondary);
  padding: 18px;
  border-radius: 18px;
  text-align: right;
}

.user-card strong,
.user-card span,
.user-card small {
  display: block;
}

.user-card strong {
  color: var(--ada-primary);
  font-size: 18px;
}

.user-card span {
  color: #475569;
  margin-top: 4px;
}

.user-card small {
  margin-top: 8px;
  color: var(--ada-primary-hover);
  font-weight: bold;
  text-transform: uppercase;
}

.role-banner {
  margin-top: 24px;
  padding: 24px;
  border-radius: 22px;
  background: var(--ada-gradient);
  border: 1px solid var(--ada-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.role-banner strong {
  display: block;
  color: var(--ada-primary);
  font-size: 20px;
}

.role-banner p {
  margin: 6px 0 0;
  color: #475569;
}

.role-pill {
  background: var(--ada-primary);
  color: white;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: bold;
  white-space: nowrap;
}

.dashboard-group {
  margin-top: 30px;
}

.dashboard-group h2 {
  margin: 0 0 14px;
  color: #334155;
  font-size: 20px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 20px;
}

.module-card {
  background: white;
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.07);
  border: 1px solid var(--ada-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.module-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
  border-color: var(--ada-secondary);
}

.module-icon {
  font-size: 34px;
}

.module-card h3 {
  margin: 16px 0 8px;
  color: var(--ada-primary);
}

.module-card p {
  color: var(--ada-muted);
  line-height: 1.5;
  margin: 0;
}

.chatbot-button {
  position: fixed;
  right: 28px;
  bottom: 28px;
  border: none;
  background: var(--ada-primary);
  color: white;
  padding: 16px 22px;
  border-radius: 999px;
  box-shadow: 0 18px 40px rgba(30, 58, 138, 0.35);
  font-weight: bold;
  cursor: pointer;
}

.chatbot-button:hover {
  background: var(--ada-primary-hover);
}

/* Páginas internas */
.module-page {
  min-height: 100vh;
  background: var(--ada-gradient);
  padding: 40px;
}

.module-shell {
  max-width: 1120px;
  margin: 0 auto;
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--ada-primary);
  font-weight: bold;
  text-decoration: none;
}

.module-view {
  background: white;
  border-radius: 24px;
  padding: 36px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  border: 1px solid var(--ada-secondary);
}

.module-view h1 {
  color: var(--ada-primary);
  font-size: 38px;
  margin: 8px 0;
}

.module-view p {
  color: var(--ada-muted);
  font-size: 18px;
}

.module-placeholder {
  margin-top: 28px;
  background: var(--ada-soft);
  border: 1px dashed var(--ada-primary);
  border-radius: 18px;
  padding: 22px;
}

.module-placeholder strong,
.module-placeholder span {
  display: block;
}

.module-placeholder strong {
  color: var(--ada-primary);
  margin-bottom: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.panel-card {
  margin-top: 24px;
  background: #fff;
  border: 1px solid var(--ada-border);
  border-radius: 20px;
  padding: 22px;
}

.panel-card h2 {
  color: var(--ada-primary);
  margin-top: 0;
}

.table-wrap {
  overflow-x: auto;
}

.ada-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.ada-table th,
.ada-table td {
  border-bottom: 1px solid var(--ada-border);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

.ada-table th {
  color: #334155;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.badge {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--ada-soft);
  color: var(--ada-primary);
  font-weight: bold;
  font-size: 12px;
}

.status-ok {
  color: #15803d;
  font-weight: bold;
}

.status-off {
  color: #b91c1c;
  font-weight: bold;
}

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }
}

@media (max-width: 920px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard-body {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    min-height: auto;
  }

  .dashboard-main {
    margin-left: 0;
    width: 100%;
    padding: 20px;
  }

  .dashboard-header,
  .role-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .user-card {
    text-align: left;
    width: 100%;
  }

  .dashboard-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   CIERRE ADA - seguridad visual por rol
   ============================================================ */
body.role-loading .dashboard-main,
body.role-loading .sidebar,
body.role-loading .module-shell,
body.role-loading .module-view,
body.role-loading .portal-main,
body.role-loading .role-portal,
body.role-loading .app-shell {
  visibility: hidden !important;
}

body.role-loading::before {
  content: "Verificando sesión y permisos...";
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f6fb;
  color: #1e293b;
  font-weight: 700;
  z-index: 99999;
}

.ada-hidden-by-role,
[hidden].ada-hidden-by-role {
  display: none !important;
}

.sidebar-submenu a.ada-hidden-by-role,
.module-card.ada-hidden-by-role {
  display: none !important;
}

.access-denied-card {
  max-width: 760px;
  margin: 40px auto;
  border: 1px solid var(--ada-secondary);
}

/* Docente: naranja institucional */
body.role-docente {
  --ada-primary: #ea580c !important;
  --ada-primary-hover: #f97316 !important;
  --ada-secondary: #fdba74 !important;
  --ada-soft: #fff7ed !important;
  --ada-sidebar: #431407 !important;
  --ada-gradient: linear-gradient(135deg, #ffedd5, #fff7ed) !important;
  background: linear-gradient(180deg, #fff7ed, #ffedd5) !important;
}

body.role-docente .dashboard-main,
body.role-docente .module-shell,
body.role-docente .module-view,
body.role-docente .portal-main,
body.role-docente .role-portal {
  background: linear-gradient(180deg, #fff7ed, #ffedd5) !important;
}

/* ============================================================
   PATCH 03 - Menú lateral también en espacios por rol
   ============================================================ */
body.ada-with-sidebar {
  min-height: 100vh;
  display: flex;
  background: var(--ada-gradient) !important;
}

body.ada-with-sidebar .module-shell {
  margin-left: 286px;
  width: calc(100% - 286px);
  min-height: 100vh;
  padding: 36px;
}

body.ada-with-sidebar .module-view {
  max-width: 1280px;
  margin: 0 auto;
}

body.ada-with-sidebar .back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 18px;
}

body.ada-with-sidebar .ada-global-logout {
  display: none !important;
}

body.role-docente .role-hero {
  background: linear-gradient(135deg, #ea580c 0%, #f97316 52%, #fdba74 100%) !important;
}

@media (max-width: 900px) {
  body.ada-with-sidebar {
    display: block;
  }

  body.ada-with-sidebar .sidebar {
    position: relative;
    width: 100%;
    min-height: auto;
  }

  body.ada-with-sidebar .module-shell {
    margin-left: 0;
    width: 100%;
    padding: 20px;
  }
}

/* ============================================================
   BLOQUE 24 - Base visual, navegación y permisos ADA
   Plantilla madre responsive para todos los módulos internos.
   ============================================================ */
:root {
  --ada-radius-lg: 28px;
  --ada-radius-md: 18px;
  --ada-shadow-soft: 0 18px 48px rgba(15, 23, 42, 0.10);
  --ada-shadow-hover: 0 24px 60px rgba(15, 23, 42, 0.16);
  --ada-sidebar-width: 300px;
}

body.ada-with-sidebar {
  min-height: 100vh;
  display: flex;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--ada-secondary) 32%, transparent), transparent 34%),
    linear-gradient(180deg, #f8fafc 0%, var(--ada-soft) 100%) !important;
}

body.ada-with-sidebar .sidebar {
  width: var(--ada-sidebar-width);
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.16), transparent 30%),
    linear-gradient(180deg, var(--ada-sidebar), #020617);
  color: white;
  padding: 22px 16px;
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 18px 0 48px rgba(2, 6, 23, .22);
}

body.ada-with-sidebar .dashboard-main,
body.ada-with-sidebar .module-shell {
  margin-left: var(--ada-sidebar-width) !important;
  width: calc(100% - var(--ada-sidebar-width)) !important;
  min-height: 100vh;
  padding: clamp(20px, 3vw, 42px) !important;
}

body.ada-with-sidebar .module-view,
body.ada-with-sidebar .dashboard-header,
body.ada-with-sidebar .role-banner,
.ada-surface {
  border-radius: var(--ada-radius-lg) !important;
  border: 1px solid rgba(148, 163, 184, .22) !important;
  box-shadow: var(--ada-shadow-soft) !important;
  backdrop-filter: blur(14px);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.ada-sidebar-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--ada-primary), var(--ada-secondary));
  color: white;
  font-weight: 900;
  letter-spacing: .5px;
  box-shadow: 0 14px 28px rgba(0,0,0,.25);
}

.sidebar-logo h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 1px;
  color: white;
}

.sidebar-logo span {
  display: block;
  margin-top: 2px;
  color: rgba(226, 232, 240, .82);
  font-size: 13px;
  font-weight: 700;
}

.ada-sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 4px 20px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
}

.ada-sidebar-avatar {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.14);
  font-size: 22px;
}

.ada-sidebar-user strong {
  display: block;
  color: white;
  font-size: 14px;
  line-height: 1.2;
}

.ada-sidebar-user small {
  display: inline-block;
  margin-top: 5px;
  color: var(--ada-secondary);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .8px;
  font-size: 10px;
}

.sidebar-nav {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-section {
  border-radius: 18px;
  overflow: hidden;
}

.sidebar-section-button {
  width: 100%;
  border: none;
  background: rgba(255,255,255,.055);
  color: rgba(226, 232, 240, .92);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 11px;
  font-weight: 900;
  padding: 12px 14px;
  border-radius: 14px;
}

.sidebar-section-button:hover {
  background: rgba(255,255,255,.10);
}

.sidebar-section-button .chevron {
  transition: transform .2s ease;
  font-size: 17px;
}

.sidebar-section.open .chevron {
  transform: rotate(90deg);
}

.sidebar-submenu {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0 8px 0;
}

.sidebar-section.open .sidebar-submenu {
  display: flex;
}

.sidebar-submenu a,
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(226, 232, 240, .86);
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 14px;
  font-weight: 800;
  line-height: 1.2;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.sidebar-submenu a:hover,
.sidebar-submenu a.active,
.sidebar-link:hover,
.sidebar-link.active {
  background: linear-gradient(135deg, var(--ada-primary), var(--ada-primary-hover));
  color: white;
  transform: translateX(3px);
  box-shadow: 0 12px 24px rgba(0,0,0,.18);
}

.ada-nav-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 24px;
}

.ada-sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
}

.sidebar-logout {
  width: 100%;
  margin-top: 16px;
  padding: 13px 14px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: white;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 900;
  transition: background .18s ease, transform .18s ease;
}

.sidebar-logout:hover {
  background: rgba(255,255,255,.12);
  transform: translateY(-1px);
}

.ada-menu-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1200;
  border: none;
  background: var(--ada-primary);
  color: white;
  padding: 11px 14px;
  border-radius: 999px;
  font-weight: 900;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .24);
  cursor: pointer;
}

.ada-menu-toggle span {
  margin-left: 6px;
}

.dashboard-header,
.role-banner,
.module-view,
.panel-card,
.module-card,
.user-card {
  position: relative;
  overflow: hidden;
}

.dashboard-header::before,
.module-view::before,
.panel-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--ada-primary), var(--ada-secondary));
}

.dashboard-header h1,
.module-view h1,
.panel-card h2 {
  color: var(--ada-primary) !important;
}

.module-card {
  border: 1px solid rgba(148, 163, 184, .26) !important;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .08) !important;
}

.module-card:hover {
  transform: translateY(-5px) !important;
  box-shadow: var(--ada-shadow-hover) !important;
}

.btn-primary,
.btn-principal,
button[type="submit"] {
  background: linear-gradient(135deg, var(--ada-primary), var(--ada-primary-hover)) !important;
  box-shadow: 0 12px 28px color-mix(in srgb, var(--ada-primary) 28%, transparent);
}

.btn-secondary {
  border-color: var(--ada-secondary) !important;
  color: var(--ada-primary) !important;
}

.ada-action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.access-denied-card {
  max-width: 780px;
  margin: 40px auto;
}

.ada-access-denied-shell {
  display: flex;
  align-items: center;
}

.helper-text {
  color: var(--ada-muted);
  font-size: 16px !important;
}

.ada-table {
  overflow: hidden;
  border-radius: 16px;
}

.ada-table th {
  background: var(--ada-soft);
  color: var(--ada-primary) !important;
}

.badge,
.role-pill {
  background: linear-gradient(135deg, var(--ada-primary), var(--ada-primary-hover)) !important;
  color: white !important;
}

/* Colores finales por rol */
body.role-admin {
  --ada-primary: #0f172a !important;
  --ada-primary-hover: #334155 !important;
  --ada-secondary: #94a3b8 !important;
  --ada-soft: #f1f5f9 !important;
  --ada-sidebar: #020617 !important;
  --ada-gradient: linear-gradient(135deg, #0f172a 0%, #334155 100%) !important;
}

body.role-directivo {
  --ada-primary: #b91c1c !important;
  --ada-primary-hover: #dc2626 !important;
  --ada-secondary: #fecaca !important;
  --ada-soft: #fef2f2 !important;
  --ada-sidebar: #450a0a !important;
  --ada-gradient: linear-gradient(135deg, #fee2e2, #fff7ed) !important;
}

body.role-secretaria {
  --ada-primary: #0284c7 !important;
  --ada-primary-hover: #0ea5e9 !important;
  --ada-secondary: #bae6fd !important;
  --ada-soft: #e0f2fe !important;
  --ada-sidebar: #082f49 !important;
  --ada-gradient: linear-gradient(135deg, #e0f2fe, #f8fafc) !important;
}

body.role-docente {
  --ada-primary: #ea580c !important;
  --ada-primary-hover: #f97316 !important;
  --ada-secondary: #fdba74 !important;
  --ada-soft: #fff7ed !important;
  --ada-sidebar: #431407 !important;
  --ada-gradient: linear-gradient(135deg, #ffedd5, #fff7ed) !important;
}

body.role-preceptor {
  --ada-primary: #b8860b !important;
  --ada-primary-hover: #ca8a04 !important;
  --ada-secondary: #fde68a !important;
  --ada-soft: #fefce8 !important;
  --ada-sidebar: #422006 !important;
  --ada-gradient: linear-gradient(135deg, #fef3c7, #fff7ed) !important;
}

body.role-familia {
  --ada-primary: #15803d !important;
  --ada-primary-hover: #16a34a !important;
  --ada-secondary: #bbf7d0 !important;
  --ada-soft: #f0fdf4 !important;
  --ada-sidebar: #052e16 !important;
  --ada-gradient: linear-gradient(135deg, #dcfce7, #f8fafc) !important;
}

body.role-alumno {
  --ada-primary: #7c3aed !important;
  --ada-primary-hover: #2563eb !important;
  --ada-secondary: #c4b5fd !important;
  --ada-soft: #eef2ff !important;
  --ada-sidebar: #111827 !important;
  --ada-gradient: linear-gradient(135deg, #dbeafe 0%, #f3e8ff 35%, #dcfce7 70%, #fff7ed 100%) !important;
}

body.role-alumno .sidebar {
  background:
    radial-gradient(circle at 0% 0%, rgba(124, 58, 237, .34), transparent 28%),
    radial-gradient(circle at 95% 15%, rgba(37, 99, 235, .28), transparent 30%),
    radial-gradient(circle at 50% 95%, rgba(22, 163, 74, .22), transparent 28%),
    linear-gradient(180deg, #111827, #020617) !important;
}

@media (max-width: 1100px) {
  :root { --ada-sidebar-width: 278px; }
}

@media (max-width: 900px) {
  body.ada-with-sidebar {
    display: block !important;
  }

  .ada-menu-toggle {
    display: inline-flex;
    align-items: center;
  }

  body.ada-with-sidebar .sidebar {
    position: fixed !important;
    width: min(86vw, 330px) !important;
    min-height: 100vh !important;
    transform: translateX(-105%);
    transition: transform .22s ease;
    border-radius: 0 28px 28px 0;
  }

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

  body.ada-sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .42);
    z-index: 900;
  }

  body.ada-with-sidebar .dashboard-main,
  body.ada-with-sidebar .module-shell {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 74px 16px 22px !important;
  }

  .dashboard-header,
  .role-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-header h1,
  .module-view h1 {
    font-size: clamp(28px, 9vw, 38px) !important;
  }

  .module-view,
  .dashboard-header,
  .role-banner,
  .panel-card {
    padding: 24px !important;
    border-radius: 22px !important;
  }

  .ada-action-row,
  .role-banner {
    width: 100%;
  }

  .ada-action-row .btn-primary,
  .ada-action-row .btn-secondary {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 560px) {
  .ada-menu-toggle span {
    display: none;
  }

  body.ada-with-sidebar .dashboard-main,
  body.ada-with-sidebar .module-shell {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .module-view,
  .dashboard-header,
  .role-banner,
  .panel-card {
    padding: 20px !important;
  }

  .dashboard-grid,
  .form-grid {
    grid-template-columns: 1fr !important;
  }
}
