#loginOverlay {
    /* Existing logic for centering remains the same */
    display: flex;
    justify-content: center;
    align-items: center;

    /* ADD THESE LINES */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    /* This ensures content doesn't touch the notch or home bar */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);

    /* Make sure background color covers the whole screen including safe areas */
    background-color: #f8fafc;
    overflow-y: auto;
    /* Allows scrolling if the phone is small */
}

/* Enable smooth pulling on iOS */
body {
    overscroll-behavior-y: contain; /* Prevents Android native refresh while we use our custom one */
    transition: transform 0.2s cubic-bezier(0,0,0.3,1);
}

#pull-to-refresh {
    transition: opacity 0.2s;
    opacity: 0;
}

/* Optional: rotate the arrow when threshold is met */
.ptr-ready #ptr-text {
    transform: rotate(180deg);
}



@media (max-width: 350px) {
    #analytics-tab .analytics-card {
        padding: 10px !important;
    }

    #analytics-tab .sidebar-table td {
        font-size: 0.65rem !important;
        padding: 4px 1px !important;
    }

    #analytics-tab h4 {
        font-size: 0.85rem !important;
    }
}

/* Responsive Font Scaling for Small Devices */
@media (max-width: 350px) {
    #analytics-tab .analytics-card {
        padding: 8px !important;
    }

    #analytics-tab h4 {
        font-size: 0.85rem !important;
        margin-bottom: 8px !important;
    }

    #analytics-tab .sidebar-table {
        font-size: 0.65rem !important;
        /* Shrinks table text */
    }

    #analytics-tab .sidebar-table td {
        padding: 6px 1px !important;
        /* Reduces horizontal gaps */
    }

    /* Shrink the percentage label even further */
    #analytics-tab .sidebar-table div[style*="font-size: 0.6rem"] {
        font-size: 0.55rem !important;
    }
}

#analytics-tab .sidebar-table {
    width: auto !important;
    /* Prevents stretching */
    margin: 0 auto;
    /* Centers the table */
    min-width: 220px;
    /* Prevents it from being TOO small on tiny screens */
}

#analytics-tab .sidebar-table th,
#analytics-tab .sidebar-table td {
    white-space: nowrap;
    /* Prevents text from jumping to two lines */
    padding: 6px 12px;
    /* Comfortable horizontal gap between columns */
}

/* Styling for individual asset/info cards */
.dashboard-card {
    background: #ffffff;
    border: 1px solid #e1e8f0;
    border-radius: 12px;
    padding: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
}

/* Responsive Grid for the Analytics Tab */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    padding: 15px;
}

/* Ensure the flex container wraps on small screens */
.analytics-flex-container {
    display: flex;
    flex-wrap: wrap;
    /* Critical for mobile auto-fit */
    gap: 20px;
    align-items: center;
    justify-content: center;
}

/* Force Table and Chart to take full width on mobile */
.analytics-flex-container>div {
    flex: 1 1 300px;
    /* Grow, shrink, and base width */
    width: 100%;
}

/* Ensure the analytics card itself doesn't exceed screen width */
.analytics-card {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

/* Force table cells to wrap text if names are too long */
.sidebar-table td {
    word-break: break-word;
    white-space: normal;
    padding: 8px 4px;
}

/* Specifically target mobile devices */
@media (max-width: 480px) {
    .analytics-card {
        padding: 10px !important;
        margin: 10px 0 !important;
    }

    .sidebar-table {
        font-size: 0.7rem !important;
        /* Smaller text for mobile */
    }

    .sidebar-table th, .sidebar-table td {
        padding: 6px 2px !important;
        /* Tighten spacing */
    }
}

/* Container for the search results */
#fundList {
    position: absolute;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: none;
}

/* Individual search items */
.mf-search-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
    /* Better spacing for wrapped text */
    color: #333;
    /* This ensures long fund names wrap to the next line */
    white-space: normal;
    word-wrap: break-word;
    text-align: left;
}

.mf-search-item:hover {
    background-color: #f7faff;
    color: #007bff;
}

/* Mobile specific adjustment */
@media (max-width: 600px) {
    .mf-search-item {
        font-size: 13px;
        padding: 15px;
        /* Larger tap area for mobile */
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Custom Prompt Styling */
.prompt-input {
    width: 100%;
    padding: 12px;
    margin: 15px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
}

.prompt-btn-group {
    display: flex;
    gap: 10px;
}

/* Optimized Ticker Styles */
.ticker-wrap {
    width: 100%;
    white-space: nowrap;
}

.ticker-scroll {
    overflow: hidden;
    width: 100%;
}

.ticker-content span {
    display: inline-block;
}

/* Mobile Specific Tweak */
@media (max-width: 480px) {
    .ticker-content {
        font-size: 0.68rem !important;
        /* Slightly smaller for mobile */
        animation-duration: 40s;
        /* Slightly faster move for smaller text */
    }

    #header-spacer {
        height: 100px !important;
        /* Adjusted for the slimmer ticker bar */
    }
}

@media (max-width: 480px) {
    .ticker-content {
        font-size: 0.7rem !important;
        /* Even smaller for tiny screens */
    }

    .ticker-sep {
        margin: 0 4px;
        opacity: 0.5;
    }
}

.ticker-content {
    display: inline-block;
    white-space: nowrap;
    animation: ticker-move 30s linear infinite;
    /* Increased time to 30s because list is longer */
}

/* On hover, pause the ticker so user can read a specific price */
.ticker-wrap:hover .ticker-content {
    animation-play-state: paused;
}

@keyframes ticker-move {
    0% {
        transform: translateX(100%);
    }

    100% {
        transform: translateX(-100%);
    }
}


/* Container to match your other inputs */
.auth-input-group {
    width: 100%;
    margin-bottom: 15px;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.auth-input-wrapper input {
    width: 100% !important;
    padding-right: 45px !important;
    /* Space for the button */
    box-sizing: border-box !important;
    margin: 0 !important;
    /* Removes browser default misalignment */
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    /* Professional Slate Grey */
    cursor: pointer;
    z-index: 5;
    height: 100%;
    /* Ensures it centers perfectly relative to input height */
}

.password-toggle-btn:hover {
    color: #002b5c;
}

.forgot-password-link {
    font-size: 0.85rem;
    color: #3b82f6;
    /* A professional blue */
    text-decoration: none;
    display: block;
    margin-top: 10px;
    text-align: right;
}

.forgot-password-link:hover {
    text-decoration: underline;
}

/* Styling for the container in both index and reset pages */
.login-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
}

/* Shared background for all Auth pages */
.auth-body {

    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* The white card container */
.auth-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

/* App Branding */
.auth-app-name {
    color: #0056b3;
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 8px;
}

.auth-subtitle {
    color: #666;
    margin-bottom: 25px;
    font-size: 14px;
}

/* Consistent Inputs */
.auth-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
}

/* The Green Action Button */
.auth-btn-primary {
    width: 100%;
    padding: 12px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-btn-primary:hover {
    background-color: #218838;
}

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

/* Container allows horizontal swiping */
/* The wrapper handles the stickiness and background color of the bar area */

/* FORCE NO MARGINS BETWEEN TOP COMPONENTS */
#appContainer>* {
    margin-top: 0 !important;
}

#header-spacer {
    /* Original height was 105px. We add the safe area variable to it */
    height: calc(90px + env(safe-area-inset-top)) !important;
    width: 100%;
    display: block;
}

#sticky-tab-wrapper {
    /* Must match the header-spacer height */
    top: 94px !important;
    margin-top: 0 !important;
    padding: 0 !important;
    background-color: white !important;
}

.tab-controls {
    margin: 0 !important;
    /* Removes the 10px margin you had previously */
    padding: 8px 12px !important;
    border-radius: 0 !important;
    /* Optional: Keep it flat to match the header */
}

/* Ensure the Goal section is immediately below tabs */
.networth-banner-swipe {
    margin-top: 10px !important;
    padding-top: 0 !important;
}

