/*
 * App shell — GitLab-like inset stage:
 * canvas behind everything, sidebar on the rail, rounded body panel.
 */
:root {
    --app-sidebar-width: 222px;
    --app-sidebar-collapsed-width: 64px;
    --app-shell-gap: 12px;
    --app-shell-radius: 12px;
    --app-shell-canvas: #0b0b0f;
    --app-sidebar-bg: transparent;
    --app-sidebar-fg: #bcbccb;
    --app-sidebar-fg-strong: #fff;
    --app-sidebar-muted: #838394;
    --app-sidebar-hover: rgba(255, 255, 255, 0.06);
    --app-sidebar-line: rgba(255, 255, 255, 0.1);
    --app-sidebar-active-bg: #e8e1f6;
    --app-sidebar-active-fg: #443865;
    --app-sidebar-staff: #e59cc4;
    --app-stage-bg: var(--color-surface, #ffffff);
}

html:not([data-color-scheme="dark"]) {
    --app-shell-canvas: #f8f9fb;
    --app-sidebar-fg: #4a4b57;
    --app-sidebar-fg-strong: #1c1c24;
    --app-sidebar-muted: #81838f;
    --app-sidebar-hover: rgba(20, 20, 30, 0.06);
    --app-sidebar-line: rgba(20, 20, 30, 0.1);
    --app-sidebar-active-bg: #eee9fa;
    --app-sidebar-active-fg: #443865;
}

[data-color-scheme="dark"] {
    --app-shell-canvas: #121214;
    --app-stage-bg: var(--color-surface, #1a1b1d);
    --app-sidebar-fg: #c4c4cf;
    --app-sidebar-muted: #8b8b98;
    --app-sidebar-hover: rgba(255, 255, 255, 0.07);
    --app-sidebar-line: rgba(255, 255, 255, 0.1);
    --app-sidebar-active-bg: #e8e1f6;
    --app-sidebar-active-fg: #443865;
}

/* Flat canvas behind the inset stage (GitLab-style frame) */
body:has(.app-container--shell) {
    background-color: var(--app-shell-canvas);
    background-image: none;
}

/* No full-page grain on shell — left rail stays clean */
body:has(.app-container--shell)::before {
    opacity: 0;
}

.app-container--shell {
    position: relative;
    z-index: 1;
    min-height: calc(100vh / var(--ui-zoom, 1));
    padding: 0;
    background: var(--app-shell-canvas);
}

.app-container--shell.is-sidebar-collapsed {
    --app-sidebar-width: var(--app-sidebar-collapsed-width);
}

/*
 * Ambient glow lives on the canvas only (behind stage + sidebar).
 * Top-right + bottom-right; grain masked to those same blobs.
 */
.app-shell-glow {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 56% 50% at 100% 0%,
            color-mix(in srgb, var(--color-primary, #b7a5eb) 16%, transparent) 0%,
            color-mix(in srgb, var(--color-primary, #b7a5eb) 9%, transparent) 28%,
            color-mix(in srgb, var(--color-primary, #b7a5eb) 3%, transparent) 35%,
            transparent 78%),
        radial-gradient(ellipse 50% 44% at 100% 100%,
            color-mix(in srgb, var(--color-team, #14b8a6) 10%, transparent) 0%,
            color-mix(in srgb, var(--color-team, #14b8a6) 4%, transparent) 30%,
            transparent 72%);
}

.app-shell-glow::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.28;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 1920 1080' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 960px 540px;
    -webkit-mask-image:
        radial-gradient(ellipse 56% 50% at 100% 0%, #000 0%, rgba(0, 0, 0, 0.55) 28%, rgba(0, 0, 0, 0.18) 55%, transparent 78%),
        radial-gradient(ellipse 50% 44% at 100% 100%, #000 0%, rgba(0, 0, 0, 0.4) 40%, transparent 72%);
    mask-image:
        radial-gradient(ellipse 56% 50% at 100% 0%, #000 0%, rgba(0, 0, 0, 0.55) 28%, rgba(0, 0, 0, 0.18) 55%, transparent 78%),
        radial-gradient(ellipse 50% 44% at 100% 100%, #000 0%, rgba(0, 0, 0, 0.4) 40%, transparent 72%);
    -webkit-mask-composite: source-over;
    mask-composite: add;
}

/* Column to the right of the sidebar: global topbar + inset stage */
.app-shell-main {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: calc(100vh / var(--ui-zoom, 1));
    margin-left: calc(var(--app-sidebar-width) + var(--app-shell-gap));
    padding: 0 var(--app-shell-gap) var(--app-shell-gap);
    box-sizing: border-box;
    transition: margin-left 0.18s ease;
}

/* Global chrome outside the rounded content card — static, scrolls away with page */
.header.app-global-topbar {
    position: static;
    top: auto;
    z-index: 2;
    flex-shrink: 0;
    padding: 0;
    background: transparent;
    border-bottom: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    isolation: auto;
}

.app-global-topbar.is-notif-open {
    z-index: 13000;
}

.app-global-topbar__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: var(--spacing-4);
    min-height: 52px;
    padding: 6px 4px 10px;
    box-sizing: border-box;
}

.app-global-topbar .app-topbar__menu {
    grid-column: 1;
    justify-self: start;
}

/* Dynamic Island: search pill ↔ flash toast */
.app-global-topbar .app-island {
    grid-column: 2;
    justify-self: center;
    width: min(520px, 52vw);
    max-width: 100%;
    z-index: 3;
    transition: width 0.48s cubic-bezier(0.32, 0.72, 0, 1);
}

.app-island__pill {
    position: relative;
    display: grid;
    grid-template-areas: 'island';
    align-items: center;
    width: 100%;
    min-height: 34px;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--color-border) 80%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-surface) 88%, transparent);
    color: var(--color-muted-foreground);
    box-shadow: none;
    overflow: hidden;
    transition:
        min-height 0.36s cubic-bezier(0.32, 0.72, 0, 1),
        background-color 0.34s ease,
        border-color 0.34s ease,
        color 0.28s ease,
        box-shadow 0.34s ease;
}

[data-color-scheme="dark"] .app-island__pill {
    border-color: color-mix(in srgb, var(--color-border) 55%, transparent);
    background: color-mix(in srgb, var(--color-background) 75%, transparent);
}

.app-island__face {
    grid-area: island;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 34px;
    padding: 0 14px;
    box-sizing: border-box;
    font-size: 12px;
    line-height: 1.25;
    transition:
        opacity 0.28s ease,
        transform 0.36s cubic-bezier(0.32, 0.72, 0, 1),
        filter 0.28s ease;
}

.app-island__face--search {
    cursor: default;
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.app-island__face--search .app-nav-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.75;
}

.app-island__face--search kbd {
    margin-left: auto;
    padding: 1px 6px;
    border: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
    border-radius: 5px;
    background: color-mix(in srgb, var(--color-muted) 80%, transparent);
    color: var(--color-muted-foreground);
    font-family: inherit;
    font-size: 10px;
    letter-spacing: 0.02em;
}

[data-color-scheme="dark"] .app-island__face--search kbd {
    background: color-mix(in srgb, #1a1a22 80%, transparent);
}

.app-island__face--toast {
    opacity: 0;
    transform: scale(0.92);
    filter: blur(4px);
    pointer-events: none;
    gap: 8px;
    color: #fff;
    font-weight: 500;
}

.app-island__toast-glyph {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    position: relative;
}

.app-island__toast-glyph::before {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 8px;
    height: 8px;
    background: no-repeat center / contain;
}

.app-island[data-level="success"] .app-island__toast-glyph::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 6.2 4.8 8.8 9.8 3.2' fill='none' stroke='%23fff' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.app-island[data-level="error"] .app-island__toast-glyph::before,
.app-island[data-level="danger"] .app-island__toast-glyph::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 2.2l7.6 7.6M9.8 2.2 2.2 9.8' fill='none' stroke='%23fff' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E");
}

.app-island[data-level="warning"] .app-island__toast-glyph::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 2.4 10.4 10H1.6L6 2.4Z' fill='none' stroke='%23fff' stroke-width='1.4' stroke-linejoin='round'/%3E%3Cpath d='M6 5v2.4M6 8.6h.01' stroke='%23fff' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.app-island[data-level="info"] .app-island__toast-glyph::before,
.app-island[data-level="debug"] .app-island__toast-glyph::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='4.2' fill='none' stroke='%23fff' stroke-width='1.4'/%3E%3Cpath d='M6 5.2V8.4M6 3.8h.01' stroke='%23fff' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.app-island__toast-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-island__toast-dismiss {
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.app-island__toast-dismiss::before {
    content: '';
    position: absolute;
    inset: 0px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    transition: background 0.15s ease;
}

.app-island__toast-dismiss:hover::before {
    background: rgba(255, 255, 255, 0.22);
}

.app-island__toast-dismiss-x {
    position: relative;
    z-index: 1;
}

.app-island__toast-timer {
    position: absolute;
    inset: 0;
    width: 24px;
    height: 24px;
    transform: rotate(-90deg);
    pointer-events: none;
}

.app-island__toast-timer .message-timer-track {
    stroke: rgba(255, 255, 255, 0.28);
    stroke-width: 2;
}

.app-island__toast-timer .message-timer-progress {
    stroke: rgba(255, 255, 255, 0.95);
    stroke-width: 2;
    stroke-linecap: round;
}

/* Toast expanded state — width set inline by JS (80% of free header width) */
.app-island[data-state="toast"] {
    width: var(--app-island-toast-width, min(520px, 52vw));
}

.app-island[data-state="toast"] .app-island__pill {
    min-height: 38px;
    color: #fff;
    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.18),
        0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.app-island[data-state="toast"] .app-island__face--search {
    opacity: 0;
    transform: scale(0.94);
    filter: blur(3px);
    pointer-events: none;
}

.app-island[data-state="toast"] .app-island__face--toast {
    opacity: 1;
    transform: scale(1);
    filter: none;
    pointer-events: auto;
    min-height: 38px;
    padding-inline: 12px 10px;
}

.app-island[data-state="toast"][data-level="success"] .app-island__pill {
    background: linear-gradient(135deg, #1f9d63 0%, #178a55 100%);
    border-color: transparent;
}

.app-island[data-state="toast"][data-level="error"] .app-island__pill,
.app-island[data-state="toast"][data-level="danger"] .app-island__pill {
    background: linear-gradient(135deg, #d64545 0%, #c0392b 100%);
    border-color: transparent;
}

.app-island[data-state="toast"][data-level="warning"] .app-island__pill {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    border-color: transparent;
}

.app-island[data-state="toast"][data-level="info"] .app-island__pill,
.app-island[data-state="toast"][data-level="debug"] .app-island__pill {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: transparent;
}

.app-island[data-state="collapsing"] {
    transition-duration: 0.28s;
}

.app-island[data-state="collapsing"] .app-island__pill {
    transition-duration: 0.22s, 0.22s, 0.22s, 0.18s, 0.22s;
}

.app-island[data-state="collapsing"] .app-island__face {
    transition-duration: 0.18s, 0.22s, 0.18s;
}

/* Desktop shell: island owns flashes; keep #messages-container only as OOB sink */
@media (min-width: 901px) {
    .app-container--shell .header-messages {
        visibility: hidden;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-global-topbar .app-island,
    .app-island__pill,
    .app-island__face {
        transition: none !important;
    }
}

.app-global-topbar .header-actions {
    grid-column: 3;
    justify-self: end;
    gap: 8px;
}

/* Inset rounded body: above the canvas glow */
.app-stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    min-height: 0;
    border-radius: var(--app-shell-radius);
    background: var(--app-stage-bg);
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--color-foreground, #000) 6%, transparent),
        0 8px 28px rgba(29, 28, 49, 0.06);
    overflow: clip;
}

[data-color-scheme="dark"] .app-stage {
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--color-foreground) 6%, transparent),
        0 8px 28px rgba(0, 0, 0, 0.18);
}

.app-stage--auth {
    margin: var(--app-shell-gap);
    min-height: calc(100vh / var(--ui-zoom, 1) - (2 * var(--app-shell-gap)));
}

.app-stage__crumbs {
    flex-shrink: 0;
    padding: 14px var(--spacing-6) 0;
}

.app-container--shell .header-messages {
    position: static;
    left: auto;
    right: auto;
    width: auto;
}

body:has(.app-container--shell) .app-loading-bar {
    left: calc(50% + var(--app-sidebar-width) / 2);
}

/* Sidebar rail on the canvas */
.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 200;
    width: var(--app-sidebar-width);
    height: calc(100vh / var(--ui-zoom, 1));
    display: flex;
    flex-direction: column;
    padding: 18px 10px 10px;
    background: var(--app-sidebar-bg);
    color: var(--app-sidebar-fg);
    box-sizing: border-box;
    transition: width 0.18s ease;
}

.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 13px;
    color: #f4f3f8;
    font-size: 25px;
    font-weight: 650;
    letter-spacing: -1.1px;
    text-decoration: none;
}

html:not([data-color-scheme="dark"]) .app-sidebar__brand {
    color: #1c1c24;
}

.app-sidebar__brand-mark {
    width: 27px;
    height: 29px;
    color: #b7a5eb;
}

.app-sidebar__brand-dot {
    color: #a99ac0;
}

.app-sidebar__workspace {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 5px 0 23px 50px;
    font-size: 11px;
    color: #a2a0b5;
}

.app-sidebar__workspace-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #a5c8ac;
}

.app-sidebar__search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 8px 10px;
    border: 1px solid #454553;
    border-radius: 8px;
    font-size: 11px;
    color: var(--app-sidebar-muted);
    cursor: default;
    opacity: 0.6;
}

.app-sidebar__search kbd {
    margin-left: auto;
    padding: 0 4px;
    border: 1px solid #494957;
    border-radius: 3px;
    background: #363743;
    color: #a7a7b9;
    font-family: inherit;
    font-size: 10px;
}

.app-sidebar__scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    scrollbar-width: none;
}

.app-nav-label {
    margin: 17px 0 7px;
    padding: 0 12px;
    font-size: 9px;
    font-weight: 650;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--app-sidebar-muted);
}

.app-nav-label:first-child {
    margin-top: 0;
}

.app-nav-label--staff {
    color: var(--app-sidebar-staff);
}

.app-nav-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 37px;
    margin: 2px 0;
    padding: 9px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 450;
    color: var(--app-sidebar-fg);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    box-sizing: border-box;
}

a.app-nav-item:hover {
    background: var(--app-sidebar-hover);
    color: var(--app-sidebar-fg-strong);
}

.app-nav-item.is-active,
.app-nav-item.is-active:hover {
    background: var(--app-sidebar-active-bg);
    color: var(--app-sidebar-active-fg);
    font-weight: 650;
}

.app-nav-item--soon {
    color: var(--app-sidebar-muted);
    opacity: 0.55;
    cursor: default;
}

/* Collapsible nav group (Operations) — GitLab-style */
.app-nav-group {
    margin: 2px 0;
}

.app-nav-group__toggle {
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.app-nav-group__toggle:hover {
    background: var(--app-sidebar-hover);
    color: var(--app-sidebar-fg-strong);
}

.app-nav-group__chevron {
    margin-left: auto;
    display: inline-flex;
    opacity: 0.55;
    transition: transform 0.15s ease;
}

.app-nav-group__chevron .app-nav-icon {
    width: 12px;
    height: 12px;
}

.app-nav-group.is-open > .app-nav-group__toggle .app-nav-group__chevron {
    transform: rotate(90deg);
}

.app-nav-group__panel {
    display: flex;
    flex-direction: column;
    padding: 2px 0 6px;
}

.app-nav-item--child {
    min-height: 32px;
    margin: 1px 0;
    padding: 7px 12px 7px 40px;
    font-size: 12px;
    font-weight: 450;
}

.app-sidebar--collapsed .app-nav-group__panel,
.app-sidebar--collapsed .app-nav-group__chevron,
html.app-sidebar-collapsed-pending .app-nav-group__panel,
html.app-sidebar-collapsed-pending .app-nav-group__chevron {
    display: none;
}

/* Profile card under the brand — opens the Account page */
.app-sidebar__profile {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 18px 0 14px;
    padding: 9px 10px;
    border: 1px solid var(--app-sidebar-line);
    border-radius: 10px;
    background: var(--app-sidebar-hover);
    color: #e5e4ed;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

html:not([data-color-scheme="dark"]) .app-sidebar__profile:not(.is-active) {
    color: var(--app-sidebar-fg-strong);
}

.app-sidebar__profile:hover {
    border-color: #5a5a6c;
}

.app-sidebar__profile.is-active {
    border-color: transparent;
    background: var(--app-sidebar-active-bg);
    color: var(--app-sidebar-active-fg);
}

.app-sidebar__profile > .app-nav-icon {
    width: 13px;
    height: 13px;
    opacity: 0.6;
}

.app-sidebar__identity {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1;
    min-width: 0;
}

.app-sidebar__identity-text {
    min-width: 0;
}

.app-sidebar__identity-text strong,
.app-sidebar__identity-text small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar__identity-text strong {
    font-size: 12px;
    font-weight: 600;
}

.app-sidebar__identity-text small {
    font-size: 10px;
    opacity: 0.7;
}

.app-sidebar__footer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 10px;
    padding-top: 0;
    border-top: 0;
}

.app-sidebar__footer .app-nav-item {
    width: 100%;
    margin: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.app-sidebar__footer .app-nav-item:hover {
    background: var(--app-sidebar-hover);
    color: var(--app-sidebar-fg-strong);
}

.app-sidebar__collapse-label,
.app-sidebar__expand-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar__expand-label,
.app-sidebar__expand-icon {
    display: none;
}

.app-sidebar__version {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding: 10px 12px 2px;
    border-top: 1px solid var(--app-sidebar-line);
    font-size: 9px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--app-sidebar-muted);
}

/* Collapsed icon rail */
.app-sidebar--collapsed {
    padding-inline: 8px;
}

.app-sidebar--collapsed .app-sidebar__brand span,
.app-sidebar--collapsed .app-nav-label,
.app-sidebar--collapsed .app-nav-item > span:not(.app-sidebar__collapse-icon):not(.app-sidebar__expand-icon),
.app-sidebar--collapsed .app-sidebar__identity-text,
.app-sidebar--collapsed .app-sidebar__profile > .app-nav-icon,
.app-sidebar--collapsed .app-sidebar__version,
.app-sidebar--collapsed .app-sidebar__collapse-label,
.app-sidebar--collapsed .app-sidebar__collapse-icon {
    display: none;
}

.app-sidebar--collapsed .app-sidebar__expand-icon {
    display: inline-flex;
}

.app-sidebar--collapsed .app-sidebar__brand {
    justify-content: center;
    padding: 0;
}

.app-sidebar--collapsed .app-sidebar__profile {
    justify-content: center;
    padding: 8px;
}

.app-sidebar--collapsed .app-nav-item {
    justify-content: center;
    padding-inline: 0;
}

.app-sidebar--collapsed .app-sidebar__footer .app-nav-item {
    justify-content: center;
}

/* Avoid FOUC when localStorage prefers collapsed rail */
html.app-sidebar-collapsed-pending .app-container--shell {
    --app-sidebar-width: var(--app-sidebar-collapsed-width);
}

html.app-sidebar-collapsed-pending .app-sidebar__brand span,
html.app-sidebar-collapsed-pending .app-nav-label,
html.app-sidebar-collapsed-pending .app-nav-item > span:not(.app-sidebar__collapse-icon):not(.app-sidebar__expand-icon),
html.app-sidebar-collapsed-pending .app-sidebar__identity-text,
html.app-sidebar-collapsed-pending .app-sidebar__profile > .app-nav-icon,
html.app-sidebar-collapsed-pending .app-sidebar__version,
html.app-sidebar-collapsed-pending .app-sidebar__collapse-label,
html.app-sidebar-collapsed-pending .app-sidebar__collapse-icon {
    display: none;
}

html.app-sidebar-collapsed-pending .app-sidebar__expand-icon {
    display: inline-flex;
}

/* Operations sub-navigation */
.section-tabs {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: var(--page-stack-gap);
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
    scrollbar-width: none;
}

.section-tab {
    margin-bottom: -1px;
    padding: 12px 0;
    border-bottom: 2px solid transparent;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-muted-foreground);
    text-decoration: none;
    white-space: nowrap;
}

.section-tab:hover {
    color: var(--color-foreground);
}

.section-tab.is-active {
    border-bottom-color: var(--color-primary);
    color: var(--color-primary);
}

/* Account page */
.panel {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
}

.account-profile {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: var(--page-stack-gap);
    padding: 21px;
}

.account-profile__avatar {
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}

.account-profile__info {
    flex: 1;
    min-width: 0;
}

.account-profile__name {
    margin: 0;
    font-size: var(--font-size-xl);
    font-weight: 650;
}

.account-profile__email {
    margin: 2px 0 8px;
    font-size: var(--font-size-sm);
    color: var(--color-muted-foreground);
}

.account-profile__roles,
.account-profile__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--page-stack-gap);
    align-items: start;
}

.account-panel {
    padding: 8px 21px;
}

.account-panel__title {
    margin: 0;
    padding: 13px 0;
    font-size: var(--font-size-lg);
    font-weight: 650;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 0;
    border-top: 1px solid var(--color-divider);
}

.settings-row--stacked {
    display: block;
}

.settings-row__head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.settings-row__label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.settings-row__value {
    font-size: var(--font-size-sm);
    color: var(--color-muted-foreground);
}

@media (max-width: 767px) {
    .settings-row--desktop {
        display: none;
    }
}

.app-topbar__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--color-muted-foreground);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.app-topbar__icon-btn:hover {
    background: color-mix(in srgb, var(--color-muted, #333) 55%, transparent);
    color: var(--color-foreground);
}

.app-topbar__icon-btn .app-nav-icon {
    width: 16px;
    height: 16px;
}

.app-container--shell .main {
    flex: 1;
    min-height: 0;
}

.app-container--shell .main > .container {
    padding-top: var(--spacing-4);
    padding-bottom: var(--spacing-6);
}

.app-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 12px;
    color: var(--color-muted-foreground);
}

.app-breadcrumbs__mark {
    width: 16px;
    height: 17px;
    flex-shrink: 0;
    color: #e8e1f6;
}

.app-breadcrumbs__trail {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.app-breadcrumbs__slash {
    color: color-mix(in srgb, var(--color-muted-foreground) 45%, transparent);
}

.app-breadcrumbs__current {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 550;
    color: var(--color-foreground);
}

.app-topbar__brand {
    font-size: 21px;
    font-weight: 650;
    letter-spacing: -0.8px;
}

.app-topbar__menu {
    display: none;
    align-items: center;
    justify-content: center;
    width: 33px;
    height: 33px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--color-muted-foreground);
    cursor: pointer;
}

.app-topbar__menu:hover {
    background: var(--color-secondary);
    color: var(--color-foreground);
}

.app-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(20, 20, 30, 0.35);
}

/* Narrow screens: sidebar becomes an off-canvas drawer */
@media (max-width: 900px) {
    .app-container--shell,
    .app-container--shell.is-sidebar-collapsed,
    html.app-sidebar-collapsed-pending .app-container--shell {
        --app-sidebar-width: 222px;
    }

    .app-shell-main {
        margin-left: 0;
        padding: 0 var(--app-shell-gap) var(--app-shell-gap);
    }

    .app-stage {
        margin: 0;
    }

    /* Drawer always shows full labels; collapse is desktop-only */
    .app-sidebar--collapsed,
    html.app-sidebar-collapsed-pending .app-sidebar {
        padding-inline: 10px;
    }

    .app-sidebar--collapsed .app-sidebar__brand span,
    .app-sidebar--collapsed .app-nav-label,
    .app-sidebar--collapsed .app-nav-item > span:not(.app-sidebar__expand-icon):not(.app-sidebar__expand-label),
    .app-sidebar--collapsed .app-sidebar__identity-text,
    .app-sidebar--collapsed .app-sidebar__profile > .app-nav-icon,
    .app-sidebar--collapsed .app-sidebar__version,
    .app-sidebar--collapsed .app-sidebar__collapse-label,
    .app-sidebar--collapsed .app-sidebar__collapse-icon,
    html.app-sidebar-collapsed-pending .app-sidebar__brand span,
    html.app-sidebar-collapsed-pending .app-nav-label,
    html.app-sidebar-collapsed-pending .app-nav-item > span:not(.app-sidebar__expand-icon):not(.app-sidebar__expand-label),
    html.app-sidebar-collapsed-pending .app-sidebar__identity-text,
    html.app-sidebar-collapsed-pending .app-sidebar__profile > .app-nav-icon,
    html.app-sidebar-collapsed-pending .app-sidebar__version,
    html.app-sidebar-collapsed-pending .app-sidebar__collapse-label,
    html.app-sidebar-collapsed-pending .app-sidebar__collapse-icon {
        display: unset;
    }

    .app-sidebar--collapsed .app-sidebar__expand-icon,
    .app-sidebar--collapsed .app-sidebar__expand-label,
    html.app-sidebar-collapsed-pending .app-sidebar__expand-icon,
    html.app-sidebar-collapsed-pending .app-sidebar__expand-label {
        display: none;
    }

    .app-sidebar--collapsed .app-sidebar__brand,
    .app-sidebar--collapsed .app-sidebar__profile,
    .app-sidebar--collapsed .app-nav-item,
    .app-sidebar--collapsed .app-sidebar__footer .app-nav-item {
        justify-content: unset;
        padding-inline: unset;
    }

    .app-sidebar--collapsed .app-sidebar__brand {
        padding: 0 13px;
    }

    .app-sidebar--collapsed .app-sidebar__profile {
        padding: 9px 10px;
    }

    .app-sidebar--collapsed .app-nav-item {
        padding: 9px 12px;
    }

    body:has(.app-container--shell) .app-loading-bar {
        left: 50%;
    }

    .app-sidebar {
        background: #15141d;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    html:not([data-color-scheme="dark"]) .app-sidebar {
        background: #ececf1;
    }

    .app-sidebar.is-open {
        transform: none;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    }

    .app-sidebar__collapse {
        display: none;
    }

    .app-topbar__menu {
        display: inline-flex;
    }

    .app-global-topbar__inner {
        grid-template-columns: auto auto;
        padding-inline: 4px;
    }

    .app-global-topbar .app-island {
        display: none;
    }

    .app-global-topbar .header-actions {
        grid-column: 2;
        justify-self: end;
        margin-left: auto;
    }

    .app-stage__crumbs {
        padding-inline: var(--spacing-4);
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-sidebar {
        transition: none;
    }
}
