@media (max-width: 820px) {
 .agent-marketplace-shell > .site-footer { position: static; width:auto; margin: 24px 16px max(16px, env(safe-area-inset-bottom)); justify-content:center; }
 .mobile-student-shell > .site-footer { position:fixed; left:12px; right:auto; bottom:max(12px,env(safe-area-inset-bottom)); width:min(290px,calc(100vw - 48px)); z-index:51; justify-content:flex-start; visibility:hidden; pointer-events:none; }
 .mobile-student-shell.mobile-conversation-open > .site-footer { visibility:visible; pointer-events:auto; }
 .mobile-student-shell .conversation-sidebar { padding-bottom:150px; }
 .mobile-student-shell .composer { bottom:0; margin-bottom:max(12px,env(safe-area-inset-bottom)); }
 .mobile-student-shell .chat-topbar { gap:6px; padding-top:max(8px,env(safe-area-inset-top)); padding-bottom:8px; }
 .mobile-student-shell .chat-topbar-controls { flex-direction:row; flex-wrap:wrap; gap:6px; }
 .mobile-student-shell .course-picker { flex:1 1 190px; width:auto; min-width:0; }
 .mobile-student-shell .guest-quota-button { flex:0 1 auto; width:auto; min-height:44px; }
 .mobile-student-shell .mobile-chat-actions { flex:1 0 100%; }
 .mobile-student-shell .mobile-chat-actions button { min-height:44px; }
 .mobile-student-shell .messages { padding-bottom:16px; }
}
/* Keep the desktop agent list and chat controls unobstructed. */
.agent-marketplace-shell > .site-footer { position:static; width:auto; margin:24px 16px max(16px, env(safe-area-inset-bottom)); justify-content:center; }
@media (min-width: 761px) and (max-width: 1080px) {
 .app-shell:not(.mobile-student-shell).kg-open { grid-template-columns: 200px minmax(0,1fr) 280px; }
 .app-shell:not(.mobile-student-shell).kg-collapsed { grid-template-columns: 200px minmax(0,1fr) 64px; }
 .app-shell:not(.mobile-student-shell) .kg-panel { position:relative; right:auto; bottom:auto; width:auto; box-shadow:none; }
 .app-shell:not(.mobile-student-shell).kg-collapsed .kg-panel { width:auto; }
 .app-shell:not(.mobile-student-shell) .chat-topbar { flex-wrap:wrap; gap:8px; padding:12px 14px; }
 .app-shell:not(.mobile-student-shell) .chat-topbar-controls { flex-wrap:wrap; max-width:100%; }
 .app-shell:not(.mobile-student-shell) .course-picker { min-width:0; max-width:100%; }
}

@media (min-width: 761px) and (max-width: 900px) {
 .app-shell:not(.mobile-student-shell) .chat-topbar { align-items:stretch; flex-direction:column; }
 .app-shell:not(.mobile-student-shell) .chat-topbar-controls { width:100%; min-width:0; justify-content:flex-start; }
 .app-shell:not(.mobile-student-shell) .course-picker { flex:1 1 100%; width:100%; }
 .app-shell:not(.mobile-student-shell) .course-picker-trigger { width:100%; }
}