#dashboard-content, .goals-container {
    margin-top: 0 !important;
    padding-top: 10px !important;
    /* Small padding for breathing room */
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .user-info-bar {
        padding: 6px 10px !important;
    }

    #market-ticker {
        width: 100%;
        /* Market moves to top row on very small phones */
        justify-content: center;
        border-bottom: 1px solid #f0f0f0;
        padding-bottom: 5px;
    }

    #displayUser {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        /* Prevents long names from breaking the layout */
    }

    #privacy-text {
        display: none;
        /* Only show the eye icon on small mobiles */
    }

    #menuBtn {
        font-size: 0;
        /* Hide "Menu" text, keep icon visible via padding */
    }

    #menuBtn::before {
        content: "☰";
        font-size: 1.1rem;
    }
}

/* Smooth live dot animation */
@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        opacity: 1;
    }
}

/* Privacy Masking */
.privacy-active .privacy-masked {
    filter: blur(8px);
    pointer-events: none;
    /* Prevents interaction while blurred */
    user-select: none;
}

/* Optional: Add a transition for a smooth effect */
.privacy-masked {
    transition: filter 0.3s ease;
}

body.privacy-active .privacy-masked {
    filter: blur(12px) !important;
    user-select: none !important;
    pointer-events: none !important;
}

#sticky-tab-wrapper {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg-main);
    /* Matches your theme background */
    padding-top: 5px;
    padding-bottom: 5px;
}

.tab-controls {
    display: flex;
    background-color: #002b5c;
    padding: 6px;
    border-radius: 14px;
    margin: 10px;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    border-bottom: none !important;

    /* NEW FIX: Creates a buffer for the first and last tabs */
    scroll-padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Hide scrollbar */
.tab-controls::-webkit-scrollbar {
    display: none;
}

.tab-controls {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.tab-button {
    flex: 0 0 auto;
    min-width: 140px;
    scroll-snap-align: center;
    border: none !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.7) !important;
    padding: 10px 15px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 10px !important;
    cursor: pointer;
}

.tab-controls .tab-button.active {
    background-color: #ffffff !important;
    color: #002b5c !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2) !important;
}

/* Hide the scrollbar for a cleaner look on mobile */
.tab-controls::-webkit-scrollbar {
    display: none;
}

.tab-controls {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Universal Sidebar Fix for Responsive Height and Button Visibility */
#budgetWizard, #expenseWizard, #categoryWizard,
#goalWizardModal, #profile-page, #loanWizard, #stock-tx-wizard {
    display: none;
    flex-direction: column;
    height: 100vh !important;
    height: -webkit-fill-available !important;
    /* Fix for mobile browser toolbars */
    position: fixed;
    right: 0;
    top: 0;
    width: 440px;
    max-width: 100vw;
    background: white;
    z-index: 10100;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    padding: 0;
    overflow: hidden;
    /* Prevents double scrollbars */
    animation: slideInRight 0.3s ease-out;
}

/* Ensure the scrollable middle section takes up all available space */
#budgetWizard>div:nth-child(2),
#expenseWizard>div:nth-child(2) {
    flex: 1 1 auto;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 15px 20px;
}

/* Ensure the footer containing the Save/Cancel buttons is always visible at bottom */
#budgetWizard>div:last-child,
#expenseWizard>div:last-child {
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 15px 20px;
    z-index: 10;
}



.master-wealth-card.budget-theme {
    /* background: linear-gradient(135deg, #1e7e34 0%, #28a745 100%) !important; */
}

/* Risk Start Assessment alignment*/

/* Fix for Risk Wizard and other Sidebars on Mobile */
#profile-page,
#riskWizardModal,
#goalWizardModal {
    position: fixed !important;
    right: 0 !important;
    top: 0 !important;
    /* Use dynamic height to account for mobile toolbars */
    height: 100% !important;
    height: -webkit-fill-available !important;
    width: 550px !important;
    max-width: 100vw;
    background: #ffffff !important;
    z-index: 10030 !important;
    display: none;
    flex-direction: column;
    /* Keeps header/footer locked while body scrolls */
    overflow: hidden !important;
    /* Prevents the whole sidebar from shifting */
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    animation: slideInRight 0.3s ease-out;
}

/* Ensure the Quiz Content itself is the part that scrolls */
#risk-quiz-content {
    flex-grow: 1;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll for iOS */
    padding: 20px;
    /* Ensures buttons at the bottom have breathing room */
    padding-bottom: 40px;
}

/* Risk End Assessment alignment*/

/* MF Start Transaction Page */
#mf-transactions-page {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    width: 650px !important;
    max-width: 100vw !important;
    height: 100vh !important;
    /* Full Screen Height */
    background: #ffffff !important;
    z-index: 10015 !important;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    /* Stack header, actions, and table */
    padding: 0 !important;
    /* Move padding to internal containers */
    animation: slideInRight 0.3s ease-out;
}

/* Internal scrollable container for the table */
#txListViewPage {
    flex-grow: 1;
    /* This pushes the table to fill all remaining space */
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 20px 20px 20px;
    margin: 0 !important;
    border: none !important;
    background: white;
}

#mf-transactions-page header.wiz-header-loan {
    padding: 20px;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
}

/* Fix MF Transaction Sidebar Layout */
#mf-transactions-page {
    display: none;
    flex-direction: column;
    height: 100vh !important;
}

#txListViewPage {
    flex-grow: 1;
    /* Pushes the table to fill the viewport height */
    overflow-y: auto;
    overflow-x: auto;
}

#mf-transactions-page table {
    width: 100%;
    min-width: 600px;
    /* Ensures horizontal scroll triggers on mobile */
}

#mf-transactions-page thead th {
    position: sticky;
    top: 0;
    background-color: #002b5c !important;
    color: white;
    z-index: 5;
}

/* MF End Transaction Page */
div.master-wealth-card,
div.mf-master-card,
div.stock-master-card,
div.debt-master-card,
div.physical-master-card,
div.liability-master-card {
    flex: 0 0 280px !important;
    /* Reduced width for a more compact feel */
    min-height: 125px !important;
    max-width: 280px !important;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 15px 18px !important;
    border-radius: 14px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
    scroll-snap-align: start;
    box-sizing: border-box !important;
    margin: 0 !important;
}

/* Specific Style for the Dashboard Card (Dark Theme) */
div.master-wealth-card {
    background: linear-gradient(135deg, #002b5c 0%, #004d99 100%) !important;
    color: white !important;
    border: none !important;
}

/* Shared Internal Layout Classes */
.m-card-top {
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.05);
}

.master-wealth-card .m-card-top {
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.m-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

/* Mobile Consistency Override */
@media (max-width: 600px) {

    div.master-wealth-card, div.mf-master-card, div.stock-master-card,
    div.debt-master-card, div.physical-master-card, div.liability-master-card {
        flex: 0 0 78vw !important;
        /* Shows a clear 22% peek of the next card */
        max-width: 78vw !important;
    }
}




.val-master {
    font-size: 1.8rem;
    font-weight: 800;
    margin-top: 4px;
}

.master-grid-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.master-item {
    display: flex;
    flex-direction: column;
}

.val-sub {
    font-size: 0.9rem;
    font-weight: 700;
    margin-top: 2px;
}

.risk-compact-tile {
    flex: 0 0 140px !important;
    background: white !important;
    border: 1px solid #e0e0e0 !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (max-width: 600px) {
    .master-wealth-card {
        flex: 0 0 92vw !important;
        /* Full width on mobile */
    }

    .val-master {
        font-size: 1.5rem;
    }

    .val-sub {
        font-size: 0.8rem;
    }
}


/* Unified Swipe Container Fix */
.networth-banner-swipe, .mini-tile-grid {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding: 10px 5px 20px 5px;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    -webkit-overflow-scrolling: touch;
}

.networth-banner-swipe::-webkit-scrollbar,
.mini-tile-grid::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* Uniform Card Sizing - Desktop */
.holding-card, .mini-tile, .slim-networth-card {
    flex: 0 0 250px !important;
    min-height: 120px;
    /* Reduced base height */
    scroll-snap-align: start;
}

/* Uniform Card Sizing - Mobile (The Reduction) */
@media (max-width: 600px) {
    .holding-card, .mini-tile, .slim-networth-card, .stock-stat-card {
        flex: 0 0 60vw !important;
        /* Smaller size for uniform look */
        min-height: 100px !important;
        padding: 12px !important;
    }

    .holding-card div, .mini-tile div {
        font-size: 0.85rem !important;
        /* Scale text down with card */
    }

    #debtTotalValue, #debtSchemeCount {
        font-size: 1.2rem !important;
    }
}

