/**
 * Identity: Layout CSS structure.
 * Dependencies: theme.css
 * Contract: Defines the structural shell, nav bars, sidebar, and grid layouts.
 */

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    position: relative;
    isolation: isolate;
}

.app-container::after {
    content: "";
    position: fixed;
    inset: 0;
    background: var(--focus-overlay, rgba(3, 6, 10, 0.22));
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 1500;
}

.top-nav {
    height: var(--top-nav-height);
    background: rgba(9, 14, 20, 0.92);
    border-bottom: 1px solid rgba(151, 166, 189, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    z-index: 1000;
    backdrop-filter: blur(14px);
    transition: opacity 220ms cubic-bezier(0.22, 1, 0.36, 1), transform 220ms cubic-bezier(0.22, 1, 0.36, 1), background 220ms ease;
}

.top-nav-right {
    margin-left: auto;
    padding-right: 20px;
    display: flex;
    align-items: center;
}


.public-auth-slot {
    display: inline-flex;
    align-items: center;
    margin-right: 10px;
}

.public-auth-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.public-auth-btn,
.public-auth-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid rgba(151, 166, 189, 0.10);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
    white-space: nowrap;
}

.public-auth-btn--primary {
    background: linear-gradient(180deg, rgba(19, 93, 255, 0.92), rgba(0, 82, 229, 0.92));
    color: #fff;
    border-color: transparent;
}

.public-auth-btn--secondary,
.public-auth-pill {
    background: rgba(255, 255, 255, 0.03);
    color: rgba(240, 246, 252, 0.94);
}

.public-auth-btn:hover,
.public-auth-pill:hover {
    border-color: rgba(var(--accent-rgb), 0.16);
}

.settings-dropdown {
    position: relative;
}

.settings-trigger-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(151, 166, 189, 0.1);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.settings-trigger-btn:hover,
.settings-trigger-btn.active {
    background: rgba(255, 255, 255, 0.045);
    border-color: rgba(var(--accent-rgb), 0.16);
    color: var(--text-primary);
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.04) inset;
    transform: translateY(-1px);
}

