@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    padding: 12px;
    gap: 0;
  }

  .sidebar-resizer {
    display: none;
  }

  .app-shell:not(.mobile-chat-open) .chat-panel {
    display: none;
  }

  .app-shell.mobile-chat-open .sidebar {
    display: none;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 0;
    grid-template-rows: 1fr;
    height: 100svh;
    height: 100dvh;
  }

  .sidebar {
    padding: 16px;
    height: 100%;
    border-radius: 0;
    border: none;
  }

  .chat-panel {
    height: 100%;
    border-radius: 0;
    border: none;
  }

  .back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    max-height: none;
    overflow: visible;
  }

  .chat-list {
    gap: 8px;
    padding: 8px 0;
  }

  .user-item,
  .chat-item {
    margin: 0 8px;
    padding: 12px;
  }

  .folder-scroll {
    display: none;
  }

  .chat-header {
    padding: 12px 16px;
    height: auto;
    min-height: 70px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .chat-header-meta {
    gap: 2px;
  }

  .chat-title h3 {
    font-size: 16px;
  }

  .chat-right {
    margin-left: auto;
  }

  .messages {
    padding: 12px 16px;
    scroll-behavior: smooth;
  }

  .floating-search-island {
    top: 80px;
    width: 94%;
  }

  .call-banner {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
  }

  .call-banner-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .message {
    max-width: 85%;
  }

  .composer {
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom) + var(--keyboard-offset, 0px));
    background: var(--panel);
    border-top: 1px solid var(--stroke);
    gap: 8px;
    /* We use padding-bottom instead of transform for better stability with fixed headers */
    transition: padding-bottom var(--anim-fast) var(--ease-out);
  }

  .composer input,
  .composer textarea {
    font-size: 16px; /* Prevent auto-zoom on iOS */
  }

  .message-actions {
    display: none;
  }

  .reaction-jump-banner {
    right: 14px;
    bottom: calc(166px + env(safe-area-inset-bottom) + var(--keyboard-offset, 0px));
    max-width: calc(100% - 28px);
  }

  .reaction-jump-text {
    max-width: 160px;
  }

  .scroll-to-bottom-button {
    right: 14px;
    bottom: calc(222px + env(safe-area-inset-bottom) + var(--keyboard-offset, 0px));
    width: 56px;
    height: 56px;
  }
}
