/* ==========================================================================
    First Principle Investing Classic Matte Black Aesthetic Design System (index.css)
   ========================================================================== */

/* --- Understated Premium Matte Color Tokens --- */
:root {
    --color-bg: #070709;             /* Extremely deep pure matte black */
    --color-bg-card: #111115;        /* Solid matte charcoal card container */
    --color-bg-sidebar: #0a0a0c;     /* Smooth sidebar matte background */
    --color-border: rgba(255, 255, 255, 0.035); /* Minimalist thin border */
    --color-border-hover: rgba(255, 255, 255, 0.08);
    
    /* Low-Contrast Sophisticated Accents */
    --color-gold: #c5a880;           /* Luxury classic gold */
    --color-blue: #7e9bb4;           /* Classic muted slate blue */
    --color-emerald: #9bbfa8;        /* Muted sage/jade green */
    --color-rose: #c28891;           /* Muted old rose red */
    --color-text-primary: #e5e7eb;   /* Soft warm silver-white */
    --color-text-secondary: #b2bcca; /* High-contrast slate-silver (WCAG AAA compliant) */
    --color-text-muted: #808b9e;     /* High-contrast carbon-grey (WCAG AA compliant) */

    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;
}

/* --- Core Resets --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* --- Custom Subtle Scrollbars --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: rgba(197, 168, 128, 0.35); /* Classic First Principle Investing Gold, semi-transparent */
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(197, 168, 128, 0.65); /* Highlighted Gold */
}

/* --- Layout Architecture --- */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar: Collapsible Navigation & Profile */
.sidebar {
    width: 250px;
    background: var(--color-bg-sidebar);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    justify-content: space-between;
    padding: 0;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 90;
}

/* Collapsed Sidebar State */
.sidebar.collapsed {
    width: 72px;
}

/* Smooth shrink and fade transition for text */
.collapsible-text {
    transition: opacity 0.2s ease, max-width 0.2s ease, margin-left 0.2s ease, visibility 0.2s;
    opacity: 1;
    max-width: 200px;
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    vertical-align: middle;
}

.sidebar.collapsed .collapsible-text {
    opacity: 0;
    max-width: 0;
    margin-left: 0 !important;
    margin-right: 0 !important;
    visibility: hidden;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.brand {
    display: flex;
    align-items: center;
    padding: 24px 20px;
    border-bottom: 1px solid var(--color-border);
    justify-content: flex-start;
    gap: 12px;
    height: 72px;
    box-sizing: border-box;
}

.sidebar.collapsed .brand {
    justify-content: center;
    padding: 24px 0;
}

.brand-icon {
    font-size: 1.25rem;
    color: var(--color-gold);
    flex-shrink: 0;
}

.brand-name {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 0.5px;
    color: #fff;
    white-space: nowrap;
}

/* Floating Sidebar Toggle Circle Button centered on right edge */
.sidebar-toggle-btn {
    position: absolute;
    top: 36px;
    right: -12px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 100;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-toggle-btn:hover {
    background: var(--color-bg);
    border-color: var(--color-gold);
    color: #fff;
    transform: translateY(-50%) scale(1.1);
}

.sidebar.collapsed .sidebar-toggle-btn {
    right: -12px;
}

.sidebar-section-header {
    font-family: var(--font-heading);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0 24px;
    margin-top: 24px;
    margin-bottom: 8px;
}

.sidebar-top-wrapper {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-top-wrapper::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

.sidebar-divider {
    height: 1px;
    background: var(--color-border);
    margin: 16px 20px;
    transition: margin 0.25s;
}

.sidebar.collapsed .sidebar-divider {
    margin: 16px 12px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
    transition: padding 0.25s;
}

.sidebar.collapsed .sidebar-nav {
    padding: 0 8px;
}

/* Sidebar Navigation Items styling */
.sidebar-nav-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--color-text-secondary);
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    gap: 12px;
    position: relative;
    border-left: 3px solid transparent;
}

.sidebar-nav-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    color: var(--color-text-muted);
    transition: color 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.02);
    color: #fff;
}

.sidebar-nav-item:hover i {
    color: var(--color-gold);
    transform: scale(1.05);
}

.sidebar-nav-item.active {
    background: rgba(197, 168, 128, 0.08);
    color: #fff;
    font-weight: 600;
    border-left-color: var(--color-gold);
}

.sidebar-nav-item.active i {
    color: var(--color-gold);
}

.sidebar-nav-item.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.sidebar-nav-item.disabled:hover {
    background: transparent;
    color: var(--color-text-secondary);
}

.sidebar-nav-item.disabled:hover i {
    color: var(--color-text-muted);
    transform: none;
}

.sidebar.collapsed .sidebar-nav-item {
    justify-content: center;
    padding: 12px 0;
    border-left-width: 0;
}

.sidebar.collapsed .sidebar-nav-item i {
    margin-right: 0;
    font-size: 1.1rem;
}

/* Future Features Group styling */
.nav-item-future {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--color-text-muted);
    border-radius: 6px;
    font-size: 0.82rem;
    gap: 12px;
    cursor: default;
    transition: all 0.2s;
}

