/* =====================================================================
   UNIVERSIDAD HUELLAS DE VIDA · Aula Virtual
   Sistema visual basado en el logo institucional · mobile-first friendly
   ===================================================================== */

:root {
  /* Colores de marca (logo) */
  --red:        #C62828;
  --red-600:    #A11F1F;
  --red-50:     #FDECEE;
  --navy:       #1E5631;
  --navy-700:   #184828;
  --navy-900:   #123A20;
  --navy-950:   #0B2915;
  --navy-50:    #E8F2EB;
  --purple:     #8C6A24;
  --purple-50:  #F7F0DF;
  --lavender:   #D9B96A;
  --lavender-50:#FAF5E8;
  --green:      #2E9B57;
  --green-50:   #E6F5EC;
  --amber:      #A86400;
  --amber-50:   #FFF4E0;

  /* Neutros cálidos (fondo crema del logo) */
  --cream:      #FBF8F4;
  --surface:    #FFFFFF;
  --ink:        #1B2A21;
  --ink-2:      #46544B;
  --muted:      #737E77;
  --line:       #ECE6DF;
  --line-2:     #F3EFEA;

  --font:       'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif:      'Cormorant Garamond', Georgia, 'Times New Roman', serif;

  --radius:     18px;
  --radius-sm:  12px;
  --shadow-sm:  0 1px 2px rgba(18, 58, 32, .05), 0 1px 3px rgba(18, 58, 32, .05);
  --shadow:     0 6px 24px -8px rgba(18, 58, 32, .16);
  --shadow-lg:  0 24px 60px -20px rgba(18, 58, 32, .38);

  --sidebar-w:  276px;
  --bottom-nav: 64px;
  --ease:       cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
a { color: var(--navy); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: 0; }
button { font-family: inherit; }
code { font-size: 12.5px; color: var(--ink-2); background: var(--line-2); padding: 2px 6px; border-radius: 6px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--navy) 35%, transparent); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

.brand-stripe {
  display: block; height: 4px; width: 64px; border-radius: 4px;
  background: linear-gradient(90deg, var(--navy) 0 50%, var(--lavender) 50%);
}

/* ---------------------------------------------------------------------
   Utilidades
   --------------------------------------------------------------------- */
