/* ==========================================================================
   NovaPlan Design System & Global Stylesheet
   ========================================================================== */

/* --- Custom Variables & Tokens --- */
:root {
    --bg-main: #060913;
    --bg-sidebar: #0b0f1e;
    --bg-card: rgba(16, 22, 38, 0.65);
    --bg-card-hover: rgba(22, 30, 52, 0.8);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --bg-header: rgba(11, 15, 30, 0.65);
    --bg-footer: rgba(11, 15, 30, 0.5);
    
    /* Harmonious Palette (Tailored HSL) */
    --primary: #10b981;          /* Emerald accent */
    --primary-rgb: 16, 185, 129;
    --secondary: #0ea5e9;        /* Sky Blue accent */
    --secondary-rgb: 14, 165, 233;
    --accent: #f59e0b;           /* Gold/Amber */
    --accent-rgb: 245, 158, 11;
    --danger: #ef4444;           /* Coral red */
    --danger-rgb: 239, 68, 68;
    
    /* Text colors */
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #1f2937;
    
    /* Shadows & Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 15px rgba(16, 185, 129, 0.2);
    --glass-blur: blur(14px);
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition-speed: 0.25s;
}

/* --- Light Theme Variables & Overrides --- */
body.light-theme {
    --bg-main: #f3f4f6;
    --bg-sidebar: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-card-hover: rgba(255, 255, 255, 0.9);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --text-main: #111827;
    --text-muted: #6b7280;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.08);
    --bg-header: rgba(255, 255, 255, 0.75);
    --bg-footer: rgba(255, 255, 255, 0.6);
}

body.light-theme .progress-bar-bg {
    background-color: rgba(0, 0, 0, 0.06);
}

body.light-theme .tracker-milestones-list {
    background: rgba(0, 0, 0, 0.03) !important;
}

body.light-theme .logo-text {
    background: linear-gradient(135deg, var(--text-main) 40%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-theme .form-input,
body.light-theme .psf-input {
    background-color: rgba(0, 0, 0, 0.03);
}

body.light-theme .form-input:focus,
body.light-theme .psf-input:focus {
    background-color: rgba(0, 0, 0, 0.01);
}

body.light-theme select.form-input {
    color-scheme: light;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

body.light-theme select.form-input option {
    background: #ffffff;
    color: #111827;
}

body.light-theme select.form-input option:hover,
body.light-theme select.form-input option:focus,
body.light-theme select.form-input option:checked {
    background: #e5e7eb;
    color: #10b981;
}

body.light-theme .whitepaper-container h3,
body.light-theme .whitepaper-container .math-formula,
body.light-theme .whitepaper-container select {
    color: var(--text-main) !important;
    background-color: var(--bg-sidebar) !important;
}

/* --- Base Reset & Setup --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Hide number input spinners globally */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button,
::-webkit-outer-spin-button,
::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}
input[type=number],
.cashflow-number-input,
.debt-balance-input,
.debt-rate-input,
.debt-min-payment-input,
.custom-inflow-number-input,
.custom-outflow-number-input {
    -webkit-appearance: none !important;
    -moz-appearance: textfield !important;
    appearance: none !important;
}

.btn-restore-default {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.72rem;
    padding: 3px 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.btn-restore-default:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Base Layout --- */
.app-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    justify-content: space-between;
    height: 100%;
    min-width: 300px;
    width: 300px;
    overflow: hidden;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
}

.logo-icon {
    font-size: 2rem;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 40%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 12px 14px;
    width: 100%;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    transition: all var(--transition-speed) ease;
    white-space: nowrap;
    overflow: hidden;
}

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

.nav-btn.active {
    color: var(--text-main);
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.02) 100%);
    box-shadow: inset 3px 0 0 var(--primary);
}

/* Sidebar Nav Dropdown collapsible menu */
.nav-dropdown {
    position: relative;
    display: flex;
    flex-direction: column;
}

.nav-dropdown .dropdown-menu {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 8px;
    border-left: 1px dashed var(--border-color);
    margin-left: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown.active .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
    max-height: 250px;
    opacity: 1;
    margin-top: 4px;
    margin-bottom: 4px;
}

/* Auto-expand dropdown menu if any of its children is active */
.nav-dropdown:has(.nav-btn.active) .dropdown-menu {
    max-height: 250px;
    opacity: 1;
    margin-top: 4px;
    margin-bottom: 4px;
}

.nav-dropdown:hover .arrow-icon,
.nav-dropdown.active .arrow-icon,
.nav-dropdown:has(.nav-btn.active) .arrow-icon {
    transform: rotate(180deg);
}

.nav-dropdown:has(.nav-btn.active) .dropdown-toggle {
    color: var(--text-main);
}

.nav-btn.submenu-btn {
    padding: 8px 10px;
    font-size: 0.88rem;
}

.nav-btn.submenu-btn .material-symbols-outlined {
    font-size: 1.15rem;
}

body.light-theme .nav-dropdown .dropdown-menu {
    border-left-color: rgba(0, 0, 0, 0.12);
}

.nav-btn.active .material-symbols-outlined {
    color: var(--primary);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary);
}

.dot.pulse {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    color: white;
    box-shadow: var(--shadow-sm);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.username {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.plan {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
}

.btn-hamburger {
    display: none;
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(4, 6, 12, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* --- Main Content Area --- */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.app-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-header);
    backdrop-filter: var(--glass-blur);
    z-index: 10;
}

.header-left h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
}

.header-left p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

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

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

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: #0d9668;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

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

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

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

/* --- Main Views Container --- */
.view-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 32px;
    background: radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.04) 0%, transparent 45%),
                radial-gradient(circle at 10% 80%, rgba(14, 165, 233, 0.03) 0%, transparent 40%);
}

/* --- Components & Reusables --- */
.glass-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    backdrop-filter: var(--glass-blur);
    padding: 24px;
    transition: transform var(--transition-speed) ease, border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.glass-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* --- Dashboard Specific Styling --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.kpi-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 128px;
    height: auto;
    padding: 18px 20px !important;
    box-sizing: border-box;
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kpi-label .icon {
    font-size: 1.25rem;
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 8px 0;
    color: var(--text-main);
}