/* --- THEME DEFINITIONS --- */

/* Styling for the section dividers */
.tab-pane h3.section-header-main {
    border-left: 4px solid #002b5c;
    /* Navy blue accent for Debt */
    padding-left: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.tile-title, .holding-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* Shows max 2 lines then adds ... */
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal !important;
}

/* --- UNIFIED HORIZONTAL SWIPE ENGINE --- */
.mini-tile-grid,
#mainHoldingsCards,
#sip-cards-container,
#stock-cards-container,
#debt-cards-container,
#fd-cards-container,
#physical-cards-container,
#loan-cards-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding: 10px 5px 20px 5px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbars for all containers */
.mini-tile-grid::-webkit-scrollbar,
#mainHoldingsCards::-webkit-scrollbar,
#sip-cards-container::-webkit-scrollbar {
    display: none;
}

/* --- UNIFIED CARD SIZING --- */
.mini-tile, .holding-card {
    flex: 0 0 260px !important;
    /* Standard Desktop Width */
    min-height: 160px !important;
    /* Reduced uniform height */
    scroll-snap-align: start;
    padding: 15px !important;
    box-sizing: border-box;
}

/* --- MOBILE COMPACT OPTIMIZATION (THE SIZE REDUCTION) --- */
@media (max-width: 600px) {
    .mini-tile, .holding-card {
        /* Reduced from 85vw to 60vw for a much more compact look */
        flex: 0 0 60vw !important;
        min-height: 135px !important;
        /* Shorter cards */
        padding: 12px !important;
    }

    /* Reduce font sizes inside cards for better fit */
    .mini-tile .tile-title,
    .holding-card .holding-title {
        font-size: 0.8rem !important;
        margin-bottom: 8px !important;
    }

    .mini-tile div, .holding-card div {
        font-size: 0.75rem !important;
    }
}

/* Mobile Specific Reduction for Stock Summary */
@media (max-width: 600px) {
    #stock-holdings-summary {
        padding: 10px 5px !important;
        gap: 10px !important;
    }

    #stock-holdings-summary .stock-stat-card {
        /* Reduced from 240px to 60% of viewport for a compact feel */
        flex: 0 0 60vw !important;
        padding: 12px !important;
        min-height: 90px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    }

    #stock-holdings-summary .stock-stat-value {
        font-size: 1.2rem !important;
        /* Smaller text for mobile */
        margin-top: 4px;
    }

    #stock-holdings-summary .stock-stat-label {
        font-size: 0.6rem !important;
        /* Smaller labels */
        letter-spacing: 0.5px;
    }
}

/* Mobile Optimization for Debt Cards */
@media (max-width: 600px) {
    .networth-banner-swipe .holding-card {
        flex: 0 0 65vw !important;
        /* Makes cards smaller on mobile */
        min-height: 90px !important;
        padding: 10px !important;
    }

    #debtTotalValue, #debtSchemeCount {
        font-size: 1.2rem !important;
        /* Slightly smaller text for mobile */
    }
}

.mini-tile-grid,
.networth-banner-swipe,
#mainHoldingsStats,
#stock-holdings-summary,
#holdingsStatsHeader {
    display: flex !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding: 10px 5px 20px 5px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.mini-tile-grid::-webkit-scrollbar,
.networth-banner-swipe::-webkit-scrollbar,
#mainHoldingsStats::-webkit-scrollbar,
#stock-holdings-summary::-webkit-scrollbar {
    display: none;
}

/* --- DESKTOP DEFAULTS --- */
.mini-tile, .holding-card, .slim-networth-card, .stock-stat-card {
    flex: 0 0 280px;
    /* Standard width */
    scroll-snap-align: start;
}

/* --- MOBILE COMPACT OPTIMIZATION --- */
@media (max-width: 600px) {

    /* 1. Main Content Cards (Goals, Holdings) */
    .mini-tile, .holding-card {
        flex: 0 0 75vw !important;
        /* Allow peek of next card */
        min-height: 160px !important;
        padding: 12px !important;
    }

    /* 2. Top Level KPI Cards (Net Worth, Assets, Liabilities) */
    .slim-networth-card, .stock-stat-card {
        flex: 0 0 60vw !important;
        /* Smaller cards for summary stats */
        padding: 12px !important;
        min-height: 100px !important;
    }

    .slim-networth-card .val-compact,
    .stock-stat-value {
        font-size: 1.2rem !important;
    }

    .label-tiny, .stock-stat-label {
        font-size: 0.6rem !important;
    }

    /* 3. Stats Banners (Invested, Market Value, P&L) */
    #mainHoldingsStats,
    #stock-holdings-summary,
    #holdingsStatsHeader {
        display: flex !important;
        /* Force horizontal on mobile */
        grid-template-columns: none !important;
        /* Override existing grid */
    }
}

/* Standard Desktop Size */
.slim-networth-card {
    flex: 0 0 250px !important;
    scroll-snap-align: start;
}

/* Mobile Specific Size Reduction */
@media (max-width: 600px) {
    .slim-networth-card {
        /* Reduced from 80vw to 65vw to make them smaller and show more of the next card */
        flex: 0 0 65vw !important;
        min-height: 120px !important;
        /* Slightly shorter height for a compact look */
        padding: 12px !important;
        /* Tighter padding */
    }

    .slim-networth-card .val-compact {
        font-size: 1.3rem !important;
        /* Smaller font for the amount on mobile */
    }

    .slim-networth-card .label-tiny {
        font-size: 0.6rem !important;
        /* Smaller labels */
    }
}

