/*
 * inDesk workspace refresh
 *
 * This layer refines the authenticated application shell while deliberately
 * reusing the color tokens from maildesk.css. Module-specific styles remain
 * free to build on top of these shared foundations.
 */

body.is-authenticated {
    background:
        radial-gradient(circle at 72% -12%, rgba(37, 99, 235, .055), transparent 30rem),
        var(--canvas);
}

.is-authenticated .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
    transition: grid-template-columns 180ms ease;
}

.is-authenticated .app-shell.is-sidebar-collapsed {
    grid-template-columns: 78px minmax(0, 1fr);
}

.is-authenticated .sidebar {
    z-index: 30;
    border-right: 1px solid rgba(191, 219, 254, .1);
    background:
        radial-gradient(circle at 18% 2%, rgba(147, 197, 253, .14), transparent 15rem),
        linear-gradient(172deg, var(--sidebar) 0%, var(--sidebar-deep) 76%);
    box-shadow: 8px 0 30px rgba(15, 23, 42, .06);
}

.is-authenticated .sidebar-header {
    min-height: 76px;
    border-bottom: 1px solid var(--sidebar-line);
    padding: 17px 20px;
}

.is-authenticated .brand-logo {
    transition: opacity 140ms ease, transform 140ms ease;
}

.is-authenticated .brand-logo:hover {
    opacity: .94;
    transform: translateY(-1px);
}

.is-authenticated .primary-nav {
    padding: 13px 13px 24px;
}

.is-authenticated .nav-section-heading {
    color: rgba(191, 219, 254, .76);
    font-size: .64rem;
    letter-spacing: .12em;
    padding: 25px 11px 8px;
}

.is-authenticated .nav-section-heading--menu {
    padding-top: 8px;
}

.is-authenticated .nav-link {
    min-height: 44px;
    gap: 12px;
    margin: 3px 0;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #dbeafe;
    font-size: .88rem;
    font-weight: 590;
    padding: 9px 11px;
    transition:
        background-color 140ms ease,
        border-color 140ms ease,
        color 140ms ease,
        transform 140ms ease;
}

.is-authenticated .nav-link > .icon {
    opacity: .82;
    transition: opacity 140ms ease;
}

.is-authenticated .nav-link:hover {
    border-color: rgba(191, 219, 254, .08);
    background: rgba(255, 255, 255, .075);
    transform: translateX(2px);
}

.is-authenticated .nav-link:hover > .icon,
.is-authenticated .nav-link.active > .icon {
    opacity: 1;
}

.is-authenticated .nav-link.active {
    border-color: rgba(147, 197, 253, .22);
    background: linear-gradient(100deg, rgba(37, 99, 235, .34), rgba(37, 99, 235, .18));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 22px rgba(2, 6, 23, .12);
}

.is-authenticated .nav-link.active::before {
    left: -1px;
    width: 3px;
    height: 22px;
    border-radius: 0 6px 6px 0;
    box-shadow: 0 0 12px rgba(147, 197, 253, .34);
}

.is-authenticated .sidebar-mailboxes {
    margin-top: 16px;
    border-top: 1px solid var(--sidebar-line);
}

.is-authenticated .mailbox-link {
    min-height: 52px;
}

.is-authenticated .mailbox-dot {
    margin-top: 7px;
}

.is-authenticated .sidebar-collapse-toggle.icon-button {
    border-color: rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .045);
}

.is-authenticated .app-main {
    min-width: 0;
    padding: 0 0 64px;
}

.is-authenticated .app-toolbar {
    position: sticky;
    z-index: 20;
    top: 0;
    width: 100%;
    max-width: var(--app-content-max-width);
    min-height: 72px;
    gap: 12px 18px;
    border: 0;
    border-bottom: 1px solid rgba(216, 225, 234, .88);
    border-radius: 0;
    background: rgba(245, 247, 250, .88);
    box-shadow: 0 8px 28px rgba(23, 32, 51, .035);
    margin: 0 auto;
    padding: 11px clamp(24px, 3.2vw, 52px);
    -webkit-backdrop-filter: blur(16px) saturate(145%);
    backdrop-filter: blur(16px) saturate(145%);
}

.is-authenticated .app-toolbar--conversation {
    top: 0;
}

.is-authenticated .app-toolbar-start,
.is-authenticated .app-toolbar-end {
    gap: 9px;
}

.is-authenticated .app-toolbar-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: .67rem;
    font-weight: 760;
    letter-spacing: .1em;
}

.is-authenticated .app-toolbar-label::before {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px var(--success-soft);
    content: "";
}

.is-authenticated .app-toolbar--conversation .app-toolbar-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.is-authenticated .account-trigger {
    min-width: min(250px, calc(100vw - 40px));
    gap: 9px;
    grid-template-columns: 36px minmax(0, 1fr) 16px;
    border-color: transparent;
    border-radius: 13px;
    background: rgba(255, 255, 255, .78);
    box-shadow: 0 1px 2px rgba(23, 32, 51, .06), inset 0 0 0 1px rgba(216, 225, 234, .82);
    padding: 6px 9px 6px 7px;
}