.kpi-trend {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-trend.positive {
    color: var(--primary);
}

.kpi-trend.negative {
    color: var(--danger);
}

.kpi-trend.neutral {
    color: var(--text-muted);
}

/* Dashboard Columns */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.dashboard-assets-liabilities-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.dashboard-card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.dashboard-card-title span.material-symbols-outlined {
    color: var(--primary);
}

/* Milestone Achievement Cards */
.milestones-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.tracker-milestones-list {
    background: rgba(0, 0, 0, 0.15);
}

.milestone-card {
    position: relative;
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.02);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.milestone-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.milestone-card.achieved {
    border-color: rgba(16,185,129,0.35);
    background: rgba(16,185,129,0.04);
    box-shadow: 0 0 20px rgba(16,185,129,0.08);
}

.milestone-card.achieved::before {
    content: '';
    position: absolute;
    top: 0; left: -60%;
    width: 40%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0%   { left: -60%; }
    100% { left: 140%; }
}

.milestone-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.milestone-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.milestone-card-title {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-main);
    line-height: 1.3;
}

.milestone-card-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

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

.milestone-progress-wrap {
    flex: 1;
    margin-right: 10px;
}

.milestone-progress-bar {
    height: 5px;
    border-radius: 99px;
    background: rgba(255,255,255,0.07);
    overflow: hidden;
}

.milestone-progress-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.6s ease;
}

.milestone-pct {
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.milestone-target-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.milestone-achieved-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #10b981;
    background: rgba(16,185,129,0.12);
    padding: 3px 8px;
    border-radius: 99px;
}

/* Milestone Roadmap Timeline */
.milestone-roadmap {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 10px 16px 10px;
    padding: 0 10px;
}

.milestone-roadmap::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 20px;
    right: 20px;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    z-index: 1;
}

.milestone-roadmap-fill {
    position: absolute;
    top: 24px;
    left: 20px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 99px;
    z-index: 2;
    transition: width 0.6s ease-in-out;
}

.roadmap-step {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 3;
    flex: 1;
}

.roadmap-dot {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #111622;
    border: 2px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.roadmap-step.achieved .roadmap-dot {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.roadmap-step.active .roadmap-dot {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
    animation: dot-pulse 2s infinite;
}

@keyframes dot-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.roadmap-label {
    margin-top: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s;
}

.roadmap-step.achieved .roadmap-label {
    color: #10b981;
}

.roadmap-step.active .roadmap-label {
    color: var(--primary);
}

@media (max-width: 600px) {
    .roadmap-label {
        display: none;
    }
    .roadmap-dot {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    .milestone-roadmap::before, .milestone-roadmap-fill {
        top: 18px;
    }
}

/* Asset Allocation / Summary */
.summary-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.summary-label {
    color: var(--text-muted);
}

.summary-value {
    font-weight: 600;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

.bg-primary { background-color: var(--primary); }
.bg-secondary { background-color: var(--secondary); }
.bg-accent { background-color: var(--accent); }
.bg-danger { background-color: var(--danger); }

/* --- Cashflow View --- */
.cashflow-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.input-with-symbol {
    position: relative;
    display: flex;
    align-items: center;
}

.input-symbol {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.form-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

/* Native <select> dark-mode fix — browser option lists otherwise inherit OS light theme */
select.form-input {
    color-scheme: dark;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

select.form-input option {
    background: #111827;
    color: #e2e8f0;
    padding: 8px 12px;
    font-size: 0.9rem;
}

select.form-input option:hover,
select.form-input option:focus,
select.form-input option:checked {
    background: #1e293b;
    color: #10b981;
}

.range-slider-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.range-slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Custom range sliders */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

body.light-theme input[type="range"] {
    background: rgba(0, 0, 0, 0.12) !important;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--primary);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type="range"]:active::-webkit-slider-thumb {
    transition: none !important;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background-color: var(--primary);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    transition: transform 0.1s ease;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
}

input[type="range"]:active::-moz-range-thumb {
    transition: none !important;
}

/* Cashflow Canvas Flow */
.flow-canvas-container {
    width: 100%;
    position: relative;
}

.flow-svg {
    width: 100%;
    height: auto;
    display: block;
    direction: ltr;
}

.flow-node {
    fill: var(--bg-card);
    stroke: var(--border-color);
    stroke-width: 1.5;
    rx: 8;
    ry: 8;
    transition: all var(--transition-speed) ease;
}

.flow-node:hover {
    stroke: var(--border-hover);
}

.flow-node-text {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    fill: var(--text-muted);
    font-weight: 500;
}

.flow-node-value {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    fill: var(--text-main);
    font-weight: 700;
}

.flow-line {
    fill: none;
    stroke-linecap: round;
    opacity: 0.25;
    transition: stroke-width 0.3s ease;
}

.flow-line.flow-primary {
    stroke: var(--primary);
}

.flow-line.flow-secondary {
    stroke: var(--secondary);
}

.flow-line.flow-accent {
    stroke: var(--accent);
}

.flow-line.flow-danger {
    stroke: var(--danger);
}

.flow-line-animation {
    fill: none;
    stroke-dasharray: 8, 12;
    animation: flow-dash 35s linear infinite;
    opacity: 0.7;
}

.flow-line-animation.flow-primary { stroke: var(--primary); }
.flow-line-animation.flow-secondary { stroke: var(--secondary); }
.flow-line-animation.flow-accent { stroke: var(--accent); }
.flow-line-animation.flow-danger { stroke: var(--danger); }

@keyframes flow-dash {
    to {
        stroke-dashoffset: -1000;
    }
}

/* --- Scenario Sandbox --- */
.sandbox-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
}

.scenario-selector {
    display: flex;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    gap: 4px;
}

.scenario-tab {
    flex-grow: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px 12px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.scenario-tab:hover {
    color: var(--text-main);
}

.scenario-tab.active {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

.sandbox-chart-container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

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

.chart-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.1rem;
}

.chart-legend {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.svg-chart {
    width: 100%;
    height: 380px;
    background: rgba(255, 255, 255, 0.01);
    border-radius: var(--radius-md);
    overflow: visible;
    direction: ltr;
}

.chart-axis-line {
    stroke: var(--border-hover);
    stroke-width: 1;
}

.chart-grid-line {
    stroke: var(--border-color);
    stroke-width: 1;
    stroke-dasharray: 4, 4;
}

.chart-axis-text {
    font-size: 0.7rem;
    fill: var(--text-muted);
}

.chart-path {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    transition: d 0.3s ease;
}

.chart-area {
    opacity: 0.08;
    transition: d 0.3s ease;
}

.chart-marker {
    stroke-width: 2;
    transition: cx 0.3s ease, cy 0.3s ease;
}

.chart-tooltip-line {
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 1.5;
    stroke-dasharray: 3, 3;
}

/* Custom chart tooltip overlay */
.chart-tooltip-box {
    position: absolute;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    pointer-events: none;
    box-shadow: var(--shadow-md);
    font-size: 0.8rem;
    display: none;
    z-index: 100;
}

.tooltip-year {
    font-weight: 700;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
    color: var(--text-muted);
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 2px 0;
}

.tooltip-label {
    color: var(--text-muted);
}

.tooltip-val {
    font-weight: 600;
    color: var(--text-main);
}

/* --- Debt Paydown View --- */
.debt-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
}

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

.debt-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 380px;
    overflow-y: auto;
    margin-bottom: 16px;
    padding-right: 4px;
}

.debt-card {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr auto;
    align-items: center;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.debt-card-name {
    font-weight: 600;
}

.debt-card-val {
    color: var(--text-main);
}

.debt-card-rate {
    color: var(--text-muted);
}

.btn-icon-only {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-icon-only:hover {
    color: var(--danger);
    background-color: rgba(239, 68, 68, 0.1);
}

.debt-input-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr) auto;
    gap: 10px;
    align-items: flex-end;
    background: rgba(255, 255, 255, 0.01);
    border: 1px dashed var(--border-color);
    padding: 16px;
    border-radius: var(--radius-md);
}

.debt-input-grid .form-group {
    margin-bottom: 0;
}

.debt-comparison-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.debt-comparison-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.strategy-card {
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.015);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.strategy-card.selected {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.02);
}

.strategy-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
}

.strategy-metric {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.strategy-metric-label {
    color: var(--text-muted);
}

.strategy-metric-val {
    font-weight: 600;
}

.strategy-highlight {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
}

.strategy-highlight.snowball {
    color: var(--secondary);
}

/* Empty view state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    gap: 12px;
}

.empty-state span.material-symbols-outlined {
    font-size: 3rem;
    color: var(--border-hover);
}

/* Custom dialog or helper styles */
.sandbox-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

/* --- Responsive Adjustments --- */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid, .dashboard-assets-liabilities-grid {
        grid-template-columns: 1fr;
    }
    
    .cashflow-layout, .sandbox-layout, .debt-layout {
        grid-template-columns: 1fr;
    }

    .kpi-value {
        font-size: 1.55rem !important;
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: flex !important;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 300px;
        max-width: 80vw;
        z-index: 2000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
        background: var(--bg-sidebar);
        backdrop-filter: var(--glass-blur);
        border-right: 1px solid var(--border-color);
        border-left: none;
        overflow-y: auto;
    }
    
    [dir="rtl"] .sidebar {
        left: auto;
        right: 0;
        transform: translateX(100%);
        border-left: 1px solid var(--border-color);
        border-right: none;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    .btn-hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: var(--text-main);
        cursor: pointer;
        padding: 8px;
        margin-right: 8px;
        border-radius: 50%;
        transition: background-color 0.2s;
    }
    .btn-hamburger:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }
    body.light-theme .btn-hamburger:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }
    
    .app-header {
        padding: 0 16px;
    }
    
    .view-container {
        padding: 16px;
    }

    .kpi-value {
        font-size: 1.4rem !important;
    }
}

