@media (max-width: 980px) {
    .app-shell,
    .app-topbar__inner {
        width: min(96vw, 1680px);
    }

    body[data-authenticated='true'][data-sidebar-open='true'] .app-shell__layout {
        grid-template-columns: 224px minmax(0, 1fr);
    }

    .app-sidebar__panel {
        width: 224px;
        padding: 16px;
    }
}

@media (max-width: 720px) {
    :root {
        --topbar-height: 68px;
    }

    .app-topbar {
        background: rgba(15, 23, 42, 0.92);
        border-bottom-color: rgba(96, 165, 250, 0.22);
        box-shadow: 0 14px 34px rgba(15, 23, 42, 0.28);
    }

    .app-shell {
        width: calc(100vw - 20px);
        padding: 18px 0 30px;
    }

    .app-shell__layout {
        display: block;
    }

    .app-sidebar {
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        bottom: 0;
        width: min(84vw, 280px);
        overflow: visible;
        opacity: 1;
        transform: translateX(calc(-100% - 16px));
        transition: transform 0.22s ease;
        z-index: 990;
    }

    body[data-authenticated='true'][data-sidebar-open='true'] .app-sidebar {
        transform: translateX(0);
    }

    .app-sidebar__panel {
        position: relative;
        top: 0;
        width: 100%;
        height: 100%;
        padding: 18px 16px 24px;
        border-left: 0;
        border-radius: 0 3px 3px 0;
        overflow-y: auto;
        box-shadow: 0 20px 44px rgba(15, 23, 42, 0.22);
    }

    .app-shell__overlay {
        position: fixed;
        inset: var(--topbar-height) 0 0 0;
        z-index: 980;
        display: block;
        margin: 0;
        padding: 0;
        border: 0;
        background: rgba(15, 23, 42, 0.3);
        cursor: pointer;
    }

    .app-topbar__inner {
        width: calc(100vw - 20px);
        min-height: auto;
        padding: 10px 0;
        align-items: center;
        gap: 12px;
    }

    .app-topbar__session,
    .app-topbar__identity,
    .app-topbar__profile,
    .app-topbar__profile-copy {
        min-width: 0;
    }

    .app-topbar__identity,
    .app-topbar__profile {
        gap: 10px;
    }

    .app-topbar__profile {
        align-items: center;
    }

    .app-topbar__avatar {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
        border-color: rgba(255, 255, 255, 0.24);
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.24);
    }

    .app-topbar__name {
        font-size: 1rem;
        line-height: 1.15;
    }

    .app-topbar__role {
        font-size: 0.82rem;
        line-height: 1.2;
        color: rgba(191, 219, 254, 0.9);
    }

    .app-topbar__logout.button--secondary {
        width: 44px;
        min-width: 44px;
        flex-basis: 44px;
        border-color: rgba(96, 165, 250, 0.26);
        background: rgba(37, 99, 235, 0.16);
    }

    .app-topbar__menu-toggle.button--secondary {
        width: 44px;
        min-width: 44px;
        flex-basis: 44px;
        border-color: rgba(96, 165, 250, 0.26);
        background: rgba(37, 99, 235, 0.16);
    }

    .app-modal-layer {
        padding: 16px;
    }

    .app-modal {
        width: min(var(--app-modal-width, 680px), calc(100vw - 24px));
        max-height: calc(100vh - 32px);
        border-color: rgba(191, 219, 254, 0.72);
        box-shadow: 0 28px 60px rgba(15, 23, 42, 0.24);
    }

    .app-modal__header,
    .app-modal__body,
    .app-modal__footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    .app-modal__header,
    .app-modal__footer {
        display: grid;
        gap: 12px;
    }

    .app-modal__header {
        padding-top: 20px;
        padding-bottom: 16px;
    }

    .app-modal__body {
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .app-modal__footer {
        padding-top: 14px;
        padding-bottom: 20px;
    }

    .app-modal__title {
        font-size: 1.08rem;
    }

    .app-modal__close,
    .app-modal__footer .button {
        width: 100%;
    }
}

@media (max-width: 560px) {
    :root {
        --topbar-height: 60px;
    }

    .app-shell {
        width: calc(100vw - 16px);
        padding: 14px 0 26px;
    }

    .app-sidebar {
        width: min(86vw, 264px);
    }

    .app-topbar__inner {
        width: calc(100vw - 16px);
        padding: 8px 0;
        gap: 8px;
    }

    .app-topbar__identity,
    .app-topbar__profile {
        gap: 8px;
    }

    .app-topbar__avatar {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }

    .app-topbar__name {
        font-size: 0.92rem;
    }

    .app-topbar__role {
        font-size: 0.76rem;
    }

    .app-topbar__profile-copy {
        gap: 1px;
    }

    .app-topbar__logout.button--secondary {
        width: 40px;
        min-width: 40px;
        flex-basis: 40px;
    }

    .app-topbar__menu-toggle.button--secondary {
        width: 40px;
        min-width: 40px;
        flex-basis: 40px;
    }

    .app-topbar__menu-icon svg,
    .app-topbar__logout-icon svg {
        width: 18px;
        height: 18px;
    }

    .app-modal-layer {
        padding: 12px;
    }

    .app-modal {
        width: min(var(--app-modal-width, 680px), calc(100vw - 16px));
        max-height: calc(100vh - 24px);
    }

    .app-modal__header,
    .app-modal__body,
    .app-modal__footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .app-modal__header {
        gap: 10px;
    }
}