.nav-item-future i:first-child {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item-future span {
    flex-grow: 1;
    white-space: nowrap;
}

.future-lock {
    font-size: 0.65rem !important;
    color: rgba(255, 255, 255, 0.25);
    margin-left: auto;
}

.sidebar.collapsed .nav-item-future {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .nav-item-future i:first-child {
    margin-right: 0;
    font-size: 1.1rem;
}

/* User Profile Panel at Bottom */
.user-profile-section {
    border-top: 1px solid var(--color-border);
    padding: 16px 16px;
    background: rgba(0, 0, 0, 0.15);
    position: relative;
    display: flex;
    flex-direction: column;
    transition: padding 0.25s;
}

.sidebar.collapsed .user-profile-section {
    padding: 16px 8px;
    align-items: center;
}

.user-profile-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    width: 100%;
}

.sidebar.collapsed .user-profile-trigger {
    justify-content: center;
    gap: 0;
}

.user-avatar-container {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(197, 168, 128, 0.15), rgba(126, 155, 180, 0.15));
    flex-shrink: 0;
    transition: border-color 0.2s;
}

.user-profile-trigger:hover .user-avatar-container {
    border-color: var(--color-gold);
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-initials {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
}

.user-info-wrapper {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
}

.user-display-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-display-email {
    font-size: 0.68rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.profile-chevron {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    transition: transform 0.2s, color 0.2s;
}

.user-profile-trigger:hover .profile-chevron {
    color: #fff;
}

.profile-chevron.rotated {
    transform: rotate(180deg);
}

/* Floating Profile Dropdown Menu */
.profile-dropdown-menu {
    position: absolute;
    bottom: 74px;
    left: 12px;
    width: calc(100% - 24px);
    background: rgba(17, 17, 21, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 150;
    animation: dropdownFadeUp 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .profile-dropdown-menu {
    left: 76px;
    bottom: 12px;
    width: 180px;
    animation: dropdownFadeRight 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownFadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: all 0.15s;
}

.dropdown-item i {
    font-size: 0.88rem;
    width: 16px;
    text-align: center;
    color: var(--color-text-muted);
    transition: color 0.15s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
}

.dropdown-item:hover i {
    color: var(--color-gold);
}

.dropdown-item.text-danger {
    color: var(--color-rose);
}

.dropdown-item.text-danger i {
    color: rgba(194, 136, 145, 0.7);
}

.dropdown-item.text-danger:hover {
    background: rgba(194, 136, 145, 0.1);
    color: #ffadb8;
}

.dropdown-item.text-danger:hover i {
    color: #ffadb8;
}

.dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 6px;
}


/* Main Workspace */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header bar with Navigation tabs inline */
.main-header {
    height: 80px;
    border-bottom: 1px solid var(--color-border);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: #08080a;
    gap: 20px;
}

.header-branding-area {
    display: flex;
    flex-direction: column;
    max-width: 320px;
}

.header-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
    color: #fff;
}

.header-subtitle {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

/* Navigation Tabs ("Upside") */
.top-nav-tabs {
    display: flex;
    gap: 8px;
    height: 100%;
    align-items: center;
}

.top-nav-item {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: 6px;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.88rem;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    gap: 8px;
}

.top-nav-item i {
    font-size: 0.95rem;
}

.top-nav-item:hover {
    background: rgba(255, 255, 255, 0.015);
    color: var(--color-text-primary);
}

.top-nav-item.active {
    background: rgba(197, 168, 128, 0.05);
    border-color: rgba(197, 168, 128, 0.2);
    color: var(--color-gold);
}

.top-nav-item.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.terminal-status-badges {
    display: flex;
    flex-shrink: 0;
}

.badge {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    color: var(--color-text-secondary);
}

.currency-badge {
    border-color: rgba(197, 168, 128, 0.2);
    color: var(--color-gold);
}

/* --- Tab Panels Content --- */
.tab-panels {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px 30px;
}

.tab-panel {
    display: none;
    height: 100%;
}

@keyframes panelFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-panel.active {
    display: block;
    animation: panelFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --- Cards & UI Elements --- */
.card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 24px;
}

.glass-card {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.card-header {
    margin-bottom: 20px;
}

.flex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.flex-header .card-header {
    margin-bottom: 0;
}

.card-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}

.card-desc {
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

/* --- Form Controls --- */
.form-group-row {
    display: flex;
    gap: 16px;
}

.form-group {
    flex-grow: 1;
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.74rem;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
    font-family: var(--font-heading);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    color: var(--color-text-primary);
    padding: 9px 12px;
    font-size: 0.85rem;
    font-family: var(--font-sans);
    outline: none;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: rgba(197, 168, 128, 0.4);
    box-shadow: 0 0 0 1px rgba(197, 168, 128, 0.1);
}

/* Input Suffix */
.input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-suffix .suffix {
    position: absolute;
    right: 12px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
}

.input-with-suffix .form-control {
    padding-right: 30px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.82rem;
    font-family: var(--font-heading);
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    outline: none;
}

.btn-primary {
    background-color: var(--color-gold);
    color: #000;
    box-shadow: 0 2px 8px rgba(197, 168, 128, 0.15);
}

.btn-primary:hover {
    background-color: #d6b88d;
    box-shadow: 0 2px 12px rgba(197, 168, 128, 0.25);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.02);
    border-color: var(--color-border);
    color: var(--color-text-primary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.btn-emerald {
    background-color: var(--color-emerald);
    color: #000;
    font-weight: 700;
}

.btn-emerald:hover {
    background-color: #89ae96;
}

.btn-full {
    width: 100%;
}

.btn-remove {
    background: transparent;
    border: none;
    color: var(--color-rose);
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.btn-remove:hover {
    transform: scale(1.1);
}

/* Benchmark selector group */
.benchmark-selector-group {
    display: flex;
    gap: 8px;
}

.benchmark-btn {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 9px;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 500;
    transition: all 0.2s ease;
}

.benchmark-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--color-text-primary);
}

.benchmark-btn.active {
    background: rgba(197, 168, 128, 0.05);
    border-color: rgba(197, 168, 128, 0.25);
    color: var(--color-gold);
}

/* --- SETUP GRID LAYOUT --- */
.setup-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
}

.ledger-card {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    min-height: 760px;
    overflow: hidden;
}

/* Ledger table header */
.ledger-table-header {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    padding: 12px 14px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.74rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
}

.col-ticker { width: 18%; }
.col-qty { width: 12%; }
.col-entry { width: 18%; }
.col-price { width: 16%; }
.col-amount { width: 18%; }
.col-exit { width: 14%; }
.col-action { width: 4%; text-align: center; }

/* Ledger dynamic container */
.ledger-rows-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.ledger-row {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.01);
    gap: 8px;
    animation: fadeIn 0.25s ease;
}

.ledger-row div {
    display: flex;
    align-items: center;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- DASHBOARD VIEW --- */
/* Scoreboard KPI grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 105px;
}

.kpi-label {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
}

.kpi-value-container {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 4px;
}

.kpi-value {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 1.45rem;
    letter-spacing: -0.5px;
}

.kpi-metric-suffix {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    font-weight: 600;
}

.kpi-subtext {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.text-gold { color: var(--color-gold); }
.text-blue { color: var(--color-blue); }
.text-rose { color: var(--color-rose); }

/* Dashboard chart layout split */
.dashboard-chart-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

.chart-container-card {
    padding: 16px 20px;
}

.canvas-chart-wrapper {
    height: 250px;
    position: relative;
    width: 100%;
}

.donut-chart-wrapper {
    height: 200px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.summary-ledger-card {
    padding: 18px 20px;
}

.summary-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
}

.summary-row.border-top {
    border-top: 1px solid var(--color-border);
    padding-top: 10px;
}

.row-label {
    color: var(--color-text-secondary);
}

.row-value {
    font-weight: 500;
}

/* --- STATS & DEEP DIVE --- */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.stats-left-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Table styling */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.terminal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.terminal-table th, .terminal-table td {
    padding: 10px 12px;
    text-align: left;
}

.terminal-table th {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.terminal-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.01);
}

.terminal-table tr:hover td {
    background: rgba(255, 255, 255, 0.005);
}

.text-bold { font-weight: 600; }
.font-mono { font-family: var(--font-mono); }
.text-muted { color: var(--color-text-muted); }

/* Correlation Heatmap Grid */
.heatmap-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-x: auto;
    padding: 15px 0;
    align-items: center; /* Centering the grid horizontally to use card space beautifully */
}

.heatmap-row {
    display: flex;
    gap: 6px;
}

.heatmap-cell {
    width: 95px;
    height: 85px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 6px; /* Premium smooth modern curves */
    font-family: var(--font-mono);
    font-size: 0.95rem; /* Larger, readable figures */
    font-weight: 600;
    color: #fff;
    cursor: default;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.heatmap-cell:hover {
    transform: scale(1.08); /* Prominent dynamic hover focus */
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.45);
}

.heatmap-cell-label {
    font-size: 0.68rem;
    opacity: 0.85;
    margin-bottom: 4px;
    font-family: var(--font-sans);
    letter-spacing: 0.3px;
}

/* OLS cards layout */
.ols-parameters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.ols-metric {
    background: rgba(255, 255, 255, 0.005);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 14px;
    display: flex;
    flex-direction: column;
}

.ols-metric-label {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
}

.ols-metric-value {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 4px;
}

.ols-metric-desc {
    font-size: 0.65rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.scatter-plot-wrapper {
    height: 300px;
    width: 100%;
    position: relative;
}

/* --- REGISTER TAB GRID VIRTUALIZATION --- */
.register-card-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    min-height: 520px;
    overflow: hidden;
    padding: 0;
}

.register-card-layout .card-header {
    padding: 20px 24px;
    margin-bottom: 0;
}

.register-actions-row {
    display: flex;
    gap: 16px;
    align-items: center;
}

/* Search Box Matte theme */
.search-box-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 230px;
}