/* --- Authentication & Login Card Styles --- */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(4, 6, 12, 0.55);
    backdrop-filter: blur(6px) saturate(140%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fade-in 0.3s ease-out;
}

/* Guest login button pulsing micro-animation */
#btn-guest-login {
    animation: guest-pulse 2.5s infinite ease-in-out;
    transition: all 0.25s ease !important;
}

#btn-guest-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    border-style: solid !important;
    animation: none; /* Stop pulsing on hover */
}

@keyframes guest-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 0 12px 4px rgba(99, 102, 241, 0.2);
    }
}

.login-card {
    max-width: 420px;
    width: 90%;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(16, 22, 38, 0.75);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(16, 185, 129, 0.1);
    padding: 36px 32px;
    animation: scale-up 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo-icon {
    font-size: 2.8rem;
    color: var(--primary);
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    margin-bottom: 12px;
    display: inline-block;
}

.login-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

#login-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex-grow: 1;
    height: 1px;
    background-color: var(--border-color);
}

.login-divider span {
    padding: 0 12px;
}

.btn-google {
    transition: all 0.2s ease !important;
}

.btn-google:hover {
    background-color: #f3f4f6 !important;
    border-color: #9ca3af !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scale-up {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- Spin Animation --- */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.spin {
    animation: spin 1.2s linear infinite;
    display: inline-block;
}

/* --- User Profile Section Styles --- */
.profile-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fade-in var(--transition-speed) ease;
    padding-bottom: 40px;
}

.profile-card-horizontal {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: var(--glass-blur);
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
}

.profile-identity {
    flex-grow: 1;
}

.profile-email {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.profile-section-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.profile-details-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
}

.profile-detail-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-detail-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

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

.profile-achievements-progress-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.profile-progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 8px;
}

.profile-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
    border-radius: var(--radius-sm);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-milestones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.profile-milestone-card {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    transition: all 0.25s ease;
    cursor: pointer;
}

.profile-milestone-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.025);
    border-color: rgba(255, 255, 255, 0.1);
}

.profile-milestone-card.achieved {
    border-color: rgba(16, 185, 129, 0.2);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.02) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.profile-milestone-card.achieved::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--primary);
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
}

.profile-milestone-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-milestone-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.profile-milestone-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
}

.profile-milestone-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    flex-grow: 1;
}

.profile-milestone-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
}

.profile-milestone-status-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
}

.profile-milestone-status-badge.unlocked {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.profile-milestone-status-badge.locked {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-actions-panel {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-top: 12px;
}

/* User hover effects in sidebar */
#sidebar-user-badge {
    padding: 6px 12px !important;
}
#sidebar-user-badge:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}
#sidebar-user-badge * {
    pointer-events: none;
}
#sidebar-user-badge #btn-logout {
    pointer-events: auto;
}

/* --- Right-to-Left (RTL) Styles --- */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .app-container {
    /* In RTL, Grid columns render right-to-left:
       300px → sidebar on the RIGHT, 1fr → content on the LEFT */
    grid-template-columns: 300px 1fr;
}

[dir="rtl"] .sidebar {
    border-left: 1px solid var(--border-color);
    border-right: none;
    min-width: 300px;
    width: 300px;
    overflow: hidden;
}

[dir="rtl"] .brand {
    flex-direction: row-reverse;
}

[dir="rtl"] .nav-btn {
    text-align: right;
    flex-direction: row-reverse;
    justify-content: flex-start;
    font-size: 0.88rem;
    letter-spacing: 0;
}

[dir="rtl"] .nav-btn span:not(.material-symbols-outlined) {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[dir="rtl"] .nav-btn.active {
    box-shadow: inset -3px 0 0 var(--primary);
}

[dir="rtl"] .sidebar-footer {
    border-top: 1px solid var(--border-color);
}

[dir="rtl"] .status-indicator {
    flex-direction: row-reverse;
}

[dir="rtl"] .user-badge {
    flex-direction: row-reverse;
}

[dir="rtl"] .user-badge #btn-logout {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .header-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] #save-status-container {
    margin-left: 10px !important;
    margin-right: 0 !important;
    flex-direction: row-reverse;
}

