/* Shared platform frame. Loaded after page-specific styles to keep every module aligned. */
:root {
    --platform-content-width: 1200px;
    --platform-header-padding: 24px;
    --platform-motion: cubic-bezier(0.22, 1, 0.36, 1);
    --platform-scroll-track: rgba(7, 7, 19, 0.72);
    --platform-scroll-thumb: rgba(135, 137, 176, 0.48);
    --platform-scroll-thumb-hover: rgba(167, 139, 250, 0.78);
}

/* Keep the shared account menu above page-local workspaces and modal-like panels. */
.header {
    position: sticky !important;
    top: 0;
    flex: 0 0 64px;
    z-index: 11000;
    isolation: isolate;
    /* Shared header glass: retain legibility while exposing more page background. */
    background: rgba(10, 10, 25, 0.48) !important;
    border-bottom-color: rgba(255, 255, 255, 0.09) !important;
    backdrop-filter: blur(18px) saturate(1.12);
    -webkit-backdrop-filter: blur(18px) saturate(1.12);
}

html[data-theme="light"] .header {
    background: rgba(248, 249, 253, 0.54) !important;
    border-bottom-color: rgba(59, 61, 91, 0.09) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.54), 0 8px 24px rgba(58, 59, 93, 0.03) !important;
    backdrop-filter: blur(18px) saturate(1.08);
    -webkit-backdrop-filter: blur(18px) saturate(1.08);
}

.header .nav-links,
.header #platformAuthWrap {
    overflow: visible !important;
}

.header #platformAuthWrap {
    position: relative;
    z-index: 2;
}

.header #platformAuthWrap .platform-auth-menu {
    z-index: 11010 !important;
}

/* Use one dark scrollbar treatment for editable fields and every scrollable workspace. */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--platform-scroll-thumb) var(--platform-scroll-track);
}

*::-webkit-scrollbar {
    width: 10px !important;
    height: 10px !important;
}

*::-webkit-scrollbar-track {
    background: var(--platform-scroll-track) !important;
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    min-height: 34px;
    border: 2px solid transparent !important;
    border-radius: 999px;
    background: var(--platform-scroll-thumb) !important;
    background-clip: padding-box !important;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--platform-scroll-thumb-hover) !important;
    background-clip: padding-box !important;
}

*::-webkit-scrollbar-button {
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

*::-webkit-scrollbar-corner {
    background: transparent !important;
}

/* Custom select surface: keeps native form values while avoiding OS-specific option popups. */
.mac-select {
    position: relative;
    display: inline-block;
    min-width: 0;
    vertical-align: middle;
}

.mac-select.mac-select-fluid { display: block; width: 100%; }

.mac-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    pointer-events: none !important;
}

.mac-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 8px 10px 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 9px;
    background: rgba(23, 23, 47, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 1px 2px rgba(0, 0, 0, 0.14);
    color: #e6e7f2;
    font: 500 13px inherit;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s var(--platform-motion), background-color 0.2s var(--platform-motion), box-shadow 0.2s var(--platform-motion), transform 0.2s var(--platform-motion);
}

.mac-select-trigger:hover {
    border-color: rgba(167, 139, 250, 0.46);
    background: rgba(31, 30, 61, 0.96);
}