.search-box-container .search-icon {
    position: absolute;
    left: 12px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.search-box-container .search-input {
    padding-left: 32px;
    height: 38px;
    font-size: 0.8rem;
}

/* Virtualized scrolling viewport grid layout rules */
.virtualized-grid-outer {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
}

.virtual-grid-headers {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    background: #09090c;
    padding-right: 6px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    height: 38px;
    align-items: center;
    flex-shrink: 0;
    overflow: hidden;
}

.virtual-grid-cell {
    width: 130px;
    flex-shrink: 0;
    padding: 0 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-mono);
}

.virtual-grid-cell.date-col {
    width: 135px;
    font-weight: 600;
}

.virtual-grid-scroll-viewport {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
}

.virtual-grid-stretcher {
    position: relative;
    width: max-content;
}

/* Single virtual absolute row styling */
.virtual-row {
    position: absolute;
    left: 0;
    width: 100%;
    height: 35px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.01);
    transition: background 0.15s ease;
}

.virtual-row:hover {
    background: rgba(255, 255, 255, 0.015);
}

.virtual-row.even {
    background: rgba(255, 255, 255, 0.003);
}

/* Utilities margin spacing */
.margin-top-sm { margin-top: 10px; }
.margin-top-md { margin-top: 20px; }

/* Ledger Footer Totals Summary Layout */
.ledger-footer {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-top: 1px solid var(--color-border);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--color-gold);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.ledger-footer div {
    display: flex;
    align-items: center;
}