/* Container fix to ensure no vertical growth */
.networth-banner-swipe {
    display: flex !important;
    overflow-x: auto !important;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    gap: 10px;
    padding: 10px 5px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.networth-banner-swipe::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for all browsers while maintaining functionality */
.networth-banner-swipe::-webkit-scrollbar {
    display: none;
}

.networth-banner-swipe {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* Responsive adjustment for a better mobile swiping experience */
@media (max-width: 600px) {
    .slim-networth-card {
        /* Shows 80% of the current card so the next card is partially visible */
        flex: 0 0 80vw !important;
    }
}

/* Net Worth Banner Swipe Container */
.networth-banner-swipe {
    display: flex !important;
    overflow-x: auto !important;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding: 10px 5px 20px 5px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.networth-banner-swipe::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.networth-banner-swipe::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.networth-banner-swipe {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* Ensure cards look good on mobile with a "peek" effect */
@media (max-width: 600px) {
    .slim-networth-card {
        flex: 0 0 80vw !important;
        /* Shows 80% of the card so the next one peeks in */
    }
}

/* Standardize width for the Net Worth cards */
.slim-networth-card {
    flex: 0 0 260px !important;
    /* Fixed width to force horizontal overflow */
    scroll-snap-align: start;
    margin: 0 !important;
    /* Remove individual margins to keep gap consistent */
}

@media (max-width: 600px) {
    .slim-networth-card {
        flex: 0 0 75vw !important;
        /* Show 75% of the card on mobile */
    }
}

/* Horizontal Swipe Container */
.mini-tile-grid {
    display: flex !important;
    /* Change from grid to flex */
    overflow-x: auto !important;
    /* Enable horizontal scroll */
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    /* Enable snapping behavior */
    gap: 15px;
    padding: 10px 5px 20px 5px;
    /* Bottom padding for shadow visibility */
    scrollbar-width: none;
    /* Hide scrollbar for Firefox */
    -ms-overflow-style: none;
    /* Hide scrollbar for IE/Edge */
    -webkit-overflow-scrolling: touch;
    /* Smooth momentum scroll on iOS */
}

/* Hide scrollbar for Chrome/Safari */
.mini-tile-grid::-webkit-scrollbar {
    display: none;
}

/* Ensure cards don't shrink and support snapping */
.mini-tile, .holding-card {
    flex: 0 0 300px;
    /* Fixed width: adjust this based on your preference */
    scroll-snap-align: start;
    /* Snap point */
    margin-bottom: 5px;
}

/* Specific adjustment for mobile screens */
@media (max-width: 600px) {
    .mini-tile, .holding-card {
        flex: 0 0 85vw;
        /* Shows 85% of one card and a peek of the next */
    }
}

.wiz-footer-loan {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    background: #fff;
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    height: 85px;
    /* Define height to prevent clipping */
    align-items: center;
    box-sizing: border-box;
}

.wiz-footer-loan button {
    height: 45px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    border: none;
}

/* Optimized Loan Wizard Sidebar */
#loanWizard {
    position: fixed !important;
    right: 0 !important;
    top: 0 !important;
    height: 100vh !important;
    width: 440px !important;
    max-width: 95vw;
    background: #ffffff !important;
    z-index: 10050 !important;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    display: none;
    /* Controlled by JS */
    flex-direction: column;
    padding: 0 !important;
    /* Standardized: Padding moved to internal divs */
    animation: slideInRight 0.3s ease-out;
    border-left: 1px solid #efeff4;
}

/* Internal header and body for Loan Wizard */
.wiz-header-loan {
    padding: 25px;
    border-bottom: 2px solid #efeff4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    flex-shrink: 0;
}

.wiz-body-loan {
    flex-grow: 1;
    overflow-y: auto;
    padding: 25px;
    -webkit-overflow-scrolling: touch;
}

.wiz-footer-loan {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    background: #fff;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

    {

    "name": "ST Wealth Planner",
    "icons": [ {
        "src": "icons/icon-512x512.png",
            "type": "image/png",
            "sizes": "512x512",
            "purpose": "any maskable"
    }

    ],
    "background_color": "#002b5c",
    "theme_color": "#002b5c"
}

/* Prevent standard modal-content behavior from breaking sidebars */
.modal-content#mf-transactions-page,
.modal-content#mf-holdings-page,
.modal-content#sipWizardModal {
    margin: 0 !important;
    border-radius: 0 !important;
}

/* Prevent accidental text selection on buttons and headers */
button, .tab-button, header, .tile-title {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    /* Removes the grey box when tapping on mobile */
}

/* Update your Header style */
header {
    background: #002b5c;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* ADD THIS */
    color: white;
    padding: calc(12px + env(safe-area-inset-top)) 20px 12px 20px !important;
}

/* Ensure the bottom of the app isn't cut off by the home indicator */
body {
    background-color: #002b5c;
    padding-bottom: env(safe-area-inset-bottom);
    /* background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); */
    background-attachment: fixed;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Add to any container that has overflow: auto or scroll */
.tab-content,
#profile-page,
.modal-content,
.mini-tile-grid {
    -webkit-overflow-scrolling: touch;
    /* Enables momentum scrolling on iOS */
}

/* CHANGE THIS */
#appContainer {
    display: none;
    max-width: 1400px;
    margin: 0 auto;
}

/* TO THIS */
#appContainer {
    background-color: #ffffff;
    min-height: 10vh;
    background: rgba backdrop-filter: blur display: none;
    width: 100%;
    max-width: 100vw;
    /* Ensures it never overflows the screen */
    margin: 0;
    padding: 0 10px;
    /* Gives small breathing room on mobile edges */
    box-sizing: border-box;
    padding-top: 10px;

}

:root {
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
    --sat: env(safe-area-inset-top);
    --bg-main: #f4f7f6;
    --card-bg: #ffffff;
    --card-text: #1c1c1e;
    --card-subtext: #666666;
    --card-border: #efeff4;
    --input-bg: #ffffff;
    --header-color: #002b5c;
}

.user-info-bar {
    display: flex;
    justify-content: flex-start !important;
    /* Align items to the left */
    align-items: center;
    background: white;
    padding: 10px 15px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    gap: 15px;
    /* Consistent spacing between title, ticker, and icon */
}

/* Add this to force the H1 title to never have centered text */
.user-info-bar h1 {
    margin: 0;
    text-align: left;
    /* ADD THIS */
    flex-grow: 0;
    /* ADD THIS */
}

#market-ticker {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: #f0f7ff;
    border-radius: 20px;
    border: 1px solid #d0e7ff;
    flex: 0 1 auto;
    /* Prevents it from stretching to fill the page */
    margin: 0 !important;
    /* Removes forced margins */
    max-width: fit-content;
}

/* Mobile Responsive for FD Sidebar */
@media (max-width: 480px) {
    #fd-config-sidebar {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Mobile Responsive for Debt Drawer */
@media (max-width: 480px) {
    #debt-transaction-drawer {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Responsive Sidebar for Debt Config */
@media (max-width: 480px) {
    #debt-config-sidebar {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Responsive adjustments for SIP Wizard */
@media (max-width: 480px) {
    #sipWizardModal {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Responsive adjustments for MF Transactions Sidebar */
@media (max-width: 600px) {
    #mf-transactions-page {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Auto-fit Watchlist Sidebar for mobile devices */
@media (max-width: 480px) {
    #stock-watchlist-sidebar {
        width: 100% !important;
        max-width: 100vw !important;
        border-radius: 0 !important;
    }
}

/* Responsive adjustments for Stock Wizard */
@media (max-width: 480px) {
    #stock-tx-wizard {
        width: 100% !important;
        max-width: 100vw !important;
        border-radius: 0 !important;
    }
}

@media (max-width: 480px) {
    #stock-history-sidebar {
        width: 100% !important;
        max-width: 100vw !important;
    }
}

/* Sidebar Auto-Fit for P&L Report */
@media (max-width: 550px) {
    #stock-pnl-sidebar {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Responsive adjustments for Risk Wizard */
@media (max-width: 550px) {
    #riskWizardModal {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Responsive Auto-Fit for Physical Asset Wizard */
@media (max-width: 480px) {
    #physicalAssetWizard {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Responsive auto-fit for Physical History Sidebar */
@media (max-width: 480px) {
    #physical-history-sidebar {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Responsive adjustments for Loan Wizard */
@media (max-width: 480px) {
    #loanWizard {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Responsive auto-fit for Amortization Sidebar */
@media (max-width: 550px) {
    #amortizationSidebar {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Responsive adjustments for Yearly Performance Sidebar */
@media (max-width: 550px) {
    #yearlyPerformanceSidebar {
        width: 100% !important;
        border-radius: 0 !important;
    }

    /* Hide the 'Download' text on very small screens to save space */
    .hide-mobile {
        display: none;
    }
}

/* Responsive adjustments for Budget Wizard */
@media (max-width: 480px) {
    #budgetWizard {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Responsive Auto-Fit for Expense Wizard */
@media (max-width: 480px) {
    #expenseWizard {
        width: 100% !important;
        max-width: 100vw !important;
        border-radius: 0 !important;
    }
}

/* Responsive adjustments for Category Wizard */
@media (max-width: 480px) {
    #categoryWizard {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Responsive adjustments for Insurance Wizard */
@media (max-width: 480px) {
    #insuranceWizard {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Auto-Fit Responsive Logic */
@media (max-width: 480px) {
    #retirementWizard {
        width: 100% !important;
        max-width: 100vw !important;
        right: 0 !important;
        left: 0 !important;
        height: 100dvh !important;
    }
}

/* Ensure body doesn't scroll when wizard is open */
body.modal-open {
    overflow: hidden;
}

/* Responsive auto-fit for Profile Sidebar */
@media (max-width: 480px) {
    #profile-page {
        width: 100% !important;
        max-width: 100vw !important;
        border-radius: 0 !important;
    }
}

/* Responsive adjustments for Unallocated Sidebar */
@media (max-width: 480px) {
    #unallocated-assets-sidebar {
        width: 100% !important;
        max-width: 100vw !important;
        border-radius: 0 !important;
    }
}

/* Responsive adjustments for Recent History Sidebar */
@media (max-width: 550px) {
    #recent-history-sidebar {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Responsive Sidebar for Settings Page */
@media (max-width: 480px) {
    #settings-page {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* Optional: Make ticker text smaller to save space */
#index-prices {
    font-size: 0.75rem !important;
    font-weight: 700;
}

@media (max-width: 600px) {
    .user-info-bar {
        flex-direction: row !important;
        /* Keep items side-by-side */
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px !important;
    }

    .user-info-bar h1 {
        display: block !important;
        /* Show Dashboard text */
        font-size: 1.1rem !important;
        /* Make it smaller to fit */
    }

    #market-ticker {
        display: none !important;
        /* Hide the ticker on very small screens to save space for Menu */
    }

    .header-actions {
        margin-left: auto !important;
        gap: 8px !important;
    }
}

@media (max-width: 600px) {

    /* Standardize Stock Wizard to match MF Transaction style */
    #stock-tx-wizard div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        /* Forces Qty and Price to stack vertically */
        gap: 0 !important;
    }

    #stock-tx-wizard .wiz-input {
        margin-bottom: 10px !important;
        font-size: 16px !important;
        /* Prevents iPhone zoom-in issues */
        height: 40px !important;
    }

    #stock-tx-wizard label {
        font-size: 11px !important;
        margin-bottom: 2px !important;
    }
}


/* Make buttons full width like the MF "Save Transaction" button */
#stock-tx-wizard .btn-wiz-save,
#stock-tx-wizard .btn-wiz-cancel {
    width: 100%;
    margin-bottom: 12px;
    padding: 12px !important;
    font-size: 1rem !important;
}

/* Fix input font size to prevent iOS "Auto-Zoom" which breaks layout */
#stock-tx-wizard .wiz-input {
    font-size: 16px !important;
}
}




body.dark-mode {
    --bg-main: #121214;
    --card-bg: #1c1c1e;
    --card-text: #ffffff;
    --card-subtext: #a1a1a6;
    --card-border: #2c2c2e;
    --input-bg: #2c2c2e;
    --header-color: #0a84ff;
}

/* --- APPLY THEMES AUTOMATICALLY --- */
body {
    background-color: var(--bg-main);
    color: var(--card-text);
    transition: 0.3s;
}

.mini-tile, .holding-card, .chart-card, .user-info-bar,
.tab-content, #profile-page, .modal-content {
    background-color: var(--card-bg) !important;
    border-color: var(--card-border) !important;
    color: var(--card-text) !important;
}

