/* Menú lateral desplegable y ajustes generales de la interfaz.
   Se carga después del resto de hojas para sobrescribir sus reglas. */

:root {
  --sidebar-width: 264px;
  --sidebar-collapsed: 76px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* El contenido ocupa todo el ancho disponible en vez de quedarse centrado */
.app-shell .content {
  max-width: none;
}

/* ---------- Menú lateral ---------- */

.app-shell .sidebar {
  z-index: 40;
  width: var(--sidebar-width);
  gap: 22px;
  padding: 22px 14px 16px;
  background: rgba(255, 255, 255, .97);
  transition: width .25s var(--ease), padding .25s var(--ease), transform .28s var(--ease);
}

.app-shell .brand {
  position: relative;
  justify-content: flex-start;
  min-height: 42px;
  padding: 0 8px;
}

.app-shell .brand > div {
  display: block;
  overflow: hidden;
  white-space: nowrap;
}

.mini-profile {
  width: 100%;
  color: inherit;
  text-align: left;
}

/* Barra para plegar el menú: ocupa todo el borde derecho de la barra lateral */
.sidebar-rail {
  position: absolute;
  z-index: 2;
  top: 0;
  right: -8px;
  bottom: 0;
  width: 16px;
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  color: var(--muted);
  cursor: col-resize;
}

.sidebar-rail::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 7px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
  content: '';
  transition: background .18s ease;
}

.sidebar-rail span {
  position: relative;
  width: 16px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: white;
  box-shadow: 0 3px 10px rgba(15, 23, 42, .08);
  transition: background .18s ease, border-color .18s ease, color .18s ease, height .18s ease;
}

.sidebar-rail svg {
  width: 12px;
  height: 12px;
  transition: transform .25s var(--ease);
}

.sidebar-rail:hover::before,
.sidebar-rail:focus-visible::before {
  background: rgba(11, 99, 206, .35);
}

