.platform-auth-gate {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.96);
    color: var(--ui-ink, #171717);
    font-family: var(--ds-typography-font-family-main, Manrope, sans-serif);
}

.platform-auth-gate__panel {
    width: min(560px, calc(100vw - 32px));
    padding: calc(24px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1));
    border: 1px solid #dedede;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
}

.platform-auth-gate__title {
    margin: 0 0 calc(10px * var(--ui-space-scale, 1) * var(--ui-margin-scale, 1));
    font-size: calc(24px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
    font-weight: clamp(100, calc(700 + var(--ui-weight-offset, 0)), 900);
}

.platform-auth-gate__text {
    margin: 0 0 calc(16px * var(--ui-space-scale, 1) * var(--ui-margin-scale, 1));
    color: var(--ui-ink, #595959);
    font-size: calc(16px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
    line-height: calc(1.45 * var(--ui-leading-scale, 1));
}

.platform-auth-gate__detail {
    padding: calc(10px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1));
    border: 1px solid #dedede;
    border-radius: 8px;
    background: #f5f5f5;
    color: var(--ui-muted, #595959);
    font: clamp(100, calc(400 + var(--ui-weight-offset, 0)), 900) calc(13px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px))/calc(1.4 * var(--ui-leading-scale, 1)) ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    overflow-wrap: normal;
}

.platform-auth-gate__actions {
    display: flex;
    flex-wrap: wrap;
    gap: calc(10px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1));
    margin-top: calc(18px * var(--ui-space-scale, 1) * var(--ui-margin-scale, 1));
}

.platform-auth-gate__btn {
    padding: calc(10px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1)) calc(14px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1));
    border: 1px solid #dedede;
    border-radius: 8px;
    appearance: none;
    background: #fff;
    color: var(--ui-ink, #171717);
    cursor: pointer;
    font: inherit;
    text-decoration: none;
}

.platform-auth-gate__btn--primary {
    border-color: #202020;
    background: #202020;
    color: var(--ui-on-action, #fff);
}

.platform-auth-gate__bar {
    height: 4px;
    margin-top: calc(16px * var(--ui-space-scale, 1) * var(--ui-margin-scale, 1));
    overflow: hidden;
    border-radius: 999px;
    background: #ededed;
}

.platform-auth-gate__bar::before {
    display: block;
    width: 40%;
    height: 100%;
    animation: platform-auth-gate-progress 1.1s ease-in-out infinite;
    background: #202020;
    content: "";
}

@keyframes platform-auth-gate-progress {
    0% { transform: translateX(-110%); }
    100% { transform: translateX(260%); }
}

/*
 * The canonical shell is a light DS surface even when its host workbench uses
 * a dark foreground. Keep inherited shell copy on the DS text token without
 * changing the surrounding application palette.
 */
#platform-shell-root {
    color: var(--ds-text-primary, #171717);
}

#ps-account-menu {
    box-sizing: border-box;
    min-width: 300px;
    max-width: min(360px, calc(100vw - 24px));
    max-height: min(72vh, 600px);
    padding: calc(8px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1)) 0;
    overflow-x: hidden;
    overflow-y: auto;
}

#ps-account-btn.ps-account-btn--support {
    position: relative;
    border: 1px solid #595959;
    background: #f1f1f1;
    color: #202020;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.12);
}

#ps-account-btn.ps-account-btn--support::after {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 7px;
    height: 7px;
    border: 1px solid var(--ds-color-surface, #fff);
    border-radius: 999px;
    background: #595959;
    content: "";
}

#ps-account-btn.ps-account-btn--support-write {
    border-color: #d8872f;
    background: #fff1df;
    color: #934c00;
    box-shadow: 0 0 0 2px rgba(216, 135, 47, 0.16);
}

#ps-account-btn.ps-account-btn--support-write::after {
    background: #d66f00;
}

#ps-account-btn.ps-account-btn--support-stale {
    border-color: #cf4b43;
    background: #fff0ef;
    color: #a22924;
    box-shadow: 0 0 0 2px rgba(207, 75, 67, 0.16);
}

#ps-account-btn.ps-account-btn--support-stale::after {
    background: #cf4b43;
}

#ps-account-btn.ps-account-btn--support:hover,
#ps-account-btn.ps-account-btn--support:focus-visible {
    filter: saturate(1.12) brightness(0.98);
}

