/* Shared mobile behavior for all production entry points. */
@media (max-width: 700px) {
  html { overflow-x: hidden; overflow-y: hidden; }
  body { min-width: 0; }

  nav,
  nav .wrap,
  .nav-wrap {
    height: auto;
    min-height: 60px;
  }

  nav .wrap,
  .nav-wrap {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .nav-right,
  .nav-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav-right > *,
  .nav-actions > * { min-height: 40px; }
  .nav-right .student-switch { width: 100%; justify-content: space-between; }
  .student-switch select { flex: 1; min-width: 0; }
  .crumb { display: none; }
  .nav-wrap,
  .page-wrap { width: min(100% - 28px, 1180px); }

  .page-wrap { padding-top: 28px; }
  .page-head,
  .conversation-head,
  .pay-head,
  .total-bar,
  .grid-header,
  .teacher-overview-head,
  .homework-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-head h1 { font-size: 1.9rem; }
  .page-head > *,
  .conversation-head > * { max-width: 100%; }
  .gh-actions,
  .class-actions,
  .editor-actions,
  .modal-actions,
  .total-bar .actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .gh-actions .btn,
  .class-actions .btn,
  .editor-actions .btn,
  .modal-actions .btn,
  .total-bar .btn { flex: 1 1 140px; min-height: 42px; }

  .card,
  .conversation-panel,
  .class-panel { min-width: 0; }
  .tt-wrap,
  .matrix-wrap,
  .classroom-graph { max-width: 100%; touch-action: pan-x; }

  .pay-grid,
  .messaging-layout { grid-template-columns: minmax(0, 1fr); }
  .composer { grid-template-columns: minmax(0, 1fr); }
  .composer button { width: 100%; min-height: 44px; }

  .join-class,
  .join-controls { min-width: 0; width: 100%; }
  .join-controls { flex-wrap: wrap; }
  .join-controls .inp { width: min(100%, 220px); flex: 1 1 160px; }
  .join-controls .btn { min-height: 42px; }
  .cls-actions { flex-wrap: wrap; }
  .cls-actions .btn { min-height: 42px; }

  .account-menu { right: 0; width: min(268px, calc(100vw - 28px)); }
  .tte-remove,
  .editor-search-clear,
  .gc-del,
  .homework-delete,
  .btn-reset { min-width: 40px; min-height: 40px; }
}

@media (max-width: 480px) {
  .wrap { padding-left: 14px; padding-right: 14px; }
  .nav-right .teacher-link,
  .nav-right .db-badge { font-size: .68rem; padding: 6px 9px; }
  .btn,
  .back,
  .nav-link { min-height: 42px; }
  .row2,
  .tte-times { grid-template-columns: minmax(0, 1fr); }
  .join-controls .inp,
  .join-controls .btn { width: 100%; flex-basis: 100%; }
  .dashboard-messages,
  .cls-enter,
  .cls-leave { flex: 1 1 100%; }
}