.settings-popover {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(368px, calc(100vw - 24px));
    max-height: min(720px, calc(100vh - 104px));
    background: rgba(9, 14, 21, 0.965);
    backdrop-filter: blur(18px) saturate(145%);
    -webkit-backdrop-filter: blur(18px) saturate(145%);
    border: 1px solid rgba(151, 166, 189, 0.11);
    border-radius: 20px;
    box-shadow: 
        0 18px 54px rgba(0, 0, 0, 0.46),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    padding: 14px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(151, 166, 189, 0.22) transparent;
    transform: translateY(-6px) scale(0.985);
    transition: opacity 180ms cubic-bezier(0.22, 1, 0.36, 1), visibility 180ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.settings-popover::-webkit-scrollbar {
    width: 8px;
}

.settings-popover::-webkit-scrollbar-track {
    background: transparent;
}

.settings-popover::-webkit-scrollbar-thumb {
    background: rgba(151, 166, 189, 0.2);
    border-radius: 999px;
}

.settings-popover.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.settings-popover::after {
    content: "";
    position: absolute;
    top: -6px;
    right: 12px;
    width: 12px;
    height: 12px;
    background: rgba(9, 14, 21, 0.965);
    border-left: 1px solid rgba(151, 166, 189, 0.11);
    border-top: 1px solid rgba(151, 166, 189, 0.11);
    transform: rotate(45deg);
}

.settings-popover .settings-section-title,
.settings-popover .settings-deck-title {
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.settings-popover .settings-deck-title {
    margin-bottom: 2px;
    padding-left: 2px;
}

.settings-popover .settings-deck-title--secondary {
    opacity: 0.76;
}

.settings-popover .hub-global-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    width: 100%;
}

.settings-primary-deck,
.settings-secondary-deck {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(151, 166, 189, 0.08);
}

.settings-primary-deck {
    background:
        linear-gradient(180deg, rgba(16, 22, 31, 0.98), rgba(10, 15, 22, 0.995));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        0 0 0 1px rgba(255, 255, 255, 0.015);
}

.settings-secondary-deck {
    background:
        linear-gradient(180deg, rgba(11, 16, 24, 0.96), rgba(8, 12, 18, 0.985));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.settings-secondary-deck[hidden] {
    display: none !important;
}

.settings-popover .settings-group {
    min-width: 0;
}

.settings-popover .settings-group[hidden],
.settings-popover .settings-row[hidden],
.settings-popover .settings-group--stacked[hidden],
.settings-popover .settings-deck-title[hidden] {
    display: none !important;
}

.settings-popover .settings-row {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.settings-popover .settings-row--solo {
    grid-template-columns: 1fr;
    border-top: none !important;
    padding-top: 0 !important;
}

.settings-popover .settings-row--solo .settings-row-label {
    display: none;
}

.settings-primary-deck .settings-row + .settings-row,
.settings-secondary-deck .settings-row + .settings-row,
.settings-secondary-deck .settings-group--stacked {
    border-top: 1px solid rgba(151, 166, 189, 0.08);
    padding-top: 10px;
}

.settings-secondary-deck .settings-group--stacked {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-popover .settings-row-label {
    min-width: 0;
    color: rgba(198, 209, 222, 0.72);
    font-size: 11px;
    font-weight: var(--fw-semibold);
    letter-spacing: 0.02em;
}

.settings-popover .settings-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.settings-popover .settings-row-control {
    min-width: 0;
    width: 100%;
}

.settings-popover .mode-toggle-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    padding: 2px;
    background: rgba(255, 255, 255, 0.022);
    border: 1px solid rgba(151, 166, 189, 0.07);
    border-radius: 999px;
}

.settings-popover .contract-toggle-group .mode-toggle-group {
    grid-template-columns: repeat(3, 1fr);
}

.settings-popover .hub-global-btn {
    min-width: 0;
    width: 100%;
}

.settings-popover .spread-gap-stepper {
    display: grid;
    grid-template-columns: 36px minmax(92px, 1fr) 36px;
    align-items: center;
    gap: 8px;
}

.settings-popover .spread-gap-btn {
    width: 36px;
    min-width: 36px;
    height: 32px;
    padding: 0;
    border-radius: 999px;
    font-size: 16px;
    line-height: 1;
}

.settings-popover .spread-gap-value {
    min-height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(151, 166, 189, 0.09);
    background: rgba(255, 255, 255, 0.026);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    letter-spacing: 0.01em;
}

.settings-popover .settings-utility-btn,
.settings-popover .technical-analysis-reset-btn {
    width: auto;
    min-width: 78px;
}

.settings-popover .settings-row--utility .settings-utility-btn {
    justify-self: stretch;
}

.technical-analysis-summary {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(151, 166, 189, 0.08);
    background: linear-gradient(180deg, rgba(12, 18, 27, 0.94), rgba(9, 14, 22, 0.98));
    color: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    text-align: left;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.technical-analysis-summary:hover,
.technical-analysis-summary[aria-expanded="true"] {
    border-color: rgba(var(--accent-rgb), 0.16);
    background: linear-gradient(180deg, rgba(16, 23, 33, 0.98), rgba(10, 16, 24, 1));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 0 0 1px rgba(var(--accent-rgb), 0.03);
}

.technical-analysis-summary__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.technical-analysis-summary__label {
    display: block;
}

.technical-analysis-summary__meta {
    color: rgba(232, 239, 247, 0.9);
    font-size: 11px;
    font-weight: var(--fw-semibold);
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.technical-analysis-summary__chevron {
    color: rgba(176, 191, 208, 0.72);
    font-size: 18px;
    line-height: 1;
    transform: rotate(90deg);
    transition: transform 160ms ease, color 160ms ease;
}

.technical-analysis-section-copy {
    color: rgba(176, 191, 208, 0.68);
    font-size: 10px;
    line-height: 1.45;
    letter-spacing: 0.01em;
}

.technical-analysis-summary[aria-expanded="true"] .technical-analysis-summary__chevron {
    color: rgba(244, 247, 251, 0.9);
    transform: rotate(270deg);
}

.technical-analysis-settings {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.technical-analysis-toolbar {
    display: flex;
    justify-content: flex-end;
}

.technical-analysis-section,
.technical-analysis-subsection {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.technical-analysis-section + .technical-analysis-section,
.technical-analysis-subsection + .technical-analysis-subsection {
    border-top: 1px solid rgba(151, 166, 189, 0.08);
    padding-top: 10px;
}

.technical-analysis-mode-toggle,
.technical-analysis-study-toggle,
.technical-analysis-overlay-toggle {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.technical-analysis-chip-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.technical-analysis-custom {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.technical-analysis-advanced-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.technical-analysis-disclosure {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(151, 166, 189, 0.08);
    background: linear-gradient(180deg, rgba(12, 18, 27, 0.88), rgba(9, 14, 22, 0.96));
    color: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    text-align: left;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.technical-analysis-disclosure:hover,
.technical-analysis-disclosure[aria-expanded="true"] {
    border-color: rgba(var(--accent-rgb), 0.16);
    background: linear-gradient(180deg, rgba(16, 23, 33, 0.98), rgba(10, 16, 24, 1));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 0 0 1px rgba(var(--accent-rgb), 0.03);
}

.technical-analysis-disclosure__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.technical-analysis-disclosure__label {
    color: rgba(244, 247, 251, 0.96);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    letter-spacing: 0.01em;
}

.technical-analysis-disclosure__meta {
    color: rgba(176, 191, 208, 0.68);
    font-size: 10px;
    font-weight: var(--fw-semibold);
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.technical-analysis-disclosure__chevron {
    color: rgba(176, 191, 208, 0.72);
    font-size: 18px;
    line-height: 1;
    transform: rotate(90deg);
    transition: transform 160ms ease, color 160ms ease;
}

.technical-analysis-disclosure[aria-expanded="true"] .technical-analysis-disclosure__chevron {
    color: rgba(244, 247, 251, 0.9);
    transform: rotate(270deg);
}

.technical-analysis-advanced-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.technical-average-settings {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.technical-average-slot,
.technical-bollinger-slot {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid rgba(151, 166, 189, 0.08);
    background: linear-gradient(180deg, rgba(12, 18, 27, 0.94), rgba(9, 14, 22, 0.98));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.technical-average-slot.is-enabled,
.technical-bollinger-slot.is-enabled {
    border-color: rgba(var(--accent-rgb), 0.18);
    background: linear-gradient(180deg, rgba(16, 23, 33, 0.98), rgba(10, 16, 24, 1));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 0 0 1px rgba(var(--accent-rgb), 0.03);
}

.technical-average-slot__top,
.technical-bollinger-slot__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.technical-average-slot__identity {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.technical-average-slot__swatch {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 0 12px rgba(255, 255, 255, 0.05);
}

.technical-average-slot__swatch--fast {
    background: #f5f8fc;
}

.technical-average-slot__swatch--core {
    background: #8fb4e6;
}

.technical-average-slot__swatch--trend {
    background: #97a6bd;
}

.technical-average-slot__copy,
.technical-bollinger-slot__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.technical-average-slot__label {
    color: rgba(244, 247, 251, 0.96);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    letter-spacing: 0.01em;
}

.technical-average-slot__meta {
    color: rgba(176, 191, 208, 0.62);
    font-size: 10px;
    line-height: 1;
}

.technical-average-slot__controls,
.technical-bollinger-slot__controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.technical-average-slot__type-toggle {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.technical-average-slot__toggle {
    width: auto !important;
    min-width: 62px !important;
    padding-inline: 12px !important;
}

.moving-average-slot__input-shell {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(151, 166, 189, 0.08);
    background: rgba(7, 11, 17, 0.78);
    color: rgba(244, 247, 251, 0.94);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.moving-average-slot__input-shell:focus-within {
    border-color: rgba(var(--accent-rgb), 0.24);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.08);
}

.moving-average-slot__input {
    width: 44px;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    text-align: right;
    font-variant-numeric: tabular-nums;
    outline: none;
    appearance: textfield;
    -moz-appearance: textfield;
}

.moving-average-slot__input::-webkit-outer-spin-button,
.moving-average-slot__input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.moving-average-slot__suffix {
    color: rgba(176, 191, 208, 0.64);
    font-size: 10px;
    font-weight: var(--fw-semibold);
    letter-spacing: 0.08em;
}

.technical-analysis-chip,
.technical-analysis-mode-btn,
.technical-analysis-study-btn,
 .technical-average-type-btn,
 .technical-analysis-overlay-btn {
    min-height: 32px;
}

.technical-analysis-reset-btn {
    margin-top: 0;
}

@media (max-width: 560px) {
    .technical-analysis-chip-grid,
    .technical-average-slot__controls,
    .technical-bollinger-slot__controls {
        grid-template-columns: 1fr;
    }
}

:root {
    --top-nav-motion-duration: 520ms;
    --top-nav-motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --top-nav-universe-offset: 126px;
    --collapsed-universe-padding: 20px;
}

.universe-selector {
    display: flex;
    gap: 8px;
    height: 100%;
    padding-left: var(--top-nav-universe-offset);
    transition: padding-left var(--top-nav-motion-duration) var(--top-nav-motion-ease);
    align-items: center;
    will-change: padding-left;
}

body:not(.top-nav-measured) .universe-selector {
    opacity: 0;
    pointer-events: none;
}

body.top-nav-measured .universe-selector {
    opacity: 1;
}

body.sidebar-collapsed .universe-selector {
    padding-left: var(--collapsed-universe-padding, 20px);
}

.layout {
    display: flex;
    width: 100%;
    flex: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid rgba(151, 166, 189, 0.08);
    display: flex;
    flex-direction: column;
    padding: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1050;
    box-shadow: none;
    min-height: 0;
}

body.brand-boot:not(.brand-logo-transition) .top-nav {
    opacity: 0;
    transform: translateY(-10px);
    animation: bobbyShellRevealY 320ms cubic-bezier(0.22, 1, 0.36, 1) 40ms forwards;
}

body.brand-boot:not(.brand-logo-transition) .sidebar {
    opacity: 0;
    transform: translateX(-12px);
    animation: bobbyShellRevealX 360ms cubic-bezier(0.22, 1, 0.36, 1) 120ms forwards;
}

body .top-nav,
body .sidebar,
body .main-content,
body .main-content .hub-header {
    transition:
        opacity 120ms cubic-bezier(0.22, 1, 0.36, 1),
        background-color 120ms cubic-bezier(0.22, 1, 0.36, 1),
        filter 120ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 120ms cubic-bezier(0.22, 1, 0.36, 1);
}

body.brand-logo-transition .sidebar,
body.brand-logo-transition .top-nav {
    opacity: 1;
    transform: none;
    animation: none;
}

body.brand-logo-transition .main-content {
    background: linear-gradient(180deg, rgba(4, 10, 18, 0.985), rgba(4, 10, 18, 0.95));
    filter: saturate(0.96) brightness(0.95);
    transform: translateY(0);
}

body.brand-logo-transition .main-content .hub-header {
    opacity: 0.94;
    transform: none;
}

body.brand-logo-transition #hub-content {
    position: relative;
    isolation: isolate;
    min-height: calc((var(--chart-card-height-dense) * 2) + var(--chart-grid-gap));
    overflow: hidden;
}

body.brand-logo-transition #hub-content > * {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

body.brand-logo-transition #hub-content::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(5, 11, 19, 0.985), rgba(5, 11, 19, 0.955));
    opacity: 1;
    pointer-events: none;
    transition: opacity 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

body.brand-focus .app-container::after {
    opacity: 1;
}

body.brand-focus .top-nav {
    opacity: 0.24;
}

body.brand-focus .top-nav:hover,
body.brand-focus .top-nav:focus-within {
    opacity: 0.94;
}

@keyframes bobbyShellRevealY {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bobbyShellRevealX {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.layout.collapsed .sidebar {
    width: 0;
    min-width: 0;
    padding: 0;
    border-right: none;
}

.layout.collapsed .sidebar > * {
    display: none !important;
}

/* MIDDLE SIDEBAR HANDLE */
.collapse-toggle {
    position: absolute;
    top: calc(50% - 30px);
    right: -8px;
    transform: translateY(-50%);
    background-color: var(--bg-color);
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    color: var(--accent);
    cursor: pointer;
    z-index: 100;
    width: 16px;
    height: 44px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    line-height: 0;
    transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease, color 160ms ease, box-shadow 160ms ease, right 160ms ease;
}

.collapse-toggle::before {
    content: "";
    display: block;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 7px solid currentColor;
    transform: translateX(-1px);
}

.collapse-toggle:hover {
    background-color: var(--accent);
    color: var(--bg-color);
    border-color: var(--accent);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.26);
    right: -10px;
}

.collapse-toggle:active {
    box-shadow: none;
}

.expand-trigger {
    position: fixed;
    top: 50%;
    left: 0px;
    transform: translateY(-50%);
    display: none !important;
    background: var(--accent);
    border: 1px solid rgba(var(--accent-rgb), 0.6);
    color: var(--bg-color);
    width: 16px;
    height: 44px;
    padding: 0;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    line-height: 0;
    transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.expand-trigger::before {
    content: "";
    display: block;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid currentColor;
    transform: translateX(1px);
}

.expand-trigger:hover {
    background: var(--bg-color);
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-50%) translateX(2px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}

.expand-trigger:active {
    transform: translateY(-50%);
    box-shadow: none;
}

body.sidebar-collapsed .expand-trigger {
    display: flex !important;
}

body:not(.sidebar-collapsed) .expand-trigger {
    display: none !important;
}

.logo-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    position: absolute;
    top: 50%;
    left: 27px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(0, -50%);
    transition: opacity 120ms ease;
    will-change: transform, opacity;
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.logo {
    font-weight: var(--fw-bold);
    font-size: var(--text-xl);
    line-height: 1;
    color: var(--accent);
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    transition: opacity 120ms ease, visibility 120ms ease;
}

.logo span.rank-blue {
    color: #ffffff; /* BOBBY is White */
    text-decoration: none !important;
}

.logo .logo-terminal {
    margin-left: 0.35em; /* enforce visible space between BOBBY and TERMINAL */
}

.nav-links {
    list-style: none;
    padding: 6px 8px 0;
    margin: 0;
    flex-grow: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(151, 166, 189, 0.18) transparent;
}

.nav-links li {
    list-style: none;
}

.nav-links::-webkit-scrollbar {
    width: 6px;
}

.nav-links::-webkit-scrollbar-track {
    background: transparent;
}

.nav-links::-webkit-scrollbar-thumb {
    background: rgba(151, 166, 189, 0.18);
    border-radius: 999px;
}

.nav-links li a {
    display: block;
    padding: 7px 10px 7px 13px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: var(--fw-medium);
    font-size: 11px;
    line-height: 1.25;
    border-radius: 10px;
    position: relative;
    border: 1px solid transparent;
    background: transparent;
    box-shadow: none;
    transform: none;
    transition:
        color 190ms cubic-bezier(0.22, 1, 0.36, 1),
        background-color 190ms cubic-bezier(0.22, 1, 0.36, 1),
        border-color 190ms cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
        background 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-links li a:hover,
.nav-links li a:focus-visible {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(151, 166, 189, 0.05);
    box-shadow: none;
    outline: none;
}

.nav-links li a.active {
    background: rgba(var(--accent-rgb), 0.08);
    color: #f4f8fc;
    border-color: rgba(var(--accent-rgb), 0.16);
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.08);
}

.nav-links li a.active::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    transform: translateY(-50%);
}

.nav-links li a.active:hover,
.nav-links li a.active:focus-visible {
    color: #f7fbff;
    background: rgba(var(--accent-rgb), 0.1);
    border-color: rgba(var(--accent-rgb), 0.18);
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.1);
}

.nav-section {
    display: flex;
    align-items: center;
    min-height: 24px;
    padding: 10px 4px 4px;
    font-size: 10px;
    font-weight: var(--fw-bold);
    color: var(--text-tertiary);
    opacity: 0.92;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    text-align: left;
    position: relative;
    padding-left: 12px;
    transition:
        color 190ms cubic-bezier(0.22, 1, 0.36, 1),
        opacity 220ms cubic-bezier(0.22, 1, 0.36, 1),
        letter-spacing 220ms cubic-bezier(0.22, 1, 0.36, 1),
        text-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-section::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 50%;
    width: 2px;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0.35;
    transform: translateY(-50%);
    transition:
        opacity 190ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
        background 220ms cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-section::after {
    display: none;
}

.nav-links > .nav-section:first-child {
    padding-top: 6px;
}

@media (max-height: 700px) {
    .nav-links li a {
        padding-top: 7px;
        padding-bottom: 7px;
    }
    .nav-section {
        min-height: 22px;
        padding-top: 9px;
        padding-bottom: 4px;
    }
}

.nav-section.active-parent {
    color: var(--accent);
    text-shadow: none;
    font-weight: var(--fw-bold);
    opacity: 1;
    letter-spacing: 0.26em;
    transform: none;
}

.nav-section.active-parent::before {
    opacity: 1;
    transform: translateY(-50%);
    background: rgba(var(--accent-rgb), 0.92);
    box-shadow: none;
}

.nav-section.hover-parent {
    color: rgba(218, 226, 236, 0.88);
    opacity: 1;
    letter-spacing: 0.26em;
    text-shadow: none;
    transform: none;
}

.nav-section.hover-parent::before {
    opacity: 0.55;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.18);
}

.nav-section.active-parent.hover-parent {
    color: var(--accent);
    text-shadow: none;
    letter-spacing: 0.26em;
    transform: none;
}

.nav-section.active-parent.hover-parent::before {
    opacity: 1;
    transform: translateY(-50%);
    background: rgba(var(--accent-rgb), 1);
    box-shadow: none;
}

.dropdown {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

.dropdown-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: var(--fw-semibold);
    font-size: var(--text-sm);
    letter-spacing: 0.03em;
    cursor: pointer;
    height: 34px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.02);
    transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.dropdown-btn:hover, .dropdown.active .dropdown-btn {
    color: var(--text-primary);
    border-color: rgba(var(--accent-rgb), 0.16);
    background: rgba(var(--accent-rgb), 0.06);
}

.dropdown-btn::after {
    content: "▾";
    font-size: var(--text-xs);
    opacity: 0.5;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(14, 20, 28, 0.98);
    min-width: 200px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(151, 166, 189, 0.12);
    border-radius: 14px;
    padding: 6px;
    margin-top: -2px;
    z-index: 1100;
}

/* Bridge the hover gap caused by margin-top */
.dropdown-content::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 0;
    width: 100%;
    height: 6px;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: var(--text-secondary);
    padding: 10px 12px;
    text-decoration: none;
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    border-radius: 10px;
}

.dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.main-content {
    flex-grow: 1;
    padding: var(--main-content-pad-y) var(--main-content-pad-x) 12px;
    overflow-y: auto;
}

.header-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    padding-right: 0;
    min-height: 0;
}

.header-title-copy,
.hub-header {
    display: flex;
    flex-direction: column;
    gap: var(--hub-header-gap);
}

.header-title-copy {
    position: relative;
    padding-left: 16px;
}

.header-title-copy::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    bottom: 3px;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.95), rgba(var(--accent-rgb), 0.42));
    box-shadow:
        0 0 0 1px rgba(var(--accent-rgb), 0.08),
        0 0 16px rgba(var(--accent-rgb), 0.16);
}

.header-kicker {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: rgba(167, 185, 205, 0.84);
    position: relative;
    padding-bottom: 1px;
}

.header-title-main {
    font-size: var(--text-lg);
    font-weight: var(--fw-bold);
    letter-spacing: -0.01em;
    line-height: 1;
    color: rgba(244, 247, 251, 0.96);
}

.header-title-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.hub-header-metric-anchor {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 3;
    pointer-events: none;
}

.hub-header-metric {
    position: relative;
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 10px 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.018));
    border: 1px solid rgba(151, 166, 189, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    white-space: nowrap;
}

.hub-header-metric[hidden] {
    display: none !important;
}

.hub-header-metric-label {
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(167, 185, 205, 0.76);
}

.hub-header-metric-value {
    font-size: var(--text-md);
    font-weight: var(--fw-bold);
    letter-spacing: -0.02em;
    line-height: 1;
    color: rgba(244, 247, 251, 0.98);
}

.hub-header-metric-meta {
    font-size: var(--text-xs);
    color: rgba(167, 185, 205, 0.74);
    font-family: var(--font-mono);
    font-feature-settings: "tnum" 1;
    font-variant-numeric: tabular-nums;
}

.header-title .year-legend {
    position: static;
    right: auto;
    bottom: auto;
    gap: 10px;
    font-size: var(--text-xs);
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 2px;
}

.hub-tabs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.hub-tabs {
    display: inline-flex;
    align-items: center;
    gap: var(--hub-tabs-gap);
    margin-bottom: 0;
    padding: 4px;
    border: 1px solid rgba(151, 166, 189, 0.09);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.018);
}

.hub-tab {
    padding: var(--hub-tab-pad-y) 4px;
    color: rgba(160, 172, 188, 0.88);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    border-radius: 999px;
    transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0.01em;
    min-width: 78px;
    text-align: center;
    padding-left: 12px;
    padding-right: 12px;
    position: relative;
}

/* DROPDOWN NAVIGATION */
.hub-tab--dropdown {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-right: 10px;
}

.hub-tab--dropdown::after {
    content: "";
    width: 0;
    height: 0;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-top: 4px solid currentColor;
    opacity: 0.6;
    transition: transform 200ms ease;
}

.hub-tab--dropdown:hover::after {
    transform: translateY(1px);
}

.hub-dropdown-container {
    position: relative;
    display: inline-block;
}

.hub-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    transform: translateY(-6px);
    background: rgba(14, 20, 28, 0.98);
    border: 1px solid rgba(151, 166, 189, 0.12);
    border-radius: 14px;
    padding: 6px;
    min-width: 160px;
    box-shadow: var(--shadow-soft);
    opacity: 0;
    visibility: hidden;
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
    z-index: 1100;
    margin-top: -2px;
}

/* Bridge the hover gap so the menu stays open while moving the mouse down */
.hub-dropdown-menu::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 0;
    width: 100%;
    height: 6px;
}

.hub-dropdown-container:hover .hub-dropdown-menu,
.hub-dropdown-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.hub-dropdown-item {
    display: block;
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    border-radius: 8px;
    text-align: left;
    transition: background 150ms ease, color 150ms ease;
    cursor: pointer;
    white-space: nowrap;
}

.hub-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.hub-dropdown-item.active {
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
}

/* ROOT-LEVEL OVERLAY MENUS (Custom Settings / More) */
#bobby-overlay-root,
.bobby-overlay-root,
#custom-overlay-root,
.custom-overlay-root {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 6000;
}

.custom-overlay-menu {
    position: fixed;
    pointer-events: auto;
    min-width: 180px;
    z-index: 6001;
}

.custom-overlay-menu[hidden] {
    display: none !important;
}

.custom-overlay-menu__card,
.custom-overlay-menu__panel {
    background: rgba(14, 20, 28, 0.98);
    border: 1px solid rgba(151, 166, 189, 0.12);
    border-radius: 14px;
    padding: 6px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.custom-overlay-menu__item {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    border-radius: 8px;
    text-align: left;
    transition: background 150ms ease, color 150ms ease;
    cursor: pointer;
    white-space: nowrap;
}

.custom-overlay-menu__item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.custom-overlay-menu__item.is-active {
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
}

.hub-tab:hover {
    color: rgba(240, 246, 252, 0.92);
    background: rgba(255, 255, 255, 0.028);
}

.hub-tab.active {
    color: #f0f6fc;
    background: rgba(var(--accent-rgb), 0.11);
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.12);
}

.hub-global-controls {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 0;
}

.mode-toggle-group {
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    padding: 3px;
    border-radius: 999px;
    border: 1px solid rgba(151, 166, 189, 0.09);
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
    isolation: isolate;
}

.hub-global-btn {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    border: 1px solid rgba(151, 166, 189, 0.09);
    padding: 7px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: var(--fw-semibold);
    font-size: var(--text-xs);
    line-height: 1;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.mode-toggle-group .hub-global-btn {
    min-width: 74px;
    min-height: 32px;
    padding: 0 14px;
    border-color: transparent;
    background: transparent;
    color: var(--text-secondary);
    box-shadow: none;
    flex: 1 1 0;
    margin: 0;
    position: relative;
}

.mode-toggle-group .hub-global-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: transparent;
    box-shadow: none;
}

.hub-global-btn:hover {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: rgba(var(--accent-rgb), 0.16);
    color: var(--text-primary);
    box-shadow: none;
}

.hub-global-btn:active {
    box-shadow: none;
}

.hub-global-btn.is-disabled,
.hub-global-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

.hub-global-btn.is-disabled:hover,
.hub-global-btn:disabled:hover {
    background-color: rgba(255, 255, 255, 0.02);
    border-color: rgba(151, 166, 189, 0.09);
    color: var(--text-secondary);
}

.hub-global-btn.active {
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-rgb), 0.1));
    border-color: rgba(var(--accent-rgb), 0.2);
    color: #f0f6fc;
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.08);
}

.hub-global-btn.active:hover {
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.18), rgba(var(--accent-rgb), 0.12));
    border-color: rgba(var(--accent-rgb), 0.24);
}

