:root {
    --c365-provider-header-height: 80px;
    --c365-provider-shell-edge-inset: clamp(1rem, 2.5vw, 4rem);
    --c365-provider-subnav-width: 260px;
    --c365-provider-dock-width: 344px;
    --c365-provider-header-background: rgba(5, 15, 34, .62);
    --c365-provider-workspace-background:
        radial-gradient(62rem 45rem at 78% 4%, rgba(184, 112, 127, .46), transparent 68%),
        radial-gradient(58rem 48rem at 7% 72%, rgba(82, 35, 119, .5), transparent 70%),
        radial-gradient(58rem 44rem at 82% 108%, rgba(0, 111, 139, .42), transparent 68%),
        linear-gradient(145deg, #071123 0%, #13122e 48%, #07192d 100%);
}

body.c365-app--authenticated {
    background: var(--c365-provider-workspace-background);
    background-attachment: fixed;
}

.c365-app-layout.c365-provider-shell,
.c365-app-layout.c365-provider-shell.c365-app-layout--no-ai,
.c365-page-v2-page .c365-app-layout.c365-provider-shell,
.c365-page-v2-page .c365-app-layout.c365-provider-shell.c365-ai-docked-collapsed {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(calc(100dvh - var(--c365-provider-header-height)), auto);
    min-height: 100dvh;
    padding: 0;
    align-items: stretch;
    background: transparent;
}

.c365-provider-header,
.c365-page-v2-page .c365-provider-header {
    position: sticky;
    z-index: var(--c365-layer-header, 1100);
    top: 0;
    grid-column: 1;
    grid-row: 1;
    display: grid;
    min-width: 0;
    min-height: var(--c365-provider-header-height);
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 1.5rem;
    padding: 0 var(--c365-provider-shell-edge-inset);
    color: var(--c365-color-text-primary, #f7f5ff);
    border: 0;
    border-bottom: 1px solid rgba(148, 164, 214, .13);
    background: var(--c365-provider-header-background);
    box-shadow: 0 1rem 3rem rgba(2, 6, 19, .16);
    -webkit-backdrop-filter: blur(24px) saturate(118%);
    backdrop-filter: blur(24px) saturate(118%);
}

.c365-provider-header__identity {
    display: grid;
    min-width: max-content;
    gap: .08rem;
}

.c365-provider-header__brand {
    display: inline-flex;
    justify-self: start;
    text-decoration: none;
    font-family: "PT Sans", Inter, system-ui, sans-serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -.04em;
}

.c365-provider-header__brand .capture365-wordmark__capture,
.c365-provider-header__brand .capture365-wordmark__365 { color: #fff; }

.c365-provider-header__subtitle {
    display: none;
    max-width: 15rem;
    overflow: hidden;
    color: var(--c365-color-text-muted, #8fa8c8);
    font-size: .7rem;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.c365-provider-header > .c365-nav-toggle {
    display: none;
}

.c365-provider-header > .c365-nav-panel,
.c365-provider-header > .c365-nav-panel.collapse:not(.show) {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: flex-start;
    gap: .35rem;
}

.c365-provider-nav__list {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.c365-provider-nav__section-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.c365-provider-nav__link {
    position: relative;
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: .5rem .75rem;
    border: 0;
    border-radius: 0;
    color: rgba(255, 255, 255, .6);
    background: transparent;
    font-family: "PT Sans", Inter, system-ui, sans-serif;
    font-size: 20px;
    font-weight: 500;
    line-height: 32px;
    text-decoration: none;
    white-space: nowrap;
    transition: color .16s ease, opacity .16s ease;
}

.c365-provider-nav__link:hover,
.c365-provider-nav__link:focus-visible {
    color: var(--c365-color-text-primary, #f7f5ff);
    background: transparent;
}

.c365-provider-nav__link:focus-visible {
    outline: 2px solid var(--c365-color-border-focus, rgba(52, 243, 242, .72));
    outline-offset: 2px;
}

.c365-provider-nav__link.active {
    color: var(--c365-color-text-primary, #f7f5ff);
    background: transparent;
    font-weight: 600;
}

.c365-provider-nav__link.active::after { content: none; }

.c365-provider-nav__save-app {
    color: #06131b;
    background: #5fdbed;
    box-shadow: 0 .3rem .8rem rgba(0, 0, 0, .22);
    cursor: pointer;
}

.c365-provider-nav__save-app:hover,
.c365-provider-nav__save-app:focus-visible {
    color: #06131b;
    background: #8ce8f2;
}

.c365-provider-nav__save-app:disabled {
    color: #8095a6;
    background: rgba(117, 171, 204, .1);
    box-shadow: none;
    cursor: not-allowed;
    opacity: .72;
}

.c365-provider-nav__save-app.is-saving {
    color: #07131f;
    background: #f5ca70;
}

.c365-provider-nav__save-app--compact {
    display: none;
}

.c365-provider-nav__icon {
    display: none;
    width: 1.05rem;
    height: 1.05rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.c365-provider-nav__icon path[d^="M4 4h6"] {
    fill: currentColor;
    stroke: none;
}

.c365-provider-nav__divider {
    width: 1px;
    height: 1.75rem;
    flex: 0 0 1px;
    margin: 0 .1rem;
    background: rgba(116, 166, 197, .24);
}

.c365-provider-header__account {
    flex: 0 0 auto;
    margin-left: auto;
    padding-left: .15rem;
    border-left: 1px solid rgba(116, 166, 197, .2);
}

.c365-provider-header__account .c365-provider-nav__logout {
    width: auto;
    color: rgba(255, 255, 255, .6);
    text-align: left;
}

.c365-provider-header__account .c365-provider-nav__logout:hover,
.c365-provider-header__account .c365-provider-nav__logout:focus-visible { color: #fff; }

.c365-provider-shell > .c365-workspace,
.c365-page-v2-page .c365-provider-shell > .c365-workspace {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    min-height: calc(100dvh - var(--c365-provider-header-height));
    border: 0;
    border-radius: 0;
    background-color: transparent;
    background-image: var(--c365-provider-workspace-background);
    background-attachment: fixed;
    box-shadow: none;
}

.c365-provider-shell > .c365-workspace.c365-app-surface-shell--provider-preview,
.c365-page-v2-page .c365-provider-shell > .c365-workspace.c365-app-surface-shell--provider-preview {
    color: var(--c365-app-content-text, var(--c365-app-theme-text, #f7f8ff));
    background-color: var(--c365-app-content-background, var(--c365-app-theme-background, #07131b));
    background-image: none;
}

.c365-provider-shell > .c365-workspace.c365-app-surface-shell--provider-preview > .c365-app-header,
.c365-page-v2-page .c365-provider-shell > .c365-workspace.c365-app-surface-shell--provider-preview > .c365-app-header {
    top: var(--c365-provider-header-height);
}

/* App identity/navigation belongs to the runtime surface, not management. */
.c365-provider-shell .c365-page-app-context {
    display: none;
}

/* Canonical authenticated workspace: left sub-navigation, fluid content, optional context dock. */
.c365-page-v2-page .c365-workspace:not(.c365-app-surface-shell) .c365-main.c365-main--provider-workspace,
.c365-workspace .c365-main.c365-main--provider-workspace {
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: 0;
}

.c365-provider-workspace-frame {
    display: grid;
    min-width: 0;
    min-height: calc(100dvh - var(--c365-provider-header-height));
    grid-template-columns: minmax(220px, var(--c365-provider-subnav-width)) minmax(0, 1fr);
    align-items: start;
}

.c365-provider-workspace-frame--with-dock {
    grid-template-columns: minmax(220px, var(--c365-provider-subnav-width)) minmax(0, 1fr) var(--c365-provider-dock-width);
}

.c365-provider-workspace-frame__navigation {
    position: sticky;
    top: var(--c365-provider-header-height);
    display: grid;
    min-width: 0;
    height: calc(100dvh - var(--c365-provider-header-height));
    align-content: start;
    padding: 2.4rem 1rem 2rem var(--c365-provider-shell-edge-inset);
    overflow-y: auto;
    border-right: 1px solid rgba(139, 171, 220, .14);
    background: linear-gradient(180deg, rgba(4, 12, 30, .38), rgba(39, 19, 68, .18));
    scrollbar-gutter: stable;
}

.c365-provider-workspace-frame__content {
    min-width: 0;
    padding: 2.4rem var(--c365-provider-shell-edge-inset) 3rem;
}

.c365-provider-workspace-frame__dock {
    position: sticky;
    top: var(--c365-provider-header-height);
    display: grid;
    min-width: 0;
    height: calc(100dvh - var(--c365-provider-header-height));
    overflow: hidden;
    border-left: 1px solid rgba(139, 171, 220, .18);
    background: rgba(7, 21, 49, .48);
    backdrop-filter: blur(20px) saturate(112%);
}

.c365-provider-subnav {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 1rem;
}

.c365-provider-subnav__header {
    display: grid;
    gap: .18rem;
    padding-right: .7rem;
}

.c365-provider-subnav__header p,
.c365-provider-subnav__header h2 { margin: 0; }

.c365-provider-subnav__header p {
    color: #56d8e8;
    font-size: .68rem;
    font-weight: 750;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.c365-provider-subnav__header h2 {
    color: #f7f6ff;
    font: 700 1.35rem/1.04 Sora, Inter, system-ui, sans-serif;
    letter-spacing: -.025em;
}

.c365-provider-subnav__list {
    display: grid;
    min-width: 0;
    gap: .18rem;
}

.c365-provider-subnav__list a {
    display: flex;
    min-width: 0;
    min-height: 2.25rem;
    align-items: center;
    gap: .62rem;
    padding: .48rem .68rem;
    border: 1px solid transparent;
    border-radius: .65rem;
    color: #a9b5d1;
    font-size: .78rem;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}

.c365-provider-subnav__list a > span {
    width: .72rem;
    height: .72rem;
    flex: 0 0 .72rem;
    border: 1.5px solid currentColor;
    border-radius: .22rem;
    opacity: .82;
}

.c365-provider-subnav__list a:hover,
.c365-provider-subnav__list a:focus-visible {
    color: #eef7ff;
    background: rgba(77, 117, 181, .13);
}

.c365-provider-subnav__list a:focus-visible {
    outline: 2px solid rgba(66, 219, 235, .75);
    outline-offset: 2px;
}

.c365-provider-subnav__list a.active {
    color: #f7fbff;
    border-color: rgba(47, 216, 233, .72);
    background: rgba(41, 79, 137, .5);
    box-shadow: inset 0 0 0 1px rgba(62, 185, 222, .08), 0 .45rem 1.4rem rgba(2, 8, 25, .14);
}

.c365-provider-subnav__list a.active > span {
    color: #50deeb;
    background: rgba(42, 207, 223, .12);
}

@media (max-width: 900px) {
    .c365-provider-workspace-frame,
    .c365-provider-workspace-frame--with-dock {
        grid-template-columns: minmax(0, 1fr);
    }

    .c365-provider-workspace-frame__navigation,
    .c365-provider-workspace-frame__dock {
        position: static;
        width: 100%;
        height: auto;
        max-height: none;
    }

    .c365-provider-workspace-frame__navigation {
        padding: 1.1rem;
        border-right: 0;
        border-bottom: 1px solid rgba(139, 171, 220, .14);
    }

    .c365-provider-workspace-frame__content { padding: 1.2rem 1.1rem 2rem; }

    .c365-provider-workspace-frame__dock {
        min-height: 26rem;
        border-top: 1px solid rgba(139, 171, 220, .18);
        border-left: 0;
    }

    .c365-provider-subnav__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
    :root {
        --c365-provider-header-height: 62px;
    }

    .c365-provider-header,
    .c365-page-v2-page .c365-provider-header {
        grid-template-columns: minmax(0, 1fr) auto auto;
        gap: .75rem;
        min-height: var(--c365-provider-header-height);
        padding: .55rem 1rem;
    }

    .c365-page-v2-page .c365-provider-header > .c365-nav-toggle {
        display: inline-flex !important;
    }

    .c365-provider-nav__save-app--compact {
        display: inline-flex;
    }

    .c365-provider-nav__save-app--desktop {
        display: none;
    }

    .c365-provider-header > .c365-nav-panel.collapse:not(.show) {
        display: none !important;
    }

    .c365-provider-header > .c365-nav-panel.show,
    .c365-provider-header > .c365-nav-panel.collapsing {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        display: flex;
        max-height: calc(100dvh - var(--c365-provider-header-height));
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: .65rem;
        padding: .85rem 1rem 1rem;
        overflow-y: auto;
        border-top: 1px solid rgba(117, 171, 204, .12);
        background: rgba(7, 19, 31, .995);
        box-shadow: 0 18px 34px rgba(0, 0, 0, .38);
    }

    .c365-provider-nav__list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .2rem;
    }

    .c365-provider-nav__section-label {
        position: static;
        width: auto;
        height: auto;
        grid-column: 1 / -1;
        margin: .15rem 0 .2rem;
        padding: 0 .65rem;
        overflow: visible;
        clip: auto;
        color: #7f9ab0;
        font-size: .68rem;
        font-weight: 650;
        letter-spacing: .025em;
        white-space: normal;
    }

    .c365-provider-nav__link {
        width: 100%;
        justify-content: flex-start;
        font-size: 1.05rem;
    }

    .c365-provider-nav__icon { display: block; }

    .c365-provider-nav__divider {
        width: 100%;
        height: 1px;
        margin: .15rem 0;
    }

    .c365-provider-header__account {
        margin-left: 0;
        padding: .65rem 0 0;
        border-top: 1px solid rgba(116, 166, 197, .2);
        border-left: 0;
    }

    .c365-provider-header__account .c365-provider-nav__logout {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .c365-provider-header__subtitle {
        display: none;
    }

    .c365-provider-nav__list {
        grid-template-columns: minmax(0, 1fr);
    }

    .c365-provider-subnav__list { grid-template-columns: minmax(0, 1fr); }
}