.sidebar-rail:hover span,
.sidebar-rail:focus-visible span {
  height: 52px;
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.sidebar-rail:focus-visible {
  outline: none;
}

.sidebar-close,
.menu-button,
.sidebar-backdrop {
  display: none;
}

.app-shell .nav {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0 -6px;
  padding: 0 6px;
  scrollbar-width: thin;
}

.nav-group {
  display: grid;
  gap: 3px;
}

/* Administración va al final del menú, justo encima del perfil */
.nav-group-admin {
  margin-top: auto;
}

.nav-label {
  overflow: hidden;
  padding: 0 12px 4px;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.app-shell .nav button {
  position: relative;
  justify-content: flex-start;
  padding: 10px 12px;
  white-space: nowrap;
}

.app-shell .nav span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-shell .nav svg {
  flex: none;
}

.app-shell .nav button:hover {
  background: #f2f7fd;
  color: var(--primary);
}

.app-shell .nav button.active {
  background: linear-gradient(90deg, #e3efff, #eef5ff);
  box-shadow: inset 3px 0 var(--primary);
}

.nav-badge {
  min-width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  margin-left: auto;
  border-radius: 99px;
  background: var(--amber);
  color: white;
  padding: 0 5px;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.app-shell .side-bottom {
  display: grid;
  gap: 8px;
  padding: 14px 0 0;
}

.app-shell .mini-profile {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
  padding: 9px;
}

.app-shell .mini-profile > .avatar {
  display: grid;
}

.app-shell .mini-profile > div:last-child {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.app-shell .mini-profile small,
.app-shell .mini-profile strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-shell .logout {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  border-radius: 10px;
  padding: 9px 12px;
  white-space: nowrap;
}

.app-shell .logout:hover {
  background: #fef2f2;
}

.logout svg {
  width: 17px;
  height: 17px;
  flex: none;
}

/* Estado contraído (escritorio y tableta) */
@media (min-width: 651px) {
  .app-shell.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
    padding-right: 12px;
    padding-left: 12px;
  }

  .sidebar-collapsed .brand {
    justify-content: center;
    padding: 0;
  }

  .sidebar-collapsed .brand > div,
  .sidebar-collapsed .nav span,
  .sidebar-collapsed .mini-profile > div:last-child,
  .sidebar-collapsed .logout span {
    display: none;
  }

  .sidebar-collapsed .sidebar-rail svg {
    transform: rotate(180deg);
  }

  .sidebar-collapsed .nav {
    overflow: visible;
  }

  .sidebar-collapsed .nav-label {
    height: 1px;
    margin: 0 10px 6px;
    padding: 0;
    background: var(--line);
    font-size: 0;
  }

  .sidebar-collapsed .nav-group:first-child .nav-label {
    display: none;
  }

  .app-shell.sidebar-collapsed .nav button,
  .app-shell.sidebar-collapsed .logout {
    justify-content: center;
    padding: 11px;
  }

  .sidebar-collapsed .nav-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    min-width: 16px;
    height: 16px;
    border: 2px solid white;
    padding: 0 3px;
    font-size: 8px;
  }

  .sidebar-collapsed .mini-profile {
    justify-content: center;
    border-color: transparent;
    background: none;
    padding: 0;
  }

  /* Etiquetas emergentes al pasar el ratón */
  .sidebar-collapsed [data-tooltip] {
    position: relative;
  }

  .sidebar-collapsed [data-tooltip]:hover::after,
  .sidebar-collapsed [data-tooltip]:focus-visible::after {
    position: absolute;
    z-index: 60;
    top: 50%;
    left: calc(100% + 14px);
    border-radius: 8px;
    background: var(--ink);
    color: white;
    padding: 6px 10px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .18);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    content: attr(data-tooltip);
    pointer-events: none;
    transform: translateY(-50%);
  }
}

/* ---------- Logotipo ---------- */

.wordmark {
  color: #15426f;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  letter-spacing: -.02em;
  text-transform: uppercase;
}

.wordmark span {
  color: #2563b8;
}

.brand .wordmark {
  font-size: 19px;
  letter-spacing: -.02em;
}

.login-brand .wordmark {
  font-size: 23px;
  letter-spacing: -.02em;
}

.brand img,
.login-brand img {
  border-radius: 12px;
  filter: drop-shadow(0 6px 12px rgba(21, 66, 111, .14));
}

/* ---------- Barra superior ---------- */

.topbar-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-button {
  width: 40px;
  height: 40px;
  place-items: center;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
}

.menu-button svg {
  width: 19px;
}

/* ---------- Detalles generales ---------- */

/* Solo al entrar en una sección: si se repitiera en cada refresco de datos, la página parpadearía. */
.view.active.is-entering {
  animation: view-in .28s var(--ease);
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.card {
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03), 0 4px 12px rgba(15, 23, 42, .04);
  transition: border-color .2s ease, box-shadow .2s ease;
}

.card:hover {
  box-shadow: 0 2px 4px rgba(15, 23, 42, .03), 0 12px 28px rgba(15, 23, 42, .07);
}

.hero {
  border-color: #d6e7fa;
}

button:disabled {
  cursor: not-allowed;
  opacity: .6;
  transform: none !important;
}

/* Botón ocupado: muestra una ruedita mientras se guarda o publica */
button.is-busy {
  cursor: progress;
  opacity: .85;
}

button.is-busy::before {
  width: 14px;
  height: 14px;
  display: inline-block;
  flex: none;
  margin-right: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  content: '';
  animation: button-spin .7s linear infinite;
}

.primary.is-busy::before,
.hero-action.is-busy::before {
  margin-right: 0;
}

button.is-busy svg {
  display: none;
}

@keyframes button-spin {
  to { transform: rotate(360deg); }
}

::selection {
  background: rgba(11, 99, 206, .16);
}

/* ---------- Fotos de perfil ---------- */

.avatar.has-photo {
  overflow: hidden;
  background: #e2e8f0;
  padding: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.profile-modal {
  width: min(460px, 100%);
}

.profile-photo {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
}

.profile-preview {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--primary), #3d8ce6);
  color: white;
  font-family: 'Manrope', sans-serif;
  font-size: 30px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(11, 99, 206, .2);
}

.profile-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-photo-info strong {
  display: block;
  font-size: 15px;
}

.profile-photo-info small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.profile-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.secondary.danger-text {
  color: #c53d3d;
}

.secondary[hidden] {
  display: none;
}

/* ---------- Actividades de Google Classroom ---------- */

.hero-buttons {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.hero-action--classroom {
  background: #1e8e3e;
  box-shadow: 0 8px 18px rgba(30, 142, 62, .22);
}

.hero-action--classroom:hover {
  background: #137333;
  box-shadow: 0 11px 23px rgba(30, 142, 62, .28);
}

.event-kind {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: -6px 0 16px;
}

.event-kind label {
  cursor: pointer;
}

.event-kind input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.event-kind span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--muted);
  padding: 10px;
  font-size: 12px;
  font-weight: 800;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.event-kind svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.event-kind input:checked + span {
  border-color: var(--primary);
  background: #eaf4ff;
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 99, 206, .09);
}

.event-kind input[value="classroom"]:checked + span {
  border-color: #1e8e3e;
  background: #ecf8ef;
  color: #137333;
  box-shadow: 0 0 0 3px rgba(30, 142, 62, .1);
}

.event-kind input:focus-visible + span {
  outline: 3px solid rgba(11, 99, 206, .24);
  outline-offset: 2px;
}

.form-group[hidden] {
  display: none;
}

.form-group .form-help {
  margin-top: 6px;
}

.calendar-event--classroom {
  border-left-color: #1e8e3e;
  background: #f0faf3;
}

.calendar-event--classroom {
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
}

.calendar-event--classroom .calendar-event-actions {
  grid-column: 1;
}

.calendar-event--classroom time {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: #137333;
  line-height: 1.2;
}

.calendar-event--classroom time small {
  display: inline;
  margin: 0;
  color: #3f8a55;
  font-size: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.calendar-event--classroom .event-subject {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #137333;
}

.calendar-event--classroom .event-subject svg {
  width: 12px;
  height: 12px;
}

.classroom-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  border: 1px solid #b7dfc2;
  border-radius: 7px;
  background: white;
  color: #137333;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 800;
  text-decoration: none;
}

.classroom-link:hover {
  border-color: #1e8e3e;
  background: #ecf8ef;
}

.classroom-link svg {
  width: 11px;
  height: 11px;
}

/* ---------- Barra superior: buscador, tema y perfil ---------- */

.top-actions {
  gap: 10px;
}

.date-label {
  margin-right: 6px;
}

.search-trigger {
  height: 39px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--muted);
  padding: 0 8px 0 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
}

