/* Accent palettes — never paint the sidebar surface.
 * Tokens: --sidebar-bg, --surface, --accent, --accent-soft, --accent-border
 * User color is ACCENT only.
 */

:root {
    --sidebar-bg: var(--vnex-sidebar, #f4f4f5);
    --surface: var(--vnex-card, #ffffff);
    --surface-elevated: rgba(15, 23, 42, 0.05);
    --accent: var(--vnex-blue, #4f6ef5);
    --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
    --accent-border: color-mix(in srgb, var(--accent) 38%, transparent);
    --accent-on: #ffffff;
}

.dark,
html.dark {
    --sidebar-bg: var(--vnex-sidebar, #09090b);
    --surface: var(--vnex-card, #18181b);
    --surface-elevated: rgba(255, 255, 255, 0.06);
    --accent: var(--vnex-blue, #60a5fa);
    --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
    --accent-border: color-mix(in srgb, var(--accent) 42%, transparent);
}

html[data-nav-palette="vnex-navy"] {
    --accent: #4f6ef5;
    --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
    --accent-border: color-mix(in srgb, var(--accent) 40%, transparent);
}

html[data-nav-palette="midnight"] {
    --accent: #60a5fa;
    --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
    --accent-border: color-mix(in srgb, var(--accent) 40%, transparent);
}

html[data-nav-palette="slate"] {
    --accent: #64748b;
    --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
    --accent-border: color-mix(in srgb, var(--accent) 38%, transparent);
}

html[data-nav-palette="graphite"] {
    --accent: #a1a1aa;
    --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
    --accent-border: color-mix(in srgb, var(--accent) 36%, transparent);
}

html[data-nav-palette="ocean"] {
    --accent: #38bdf8;
    --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
    --accent-border: color-mix(in srgb, var(--accent) 42%, transparent);
}

html[data-nav-palette="indigo"] {
    --accent: #818cf8;
    --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
    --accent-border: color-mix(in srgb, var(--accent) 42%, transparent);
}

html[data-nav-palette] {
    --vnex-blue: var(--accent);
    --vnex-blue-bright: var(--accent);
    --vnex-blue-soft: var(--accent-soft);
    --vnex-vfm-blue: var(--accent);
    --vnex-vfm-blue-bright: var(--accent);
    --vnex-vfm-blue-soft: var(--accent-soft);
}

/* Neutral sidebar — matches the top header. Never use --accent as fill. */
html[data-nav-palette] .fi-sidebar,
html[data-nav-palette] .fi-sidebar-header,
html[data-nav-palette] .fi-sidebar-nav,
html[data-nav-palette] .fi-main-sidebar {
    background: var(--sidebar-bg) !important;
    background-color: var(--sidebar-bg) !important;
    border-inline-end: 1px solid var(--vnex-sidebar-border, var(--vnex-vfm-sidebar-border, #27272a)) !important;
}

html[data-sidebar-image] .fi-sidebar,
html[data-sidebar-image] .fi-sidebar-nav {
    background-image: var(--sidebar-image) !important;
    background-size: cover !important;
    background-position: center !important;
}

html[data-sidebar-image] .fi-sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(9, 9, 11, 0.78);
    pointer-events: none;
    z-index: 0;
}

html[data-sidebar-image] .fi-sidebar > * {
    position: relative;
    z-index: 1;
}

html[data-nav-palette] .vnex-module-sidebar__module-label,
html[data-nav-palette] .vnex-module-sidebar__group-label,
html[data-nav-palette] .fi-sidebar-group-label,
html[data-nav-palette] .vnex-module-sidebar__drag,
html[data-nav-palette] .vnex-nav-quota__meta {
    color: var(--vnex-muted, var(--vnex-vfm-muted, #a1a1aa)) !important;
}

html[data-nav-palette] .vnex-module-sidebar__item-link,
html[data-nav-palette] .vnex-module-sidebar__item-label,
html[data-nav-palette] .vnex-module-sidebar__module-btn,
html[data-nav-palette] .fi-sidebar-item-button,
html[data-nav-palette] .fi-sidebar-item-button .fi-sidebar-item-label {
    color: var(--vnex-text, var(--vnex-vfm-text, #fafafa));
}

html[data-nav-palette] .vnex-module-sidebar__item-link:hover,
html[data-nav-palette] .vnex-module-sidebar__module-btn:hover,
html[data-nav-palette] .vnex-module-sidebar__group-btn:hover,
html[data-nav-palette] .fi-sidebar-item-button:hover {
    background: var(--surface-elevated) !important;
    box-shadow: none !important;
}

/* Active item: quiet tint + 2px accent rail + accent icon. Not a painted row. */
html[data-nav-palette] .vnex-module-sidebar__item.is-active > .vnex-module-sidebar__item-link,
html[data-nav-palette] .vnex-module-sidebar__item-link.is-active,
html[data-nav-palette] .vnex-module-sidebar__item-link[aria-current="page"],
html[data-nav-palette] .fi-sidebar-item-active .fi-sidebar-item-button {
    background: var(--accent-soft) !important;
    box-shadow: none !important;
    border-radius: 0.55rem;
    position: relative;
}

html[data-nav-palette] .vnex-module-sidebar__item.is-active > .vnex-module-sidebar__item-link::before,
html[data-nav-palette] .vnex-module-sidebar__item-link.is-active::before,
html[data-nav-palette] .vnex-module-sidebar__item-link[aria-current="page"]::before,
html[data-nav-palette] .fi-sidebar-item-active .fi-sidebar-item-button::before {
    content: "";
    position: absolute;
    inset-block: 0.28rem;
    inset-inline-start: 0;
    width: 2px;
    border-radius: 999px;
    background: var(--accent);
}

html[data-nav-palette] .vnex-module-sidebar__item-link.is-active .vnex-module-sidebar__item-icon,
html[data-nav-palette] .vnex-module-sidebar__item-link.is-active .vnex-module-sidebar__item-icon .fi-icon,
html[data-nav-palette] .vnex-module-sidebar__item-link.is-active .vnex-module-sidebar__item-icon svg,
html[data-nav-palette] .fi-sidebar-item-active .fi-sidebar-item-button .fi-icon {
    color: var(--accent) !important;
}

html[data-nav-palette] .vnex-module-sidebar__item-link.is-active .vnex-module-sidebar__item-label,
html[data-nav-palette] .fi-sidebar-item-active .fi-sidebar-item-button .fi-sidebar-item-label {
    color: var(--vnex-text, var(--vnex-vfm-text, #fafafa)) !important;
    font-weight: 650;
}

/* Nested Storage/Files: do not paint the whole module blue. */
html[data-nav-palette] .vnex-module-sidebar__module[data-vnex-module],
html[data-nav-palette] .vnex-module-sidebar__module[data-vnex-module]:not(.is-collapsed),
html[data-nav-palette] .vnex-module-sidebar__module[data-vnex-module]:has(.vnex-module-sidebar__item-link.is-active) {
    border-inline-start-color: transparent !important;
}

html[data-nav-palette] .vnex-module-sidebar__fixed,
html[data-nav-palette] .vnex-nav-quota {
    border-color: var(--vnex-sidebar-border, var(--vnex-vfm-sidebar-border, #27272a)) !important;
}

html[data-nav-palette] .vnex-nav-quota {
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    color: var(--vnex-text, var(--vnex-vfm-text, #fafafa));
}

html[data-nav-palette] .vnex-nav-quota__bar i,
html[data-nav-palette] .vnex-drive-stat__bar i,
html[data-nav-palette] .vnex-storage-bar i.is-used,
html[data-nav-palette] .vnex-fm__btn--primary,
html[data-nav-palette] .vnex-ui__btn--soft,
html[data-nav-palette] .vnex-account__tab.is-active {
    background-color: var(--accent);
}

html[data-nav-palette] .vnex-account__tab.is-active {
    background-color: transparent;
    color: var(--accent);
    border-bottom-color: var(--accent);
}

html[data-nav-palette] a.vnex-ui__link {
    color: var(--accent);
}

html[data-nav-palette] :focus-visible {
    outline-color: var(--accent);
}

.vnex-nav-quota {
    margin: 0.9rem 0.75rem 1rem;
    padding: 0.8rem 0.85rem;
    border-radius: 0.85rem;
    border: 1px solid var(--vnex-vfm-sidebar-border, #e4e4e7);
    background: rgba(255, 255, 255, 0.55);
}

.dark .vnex-nav-quota,
html.dark .vnex-nav-quota {
    background: rgba(255, 255, 255, 0.03);
}

.vnex-nav-quota__head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.vnex-nav-quota__meta {
    margin: 0.25rem 0 0.55rem;
    font-size: 0.72rem;
    color: var(--vnex-vfm-muted, #6e7e83);
}

.vnex-nav-quota__bar,
.vnex-drive-stat__bar {
    display: block;
    height: 0.35rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.28);
    overflow: hidden;
}

.vnex-nav-quota__bar i,
.vnex-drive-stat__bar i {
    display: block;
    height: 100%;
    background: var(--accent, #4f6ef5);
}

.vnex-nav-palette {
    border: 0;
    margin: 0;
    padding: 0;
}

.vnex-nav-palette__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: 0.65rem;
    margin: 0.75rem 0 1rem;
}

.vnex-nav-palette__option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.75rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--vnex-border, #e4e4e7);
    border-radius: 0.75rem;
    cursor: pointer;
    background: var(--surface, transparent);
}

.vnex-nav-palette__option:has(input:focus-visible) {
    outline: 2px solid var(--accent, #4f6ef5);
    outline-offset: 2px;
}

.vnex-nav-palette__option:has(input:checked) {
    border-color: var(--accent, #4f6ef5);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.vnex-nav-palette__option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.vnex-nav-palette__swatch {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.2);
    flex: 0 0 auto;
}

.vnex-nav-palette__option[data-palette="vnex-navy"] .vnex-nav-palette__swatch { background: #4f6ef5; }
.vnex-nav-palette__option[data-palette="midnight"] .vnex-nav-palette__swatch { background: #60a5fa; }
.vnex-nav-palette__option[data-palette="slate"] .vnex-nav-palette__swatch { background: #64748b; }
.vnex-nav-palette__option[data-palette="graphite"] .vnex-nav-palette__swatch { background: #a1a1aa; }
.vnex-nav-palette__option[data-palette="ocean"] .vnex-nav-palette__swatch { background: #38bdf8; }
.vnex-nav-palette__option[data-palette="indigo"] .vnex-nav-palette__swatch { background: #818cf8; }

.vnex-nav-palette__name {
    font-size: 0.85rem;
    font-weight: 700;
}

.vnex-drive-banner-preview {
    position: relative;
    min-height: 8rem;
    border-radius: 0.9rem;
    overflow: hidden;
    background: linear-gradient(135deg, #18181b, #27272a);
}

.vnex-drive-banner-preview img {
    width: 100%;
    height: 8.5rem;
    object-fit: cover;
}

.vnex-drive-banner-preview__fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 8rem;
    color: #e8eef8;
    font-weight: 700;
}