[dir="rtl"] .milestone-card.achieved::before {
    left: auto;
    right: 0;
}

[dir="rtl"] .profile-milestone-card.achieved::before {
    left: auto;
    right: 0;
}

[dir="rtl"] .profile-avatar-large {
    margin-left: 0;
}

[dir="rtl"] .profile-card-horizontal {
    flex-direction: row-reverse;
}

[dir="rtl"] .profile-badge {
    flex-direction: row-reverse;
}

[dir="rtl"] .profile-detail-row {
    flex-direction: row-reverse;
}

[dir="rtl"] .profile-detail-label {
    flex-direction: row-reverse;
}

[dir="rtl"] .profile-milestone-card-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .profile-milestone-status {
    flex-direction: row-reverse;
}

[dir="rtl"] .profile-milestone-status-badge {
    flex-direction: row-reverse;
}

[dir="rtl"] .profile-actions-panel {
    flex-direction: row-reverse;
}

/* Adjust margins on material icons inside buttons for RTL */
[dir="rtl"] .btn .material-symbols-outlined,
[dir="rtl"] .nav-btn .material-symbols-outlined {
    margin-left: 0;
}

/* Align text descriptions */
[dir="rtl"] .dashboard-card-title,
[dir="rtl"] .profile-section-title {
    flex-direction: row;
    justify-content: flex-start;
}

[dir="rtl"] .kpi-label {
    flex-direction: row;
}

[dir="rtl"] .kpi-trend {
    flex-direction: row;
    justify-content: flex-start;
}

[dir="rtl"] .milestone-roadmap {
    flex-direction: row-reverse;
}

[dir="rtl"] .milestone-card-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .milestone-card-footer {
    flex-direction: row-reverse;
}

[dir="rtl"] .milestone-progress-wrap {
    flex-direction: row-reverse;
}

[dir="rtl"] .milestone-achieved-badge {
    flex-direction: row-reverse;
}

[dir="rtl"] .input-symbol {
    left: auto;
    right: 12px;
}

[dir="rtl"] .form-input {
    padding: 10px 36px 10px 12px;
}

/* --- Modal Overlay & Content --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 6, 12, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    opacity: 0;
    animation: fadeIn 0.2s forwards ease-out;
}

.modal-content {
    background: rgba(16, 22, 38, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transform: scale(0.95);
    animation: slideUp 0.25s forwards cubic-bezier(0.16, 1, 0.3, 1);
    width: 90%;
    max-width: 650px;
    border-radius: var(--radius-lg);
}

@keyframes fadeIn {
    to { opacity: 1; }
}

@keyframes slideUp {
    to { transform: scale(1); }
}

/* ===================================================
   Profile Settings Form (psf-*)
   =================================================== */
.profile-settings-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}
.psf-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
}
.psf-row:last-child { border-bottom: none; }
.psf-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 150px;
    cursor: default;
}
.psf-label .material-symbols-outlined { font-size: 1rem; }
.psf-input {
    flex: 1;
    max-width: 180px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    color: var(--text-main);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}
.psf-input:focus { border-color: var(--primary); }
.psf-select {
    flex: 1;
    max-width: 200px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    color: var(--text-main);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}
.psf-select:focus { border-color: var(--primary); }
.psf-select option { background: var(--bg-sidebar); color: var(--text-main); }
.psf-static {
    font-size: 0.88rem;
    color: var(--text-main);
    font-weight: 600;
    text-align: right;
}
.psf-save-btn {
    margin-top: 8px;
    align-self: flex-end;
    padding: 8px 22px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

/* ===================================================
   Net Worth History Tracker (nwh-*)
   =================================================== */
.nwh-card { padding: 22px 24px; }
.nwh-chart-wrap {
    margin: 14px 0 10px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    padding: 8px 4px 4px;
}
.nwh-svg {
    width: 100%;
    height: auto;
    display: block;
}
.chart-grid-line {
    stroke: rgba(255,255,255,0.06);
    stroke-width: 1;
}
.chart-axis-text {
    fill: var(--text-muted);
    font-size: 9px;
    font-family: inherit;
}
.nwh-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px 0;
    font-size: 0.88rem;
}
.nwh-table-wrap {
    margin: 12px 0;
    max-height: 220px;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}
.nwh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.nwh-table thead th {
    position: sticky;
    top: 0;
    background: rgba(13,18,34,0.95);
    color: var(--text-muted);
    font-weight: 600;
    padding: 9px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.nwh-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}
.nwh-table tbody tr:last-child { border-bottom: none; }
.nwh-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.nwh-td-date, .nwh-td-val, .nwh-td-actions {
    padding: 8px 14px;
}
.nwh-td-val { font-weight: 600; color: var(--primary); }
.nwh-td-actions {
    text-align: right;
    white-space: nowrap;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
}
.nwh-btn-edit, .nwh-btn-del {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 3px 7px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
    display: flex;
    align-items: center;
}
.nwh-btn-edit:hover { border-color: var(--secondary); color: var(--secondary); }
.nwh-btn-del:hover { border-color: var(--danger); color: var(--danger); }
.nwh-btn-edit .material-symbols-outlined,
.nwh-btn-del .material-symbols-outlined { font-size: 0.95rem; }
.nwh-add-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}
.nwh-add-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0 0 10px;
    font-weight: 600;
}
.nwh-add-title .material-symbols-outlined { font-size: 1rem; color: var(--primary); }
.nwh-add-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.nwh-add-row .psf-input { max-width: none; flex: 1; min-width: 120px; }
.nwh-add-row .btn {
    white-space: nowrap;
    padding: 7px 16px;
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ===================================================
   KPI Badge + Tooltip (savings rate)
   =================================================== */
.kpi-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
    text-transform: uppercase;
}
.kpi-tooltip-wrap {
    position: relative;
}
.kpi-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-hover);
    border-radius: 12px;
    padding: 12px 16px;
    min-width: 200px;
    box-shadow: var(--shadow-md);
    pointer-events: none;
}
/* kpi-tooltip is shown/hidden by JS (position:fixed) */
.kpi-tooltip-wrap { position: relative; }
.kpi-tooltip {
    display: none;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-hover);
    border-radius: 12px;
    padding: 12px 16px;
    min-width: 200px;
    box-shadow: var(--shadow-md);
}
.kpi-tooltip-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}
.kpi-tooltip-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-main);
    padding: 4px 0;
}
.kpi-tooltip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Roadmap dot pointer */
.roadmap-dot { cursor: pointer; }