.reset-all-btn-global {
    min-width: 70px;
}

.hub-sub-nav {
    display: inline-flex !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px !important;
    margin-bottom: 14px !important;
    padding: 4px;
    border: 1px solid rgba(151, 166, 189, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.02);
}

.fundamentals-local-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 26px;
    margin: -2px 0 10px;
}

.fundamentals-local-toolbar__spacer {
    flex: 1 1 auto;
}

.fundamentals-coverage-control {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 22px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(20px) saturate(135%);
    -webkit-backdrop-filter: blur(20px) saturate(135%);
}

.fundamentals-coverage-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: rgba(177, 188, 204, 0.82);
    padding: 5px 10px;
    min-width: 60px;
    border-radius: 999px;
    font-size: 10px;
    line-height: 1;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.fundamentals-coverage-btn:hover {
    color: rgba(241, 245, 250, 0.96);
}

.fundamentals-coverage-btn.active {
    color: rgba(248, 250, 252, 0.98);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.28), rgba(var(--accent-rgb), 0.18));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 1px rgba(var(--accent-rgb), 0.18);
}

.fundamentals-coverage-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.24), 0 0 0 4px rgba(var(--accent-rgb), 0.12);
}

.sidebar-footer {
    padding: 16px 0 14px;
    font-size: var(--text-xs);
    color: rgba(142, 153, 168, 0.45);
    margin-top: 10px;
    text-align: center;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    font-weight: var(--fw-regular);
    flex-shrink: 0;
}