h1, h2, h3 {
    color: var(--header-color) !important;
}

/* Fixed visibility for Inputs & Selects in Dark Mode */
input, select, .wiz-input {
    background-color: var(--input-bg) !important;
    color: var(--card-text) !important;
    border: 1px solid var(--card-border) !important;
}

/* Fix for Tables in Dark Mode */
body.dark-mode .sidebar-table th {
    background-color: #2c2c2e !important;
    color: #0a84ff !important;
}

body.dark-mode .sidebar-table td {
    border-bottom: 1px solid #2c2c2e !important;
    color: #e4e4e7 !important;
}

/* Standardized Buttons for both modes */
.btn-action-small {
    background: var(--card-border);
    color: var(--header-color);
}

body.dark-mode .btn-action-small {
    background: #3a3a3c;
    color: #0a84ff;
}

/* Main Application Header (Fintech Style) */
h1 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    color: #002b5c;
    /* Deep Navy Blue for Trust */
    letter-spacing: -1px;
    /* Tighter spacing for a modern look */
    margin: 0;
}

/* Goal Tracking Section Header - Combined & Fixed */
.section-header-main {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: #1c1c1e;
    font-size: 1.2rem;
    margin: 30px 0 15px 0;
    /* Balanced margin */
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    /* Ensures it takes full width */
    justify-content: flex-start;
    /* Forces content to the far LEFT */
}

/* Accent line for Goal Tracking */
.section-header-main::before {
    content: "";
    width: 4px;
    height: 24px;
    background-color: #007bff;
    /* Vibrant Blue accent */
    border-radius: 2px;
}

/* Sidebar Header Styling */
#goal-detail-inline-section h2,
#debt-transaction-drawer h3,
#debt-config-sidebar h3,
#sipWizardModal h3 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: #002b5c !important;
    /* Branded Navy Blue */
    border-bottom: 2px solid #efeff4;
    padding-bottom: 15px;
    margin-top: 0;
}

/* Secondary Headers (Recent History, Goal Mapping) */
h4 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: #004d99;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Tab Button Active State Color Update */
.tab-button.active {
    background: #002b5c !important;
    /* Navy Blue instead of standard blue */
    color: white;
}


.login-box h2 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    color: #002b5c;
}

#mainAuthBtn {
    background: #002b5c !important;
    /* Navy Blue button */
    font-family: 'Inter', sans-serif;
    font-weight: 700;
}



/* Table Header Theme */
.sidebar-table th {
    background-color: #002b5c !important;
    color: white !important;
}

/* Stocks Summary Banner Styles */
#stock-holdings-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stock-stat-card {
    background: #ffffff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.stock-stat-label {
    font-size: 0.75rem;
    color: #8e8e93;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 8px;
}

.stock-stat-value {
    font-size: 1.6rem;
    font-weight: 800;
}

/* Color coding for Market Value and P&L */
.val-blue {
    color: #007bff;
}

.val-green {
    color: #28a745;
}

.val-red {
    color: #ff453a;
}

@keyframes pulse-red {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        opacity: 1;
    }
}

.live-dot {
    color: #ff453a;
    animation: pulse-red 1.5s infinite;
}



/* Sidebar Drawer Style for Profile Page */
#profile-page {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: 440px;
    max-width: 95%;
    background: #ffffff !important;
    z-index: 10025 !important;
    /* Higher than other drawers */
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    padding: 25px;
    display: none;
    /* Controlled by JS */
    flex-direction: column;
    overflow-y: auto;
    animation: slideInRight 0.3s ease-out;
}

@media (max-width: 600px) {
    #mf-transactions-page {
        /* This ensures the sidebar starts at the very top and allows full height scroll */
        height: 100% !important;
        position: fixed !important;
    }
}

@media (max-width: 600px) {
    .slim-networth-card {
        flex: 1 1 calc(50% - 12px) !important;
        /* Shows 2 cards per row on mobile */
        min-width: 150px;
    }
}

/* Ensure the profile content looks good in sidebar mode */
#profile-page .controls {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* Sidebar Drawer Fix for Profile Page */
#profile-page {
    /* Existing styles ... */
    padding-bottom: 80px !important;
    /* Adds space at the bottom of the scrollable area */
}

/* Ensure the sidebar has enough room for the legal text and the buttons */
#profile-page {
    padding-bottom: 100px !important;
}

/* Optional: Make the disclaimer look like a professional card */
.disclaimer-text {
    font-family: 'Inter', sans-serif;
    text-align: justify;
}

/* Standardized card size for ALL tiles (Goal, MF, Stock, Debt) */
.mini-tile, .holding-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px !important;
    min-height: 180px !important;
    /* Forces uniform height */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}

.mini-tile:hover {
    transform: translateY(-5px);
}

/* Ensure the Goal Grid matches the MF Grid */
.mini-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    justify-items: stretch;
    /* Cards will fill the space */
}

/* CSS End New Page name, Header-Goal Tracking added, Page Theme for Mutual Fund, Debt Side Over page


   /* Fix for invisible text in Goal Wizard inputs */
#goalWizardModal .modal-content input,
#goalWizardModal .modal-content select,
.wiz-input {
    color: #1c1c1e !important;
    /* Force a dark font color */
    background-color: #ffffff !important;
    /* Keep the background white as per your screenshot */
}

/* Ensure placeholder text is still visible but distinct */
#goalWizardModal .modal-content input::placeholder {
    color: #8e8e93 !important;
}

/* Success Toast Styles */
#successToast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #28a745;
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 100050;
    display: none;
    align-items: center;
    gap: 10px;
    animation: slideDownFade 0.4s ease-out;
}

@keyframes slideDownFade {
    from {
        top: -50px;
        opacity: 0;
    }

    to {
        top: 20px;
        opacity: 1;
    }
}

/* Placeholder style for empty goals */
.empty-goal-placeholder {
    grid-column: 1 / -1;
    /* Makes it span the full width of the grid */
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    background: transparent;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 150px;
}

.empty-goal-placeholder:hover {
    background-color: rgba(0, 123, 255, 0.05);
    border-color: #007bff;
}

.empty-goal-placeholder span {
    color: #007bff;
    font-weight: 600;
    font-size: 1.1rem;
    margin-top: 10px;
}

/* Standardized card size for all grids */
.mini-tile, .holding-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px !important;
    min-height: 190px !important;
    /* Uniform height for all cards */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.mini-tile:hover, .holding-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* This dims the background */
    display: none;
    /* Hidden by default */
    justify-content: center;
    /* Centers popup horizontally */
    align-items: center;
    /* Centers popup vertically */
    z-index: 10006;
    /* Ensures it sits on top of cards */
}

