.ip-shell, .ip-shell * { box-sizing: border-box; }

.ip-shell {
    --ip-shell-gutter: clamp(12px, 1.3vw, 20px);
    --ip-sidebar-width: 272px;
    --ip-topbar-height: 64px;
    display: grid;
    grid-template-columns: var(--ip-sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
    background: var(--ip-bg);
    color: var(--ip-text);
    font-family: var(--ip-font);
}

.ip-workspace { min-width: 0; }

.ip-skip {
    position: absolute;
    z-index: 120;
    top: 8px;
    left: 8px;
    padding: 10px 14px;
    transform: translateY(-200%);
    border-radius: 8px;
    background: var(--ip-fill);
    color: #fff;
}

.ip-skip:focus { transform: none; color: #fff; }

.ip-sidebar {
    position: sticky;
    z-index: 6;
    top: var(--ip-shell-gutter);
    align-self: start;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 2 * var(--ip-shell-gutter));
    height: calc(100dvh - 2 * var(--ip-shell-gutter));
    min-width: 0;
    margin: var(--ip-shell-gutter) 0 var(--ip-shell-gutter) var(--ip-shell-gutter);
    border: 1px solid var(--ip-border);
    border-radius: 23px;
    background: var(--ip-sidebar);
    box-shadow: 0 5px 20px rgb(36 38 59 / .035);
    color: var(--ip-text);
}

.ip-sidebar-top { display: flex; align-items: center; justify-content: space-between; margin: 0 13px; }

.ip-shell .ip-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    flex-shrink: 0;
    min-height: 72px;
    padding: 12px 5px;
    color: var(--ip-text);
    text-decoration: none;
}

.ip-shell .ip-brand:hover { color: var(--ip-link); }
.ip-brand-mark { display: block; width: 43px; height: 43px; flex: 0 0 auto; }
.ip-brand-wordmark { display: block; font-size: 1.32rem; font-weight: 700; letter-spacing: -.05em; }

.ip-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    scrollbar-color: var(--ip-border) transparent;
    scrollbar-width: thin;
    overscroll-behavior: contain;
    padding: 4px 11px 12px;
}

.ip-nav-group { margin: 0 0 10px; }

.ip-nav-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    min-height: 33px;
    padding: 6px 8px;
    border-radius: 8px;
    color: var(--ip-muted);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .005em;
    line-height: 1.4;
    list-style: none;
    cursor: pointer;
    transition: color .18s ease, background-color .18s ease;
}

.ip-nav-heading::-webkit-details-marker, .ip-profile::-webkit-details-marker { display: none; }
.ip-nav-heading:hover { color: var(--ip-link); background: var(--ip-hover); }
.ip-nav-heading .ip-nav-chevron { width: 14px; height: 14px; transform: rotate(-90deg); transition: transform .18s ease; }
.ip-nav-group[open] .ip-nav-heading .ip-nav-chevron { transform: none; }
.ip-nav-items { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.ip-logout-form { margin: 0; }

.ip-shell .ip-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 38px;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--ip-text);
    font: 500 .81rem/1.4 var(--ip-font);
    text-align: start;
    text-decoration: none;
    transition: color .18s ease, background-color .18s ease, border-color .18s ease;
}

.ip-nav-link .ip-icon { width: 17px; height: 17px; color: var(--ip-muted); }
.ip-shell .ip-nav-link:hover { background: var(--ip-hover); color: var(--ip-link); }
.ip-shell .ip-nav-link[aria-current] {
    border-color: color-mix(in srgb, var(--ip-primary) 13%, var(--ip-lavender));
    background: var(--ip-lavender);
    color: var(--ip-link);
    font-weight: 700;
}

.ip-nav-link[aria-current] .ip-icon, .ip-nav-link:hover .ip-icon { color: var(--ip-link); }