.trademark {
    font-size: 8px;
    vertical-align: super;
    margin-left: 2px;
    opacity: 0.8;
}

.logo-container {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 27px;
    gap: 10px;
    height: 100%;
    background-color: rgba(10, 14, 20, 0.92);
    position: relative;
    overflow: visible;
    transition: width var(--top-nav-motion-duration) var(--top-nav-motion-ease), min-width var(--top-nav-motion-duration) var(--top-nav-motion-ease);
}

/* Sidebar Collapsed Logo styles */
body.sidebar-collapsed .logo-container {
    width: var(--collapsed-logo-width, 120px);
    min-width: var(--collapsed-logo-width, 120px);
    justify-content: center;
    padding-left: 0;
}
body.sidebar-collapsed .logo {
    opacity: 0;
    visibility: hidden;
}
body.sidebar-collapsed .logo-icon {
    left: 50%;
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%);
}


@media (max-height: 920px) {
    .nav-links {
        padding-top: 4px;
    }

    .nav-links li a {
        padding: 6px 10px 6px 13px;
    }

    .nav-section {
        min-height: 20px;
        padding: 7px 4px 3px 12px;
        font-size: 9px;
        letter-spacing: 0.22em;
    }

    .nav-section::before {
        height: 10px;
    }

    .sidebar-footer {
        padding: 10px 0 9px;
        margin-top: 4px;
        letter-spacing: 0.24em;
    }
}