.ledger-footer span {
    font-family: var(--font-mono);
    color: var(--color-text-primary);
    margin-left: 6px;
}

/* --- Premium Interactive Range Filters & Full Screen Modes --- */
.chart-actions-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.range-filter-buttons {
    display: flex;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 2px;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.02);
}

.filter-btn.active {
    background: rgba(197, 168, 128, 0.15);
    color: var(--color-gold);
}

.btn-chart-action {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-chart-action:hover {
    border-color: rgba(197, 168, 128, 0.4);
    color: var(--color-gold);
    background: rgba(197, 168, 128, 0.05);
}

/* Premium Fullscreen Overlay Mode */
.chart-container-card.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    z-index: 99999 !important;
    background: #06070a !important; /* Premium ultra-dark matte black */
    border: none !important;
    border-radius: 0 !important;
    padding: 30px 40px !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: none !important;
}

.chart-container-card.fullscreen .card-header {
    margin-bottom: 24px !important;
    flex-shrink: 0 !important;
}

.chart-container-card.fullscreen .canvas-chart-wrapper {
    flex-grow: 1 !important;
    height: calc(100vh - 140px) !important;
    width: 100% !important;
}

.scale-toggle-buttons {
    display: flex;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 2px;
}

.scale-btn {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.scale-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.02);
}

.scale-btn.active {
    background: rgba(197, 168, 128, 0.15);
    color: var(--color-gold);
}

/* --- Premium Synchronized Tooltip Styles --- */
.chart-container-card {
    position: relative !important; /* Ensure absolute positioning maps contextually */
}

.lwc-custom-tooltip {
    width: 260px;
    background: rgba(9, 13, 22, 0.95);
    border: 1px solid rgba(197, 168, 128, 0.25);
    border-radius: 6px;
    padding: 12px;
    color: #94a3b8;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    position: absolute;
    display: none;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    transition: opacity 0.1s ease;
}

.lwc-custom-tooltip .tooltip-date {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: #f8fafc;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 4px;
    margin-bottom: 6px;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.lwc-custom-tooltip .tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.lwc-custom-tooltip .tooltip-row:last-child {
    margin-bottom: 0;
}

.lwc-custom-tooltip .tooltip-series-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #cbd5e1;
}

.lwc-custom-tooltip .tooltip-series-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.lwc-custom-tooltip .tooltip-values {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.lwc-custom-tooltip .tooltip-val {
    font-family: 'Fira Code', monospace;
    color: #f1f5f9;
    font-size: 11px;
}

.lwc-custom-tooltip .tooltip-pct {
    font-family: 'Fira Code', monospace;
    font-weight: 600;
    margin-left: 8px;
    font-size: 11px;
    width: 60px;
    text-align: right;
}

/* ==========================================================================
    METRIC INFO ICON & FLOATING CALCULATION TOOLTIP
   ========================================================================== */

/* Inline ℹ icon next to each metric label */
.metric-info-icon {
    font-size: 0.65rem;
    color: var(--color-text-muted);
    margin-left: 5px;
    cursor: help;
    vertical-align: middle;
    transition: color 0.2s ease, transform 0.15s ease;
    display: inline-block;
}

.metric-info-icon:hover {
    color: var(--color-gold);
    transform: scale(1.2);
}

/* Global floating tooltip panel — positioned via JS, always on top */
#metric-calc-tooltip {
    display: none;
    position: fixed;
    z-index: 99999;
    max-width: 300px;
    background: rgba(8, 10, 18, 0.97);
    border: 1px solid rgba(197, 168, 128, 0.3);
    border-radius: 10px;
    padding: 12px 15px;
    pointer-events: none;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: tooltipFadeIn 0.12s ease;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Tooltip title line (metric name) */
#metric-calc-tooltip .mctt-label {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-gold);
    letter-spacing: 0.3px;
    margin-bottom: 7px;
    text-transform: uppercase;
}