.ip-topbar {
    position: sticky;
    z-index: 5;
    top: var(--ip-shell-gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: var(--ip-topbar-height);
    margin: var(--ip-shell-gutter) clamp(15px, 2.5vw, 34px) 0;
    padding: 8px 12px;
    border: 1px solid var(--ip-border);
    border-radius: 17px;
    background: var(--ip-panel);
    box-shadow: 0 3px 16px rgb(36 38 59 / .035);
    color: var(--ip-text);
}

.ip-topbar-start, .ip-location { display: flex; align-items: center; min-width: 0; }
.ip-topbar-start { gap: 13px; }
.ip-location { gap: 9px; font-size: .82rem; }
.ip-shell .ip-location-home, .ip-location-separator { color: var(--ip-muted); }
.ip-shell .ip-location-home:hover { color: var(--ip-link); }
.ip-location-current { overflow: hidden; color: var(--ip-text); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }

.ip-shell .ip-icon-button, .ip-shell .ip-topbar-shortcut {
    display: inline-grid;
    width: 42px;
    min-height: 42px;
    padding: 0;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--ip-border);
    border-radius: 11px;
    background: var(--ip-sidebar);
    color: var(--ip-link);
    text-decoration: none;
    cursor: pointer;
    transition: color .18s ease, background-color .18s ease, border-color .18s ease;
}

.ip-shell .ip-icon-button:hover, .ip-shell .ip-topbar-shortcut:hover {
    border-color: var(--ip-lavender);
    background: var(--ip-lavender);
    color: var(--ip-link);
}

.ip-shell .ip-topbar-shortcut {
    display: inline-flex;
    justify-content: center;
    gap: 7px;
    width: auto;
    padding: 7px 11px;
    font: 600 .76rem/1.4 var(--ip-font);
    white-space: nowrap;
}

.ip-topbar-shortcut .ip-icon { width: 17px; height: 17px; }
.ip-shell .ip-nav-toggle, .ip-shell .ip-menu-close, .ip-toggle-mobile { display: none; }
.ip-shell[data-ip-ready] .ip-nav-toggle { display: inline-grid; }

.ip-sidebar-footer {
    position: relative;
    z-index: 1;
    padding: 9px 10px 10px;
    border-top: 1px solid var(--ip-border);
    flex: 0 0 auto;
}

.ip-account { position: relative; }
.ip-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    min-width: 0;
    padding: 7px 7px;
    border: 1px solid transparent;
    border-radius: 13px;
    color: var(--ip-text);
    list-style: none;
    cursor: pointer;
    transition: background-color .18s ease, border-color .18s ease;
}

.ip-profile:hover, .ip-account[open] .ip-profile {
    border-color: var(--ip-border);
    background: var(--ip-hover);
}

.ip-profile-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border: 1px solid color-mix(in srgb, var(--ip-primary) 16%, var(--ip-lavender));
    border-radius: 12px;
    background: var(--ip-lavender);
    color: var(--ip-link);
    font-size: .82rem;
    font-weight: 700;
}

.ip-profile-text { display: grid; gap: 3px; min-width: 0; line-height: 1.25; flex: 1 1 auto; }
.ip-profile-name { overflow: hidden; color: var(--ip-text); font-size: .78rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.ip-profile-role { color: var(--ip-muted); font-size: .68rem; white-space: nowrap; }
.ip-account-chevron { width: 15px; height: 15px; color: var(--ip-muted); transition: transform .18s ease; }
.ip-account[open] .ip-account-chevron { transform: rotate(180deg); }

.ip-account-menu {
    position: absolute;
    z-index: 2;
    inset: auto 0 calc(100% + 9px);
    min-width: 170px;
    padding: 5px;
    border: 1px solid var(--ip-border);
    border-radius: 12px;
    background: var(--ip-panel);
    box-shadow: 0 8px 24px rgb(36 38 59 / .09);
}

.ip-account:not([open]) .ip-account-menu { display: none; }
.ip-account[open] .ip-account-menu { animation: ip-account-in .16s ease-out; }

@keyframes ip-account-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.ip-shell .ip-account-action {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    padding: 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ip-text);
    font: 500 .78rem/1.4 var(--ip-font);
    text-align: start;
    text-decoration: none;
    cursor: pointer;
}

