.mobile-navigation, .mobile-initials, .mobile-header-bell > svg {
  display: none;
}

.mobile-menu {
  position: fixed;
  inset: auto 0 0;
  margin: 0 auto;
  width: min(100%, 640px);
  max-width: 100%;
  max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 -12px 60px #273d4222;
}

.mobile-menu::backdrop { background: #203c3c77; }
.mobile-menu-open { overflow: hidden; }
.mobile-menu-handle { width: 38px; height: 4px; margin: 2px auto 18px; border-radius: 8px; background: #c1d0c8; }
.mobile-menu-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.mobile-menu-heading h2 { margin: 0; font-size: 24px; }
.mobile-menu-heading .eyebrow { margin: 0 0 4px; font-size: 10px; }
.mobile-icon-button { width: 44px; height: 44px; display: grid; place-items: center; flex-shrink: 0; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--ink); }
.mobile-profile-name { color: var(--muted); font-size: 14px; margin: 12px 0 20px; overflow-wrap: anywhere; }
.mobile-menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mobile-menu-grid button { display: flex; align-items: center; gap: 10px; min-height: 60px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); padding: 12px; font-size: 14px; font-weight: 600; text-align: left; line-height: 1.35; }
.mobile-menu-grid button svg { flex: 0 0 23px; }
.mobile-menu-grid button.active { background: var(--mint); border-color: #90b69e; color: #234d40; }
.mobile-menu-footer { display: grid; gap: 10px; border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.mobile-menu-footer button, .mobile-cabinet-link { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--lavender); border: 0; border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 600; }
.mobile-menu-footer button { color: var(--danger); background: #fff2ed; }

@media (max-width: 1024px) {
  body.has-mobile-navigation {
    --mobile-nav-height: 76px;
    min-height: 100dvh;
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px) + 16px);
  }

  .has-mobile-navigation main > .tabs { display: none; }
  .has-mobile-navigation main { display: block; margin: 16px auto; padding: 0 14px; }
  .has-mobile-navigation #nameNotice, .has-mobile-navigation #resumeNotice { margin-bottom: 14px; }
  .has-mobile-navigation header {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 68px;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) 10px max(14px, env(safe-area-inset-left, 0px));
  }

  .has-mobile-navigation header h1 { min-width: 0; margin: 0; font-size: clamp(14px, 3.7vw, 17px); }
  .has-mobile-navigation .brand-caption { font-size: 9px; letter-spacing: .02em; margin-top: 4px; }
  .has-mobile-navigation .user-info { flex: 0 0 auto; width: auto; gap: 8px; flex-wrap: nowrap; }
  .has-mobile-navigation .user-info > .logout, .has-mobile-navigation .user-info > a { display: none; }
  .has-mobile-navigation .profile-link { flex: 0 0 44px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid #ccdcd1; border-radius: 50%; background: var(--mint); }
  .has-mobile-navigation .profile-link #userName, .has-mobile-navigation .notification-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .mobile-initials { display: inline; font-size: 14px; font-weight: 700; }
  .mobile-header-bell { position: relative; display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; padding: 0; border-radius: 50%; }
  .mobile-header-bell > svg { display: block; width: 22px; height: 22px; }
  .mobile-header-bell .badge { position: absolute; top: -5px; right: -5px; min-width: 19px; margin: 0; padding: 1px 5px; border: 1px solid #d6d1e5; font-size: 10px; }

  .mobile-navigation {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: var(--mobile-nav-height);
    padding: 6px max(5px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(5px, env(safe-area-inset-left, 0px));
    border-top: 1px solid var(--line);
    background: var(--paper);
    box-shadow: 0 -4px 24px #273d420c;
  }

  .mobile-nav-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    min-height: 62px;
    padding: 5px 2px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--muted);
    background: transparent;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 600;
  }

  .mobile-nav-button svg { width: 23px; height: 23px; }
  .mobile-nav-button.active { background: var(--mint); border-color: #ccdcd1; color: #234d40; }
  .mobile-nav-button:active, .mobile-menu-grid button:active { background: #c9e2d3; }
  .content { padding: 22px 18px; border-radius: 16px; }
  .content h2, .item h3, .hero h2 { overflow-wrap: anywhere; }
  .hero { padding: 22px; }
  .hero h2 { font-size: clamp(24px, 6vw, 32px); }
  .hero h2 .welcome-name { display: block; margin-top: 10px; font-size: 16px; font-weight: 600; line-height: 1.5; letter-spacing: 0; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .quick-card { min-height: 146px; padding: 18px 14px; }
  .quick-card strong { font-size: 16px; }
  .quick-card span { font-size: 13px; }
  button, input:not([type=radio]):not([type=checkbox]), select { min-height: 44px; }
  input:not([type=radio]):not([type=checkbox]), textarea, select { font-size: 16px; }
  .field-grid { grid-template-columns: 1fr; }
  .actions, .item-actions, .subject-actions { gap: 10px; }
  .actions > button, .item-actions > button { flex: 1 1 auto; }
  .schedule-filters label, .grade-filters label { flex: 1 1 100%; width: 100%; }
  .schedule-filters > button, .grade-filters > button { width: 100%; }
  .schedule-card { grid-template-columns: 1fr; gap: 10px; }
  .schedule-card .actions { grid-column: 1; }
  .schedule-time { display: flex; align-items: baseline; gap: 10px; font-size: 18px; }
  .schedule-time .meta::before { content: "— "; }
  .table-wrap { overflow: visible; }
  .table-wrap table, .table-wrap tbody { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { display: grid; grid-template-columns: 1fr; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; background: white; }
  .table-wrap td { padding: 0; border: 0; min-width: 0; }
  .table-wrap td + td { margin-top: 12px; }
  .table-wrap td:nth-child(2)::before { content: "Роль аккаунта"; display: block; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
  .table-wrap td button, .table-wrap td select { width: 100%; min-width: 0; }
  .account-name { min-width: 0; }
  .account-name .badge { margin-top: 8px; }
  #content > #submit-test, #content > #leave-test, #content > #leave-test + button { width: 100%; margin-bottom: 10px; }
  #toastRegion { right: 12px; bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px) + 10px); width: min(380px, calc(100% - 24px)); z-index: 25; }
  .toast:not(:last-child) { display: none; }
  .toast { padding: 12px; gap: 6px; }
  .toast > button:not(.toast-open) { min-width: 44px; min-height: 44px; margin: -6px -6px -6px 0; }
  .toast p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .notification-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px)); padding: 20px 16px; }
  .notification-dialog .dialog-heading h2 { font-size: 22px; }
  .notification-dialog .actions { align-items: stretch; }
  .has-mobile-navigation #status { margin: 10px 14px; padding: 12px !important; }
}

@media (max-width: 359px) {
  .has-mobile-navigation main { padding: 0 10px; }
  .content { padding: 18px 14px; }
  .quick-grid { grid-template-columns: 1fr; }
  .mobile-menu { padding-left: 14px; padding-right: 14px; }
  .mobile-menu-grid button { font-size: 13px; padding: 10px; }
}

@media (max-width: 1024px) and (max-height: 430px) {
  body.has-mobile-navigation { --mobile-nav-height: 60px; }
  .has-mobile-navigation header { min-height: 56px; padding-top: 6px; padding-bottom: 6px; }
  .has-mobile-navigation .brand-caption { display: none; }
  .mobile-nav-button { min-height: 48px; gap: 2px; padding: 2px; }
  .mobile-nav-button svg { width: 20px; height: 20px; }
  .mobile-menu { max-height: calc(100dvh - 8px); }
}