/* Roadmap dot hover tooltip */
.rdot-tooltip {
    display: none;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-hover);
    border-radius: 12px;
    padding: 13px 16px;
    min-width: 220px;
    max-width: 280px;
    box-shadow: var(--shadow-md);
    font-size: 0.83rem;
}
.rdot-tooltip-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 6px;
}
.rdot-tooltip-desc {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}
.rdot-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 3px 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.rdot-tooltip-row span:last-child { color: var(--text-main); font-weight: 600; }

/* --- Donation & Support UI --- */
.donation-widget-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.donation-goal-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.donation-progress-bar-bg {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    height: 10px;
    position: relative;
    overflow: hidden;
    margin-top: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.donation-progress-bar-fill {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    height: 100%;
    border-radius: 99px;
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px var(--primary);
}

.donor-wall-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.donor-wall-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.donor-wall-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 6px;
}

.donor-wall-list::-webkit-scrollbar {
    width: 4px;
}
.donor-wall-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.donor-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.donor-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.donor-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.donor-info {
    flex-grow: 1;
    min-width: 0;
}

.donor-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.donor-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
}

.donor-amount {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
}

.donor-message {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    word-break: break-word;
    line-height: 1.3;
}

.donor-date {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 4px;
}

/* Custom modal overlay for simulated checkout or link selection */
.checkout-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 6, 14, 0.85);
    backdrop-filter: blur(8px);
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s ease-out;
}

.checkout-modal-card {
    width: 90%;
    max-width: 460px;
    padding: 28px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.checkout-platform-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.checkout-platform-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.kpi-edit-icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s, transform 0.2s;
    margin-left: 6px;
}

.kpi-edit-icon-btn:hover {
    transform: scale(1.15);
}

#kpi-edit-assets-btn:hover {
    color: var(--primary) !important;
}

#kpi-edit-liabilities-btn:hover {
    color: var(--danger) !important;
}

/* Highlighted Net Worth Card (Gold Liquid Cup) */
.kpi-card.highlighted {
    border: 1px solid rgba(245, 158, 11, 0.45) !important;
    background: rgba(16, 22, 38, 0.85) !important;
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    position: relative;
    overflow: hidden;
}
.kpi-card.highlighted .kpi-label .icon {
    color: #f59e0b !important;
}
.kpi-card.highlighted .kpi-value {
    color: #fff !important;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}

/* Header Mode Switch Toggle Buttons */
.mode-toggle-btn {
    border: none;
    background: none;
    border-radius: 30px;
    padding: 0 14px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
}
.mode-toggle-btn.active {
    background: var(--primary) !important;
    color: white !important;
    box-shadow: 0 2px 10px rgba(14, 165, 233, 0.4);
}
.mode-toggle-btn:hover:not(.active) {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Interactive Cashflow Editor Nodes */
.flow-node-group {
    cursor: pointer;
    pointer-events: all;
}
.flow-node-group:hover .flow-node {
    fill: rgba(255, 255, 255, 0.08) !important;
    stroke: var(--primary) !important;
    filter: drop-shadow(0 0 8px rgba(14, 165, 233, 0.35));
}
.flow-node.dotted-add {
    stroke-dasharray: 5, 5;
    stroke: var(--text-muted);
    fill: rgba(255, 255, 255, 0.01) !important;
}
.flow-node-group:hover .flow-node.dotted-add {
    stroke: var(--secondary) !important;
    fill: rgba(16, 185, 129, 0.05) !important;
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.3));
}

/* Modal Overlay & Card styling */
.cf-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 6, 15, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.cf-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.cf-modal-card {
    background: rgba(13, 18, 34, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    width: 440px;
    max-width: 92%;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    transform: translateY(20px);
    transition: transform 0.2s ease;
}
.cf-modal-overlay.active .cf-modal-card {
    transform: translateY(0);
}
.cf-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.cf-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cf-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.cf-modal-close:hover {
    color: #fff;
}
.cf-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.cf-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}


/* --- Mobile Bottom Navigation & Responsiveness Overrides --- */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(8, 12, 24, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 9999;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
}

.mobile-bottom-nav .nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 0;
    flex: 1;
    gap: 4px;
    transition: color 0.2s ease;
    height: 100%;
}

.mobile-bottom-nav .nav-btn .material-symbols-outlined {
    font-size: 1.35rem;
    transition: transform 0.2s ease;
}

.mobile-bottom-nav .nav-btn.active {
    color: var(--primary) !important;
}

.mobile-bottom-nav .nav-btn.active .material-symbols-outlined {
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    body.logged-in .mobile-bottom-nav {
        display: flex;
    }
    
    .view-container {
        padding-bottom: 90px !important;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start !important;
        height: auto !important;
        padding: 16px !important;
        gap: 12px;
        border-bottom: 1px solid var(--border-color);
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-start !important;
        flex-wrap: wrap;
        gap: 8px;
    }

    #country-dropdown, #currency-dropdown, #language-dropdown {
        position: fixed !important;
        top: 25% !important;
        left: 50% !important;
        transform: translate(-50%, 0) !important;
        right: auto !important;
        width: 280px !important;
        max-height: 400px !important;
        box-shadow: 0 10px 40px rgba(0,0,0,0.85) !important;
        border: 1px solid var(--border-hover) !important;
        background: var(--bg-sidebar) !important;
        border-radius: 12px !important;
        z-index: 100000 !important;
    }

    .profile-grid-2col {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .profile-card-horizontal {
        flex-direction: column !important;
        text-align: center !important;
        align-items: center !important;
        gap: 16px !important;
    }

    .profile-email {
        font-size: 1.1rem !important;
        word-break: break-all !important;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr !important;
    }

    .kpi-value {
        font-size: 1.25rem !important;
    }
}

/* Header Dropdown Scrim Backdrop Override (No Blur) */
#dropdown-backdrop {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

@media (min-width: 769px) {
    #dropdown-backdrop {
        display: none !important; /* Never display on desktop: standard click fall-through applies */
    }
}

@media (max-width: 768px) {
    #dropdown-backdrop {
        display: none; /* Let JS toggle block/none on mobile, no !important */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(4, 6, 12, 0.4); /* Shaded backdrop to block clicks, no blur filter */
        z-index: 99990;
        pointer-events: auto;
    }
}

/* --- Global FIRE Track Scrollable Container for Mobile --- */
.global-fire-track-wrapper {
    overflow-x: auto;
    width: 100%;
    padding: 36px 0 40px 0;
}
.global-fire-track-wrapper::-webkit-scrollbar {
    height: 4px;
}
.global-fire-track-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 2px;
}
.global-fire-track-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
}
.global-fire-track-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.global-fire-track-inner {
    position: relative;
    height: 12px;
    margin: 0 20px;
    min-width: 750px; /* Force minimum width to prevent overlap clusters and clipping */
}