/* Update this block to include both X and Y overflow */
#debt-transaction-drawer,
#debt-config-sidebar,
#mf-holdings-page,
#mf-transactions-page,
#profile-page,
#goal-detail-inline-section {
    position: fixed !important;
    right: 0;
    top: 0;
    height: 100vh;
    width: 650px;
    max-width: 95%;
    background: #ffffff !important;
    z-index: 10010 !important;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    padding: 25px;
    display: none;
    flex-direction: column;

    /* FIX: Enable both vertical and horizontal scrolling */
    overflow-y: auto !important;
    overflow-x: auto !important;

    animation: slideInRight 0.3s ease-out;
    border-left: 1px solid #efeff4;
}

#mf-holdings-page,
#mf-transactions-page,
#profile-page {
    -webkit-overflow-scrolling: touch;
    /* Enables momentum scrolling */
}

/* Sidebar Drawer Style for ALL Overlays - CRITICAL FIX */
#profile-page,
#goal-detail-inline-section,
#goalWizardModal,
#sipWizardModal,
#debt-transaction-drawer,
#debt-config-sidebar,
#fd-config-sidebar,
#mf-holdings-page,
#mf-transactions-page,
#stock-history-sidebar,
#stock-pnl-sidebar,
#riskWizardModal {
    position: fixed !important;
    right: 0 !important;
    /* Force to right */
    top: 0 !important;
    height: 100vh !important;
    width: 550px !important;
    /* Standardized width */
    max-width: 95vw;
    background: #ffffff !important;
    z-index: 10010 !important;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    padding: 25px;
    display: none;
    /* Controlled by JS */

    /* These ensure the sidebar doesn't create a blank space on the left */
    flex-direction: column;
    margin: 0 !important;
    left: auto !important;
    /* Prevents stretching from left: 0 */

    /* Enable scrolling */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;

    animation: slideInRight 0.3s ease-out;
    border-left: 1px solid #efeff4;
}

#stock-tx-wizard {
    position: fixed !important;
    right: 0 !important;
    top: 0 !important;
    height: 100vh !important;
    width: 550px !important;
    max-width: 100vw !important;
    background: #ffffff !important;
    z-index: 10030 !important;
    padding: 15px !important;
    /* Reduced from 25px to save space */
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    animation: slideInRight 0.3s ease-out;
    border-left: 1px solid #efeff4;
    box-sizing: border-box;
    /* Ensures padding doesn't add to width */
}



/* Ensure centering for the Add Scheme Popup */
#addSchemeModal.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 10011;
}


.holding-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #edf2f7;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.2s;
}

.holding-card:hover {
    transform: translateY(-5px);
}

.holding-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.holding-label {
    color: #718096;
}

.holding-value {
    font-weight: 600;
    color: #2d3748;
}

.holding-profit {
    color: #48bb78;
    font-weight: 700;
}

.holding-loss {
    color: #f56565;
    font-weight: 700;
}

/* FORCE ALL SIDEBARS TO WHITE BACKGROUND */
#goalWizardModal .modal-content,
#sipWizardModal .modal-content,
#goal-detail-inline-section,
#debt-transaction-drawer,
#debt-config-sidebar,
#fd-config-sidebar {
    background-color: #ffffff !important;
    color: #333333 !important;
    border-left: 1px solid #ddd !important;
}

/* Ensure all labels inside white sidebars are dark */
#goalWizardModal label,
#sipWizardModal label,
#debt-transaction-drawer label,
#debt-config-sidebar label {
    color: #555555 !important;
}

/* Ensure inputs inside white sidebars have dark text and light backgrounds */
#goalWizardModal input, #goalWizardModal select,
#sipWizardModal input, #sipWizardModal select,
#debt-transaction-drawer input, #debt-transaction-drawer select,
#debt-config-sidebar input, #debt-config-sidebar select,
.wiz-input {
    background-color: #f8f9fa !important;
    color: #1c1c1e !important;
    border: 1px solid #ced4da !important;
}

#debt-transaction-drawer {
    animation: slideInRight 0.3s ease-out;
}

/* 2. Global Input Styling for all sidebars to ensure professionalism */
#goalWizardModal .modal-content label,
#sipWizardModal .modal-content label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
    display: block;
}

#goalWizardModal .modal-content input,
#goalWizardModal .modal-content select,
#sipWizardModal .modal-content input,
#sipWizardModal .modal-content select {
    background-color: #ffffff !important;
    border: 1px solid #ced4da !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    font-size: 0.9rem !important;
    text-align: left !important;
    width: 100% !important;
    margin-bottom: 12px !important;
    display: block !important;
}

/* 3. Handling Read-only fields */
#sip_code, #sip_fund_name[readonly] {
    background-color: #e9ecef !important;
    color: #495057 !important;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

/* Sidebar Drawer Style for all MF Panels */
#mf-holdings-section, #mf-transactions-section, #sipWizardModal .modal-content {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: 600px;
    /* Wider for tables */
    max-width: 95%;
    background: #ffffff !important;
    border-left: 1px solid #ddd;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 10005;
    display: flex;
    flex-direction: column;
    padding: 25px;
    overflow-y: auto;
    animation: slideInRight 0.3s ease-out;
}

/* Specific fix for tables inside drawers */
.sidebar-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.85rem;
    /* FIX: Prevent table from shrinking too much, forcing horizontal scroll if needed */
    min-width: 600px;
}

.sidebar-table th {
    background: #f8f9fa;
    padding: 10px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
}

.sidebar-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

/* Compact Networth Header */
.slim-networth-card {
    /* background: linear-gradient(135deg, #003366, #0056b3); */
    padding: 10px 20px;
    border-radius: 8px;
    margin: 0 0 20px 0;
    /* Ensures the card itself sits on the left */
    max-width: 250px;
    color: white;
    text-align: left;
}

.val-compact {
    font-size: 1.2rem;
    font-weight: 700;
}



/* Common Popup Design */
.common-popup {
    max-width: 320px !important;
    text-align: center;
    border-radius: 16px !important;
    padding: 24px !important;
    background: var(--card-bg);
}

/* Standardized card size for all three grids */
.mini-tile, .holding-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 15px !important;
    min-height: 180px !important;
    /* Increased to match largest card */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.mini-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    /* Wider columns */
    gap: 15px;
    margin-bottom: 30px;
}

/* Specific text sizing for uniform look */
.tile-title, .holding-title {
    font-weight: 700;
    color: #004d99;
    font-size: 0.9rem;
    margin-bottom: 10px;
    line-height: 1.2;
}

/* Delete Icon and Hover Overlay */
.tile-delete {
    color: #ff453a;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    position: relative;
}

.tile-delete:hover::after {
    content: "Delete Goal?";
    position: absolute;
    bottom: 120%;
    right: 0;
    background: #ff453a;
    color: white;
    padding: 4px 8px;
    font-size: 0.6rem;
    border-radius: 4px;
}

.val-compact {
    font-size: 1.2rem;
    font-weight: 700;
}

/* Add Goal Button Styling */
.btn-add-goal {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-add-goal:hover {
    background-color: #0056b3;
}

/* Close Button Visibility Fix */
.btn-close-modal {
    width: 100%;
    margin-top: 15px;
    padding: 10px;
    background: #e9ecef;
    /* Light gray background */
    color: #333 !important;
    /* Forces dark text for visibility */
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}



/* Compact Layouts */
.compact-summary {
    /* background: linear-gradient(135deg, #003366, #0056b3); */
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    color: white;
    text-align: center;
}

.label-tiny {
    font-size: 0.65rem;
    opacity: 0.7;
    letter-spacing: 0.5px;
}

.val-med {
    font-size: 1.4rem;
    font-weight: 700;
}



.mini-tile {
    background: var(--card-bg);
    /* Uses variables from previous step */
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100px;
}

/* Detail Modal Styling */
.modal-card-detail {
    background: var(--card-bg);
    color: var(--card-text);
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    padding: 24px;
    max-height: 85vh;
    overflow-y: auto;
}

.asset-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.85rem;
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.btn-action-small {
    font-size: 0.75rem;
    padding: 10px;
    background: #f1f3f5;
    color: #0056b3;
    border-radius: 8px;
    border: none;
    font-weight: 600;
}



/* Compact Summary Header */
.summary-header {
    background: #004d99;
    /* Deep blue header */
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    color: white;
    text-align: center;
}

.summary-label {
    font-size: 0.7rem;
    letter-spacing: 1px;
    opacity: 0.8;
}

.summary-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 5px;
}

