/* Shared mobile sizing for student portal pages */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

@media (max-width: 920px) {
  body {
    font-size: 14px;
  }

  .app-shell {
    display: block !important;
    min-height: 100vh;
    width: 100%;
  }

  .sidebar {
    position: sticky !important;
    top: 0;
    z-index: 45;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 10px 12px 8px !important;
    border-right: 0 !important;
    border-bottom: 1px solid var(--border, #e5e7eb) !important;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07) !important;
  }

  .sidebar-brand {
    min-height: 0 !important;
    padding: 6px 4px 10px !important;
    border-bottom: 0 !important;
  }

  .brand-mark {
    width: 38px !important;
    height: 38px !important;
    border-radius: 12px !important;
    flex: 0 0 auto;
  }

  .brand-name {
    font-size: 15px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
  }

  .brand-subtitle {
    font-size: 11px !important;
  }

  .sidebar-nav {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    padding: 4px 2px 8px !important;
    min-height: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar-section-label {
    display: none !important;
  }

  .sidebar-item {
    width: auto !important;
    min-width: max-content;
    min-height: 40px !important;
    flex: 0 0 auto;
    gap: 8px !important;
    padding: 9px 12px !important;
    border-left: 0 !important;
    border-radius: 12px !important;
    font-size: 13px !important;
    white-space: nowrap;
  }

  .sidebar-item.active::after {
    display: none !important;
  }

  .sidebar-item svg,
  .sidebar-item::before {
    width: 18px !important;
    height: 18px !important;
    flex: 0 0 auto;
  }

  .sidebar-footer {
    display: flex !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 6px 2px 2px !important;
    border-top: 1px solid var(--border, #e5e7eb) !important;
    overflow-x: auto;
  }

  .sidebar-footer .sidebar-item {
    justify-content: center;
  }

  .main {
    width: 100% !important;
    min-width: 0 !important;
  }

  .topbar,
  .topbar--portal {
    position: sticky !important;
    top: 0;
    z-index: 35;
    min-height: 0 !important;
    padding: 10px 14px !important;
    gap: 10px !important;
  }

  .topbar--portal.topbar--with-search {
    display: flex !important;
    flex-wrap: wrap !important;
  }

  .topbar--portal .page-title,
  .topbar .page-title,
  .page-title {
    font-size: 1.08rem !important;
    line-height: 1.2 !important;
  }

  .topbar-center,
  .topbar--portal .topbar-center {
    order: 3;
    flex: 1 1 100%;
    max-width: none !important;
    margin: 2px 0 0 !important;
  }

  .topbar-search,
  .dashboard-search,
  .search-box,
  .search-input-wrap {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 40px !important;
  }

  .topbar-right,
  .topbar-right--portal {
    gap: 8px !important;
    flex-wrap: nowrap !important;
  }

  .icon-btn,
  .topbar--portal .icon-btn {
    width: 40px !important;
    height: 40px !important;
    border-radius: 13px !important;
  }

  .topbar-user-block,
  .user-chip,
  .admin-chip {
    display: none !important;
  }

  .content,
  [class*="content--"],
  .support-content,
  .wallet-content,
  .lockers-content,
  .reservation-content,
  .history-content,
  .profile-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 18px 14px 28px !important;
  }

  .section-head,
  .page-head,
  .hero-row,
  .welcome-card,
  .profile-hero,
  .wallet-hero,
  .support-hero,
  .reserve-hero,
  .locker-detail-hero {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
  }

  .stats-grid,
  .actions-grid,
  .dashboard-grid,
  .dash-grid-main,
  .quick-grid,
  .wallet-grid,
  .wallet-main-grid,
  .profile-grid,
  .support-grid,
  .support-main-grid,
  .locker-grid,
  .locker-list,
  .lockers-grid,
  .reserve-grid,
  .reserve-layout,
  .detail-grid,
  .pin-grid,
  .pin-layout,
  .history-grid,
  .summary-grid,
  .cards-grid,
  .map-shell,
  .location-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .stat-card,
  .action-card,
  .card,
  .panel,
  .wallet-card,
  .booking-card,
  .locker-card,
  .profile-card,
  .support-card,
  .dash-active-reservation {
    width: 100% !important;
    max-width: 100% !important;
  }

  .table-wrap,
  .history-table-wrap,
  .reservation-table-wrap,
  .wallet-table-wrap,
  .transactions-table-wrap,
  .support-table-wrap,
  .list-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 680px;
  }

  .modal,
  .modal-content,
  .dialog,
  .dialog-card,
  .web-notif-panel {
    width: calc(100vw - 28px) !important;
    max-width: calc(100vw - 28px) !important;
  }
}

@media (max-width: 560px) {
  .sidebar {
    padding-inline: 10px !important;
  }

  .brand-subtitle,
  .page-subtitle,
  .topbar-logout-compact {
    display: none !important;
  }

  .sidebar-item {
    min-height: 38px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
  }

  .content,
  [class*="content--"],
  .support-content,
  .wallet-content,
  .lockers-content,
  .reservation-content,
  .history-content,
  .profile-content {
    padding: 14px 10px 24px !important;
  }

  .btn,
  button,
  input,
  select,
  textarea {
    max-width: 100%;
  }

  .btn,
  .btn-primary,
  .btn-secondary,
  .btn-ghost,
  .dash-res-btn,
  .reserve-btn,
  .support-submit,
  .wallet-action {
    width: 100%;
    justify-content: center;
  }

  .stats-grid,
  .actions-grid,
  .summary-grid {
    gap: 10px !important;
  }

  .locker-map-grid,
  #lockerMapGrid {
    gap: 8px !important;
  }

  .locker-cell {
    min-height: 42px !important;
    font-size: 0.82rem !important;
  }
}
/* Mobile drawer navigation and bottom tabs */
.mobile-menu-btn,
.mobile-nav-backdrop,
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 920px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  .mobile-menu-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin-right: 8px;
    border: 1px solid var(--border, #dfe6f3);
    border-radius: 14px;
    background: #ffffff;
    color: #17233c;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
    flex: 0 0 auto;
  }

  .mobile-menu-btn svg,
  .mobile-bottom-item svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .topbar-left {
    display: flex !important;
    align-items: center !important;
    min-width: 0;
  }

  .app-shell > .sidebar,
  .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    z-index: 90 !important;
    width: min(84vw, 330px) !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 18px 18px calc(28px + env(safe-area-inset-bottom, 0px)) !important;
    border-right: 1px solid var(--border, #e1e8f4) !important;
    border-bottom: 0 !important;
    border-radius: 0 24px 24px 0 !important;
    background: #ffffff !important;
    box-shadow: 24px 0 70px rgba(15, 23, 42, 0.2) !important;
    transform: translateX(-106%);
    transition: transform 220ms ease;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }

  body.mobile-nav-open .mobile-nav-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-brand {
    padding: 4px 4px 18px !important;
    margin-bottom: 10px !important;
    border-bottom: 1px solid var(--border, #e5e7eb) !important;
  }

  .brand-mark {
    width: 48px !important;
    height: 48px !important;
  }

  .brand-name {
    font-size: 1.05rem !important;
    line-height: 1.18 !important;
  }

  .brand-subtitle {
    display: block !important;
    font-size: 0.78rem !important;
  }

  .sidebar-nav {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 10px 0 !important;
    overflow: visible !important;
  }

  .sidebar-footer {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 14px 0 0 !important;
    margin-top: 12px !important;
    overflow: visible !important;
  }

  .sidebar-item {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
    justify-content: flex-start !important;
    border-radius: 16px !important;
    padding: 12px 14px !important;
    font-size: 0.95rem !important;
  }

  .sidebar-item.active {
    background: #eef1ff !important;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border, #dfe6f3);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -14px 34px rgba(15, 23, 42, 0.1);
    backdrop-filter: blur(18px);
  }

  .mobile-bottom-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    gap: 4px;
    border-radius: 16px;
    color: #8a97ad;
    text-decoration: none;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .mobile-bottom-item.active {
    color: var(--primary, #4f46e5);
    background: #f1f3ff;
  }

  .mobile-bottom-item.active::after {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: currentColor;
  }

  .topbar,
  .topbar--portal {
    top: 0 !important;
  }
}

@media (max-width: 560px) {
  .topbar,
  .topbar--portal {
    min-height: 66px !important;
    padding: 10px 14px !important;
  }

  .topbar--portal .page-title,
  .topbar .page-title,
  .page-title {
    font-size: 1rem !important;
  }

  .topbar-right,
  .topbar-right--portal {
    margin-left: auto !important;
  }

  .topbar-right .icon-btn:nth-of-type(2),
  .topbar-right--portal .icon-btn:nth-of-type(2) {
    display: none !important;
  }

  .content,
  [class*="content--"],
  .support-content,
  .wallet-content,
  .lockers-content,
  .reservation-content,
  .history-content,
  .profile-content {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Final phone polish: topbar, avatar, search, wallet overflow */
@media (max-width: 920px) {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html,
  body,
  .app-shell,
  .main {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .topbar,
  .topbar--portal,
  .topbar--portal.topbar--with-search {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    column-gap: 8px !important;
    row-gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 12px !important;
  }

  .topbar-left {
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .page-title-wrap {
    min-width: 0 !important;
  }

  .topbar--portal .page-title,
  .topbar .page-title,
  .page-title {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .topbar-right,
  .topbar-right--portal {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 7px !important;
    flex-wrap: nowrap !important;
    min-width: max-content !important;
    margin-left: auto !important;
  }

  .topbar-user-block,
  .user-chip,
  .admin-chip {
    display: flex !important;
  }

  .topbar-user-block {
    width: 42px !important;
    height: 42px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    flex: 0 0 42px !important;
  }

  .topbar-user-text {
    display: none !important;
  }

  .topbar-avatar {
    width: 42px !important;
    height: 42px !important;
    border: 3px solid #ffffff !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.88) !important;
    font-size: 0.78rem !important;
  }

  .icon-btn,
  .topbar--portal .icon-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    padding: 0 !important;
    overflow: hidden !important;
    font-size: 0 !important;
  }

  .icon-btn svg,
  .topbar--portal .icon-btn svg,
  .topbar-search-ico svg,
  .wallet-search-ico svg,
  .search-box svg,
  .search-input-wrap svg,
  .dashboard-search svg {
    width: 19px !important;
    height: 19px !important;
    min-width: 19px !important;
    min-height: 19px !important;
    max-width: 19px !important;
    max-height: 19px !important;
    display: block !important;
    flex: 0 0 19px !important;
  }

  .topbar-center,
  .topbar--portal .topbar-center {
    grid-column: 1 / -1 !important;
    order: initial !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  .topbar-search,
  .wallet-search,
  .dashboard-search,
  .search-box,
  .search-input-wrap {
    width: 100% !important;
    max-width: 100% !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 9px 12px !important;
    gap: 8px !important;
    border-radius: 16px !important;
  }

  .topbar-search-input,
  .wallet-search-input,
  .search-box input,
  .search-input-wrap input,
  .dashboard-search input {
    min-width: 0 !important;
    width: 100% !important;
    font-size: 0.88rem !important;
  }

  .content,
  [class*="content--"],
  .content.content--wallet,
  .support-content,
  .wallet-content,
  .lockers-content,
  .reservation-content,
  .history-content,
  .profile-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .wallet-grid,
  .wallet-main-grid,
  .wallet-col-pay {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 14px !important;
  }

  .wallet-card,
  .wallet-card--tx,
  .wallet-card--balance,
  .wallet-card--topup,
  .wallet-card--methods,
  .wallet-secure-banner {
    grid-column: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 18px !important;
    border-radius: 16px !important;
  }

  .wallet-presets,
  .wallet-tx-head,
  .wallet-methods-head,
  .wallet-tx-actions,
  .wallet-dialog-actions {
    flex-wrap: wrap !important;
  }

  .wallet-mini-stats {
    grid-template-columns: 1fr !important;
  }

  .wallet-card-hero-number,
  .wallet-card-hero-foot,
  .wallet-card-list-mask {
    overflow-wrap: anywhere !important;
  }

  .wallet-table-wrap,
  .transactions-table-wrap {
    max-width: 100% !important;
    overflow-x: auto !important;
  }

  .wallet-table {
    min-width: 620px !important;
  }
}

@media (max-width: 560px) {
  .topbar,
  .topbar--portal,
  .topbar--portal.topbar--with-search {
    grid-template-columns: minmax(0, 1fr) auto !important;
    min-height: 64px !important;
  }

  .mobile-menu-btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    margin-right: 6px !important;
    border-radius: 13px !important;
  }

  .topbar--portal .page-title,
  .topbar .page-title,
  .page-title {
    font-size: 0.98rem !important;
    max-width: 44vw !important;
  }

  .icon-btn,
  .topbar--portal .icon-btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    border-radius: 13px !important;
  }

  .topbar-right .icon-btn:nth-of-type(2),
  .topbar-right--portal .icon-btn:nth-of-type(2) {
    display: grid !important;
  }

  .topbar-user-block {
    width: 38px !important;
    height: 38px !important;
    flex-basis: 38px !important;
  }

  .topbar-avatar {
    width: 38px !important;
    height: 38px !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.86) !important;
  }

  .topbar-search,
  .wallet-search,
  .dashboard-search,
  .search-box,
  .search-input-wrap {
    height: 40px !important;
    min-height: 40px !important;
  }

  .content,
  [class*="content--"],
  .content.content--wallet,
  .support-content,
  .wallet-content,
  .lockers-content,
  .reservation-content,
  .history-content,
  .profile-content {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .wallet-card,
  .wallet-card--tx,
  .wallet-card--balance,
  .wallet-card--topup,
  .wallet-card--methods,
  .wallet-secure-banner {
    padding: 16px !important;
  }

  .wallet-presets {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .wallet-preset {
    padding: 10px 6px !important;
    font-size: 0.78rem !important;
  }
}