.ip-shell .ip-account-action:hover { background: var(--ip-hover); color: var(--ip-link); }
.ip-shell .ip-account-logout { color: #a33346; }
.ip-shell .ip-account-logout:hover { background: #fcecef; color: #8a2738; }
.ip-account-action .ip-icon { width: 16px; height: 16px; }
.ip-backdrop[hidden] { display: none; }

@media (min-width: 768px) {
    .ip-shell[data-sidebar-collapsed] { --ip-sidebar-width: calc(70px + var(--ip-shell-gutter)); }
    .ip-shell[data-sidebar-collapsed] .ip-sidebar-top { justify-content: center; margin: 0; }
    .ip-shell[data-sidebar-collapsed] .ip-nav { padding-inline: 8px; }
    .ip-shell[data-sidebar-collapsed] .ip-nav-group { margin-bottom: 8px; padding-bottom: 7px; border-bottom: 1px solid var(--ip-border); }
    .ip-shell[data-sidebar-collapsed] .ip-nav-group:last-child { border: 0; }
    .ip-shell[data-sidebar-collapsed] .ip-nav-link,
    .ip-shell[data-sidebar-collapsed] .ip-profile { justify-content: center; padding-inline: 0; }
    .ip-shell[data-sidebar-collapsed] :is(.ip-nav-heading, .ip-account-chevron) { display: none; }
    .ip-shell[data-sidebar-collapsed] :is(.ip-brand-wordmark, .ip-nav-text, .ip-profile-text) {
        position: absolute;
        clip-path: inset(50%);
        width: 1px;
        height: 1px;
        overflow: hidden;
        white-space: nowrap;
    }
    .ip-shell[data-sidebar-collapsed] .ip-account-menu { inset-inline: 0 auto; }
}

@media (max-width: 767px) {
    .ip-shell { display: block; --ip-topbar-height: 58px; }
    .ip-sidebar { position: static; height: auto; margin-inline: 12px; }
    .ip-topbar { min-height: 58px; margin-inline: 12px; padding: 6px 8px; }
    .ip-shell .ip-icon-button { width: 44px; min-height: 44px; }
    .ip-shell[data-ip-ready] .ip-sidebar {
        position: fixed;
        z-index: 20;
        inset: 8px auto 8px 8px;
        width: min(300px, calc(100% - 38px));
        height: auto;
        margin: 0;
        visibility: hidden;
        transform: translateX(calc(-100% - 8px));
        transition: transform .2s ease, visibility 0s linear .2s;
    }
    .ip-shell[data-menu-open] .ip-sidebar { visibility: visible; transform: translateX(0); transition-delay: 0s; }
    .ip-shell[data-ip-ready] .ip-menu-close { display: inline-grid; }
    .ip-shell .ip-nav-link, .ip-shell .ip-account-action { min-height: 44px; }
    .ip-toggle-desktop { display: none; }
    .ip-toggle-mobile { display: block; }
    .ip-backdrop { position: fixed; z-index: 15; inset: 0; background: rgb(29 25 51 / .34); }
    body:has(.ip-shell[data-menu-open]) { overflow: hidden; }
}

@media (max-width: 510px) {
    .ip-topbar { gap: 9px; }
    .ip-topbar-start { gap: 9px; }
    .ip-location-home, .ip-location-separator, .ip-topbar-shortcut span { display: none; }
    .ip-shell .ip-topbar-shortcut { width: 44px; min-height: 44px; padding: 0; }
}

@media (pointer: coarse) {
    .ip-nav-heading { min-height: 40px; }
    .ip-shell .ip-nav-link, .ip-shell .ip-account-action { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
    .ip-sidebar, .ip-sidebar *, .ip-topbar, .ip-topbar * { transition: none !important; }
    .ip-account[open] .ip-account-menu { animation: none; }
}