@media (min-width: 769px) {
    .global-fire-track-inner {
        margin: 0 12px;
    }
    .global-fire-track-wrapper {
        padding: 36px 0 40px 0;
        margin: 0;
    }
}

/* --- Global Footer --- */
.app-footer {
    height: 40px;
    padding: 0 32px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-footer);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    display: flex;
    align-items: center;
    z-index: 5;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.footer-whitepaper-btn {
    transition: color var(--transition-speed) ease, text-shadow var(--transition-speed) ease;
}
.footer-whitepaper-btn:hover {
    color: var(--text-main) !important;
    text-shadow: 0 0 10px rgba(14, 165, 233, 0.3);
}
@media (max-width: 768px) {
    .app-footer {
        display: none !important; /* Hide on mobile so it doesn't clash with bottom nav */
    }
}

/* --- White Paper --- */
.whitepaper-container {
    animation: fadeIn var(--transition-speed) ease;
}
.formula-card {
    border: 1px solid var(--border-color) !important;
    background: var(--bg-card) !important;
    backdrop-filter: var(--glass-blur);
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.formula-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.2) !important;
    box-shadow: var(--shadow-lg), 0 0 20px rgba(99, 102, 241, 0.05);
}
.formula-card h3 {
    color: var(--text-main) !important;
}
.math-formula {
    background: rgba(120, 120, 120, 0.08) !important;
    border-left: 3px solid var(--primary);
    padding: 14px;
    border-radius: 6px;
    font-family: 'Outfit', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main) !important;
    word-break: break-word;
    letter-spacing: 0.5px;
    margin: 8px 0;
}
.dataset-filters-wrapper select,
.dataset-filters-wrapper input {
    background: rgba(120, 120, 120, 0.08) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
}
.psf-select {
    color: var(--text-main) !important;
    background-color: var(--bg-sidebar) !important;
    border: 1px solid var(--border-color) !important;
}
.nwh-td-date {
    color: var(--text-main) !important;
}
.dataset-filters-wrapper select:focus,
.dataset-filters-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}

/* --- Cookie Consent Banner --- */
.cookie-consent-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    z-index: 30000;
    width: 90%;
    max-width: 600px;
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur) saturate(140%);
    -webkit-backdrop-filter: var(--glass-blur) saturate(140%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    animation: slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.cookie-consent-banner.dismissed {
    transform: translateX(-50%) translateY(100px);
    opacity: 0;
}

.cookie-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
}

.cookie-icon {
    font-size: 1.6rem;
    color: var(--primary);
    animation: rotate-cookie 5s linear infinite;
}

.cookie-text {
    font-size: 0.82rem;
    color: var(--text-main);
    line-height: 1.4;
    margin: 0;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

@keyframes slide-up {
    from {
        transform: translateX(-50%) translateY(120px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes rotate-cookie {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 600px) {
    .cookie-consent-banner {
        flex-direction: column;
        align-items: stretch;
        bottom: 16px;
        padding: 16px;
    }
    .cookie-buttons {
        justify-content: flex-end;
    }
}

/* Toggle Switch styling */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(16px);
    background-color: var(--primary);
}

/* Share Dropdown Styles */
.share-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 100;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px;
    min-width: 160px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.share-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 8px 10px;
    color: var(--text-main);
    font-size: 0.75rem;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.share-menu-item:hover {
    background: var(--border-color) !important;
    color: var(--primary) !important;
}

.share-menu-item svg, .share-menu-item span {
    pointer-events: none;
}

/* FIRE Type Selector container & buttons */
.fire-type-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

body.light-theme .fire-type-selector {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
}

.fire-type-btn {
    border: none;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.fire-type-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

body.light-theme .fire-type-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

.fire-type-btn.active[data-type="coast"] {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.1);
}

.fire-type-btn.active[data-type="lean"] {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.1);
}

.fire-type-btn.active[data-type="fire"] {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
}

.fire-type-btn.active[data-type="fat"] {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

/* Light theme overrides for active buttons (high contrast) */
body.light-theme .fire-type-btn.active[data-type="coast"] {
    background: rgba(139, 92, 246, 0.15);
    color: #5b21b6;
    box-shadow: none;
}

body.light-theme .fire-type-btn.active[data-type="lean"] {
    background: rgba(245, 158, 11, 0.2);
    color: #92400e;
    box-shadow: none;
}

body.light-theme .fire-type-btn.active[data-type="fire"] {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
    box-shadow: none;
}

body.light-theme .fire-type-btn.active[data-type="fat"] {
    background: rgba(16, 185, 129, 0.18);
    color: #065f46;
    box-shadow: none;
}

/* Hide number input spinner arrows globally */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}
input[type="number"] {
    -moz-appearance: textfield !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

/* --- Dashboard Edit FIRE Target Modal styling helpers --- */
.db-modal-segment-control {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 3px;
    border-radius: var(--radius-md);
    gap: 2px;
}
.db-modal-segment-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px 12px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    text-align: center;
}
.db-modal-segment-btn:hover {
    color: var(--text-main);
}
.db-modal-segment-btn.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}
.db-modal-breakdown-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.db-modal-breakdown-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.db-modal-breakdown-val {
    font-weight: 600;
    color: var(--text-main);
}
.db-modal-breakdown-total {
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
    margin-top: 4px;
    font-weight: 700;
    color: var(--accent);
}

/* --- Balance Sheet Composite Layout --- */
.balance-composite-container {
    display: grid;
    grid-template-columns: 0.9fr 35px 1.25fr 45px 1fr 12px 80px;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 24px;
    width: 100%;
}

.balance-export-col {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-export-composite {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-main);
}

.btn-export-composite .btn-text {
    display: none;
}

.btn-export-composite:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.15);
    transform: translateY(-2px);
}

.btn-export-composite:hover .material-symbols-outlined {
    color: var(--primary) !important;
    transform: scale(1.1);
    transition: all 0.3s ease;
}