/* The Grid (Matches your reference photo tiles) */
.compact-goal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    /* Small tiled look */
    gap: 12px;
    padding: 5px;
}

.compact-goal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 12px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 110px;
    transition: all 0.2s ease;
}

.goal-top {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.goal-dot {
    width: 8px;
    height: 8px;
    background: #0a84ff;
    border-radius: 50%;
    margin-top: 5px;
}

.goal-title-small {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--card-text);
    line-height: 1.2;
}

.goal-mid {
    margin-top: 10px;
    text-align: right;
}

.current-val-small {
    font-size: 1rem;
    font-weight: 700;
    color: var(--card-text);
}

.target-val-small {
    font-size: 0.7rem;
    color: var(--card-subtext);
}

.goal-bottom-info {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--card-subtext);
}

.add-goal-link {
    color: #007bff;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
}

/* Refined Compact Swipe Container */
.goal-swipe-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding: 10px 20px 20px 20px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Compact Fintech Card Design */
.goal-card-swipe {
    flex: 0 0 280px;
    /* Fixed smaller width for a presentable look */
    background: #1c1c1e;
    color: white;
    border-radius: 12px;
    padding: 16px;
    scroll-snap-align: start;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    min-height: 140px;
    transition: transform 0.2s;
}

.goal-card-swipe:hover {
    transform: scale(1.02);
}

.goal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.goal-icon-circle {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.goal-name-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.goal-values-container {
    text-align: right;
    margin: 8px 0;
}

.goal-main-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

.goal-target-text {
    font-size: 0.75rem;
    color: #8e8e93;
}

.goal-footer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 10px;
}

.time-left-tag {
    color: #0a84ff;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(10, 132, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.remove-btn-small {
    background: none;
    border: none;
    color: #ff453a;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0.7;
}

.remove-btn-small:hover {
    opacity: 1;
}

/* Dark Theme Fintech Styles */
.kpi-card-modern {
    background: #002b5c;
    color: white;
    padding: 30px 20px;
    text-align: center;
    border-radius: 0 0 20px 20px;
    margin: -20px -20px 20px -20px;
}

.kpi-label-small {
    font-size: 0.75rem;
    opacity: 0.8;
    letter-spacing: 1px;
}

.kpi-value-large {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 5px;
}

/* Swipe Container */
.goal-carousel-wrapper {
    margin: 0 -20px;
    /* Bleed to edges */
    padding: 10px 0;
}

.goal-swipe-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    /* Modern swipe snapping */
    gap: 15px;
    padding: 0 20px 20px 20px;
    scrollbar-width: none;
    /* Hide scrollbar for clean look */
}

.goal-swipe-container::-webkit-scrollbar {
    display: none;
}

/* Goal Card UI (Based on your Screenshot) */
.goal-card-swipe {
    flex: 0 0 85%;
    /* Shows a peek of the next card */
    background: #1c1c1e;
    /* Dark modern card */
    color: white;
    border-radius: 16px;
    padding: 20px;
    scroll-snap-align: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.goal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.goal-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
}

.goal-name-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #efeff4;
}

.goal-main-value {
    font-size: 1.4rem;
    font-weight: 600;
    text-align: right;
}

.goal-target-text {
    font-size: 0.85rem;
    color: #8e8e93;
    text-align: right;
}

.goal-footer-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 20px;
}

.time-left-tag {
    color: #8e8e93;
    font-size: 0.85rem;
}

.add-text-btn {
    background: none;
    border: none;
    color: #0a84ff;
    font-weight: 600;
    cursor: pointer;
}

/* OAuth Button Styles */
.oauth-btn {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95em;
    background: white;
    transition: all 0.2s ease;
}

/* Specific Style for Google Button to fix visibility */
.oauth-btn.google {
    background-color: #ffffff;
    color: #444444;
    /* Dark grey text for visibility on white background */
    border: 1px solid #dcdcdc;
    /* Subtle border to define the button edge */
}

/* Specific Style for Apple Button */
.oauth-btn.apple {
    background-color: #000000;
    color: #ffffff;
    border: none;
}

/* Ensure images have space and don't overlap text */
.oauth-btn img {
    width: 20px;
    height: 20px;
    margin-right: 12px;
}

.oauth-btn:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    filter: brightness(0.95);
}

/* Compact Wizard Layout */
.compact-wizard {
    max-width: 400px !important;
    /* Forces a smaller, mobile-like width */
    padding: 20px !important;
}

.wizard-row {
    margin-bottom: 12px;
}

.wizard-row.split {
    display: flex;
    gap: 10px;
}

.wiz-field {
    flex: 1;
}

.wiz-input {
    width: 100%;
    padding: 8px;
    font-size: 0.9rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
}

/* Smaller Buttons */
.wizard-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.btn-wiz-save {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-wiz-cancel {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

/* Enhanced Delete Button with Tooltip/Overlay */
.tile-delete {
    color: #ff453a;
    /* Bright Red */
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    padding: 5px;
}

.tile-delete:hover::after {
    content: "Delete Goal?";
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(255, 69, 58, 0.9);
    color: white;
    padding: 4px 8px;
    font-size: 0.65rem;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 10;
}

.common-popup {
    max-width: 320px !important;
    text-align: center;
    padding: 25px !important;
    border-radius: 15px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
}

.modal-actions-horizontal {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.btn-primary-small {
    background: #ff453a;
    /* Red for delete/confirm */
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.btn-secondary-small {
    background: #e9ecef;
    color: #333;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
}


/* Slimmer Networth Banner */
.compact-summary {
    /* background: linear-gradient(135deg, #003366, #0056b3); */
    padding: 10px 15px;
    border-radius: 8px;
    margin: 0 auto 20px auto;
    max-width: 250px;
    /* Constrains it to be small */
    color: white;
    text-align: center;
}

.val-med {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Common Popup Styles */
.common-popup {
    max-width: 320px !important;
    text-align: center;
    border-radius: 16px !important;
    padding: 24px !important;
}

/* Close Button Theme Fix */
.btn-close-modal {
    width: 100%;
    margin-top: 15px;
    padding: 10px;
    background: #f1f3f5;
    color: #333 !important;
    /* Forces dark text in light mode */
    border: none;
    border-radius: 8px;
    font-weight: 600;
}



/* Delete Button Overlay Hover Effect */
.tile-delete:hover::after {
    content: "Delete Goal?";
    position: absolute;
    bottom: 120%;
    right: 0;
    background: #ff453a;
    color: white;
    padding: 4px 8px;
    font-size: 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
}

/* Sidebar Responsive & Safe Area Support */
#goal-detail-inline-section {
    /* Responsive width */
    width: 440px !important;
    max-width: 100vw;

    /* Safe Area Insets for PWA */
    padding-top: calc(15px + env(safe-area-inset-top)) !important;
    padding-bottom: calc(15px + env(safe-area-inset-bottom)) !important;
    padding-left: calc(20px + env(safe-area-inset-left)) !important;
    padding-right: calc(20px + env(safe-area-inset-right)) !important;

    box-sizing: border-box;
}

/* On mobile devices, make it full width */
@media (max-width: 480px) {
    #goal-detail-inline-section {
        width: 100% !important;
    }
}

/* Mobile Responsive for Goal Wizard */
@media (max-width: 480px) {
    #goalWizardModal {
        width: 100% !important;
        border-radius: 0 !important;
        /* Full screen feels better on mobile */
    }
}

/* Sidebar Responsive Logic */
@media (max-width: 500px) {
    #sipProjectionSidebar {
        width: 100% !important;
        border-radius: 0 !important;
    }
}

#goalDetailContent {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
    /* Smooth scrolling for iOS */
    -webkit-overflow-scrolling: touch;
}

#goalDetailTitleContainer {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

#goal-detail-inline-section {
    position: fixed;
    /* Ensures it stays locked to the right side of the screen */
    right: 0;
    top: 0;
    height: 100vh;
    z-index: 10006 !important;
}

#goal-detail-inline-section {
    z-index: 10006 !important;
    /* Higher than card container */
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