.ps-account-support-status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: calc(-1px * var(--ui-space-scale, 1) * var(--ui-margin-scale, 1));
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#ps-account-menu .ds-dropdown-item {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: calc(10px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1)) calc(16px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1));
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
    font: inherit;
    line-height: calc(1.3 * var(--ui-leading-scale, 1));
    text-align: left;
    text-decoration: none;
    white-space: normal;
}

#ps-account-menu .ds-dropdown-item:hover,
#ps-account-menu .ps-account-result:hover {
    background: var(--ds-color-surface-hover, #ebebeb);
}

#ps-account-menu .ds-dropdown-group {
    padding: calc(8px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1)) calc(16px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1));
}

#ps-account-menu .ds-dropdown-group-title {
    margin-bottom: calc(4px * var(--ui-space-scale, 1) * var(--ui-margin-scale, 1));
    color: var(--ds-color-text-muted, #595959);
    font-size: calc(12px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

#ps-account-menu .ps-account-email {
    overflow-wrap: normal;
}

#ps-account-menu .ps-account-context-card {
    display: grid;
    gap: calc(8px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1));
    padding: calc(10px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1));
    border: 1px solid var(--ds-color-border, #dedede);
    border-radius: 8px;
    background: var(--ds-color-surface-muted, #f5f5f5);
}

#ps-account-menu .ps-account-kv {
    display: grid;
    gap: calc(2px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1));
}

#ps-account-menu .ps-account-kv span,
#ps-account-menu .ps-account-context-hint {
    color: var(--ds-color-text-muted, #595959);
    font-size: calc(12px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
}

#ps-account-menu .ps-account-kv strong,
#ps-account-menu .ps-account-result strong {
    overflow-wrap: normal;
    font-size: calc(14px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
    line-height: calc(1.3 * var(--ui-leading-scale, 1));
}

#ps-account-menu .ps-account-note {
    color: var(--ds-color-text-muted, #595959);
    font-size: calc(13px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
    line-height: calc(1.4 * var(--ui-leading-scale, 1));
}

#ps-account-menu .ps-account-result {
    display: block;
    width: 100%;
    margin-top: calc(6px * var(--ui-space-scale, 1) * var(--ui-margin-scale, 1));
    padding: calc(10px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1));
    border: 1px solid var(--ds-color-border, #dedede);
    border-radius: 8px;
    background: var(--ds-color-surface, #fff);
    cursor: pointer;
    text-align: left;
}

#ps-account-menu .ps-account-result strong,
#ps-account-menu .ps-account-result span {
    display: block;
}

#ps-account-menu .ps-account-result span {
    margin-top: calc(2px * var(--ui-space-scale, 1) * var(--ui-margin-scale, 1));
    color: var(--ds-color-text-muted, #595959);
    font-size: calc(12px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
}

#ps-account-menu .ps-account-form {
    display: grid;
    gap: calc(8px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1));
}

#ps-account-menu #ps-account-scope-mount .sfs-root,
#ps-account-menu #ps-account-scope-mount .ds-input {
    width: 100%;
    max-width: 100%;
}

#ps-account-menu .ds-dropdown-divider {
    margin: calc(6px * var(--ui-space-scale, 1) * var(--ui-margin-scale, 1)) 0;
    border: 0;
    border-top: 1px solid var(--ds-color-border, #dedede);
}

.ps-balance-link {
    text-decoration: none;
}