/* Formula / calculation block */
#metric-calc-tooltip .mctt-formula {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: #a5b4c8;
    line-height: 1.65;
    border-left: 2px solid rgba(197, 168, 128, 0.35);
    padding-left: 9px;
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Plain-language description */
#metric-calc-tooltip .mctt-desc {
    font-family: var(--font-sans);
    font-size: 0.69rem;
    color: var(--color-text-secondary);
    line-height: 1.55;
}

/* ==========================================================================
    CHART ZOOM CONTROLS & INTERACTION HINT
   ========================================================================== */

/* Zoom button group — sits between range filters and fullscreen button */
.zoom-btn-group {
    display: flex;
    align-items: center;
    gap: 1px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 7px;
    padding: 2px;
    margin-left: 4px;
}

.btn-zoom {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    width: 26px;
    height: 26px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    transition: background 0.15s, color 0.15s;
}

.btn-zoom:hover {
    background: rgba(197, 168, 128, 0.12);
    color: var(--color-gold);
}

.btn-zoom:active {
    background: rgba(197, 168, 128, 0.22);
    transform: scale(0.92);
}

/* Interaction hint bar — shown below each chart canvas */
.chart-interaction-hint {
    text-align: center;
    font-size: 0.64rem;
    color: var(--color-text-muted);
    letter-spacing: 0.4px;
    padding: 4px 0 6px 0;
    opacity: 0.6;
    transition: opacity 0.2s;
    pointer-events: none;
    user-select: none;
}

.chart-container-card:hover .chart-interaction-hint {
    opacity: 1;
}

/* ==========================================================================
    ENHANCED LWC FLOATING TOOLTIP — PREMIUM REDESIGN
   ========================================================================== */

/* Override the base tooltip width and layout */
.lwc-custom-tooltip {
    position: absolute;
    display: none;
    z-index: 9000;
    width: 280px;
    background: rgba(7, 9, 15, 0.96) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-top: 2px solid rgba(197, 168, 128, 0.5) !important;
    border-radius: 10px !important;
    padding: 0 !important;
    box-shadow: 0 8px 40px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.03) inset !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    overflow: hidden;
    pointer-events: none;
    font-family: var(--font-sans) !important;
}

/* Date header strip */
.lwc-custom-tooltip .tooltip-date {
    font-size: 0.68rem !important;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--color-gold) !important;
    background: rgba(197, 168, 128, 0.07);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 7px 12px !important;
}

/* Value block with INR price */
.tooltip-inr-value {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 600;
    color: #f1f5f9;
    line-height: 1;
    margin-bottom: 2px;
}

.tooltip-inr-label {
    font-size: 0.64rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Section divider inside tooltip */
.tooltip-section-divider {
    height: 1px;
    background: rgba(255,255,255,0.05);
    margin: 6px 0;
}

/* Rows inside tooltip body */
.lwc-custom-tooltip .tooltip-body {
    padding: 8px 12px;
}

.lwc-custom-tooltip .tooltip-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 5px !important;
    gap: 8px;
}

.lwc-custom-tooltip .tooltip-row:last-child {
    margin-bottom: 0 !important;
}

.lwc-custom-tooltip .tooltip-series-name {
    display: flex !important;
    align-items: center !important;
    gap: 6px;
    font-size: 0.71rem;
    color: #94a3b8;
    flex-shrink: 0;
}

.lwc-custom-tooltip .tooltip-series-dot {
    width: 7px !important;
    height: 7px !important;
    border-radius: 50% !important;
    display: inline-block !important;
    flex-shrink: 0;
}

.lwc-custom-tooltip .tooltip-values {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px;
}

.lwc-custom-tooltip .tooltip-val {
    font-family: var(--font-mono) !important;
    color: #f1f5f9 !important;
    font-size: 0.78rem !important;
    font-weight: 500;
}

.lwc-custom-tooltip .tooltip-pct {
    font-family: var(--font-mono) !important;
    font-weight: 600 !important;
    font-size: 0.72rem !important;
    width: 62px !important;
    text-align: right !important;
}

/* Daily return footer strip inside tooltip */
.tooltip-daily-row {
    background: rgba(255,255,255,0.025);
    border-top: 1px solid rgba(255,255,255,0.05);
    padding: 6px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.66rem;
    color: var(--color-text-muted);
}

.tooltip-daily-val {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
}

/* --- Ticker Browser & Autocomplete Premium Styling --- */
.col-ticker {
    position: relative;
}

.pos-ticker {
    padding-right: 32px !important;
}

.ticker-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 0.8rem;
    pointer-events: none;
    transition: color 0.2s ease;
}

.pos-ticker:focus ~ .ticker-search-icon {
    color: var(--color-gold);
}

.ticker-autocomplete-dropdown,
.benchmark-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    max-height: 250px;
    background: rgba(17, 17, 21, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(197, 168, 128, 0.25);
    border-radius: 6px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.65);
    display: none;
}