@media (max-height: 820px) {
    .nav-links {
        padding-top: 3px;
    }

    .nav-links li a {
        padding: 5px 10px 5px 13px;
        font-size: 10px;
    }

    .nav-section {
        min-height: 18px;
        padding: 6px 4px 2px 12px;
        font-size: 9px;
        letter-spacing: 0.2em;
    }

    .sidebar-footer {
        padding: 8px 0 7px;
        margin-top: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav-links li a,
    .nav-section,
    .nav-section::before,
    .nav-section::after,
    .header-title-copy::before,
    .logo-container,
    .logo,
    .logo-icon,
    .universe-selector {
        transition-duration: 1ms !important;
        animation-duration: 1ms !important;
    }

    .nav-links li a:hover,
    .nav-links li a:focus-visible,
    .nav-links li a.active:hover,
    .nav-links li a.active:focus-visible,
    .nav-section.hover-parent,
    .nav-section.active-parent.hover-parent {
        transform: none !important;
    }
}

@media (max-width: 1200px) {
    .hub-global-controls {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    .main-content {
        padding: 10px 10px 12px;
    }

    .hub-tabs {
        flex-wrap: wrap;
        gap: 6px;
    }

    .header-title {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-title-row {
        align-items: flex-start;
    }

    .header-title .year-legend {
        width: 100%;
        justify-content: flex-start;
    }
}


.settings-popover .mode-toggle-group {
    gap: 0;
    padding: 3px;
    overflow: hidden;
    border-radius: 999px;
}

.settings-popover .contract-toggle-group {
    align-items: stretch;
}

.settings-popover .mode-toggle-group .hub-global-btn {
    min-width: 0;
    width: 100%;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: none;
}

.settings-popover .mode-toggle-group .hub-global-btn.active {
    transform: none;
}

/* -------------------------------------------------------------------------- */
/* Custom universe                                                             */
/* -------------------------------------------------------------------------- */
body.custom-focus-mode .sidebar,
body.custom-focus-mode .expand-trigger {
    display: none !important;
}

body.custom-focus-mode .layout {
    display: block;
    overflow: visible;
}

body.custom-focus-mode .main-content {
    width: auto;
    max-width: none;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: visible;
    min-height: calc(100vh - 84px);
}

html:has(body.custom-focus-mode),
body.custom-focus-mode {
    overflow-y: auto;
}

.custom-hub-header {
    margin-bottom: 4px;
    position: relative;
    z-index: 120;
    isolation: isolate;
}

.custom-hub-header .header-title {
    padding-bottom: 14px;
    align-items: flex-start;
}

.custom-hub-header .header-title-copy {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
}

.custom-hub-header .header-title-main {
    letter-spacing: -0.02em;
    text-transform: none;
    min-width: 0;
    flex: 1 1 auto;
}

.custom-hub-header .header-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
}

.custom-hub-header .header-kicker {
    color: rgba(151, 166, 189, 0.68);
    letter-spacing: 0.14em;
}

.custom-shell {
    display: grid;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.custom-workspace-tabs-row {
    margin-bottom: 0;
    align-items: stretch;
    gap: 12px;
    position: relative;
    z-index: 140;
    overflow: visible;
}

.custom-shell-toolbar,
.custom-editor-panel__controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.custom-shell-toolbar__actions,
#custom-header-actions,
.custom-auth-card__actions,
.custom-editor-slot-actions,
.custom-grid-slot__overlay {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

#custom-header-actions {
    margin-left: auto;
    justify-content: flex-end;
    display: inline-flex;
    visibility: visible;
    opacity: 1;
    min-width: max-content;
}

.custom-workspace-tabs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(148px, 176px);
    width: auto;
    max-width: 100%;
    overflow: visible;
    align-items: stretch;
    position: relative;
    z-index: 150;
}

.custom-workspace-tabs::-webkit-scrollbar {
    height: 0;
}

.custom-shell-btn,
.custom-auth-link-btn {
    border: 1px solid rgba(151, 166, 189, 0.14);
    background: rgba(16, 25, 37, 0.94);
    color: #f5f7fb;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.custom-workspace-tab {
    appearance: none;
    border: 0;
    background: transparent;
    color: rgba(212, 223, 241, 0.72);
    min-width: 0;
    text-transform: none;
}

.custom-workspace-tab__label {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-workspace-tab--more {
    color: rgba(212, 223, 241, 0.84);
}

.custom-workspace-overflow,
.custom-settings-menu {
    position: relative;
    z-index: 260;
    isolation: isolate;
}

.custom-workspace-overflow-menu,
.custom-settings-dropdown {
    z-index: 5000;
    left: auto;
    right: 0;
}

/* Compatibility layer until JS portals More / Settings into the root overlay host */
.custom-workspace-overflow-menu,
.custom-settings-dropdown,
.custom-overlay-menu__card,
.custom-overlay-menu__panel {
    background: rgba(14, 20, 28, 0.98);
    border: 1px solid rgba(151, 166, 189, 0.12);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.hub-dropdown-container.is-open > .hub-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-settings-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.custom-workspace-overflow-toggle {
    appearance: none;
    border: 0;
    background: transparent;
}

.custom-shell-btn--static {
    cursor: default;
}

.custom-shell-btn:hover,
.custom-workspace-tab:hover,
.custom-auth-link-btn:hover {
    border-color: rgba(151, 166, 189, 0.26);
}

.custom-shell-btn--primary,
.custom-auth-link-btn--primary {
    background: linear-gradient(180deg, rgba(19, 93, 255, 0.92), rgba(0, 82, 229, 0.92));
    border-color: transparent;
    color: #ffffff;
}

.custom-workspace-tabs .custom-workspace-tab:hover {
    color: rgba(240, 246, 252, 0.96);
    background: rgba(var(--accent-rgb), 0.06);
}

.custom-workspace-tabs .custom-workspace-tab.active {
    color: #f4f8ff;
    background: linear-gradient(180deg, rgba(19, 93, 255, 0.44), rgba(0, 82, 229, 0.36));
    box-shadow: inset 0 0 0 1px rgba(90, 166, 255, 0.36), 0 0 0 1px rgba(19, 93, 255, 0.10);
}

.custom-shell-btn--danger {
    color: #ffb1b1;
}

.custom-shell-kicker,
.custom-shell-subtitle {
    display: block;
}

.custom-editor-hero {
    display: grid;
    gap: 6px;
}

.custom-shell-kicker {
    color: rgba(151, 166, 189, 0.68);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.custom-editor-slot-label {
    color: rgba(151, 166, 189, 0.78);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.custom-editor-chart-title {
    font-size: 26px;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: #f5f7fb;
    font-weight: 600;
}

.custom-editor-chart-meta {
    color: rgba(212, 223, 241, 0.72);
    font-size: 13px;
    line-height: 1.45;
}

.custom-shell-subtitle {
    color: rgba(212, 223, 241, 0.78);
    font-size: 13px;
    line-height: 1.45;
    margin-top: 6px;
    max-width: 760px;
}

.custom-picker-bar {
    display: grid;
    gap: 10px;
}

.custom-picker-tabs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.custom-picker-tab {
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: rgba(212, 223, 241, 0.72);
    padding: 0 0 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 140ms ease, border-color 140ms ease;
}

.custom-picker-tab:hover {
    color: rgba(245, 247, 251, 0.92);
}

.custom-picker-tab.is-active {
    color: #5aa6ff;
    border-bottom-color: #0066ff;
}

.custom-picker-filters {
    display: grid;
    grid-template-columns: minmax(104px, 132px) minmax(180px, 260px);
    gap: 8px;
    align-items: end;
    justify-content: start;
}

.custom-picker-search,
.custom-picker-filter {
    width: auto;
}

.custom-picker-search input,
.custom-picker-filter select,
.custom-editor-panel__controls--inputs input,
.custom-editor-panel__controls--inputs select,
.custom-grid-control select {
    width: 100%;
    box-sizing: border-box;
    min-height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(151, 166, 189, 0.14);
    background: rgba(11, 18, 28, 0.96);
    color: #f5f7fb;
    padding: 0 12px;
    box-shadow: none;
    appearance: none;
}

.custom-picker-search input::placeholder {
    color: rgba(151, 166, 189, 0.58);
}

.custom-auth-shell,
.custom-empty-state {
    display: grid;
    gap: 12px;
}

.custom-shell-card,
.custom-auth-card,
.custom-workspace-card {
    padding: 0;
    height: auto !important;
    min-height: 0 !important;
}

.custom-auth-card {
    max-width: 680px;
    padding: 18px;
}

.custom-auth-card__body {
    display: grid;
    gap: 12px;
}

.custom-auth-card__title,
.custom-empty-state__title,
.custom-slot-empty-copy .custom-catalog-card__title,
.custom-editor-slot-meta .custom-catalog-card__title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #f5f7fb;
}

.custom-auth-card__copy,
.custom-empty-state__copy,
.custom-slot-empty-copy .custom-catalog-card__meta,
.custom-editor-slot-meta .custom-catalog-card__meta,
.custom-catalog-card__meta {
    color: rgba(212, 223, 241, 0.72);
    font-size: 12px;
    line-height: 1.4;
}

.custom-empty-state,
.custom-empty-state--inline {
    border: 1px dashed rgba(151, 166, 189, 0.18);
    border-radius: 16px;
    padding: 22px;
    background: rgba(8, 13, 20, 0.46);
}

.custom-empty-state--inline {
    min-height: 120px;
}

.custom-editor-panel {
    display: grid;
    gap: 14px;
    border: 1px solid rgba(151, 166, 189, 0.12);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(8, 13, 20, 0.96), rgba(9, 15, 24, 0.92));
    padding: 18px 18px 16px;
}

.custom-editor-panel__controls--inputs {
    align-items: center;
    gap: 8px;
}

.custom-editor-panel__controls--inputs input,
.custom-editor-panel__controls--inputs select,
.custom-grid-control select {
    min-width: 0;
}

.custom-grid-control {
    color: rgba(212, 223, 241, 0.72);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: grid;
    gap: 5px;
}

.custom-grid-control span {
    white-space: nowrap;
}

.custom-editor-slot-meta {
    display: grid;
    gap: 4px;
    padding: 2px 0 4px;
}

.custom-editor-slot-actions {
    margin-top: 4px;
}

.custom-layout-disclosure {
    display: grid;
    gap: 10px;
    padding-top: 4px;
    border-top: 1px solid rgba(151, 166, 189, 0.10);
}

.custom-layout-toggle {
    justify-self: start;
    border: 1px solid rgba(151, 166, 189, 0.14);
    background: rgba(11, 18, 28, 0.96);
    color: rgba(212, 223, 241, 0.84);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

.custom-layout-panel {
    display: grid;
    gap: 10px;
}

.custom-layout-controls,
.custom-layout-workspace-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.custom-grid-control--compact {
    min-width: 104px;
}

.custom-editor-slot-meta .custom-catalog-card__title {
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(151, 166, 189, 0.78);
}

.custom-editor-slot-meta .custom-catalog-card__meta {
    font-size: 22px;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: #f5f7fb;
}

.custom-editor-panel__list {
    display: grid;
    gap: 10px;
    max-height: 360px;
    overflow: auto;
    padding-right: 4px;
    align-content: start;
}

.custom-catalog-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border: 1px solid rgba(151, 166, 189, 0.12);
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(11, 18, 28, 0.92);
}

.custom-catalog-card__title {
    font-size: 16px;
    font-weight: 600;
    color: #f5f7fb;
    line-height: 1.2;
}

.custom-workspace-grid {
    --custom-empty-slot-bg: rgb(22 28 37);
    display: grid;
    gap: 12px;
    min-width: 0;
}

.custom-grid-slot {
    --custom-slot-height: 360px;
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    box-sizing: border-box;
    min-height: var(--custom-slot-height);
    height: var(--custom-slot-height);
    background: rgba(8, 13, 20, 0.46);
    border: 1px solid rgba(151, 166, 189, 0.10);
}

.custom-grid-slot__skeleton {
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: 14px;
    overflow: hidden;
    box-sizing: border-box;
    min-height: var(--custom-slot-height);
    height: var(--custom-slot-height);
}

.custom-grid-slot__skeleton .chart-loading-overlay {
    display: flex;
}

.custom-grid-slot__skeleton .chart-loading-overlay > div {
    font-size: 12px;
    line-height: 1.45;
}

.custom-grid-slot--loaded .custom-grid-slot__skeleton {
    display: none;
}

.custom-grid-slot--error .custom-grid-slot__skeleton .chart-loading-overlay {
    background: linear-gradient(180deg, rgba(7, 12, 19, 0.94), rgba(7, 12, 19, 0.94));
}

.custom-grid-slot.is-selected {
    box-shadow: inset 0 0 0 1px rgba(19, 93, 255, 0.72), 0 0 0 1px rgba(19, 93, 255, 0.24);
}

.custom-grid-slot--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--custom-slot-height);
    height: var(--custom-slot-height);
    padding: 20px;
    box-sizing: border-box;
    background: var(--custom-empty-slot-bg);
}

.custom-slot-empty-copy {
    text-align: center;
    max-width: 220px;
}

.custom-grid-slot__overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
}

.custom-workspace-frame {
    width: 100%;
    height: var(--custom-slot-height);
    min-height: var(--custom-slot-height);
    border: 0;
    background: #050a11;
    border-radius: 14px;
    display: block;
    position: relative;
    z-index: 1;
}

.custom-workspace-frame--pending {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

body.custom-workspace-fullscreen-active {
    overflow: hidden;
}

body.custom-workspace-fullscreen-active .custom-shell {
    z-index: auto;
}

.custom-grid-slot.custom-grid-slot--workspace-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 12000;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    border-radius: 0;
    margin: 0;
    background: rgba(5, 10, 17, 1);
    border: 0;
    box-shadow: none;
}

.custom-grid-slot:fullscreen,
.custom-grid-slot:-webkit-full-screen {
    position: relative;
    inset: auto;
    z-index: auto;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    border-radius: 0;
    margin: 0;
    background: rgba(5, 10, 17, 1);
    border: 0;
    box-shadow: none;
}

.custom-grid-slot.custom-grid-slot--workspace-fullscreen .custom-workspace-frame {
    height: 100%;
    min-height: 100%;
    width: 100%;
    border-radius: 0;
}

.custom-grid-slot:fullscreen .custom-workspace-frame,
.custom-grid-slot:-webkit-full-screen .custom-workspace-frame {
    height: 100%;
    min-height: 100%;
    width: 100%;
    border-radius: 0;
}

@media (max-width: 920px) {
    .custom-hub-header .header-title-row,
    .custom-workspace-tabs-row {
        align-items: flex-start;
    }

    #custom-header-actions {
        margin-left: 0;
        justify-content: flex-start;
    }

    .custom-shell-toolbar,
    .custom-editor-panel__controls {
        align-items: flex-start;
    }

    .custom-picker-filters {
        grid-template-columns: 1fr;
    }

    .custom-workspace-tabs {
        grid-auto-columns: minmax(132px, 160px);
    }

    .custom-workspace-frame,
    .custom-grid-slot {
        min-height: 320px;
        height: 320px;
    }
}