.is-authenticated .account-trigger:hover,
.is-authenticated .account-trigger:focus-visible {
    border-color: transparent;
    background: var(--panel);
    box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--brand-line);
}

.is-authenticated .account-avatar {
    width: 36px;
    height: 36px;
    background: var(--brand);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22);
}

.is-authenticated .account-copy strong {
    font-size: .79rem;
    font-weight: 680;
}

.is-authenticated .account-popover {
    top: calc(100% + 10px);
    width: min(250px, calc(100vw - 28px));
    border-radius: 15px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .18);
    padding: 7px;
}

.is-authenticated .account-menu-link {
    min-height: 42px;
    border-radius: 9px;
    padding: 10px 11px;
}

.is-authenticated .page {
    width: 100%;
    max-width: var(--app-content-max-width);
    margin: 0 auto;
    padding: clamp(28px, 3.2vw, 48px) clamp(24px, 3.2vw, 52px) 0;
}

.is-authenticated .page-header {
    align-items: center;
    margin-bottom: 28px;
}

.is-authenticated .page-header h1 {
    font-size: clamp(1.8rem, 2.6vw, 2.45rem);
    font-weight: 730;
    letter-spacing: -.05em;
}

.is-authenticated .lead {
    max-width: 760px;
    color: var(--muted);
    font-size: .93rem;
    line-height: 1.6;
    margin-top: 8px;
}

.is-authenticated .card {
    border-color: rgba(216, 225, 234, .94);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(23, 32, 51, .035), 0 10px 32px rgba(23, 32, 51, .025);
}

.is-authenticated .button {
    min-height: 42px;
    border-radius: 11px;
    box-shadow: 0 1px 2px rgba(23, 32, 51, .06);
    font-weight: 690;
    padding-inline: 15px;
}

.is-authenticated .button:not(.secondary):not(.danger) {
    box-shadow: 0 7px 18px rgba(37, 99, 235, .16);
}

.is-authenticated input,
.is-authenticated textarea,
.is-authenticated select {
    border-color: var(--line);
    border-radius: 11px;
    box-shadow: 0 1px 2px rgba(23, 32, 51, .025);
}

.is-authenticated input:hover,
.is-authenticated textarea:hover,
.is-authenticated select:hover {
    border-color: var(--line-hover);
}

@media (max-width: 1100px) {
    .is-authenticated .app-shell {
        grid-template-columns: 236px minmax(0, 1fr);
    }

    .is-authenticated .app-shell.is-sidebar-collapsed {
        grid-template-columns: 74px minmax(0, 1fr);
    }
}

@media (max-width: 860px) {
    .is-authenticated .app-shell,
    .is-authenticated .app-shell.is-sidebar-collapsed {
        display: block;
    }

    .is-authenticated .sidebar {
        position: sticky;
        top: 0;
        min-height: 66px;
        box-shadow: 0 8px 28px rgba(15, 23, 42, .14);
    }

    .is-authenticated .sidebar-header,
    .is-authenticated .app-shell.is-sidebar-collapsed .sidebar-header {
        min-height: 66px;
        padding: 12px 18px;
    }

    .is-authenticated .sidebar-panel {
        top: 66px;
        border-top-color: rgba(191, 219, 254, .12);
        background:
            radial-gradient(circle at 16% 0%, rgba(147, 197, 253, .11), transparent 18rem),
            var(--sidebar-deep);
    }

    .is-authenticated .primary-nav {
        padding: 13px 16px 24px;
    }

    .is-authenticated .app-toolbar,
    .is-authenticated .app-toolbar--conversation {
        top: 66px;
        min-height: 62px;
        padding: 8px 20px;
    }

    .is-authenticated .page {
        padding: 28px 20px 0;
    }
}

@media (max-width: 680px) {
    .is-authenticated .app-toolbar {
        gap: 8px;
        padding-inline: 16px;
    }

    .is-authenticated .app-toolbar-start {
        flex-wrap: wrap;
    }

    .is-authenticated .app-toolbar-label {
        font-size: .63rem;
    }

    .is-authenticated .account-trigger {
        min-width: 0;
    }

    .is-authenticated .account-copy small {
        display: none;
    }

    .is-authenticated .page {
        padding: 24px 16px 0;
    }

    .is-authenticated .page-header {
        align-items: stretch;
        gap: 18px;
        margin-bottom: 24px;
    }

    .is-authenticated .page-actions {
        display: flex;
    }
}

@media (max-width: 480px) {
    .is-authenticated .app-toolbar-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .is-authenticated .account-trigger {
        grid-template-columns: 36px 14px;
    }

    .is-authenticated .account-copy {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .is-authenticated .page-header h1 {
        font-size: 1.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .is-authenticated .app-shell,
    .is-authenticated .brand-logo,
    .is-authenticated .nav-link,
    .is-authenticated .nav-link > .icon {
        transition: none;
    }
}