.btn-export-composite:active {
    transform: translateY(1px);
}
.balance-composite-container .savings-composite-card {
    align-self: center;
}
.balance-flow-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
}
.savings-flow-item {
    position: relative;
    width: 100%;
    height: 30px;
}
.savings-feed-particle {
    position: absolute;
    font-size: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    user-select: none;
    pointer-events: none;
}
.savings-feed-particle.flow-positive {
    animation: feedCash 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
    text-shadow: 0 0 5px rgba(16, 185, 129, 0.4);
}
.savings-feed-particle.flow-negative {
    animation: suckCash 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
    text-shadow: 0 0 5px rgba(239, 68, 68, 0.4);
}
@keyframes feedCash {
    0% {
        left: -15px;
        opacity: 0;
        transform: translateY(-50%) scale(0.6) rotate(0deg);
    }
    15% {
        opacity: 1;
        transform: translateY(-50%) scale(1.15) rotate(15deg);
    }
    85% {
        opacity: 1;
        transform: translateY(-50%) scale(1.15) rotate(-15deg);
    }
    100% {
        left: calc(100% + 15px);
        opacity: 0;
        transform: translateY(-50%) scale(0.6) rotate(0deg);
    }
}
@keyframes suckCash {
    0% {
        left: calc(100% + 15px);
        opacity: 0;
        transform: translateY(-50%) scale(0.6) rotate(0deg);
    }
    15% {
        opacity: 1;
        transform: translateY(-50%) scale(1.15) rotate(-15deg);
    }
    85% {
        opacity: 1;
        transform: translateY(-50%) scale(1.15) rotate(15deg);
    }
    100% {
        left: -15px;
        opacity: 0;
        transform: translateY(-50%) scale(0.6) rotate(0deg);
    }
}

.balance-links-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}
.balance-link-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
}
.permanent-line-link {
    position: absolute;
    left: -12px;
    right: -12px;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
}
.permanent-line-link::after {
    content: '';
    position: absolute;
    top: 0;
    height: 100%;
    width: 40px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
}

.permanent-line-link.green-line::after {
    animation: flow-left 2s linear infinite;
}
.permanent-line-link.red-line::after {
    animation: flow-right 2s linear infinite;
}

[dir="rtl"] .permanent-line-link.green-line::after {
    animation: flow-right 2s linear infinite;
}
[dir="rtl"] .permanent-line-link.red-line::after {
    animation: flow-left 2s linear infinite;
}

.permanent-line-link.green-line {
    background: var(--primary);
    animation: pulse-shadow-green 3s ease-in-out infinite;
}
.permanent-line-link.red-line {
    background: var(--danger);
    animation: pulse-shadow-red 3s ease-in-out infinite;
}

@keyframes flow-left {
    0% {
        left: 100%;
    }
    100% {
        left: -40px;
    }
}

@keyframes flow-right {
    0% {
        left: -40px;
    }
    100% {
        left: 100%;
    }
}

@keyframes pulse-shadow-green {
    0%, 100% {
        box-shadow: 0 0 8px rgba(16, 185, 129, 0.55);
    }
    50% {
        box-shadow: 0 0 16px rgba(16, 185, 129, 0.85);
    }
}

@keyframes pulse-shadow-red {
    0%, 100% {
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.55);
    }
    50% {
        box-shadow: 0 0 16px rgba(239, 68, 68, 0.85);
    }
}

.balance-stacked-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: space-between;
}

.balance-stacked-col .kpi-card {
    flex: 1;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 80px; /* Reduced min-height */
    padding: 12px 14px !important; /* Reduced padding */
}

.balance-stacked-col .kpi-card .kpi-label {
    font-size: 0.78rem; /* Smaller font */
}

.balance-stacked-col .kpi-card .kpi-label .icon {
    font-size: 1.1rem; /* Smaller icon */
}

.balance-stacked-col .kpi-card .kpi-value {
    font-size: 1.35rem; /* Smaller value */
    margin: 4px 0;
}

.balance-stacked-col .kpi-card .kpi-trend {
    font-size: 0.7rem; /* Smaller trend badge */
}

.dashboard-toggle-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    flex-wrap: wrap;
    width: 100%;
}

.btn-toggle-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-sm);
}

.btn-toggle-box:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-main);
    transform: translateY(-1px);
}

.btn-toggle-box.active {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.15);
}

.btn-toggle-box.active:hover {
    background: rgba(16, 185, 129, 0.12);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.25);
}

.btn-toggle-box:active {
    transform: translateY(1px);
}

.btn-toggle-details {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    user-select: none;
    outline: none;
}

.btn-toggle-details:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--text-main);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn-toggle-details.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 700;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.25);
}

.btn-toggle-details.active:hover {
    background: rgba(16, 185, 129, 0.14);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.35);
}

.btn-toggle-details:active {
    transform: translateY(1px);
}