/* ==========================================================================
   Bobby AI Panel
   ========================================================================== */

.ai-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid rgba(151, 166, 189, 0.14);
    background: rgba(10, 18, 28, 0.92);
    color: #e5ecf8;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.ai-trigger-btn:hover,
.ai-trigger-btn.is-active {
    border-color: rgba(0, 102, 255, 0.34);
    background: rgba(13, 24, 38, 0.98);
}

.ai-trigger-btn__dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(180deg, #66a3ff, #0066ff);
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.12);
}

.ai-trigger-btn__label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .01em;
}

.ai-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 13, 0.38);
    backdrop-filter: blur(3px);
    z-index: 1500;
}

.ai-panel {
    position: fixed;
    top: 96px;
    right: 20px;
    bottom: 20px;
    width: min(420px, calc(100vw - 40px));
    display: grid;
    grid-template-rows: auto auto auto 1fr auto;
    gap: 14px;
    padding: 18px;
    border-radius: 24px;
    border: 1px solid rgba(151, 166, 189, 0.14);
    background: rgba(7, 13, 21, 0.94);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
    backdrop-filter: blur(18px);
    transform: translateX(18px);
    opacity: 0;
    pointer-events: none;
    transition: transform .22s ease, opacity .22s ease;
    z-index: 1510;
}

