    @media (max-width: 1100px) {
        .container {
            width: 100%;
        }

        .app-layout {
            grid-template-columns: 220px minmax(0, 1fr);
        }

        .sidebar {
            padding: 20px;
        }

        .mode-header {
            align-items: stretch;
            flex-direction: column;
        }

        .mode-actions,
        .hero-actions {
            flex-wrap: wrap;
        }

        .filter-panel,
        .inline-filter {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .filter-actions {
            grid-column: 1 / -1;
        }

        .account-settings-panel .settings-group {
            grid-template-columns: 1fr;
        }

        .account-form {
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        }
    }

    @media (max-width: 820px) {
        body {
            padding: 0;
        }

        .container {
            border: 0;
            border-radius: 0;
            min-height: 100vh;
        }

        .app-layout {
            grid-template-columns: 1fr;
            min-height: 100vh;
        }

        .sidebar {
            border-radius: 0;
            display: block;
            padding: 12px 16px;
            position: relative;
            z-index: 20;
        }

        .sidebar-top {
            align-items: center;
            display: flex;
            justify-content: space-between;
        }

        .sidebar-brand {
            min-width: 0;
        }

        .sidebar-brand small {
            display: none;
        }

        .brand-mark {
            height: 38px;
            width: 38px;
        }

        .space-chip {
            margin-top: 10px;
            padding: 8px 10px;
        }

        .space-chip span {
            display: inline;
            margin: 0 6px 0 0;
        }

        .space-chip strong {
            display: inline;
            overflow-wrap: anywhere;
        }

        .sidebar-nav {
            background: #203f3f;
            bottom: 0;
            display: grid;
            gap: 2px;
            grid-template-columns: repeat(6, minmax(0, 1fr));
            left: 0;
            margin: 0;
            padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
            position: fixed;
            right: 0;
            z-index: 40;
        }

        .sidebar-nav a {
            align-items: center;
            display: flex;
            justify-content: center;
            min-height: 48px;
            min-width: 0;
            padding: 6px 3px;
            text-align: center;
        }

        .sidebar-nav span {
            font-size: 11px;
            line-height: 1.15;
            overflow-wrap: anywhere;
        }

        .sidebar-nav small {
            display: none;
        }

        .sidebar-logout {
            display: none;
        }

        .mobile-logout {
            display: block;
            margin: 0;
        }

        .mobile-logout button {
            background: transparent;
            border: 1px solid rgba(255, 255, 255, 0.28);
            border-radius: 8px;
            color: #fff;
            font: inherit;
            min-height: 40px;
            padding: 7px 10px;
        }

        .app-main {
            padding: 18px 18px calc(82px + env(safe-area-inset-bottom));
        }

        .stats-grid,
        .app-stats {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .filter-panel,
        .inline-filter,
        .files-filter,
        .chat-compose,
        .settings-group {
            grid-template-columns: 1fr;
        }

        .event-row {
            grid-template-columns: 1fr;
        }

        input,
        select,
        textarea {
            font-size: 16px;
            max-width: 100%;
        }

        .primary-action,
        .secondary-action,
        .muted-action,
        .mini-action,
        .button {
            min-height: 44px;
        }

        .file-card,
        .task-card,
        .mini-item,
        .event-row,
        .chat-bubble {
            min-width: 0;
            overflow-wrap: anywhere;
        }

        .chat-layout {
            height: var(--chat-viewport-height, 100dvh);
            min-height: 0;
            overflow: hidden;
        }

        .chat-main {
            display: grid;
            grid-template-rows: minmax(0, 1fr);
            min-height: 0;
            overflow: hidden;
            padding: 8px 8px calc(64px + env(safe-area-inset-bottom));
        }

        .chat-mode-header {
            display: none;
        }

        .chat-mode-panel {
            grid-template-rows: minmax(0, 1fr) auto;
            gap: 4px;
            min-height: 0;
            overflow: hidden;
            padding: 4px;
        }

        .full-chat-feed {
            height: auto;
            margin: 0;
            max-height: none;
            min-height: 0;
            overscroll-behavior: contain;
            padding: 2px 2px 4px;
            scroll-behavior: smooth;
        }

        .chat-compose {
            background: inherit;
            border-top: 0;
            bottom: auto;
            max-height: min(30dvh, 240px);
            overflow-y: auto;
            padding-top: 2px;
            position: static;
        }

        .chat-compose textarea {
            height: 38px;
            line-height: 1.35;
            max-height: 104px;
            min-height: 38px;
            overflow-y: auto;
            padding: 8px 10px;
            resize: none;
        }
    }

    @media (max-width: 640px) {
        body {
            padding: 0;
        }

        .container {
            max-width: 100%;
            min-height: 100vh;
            border-radius: 0;
        }

        .header-bar,
        #search-and-wrapper,
        #search-and-wrapper form,
        .dashboard-hero,
        .hero-actions,
        .filter-actions {
            align-items: stretch;
            flex-direction: column;
        }

        #add-link {
            align-self: flex-end;
            line-height: 1;
        }

        .dashboard-hero {
            padding: 26px 20px;
        }

        .home-hero {
            align-items: stretch;
            flex-direction: column;
            padding: 26px 20px;
        }

        .home-hero h1 {
            font-size: 34px;
        }

        .home-grid {
            grid-template-columns: 1fr;
            padding: 20px;
        }

        .hub-panel-wide {
            grid-row: auto;
        }

        .panel-heading {
            flex-direction: column;
        }

        .dashboard-hero h1 {
            font-size: 32px;
        }

        .task-grid {
            grid-template-columns: 1fr;
            padding-left: 20px;
            padding-right: 20px;
        }

        .stats-grid,
        .app-stats {
            gap: 10px;
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .stat-card {
            min-height: 94px;
            padding: 14px;
        }

        .stat-card strong {
            font-size: 26px;
        }

        .filter-panel {
            grid-template-columns: 1fr;
            margin: 20px;
        }

        .task-list-header {
            margin-left: 20px;
            margin-right: 20px;
        }

        .app-layout {
            grid-template-columns: 1fr;
        }

        .sidebar {
            border-radius: 0;
        }

        .sidebar-nav {
            display: grid;
            overflow: visible;
        }

        .app-main {
            padding: 16px 14px calc(82px + env(safe-area-inset-bottom));
        }

        .chat-main {
            padding: 4px 4px calc(60px + env(safe-area-inset-bottom));
        }

        .mode-header,
        .mode-actions,
        .chat-compose {
            align-items: stretch;
            flex-direction: column;
        }

        .mode-header h1 {
            font-size: 30px;
        }

        .mode-header .primary-action,
        .mode-header .secondary-action,
        .mode-header .mini-action,
        .mode-actions a,
        .mode-actions button {
            justify-content: center;
            text-align: center;
            width: 100%;
        }

        .mode-grid,
        .app-task-grid,
        .file-grid,
        .two-stats {
            grid-template-columns: 1fr;
        }

        .files-filter {
            grid-template-columns: 1fr;
        }

        .event-row {
            grid-template-columns: 1fr;
        }

        .settings-group {
            grid-template-columns: 1fr;
        }

        .inline-settings-form,
        .account-form {
            grid-template-columns: 1fr;
        }

        .chat-bubble {
            max-width: 92%;
        }

        .chat-compose > .button {
            width: 100%;
        }

        .chat-compose-row {
            gap: 5px;
            grid-template-columns: 36px minmax(0, 1fr) 36px 36px 36px;
        }

        .chat-icon-button,
        .chat-send-button {
            height: 36px;
            width: 36px;
        }

        .chat-photo {
            height: auto;
            max-height: 55vh;
            width: 100%;
        }

        .chat-audio {
            max-width: 100%;
            width: 100%;
        }

        .file-actions,
        .form-actions,
        .filter-actions {
            display: grid;
            grid-template-columns: 1fr;
        }

        .file-actions a,
        .form-actions a,
        .form-actions button,
        .filter-actions a,
        .filter-actions button {
            justify-content: center;
            text-align: center;
            width: 100%;
        }

        .floating-video-circle {
            bottom: calc(74px + env(safe-area-inset-bottom));
            right: 12px;
        }

        .floating-video-circle video {
            height: min(52vw, 190px);
            width: min(52vw, 190px);
        }

        .empty-state {
            padding: 28px 18px;
        }
    }