.mac-select.open .mac-select-trigger,
.mac-select-trigger:focus-visible {
    border-color: rgba(167, 139, 250, 0.76);
    box-shadow: 0 0 0 3px rgba(124, 111, 233, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    outline: none;
}

.mac-select-trigger:active { transform: translateY(1px); }

.mac-select-trigger:disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

.mac-select-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mac-select-chevron {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: #b9b6d3;
    transition: transform 0.22s var(--platform-motion), color 0.22s var(--platform-motion);
}

.mac-select.open .mac-select-chevron { color: #d9d1ff; transform: rotate(180deg); }

.mac-select-menu {
    position: fixed;
    z-index: 12050;
    display: grid;
    gap: 3px;
    min-width: 152px;
    max-height: min(300px, calc(100vh - 18px));
    overflow: auto;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 11px;
    background: rgba(24, 24, 48, 0.97);
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.43), inset 0 1px 0 rgba(255, 255, 255, 0.055);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transform-origin: top center;
    animation: mac-select-in 0.16s var(--platform-motion) both;
}

.mac-select-menu.opens-up { transform-origin: bottom center; }

@keyframes mac-select-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.mac-select-option {
    display: flex;
    align-items: center;
    min-height: 32px;
    width: 100%;
    padding: 7px 9px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #dedfed;
    font: 500 13px inherit;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.mac-select-option:hover,
.mac-select-option:focus-visible {
    background: rgba(139, 115, 240, 0.2);
    color: #fff;
    outline: none;
}

.mac-select-option.selected {
    background: rgba(110, 91, 213, 0.34);
    color: #f4f1ff;
}

.mac-select-option.selected::after {
    content: '';
    width: 6px;
    height: 6px;
    margin-left: auto;
    border-radius: 50%;
    background: #c4b5fd;
    box-shadow: 0 0 10px rgba(196, 181, 253, 0.7);
}

.mac-select-option:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

@media (prefers-reduced-motion: reduce) {
    .mac-select-trigger,
    .mac-select-chevron,
    .mac-select-menu,
    .mac-select-option { animation: none !important; transition: none !important; }
}

.header .header-inner {
    width: min(100%, var(--platform-content-width)) !important;
    max-width: var(--platform-content-width) !important;
    margin-inline: auto !important;
    min-width: 0;
    padding-inline: var(--platform-header-padding) !important;
    gap: 18px !important;
}

.header .logo {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 0 0 auto !important;
    min-width: max-content;
    white-space: nowrap;
}

.header .logo-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
}

.header .logo-image {
    display: block;
    padding: 0 !important;
    border-radius: 10px;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    object-fit: contain;
}

.header .logo-text {
    white-space: nowrap;
    line-height: 1;
}

.header .nav-links {
    min-width: 0;
    max-width: 100%;
    /* Account menus are positioned below this navigation area and must not be clipped. */
    overflow: visible !important;
}

.header .nav-links::-webkit-scrollbar {
    display: none;
}

.platform-theme-toggle {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 34px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.045);
    color: #c7c4df;
    cursor: pointer;
    transition: background-color 0.2s var(--platform-motion), border-color 0.2s var(--platform-motion), color 0.2s var(--platform-motion), transform 0.2s var(--platform-motion);
}

.platform-theme-toggle:hover {
    border-color: rgba(167, 139, 250, 0.48);
    background: rgba(139, 124, 240, 0.14);
    color: #f1edff;
}

.platform-theme-toggle:active { transform: scale(0.94); }
.platform-theme-toggle svg { width: 17px; height: 17px; }

html[data-theme="light"] .platform-theme-toggle {
    border-color: rgba(28, 28, 42, 0.14);
    background: rgba(255, 255, 255, 0.62);
    color: #55506f;
}

html[data-theme="light"] .platform-theme-toggle:hover {
    border-color: rgba(99, 91, 219, 0.4);
    background: rgba(99, 91, 219, 0.1);
    color: #413c9f;
}

/* The dashboard's text-only brand keeps the same left alignment and visual weight. */
.header .logo:not(:has(.logo-icon)) {
    display: flex;
    align-items: center;
    min-height: 36px;
}

.platform-hover-card,
.platform-hover-row {
    will-change: transform;
    transform: translateZ(0);
}

@media (hover: hover) and (pointer: fine) {
    .platform-hover-card {
        transition: transform 0.4s var(--platform-motion), border-color 0.4s var(--platform-motion), background-color 0.4s var(--platform-motion), box-shadow 0.4s var(--platform-motion);
    }

    .platform-hover-card:hover {
        transform: translateY(-4px);
        border-color: rgba(167, 139, 250, 0.38) !important;
        background-color: rgba(255, 255, 255, 0.055);
        box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24), 0 0 28px rgba(99, 102, 241, 0.1);
    }

    .platform-hover-row {
        transition: transform 0.25s var(--platform-motion), border-color 0.25s var(--platform-motion), background-color 0.25s var(--platform-motion);
    }

    .platform-hover-row:hover {
        transform: translateX(4px);
        border-color: rgba(167, 139, 250, 0.34) !important;
        background-color: rgba(255, 255, 255, 0.055);
    }
}

@media (max-width: 760px) {
    :root { --platform-header-padding: 14px; }

    .header .header-inner {
        gap: 12px !important;
        justify-content: flex-start !important;
    }

    .header .logo-text { font-size: 16px; }
    .header .logo-icon { width: 32px; height: 32px; flex-basis: 32px; }
    .header .nav-links { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
    .platform-hover-card,
    .platform-hover-row { transition: none !important; }
}
