/* Shared navigation; page-specific cards and actions retain their own styles. */
.topbar .sidebar-toggle { display: inline-flex; }
@media (min-width: 901px) {
    body.sidebar-desktop-collapsed .sidebar { display: none; }
}
.sidebar { --sidebar-width: 260px; width: var(--sidebar-width); flex-basis: var(--sidebar-width); }
.sidebar__header { position: relative; gap: .5rem; min-height: 80px; }
.sidebar__brand { justify-content: flex-start; text-align: start; min-width: 0; }
.sidebar__brand > div { min-width: 0; }
.sidebar__subtitle { font-size: .68rem; }
.sidebar__nav { gap: .8rem; padding: 1rem .75rem; }
.sidebar__section { gap: .2rem; padding-bottom: .8rem; border-bottom-color: var(--color-sidebar-border); }
.sidebar__section-title { margin: 0; padding: 0 .6rem .4rem; font-size: .74rem; }
.sidebar__link { justify-content: flex-start; min-height: 44px; padding: .6rem .7rem; font-size: .83rem; gap: .65rem; }
.sidebar__link span:nth-child(2) { white-space: normal; overflow: visible; overflow-wrap: anywhere; line-height: 1.65; }
.sidebar__link-icon { width: 1.5rem; height: 1.5rem; flex-basis: 1.5rem; border: 0; background: transparent; color: var(--color-primary); }
.sidebar__link.is-active { font-weight: 850; }
.sidebar__link.is-active::before { content: ""; position: absolute; inset-inline-start: 0; inset-block: .55rem; width: 3px; border-radius: 3px; background: var(--color-primary); }
.sidebar .project-icon, .topbar .project-icon { display: block; width: 1.2rem; height: 1.2rem; flex-shrink: 0; }
.sidebar-project { display: grid; gap: .2rem; margin: 0 .2rem .4rem; padding: .65rem; border: 1px solid var(--color-sidebar-border); border-radius: var(--radius-sm); background: var(--color-sidebar-active-bg); }
.sidebar-project__name { font-size: .85rem; font-weight: 750; line-height: 1.8; overflow-wrap: anywhere; }
.sidebar-project__switch { display: inline-flex; align-items: center; min-height: 44px; width: fit-content; font-size: .78rem; text-decoration: underline; text-underline-offset: .2em; }
.sidebar-close { display: none; flex-shrink: 0; }
.sidebar-backdrop[hidden], .account-panel[hidden] { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(1, 8, 20, .65); }
body.sidebar-is-open { overflow: hidden; }
.topbar { gap: .75rem; }
.topbar-context { display: grid; gap: .05rem; flex: 1 1 auto; min-width: 0; }
.topbar-context__label { color: var(--color-muted); font-size: .66rem; }
.topbar-context__name { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--color-text); font-size: .85rem; font-weight: 750; width: fit-content; max-width: 100%; }
.project-switcher { position: relative; min-width: 0; max-width: 38rem; }
.project-switcher__toggle { display: flex; align-items: center; gap: .75rem; max-width: 100%; min-height: 44px; padding: .35rem .6rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text); background: var(--color-surface); font: inherit; text-align: start; cursor: pointer; }
.project-switcher__heading { display: grid; min-width: 0; gap: .1rem; }
.project-switcher .topbar-context__name { white-space: normal; overflow: visible; overflow-wrap: anywhere; line-height: 1.6; }
.project-switcher__panel[hidden] { display: none; }
.project-switcher__panel { position: absolute; inset-inline-start: 0; top: calc(100% + .5rem); z-index: 25; width: min(32rem, calc(100vw - 2rem)); max-height: min(60dvh, 28rem); overflow-y: auto; padding: .35rem; background: var(--color-sidebar-bg); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.project-switcher__choice { display: block; min-height: 44px; padding: .65rem .75rem; border-radius: var(--radius-sm); color: var(--color-text); font-size: .85rem; line-height: 1.7; overflow-wrap: anywhere; }
.project-switcher__choice:hover, .project-switcher__choice[aria-current] { background: var(--color-sidebar-active-bg); text-decoration: none; }
.topbar:has(.project-switcher) { height: auto; padding-block: .4rem; }
.topbar-create { min-height: 44px; flex-shrink: 0; }
.topbar .icon-button { width: 44px; height: 44px; min-height: 44px; flex-shrink: 0; }
.account-menu { position: relative; flex-shrink: 0; max-width: 12rem; }
.account-toggle { display: flex; align-items: center; justify-content: center; gap: .45rem; width: 100%; min-height: 44px; padding: .4rem .55rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text); background: var(--color-surface); font: inherit; cursor: pointer; }
.account-toggle__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-size: .8rem; }
.account-toggle .topbar__avatar { color: var(--color-primary-contrast); background: var(--color-primary-action); border: 0; }
.account-panel { position: absolute; inset-inline-end: 0; top: calc(100% + .5rem); z-index: 25; width: min(18rem, calc(100vw - 2rem)); padding: .75rem; background: var(--color-sidebar-bg); color: var(--color-text); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.account-panel__label, .account-panel__name { display: block; }
.account-panel__label { color: var(--color-muted); font-size: .72rem; }
.account-panel__name { margin: .3rem 0 .7rem; overflow-wrap: anywhere; font-size: .85rem; }
.account-panel form { margin: 0; }
.account-logout { display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 44px; padding: .6rem; border: 0; border-top: 1px solid var(--color-border); background: transparent; color: var(--color-text); font: inherit; font-size: .85rem; text-align: start; cursor: pointer; }
.account-logout:hover, .account-toggle:hover { background: var(--color-sidebar-active-bg); }
.sidebar a:focus-visible, .sidebar button:focus-visible, .topbar a:focus-visible, .topbar button:focus-visible, .app-breadcrumb a:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; }
.app-breadcrumb { margin-bottom: 1rem; color: var(--color-muted); font-size: .76rem; }
.app-breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 0; list-style: none; padding: 0; margin: 0; }
.app-breadcrumb li { display: inline; min-width: 0; overflow-wrap: anywhere; }
.app-breadcrumb li + li::before { content: "/"; display: inline-block; margin: 0 .5rem; opacity: .6; }
.app-breadcrumb a { color: inherit; text-decoration: underline; text-underline-offset: .2em; }
.app-breadcrumb [aria-current] { color: var(--color-text); }
@media (max-width: 900px) {
    .sidebar { width: min(320px, calc(100vw - 3rem)); max-width: 100%; height: 100dvh; visibility: hidden; overscroll-behavior: contain; }
    body.sidebar-is-open .sidebar { visibility: visible; }
    .sidebar__header { padding-inline-end: 3.7rem; }
    .sidebar-close { display: inline-flex; position: absolute; inset-inline-end: .6rem; top: 1rem; width: 44px; height: 44px; color: var(--color-text); background: var(--color-sidebar-active-bg); }
    .topbar { gap: .5rem; }
}
@media (max-width: 600px) {
    .topbar { padding-inline: .6rem; gap: .35rem; }
    .topbar-create { padding: .4rem .5rem; gap: .25rem; font-size: .7rem; }
    .topbar-create .project-icon { width: 1rem; height: 1rem; }
    .account-toggle { padding: .3rem; width: 44px; }
    .account-toggle__name, .account-toggle > .project-icon { display: none; }
    .topbar-context__name { font-size: .74rem; }
    .topbar-context__label { font-size: .6rem; }
    .topbar:has(.project-switcher) { flex-wrap: wrap; }
    .topbar:has(.project-switcher) .topbar-context { order: 5; flex-basis: 100%; }
    .project-switcher { max-width: 100%; }
    .project-switcher__toggle { width: 100%; justify-content: space-between; }
    .topbar:has(.project-switcher) .topbar-create { margin-inline-start: auto; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