.btn-toggle-details .icon-toggle {
    font-size: 1.05rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-toggle-details.active .icon-toggle {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    .dashboard-toggle-container {
        gap: 10px;
    }
    .balance-composite-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .balance-links-col,
    .balance-flow-col {
        display: none !important;
    }
    .nw-composite-card {
        order: 1;
    }
    .savings-composite-card {
        order: 2;
        align-self: stretch;
    }
    .balance-stacked-col {
        order: 3;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .balance-composite-spacer {
        display: none !important;
    }
    .balance-export-col {
        width: 100%;
        margin-top: 12px;
        order: 4;
    }
    .btn-export-composite {
        width: 100% !important;
        height: 48px !important;
        min-height: 48px !important;
        flex-direction: row !important;
        gap: 10px !important;
        padding: 10px !important;
        border-radius: var(--radius-md) !important;
    }
    .btn-export-composite .btn-text {
        display: inline !important;
    }
}
@media (max-width: 480px) {
    .balance-stacked-col {
        grid-template-columns: 1fr;
    }
}

/* --- Light Theme Highlighted Card Override --- */
body.light-theme .kpi-card.highlighted {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(254, 243, 199, 0.35) 100%) !important;
    border: 1px solid rgba(217, 119, 6, 0.25) !important;
    box-shadow: 0 10px 30px rgba(217, 119, 6, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}
body.light-theme .kpi-card.highlighted .kpi-value {
    color: var(--text-main) !important;
    text-shadow: none !important;
}
body.light-theme .kpi-card.highlighted .kpi-label {
    color: var(--text-muted) !important;
}
body.light-theme .kpi-card.highlighted .kpi-label .icon {
    color: #d97706 !important;
}
body.light-theme .kpi-card.highlighted .nw-fire-progress-badge {
    background: rgba(217, 119, 6, 0.1) !important;
    border: 1px solid rgba(217, 119, 6, 0.2) !important;
    color: #b45309 !important;
}

/* --- Base Progress Badge for Net Worth Card --- */
.nw-fire-progress-badge {
    font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
    color: white;
}

/* --- KPI Card Text Auto-Sizing (Container Queries) --- */
.kpi-card {
    container-type: inline-size;
}
.kpi-card .kpi-value {
    font-size: clamp(1.1rem, 8.5cqw, 1.8rem) !important;
}
.kpi-card.highlighted .kpi-value {
    font-size: clamp(1.6rem, 13cqw, 3.2rem) !important;
}
.kpi-card.highlighted .kpi-label {
    font-size: clamp(0.85rem, 5.5cqw, 1.05rem) !important;
}
.kpi-card.highlighted .kpi-label .icon {
    font-size: clamp(1.15rem, 7.5cqw, 1.55rem) !important;
}
.kpi-card .kpi-label {
    font-size: clamp(0.7rem, 4.5cqw, 0.85rem) !important;
}
.kpi-card .kpi-label .icon {
    font-size: clamp(1rem, 6.5cqw, 1.25rem) !important;
}

/* --- Light Theme Modal/Popup Overrides --- */
body.light-theme .cf-modal-card,
body.light-theme .modal-content,
body.light-theme .checkout-modal-card,
body.light-theme .login-card {
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
    color: var(--text-main) !important;
}

body.light-theme .cf-modal-title,
body.light-theme .modal-title,
body.light-theme .modal-content h2,
body.light-theme .modal-content h3,
body.light-theme .modal-content h4,
body.light-theme .cf-modal-card h2,
body.light-theme .cf-modal-card h3,
body.light-theme .checkout-modal-card h2,
body.light-theme .checkout-modal-card h3,
body.light-theme .checkout-modal-card h4,
body.light-theme .cf-modal-close,
body.light-theme .login-title {
    color: var(--text-main) !important;
    text-shadow: none !important;
}

body.light-theme #btn-guest-login {
    border-color: #8b5cf6 !important;
    color: #8b5cf6 !important;
}

body.light-theme .cf-modal-close:hover {
    color: var(--primary) !important;
}

body.light-theme .btn-secondary {
    background-color: rgba(0, 0, 0, 0.05) !important;
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
}
body.light-theme .btn-secondary:hover {
    background-color: rgba(0, 0, 0, 0.08) !important;
    border-color: var(--border-hover) !important;
}

body.light-theme .db-modal-segment-control {
    background: rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .db-modal-segment-btn.active {
    background: #ffffff !important;
    box-shadow: var(--shadow-sm) !important;
    color: var(--text-main) !important;
}

body.light-theme .db-modal-breakdown-card {
    background: rgba(0, 0, 0, 0.02) !important;
    border: 1px dashed var(--border-color) !important;
}

body.light-theme .modal-overlay,
body.light-theme .cf-modal-overlay,
body.light-theme .checkout-modal-overlay {
    background: rgba(0, 0, 0, 0.4) !important;
}

/* Onboarding Specific Overrides for Light Theme */
body.light-theme #onboarding-modal-overlay .form-input,
body.light-theme #onboarding-modal-overlay select.form-input {
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
}

body.light-theme #ob-assets-list,
body.light-theme #ob-debts-list {
    background: rgba(0, 0, 0, 0.02) !important;
    border: 1px solid var(--border-color) !important;
}

body.light-theme #onboarding-modal-overlay div[style*="background: rgba(255,255,255,0.02)"],
body.light-theme #onboarding-modal-overlay div[style*="background: rgba(255, 255, 255, 0.03)"],
body.light-theme #onboarding-modal-overlay div[style*="background: rgba(255,255,255,0.03)"] {
    background: rgba(0, 0, 0, 0.02) !important;
    border-color: var(--border-color) !important;
}

body.light-theme #onboarding-modal-overlay div[style*="background: rgba(255,255,255,0.08)"] {
    background: rgba(0, 0, 0, 0.08) !important;
}

body.light-theme #onboarding-modal-overlay div[style*="border-top: 1px solid rgba(255,255,255,0.08)"] {
    border-top: 1px solid var(--border-color) !important;
}

body.light-theme #onboarding-modal-overlay div[style*="border: 1px dashed rgba(255,255,255,0.1)"] {
    border: 1px dashed var(--border-color) !important;
    background: rgba(0, 0, 0, 0.01) !important;
}

body.light-theme .step-indicator:not(.active) {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 2px solid rgba(0, 0, 0, 0.08) !important;
    color: var(--text-muted) !important;
}

body.light-theme .step-line {
    background: rgba(0, 0, 0, 0.08) !important;
}

body.light-theme #ob-rec-swr,
body.light-theme #ob-rec-target-amount {
    color: var(--text-main) !important;
}

/* Cashflow Specific Overrides for Light Theme */
body.light-theme .cashflow-number-input,
body.light-theme input.cashflow-number-input {
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
}

body.light-theme div[style*="background: rgba(255,255,255,0.05)"] {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: var(--border-color) !important;
}

/* Sandbox Sharing Visual Override for Light Theme */
body.light-theme div[style*="background: #0b0f19"] {
    background: #ffffff !important;
    border-color: var(--border-color) !important;
}

body.light-theme div[style*="background: rgba(255,255,255,0.01)"] {
    background: rgba(0, 0, 0, 0.01) !important;
    border-color: var(--border-color) !important;
}

/* --- Right-to-Left (RTL) progress bar and particle animation overrides --- */
[dir="rtl"] .progress-bar-fill,
[dir="rtl"] .milestone-progress-fill,
[dir="rtl"] .profile-progress-fill,
[dir="rtl"] .donation-progress-bar-fill {
    margin-left: auto;
    margin-right: 0;
}

[dir="rtl"] .profile-progress-fill,
[dir="rtl"] .donation-progress-bar-fill,
[dir="rtl"] .progress-bar-fill[style*="linear-gradient"] {
    background: linear-gradient(-90deg, var(--primary) 0%, var(--secondary) 100%) !important;
}

[dir="rtl"] .savings-feed-particle.flow-positive {
    animation: suckCash 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

[dir="rtl"] .savings-feed-particle.flow-negative {
    animation: feedCash 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Collapsible Dashboard Details --- */
.dashboard-details-container {
    opacity: 1;
    transform: translateY(0);
    max-height: 10000px; /* Large enough to handle all cards */
    overflow: hidden;
    transition: max-height 0.7s cubic-bezier(0.16, 1, 0.3, 1), 
                opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.dashboard-details-container.collapsed {
    max-height: 0;
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* --- Dashboard Alerts Section --- */
.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 12px;
}
.alerts-header-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 24px;
}
@media (max-width: 800px) {
    .alerts-header-grid {
        grid-template-columns: 1fr;
    }
}
.score-gauge-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
}
.checks-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.score-glow-circle {
    filter: drop-shadow(0 0 12px var(--primary-translucent, rgba(16, 185, 129, 0.2)));
}
.risk-audit-card {
    transition: transform 0.2s, box-shadow 0.2s;
}
.risk-audit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}