.ticker-autocomplete-item,
.benchmark-autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ticker-autocomplete-item:last-child,
.benchmark-autocomplete-item:last-child {
    border-bottom: none;
}

.ticker-autocomplete-item:hover,
.ticker-autocomplete-item.active,
.benchmark-autocomplete-item:hover,
.benchmark-autocomplete-item.active {
    background: rgba(197, 168, 128, 0.08);
}

.ticker-item-meta,
.benchmark-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ticker-item-symbol,
.benchmark-item-symbol {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-gold);
}

.ticker-item-exch,
.benchmark-item-exch {
    font-size: 0.65rem;
    color: var(--color-gold);
    font-family: var(--font-mono);
    background: rgba(197, 168, 128, 0.1);
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid rgba(197, 168, 128, 0.25);
}

.ticker-item-name,
.benchmark-item-name {
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#benchmark-input:focus ~ .benchmark-search-icon {
    color: var(--color-gold);
}

/* Premium Glassmorphic Toast/Popup Notification */
.toast-popup {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(17, 17, 21, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(197, 168, 128, 0.35);
    border-radius: 8px;
    padding: 16px 24px;
    color: var(--color-text);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 2000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: none;
}

.toast-popup.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-icon {
    font-size: 1.2rem;
}

.text-emerald {
    color: #10b981 !important;
}

.text-rose {
    color: #f43f5e !important;
}

/* Register side-by-side split layout */
.register-split-container {
    display: flex;
    gap: 16px;
    align-items: stretch;
    width: 100%;
}

.flex-main-grid {
    flex-grow: 1;
    flex-basis: 0;
    min-width: 0; /* Ensures virtual grid doesn't blow past layout constraints */
}

.sidebar-coverage-card {
    width: 330px;
    height: calc(100vh - 180px);
    min-height: 520px;
    flex-shrink: 0;
    margin-bottom: 0 !important; /* Resets vertical spacer */
    display: flex;
    flex-direction: column;
}

.sidebar-coverage-card .table-responsive {
    flex-grow: 1;
    overflow-y: auto;
    padding: 12px;
}

.compact-coverage-table th, 
.compact-coverage-table td {
    padding: 8px 6px !important;
    vertical-align: middle;
}
@media (max-width: 1200px) {
    .setup-grid {
        grid-template-columns: 1fr;
    }
    .ledger-card {
        height: auto;
        min-height: 480px;
    }
    .register-split-container {
        flex-direction: column;
    }
    .sidebar-coverage-card {
        width: 100%;
        height: auto;
        min-height: unset;
    }
}

/* Interactive Sortable Header Elements */
.sortable-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    position: relative;
    padding-right: 20px;
}

.sortable-table th.sortable:hover {
    color: var(--color-gold) !important;
    background: rgba(255, 255, 255, 0.02);
}

.sortable-table th.sortable i {
    margin-left: 6px;
    font-size: 0.7rem;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sortable-table th.sortable.active-sort {
    color: var(--color-gold) !important;
    border-bottom: 2px solid var(--color-gold) !important;
}

/* Redesigned Performance Attribution Layout Elements */
.overall-summary-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.summary-kpi-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(10, 15, 26, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.03) !important;
}

.summary-kpi-card .kpi-label {
    font-size: 0.68rem;
    font-family: var(--font-heading);
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.summary-kpi-card .kpi-value {
    font-size: 1.15rem;
    font-weight: 700;
}

.summary-metrics-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.012);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.summary-metrics-bar .metric-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-metrics-bar .metric-label {
    font-size: 0.65rem;
    font-family: var(--font-heading);
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 600;
    letter-spacing: 0.03em;
}

.summary-metrics-bar .metric-val {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
}