.ai-panel.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.ai-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ai-panel__eyebrow {
    color: #7b8ca6;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.ai-panel__title {
    margin-top: 6px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.ai-panel__subtitle {
    margin-top: 6px;
    color: #92a5c1;
    font-size: 12px;
    line-height: 1.45;
}

.ai-panel__close {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(151, 166, 189, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: #dbe4f2;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.ai-panel__status {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(151, 166, 189, 0.12);
    background: rgba(255, 255, 255, 0.03);
    color: #9bb5d8;
    font-size: 12px;
    line-height: 1.4;
}

.ai-panel__status.is-error {
    border-color: rgba(255, 128, 128, 0.24);
    color: #ffb0b0;
}

.ai-panel__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-suggestion-chip {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(151, 166, 189, 0.14);
    background: rgba(255, 255, 255, 0.03);
    color: #d9e3f0;
    font-size: 12px;
    cursor: pointer;
}

.ai-panel__messages {
    display: grid;
    gap: 10px;
    overflow: auto;
    padding-right: 4px;
}

.ai-message {
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(151, 166, 189, 0.12);
    background: rgba(8, 14, 22, 0.96);
}

.ai-message--assistant {
    background: rgba(10, 18, 28, 0.98);
}

.ai-message--user {
    background: rgba(0, 102, 255, 0.14);
    border-color: rgba(0, 102, 255, 0.24);
}

.ai-message__role {
    color: #7f93b2;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.ai-message__body {
    white-space: pre-wrap;
    color: #e7edf7;
    font-size: 13px;
    line-height: 1.55;
}

.ai-message__meta {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-message__pill {
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: #88a0c0;
    font-size: 11px;
}

.ai-panel__composer {
    display: grid;
    gap: 10px;
}

.ai-panel__input {
    resize: vertical;
    min-height: 92px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(151, 166, 189, 0.16);
    background: rgba(5, 10, 17, 0.98);
    color: #f4f7fb;
    font: inherit;
}

.ai-panel__composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ai-panel__hint {
    color: #7f93b2;
    font-size: 12px;
}

.ai-panel__send {
    min-width: 92px;
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, #1d6cff, #0055f2);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.ai-panel__send[disabled] {
    opacity: .55;
    cursor: default;
}

@media (max-width: 920px) {
    .ai-panel {
        top: 88px;
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
    }
}
