@media (max-width: 960px) {
    .dashboard-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .dashboard-sidebar {
        position: static;
        height: auto;
        min-height: 0;
        padding: .75rem 1rem;
        border-right: 0;
        border-bottom: 1px solid rgba(185, 165, 138, 0.16);
        background: var(--rail-bg);
    }

    .sidebar-caption,
    .sidebar-divider,
    .sidebar-account {
        display: none;
    }

    .sidebar-nav {
        display: flex;
        gap: .45rem;
        overflow-x: auto;
        padding-bottom: .15rem;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-nav::-webkit-scrollbar {
        display: none;
    }

    .sidebar-link {
        flex: 0 0 auto;
        width: auto;
        min-width: max-content;
        min-height: 40px;
        padding: .5rem .8rem;
        white-space: nowrap;
    }

    .sidebar-link:hover {
        transform: translateY(-1px);
    }

    main {
        padding: 1.25rem clamp(.75rem, 3vw, 1.5rem) 4.5rem;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.9rem;
    }

    .dashboard-status {
        text-align: left;
    }

    .dashboard-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .dashboard-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .dashboard-dialog-content.has-settings-sidebar {
        width: calc(100vw - 1rem);
        height: min(86dvh, 620px);
        padding: 0.9rem;
    }

    .dashboard-settings-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
    }

    .dashboard-settings-nav {
        display: flex;
        gap: .4rem;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .dashboard-settings-nav button {
        flex: 0 0 auto;
        min-height: 36px;
    }

    .dashboard-settings-panel {
        padding: .85rem;
    }

    header {
        align-items: stretch;
        flex-direction: column;
        gap: 0.55rem;
        padding: 0.75rem;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
        gap: 0.4rem;
    }

    .header-actions > .button {
        flex: 1 1 auto;
        min-height: 38px;
        padding: 0.45rem 0.65rem;
        font-size: 0.74rem;
    }

    .user-panel {
        flex: 0 1 auto;
        margin-left: auto;
        max-width: 100%;
    }

    .user-meta small {
        max-width: 110px;
    }

    .account-menu,
    .notification-menu {
        position: fixed;
        top: 66px;
        right: 10px;
        left: auto;
        width: min(310px, calc(100vw - 20px));
        max-height: calc(100dvh - 84px);
    }

    main {
        width: 100%;
        max-width: 100%;
        padding: 1rem 0.75rem 5rem;
    }

    .albums-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.9rem;
    }

    .album-viewer {
        margin-top: 1.2rem;
        padding: 0.8rem;
        border-radius: 14px;
    }

    .album-viewer-header {
        align-items: flex-start;
        flex-wrap: wrap;
        margin-bottom: 0.8rem;
    }

    .album-viewer-title {
        max-width: 100%;
        font-size: 1.05rem;
    }

    .album-viewer-header .button {
        min-height: 36px;
        padding: 0.45rem 0.65rem;
    }

    .viewer-toolbar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
        padding: 0.55rem;
    }

    .viewer-toolbar.is-visible {
        display: grid;
    }

    .viewer-search {
        grid-column: 1 / -1;
        min-width: 0;
        width: 100%;
    }

    .viewer-category {
        max-width: none;
        width: 100%;
    }

    .viewer-toolbar .button {
        width: 100%;
        min-height: 38px;
        padding: 0.45rem 0.35rem;
        font-size: 0.68rem;
    }

    .viewer-download {
        margin-left: 0;
    }

    .viewer-comments-toggle {
        grid-column: 1 / -1;
    }

    .album-viewer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem;
    }

    .viewer-photo {
        border-radius: 9px;
    }

    .viewer-photo-heart {
        top: 0.35rem;
        right: 0.35rem;
        width: 36px;
        height: 36px;
    }

    .viewer-close {
        top: 0.65rem;
        right: 0.65rem;
        width: 38px;
        height: 38px;
        background: rgba(0, 0, 0, .62);
    }

    .admin-chat {
        right: .65rem;
        bottom: .65rem;
    }

    .admin-chat-toggle {
        width: 48px;
        height: 48px;
    }

    .admin-chat-mark {
        width: 1.7rem;
        height: 1.7rem;
        flex-basis: 1.7rem;
    }
}

@media (max-width: 420px) {
    .user-meta {
        display: none;
    }
}