.muted { color: var(--muted); font-size: 13.5px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.break { word-break: break-word; }
.truncate { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-good { color: var(--green) !important; }
.is-bad  { color: var(--red) !important; }
.section-gap { margin-top: 1.4rem; }

/* ---------------------------------------------------------------------
   Botones, enlaces, etiquetas
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 46px; padding: .7rem 1.25rem; border: 0; border-radius: 13px;
  font: 700 15px/1 var(--font); cursor: pointer; text-align: center;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s, color .2s;
}
.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-900) 100%);
  box-shadow: 0 10px 22px -10px rgba(18, 58, 32, .65);
}
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -12px rgba(18, 58, 32, .75); }
.btn--primary:active { transform: translateY(0); }
.btn--ghost { color: var(--navy); background: var(--navy-50); }
.btn--ghost:hover { background: #DCE6F8; }
.btn--block { width: 100%; }
.btn--lg { min-height: 54px; font-size: 16px; border-radius: 15px; }
.btn i { font-size: 1.1em; transition: transform .2s var(--ease); }
.btn:hover .bi-arrow-right { transform: translateX(3px); }
.btn[aria-busy='true'] { pointer-events: none; opacity: .85; }
.btn[aria-busy='true'] > .bi::before { content: '\F130'; display: inline-block; animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

.link { background: none; border: 0; padding: 0; cursor: pointer; font: 700 13.5px var(--font); color: var(--navy); }
.link:hover { color: var(--purple); text-decoration: underline; text-underline-offset: 3px; }

.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .65rem; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.2;
  color: var(--pc, var(--navy)); background: var(--pb, var(--navy-50));
}
.pill--green  { --pc: var(--green);   --pb: var(--green-50); }
.pill--red    { --pc: var(--red-600); --pb: var(--red-50); }
.pill--navy   { --pc: var(--navy);    --pb: var(--navy-50); }
.pill--purple { --pc: var(--purple);  --pb: var(--purple-50); }
.pill--amber  { --pc: var(--amber);   --pb: var(--amber-50); }

.tag { display: inline-block; padding: .25rem .6rem; border-radius: 8px; font-size: 11.5px; font-weight: 700; }
.user-menu__head .tag { margin-top: .5rem; }
.tag--admin, .tag--coordinador { color: var(--red-600); background: var(--red-50); }
.tag--docente { color: var(--purple); background: var(--purple-50); }
.tag--alumno  { color: var(--green);  background: var(--green-50); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot--green  { background: var(--green); }
.dot--purple { background: var(--purple); }
.dot--red    { background: var(--red); }
.dot--navy   { background: #BCD6C3; }
.dot--amber  { background: var(--amber); }

/* Alertas */
.alert {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .85rem 1rem; margin-bottom: 1rem;
  border-radius: 13px; border: 1px solid; font-size: 14px; font-weight: 500;
  animation: aparecer .35s var(--ease);
}
.alert i { font-size: 1.1rem; line-height: 1.3; flex: none; }
.alert--error { color: #8E0B16; background: var(--red-50); border-color: #F6C4C9; }
.alert--info  { color: var(--navy-700); background: var(--navy-50); border-color: #CCD8F3; }
.alert--exito { color: #0B6634; background: var(--green-50); border-color: #BEE5CC; }

/* ---------------------------------------------------------------------
   Formularios
   --------------------------------------------------------------------- */
.form { display: grid; gap: .1rem; }
.field { display: block; margin-bottom: 1.05rem; }
.field__label { display: block; margin-bottom: .45rem; font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.field__label em { font-style: normal; font-weight: 500; }
.field__control {
  position: relative; display: flex; align-items: center;
  background: #fff; border: 1.5px solid var(--line); border-radius: 13px;
  transition: border-color .2s, box-shadow .2s;
}
.field__control:focus-within { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(30, 86, 49, .1); }
.field__control > .bi { position: absolute; left: 15px; color: var(--muted); font-size: 1.05rem; pointer-events: none; transition: color .2s; }
.field__control:focus-within > .bi { color: var(--navy); }
.field__control input {
  width: 100%; min-height: 50px; padding: .85rem 1rem .85rem 2.85rem;
  border: 0; outline: 0; background: transparent; border-radius: 13px;
  font: 500 16px var(--font); color: var(--ink);
}
.field__control input::placeholder { color: #A7ABBE; font-weight: 400; }
.field__toggle {
  flex: none; margin-right: 5px; width: 42px; height: 42px; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.05rem;
}
.field__toggle:hover { background: var(--line-2); color: var(--navy); }
.field__hint { display: flex; gap: .35rem; align-items: center; margin-top: .45rem; font-size: 12.5px; font-weight: 600; color: var(--amber); }
.textarea {
  width: 100%; padding: .8rem 1rem; border: 1.5px solid var(--line); border-radius: 13px; resize: vertical;
  font: 500 16px/1.45 var(--font); color: var(--ink); background: #fff; outline: 0;
}
.textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(30, 86, 49, .1); }
.check { display: inline-flex; gap: .55rem; align-items: center; cursor: pointer; font-size: 14px; color: var(--ink-2); min-height: 32px; }
.check input { width: 19px; height: 19px; accent-color: var(--navy); cursor: pointer; }

.form--inline { margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px dashed var(--line); display: flex; align-items: flex-end; gap: .75rem; flex-wrap: wrap; }
.form--inline .field { flex: 1 1 220px; margin: 0; }
.form--inline .alert { flex-basis: 100%; margin: 0; }

.search { position: relative; display: block; min-width: 240px; }
.search .bi { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input {
  width: 100%; min-height: 44px; padding: .6rem 1rem .6rem 2.5rem; border-radius: 12px;
  border: 1.5px solid var(--line); background: #fff; font: 500 15px var(--font); outline: 0;
}
.search input:focus { border-color: var(--navy); }

/* Subida de archivos */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center;
  padding: 1.5rem 1rem; margin-bottom: 1rem; border: 2px dashed #D9CFE6; border-radius: 16px;
  background: var(--lavender-50); color: var(--ink-2); cursor: pointer; transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--purple); background: #F7EFDA; }
.dropzone.has-file { border-style: solid; border-color: var(--green); background: var(--green-50); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone > .bi { font-size: 2rem; color: var(--purple); }
.dropzone.has-file > .bi { color: var(--green); }
.dropzone strong { font-size: 14.5px; word-break: break-all; }
.dropzone small { font-size: 12px; color: var(--muted); }

/* Fortaleza de contraseña */
.strength { margin: -.4rem 0 1rem; }
.strength__bar { height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.strength__bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--red); transition: width .3s, background .3s; }
.strength__rules { list-style: none; padding: 0; margin: .55rem 0 0; display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: 12.5px; color: var(--muted); }
.strength__rules li::before { content: '\F28A'; font-family: 'bootstrap-icons'; margin-right: .3rem; font-size: 11px; }
.strength__rules li.ok { color: var(--green); font-weight: 600; }
.strength__rules li.ok::before { content: '\F26E'; }

/* ---------------------------------------------------------------------
   Layout del panel
   --------------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  color: #CFE0D3;
  background:
    radial-gradient(120% 50% at 0% 100%, rgba(140, 106, 36, .55), transparent 60%),
    linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 55%, #1A1E5C 100%);
  transition: transform .32s var(--ease);
}
.sidebar__top { display: flex; align-items: center; justify-content: space-between; padding: 1.3rem 1.1rem 1rem 1.25rem; }
.sidebar__brand { display: flex; gap: .8rem; align-items: center; }
.sidebar__logo {
  flex: none; width: 46px; height: 46px; display: grid; place-items: center;
  background: var(--cream); border-radius: 13px; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .5);
}
.sidebar__logo img { width: 34px; }
.sidebar__brand-text strong { display: block; font: 700 21px/1.05 var(--serif); color: #fff; letter-spacing: .2px; }
.sidebar__brand-text small { font-size: 10.5px; font-weight: 700; letter-spacing: 2.4px; text-transform: uppercase; color: var(--lavender); }
.sidebar__close { display: none; width: 38px; height: 38px; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; }

.sidebar__me {
  display: none; align-items: center; gap: .75rem; margin: 0 1rem .5rem; padding: .75rem;
  border-radius: 14px; background: rgba(255, 255, 255, .06); color: #fff;
}
.sidebar__me strong { display: block; font-size: 14px; }
.sidebar__me small { font-size: 12px; color: #B6CDBC; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: .2rem .85rem 1rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; overscroll-behavior: contain; }
.sidebar__group { margin: 1.05rem .7rem .4rem; font-size: 10.5px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; color: #7884B3; }
.sidebar__link {
  position: relative; display: flex; align-items: center; gap: .8rem;
  min-height: 42px; padding: .6rem .8rem; margin-bottom: 2px; border-radius: 11px;
  color: #CFE0D3; font-size: 14px; font-weight: 500;
  transition: background .2s, color .2s;
}
.sidebar__link .bi { font-size: 1.08rem; width: 20px; text-align: center; opacity: .85; }
.sidebar__link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar__link.is-active { background: rgba(255, 255, 255, .11); color: #fff; font-weight: 700; }
.sidebar__link.is-active::before {
  content: ''; position: absolute; left: -.85rem; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--lavender);
}
.sidebar__link.is-active .bi { opacity: 1; color: #E3C67A; }
.sidebar__soon, .sidebar__count {
  margin-left: auto; padding: .1rem .45rem; border-radius: 6px;
  font-size: 10px; font-style: normal; font-weight: 700; letter-spacing: .3px;
  color: var(--lavender); background: rgba(217, 185, 106, .14);
}
.sidebar__count { color: #fff; background: var(--red); border-radius: 10px; min-width: 20px; text-align: center; }
.sidebar__foot { padding: 1rem 1.4rem calc(1.3rem + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255, 255, 255, .07); }
.sidebar__foot p { margin-top: .6rem; font: italic 600 14px/1.35 var(--serif); color: #B6CDBC; }
.sidebar__logout {
  display: flex; align-items: center; gap: .6rem; width: 100%; margin-bottom: 1rem; padding: .6rem .7rem;
  border: 1px solid rgba(255, 255, 255, .1); border-radius: 11px; background: none; color: #E1E6F7; cursor: pointer; font-size: 14px; font-weight: 600;
}
.sidebar__logout:hover { background: rgba(209, 15, 31, .2); border-color: rgba(209, 15, 31, .4); }

.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .9rem;
  padding: .85rem 2rem; padding-top: calc(.85rem + env(safe-area-inset-top));
  background: rgba(251, 248, 244, .86);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__iso { display: none; flex: none; width: 40px; height: 40px; place-items: center; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.topbar__iso img { width: 30px; }
.topbar__title { min-width: 0; }
.topbar__title h1 { font-size: 20px; font-weight: 800; letter-spacing: -.2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__title p { font-size: 12.5px; color: var(--muted); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }

.icon-btn {
  position: relative; flex: none; width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  color: var(--ink-2); font-size: 1.15rem; cursor: pointer; transition: border-color .2s, color .2s;
}
.icon-btn:hover { border-color: #D7CFC6; color: var(--navy); }
.icon-btn__dot {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 10px; border: 2px solid var(--cream);
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 800;
}

.avatar {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px;
  font-size: 13.5px; font-weight: 800; color: #fff; letter-spacing: .3px;
  background: linear-gradient(135deg, var(--navy), var(--purple));
}
.avatar--alumno  { background: linear-gradient(135deg, var(--green), #0D6B5E); }
.avatar--docente { background: linear-gradient(135deg, var(--purple), var(--navy)); }
.avatar--admin, .avatar--coordinador { background: linear-gradient(135deg, var(--red), var(--purple)); }
.avatar--xl { width: 96px; height: 96px; border-radius: 26px; font-size: 32px; border: 4px solid #fff; box-shadow: var(--shadow); }

.user-menu { position: relative; }
.user-menu__btn {
  display: flex; align-items: center; gap: .65rem; padding: .3rem .7rem .3rem .3rem;
  border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; color: var(--ink);
}
.user-menu__btn:hover { border-color: #D7CFC6; }
.user-menu__info { text-align: left; line-height: 1.2; }
.user-menu__info strong { display: block; font-size: 13.5px; }
.user-menu__info small { font-size: 11.5px; color: var(--muted); }
.user-menu__btn > .bi { font-size: .8rem; color: var(--muted); transition: transform .2s; }
.user-menu.is-open .user-menu__btn > .bi { transform: rotate(180deg); }
.user-menu__panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 272px; z-index: 50;
  padding: .5rem; background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .18s, transform .18s var(--ease), visibility .18s;
}
.user-menu.is-open .user-menu__panel { opacity: 1; visibility: visible; transform: none; }
.user-menu__head { padding: .7rem .75rem .8rem; margin-bottom: .35rem; border-bottom: 1px solid var(--line-2); }
.user-menu__head strong { display: block; font-size: 14px; }
.user-menu__head small { font-size: 12.5px; color: var(--muted); word-break: break-all; }
.user-menu__panel a, .user-menu__panel button {
  display: flex; width: 100%; align-items: center; gap: .65rem; padding: .65rem .75rem;
  border: 0; border-radius: 10px; background: none; cursor: pointer;
  font: 500 14px var(--font); color: var(--ink-2); text-align: left;
}
.user-menu__panel a:hover, .user-menu__panel button:hover { background: var(--line-2); color: var(--ink); }
.user-menu__panel .is-danger { color: var(--red-600); }
.user-menu__panel .is-danger:hover { background: var(--red-50); color: var(--red-600); }
.user-menu__panel form { margin: .25rem 0 0; padding-top: .25rem; border-top: 1px solid var(--line-2); }

.content { flex: 1; padding: 1.75rem 2rem 2.5rem; width: 100%; max-width: 1480px; margin: 0 auto; }

.app-footer {
  display: flex; justify-content: space-between; gap: .4rem 1rem; flex-wrap: wrap;
  padding: 1.1rem 2rem; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}
.app-footer__motto { font: italic 600 14px var(--serif); color: var(--purple); }

/* Barra inferior (solo celular) */
.bottom-nav { display: none; }

/* ---------------------------------------------------------------------
   Encabezados de página
   --------------------------------------------------------------------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h2 { font: 700 32px/1.1 var(--serif); color: var(--navy-900); }
.page-head p { margin-top: .2rem; color: var(--muted); font-size: 14px; }
.page-head--sm { margin-top: 1.6rem; }
.page-head--sm h2 { font-size: 26px; }

/* ---------------------------------------------------------------------
   Hero de bienvenida
   --------------------------------------------------------------------- */
.hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  padding: 1.9rem 2.1rem; margin-bottom: 1.4rem; border-radius: 24px;
  color: #fff;
  background: linear-gradient(120deg, var(--navy-900) 0%, var(--navy) 55%, var(--purple) 120%);
  box-shadow: var(--shadow);
  isolation: isolate;
}
.hero::before, .hero::after { content: ''; position: absolute; z-index: -1; border-radius: 50%; filter: blur(10px); }
.hero::before { width: 340px; height: 340px; right: -80px; top: -150px; background: radial-gradient(circle, rgba(217, 185, 106, .45), transparent 65%); }
.hero::after  { width: 260px; height: 260px; left: 38%; bottom: -170px; background: radial-gradient(circle, var(--hero-glow, rgba(209, 15, 31, .4)), transparent 65%); }
.hero--alumno  { --hero-glow: rgba(18, 144, 74, .55); }
.hero--docente { --hero-glow: rgba(217, 185, 106, .6); }
.hero--admin   { --hero-glow: rgba(217, 185, 106, .5); }
.hero__text { min-width: 0; }
.hero__eyebrow { font-size: 14px; font-weight: 600; color: #CFE3D4; }
.hero h2 { margin: .1rem 0 .55rem; font: 700 40px/1.05 var(--serif); letter-spacing: .2px; }
.hero__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .45rem; font-size: 14px; color: #DCEBDF; }
.hero__meta .sep { opacity: .45; }
.hero__progress { text-align: center; }
.hero__progress p { margin-top: .45rem; font-size: 12px; font-weight: 600; color: #CFE3D4; }
.ring {
  width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255, 255, 255, .16) 0);
}
.ring span {
  width: 74px; height: 74px; border-radius: 50%; display: flex; align-items: baseline; justify-content: center; padding-top: 22px;
  background: var(--navy); font: 700 28px/1 var(--serif);
}
.ring small { font-family: var(--font); font-size: 12px; font-weight: 600; opacity: .7; }

.status { display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; font-size: 13px; }
.status > span { width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent); }
.status--ok   { color: #32C774; }
.status--warn { color: #F2B13A; }
.status--bad  { color: #FF6B76; }
.card .status--ok   { color: var(--green); }
.card .status--warn { color: var(--amber); }
.card .status--bad  { color: var(--red); }

/* Bienvenida sin cursos */
.welcome { display: flex; align-items: center; gap: 2rem; padding: 2.2rem; }
.welcome__art {
  flex: none; width: 140px; height: 140px; display: grid; place-items: center; border-radius: 36px;
  background: radial-gradient(circle at 30% 30%, #fff, var(--lavender-50)); border: 1px solid var(--line);
}
.welcome__art img { width: 96px; }
.welcome__text h2 { font: 700 30px/1.15 var(--serif); color: var(--navy-900); margin-bottom: .5rem; }
.welcome__text p { color: var(--ink-2); max-width: 560px; }
.welcome__actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.3rem; }

/* ---------------------------------------------------------------------
   Indicadores
   --------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.stats--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat {
  display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); color: var(--ink);
  transition: transform .2s var(--ease), box-shadow .2s;
}
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat > .bi {
  flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; font-size: 1.35rem;
  color: var(--c); background: var(--c-bg);
}
.stat strong { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; }
.stat span { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat--red      { --c: var(--red);    --c-bg: var(--red-50); }
.stat--navy     { --c: var(--navy);   --c-bg: var(--navy-50); }
.stat--purple   { --c: var(--purple); --c-bg: var(--purple-50); }
.stat--green    { --c: var(--green);  --c-bg: var(--green-50); }
.stat--lavender { --c: #8A5BB5;       --c-bg: var(--lavender-50); }

.summary-band {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1.4rem;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
}
.summary-band > div { padding: 1.1rem 1.3rem; border-right: 1px solid var(--line-2); }
.summary-band > div:last-child { border-right: 0; }
.summary-band span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.summary-band strong { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }

/* ---------------------------------------------------------------------
   Grillas y tarjetas
   --------------------------------------------------------------------- */
.grid { display: grid; gap: 1.4rem; align-items: start; }
.grid--main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: grid; gap: 1.4rem; min-width: 0; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.35rem 1.4rem; box-shadow: var(--shadow-sm); min-width: 0;
}
.card--flush { padding: .4rem 0; }
.card--highlight { border-color: #EADBB4; box-shadow: 0 0 0 4px var(--lavender-50), var(--shadow-sm); }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.card__head h3 { display: flex; align-items: center; gap: .55rem; font-size: 16.5px; font-weight: 800; }
.card__head h3 .bi { color: var(--purple); }
.card__note { margin-top: 1rem; }

/* Cursos */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 1rem; }
.course-grid--page { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; }
.course {
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink);
  transition: transform .2s var(--ease), box-shadow .2s;
}
a.course:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.course--red    { --c1: var(--red);    --c2: #7A1C1C;          --accent: var(--red); }
.course--navy   { --c1: var(--navy);   --c2: var(--navy-950);  --accent: var(--navy); }
.course--purple { --c1: var(--purple); --c2: #5E4614;          --accent: var(--purple); }
.course--green  { --c1: var(--green);  --c2: #0B5E4A;          --accent: var(--green); }
.course__banner {
  position: relative; height: 82px; padding: .8rem 1rem;
  display: flex; justify-content: space-between; align-items: flex-start;
  color: #fff; font-size: 12px; font-weight: 700;
  background:
    radial-gradient(circle at 85% 120%, rgba(255, 255, 255, .25) 0 18%, transparent 19%),
    radial-gradient(circle at 100% 0%, rgba(255, 255, 255, .14) 0 30%, transparent 31%),
    linear-gradient(135deg, var(--c1), var(--c2));
}
.course__code { padding: .22rem .55rem; border-radius: 7px; background: rgba(255, 255, 255, .2); letter-spacing: .3px; }
.course__mode { opacity: .9; }
.course__body { flex: 1; display: flex; flex-direction: column; padding: 1rem 1.05rem 1.1rem; }
.course__body h4 { font-size: 15.5px; font-weight: 800; margin-bottom: .3rem; }
.course__teacher { font-size: 13px; color: var(--muted); margin-bottom: .85rem; }
.course .progress span { background: var(--accent); }
.course__progress-label { margin-top: .4rem; font-size: 12px; color: var(--muted); }
.course__kpis { display: grid; grid-template-columns: repeat(3, 1fr); margin: auto 0 0; padding-top: .8rem; border-top: 1px dashed var(--line); }
.course__progress-label + .course__kpis { margin-top: .9rem; }
.course__kpis div { text-align: center; }
.course__kpis dt { font-size: 10.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.course__kpis dd { margin: .1rem 0 0; font-size: 17px; font-weight: 800; }
.course__badge {
  display: inline-flex; gap: .35rem; align-items: center; align-self: flex-start; margin-top: .85rem;
  padding: .3rem .6rem; border-radius: 8px; font-size: 12px; font-weight: 700; color: var(--red-600); background: var(--red-50);
}

.progress { height: 8px; border-radius: 8px; background: var(--line-2); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--navy), var(--purple)); transition: width .8s var(--ease); }
.progress--sm { height: 6px; margin-bottom: .25rem; }

/* Listas */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--line-2); }
.list > li:last-child { border-bottom: 0; }
.list__item { display: flex; align-items: center; gap: .85rem; padding: .75rem 0; color: var(--ink); }
.list > li:first-child > .list__item, .list > .list__item:first-child { padding-top: 0; }
.list > li:last-child > .list__item { padding-bottom: 0; }
a.list__item:hover strong { color: var(--navy); }
.list--padded > li > .list__item { padding: .9rem 1.4rem !important; }
a.list__item { transition: background .15s; }
.list--padded > li > a.list__item:hover { background: var(--cream); }
.list__icon {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px;
  background: var(--navy-50); color: var(--navy); font-size: 1.02rem;
}
.list__icon.is-done, .list__icon--green   { background: var(--green-50); color: var(--green); }
.list__icon.is-urgent, .list__icon--red   { background: var(--red-50); color: var(--red); }
.list__icon.is-warn, .list__icon--amber   { background: var(--amber-50); color: var(--amber); }
.list__icon--purple { background: var(--purple-50); color: var(--purple); }
.list__text { flex: 1; min-width: 0; }
.list__text strong { display: block; font-size: 14px; font-weight: 700; }
.list__text small { display: block; font-size: 12.5px; color: var(--muted); }

/* Línea de tiempo */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line-2); }
.timeline li:first-child { padding-top: 0; }
.timeline li:last-child { border-bottom: 0; padding-bottom: 0; }
.timeline__time { flex: none; width: 54px; font-weight: 800; font-size: 14px; color: var(--navy); }
.timeline__time small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.timeline a { color: var(--ink); min-width: 0; }
.timeline strong { display: block; font-size: 14px; }
.timeline small { font-size: 12.5px; color: var(--muted); }

/* Anuncios */
.news { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.news__item { padding: .85rem 1rem; border-radius: 13px; background: var(--cream); border: 1px solid var(--line-2); }
.news__item.is-pinned { background: var(--lavender-50); border-color: #EFE3C4; }
.news__meta { font-size: 11.5px; font-weight: 700; color: var(--purple); text-transform: uppercase; letter-spacing: .4px; margin-bottom: .25rem; }
.news__item strong { display: block; font-size: 14px; margin-bottom: .2rem; }
.news__item p:last-child { font-size: 13px; color: var(--ink-2); }

.chips { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .3rem; margin-bottom: 1.1rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips a {
  flex: none; padding: .5rem .95rem; border-radius: 999px; border: 1px solid var(--line); background: #fff;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.chips a.is-active { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }

.announcements { display: grid; gap: 1rem; max-width: 860px; }
.announcement header { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.announcement__src { font-size: 12px; font-weight: 700; color: var(--purple); text-transform: uppercase; letter-spacing: .4px; }
.announcement h3 { font-size: 18px; font-weight: 800; margin-bottom: .45rem; }
.announcement p { color: var(--ink-2); }
.announcement footer { margin-top: .9rem; font-size: 12.5px; }
.announcement.is-pinned { border-color: #EADBB4; background: linear-gradient(180deg, var(--lavender-50), #fff 60%); }

/* Sesiones (docente) */
.sessions { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.session { display: flex; gap: .9rem; padding: .85rem; border-radius: 14px; border: 1px solid var(--line-2); }
.session.is-next { border-color: #E8D6A8; background: linear-gradient(135deg, var(--lavender-50), #fff); }
.session__date { flex: none; width: 56px; padding: .45rem 0; border-radius: 12px; text-align: center; background: var(--navy-50); color: var(--navy); line-height: 1.1; }
.session.is-next .session__date { background: var(--purple); color: #fff; }
.session__date span { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.session__date strong { display: block; font-size: 22px; font-weight: 800; }
.session__body { min-width: 0; }
.session__body .pill { margin-bottom: .3rem; }
.session__body strong { display: block; font-size: 14px; }
.session__body p { font-size: 13px; color: var(--ink-2); margin: .1rem 0 .3rem; }

/* Tablas */
.table-wrap { overflow-x: auto; margin: 0 -1.4rem; padding: 0 1.4rem; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: .6rem .75rem; font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; background: var(--cream); border-bottom: 1px solid var(--line);
}
.table th:first-child { border-radius: 10px 0 0 10px; }
.table th:last-child  { border-radius: 0 10px 10px 0; }
.table td { padding: .8rem .75rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FDFBF8; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table small { font-size: 12.5px; }
.table--compact td { padding: .6rem .75rem; }
.table--stack td:first-child { min-width: 200px; }
.td-progress { min-width: 130px; }

/* Salud del sistema */
.health { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.health__item { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem .9rem; border-radius: 13px; border: 1px solid var(--line-2); background: var(--cream); }
.health__item > .bi { font-size: 1.05rem; line-height: 1.35; }
.health__item strong { display: block; font-size: 13.5px; }
.health__item small { font-size: 12.5px; color: var(--muted); }
.health__item--ok   > .bi { color: var(--green); }
.health__item--warn { background: var(--amber-50); border-color: #F5DFB3; }
.health__item--warn > .bi { color: var(--amber); }
.health__item--bad  { background: var(--red-50); border-color: #F6C4C9; }
.health__item--bad  > .bi { color: var(--red); }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.bars__label { display: flex; justify-content: space-between; gap: 1rem; font-size: 13.5px; margin-bottom: .35rem; }
.bars__label span { color: var(--ink-2); }
.bars__track { height: 10px; border-radius: 10px; background: var(--line-2); overflow: hidden; }
.bars__track span { display: block; height: 100%; border-radius: inherit; min-width: 4px; }

/* Estado vacío */
.empty-state { text-align: center; padding: 1.6rem 1rem; color: var(--muted); }
.empty-state--sm { padding: .75rem .5rem; }
.empty-state--lg { padding: 3.5rem 1.5rem; }
.empty-state--lg h2 { font: 700 30px var(--serif); color: var(--navy-900); margin: .4rem 0 .5rem; }
.empty-state--lg p { max-width: 460px; margin: 0 auto 1.2rem; }
.empty-state--lg p:last-child { margin-bottom: 0; }
.empty-state__icon {
  width: 58px; height: 58px; margin: 0 auto .7rem; display: grid; place-items: center; border-radius: 17px;
  font-size: 1.5rem; background: var(--lavender-50); color: var(--purple);
}
.empty-state--lg .empty-state__icon { width: 78px; height: 78px; font-size: 2rem; border-radius: 24px; }
.empty-state__icon.is-good { background: var(--green-50); color: var(--green); }
.empty-state p { font-size: 14px; }
.empty-filter { text-align: center; padding: 2rem 0; }

/* ---------------------------------------------------------------------
   Detalle de curso
   --------------------------------------------------------------------- */
.course-hero {
  position: relative; overflow: hidden; display: flex; align-items: flex-end; justify-content: space-between; gap: 1.2rem; flex-wrap: wrap;
  padding: 2rem 2.1rem; border-radius: 24px; color: #fff; margin-bottom: 1rem;
  background:
    radial-gradient(circle at 92% 130%, rgba(255, 255, 255, .2) 0 22%, transparent 23%),
    radial-gradient(circle at 100% -10%, rgba(255, 255, 255, .12) 0 28%, transparent 29%),
    linear-gradient(130deg, var(--c1), var(--c2));
  box-shadow: var(--shadow);
}
.course-hero__main { min-width: 0; flex: 1 1 320px; }
.course-hero__code { font-size: 12.5px; font-weight: 700; letter-spacing: .4px; opacity: .85; }
.course-hero h2 { font: 700 38px/1.05 var(--serif); margin: .35rem 0 .7rem; }
.course-hero__meta { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; font-size: 14px; opacity: .92; }
.course-hero__kpis { display: flex; gap: .6rem; margin: 0; }
.course-hero__kpis div { min-width: 92px; padding: .7rem .9rem; border-radius: 14px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .18); text-align: center; }
.course-hero__kpis dt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; opacity: .8; }
.course-hero__kpis dd { margin: .15rem 0 0; font-size: 22px; font-weight: 800; }

.next-class {
  display: flex; gap: .85rem; align-items: center; padding: .85rem 1.1rem; margin-bottom: 1.2rem;
  border-radius: 14px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.next-class > .bi { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--purple-50); color: var(--purple); font-size: 1.1rem; }
.next-class strong { display: block; font-size: 14px; }
.next-class span { font-size: 13px; color: var(--muted); }

/* Pestañas */
.tabs__list {
  display: flex; gap: .35rem; padding: .35rem; margin-bottom: 1.2rem; overflow-x: auto; scrollbar-width: none;
  background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow-sm);
  position: sticky; top: 76px; z-index: 20;
}
.tabs__list::-webkit-scrollbar { display: none; }
.tabs__list button {
  flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 42px; padding: .55rem .95rem; border: 0; border-radius: 11px; background: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; transition: background .2s, color .2s;
}
.tabs__list button:hover { background: var(--cream); }
.tabs__list button[aria-selected='true'] { background: var(--navy-900); color: #fff; }
.tabs__list button em { font-style: normal; font-size: 11px; font-weight: 800; padding: .05rem .4rem; border-radius: 8px; background: var(--red); color: #fff; }
.js .tabs__panel:not(.is-active) { display: none; }
.tabs__panel { animation: aparecer .3s var(--ease); }
html:not(.js) .tabs__list { display: none; }
html:not(.js) .tabs__panel { margin-bottom: 1.4rem; }

/* Unidades y recursos */
.unit { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .9rem; box-shadow: var(--shadow-sm); overflow: hidden; }
.unit summary { display: flex; align-items: center; gap: .85rem; padding: 1rem 1.2rem; cursor: pointer; list-style: none; }
.unit summary::-webkit-details-marker { display: none; }
.unit summary::after { content: '\F282'; font-family: 'bootstrap-icons'; margin-left: .3rem; color: var(--muted); transition: transform .2s; }
.unit[open] summary::after { transform: rotate(180deg); }
.unit[open] summary { border-bottom: 1px solid var(--line-2); }
.unit__num { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: var(--navy-900); color: #fff; font-weight: 800; font-size: 14px; }
.unit__title { flex: 1; font-weight: 800; font-size: 15px; }
.unit__count { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--line-2); padding: .15rem .55rem; border-radius: 8px; }
.unit__desc { padding: .9rem 1.2rem 0; color: var(--ink-2); font-size: 14px; }
.unit__empty { padding: 1rem 1.2rem 1.1rem; color: var(--muted); font-size: 13.5px; }
.resources { list-style: none; margin: 0; padding: .5rem .6rem .7rem; }
.resource { display: flex; align-items: flex-start; gap: .85rem; padding: .7rem .6rem; border-radius: 12px; }
.resource:hover { background: var(--cream); }
.resource__icon { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; font-size: 1.15rem; background: var(--navy-50); color: var(--navy); }
.resource--video  .resource__icon { background: var(--red-50); color: var(--red); }
.resource--enlace .resource__icon { background: var(--purple-50); color: var(--purple); }
.resource--texto  .resource__icon { background: var(--green-50); color: var(--green); }
.resource__body { flex: 1; min-width: 0; }
.resource__body strong { display: block; font-size: 14px; }
.resource__body small { font-size: 12.5px; color: var(--muted); }
.resource__body p { margin-top: .35rem; font-size: 13.5px; color: var(--ink-2); }
.resource__action { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); color: var(--navy); background: #fff; }
.resource__action:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Notas */
.grade-summary { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.2rem; padding-bottom: 1.2rem; border-bottom: 1px dashed var(--line); }
.grade-summary__big { flex: none; font-size: 44px; font-weight: 800; letter-spacing: -1px; line-height: 1; text-align: center; }
.grade-summary__big small { display: block; margin-top: .3rem; font-size: 11.5px; font-weight: 700; letter-spacing: .3px; color: var(--muted); text-transform: uppercase; }
.grade-summary__bar { flex: 1; }
.grade-summary__bar p { margin-bottom: .5rem; }
.grade { font-size: 16px; }

.grade-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; }
.grade-card__head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.grade-card__dot { flex: none; width: 10px; align-self: stretch; border-radius: 6px; background: linear-gradient(180deg, var(--c1), var(--c2)); }
.grade-card__head div { flex: 1; min-width: 0; }
.grade-card__head h3 { font-size: 15.5px; font-weight: 800; }
.grade-card__head h3 a { color: var(--ink); }
.grade-card__head h3 a:hover { color: var(--navy); }
.grade-card__avg { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.grade-list { list-style: none; margin: 0; padding: 0; }
.grade-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.grade-list strong { font-size: 15px; }

/* Asistencia */
.att-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; margin-bottom: 1.1rem; }
.att-summary__item { padding: .8rem; border-radius: 13px; text-align: center; background: var(--b); color: var(--c); }
.att-summary__item strong { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; }
.att-summary__item span { font-size: 12px; font-weight: 700; }
.att-summary__item--green  { --b: var(--green-50);  --c: var(--green); }
.att-summary__item--amber  { --b: var(--amber-50);  --c: var(--amber); }
.att-summary__item--red    { --b: var(--red-50);    --c: var(--red); }
.att-summary__item--purple { --b: var(--purple-50); --c: var(--purple); }

.sessions-list { list-style: none; margin: 0; padding: 0; }
.sessions-list li { display: flex; align-items: center; gap: .85rem; padding: .7rem 0; border-top: 1px solid var(--line-2); }
.sessions-list li.is-future { opacity: .62; }
.sessions-list__n { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--line-2); font-size: 13px; font-weight: 800; color: var(--ink-2); }
.sessions-list__text { flex: 1; min-width: 0; }
.sessions-list__text strong { display: block; font-size: 14px; }
.sessions-list__text small { font-size: 12.5px; color: var(--muted); }

.att-cards { display: grid; gap: 1rem; }
.att-card { padding: 0; }
.att-card summary { display: flex; align-items: center; gap: 1.1rem; padding: 1.1rem 1.3rem; cursor: pointer; list-style: none; }
.att-card summary::-webkit-details-marker { display: none; }
.att-card.is-risk { border-color: #F6C4C9; }
.att-card__ring {
  flex: none; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--green) calc(var(--p) * 1%), var(--line-2) 0);
}
.att-card.is-risk .att-card__ring { background: conic-gradient(var(--red) calc(var(--p) * 1%), var(--line-2) 0); }
.att-card__ring span { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: #fff; font-size: 13.5px; font-weight: 800; }
.att-card__info { flex: 1; min-width: 0; }
.att-card__info strong { display: block; font-size: 15px; }
.att-card__chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.att-card__chev { color: var(--muted); transition: transform .2s; }
.att-card[open] .att-card__chev { transform: rotate(180deg); }
.att-card .sessions-list, .att-card__empty { padding: 0 1.3rem 1rem; }

/* Datos clave */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.2rem; margin: 0; }
.facts dt { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.facts dd { margin: .15rem 0 0; font-size: 14.5px; font-weight: 600; }
.facts--row { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 1.2rem 0; padding: 1rem 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.subhead { margin: 1.3rem 0 .5rem; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--purple); }
.prose { font-size: 14.5px; color: var(--ink-2); line-height: 1.65; }
.person { display: flex; align-items: center; gap: .8rem; }
.person strong { display: block; font-size: 14.5px; }
.person a { font-size: 13px; word-break: break-all; }
.quote { margin-top: .7rem; padding: .8rem 1rem; border-left: 3px solid var(--lavender); border-radius: 0 12px 12px 0; background: var(--lavender-50); font-size: 14px; color: var(--ink-2); }

/* Tareas */
.segmented {
  display: inline-flex; gap: .3rem; padding: .3rem; margin-bottom: 1.2rem; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.segmented a { flex: none; display: inline-flex; align-items: center; gap: .45rem; min-height: 40px; padding: .5rem .95rem; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.segmented a em { font-style: normal; font-size: 11.5px; font-weight: 800; padding: .05rem .45rem; border-radius: 8px; background: var(--line-2); }
.segmented a.is-active { background: var(--navy-900); color: #fff; }
.segmented a.is-active em { background: rgba(255, 255, 255, .18); }

.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.task {
  position: relative; display: flex; flex-direction: column; padding: 1.15rem 1.2rem 1rem 1.35rem; border-radius: var(--radius);
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: var(--ink); overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s;
}
.task::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tc, var(--navy)); }
.task--red { --tc: var(--red); } .task--green { --tc: var(--green); } .task--purple { --tc: var(--purple); } .task--amber { --tc: var(--amber); }
.task:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.task__top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.task__course { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .4px; }
.task h3 { font-size: 16px; font-weight: 800; }
.task__sub { font-size: 13px; color: var(--muted); margin-top: .15rem; }
.task__foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: auto; padding-top: .9rem; font-size: 13px; color: var(--ink-2); }
.task__sub + .task__foot { margin-top: .9rem; border-top: 1px dashed var(--line); }

.task-detail__course a { font-size: 13px; font-weight: 700; color: var(--purple); }
.task-detail h2 { font: 700 32px/1.1 var(--serif); color: var(--navy-900); margin: .4rem 0 .7rem; }
.file-chip {
  display: flex; align-items: center; gap: .7rem; margin-top: 1rem; padding: .75rem .9rem; border-radius: 13px;
  border: 1px solid var(--line); background: var(--cream); color: var(--ink); font-size: 14px; font-weight: 600;
}
.file-chip:first-child { margin-top: 0; }
.file-chip span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip > .bi:first-child { font-size: 1.3rem; color: var(--red); }
.file-chip > .bi:last-child { color: var(--navy); }
.file-chip:hover { border-color: var(--navy); }
.file-chip + .muted { margin-top: .7rem; }
.feedback__grade { font-size: 48px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.feedback__grade small { font-size: 18px; color: var(--muted); font-weight: 600; margin-left: .3rem; }

/* Horario semanal */
.week { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .8rem; }
.week__day { display: flex; flex-direction: column; gap: .6rem; padding: .8rem; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); min-height: 220px; }
.week__day.is-today { border-color: #F2B8BE; box-shadow: 0 0 0 4px var(--red-50); }
.week__day header { display: flex; justify-content: space-between; align-items: center; padding: .1rem .2rem .3rem; }
.week__day header strong { font-size: 14px; font-weight: 800; }
.week__free { margin: auto; color: #B5B9C9; font-size: 13px; font-weight: 600; }
.slot {
  display: flex; flex-direction: column; gap: .15rem; padding: .7rem .75rem; border-radius: 13px; color: #fff;
  background: linear-gradient(140deg, var(--c1), var(--c2)); transition: transform .2s var(--ease);
}
.slot:hover { transform: translateY(-2px); }
.slot__time { font-size: 12px; font-weight: 800; opacity: .9; }
.slot strong { font-size: 13.5px; line-height: 1.25; }
.slot small { font-size: 11.5px; opacity: .88; }

/* Carrera */
.career {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1.4rem 2rem; padding: 2rem 2.1rem; border-radius: 24px;
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.career::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, var(--navy) 0 50%, var(--lavender) 50%); }
.career__fac { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--purple); }
.career h2 { font: 700 36px/1.1 var(--serif); color: var(--navy-900); margin: .35rem 0 .5rem; }
.career__degree { font-weight: 600; color: var(--ink-2); font-size: 14.5px; }
.career__desc { margin-top: .7rem; color: var(--muted); font-size: 14px; }
.career__stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; margin: 0; align-self: center; }
.career__stats div { padding: .9rem 1rem; border-radius: 14px; background: var(--cream); border: 1px solid var(--line-2); }
.career__stats dt { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.career__stats dd { margin: .1rem 0 0; font-size: 26px; font-weight: 800; color: var(--navy-900); }
.career__stats dd small { font-size: 14px; color: var(--muted); font-weight: 600; }
.career__stats .career__date { font-size: 15px; padding-top: .35rem; }
.career__progress { grid-column: 1 / -1; }
.career__progress small { display: block; margin-top: .4rem; font-size: 12.5px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.plan { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.plan__cycle { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow-sm); }
.plan__cycle.is-current { border-color: #F2B8BE; box-shadow: 0 0 0 4px var(--red-50); }
.plan__cycle header { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.plan__cycle header strong { font-size: 15px; font-weight: 800; }
.plan__cycle header small { color: var(--muted); font-size: 12.5px; margin-right: auto; }
.plan__cycle ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.plan__course { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 12px; background: var(--cream); }
.plan__course > .bi { font-size: 1.05rem; color: var(--pc); }
.plan__course div { flex: 1; min-width: 0; }
.plan__course strong { display: block; font-size: 13.5px; line-height: 1.3; }
.plan__course small { font-size: 12px; color: var(--muted); }
.plan__course b { font-size: 14px; }
.plan__course--green  { --pc: var(--green); }
.plan__course--purple { --pc: var(--purple); background: var(--purple-50); }
.plan__course--red    { --pc: var(--red); }
.plan__course--navy   { --pc: #BCD6C3; }

/* Perfil */
.profile { margin-bottom: 1.4rem; border-radius: 24px; overflow: hidden; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.profile__cover {
  height: 120px;
  background:
    radial-gradient(circle at 85% 130%, rgba(217, 185, 106, .55), transparent 45%),
    radial-gradient(circle at 10% -30%, rgba(46, 155, 87, .45), transparent 45%),
    linear-gradient(120deg, var(--navy-900), var(--navy) 60%, var(--purple));
}
.profile__body { display: flex; align-items: flex-end; gap: 1.2rem; padding: 0 1.8rem 1.4rem; margin-top: -48px; flex-wrap: wrap; }
.profile__id h2 { font: 700 30px/1.1 var(--serif); color: var(--navy-900); }
.profile__id p { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: .35rem; }

/* Notificaciones */
.notifs { list-style: none; margin: 0; padding: 0; }
.notif { display: flex; gap: .9rem; padding: 1rem 1.4rem; border-bottom: 1px solid var(--line-2); }
.notif:last-child { border-bottom: 0; }
.notif.is-unread { background: linear-gradient(90deg, var(--lavender-50), #fff); }
.notif__icon { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--navy-50); color: var(--navy); }
.notif.is-unread .notif__icon { background: var(--red); color: #fff; }
.notif__body strong { display: block; font-size: 14.5px; }
.notif__body strong a { color: var(--ink); }
.notif__body p { font-size: 13.5px; color: var(--ink-2); }
.notif__body small { font-size: 12px; color: var(--muted); }

/* Página de error */
.page-error { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.error-card { max-width: 520px; text-align: center; background: #fff; padding: 2.5rem 2rem; border-radius: 22px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.error-card img { margin: 0 auto 1rem; }
.error-card h1 { font: 700 30px var(--serif); margin-bottom: .6rem; }
.error-card p { color: var(--ink-2); margin-bottom: 1.2rem; }
.error-card pre { text-align: left; white-space: pre-wrap; font-size: 12.5px; background: var(--red-50); color: #8E0B16; padding: .8rem; border-radius: 10px; margin-bottom: 1.2rem; }

@keyframes aparecer { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .stats--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .week { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid--main { grid-template-columns: minmax(0, 1fr); }
  .career { grid-template-columns: minmax(0, 1fr); }
}

/* Tablet y celular: menú lateral deslizable + barra inferior */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-102%); box-shadow: var(--shadow-lg); width: min(86vw, 320px); }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(11, 41, 21, .5); backdrop-filter: blur(2px); animation: aparecer .2s; }
  .sidebar__close { display: grid; place-items: center; }
  .sidebar__me { display: flex; }
  .main { margin-left: 0; padding-bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom)); }
  .topbar__iso { display: grid; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--2 { grid-template-columns: minmax(0, 1fr); }
  .tabs__list { top: 70px; }

  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: flex; justify-content: space-around; align-items: stretch;
    height: calc(var(--bottom-nav) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); box-shadow: 0 -6px 20px -12px rgba(18, 58, 32, .2);
  }
  .bottom-nav a, .bottom-nav button {
    position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
    border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer;
  }
  .bottom-nav .bi { font-size: 1.3rem; line-height: 1; transition: transform .2s var(--ease); }
  .bottom-nav .is-active { color: var(--navy); }
  .bottom-nav .is-active::before { content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--lavender); }
  .bottom-nav .is-active .bi { transform: translateY(-1px); }
}

@media (max-width: 760px) {
  .week { grid-template-columns: minmax(0, 1fr); }
  .week__day { min-height: 0; }
  .week__day.is-empty { flex-direction: row; justify-content: space-between; align-items: center; padding: .65rem .9rem; }
  .week__day.is-empty header { padding: 0; }
  .week__day.is-empty .week__free { margin: 0; }
  .facts--row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .att-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-band { grid-template-columns: minmax(0, 1fr); }
  .summary-band > div { display: flex; justify-content: space-between; align-items: center; border-right: 0; border-bottom: 1px solid var(--line-2); padding: .85rem 1.1rem; }
  .summary-band > div:last-child { border-bottom: 0; }
  .summary-band strong { font-size: 22px; }
  .welcome { flex-direction: column; text-align: center; padding: 2rem 1.3rem; gap: 1.2rem; }
  .welcome__art { width: 110px; height: 110px; border-radius: 30px; }
  .welcome__art img { width: 74px; }
  .welcome__actions { justify-content: center; }
  .welcome__actions .btn { flex: 1 1 200px; }

  /* Tablas → tarjetas */
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { padding: .8rem 0; border-bottom: 1px solid var(--line-2); }
  .table--stack tbody tr:last-child { border-bottom: 0; }
  .table--stack td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .25rem 0; border: 0; text-align: right; }
  .table--stack td::before { content: attr(data-label); font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; text-align: left; }
  .table--stack td:first-child { display: block; text-align: left; padding-bottom: .4rem; }
  .table--stack td:first-child::before { display: none; }
  .table--stack tbody tr:hover td { background: none; }
  .table--stack td:first-child { min-width: 0; }
  .table--stack .td-progress .progress { flex: 1; margin: 0; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .topbar { padding: .65rem 1rem; padding-top: calc(.65rem + env(safe-area-inset-top)); gap: .7rem; }
  .topbar__title h1 { font-size: 17px; }
  .topbar__title p, .user-menu__info, .user-menu__btn > .bi { display: none; }
  .user-menu__btn { padding: .25rem; border-radius: 13px; }
  .icon-btn { width: 40px; height: 40px; }
  .user-menu__panel { position: fixed; left: 1rem; right: 1rem; top: calc(64px + env(safe-area-inset-top)); width: auto; }
  .content { padding: 1rem 1rem 1.6rem; }
  .app-footer { justify-content: center; text-align: center; padding: 1rem; }

  .hero { padding: 1.4rem 1.3rem; border-radius: 20px; gap: 1rem; }
  .hero h2 { font-size: 32px; }
  .hero__meta { font-size: 13px; }
  .hero__progress { display: flex; align-items: center; gap: .75rem; }
  .hero__progress p { margin: 0; }
  .ring { width: 64px; height: 64px; }
  .ring span { width: 52px; height: 52px; font-size: 21px; padding-top: 15px; }

  .stats, .stats--5 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .7rem; margin-bottom: 1rem; }
  .stat { flex-direction: column; align-items: flex-start; gap: .55rem; padding: .9rem; }
  .stat > .bi { width: 38px; height: 38px; font-size: 1.05rem; border-radius: 11px; }
  .stat strong { font-size: 22px; }
  .stat span { font-size: 12.5px; }

  .grid, .stack { gap: 1rem; }
  .card { padding: 1.1rem 1rem; border-radius: 16px; }
  .card--flush { padding: .3rem 0; }
  .list--padded > li > .list__item { padding: .85rem 1rem !important; }
  .table-wrap { margin: 0 -1rem; padding: 0 1rem; }
  .health { grid-template-columns: minmax(0, 1fr); }
  .course-grid, .course-grid--page, .task-grid, .grade-cards, .plan { grid-template-columns: minmax(0, 1fr); }

  .page-head { margin-bottom: 1rem; }
  .page-head h2 { font-size: 28px; }
  .search { min-width: 0; width: 100%; }

  .course-hero { padding: 1.4rem 1.2rem; border-radius: 20px; }
  .course-hero h2 { font-size: 29px; }
  .course-hero__meta { font-size: 13px; }
  .course-hero__kpis { width: 100%; }
  .course-hero__kpis div { flex: 1; min-width: 0; padding: .6rem .4rem; }
  .course-hero__kpis dd { font-size: 19px; }
  .tabs__list { top: 62px; margin-left: -1rem; margin-right: -1rem; border-radius: 0; border-left: 0; border-right: 0; padding: .35rem 1rem; }
  .tabs__list button { flex: none; padding: .5rem .8rem; font-size: 13.5px; }

  .unit summary { padding: .9rem 1rem; }
  .resources { padding: .4rem .3rem .6rem; }
  .grade-summary { gap: 1rem; }
  .grade-summary__big { font-size: 36px; }
  .att-card summary { padding: 1rem; gap: .8rem; }
  .att-card .sessions-list, .att-card__empty { padding: 0 1rem 1rem; }
  .task-detail h2 { font-size: 27px; }
  .career { padding: 1.5rem 1.2rem; border-radius: 20px; }
  .career h2 { font-size: 29px; }
  .career__stats dd { font-size: 22px; }
  .profile__body { padding: 0 1.1rem 1.2rem; gap: .8rem; }
  .avatar--xl { width: 84px; height: 84px; font-size: 28px; border-radius: 22px; }
  .profile__id h2 { font-size: 26px; }
  .form--inline .btn { width: 100%; }
  .notif { padding: .9rem 1rem; }
  .segmented { display: flex; }
  .segmented a { flex: 1 1 auto; justify-content: center; gap: .3rem; padding: .5rem .55rem; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