.search-trigger:hover {
  border-color: #b9d7f5;
  color: var(--primary);
}

.search-trigger svg {
  width: 16px;
  height: 16px;
}

.search-trigger span {
  min-width: 90px;
  text-align: left;
}

kbd {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  padding: 2px 6px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.icon-button {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
}

.icon-button:hover {
  border-color: #b9d7f5;
  color: var(--primary);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.topbar-avatar {
  padding: 0;
  border-radius: 12px;
  background: none;
}

.topbar-avatar .avatar {
  width: 39px;
  height: 39px;
  border-radius: 12px;
}

.topbar-avatar:hover .avatar {
  box-shadow: 0 0 0 3px rgba(11, 99, 206, .2);
}

/* ---------- Inicio: cabecera, próxima clase y accesos rápidos ---------- */

.dashboard-hero {
  align-items: center;
  gap: 32px;
}

/* El anillo decorativo chocaba con el widget de la próxima clase */
.dashboard-hero::after {
  display: none;
}

.dashboard-hero::before {
  top: -120px;
  right: -60px;
}

/* Inicio: tres columnas iguales, sin huecos */
.dashboard-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.dashboard-grid > .card {
  grid-row: auto;
  grid-column: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dashboard-grid > .card > .agenda-list,
.dashboard-grid > .card > .note-stack,
.dashboard-grid > .card > .empty-block {
  flex: 1;
}

.dashboard-grid .agenda-item {
  grid-template-columns: 52px minmax(0, 1fr);
}

.dashboard-grid .agenda-item .tag {
  grid-column: 2;
  justify-self: start;
  margin-top: -4px;
}

.dashboard-hero .hero-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.dashboard-hero .hero-action {
  margin-top: 20px;
}

.next-class {
  position: relative;
  z-index: 1;
  width: min(340px, 38%);
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid #d6e7fa;
  border-radius: 16px;
  background: rgba(255, 255, 255, .86);
  color: var(--ink);
  padding: 18px 20px;
  text-align: left;
  box-shadow: 0 10px 28px rgba(11, 99, 206, .1);
  backdrop-filter: blur(6px);
}

.next-class:hover {
  border-color: #9fc7ed;
  transform: translateY(-2px);
}

.next-class-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.next-class-label svg {
  width: 14px;
  height: 14px;
}

.next-class.is-now .next-class-label {
  color: #098362;
}

.next-class.is-now .next-class-label::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .2);
  content: '';
}

.next-class strong {
  font-family: 'Manrope', sans-serif;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.03em;
}

.next-class-time {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.next-class small {
  color: var(--muted);
  font-size: 12px;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.quick-link {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .96);
  color: var(--ink);
  padding: 12px;
  text-align: left;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03), 0 4px 12px rgba(15, 23, 42, .04);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.quick-link:hover {
  border-color: #b9d7f5;
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.quick-link > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.quick-link strong,
.quick-link small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-link strong {
  font-size: 13px;
}

.quick-link small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.quick-link > svg {
  width: 13px;
  height: 13px;
  flex: none;
  color: var(--muted);
}

.quick-link-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 10px;
  background: #e7f1ff;
  color: var(--primary);
}

.quick-link-icon svg {
  width: 17px;
  height: 17px;
}

.subject-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 16px;
}

.subject-chips > span {
  margin-right: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: #475569;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
}

.chip:hover {
  border-color: #b9d7f5;
  color: var(--primary);
}

.chip.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.agenda-time small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;
}