/* Ensure a background overlay exists when the drawer is open */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10004;
    display: none;
}



.action-footer {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    /* Forces button to the LEFT */
    margin-top: 15px;
    padding-left: 0;
}


/*New Card type CSS end here*/

/* Add this inside your <style> block */
#goalTable td:first-child input[type="text"] {
    min-width: 250px;
    /* Increased from default */
    text-align: left;
    font-weight: 600;
}

/* Import Modern Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

body {
    font-family: 'Poppins', sans-serif;
    margin: 20px;
    background-color: #f4f7f6;
    color: #333;
}

h1 {
    margin: 0;
    font-weight: 600;
}

/* Premium Login Background */
#loginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Deep Fintech Gradient */
    background: linear-gradient(135deg, #001a33 0%, #002b5c 50%, #004d99 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* 2. Your existing Login Box style with one small tweak for mobile width */
.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 50px 40px;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    text-align: center;
    width: 380px;
    max-width: 90%;
    /* Added this: ensures it fits on narrow iPhones */
    border-top: 5px solid #28a745;
    margin: auto;
    /* Keeps it centered within the safe-area padding */
}

.login-box h2 {
    color: #004d99;
    margin-bottom: 5px;
}

.login-box input {
    width: 100%;
    padding: 14px;
    margin: 20px 0;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 15px;
}

.toggle-link {
    color: #004d99;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
}

#appContainer {
    display: none;
    max-width: 1400px;
    margin: 0 auto;
}

.forgot-password-link {
    font-size: 0.85rem;
    color: #3b82f6;
    /* A professional blue */
    text-decoration: none;
    display: block;
    margin-top: 10px;
    text-align: right;
}

.forgot-password-link:hover {
    text-decoration: underline;
}

/* --- LAYOUT & DASHBOARD --- */
.user-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 25px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.chart-card {
    background: white;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    text-align: center;
}

.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

.kpi-card {
    /* background: linear-gradient(135deg, #004d99, #003366);  */
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 25px;
}

.kpi-value {
    font-size: 2.5em;
    font-weight: 700;
    margin-top: 5px;
}

/* --- TABS --- */
.tab-controls {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    overflow-x: auto;
    padding-bottom: 2px;
}

.tab-group {
    display: flex;
    flex-direction: column;
}

.tab-button {
    padding: 12px 20px;
    margin-right: 8px;
    cursor: pointer;
    background: #e9ecef;
    color: #555;
    border: none;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s;
    font-weight: 500;
    white-space: nowrap;
}

.tab-button.active {
    background: #004d99;
    color: white;
    box-shadow: 0 -2px 10px rgba(0, 77, 153, 0.2);
}

#mf-child-tabs {
    display: none;
    background: #f1f3f5;
    border-radius: 0 0 8px 8px;
    padding: 8px;
    margin-top: -2px;
    margin-right: 8px;
}

#mf-child-tabs .tab-button {
    background: transparent;
    color: #004d99;
    border: 1px solid #004d99;
    font-size: 0.85em;
    padding: 6px 12px;
}

#mf-child-tabs .tab-button.active {
    background: #004d99;
    color: white;
    border: 1px solid #004d99;
}

.tab-content {
    padding: 0px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 0 10px 10px 10px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- CONTROLS & TABLE --- */
.controls {
    margin-bottom: 20px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

button {
    padding: 10px 16px;
    cursor: pointer;
    background-color: #0056b3;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
}

.delete-btn {
    background-color: #ff4d4d;
    padding: 6px 12px;
    font-size: 0.8em;
}

.status {
    margin-top: 0;
    margin-left: auto;
    padding: 8px 15px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
    background-color: #e6ffe6;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* TABLE IMPROVEMENTS */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    font-size: 0.9em;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    table-layout: auto;
}

th, td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #eee;
    border-right: 1px solid #eee;
    white-space: nowrap;
}

th {
    background-color: #f1f3f5;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
}

/* WIDER INPUTS */
input, select {
    border: 1px solid transparent;
    width: 100%;
    text-align: center;
    background: transparent;
    padding: 6px;
    border-radius: 4px;
}

input:focus, select:focus {
    border: 1px solid #007bff;
    background: #fff;
    outline: none;
}

/* Specific Widths for Readability */
input[type="date"] {
    min-width: 130px;
}

input[placeholder="Fund Name"], select {
    min-width: 180px;
    max-width: 300px;
}

input[placeholder="Notes"] {
    min-width: 200px;
    text-align: left;
}

input[type="number"] {
    min-width: 80px;
}

/* Colored Columns */
.goal-calc-field, .mf-metric-field, .gs-calc-field {
    background-color: #e8f5e9;
    font-weight: 600;
    color: #155724;
}

.mf-goal-col {
    background-color: #f8f9fa;
}

.manual-entry-row td {
    background-color: #fff3cd !important;
    border-bottom: 2px solid #ffeeba;
}

/* PAGINATION CONTROLS */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
    gap: 15px;
}

.pagination-btn {
    background-color: #6c757d;
    padding: 6px 12px;
    font-size: 0.85em;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-weight: 600;
    color: #555;
}

/* Add this to increase Fund Name width in Config Table */
#configTable td:nth-child(2) input {
    min-width: 350px;
    /* Increased width */
    text-align: left;
    /* Align text to left for better readability */
}

/* Add this to increase column widths in Fixed Income Table */

/* 1. Name Column (1st column) */
#fixedIncomeTable td:first-child input {
    min-width: 250px;
    text-align: left;
    font-weight: 600;
}

/* 2. Remarks Column (10th column) */
#fixedIncomeTable td:nth-child(10) input {
    min-width: 300px;
    /* Make remarks extra wide */
    text-align: left;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: 0;
    /* Change this to 'auto' if you want User/Menu to stay on the far right */
}

.header-actions button {
    padding: 8px 15px;
    font-size: 0.85em;
    border-radius: 5px;
    white-space: nowrap;
    /* Prevents text from wrapping on small screens */
}

/* Ensure the profile container inherits theme colors */
#profile-page .controls {
    transition: background-color 0.3s ease;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Dropdown Container */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Dropdown Button */
.dropbtn {
    background-color: #0056b3;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

/* Dropdown Content (Hidden by Default) */
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    border-radius: 8px;
    margin-top: 5px;
    overflow: hidden;
}

/* Links inside the dropdown */
.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 14px;
    transition: background 0.2s;
}

/* Change color on hover */
.dropdown-content a:hover {
    background-color: #f1f1f1;
}

/* Show the dropdown when the button is clicked */
.show {
    display: block;
}

/* Loading Overlay Styles */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    display: none;
    /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #0056b3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Style for the Danger/Reset Button */
.btn-danger {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
}

.btn-danger:hover {
    background-color: #bb2d3b;
}

.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px;
    background-color: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 8px;
    color: #3c4043;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3);
    margin-bottom: 20px;
}

.google-signin-btn:hover {
    background-color: #f8f9fa;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3), 0 4px 8px rgba(60, 64, 67, 0.15);
}

.google-signin-btn img {
    width: 20px;
    height: 20px;
    margin-right: 12px;
}

.sync-indicator {
  /* position: fixed; */
  top: 10px;
  right: 10px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
}
.online { background: #e6fffa; color: #2c7a7b; border: 1px solid #b2f5ea; }
.offline { background: #fff5f5; color: #c53030; border: 1px solid #feb2b2; }


#annualReportOverlay {
    -webkit-overflow-scrolling: touch; /* Smooth scrolling for iOS */

}

#annualReportOverlay {
    box-shadow: -5px 0 25px rgba(0,0,0,0.15); /* Adds depth when sliding in */
    border-left: 1px solid #e2e8f0;
}

/* Ensure child elements don't cause horizontal overflow */
#annualReportOverlay * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Ensure the select dropdown doesn't zoom in on iPhone */
@media screen and (max-width: 768px) {
    #reportGoalSelect {
        font-size: 16px !important;
    }
}

.fullscreen-overlay {
    position: fixed;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    overflow-y: auto;
}

#liquid-detail-page {
    /* Fix for mobile browsers height */
    height: 100dvh !important;
    /* Ensure it stays on top of everything */
    z-index: 100000 !important;
}

/* Add a smooth entry animation if not already present */
@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}