/* Shared phone controls. Keep print layouts and desktop typography unchanged. */
@media screen and (max-width: 700px) {
  input:not([type='checkbox']):not([type='radio']):not([type='hidden']), select, textarea {
    font-size: 16px !important;
    min-height: 44px;
    max-width: 100%;
  }
  button:not(.cd-dot), .btn, .btn-view { min-height: 44px; }
  .form-row, .form-row.thirds { grid-template-columns: minmax(0, 1fr) !important; }
  .form-field, .page-grid-main, main { min-width: 0; }
  #layoutContainer, #layoutContainer.no-side { grid-template-columns: minmax(0, 1fr); padding: 24px 16px; }
  #layoutContainer > div, #layoutContainer .field { min-width: 0; }
  .steps { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .step-pill { padding: 0; min-width: 0; }
  .step-title { overflow-wrap: anywhere; }
  .dob-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dob-grid select { grid-column: 1 / -1; }
  .mobile-grid { grid-template-columns: minmax(0, 1fr); }
  .modal-overlay { padding: 12px; }
  .modal { max-height: calc(100dvh - 24px); }
  .modal-head, .modal-body, .modal-foot { padding: 20px; }
  .modal-foot { flex-wrap: wrap; }
  .cd-dot { width: 44px; height: 44px; background: transparent; display: grid; place-items: center; }
  .cd-dot::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.4); }
  .cd-dot.active, .cd-dot:hover { background: transparent; }
  .cd-dot.active::after { background: var(--cyan-bright); }
  .profile-page-body, .exam-page-body, .cred-page-body { padding: 24px 16px; }
  .profile-section-toggle { flex-shrink: 0; }
  .profile-section-collapsed > :not(.form-section-head) { display: none; }
  #orders-view .table-scroll::before, #programs-view .table-scroll::before {
    content: 'Swipe to see all columns →'; display: block; font-size: 12px;
    color: var(--muted); padding: 8px 0;
  }
  #orders-view .data-table th:last-child, #orders-view .data-table td:last-child {
    position: sticky; right: 0; background: var(--paper); box-shadow: -3px 0 5px rgba(15,15,41,.08);
  }
}
.profile-section-toggle { display: none; }
@media screen and (max-width: 700px) {
  .profile-section-toggle { display: inline-flex; align-items: center; justify-content: center; padding: 8px 12px; background: var(--paper); border: 1px solid var(--rule); color: var(--navy); border-radius: 6px; }
}
/* At tablet widths the former absolutely positioned badge still collided with
   wrapped text. Normal grid flow makes overlap impossible at these widths. */
@media screen and (max-width: 1100px) {
  .hero-medallion { position: static; transform: none; width: 88px; height: 88px; }
  #dashboard-view .hero { grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; }
  #dashboard-view .hero-meta { grid-column: 1 / -1; }
}
@media screen and (max-width: 900px) {
  .masthead { padding: 12px 16px; min-height: 68px; flex-wrap: nowrap; gap: 12px; }
  .brand { min-width: 0; }
  .brand-mark { font-size: 20px; white-space: nowrap; }
  .brand-mark .portal, .brand-mark .pipe { display: none; }
  .nav-toggle { display: inline-flex; flex-shrink: 0; width: 44px; height: 44px; }
  .masthead .nav { display: none; }
  .masthead.nav-open .nav {
    position: absolute; top: 100%; left: 0; right: 0; width: 100%;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch;
    gap: 0; padding: 8px 16px 16px; background: var(--navy);
    max-height: calc(100dvh - 68px); overflow-y: auto;
    box-shadow: 0 12px 24px rgba(0,0,0,.25);
  }
  .masthead.nav-open .nav > a { padding: 12px; font-size: 14px; min-height: 44px; border-top: 1px solid rgba(255,255,255,.12); }
  .masthead.nav-open .nav > a.active::after { display: none; }
  .masthead.nav-open .account-menu { position: static; width: 100%; grid-column: 1 / -1; }
  .masthead.nav-open .account-menu .user-badge { width: 100%; padding: 12px; border: 0; justify-content: flex-start; }
  .masthead.nav-open .user-meta { min-width: 0; overflow-wrap: anywhere; }
  .masthead.nav-open .account-caret, .masthead.nav-open .account-sep { display: none; }
  .masthead.nav-open .account-dropdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); position: static; width: 100%; min-width: 0; padding: 0; background: transparent; box-shadow: none; }
  .masthead.nav-open .account-dropdown a { min-height: 44px; padding: 12px; color: #fff; border-top: 1px solid rgba(255,255,255,.12); }
  .masthead.nav-open #logoutLink { color: #ffb9b9; }
}
@media screen and (max-width: 400px) {
  #dashboard-view .hero .hero-text { grid-column: 1 / -1; }
  #dashboard-view .hero-meta { grid-column: auto; }
}
/* The Latest Achievement block must not squeeze the description into a
   word-wide column; on a phone it stacks under the heading instead. */
@media screen and (max-width: 700px) {
  #achievementsMount { padding: 24px 16px !important; }
  #achievementsMount .ach-latest-title { font-size: 23px !important; }
  #achievementsMount .ach-section-blurb { display: none; }
  #achievementsMount .ach-section h2 { font-size: 22px !important; }
}