/* ---------- Estados vacíos ---------- */

.empty-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 1px dashed #c9dcef;
  border-radius: 14px;
  background: #f8fbff;
  padding: 24px 18px;
  text-align: center;
}

.notes-grid > .empty-block,
.card > .empty-block {
  grid-column: 1 / -1;
}

.empty-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 14px;
  background: #e7f1ff;
  color: var(--primary);
}

.empty-icon svg {
  width: 22px;
  height: 22px;
}

.empty-block strong {
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  font-weight: 800;
}

.empty-block p {
  max-width: 320px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.empty-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--primary);
}

.empty-action svg {
  width: 15px;
  height: 15px;
}

/* ---------- Buscador global (Ctrl/Cmd + K) ---------- */

.search-overlay {
  place-items: start center;
  padding-top: min(14vh, 120px);
}

.search-modal {
  width: min(600px, 100%);
  overflow: hidden;
  padding: 0;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.search-field > svg {
  width: 19px;
  height: 19px;
  flex: none;
  color: var(--muted);
}

.search-field input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  outline: none;
}

.search-field input::-webkit-search-cancel-button {
  display: none;
}

.search-results {
  max-height: min(56vh, 460px);
  overflow-y: auto;
  padding: 8px;
}

.search-group + .search-group {
  margin-top: 6px;
}

.search-group-label {
  display: block;
  padding: 8px 10px 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.search-result {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
}

.search-result.active {
  background: #eaf4ff;
}

.search-result > span:last-child {
  min-width: 0;
}

.search-result strong,
.search-result small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result strong {
  font-size: 13px;
}

.search-result small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.search-result .avatar,
.search-result-icon {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 9px;
  font-size: 11px;
}

.search-result-icon {
  display: grid;
  place-items: center;
  background: #e7f1ff;
  color: var(--primary);
}

.search-result-icon svg {
  width: 16px;
  height: 16px;
}

.search-empty {
  margin: 0;
  padding: 26px 12px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.search-footer {
  display: flex;
  gap: 16px;
  margin: 0;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  padding: 9px 16px;
  font-size: 11px;
}

.search-footer span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

@media (max-width: 1180px) {
  .quick-links {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid > .card:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .search-trigger span,
  .search-trigger kbd {
    display: none;
  }

  .search-trigger {
    width: 39px;
    justify-content: center;
    padding: 0;
  }

  .date-label {
    display: none;
  }
}

/* ---------- Chat: personas en línea y menciones ---------- */

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  align-items: start;
  gap: 17px;
}

.chat-online {
  position: sticky;
  top: 96px;
  padding: 18px;
}

.online-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.online-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.online-head h3::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .18);
  content: '';
}

