:root {
    --c365-provider-sidebar-width: 260px;
    --c365-provider-sidebar-background: #0b1a2b;
    --c365-provider-shell-inset: 0px;
    --c365-provider-shell-gap: 0px;
    --c365-provider-workspace-left-radius: 36px;
}

body.c365-app--authenticated {
    background: #050b13;
}

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

.c365-provider-mobilebar {
    display: none;
}

.c365-provider-sidebar,
.c365-board-v2-page .c365-provider-sidebar {
    position: sticky;
    z-index: var(--c365-layer-header, 1100);
    top: var(--c365-provider-shell-inset);
    grid-column: 1;
    grid-row: 1;
    display: flex;
    min-width: 0;
    height: calc(100dvh - var(--c365-provider-shell-inset) - var(--c365-provider-shell-inset));
    flex-direction: column;
    padding: 1.75rem 1rem 1.15rem;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    color: #d7e5ef;
    background: transparent;
    box-shadow: none;
}

.c365-provider-sidebar__brand {
    display: inline-flex;
    align-self: flex-start;
    margin: 0 .75rem;
    text-decoration: none;
}

.c365-provider-sidebar__subtitle {
    margin: .35rem .75rem 1.75rem;
    color: #8fa9bd;
    font-size: .76rem;
    font-weight: 500;
}

.c365-provider-sidebar > .c365-nav-panel,
.c365-provider-sidebar > .c365-nav-panel.collapse:not(.show) {
    display: flex;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow: auto;
    scrollbar-color: rgba(104, 157, 188, .28) transparent;
    scrollbar-width: thin;
}