@media (max-width: 1400px) {
    .overall-summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .overall-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .overall-summary-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
    MODULE 6: PREMIUM GLASSMORPHIC AUTHENTICATION MODAL & NAV USER BADGES
   ========================================================================== */

/* Fade-in for backdrop overlay */
@keyframes modalOverlayFadeIn {
    from { opacity: 0; backdrop-filter: blur(0px); }
    to   { opacity: 1; backdrop-filter: blur(12px); }
}

/* Sleek slide-up for glass modal card */
@keyframes modalContentSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 5, 10, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
    box-sizing: border-box;
    animation: modalOverlayFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-modal-card {
    width: 100%;
    max-width: 410px;
    background: rgba(10, 15, 26, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-top: 3px solid var(--color-gold) !important;
    box-shadow: 
        0 24px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset !important;
    border-radius: 12px !important;
    padding: 30px !important;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    animation: modalContentSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    box-sizing: border-box;
}

.auth-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.auth-modal-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-modal:hover {
    color: var(--color-rose);
    transform: scale(1.1);
}

/* Premium Segmented Auth Tabs Selector */
.auth-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 3px;
    margin-bottom: 24px;
}

.auth-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.auth-tab-btn:hover {
    color: #fff;
}

.auth-tab-btn.active {
    background: rgba(197, 168, 128, 0.15);
    color: var(--color-gold);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Custom form tweaks inside modal */
.auth-form-body {
    display: flex;
    flex-direction: column;
}

.auth-error-container {
    animation: modalContentSlideUp 0.2s ease;
}

.auth-divider span {
    font-family: var(--font-heading);
    font-size: 0.65rem;
    letter-spacing: 0.05em;
}

/* User header status profile badge overrides */
.user-badge {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--color-text-secondary);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 500;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.user-badge:hover {
    background: rgba(197, 168, 128, 0.06);
    border-color: rgba(197, 168, 128, 0.3);
    color: var(--color-gold);
}

/* Glowing Neon Indicator Authenticated badge state */
.user-badge.authenticated {
    background: rgba(16, 185, 129, 0.05) !important;
    border-color: rgba(16, 185, 129, 0.25) !important;
    color: var(--color-emerald) !important;
    position: relative;
    padding-left: 20px;
}

.user-badge.authenticated::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

/* Save to Cloud custom transitions */
.btn-cloud {
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.btn-cloud:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

/* ==========================================================================
    MODULE 7: SAVED PORTFOLIOS DRAWER & DROPDOWN SELECTOR STYLES
   ========================================================================== */

/* Top header dropdown selector */
.portfolio-dropdown {
    font-family: var(--font-heading);
    font-weight: 500;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.portfolio-dropdown:hover {
    border-color: rgba(197, 168, 128, 0.4) !important;
    background: rgba(30, 30, 30, 0.8) !important;
    box-shadow: 0 0 8px rgba(197, 168, 128, 0.15);
}

.portfolio-dropdown:focus {
    border-color: var(--color-gold) !important;
    box-shadow: 0 0 12px rgba(197, 168, 128, 0.3);
}

.portfolio-dropdown option {
    background: #111115;
    color: var(--color-text);
    padding: 8px;
}

/* Sliding Drawer Overlay */
@keyframes drawerOverlayFadeIn {
    from { opacity: 0; backdrop-filter: blur(0px); }
    to   { opacity: 1; backdrop-filter: blur(8px); }
}

@keyframes drawerSlideIn {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 5, 10, 0.6);
    display: flex;
    justify-content: flex-end;
    z-index: 99990;
    animation: drawerOverlayFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Sliding Drawer Panel */
.portfolios-drawer-panel {
    width: 100%;
    max-width: 440px;
    height: 100%;
    background: rgba(8, 10, 18, 0.95) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-top: none !important;
    border-bottom: none !important;
    border-right: none !important;
    border-radius: 0px !important;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.8) !important;
    padding: 30px !important;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    animation: drawerSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Custom Scrollbar for Drawer Body */
.drawer-body::-webkit-scrollbar {
    width: 6px;
}

.drawer-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

.drawer-body::-webkit-scrollbar-thumb {
    background: rgba(197, 168, 128, 0.2);
    border-radius: 3px;
    transition: background 0.2s;
}

.drawer-body::-webkit-scrollbar-thumb:hover {
    background: rgba(197, 168, 128, 0.4);
}

/* Saved Portfolios List & Named Cards */
.portfolios-list {
    margin-top: 5px;
    padding-bottom: 20px;
}

.portfolio-card {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 8px !important;
    padding: 16px !important;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.portfolio-card:hover {
    background: rgba(197, 168, 128, 0.03) !important;
    border-color: rgba(197, 168, 128, 0.3) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Loaded active state card highlights */
.portfolio-card.active {
    border-left: 3px solid var(--color-gold) !important;
    background: rgba(197, 168, 128, 0.05) !important;
    border-color: rgba(197, 168, 128, 0.35) !important;
}

.portfolio-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.portfolio-card-title {
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0;
    line-height: 1.4;
    word-break: break-word;
}

.portfolio-card.active .portfolio-card-title {
    color: var(--color-gold);
}

.portfolio-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Card Segmented Action Buttons */
.btn-card-action {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--color-text-secondary);
    width: 26px;
    height: 26px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-card-action:hover {
    background: rgba(197, 168, 128, 0.12);
    color: var(--color-gold);
    border-color: rgba(197, 168, 128, 0.3);
    transform: scale(1.08);
}

.btn-card-action.btn-delete:hover {
    background: rgba(244, 63, 94, 0.12) !important;
    color: var(--color-rose) !important;
    border-color: rgba(244, 63, 94, 0.3) !important;
}

.btn-card-action:active {
    transform: scale(0.92);
}

/* Grid Meta Badge Layout */
.portfolio-card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 10px;
}

.meta-item {
    font-size: 0.68rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    color: var(--color-text-muted);
}

.meta-label {
    text-transform: uppercase;
    font-family: var(--font-heading);
    font-weight: 500;
    letter-spacing: 0.2px;
}

.meta-val {
    font-family: var(--font-mono);
    color: #cbd5e1;
    font-weight: 500;
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}

.portfolio-card.active .meta-val {
    color: #fff;
}


/* ==========================================================================
    Onboarding Welcome Modal Premium Styling
   ========================================================================== */
.welcome-modal-card {
    width: 100%;
    max-width: 580px;
    background: rgba(10, 15, 26, 0.78) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-top: 3px solid var(--color-gold) !important;
    box-shadow: 
        0 24px 60px rgba(0, 0, 0, 0.75),
        0 0 40px rgba(197, 168, 128, 0.06),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset !important;
    border-radius: 16px !important;
    padding: 36px !important;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    animation: modalContentSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    box-sizing: border-box;
}

.welcome-modal-header-branding {
    text-align: center;
    margin-bottom: 24px;
}

.welcome-logo {
    width: 60px;
    height: 60px;
    background: rgba(197, 168, 128, 0.08);
    border: 1px solid rgba(197, 168, 128, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
    box-shadow: 0 0 20px rgba(197, 168, 128, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.welcome-logo:hover {
    transform: rotate(15deg) scale(1.05);
    box-shadow: 0 0 30px rgba(197, 168, 128, 0.2);
}

.welcome-logo-icon {
    font-size: 1.8rem;
}

.welcome-title {
    font-family: var(--font-heading);
    font-size: 1.7rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin: 0 0 6px 0;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, var(--color-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
    font-size: 0.88rem;
    color: var(--color-text-secondary);
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.welcome-body {
    margin-bottom: 30px;
}

.welcome-intro-text {
    font-size: 0.88rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    text-align: center;
    margin-bottom: 22px;
}

.welcome-section-title {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-gold);
    margin: 0 0 14px 0;
    font-weight: 600;
}

.welcome-features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.welcome-feature-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    transition: all 0.25s ease;
}

.welcome-feature-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(197, 168, 128, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.welcome-grid-full-width {
    grid-column: span 2;
}

.welcome-feature-icon-container {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.welcome-feature-item:hover .welcome-feature-icon-container {
    background: rgba(197, 168, 128, 0.08);
    border-color: rgba(197, 168, 128, 0.25);
    box-shadow: 0 0 10px rgba(197, 168, 128, 0.1);
}

.welcome-feature-icon-container i {
    font-size: 0.95rem;
}

.welcome-feature-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.welcome-feature-text h5 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.welcome-feature-text p {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    line-height: 1.4;
    margin: 0;
}

.welcome-footer {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.welcome-btn-primary {
    font-weight: 600;
    letter-spacing: 0.5px;
    height: 46px;
    font-size: 0.95rem;
    background: linear-gradient(135deg, var(--color-gold) 0%, #ab916b 100%) !important;
    border: none !important;
    color: #070709 !important;
    box-shadow: 0 4px 15px rgba(197, 168, 128, 0.2);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.welcome-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(197, 168, 128, 0.35);
    filter: brightness(1.1);
}

.welcome-secondary-actions {
    display: flex;
    gap: 12px;
}

.welcome-btn-secondary {
    flex: 1;
    font-weight: 500;
    height: 40px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    color: var(--color-text-secondary) !important;
    transition: all 0.25s ease !important;
}

.welcome-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: var(--color-text-primary) !important;
    transform: translateY(-1px);
}

/* Onboarding Responsive Breakpoints */
@media (max-width: 640px) {
    .welcome-modal-card {
        padding: 24px !important;
    }
    .welcome-features-grid {
        grid-template-columns: 1fr;
    }
    .welcome-grid-full-width {
        grid-column: span 1;
    }
    .welcome-title {
        font-size: 1.45rem;
    }
}

/* --- Responsive Layout Upgrades --- */
@media (max-width: 1024px) {
    .dashboard-chart-layout,
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
    MODULE 7: GUIDED ONBOARDING TOUR STYLE SHEETS
   ========================================================================== */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 5, 10, 0.3);
    z-index: 999999;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tour-highlight-zone {
    position: absolute;
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(3, 5, 10, 0.72);
    border: 2px solid var(--color-gold);
    pointer-events: auto;
    z-index: 999999;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tour-tooltip {
    position: absolute;
    width: 320px;
    background: rgba(10, 15, 26, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-top: 3px solid var(--color-gold) !important;
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset !important;
    border-radius: 12px !important;
    padding: 20px !important;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    pointer-events: auto;
    z-index: 1000000;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tour-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tour-tooltip-header h4 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: #fff;
    margin: 0;
    font-weight: 600;
}

.tour-step-indicator {
    font-size: 0.75rem;
    color: var(--color-gold);
    font-weight: 600;
    font-family: var(--font-mono);
}

.tour-tooltip-body p {
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
    margin: 0;
}

.tour-tooltip-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.tour-nav-btns {
    display: flex;
    gap: 8px;
}

#btn-tour-skip {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-family: var(--font-heading);
    font-weight: 500;
    transition: color 0.2s;
}
#btn-tour-skip:hover {
    color: var(--color-rose);
}

/* ==========================================================================
    MODULE 8: PREMIUM APPLICATION FOOTER
   ========================================================================== */
.app-footer {
    margin-top: 40px;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(10, 15, 26, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 8px;
}

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

.footer-copyright {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin: 0;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-links a {
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--color-gold);
}

.footer-separator {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

#btn-toggle-account-password {
    transition: color 0.2s ease;
}

#btn-toggle-account-password:hover {
    color: var(--color-gold) !important;
}