.online-head h3 {
  margin-right: auto;
}

.online-head {
  gap: 8px;
}

.presence-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
}

.presence-toggle svg {
  width: 14px;
  height: 14px;
}

.presence-toggle:hover {
  border-color: #b9d7f5;
  color: var(--primary);
}

.presence-toggle.active {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #475569;
}

.online-person.is-hidden .online-dot {
  border: 2px solid #94a3b8;
  background: transparent;
}

.online-person.is-hidden .avatar {
  opacity: .55;
}

.online-count {
  min-width: 24px;
  border-radius: 99px;
  background: #e7f8f2;
  color: #087e5b;
  padding: 3px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
}

.online-list {
  display: grid;
  gap: 4px;
  max-height: min(430px, 50vh);
  overflow-y: auto;
  margin: 0 -6px;
  padding: 0;
  list-style: none;
}

.online-person {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  padding: 7px 6px;
  text-align: left;
}

button.online-person:hover {
  background: #f2f7fd;
}

.online-person .avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 11px;
}

.online-person > span {
  min-width: 0;
  flex: 1;
}

.online-person strong,
.online-person small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online-person strong {
  font-size: 13px;
}

.online-person strong em {
  color: var(--muted);
  font-style: normal;
  font-weight: 600;
}

.online-person small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.online-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: #10b981;
}

.online-help {
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.chat-composer {
  position: relative;
}

.mention-box {
  position: absolute;
  z-index: 5;
  right: 17px;
  bottom: calc(100% - 6px);
  left: 17px;
  max-width: 360px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 6px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
}

.mention-title {
  display: block;
  padding: 5px 8px 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.mention-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 7px 8px;
  text-align: left;
}

.mention-option.active {
  background: #eaf4ff;
}

.mention-option.is-offline .avatar {
  opacity: .55;
}

.mention-option .avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 10px;
}

.mention-option > span {
  min-width: 0;
  flex: 1;
}

.mention-option strong,
.mention-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-option strong {
  font-size: 13px;
}

.mention-option small {
  color: var(--muted);
  font-size: 11px;
}

