/*
 * Ajustes móviles compartidos.
 *
 * Este archivo se carga después de los estilos generales para adaptar controles
 * anchos sin cambiar su comportamiento en escritorio. Los calendarios y tablas
 * conservan su ancho útil dentro de una región desplazable táctil.
 */
.dashboard-scroll-hint,
.mobile-table-hint {
  display: none;
}

.dashboard-main-grid > *,
.dashboard-section,
.dashboard-agenda {
  min-width: 0;
}

.dashboard-agenda-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  scrollbar-width: thin;
}

.dashboard-agenda-scroll .dashboard-agenda-grid {
  min-width: 625px;
  overflow: visible;
  border: 0;
  border-radius: 0;
}

@media (max-width: 700px) {
  body.mobile-navigation-open {
    overflow: hidden;
    overscroll-behavior-y: none;
  }

  .topbar {
    position: fixed !important;
    inset: 0 0 auto 0;
    z-index: 20;
    height: 76px !important;
    min-height: 76px !important;
    width: 100%;
    flex-wrap: nowrap !important;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 10px;
  }

  .app-shell:not(.focus-shell) {
    padding-top: 76px;
  }

  .sidebar {
    top: 76px;
    bottom: auto;
    height: calc(100vh - 76px);
    height: calc(100dvh - 76px);
    height: var(--mobile-navigation-height, calc(100dvh - 76px));
    min-height: 0;
    max-height: none;
    padding-bottom: max(22px, env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-gutter: stable;
  }

  .sidebar .logout-form {
    flex: 0 0 auto;
  }

  .brand {
    flex: 0 0 34px;
    width: 34px;
    min-width: 34px;
    max-width: 34px;
    gap: 0;
  }

  .brand-logo {
    flex: 0 0 auto;
    width: 34px;
    height: 42px;
    object-fit: contain;
  }

  .brand span:last-child {
    display: none !important;
  }

  .nav-toggle {
    display: block;
    flex: 0 0 44px;
    width: 44px;
    padding: 0;
    margin-right: auto;
  }

  .notification-center {
    flex: 0 0 auto;
    margin-left: 0;
  }

  .notification-center > summary {
    width: 42px;
  }

  .content > * {
    min-width: 0;
  }

  .panel,
  .dashboard-section,
  .dashboard-hero,
  .table-wrap {
    max-width: 100%;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }

  .mobile-table-hint {
    display: block;
    margin: 0 0 9px;
    color: var(--muted);
    font-size: 11px;
  }

  .mobile-data-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
  }

  .student-list-table {
    min-width: 680px;
  }

  .attendance-table {
    min-width: 900px;
  }

  .attendance-table th:last-child,
  .attendance-table td:last-child {
    min-width: 220px;
  }

  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    max-width: 100%;
    min-width: 0;
  }

  .panel-head,
  .dashboard-section-head {
    flex-wrap: wrap;
  }

  .dashboard-announcement-empty {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-announcement-empty .btn {
    align-self: flex-start;
    min-height: 44px;
  }

  .screen-help-button {
    right: 12px;
    bottom: 12px;
    width: 52px;
    min-height: 52px;
    height: 52px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .screen-help-label,
  .screen-help-button small {
    display: none;
  }

  .dashboard-hero-copy {
    min-width: 0;
    padding: 26px 20px;
  }

  .dashboard-hero h1 {
    font-size: clamp(32px, 10vw, 44px);
    line-height: 1.04;
    overflow-wrap: break-word;
  }

  .dashboard-hero > img {
    pointer-events: none;
  }
}

@media (max-width: 360px) {
  .screen-help-button {
    position: static;
    display: flex;
    margin: 0 0 14px auto;
  }
}

@media (max-width: 760px) {
  .dashboard-scroll-hint {
    display: block;
    margin: -5px 0 9px;
    color: var(--muted);
    font-size: 11px;
  }

  .dashboard-agenda-scroll {
    scroll-snap-type: x proximity;
  }

  .dashboard-agenda-scroll .dashboard-agenda-grid {
    width: max-content;
    min-width: 725px;
    grid-template-columns: repeat(5, 145px);
  }

  .dashboard-agenda-day {
    scroll-snap-align: start;
  }
}