.c365-provider-nav__list {
    display: grid;
    gap: .22rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.c365-provider-nav__section-label {
    margin: 0 0 .42rem;
    padding: 0 .75rem;
    color: #7f9ab0;
    font: 600 .69rem/1.4 var(--c365-font-body, Manrope, sans-serif);
    letter-spacing: .025em;
    text-transform: none;
}

.c365-provider-nav__link {
    position: relative;
    display: grid;
    grid-template-columns: 1.3rem minmax(0, 1fr);
    min-height: 42px;
    align-items: center;
    gap: .72rem;
    padding: .65rem .78rem;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #bdccda;
    font-size: .83rem;
    font-weight: 600;
    text-decoration: none;
    transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease;
}

.c365-provider-nav__link:hover,
.c365-provider-nav__link:focus-visible {
    color: #f4faff;
    border-color: rgba(91, 153, 199, .14);
    background: rgba(79, 131, 176, .11);
}

.c365-provider-nav__link.active {
    color: #f7fbff;
    border-color: rgba(57, 136, 206, .18);
    background: linear-gradient(90deg, rgba(32, 92, 166, .48), rgba(30, 76, 127, .3));
    box-shadow: inset 0 0 20px rgba(44, 129, 222, .08);
}

.c365-provider-nav__link.active::before {
    content: "";
    position: absolute;
    inset: .38rem auto .38rem 0;
    width: 3px;
    border-radius: 99px;
    background: #45c8f1;
    box-shadow: 0 0 10px rgba(69, 200, 241, .48);
}

.c365-provider-nav__icon {
    width: 1.18rem;
    height: 1.18rem;
    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 {
    height: 1px;
    margin: 1rem .75rem 1.1rem;
    background: linear-gradient(90deg, rgba(116, 166, 197, .24), rgba(116, 166, 197, .05));
}

.c365-provider-nav__apps {
    display: grid;
    gap: .55rem;
}

.c365-provider-app-switcher {
    position: relative;
    display: block;
    margin: 0 0 .2rem;
}

.c365-provider-app-switcher > summary {
    display: grid;
    grid-template-columns: 2.15rem minmax(0, 1fr) 1rem;
    min-height: 54px;
    align-items: center;
    gap: .65rem;
    padding: .5rem .58rem;
    border: 1px solid rgba(96, 154, 190, .16);
    border-radius: 11px;
    color: #eef7fc;
    background: linear-gradient(135deg, rgba(26, 53, 79, .96), rgba(12, 33, 53, .96));
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18), inset 0 1px rgba(255, 255, 255, .025);
    cursor: pointer;
    list-style: none;
}

.c365-provider-app-switcher > summary::-webkit-details-marker { display: none; }
.c365-provider-app-switcher > summary > svg { width: 1rem; fill: none; stroke: #86a2b5; stroke-width: 1.8; transition: transform .16s ease; }
.c365-provider-app-switcher[open] > summary > svg { transform: rotate(180deg); }

.c365-provider-app-switcher__mark {
    display: grid;
    width: 2.15rem;
    height: 2.15rem;
    place-items: center;
    border: 1px solid rgba(87, 211, 246, .35);
    border-radius: 10px;
    color: #effcff;
    background: linear-gradient(145deg, #2e75dd, #2159a6);
    font-size: .78rem;
    font-weight: 800;
    box-shadow: 0 5px 15px rgba(15, 77, 155, .25);
}

.c365-provider-app-switcher__copy,
.c365-provider-app-switcher__menu a > span:last-child {
    display: grid;
    min-width: 0;
    gap: .12rem;
}

.c365-provider-app-switcher strong { overflow: hidden; font-size: .79rem; text-overflow: ellipsis; white-space: nowrap; }
.c365-provider-app-switcher small { color: #7f9aae; font-size: .64rem; }

.c365-provider-app-switcher__menu {
    position: absolute;
    z-index: 12;
    top: calc(100% + .42rem);
    left: 0;
    display: grid;
    width: 100%;
    max-height: min(19rem, 55vh);
    gap: .2rem;
    padding: .38rem;
    overflow: auto;
    border: 1px solid rgba(88, 153, 195, .28);
    border-radius: 11px;
    background: rgba(8, 24, 39, .985);
    box-shadow: 0 18px 42px rgba(0, 0, 0, .46);
}

.c365-provider-app-switcher__menu a {
    display: grid;
    grid-template-columns: 2.15rem minmax(0, 1fr);
    align-items: center;
    gap: .58rem;
    padding: .48rem;
    border-radius: 8px;
    color: #d9e8f1;
    text-decoration: none;
}
.c365-provider-app-switcher__menu a:hover,
.c365-provider-app-switcher__menu a.active { background: rgba(53, 123, 180, .18); }
.c365-provider-app-switcher--empty { padding: .8rem; border: 1px dashed rgba(82, 176, 217, .28); border-radius: 9px; color: #a9dcef; text-decoration: none; }

.c365-provider-nav__list--app { gap: .12rem; }

.c365-provider-sidebar__account {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(116, 166, 197, .14);
}
.c365-provider-sidebar__account .c365-provider-nav__logout {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
}

.c365-provider-shell > .c365-workspace,
.c365-board-v2-page .c365-provider-shell > .c365-workspace {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: calc(100dvh - var(--c365-provider-shell-inset) - var(--c365-provider-shell-inset));
    border: 1px solid rgba(117, 171, 204, .1);
    border-radius: var(--c365-provider-workspace-left-radius) 0 0 var(--c365-provider-workspace-left-radius);
    background-color: var(--c365-provider-sidebar-background);
    background-image:
        linear-gradient(180deg, rgba(9, 23, 38, .98), rgba(7, 16, 29, .995) 54%, rgba(6, 14, 25, .995)),
        url("../images/logic365-provider-pattern.svg");
    background-position: 0 0, right -70px top -40px;
    background-size: auto, 300px 300px;
    box-shadow: inset 1px 0 rgba(128, 184, 214, .035), 0 14px 42px rgba(0, 0, 0, .14);
}

.c365-provider-shell > .c365-workspace > .c365-app-header {
    border-top-left-radius: inherit;
}

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

@media (min-width: 921px) and (max-width: 1360px) {
    :root { --c365-provider-sidebar-width: 246px; }
}

@media (max-width: 920px) {
    .c365-app-layout.c365-provider-shell,
    .c365-app-layout.c365-provider-shell.c365-app-layout--no-ai,
    .c365-board-v2-page .c365-app-layout.c365-provider-shell,
    .c365-board-v2-page .c365-app-layout.c365-provider-shell.c365-ai-docked-collapsed {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: 58px minmax(calc(100dvh - 58px), auto);
        gap: 0;
        padding: 0;
    }

    .c365-provider-mobilebar {
        position: sticky;
        z-index: calc(var(--c365-layer-header, 1100) + 1);
        top: 0;
        grid-column: 1;
        grid-row: 1;
        display: flex;
        min-height: 58px;
        align-items: center;
        justify-content: space-between;
        padding: 0 1rem;
        background: rgba(8, 20, 33, .98);
        box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
    }
    .c365-provider-mobilebar .c365-nav-toggle { display: inline-flex; }

    .c365-provider-sidebar,
    .c365-board-v2-page .c365-provider-sidebar {
        position: fixed;
        z-index: var(--c365-layer-mobile-navigation, 1190);
        top: 58px;
        bottom: 0;
        left: 0;
        width: min(280px, calc(100vw - 3rem));
        height: calc(100dvh - 58px);
        border-radius: 0;
        padding-top: 1rem;
        visibility: hidden;
        pointer-events: none;
        transform: translateX(-102%);
        transition: transform .2s ease, visibility .2s ease;
    }
    .c365-provider-sidebar:has(.c365-nav-panel.show) { visibility: visible; pointer-events: auto; transform: none; }
    .c365-provider-sidebar__brand, .c365-provider-sidebar__subtitle { display: none; }
    .c365-provider-sidebar > .c365-nav-panel.collapse:not(.show) { display: flex; }
    .c365-provider-shell > .c365-workspace,
    .c365-board-v2-page .c365-provider-shell > .c365-workspace {
        grid-column: 1;
        grid-row: 2;
        min-height: calc(100dvh - 58px);
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
}