.mention-empty {
  margin: 0;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

.mention {
  border-radius: 5px;
  background: rgba(11, 99, 206, .1);
  color: var(--primary);
  padding: 0 3px;
  font-weight: 800;
}

.mention.mention-me {
  background: rgba(245, 158, 11, .2);
  color: #9a5b00;
}

@media (max-width: 1180px) {
  .chat-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-online {
    position: static;
    order: -1;
    padding: 14px 16px;
  }

  .online-list {
    display: flex;
    overflow-x: auto;
    max-height: none;
    margin: 0;
    gap: 6px;
  }

  .online-list > li {
    flex: none;
  }

  .online-person {
    width: auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 12px 4px 4px;
  }

  .online-person small,
  .online-help {
    display: none;
  }

  .online-person .avatar {
    width: 26px;
    height: 26px;
    border-radius: 99px;
    font-size: 9px;
  }
}

/* ---------- Móvil: menú como panel deslizante ---------- */

@media (max-width: 650px) {
  .app-shell .sidebar {
    position: fixed;
    z-index: 200;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(300px, 86vw);
    height: 100%;
    padding: 20px 16px 18px;
    border-top: 0;
    border-right: 1px solid var(--line);
    box-shadow: 18px 0 40px rgba(15, 23, 42, .16);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform .28s var(--ease), visibility 0s linear .28s;
  }

  .app-shell.nav-open .sidebar {
    transform: none;
    visibility: visible;
    transition: transform .28s var(--ease);
  }

  .app-shell .brand,
  .app-shell .side-bottom {
    display: flex;
  }

  .app-shell .side-bottom {
    display: grid;
  }

  .app-shell .nav {
    display: flex;
    justify-content: flex-start;
    width: auto;
  }

  .app-shell .nav button {
    width: 100%;
    padding: 12px;
  }

  .app-shell .nav button.active {
    box-shadow: inset 3px 0 var(--primary);
  }

  .sidebar-rail {
    display: none;
  }

  .sidebar-close {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    margin-left: auto;
    border-radius: 10px;
    background: #f1f5f9;
    color: var(--muted);
  }

  .sidebar-close svg {
    width: 18px;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    z-index: 190;
    inset: 0;
    background: rgba(15, 23, 42, .4);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
  }

  .nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .menu-button {
    display: grid;
  }

  .app-shell .main {
    padding-bottom: 0;
  }

  .hero-buttons {
    justify-content: flex-start;
    margin-top: 18px;
  }

  .hero-buttons .hero-action {
    margin-top: 0;
  }

  .event-kind {
    grid-template-columns: 1fr;
  }

  .top-actions {
    gap: 7px;
  }

  .icon-button,
  .search-trigger,
  .bell,
  .topbar-avatar .avatar {
    width: 36px;
    height: 36px;
  }

  .dashboard-hero .hero-main {
    align-items: stretch;
  }

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

  .next-class {
    width: 100%;
    margin-top: 18px;
  }

  .quick-links {
    display: flex;
    overflow-x: auto;
    margin-right: -16px;
    padding: 2px 16px 6px 0;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .quick-links::-webkit-scrollbar {
    display: none;
  }

  .quick-link {
    min-width: 200px;
    scroll-snap-align: start;
  }

  .search-footer {
    display: none;
  }

  .search-overlay {
    padding-top: 16px;
  }

  .topbar-title .eyebrow {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

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

  /* La ruedita es un indicador de progreso: se mantiene, pero más lenta */
  button.is-busy::before {
    animation: button-spin 1.4s linear infinite !important;
  }
}

/* ---------- Apartados del menú que se pueden contraer ---------- */

.app-shell .nav .nav-items {
  display: grid;
  gap: 3px;
}

.app-shell .nav .nav-label-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 2px 12px 6px;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: none;
}

.app-shell .nav .nav-label-toggle:hover {
  background: transparent;
  color: var(--primary);
}

.app-shell .nav .nav-label-toggle svg {
  width: 13px;
  height: 13px;
  margin-left: auto;
  transition: transform .2s ease;
}

.nav-group.is-collapsed .nav-label-toggle svg {
  transform: rotate(-90deg);
}

.nav-group-badge {
  min-width: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--amber);
  color: #fff;
  font-size: 9.5px;
  font-style: normal;
  letter-spacing: 0;
  line-height: 16px;
  text-align: center;
}

.nav-group-badge[hidden],
.nav-group:not(.is-collapsed) .nav-group-badge {
  display: none;
}

/* Contraído: solo se ve la sección abierta, si es de ese apartado. */
.nav-group.is-collapsed .nav-items > button:not(.active) {
  display: none;
}

html.theme-dark .app-shell .nav .nav-label-toggle {
  color: #8a9bb3;
}

@media (min-width: 651px) {
  /* Con el menú estrecho no hay títulos: se ven todos los iconos. */
  .app-shell.sidebar-collapsed .nav .nav-label-toggle {
    width: auto;
    height: 1px;
    margin: 0 10px 6px;
    padding: 0;
    border-radius: 0;
    background: var(--line);
    font-size: 0;
    pointer-events: none;
  }

  .sidebar-collapsed .nav-label-toggle > * {
    display: none !important;
  }

  .sidebar-collapsed .nav-group.is-collapsed .nav-items > button {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell .nav .nav-label-toggle svg {
    transition: none;
  }
}