/* Shared shell and portalled Landing menus use the platform type and neutral palette. */
#platform-shell-root.ps-shell, .ps-menu-panel {
    --landing-primary-color: var(--ui-ink, #171717);
    --ds-surface-primary: #fff; --ds-surface-secondary: #f1f1f1;
    --ds-text-primary: #171717; --ds-text-secondary: #595959; --ds-text-tertiary: #595959;
    --ds-border-color-default: #dedede; --ds-shadow-lg: 0 8px 24px #00000014;
    --ds-color-surface: #fff; --ds-color-surface-hover: #ebebeb; --ds-color-surface-muted: #f1f1f1;
    --ds-color-text-muted: #595959; --ds-color-border: #dedede;
    --ds-focus-outline-color: #202020; --ds-border-focus: #202020; --ui-focus: #202020;
    color: var(--ds-text-primary); background: #fff;
    font-family: var(--ds-typography-font-family-main, Manrope, sans-serif);
    font-size: calc(14px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
    line-height: 1.5; font-weight: 400; text-align: left;
}
#platform-shell-root.ps-shell { width: 100%; min-width: 0; }
#platform-shell-root.ps-shell [hidden] { display: none !important; }
#platform-shell-root.ps-shell .ps-global {
    min-height: 56px; padding: 6px var(--ui-page-gutter, 24px); box-sizing: border-box;
    display: flex; align-items: center; gap: 20px; border-bottom: 1px solid #dedede;
}
#platform-shell-root.ps-shell .ps-brand {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
    color: inherit; font-size: 25px; font-weight: 750; letter-spacing: -1px; text-decoration: none;
}
#platform-shell-root.ps-shell .ps-brand > img.ps-brand-mark {
    display: block; flex: 0 0 auto; width: 29px; height: 29px;
}
#platform-shell-root.ps-shell #ps-public { flex: 1 1 auto; min-width: 0; }
#platform-shell-root.ps-shell .ps-public-desktop,
#platform-shell-root.ps-shell .ps-work-desktop { display: flex; align-items: center; gap: 8px; }
#platform-shell-root.ps-shell .ps-work-entry { margin-left: auto; }
#platform-shell-root.ps-shell #ps-actions { flex: 0 0 auto; flex-wrap: nowrap; gap: 4px; justify-content: flex-end; }
#platform-shell-root.ps-shell #ps-actions > .ds-btn,
#platform-shell-root.ps-shell #ps-account-btn { width: 36px; height: 36px; min-width: 36px; padding: 8px; border-radius: 6px; }
#platform-shell-root.ps-shell #ps-actions svg { width: 20px; height: 20px; }
#platform-shell-root.ps-shell .site-menu-bar__link,
#platform-shell-root.ps-shell .ds-navbar-nav-link {
    display: inline-flex; align-items: center; gap: 5px; padding: 7px 9px; margin: 0;
    border: 0; border-radius: 5px; background: transparent; color: inherit; font: inherit;
    white-space: nowrap; text-decoration: none; box-shadow: none;
}
#platform-shell-root.ps-shell :is(.site-menu-bar__link,.ds-navbar-nav-link,.ds-navbar-dropdown-item):hover,
#platform-shell-root.ps-shell .site-menu-bar__link[aria-expanded="true"] { background: #f1f1f1; color: #171717; }
#platform-shell-root.ps-shell :is(a,button)[aria-current="page"],
.ps-menu-panel .site-menu-bar__line[aria-current="page"] { background: #e8e8e8; color: #171717; font-weight: 600; border-radius: 5px; }
#platform-shell-root.ps-shell :focus-visible, .ps-menu-panel :focus-visible { outline: 2px solid #202020; outline-offset: 2px; }
#platform-shell-root.ps-shell .lw-nav-dd { position: relative; display: inline-block; }
#platform-shell-root.ps-shell .lw-nav-dd > summary { cursor: pointer; list-style: none; }
#platform-shell-root.ps-shell .lw-nav-dd > summary::-webkit-details-marker { display: none; }
#platform-shell-root.ps-shell .lw-nav-dd > summary::after { content: none; }
#platform-shell-root.ps-shell :is(.site-menu-bar__link,.lw-nav-dd-summary) > .iconify {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
#platform-shell-root.ps-shell .lw-nav-dd-menu {
    position: absolute; z-index: 2400; top: calc(100% + 4px); left: 0; right: auto;
    min-width: 240px; max-width: min(360px, calc(100vw - 32px)); max-height: min(70vh, 580px);
    padding: 6px; border: 1px solid #dedede; border-radius: 8px;
    background: #fff; box-shadow: 0 8px 24px #00000014; overflow: auto;
}
#platform-shell-root.ps-shell .lw-nav-dd:not([open]) > .lw-nav-dd-menu { display: none; }
#platform-shell-root.ps-shell .ds-navbar-dropdown-item {
    display: block; padding: 8px 10px; border-radius: 5px; color: inherit;
    text-decoration: none; font: inherit; white-space: normal;
}
#platform-shell-root.ps-shell .ds-navbar-dropdown-item:hover { background: #f1f1f1; }
#platform-shell-root.ps-shell [data-dropdown="work-more"] .lw-nav-dd-menu { left: auto; right: 0; }
#platform-shell-root.ps-shell #ps-sections { padding: 3px var(--ui-page-gutter, 24px); min-height: 40px; box-sizing: border-box; border-bottom: 1px solid #dedede; }
#platform-shell-root.ps-shell .ps-page-context { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 var(--ui-page-gutter, 24px); }
#platform-shell-root.ps-shell .ps-page-context:has(> [hidden]):not(:has(> :not([hidden]))) { display: none; }
#platform-shell-root.ps-shell #ps-work-context { flex: 0 1 auto; min-width: 0; }
#platform-shell-root.ps-shell .work-context-summary { font: inherit; min-height: 36px; }
#platform-shell-root.ps-shell .work-context { font: inherit; }
#platform-shell-root.ps-shell .work-context-summary strong { font-weight: 600; }
#platform-shell-root.ps-shell #ps-breadcrumbs { min-width: 0; padding: 6px 0; margin: 0; background: transparent; font: inherit; }
#platform-shell-root.ps-shell .ds-breadcrumbs { margin: 0; padding: 0; background: transparent; font: inherit; }
#platform-shell-root.ps-shell .ds-breadcrumbs-list { margin: 0; padding: 0; gap: 8px; flex-wrap: wrap; }
#platform-shell-root.ps-shell .ds-breadcrumbs-link { padding: 0; border-radius: 0; background: transparent; font: inherit; color: #595959; }
#platform-shell-root.ps-shell .ds-breadcrumbs-link[aria-current="page"] { color: #171717; background: transparent; font-weight: 400; }
#platform-shell-root.ps-shell a.ds-breadcrumbs-link:hover { text-decoration: underline; }
#platform-shell-root.ps-shell .ps-public-mobile, #platform-shell-root.ps-shell .ps-work-mobile { display: none; }
.ps-menu-panel .site-menu-bar__line { font: inherit; }
.ps-menu-panel .site-menu-bar__code { font-size: inherit; font-weight: 600; margin-bottom: 6px; }
.ps-menu-panel .site-menu-bar__group { padding: 4px 8px; margin-bottom: 16px; }
.ps-menu-panel .site-menu-bar__line-row { min-height: 32px; }
.ps-ai-context { display: grid; gap: 8px; padding: 8px 0; }
.ps-ai-drawer { width: min(100vw, 620px) !important; }
.ps-ai-context label { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.ps-ai-context select { flex: 1; min-width: 0; }
.ps-ai-context details { font-size: 13px; }
.ps-ai-context details > div { max-height: 160px; overflow: auto; }
@media (max-width: 1240px) {
    #platform-shell-root.ps-shell .ps-public-desktop { display: none; }
    #platform-shell-root.ps-shell .ps-public-mobile { display: inline-block; }
}
@media (max-width: 900px) {
    #platform-shell-root.ps-shell .ps-work-desktop { display: none; }
    #platform-shell-root.ps-shell .ps-work-mobile { display: block; }
}
@media (max-width: 600px) {
    #platform-shell-root.ps-shell .ps-global { padding: 6px 12px; gap: 8px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
    #platform-shell-root.ps-shell .ps-brand { font-size: 23px; }
    #platform-shell-root.ps-shell .ps-brand > img.ps-brand-mark { width: 27px; height: 27px; }
    #platform-shell-root.ps-shell #ps-public .site-menu-bar__link { padding: 7px 4px; }
    #platform-shell-root.ps-shell .ps-page-context { padding: 0 12px; gap: 0 8px; flex-wrap: wrap; }
    #platform-shell-root.ps-shell #ps-work-context { margin-left: auto; }
    #platform-shell-root.ps-shell #ps-sections { padding-inline: 12px; }
}
@media (max-width: 767px) {
    /* DS dropdowns become bottom sheets; the shared account control stays anchored to its header. */
    #platform-shell-root.ps-shell #ps-account-menu { position: fixed; top: 56px !important; bottom: auto !important; right: 8px !important; left: auto !important; width: calc(100% - 16px); min-width: 0; max-width: 360px; border-radius: 8px; transform: none; }
}
}
}
