.performance-table thead th {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    border-color: rgba(255, 255, 255, 0.15);
}

/* Empty portfolio onboarding overlay */
.empty-portfolio-overlay {
    position: fixed;
    top: 4rem;
    left: 50%;
    width: min(480px, calc(100vw - 2rem));
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transform: translate3d(-50%, -12px, 0);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.empty-portfolio-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate3d(-50%, 0, 0);
    pointer-events: auto;
}

.empty-portfolio-overlay .overlay-panel {
    background: rgba(4, 8, 20, 0.97);
    color: #fff;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    padding: 1.5rem;
    pointer-events: auto;
    position: relative;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
}

.empty-portfolio-overlay .overlay-backdrop {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, rgba(1, 12, 44, 0.45), transparent 65%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
    z-index: -1;
}

.empty-portfolio-overlay.is-visible .overlay-backdrop {
    opacity: 1;
}

.empty-portfolio-overlay .overlay-header .btn-close {
    filter: invert(1);
    opacity: 0.8;
}

.empty-portfolio-overlay .overlay-body {
    margin-top: 1rem;
    margin-bottom: 1.25rem;
}

.empty-portfolio-overlay .overlay-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1rem;
}

.empty-portfolio-overlay .overlay-footer small {
    flex: 1 1 auto;
    color: rgba(255, 255, 255, 0.55);
}

.empty-portfolio-overlay .overlay-footer .btn {
    min-width: 160px;
}

.empty-portfolio-overlay .empty-portfolio-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.empty-portfolio-overlay .empty-portfolio-option-card {
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0.85rem;
    padding: 1.25rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 190px;
    color: #1a1a1a;
}

.empty-portfolio-overlay .empty-portfolio-option-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.25);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.12));
}

.empty-portfolio-overlay .option-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.empty-portfolio-overlay .initial-transaction-form {
    animation: fadeIn 0.25s ease;
}

.empty-portfolio-overlay .initial-asset-card {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.85rem;
    padding: 0.5rem;
    background-color: rgba(0, 0, 0, 0.2);
    min-height: 100%;
}

/* Brand colors for initial transaction asset cards */
.empty-portfolio-overlay .initial-asset-card.tickersSTOCK {
    border-left: 4px solid var(--asset-stock-color);
    background: linear-gradient(145deg, var(--asset-stock-bg), rgba(0, 0, 0, 0.1));
}

.empty-portfolio-overlay .initial-asset-card.tickersBOND {
    border-left: 4px solid var(--asset-bond-color);
    background: linear-gradient(145deg, var(--asset-bond-bg), rgba(0, 0, 0, 0.1));
}

.empty-portfolio-overlay .initial-asset-card.tickersGOLD {
    border-left: 4px solid var(--asset-gold-color);
    background: linear-gradient(145deg, var(--asset-gold-bg), rgba(0, 0, 0, 0.1));
}

.empty-portfolio-overlay .initial-asset-card .form-label {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.empty-portfolio-overlay .asset-selector-input {
    cursor: pointer;
    min-height: 50px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
}


@media (max-width: 767.98px) {
    .empty-portfolio-overlay {
        left: 50%;
        right: auto;
        width: min(520px, calc(100vw - 2rem));
        top: 5rem;
    }
}

@media (max-width: 576px) {
    .empty-portfolio-overlay .empty-portfolio-option-card {
        min-height: 150px;
    }

    .empty-portfolio-overlay .overlay-footer {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    .empty-portfolio-overlay .overlay-footer .btn {
        width: 100%;
    }
}

/* Asset Selector Filter Buttons - Market Filters */

.asset-selector-modal.modal {
    z-index: 10000 !important; /* Higher than transaction modal (9999) */
}

.modal-backdrop.asset-selector-backdrop {
    z-index: 9999 !important; /* Behind the modal but above everything else */
}

@media (max-width: 576px) {
    .empty-portfolio-modal .empty-portfolio-option-card {
        min-height: 150px;
    }

    .empty-portfolio-modal .modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .empty-portfolio-modal .modal-footer .btn {
        width: 100%;
    }
}

.performance-table tbody td {
    color: var(--white);
    font-weight: 600;
    border-color: rgba(255, 255, 255, 0.05);
}

.performance-table td.text-success,
.performance-table td.text-danger {
    font-weight: 700;
}
.summary-section + .summary-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.2);
}

.summary-section-title {
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.65rem;
}
/* Timeline Accordion Styles */
#timelineAccordionHeader {
    transition: background-color 0.2s ease;
}

#timelineAccordionHeader:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

#timelineChevron {
    transition: transform 0.3s ease;
    display: inline-block;
}

#timelineChevron.rotated {
    transform: rotate(90deg);
}

#timelineAccordionBody {
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

#timelineAccordionBody.collapse {
    display: block;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

#timelineAccordionBody.collapse.show {
    max-height: 5000px;
    opacity: 1;
}

/* Section 1 Header Layout for Normal Screens */
@media (min-width: 768px) {
    .card-header.d-flex {
        align-items: flex-start !important;
    }
    
    .card-header .flex-grow-1 {
        flex: 0 0 75% !important;
        max-width: 75% !important;
    }
    
    .card-header #introButton,
    .card-header #introButtonB,
    .card-header #mainIntroButton {
        flex: 0 0 0 !important;
        max-width: 20% !important;
        align-self: flex-start !important;
        margin-top: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* Section 1 Input Parameters Styling */
.input-param-box {
    display: flex;
    align-items: center;
    border: 1px solid #000;
    border-radius: 6px;
    background-color: #fff;
    font-family: 'Spline Sans', sans-serif;
    height: 40px;
    overflow: hidden;
}

.input-param-box i {
    font-size: 1rem;
    color: #040814;
    flex-shrink: 0;
    background-color: #f8f9fa;
    padding: 0.5rem;
    border-right: 1px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

/* Asset icon styling */
.input-param-box .asset-icon {
    color: #fff !important;
    height: 38px !important;
    width: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important; /* Adjust font size to fit nicely in 38px */
}

.input-param-box .asset-icon-stock {
    background-color: var(--asset-stock-color) !important;
}

.input-param-box .asset-icon-bond {
    background-color: var(--asset-bond-color) !important;
}

.input-param-box .asset-icon-gold {
    background-color: var(--asset-gold-color) !important;
}

/* Calendar icon styling */
.input-param-box .calendar-icon {
    color: #040814 !important;
    background-color: #f8f9fa !important;
}

.input-param-box label {
    font-weight: bold;
    color: #040814;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 1; /* Allow shrinking */
    padding: 0.5rem;
    border-right: 1px solid #000;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    min-width: 60px; /* Smaller minimum width */
    width: 80px; /* Fixed width for all labels */
    justify-content: center; /* Center text within fixed width */
}

@media (max-width: 480px) {
    /* Let Pharos Risk labels wrap on small screens */
    .risk-flex-section .input-param-box label {
        white-space: normal;
        width: auto;
        min-width: 0;
        line-height: 1.1;
    }
}

.input-param-box input.form-control {
    flex: 0 0 auto; /* Don't grow, don't shrink, auto width */
    border: none;
    background: transparent;
    padding: 0.5rem;
    font-size: 0.9rem;
    height: 100%;
    width: 100px; /* Fixed width for asset input fields */
}

.input-param-box input.form-control:focus {
    outline: none;
    box-shadow: none;
}

.input-param-box select.form-control {
    flex: 0 0 auto; /* Don't grow, don't shrink, auto width */
    border: none;
    background: transparent;
    padding: 0.5rem;
    font-size: 0.9rem;
    height: 100%;
    width: 120px; /* Fixed narrower width for dropdown */
}

.input-param-box select.form-control:focus {
    outline: none;
    box-shadow: none;
}

.input-param-box .bi-arrow-right {
    font-size: 0.9rem;
    color: #040814;
    background-color: #f8f9fa;
    padding: 0.5rem;
    border-left: 1px solid #000;
    border-right: 1px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
}

.section-divider {
    border: 0;
    border-top: 1px solid #000;
    margin: 0;
    opacity: 1;
    width: 100%;
}

/* Tutorial button styling - Gold color, no shadows */
#introButton, #introButtonB, #mainIntroButton {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--gold) !important;
    border-color: var(--gold) !important;
    color: var(--darkblue) !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
}

#introButton:hover, #introButtonB:hover, #mainIntroButton:hover {
    background-color: #e6c200 !important;
    border-color: #e6c200 !important;
    color: var(--darkblue) !important;
}

#introButton i, #introButtonB i, #mainIntroButton i {
    font-family: "Font Awesome 6 Free" !important;
}

#introButton span, #introButtonB span, #mainIntroButton span {
    font-family: 'Spline Sans', sans-serif !important;
}

/* Embedded Asset Selectors Styling */
.card .tickersSTOCK,
.card .tickersBOND,
.card .tickersGOLD {
    margin-bottom: 0.5rem;
}

.card .tickersSTOCK:last-child,
.card .tickersBOND:last-child,
.card .tickersGOLD:last-child {
    margin-bottom: 0;
}

.summary-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.3rem;
}
.summary-section + .summary-section {
    margin-top: 0;
    padding-top: 1rem;
    border-top: none;
}

.summary-section-title {
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.65rem;
}

.performance-placeholder {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
}

@media (max-width: 1399.98px) {
    .summary-metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .summary-metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

.summary-metric {
    background-color: rgba(17, 26, 60, 0.02);
    border-radius: 0.75rem;
    padding: 0.6rem 0.9rem;
}

.summary-metric .label {
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(17, 26, 60, 0.65);
}

.summary-metric .value {
    font-weight: 600;
    color: var(--black);
}

.summary-metric-grid .value {
    font-weight: 700;
}

.portfolio-summary-card {
    grid-column: 1 / -1;
}

.portfolio-summary-card .summary-metric {
    background-color: rgba(255, 255, 255, 0.08);
}

.portfolio-summary-card .summary-metric .label {
    color: rgba(255, 255, 255, 0.75);
}

.portfolio-summary-card .summary-metric .value {
    color: var(--white);
}

.asset-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

@media (max-width: 1199.98px) {
    .asset-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

.asset-card {
    border: 1px solid rgba(4, 8, 20, 0.08);
    border-radius: 1rem;
    background-color: var(--white);
    padding: 0.85rem 1rem 0.4rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0.35rem 0.75rem rgba(4, 8, 20, 0.06);
    min-height: 100%;
    color: var(--black);
}

.asset-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.asset-type-label {
    letter-spacing: 0.08em;
    color: rgba(4, 8, 20, 0.6);
}

.asset-card-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.2rem;
}

@media (max-width: 767.98px) {
    .asset-card-body {
        grid-template-columns: 1fr;
    }
}

.asset-metric {
    background-color: rgba(17, 26, 60, 0.03);
    border-radius: 0.75rem;
    padding: 0.45rem 0.75rem 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.asset-metric .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(17, 26, 60, 0.7);
}

.asset-metric .label .last-price-date {
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: normal;
    text-transform: none;
    color: rgba(17, 26, 60, 0.6);
    margin-left: 0.35rem;
}

.asset-metric .value {
    font-weight: 600;
    font-size: 1rem;
    color: var(--black);
}

.asset-details-toggle {
    font-weight: 600;
    color: var(--lightblue);
    text-decoration: none;
}

.asset-details-toggle i {
    transition: transform 0.2s ease;
}

.asset-details-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.asset-card-details {
    border-top: 1px dashed rgba(4, 8, 20, 0.1);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    display: none;
}

.asset-card-details.show {
    display: block;
}

.asset-card-details-body {
    max-height: 260px;
    overflow-y: auto;
}

.asset-card-total {
    background: linear-gradient(135deg, var(--darkblue), var(--black));
    color: var(--white);
    grid-column: 1 / -1;
}

.asset-card-total h6 {
    color: var(--white);
}

.asset-card-total .asset-type-label,
.asset-card-total small {
    color: rgba(255, 255, 255, 0.85);
}

.asset-card-total .asset-metric {
    background-color: rgba(255, 255, 255, 0.08);
}

.asset-card-total .asset-metric .label {
    color: rgba(255, 255, 255, 0.75);
}

.asset-card-total .asset-metric .value {
    color: var(--white);
}

@media (max-width: 575.98px) {
    .asset-card {
        padding: 0.75rem 0.85rem;
    }

    .asset-card-body {
        grid-template-columns: 1fr;
    }
}

/* Asset selector row spacing */
.col-lg-10.col-md-9 {
    margin-bottom: 5px;
}

.col-lg-10.col-md-9:last-child {
    margin-bottom: 0;
}

/* Asset selector row spacing inside pharosSwitchPanel */
.pharosSwitchPanel .col-lg-10.col-md-9 {
    margin-bottom: 5px;
}

.pharosSwitchPanel .col-lg-10.col-md-9:last-child {
    margin-bottom: 0;
}

/* Asset Brand Color Variables */
:root {
    --asset-stock-color: var(--lightblue);
    --asset-stock-bg: rgba(92, 130, 190, 0.08);
    --asset-bond-color: var(--darkblue);
    --asset-bond-bg: rgba(17, 26, 60, 0.08);
    --asset-gold-color: var(--gold);
    --asset-gold-bg: rgba(255, 215, 0, 0.12);
}

/* Brand Colors for Asset Classes */
.asset-card.tickersSTOCK {
    border-top: 4px solid var(--asset-stock-color);
    background: linear-gradient(145deg, var(--asset-stock-bg), var(--white));
}

.asset-card.tickersBOND {
    border-top: 4px solid var(--asset-bond-color);
    background: linear-gradient(145deg, var(--asset-bond-bg), var(--white));
}

.asset-card.tickersGOLD {
    border-top: 4px solid var(--asset-gold-color);
    background: linear-gradient(145deg, var(--asset-gold-bg), var(--white));
}

.rebalancing-timeline {
    position: relative;
    padding-left: 1.75rem;
}

.rebalancing-timeline::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 16px;
    width: 2px;
    background: rgba(17, 26, 60, 0.12);
}

.timeline-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    position: relative;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-badge {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background-color: var(--lightblue);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.timeline-item.manual .timeline-badge {
    background-color: var(--gold);
    color: var(--black);
}

.timeline-item.deposit .timeline-badge {
    background-color: #198754;
}

.timeline-item.withdrawal .timeline-badge {
    background-color: #dc3545;
}

.timeline-item.deposit .timeline-card {
    border-top: 3px solid rgba(25, 135, 84, 0.65);
    box-shadow: 0 0.5rem 1.5rem rgba(25, 135, 84, 0.15);
}

.timeline-item.withdrawal .timeline-card {
    border-top: 3px solid rgba(220, 53, 69, 0.65);
    box-shadow: 0 0.5rem 1.5rem rgba(220, 53, 69, 0.15);
}

.timeline-card {
    flex: 1;
    background-color: var(--white);
    border: 1px solid rgba(17, 26, 60, 0.08);
    border-radius: 0.85rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 0.35rem 1rem rgba(4, 8, 20, 0.08);
}

.timeline-card-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.timeline-card-header-left {
    flex: 1;
}

.timeline-card-header-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.timeline-date {
    font-weight: 600;
    color: var(--black);
}

.timeline-status {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.timeline-status.executed {
    color: #198754;
}

.timeline-status.pending {
    color: var(--red);
}

.timeline-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.timeline-badge-pill.risk {
    background-color: rgba(16, 32, 82, 0.15);
    color: var(--blue);
    border: 1px solid rgba(16, 32, 82, 0.3);
}

.timeline-badge-pill.deposit {
    background-color: rgba(25, 135, 84, 0.15);
    color: #198754;
    border: 1px solid rgba(25, 135, 84, 0.3);
}

.timeline-badge-pill.withdrawal {
    background-color: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.timeline-section + .timeline-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(17, 26, 60, 0.15);
}

.timeline-section h6 {
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(17, 26, 60, 0.6);
    margin-bottom: 0.35rem;
}

.timeline-list {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.timeline-list li {
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.timeline-list.timeline-combined-list li {
    align-items: flex-start;
    gap: 1rem;
    display: flex;
    flex-direction: row;
}

.timeline-header-row {
    align-items: center !important;
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(17, 26, 60, 0.1);
}

.timeline-header-spacer {
    width: 140px;
    flex-shrink: 0;
}

.asset-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    width: 140px;
    flex-shrink: 0;
    justify-content: center;
}

.asset-tag.stock {
    background-color: var(--asset-stock-bg);
    color: var(--asset-stock-color);
}

.asset-tag.bond {
    background-color: var(--asset-bond-bg);
    color: var(--asset-bond-color);
}

.asset-tag.gold {
    background-color: var(--asset-gold-bg);
    color: var(--asset-gold-color);
}

.timeline-value {
    font-weight: 600;
    color: var(--black);
}

.timeline-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.timeline-column-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(17, 26, 60, 0.5);
}

.timeline-header-row .timeline-column-header:first-of-type {
    width: 400px;
    flex-shrink: 0;
}

.timeline-header-row .timeline-column-header:last-of-type {
    flex: 1;
    min-width: 0;
}

.timeline-predicted-column {
    width: 400px;
    flex-shrink: 0;
}

.timeline-executed-column {
    flex: 1;
    min-width: 0;
}

.timeline-predicted {
    font-size: 0.85rem;
    color: rgba(17, 26, 60, 0.7);
}

.timeline-predicted-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid rgba(103, 58, 183, 0.25);
    border-left: 3px solid rgba(103, 58, 183, 0.6);
    border-radius: 0.65rem;
    background-color: rgba(103, 58, 183, 0.05);
    /* font-size: 0.85rem; */
    width: 100%;
    box-sizing: border-box;
}

.timeline-predicted-action {
    font-weight: 600;
    min-width: 70px;
    /* font-size: 0.85rem; */
}

.timeline-predicted-detail {
    color: rgba(17, 26, 60, 0.75);
    flex: 1;
    /* font-size: 0.85rem; */
}

.timeline-actual-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.timeline-actual-chip {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid rgba(17, 26, 60, 0.12);
    position: relative;
    border-left: 3px solid var(--lightblue);
    border-radius: 0.65rem;
    background-color: rgba(17, 26, 60, 0.02);
    width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
}

.timeline-actual-action {
    font-weight: 600;
    white-space: nowrap;
}

.timeline-actual-detail {
    /* font-size: 0.85rem; */
    font-weight: 600;
}

.timeline-actual-value {
    color: rgba(17, 26, 60, 0.85);
}

.timeline-actual-date {
    color: rgba(17, 26, 60, 0.6);
}

.timeline-actual-chip .timeline-value {
    font-weight: 600;
}

.timeline-delete-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
}

.timeline-delete-btn:hover {
    opacity: 1;
}

.timeline-actual-chip:hover .timeline-delete-btn {
    opacity: 1;
}

.timeline-delete-rebalance-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    white-space: nowrap;
    margin-left: 0.5rem;
}

.timeline-card-header-badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.timeline-empty,
.timeline-loading {
    border: 1px dashed rgba(17, 26, 60, 0.15);
    border-radius: 0.75rem;
    background-color: rgba(17, 26, 60, 0.02);
}

@media (max-width: 767.98px) {
    .rebalancing-timeline {
        padding-left: 0;
    }

    .rebalancing-timeline::before {
        display: none;
    }

    .timeline-item {
        flex-direction: column;
    }

    .timeline-badge {
        margin-bottom: 0.5rem;
    }

    .timeline-actual-chip {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Stack timeline rows vertically on mobile */
    .timeline-list.timeline-combined-list li {
        flex-direction: column;
        gap: 1rem;
    }
    
    .timeline-predicted-column,
    .timeline-executed-column {
        min-width: auto;
        width: 100%;
    }
    
    .timeline-header-row {
        display: none;
    }
    
    .timeline-column::before {
        content: attr(data-header);
        font-size: 0.65rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: rgba(17, 26, 60, 0.5);
        margin-bottom: 0.5rem;
        display: block;
    }
    
    .timeline-predicted-column::before {
        content: "PREDICTED";
    }
    
    .timeline-executed-column::before {
        content: "EXECUTED";
    }
    
    .asset-tag {
        width: 100%;
    }
}

/* Asset selector input styling */
.asset-selector-input {
    cursor: pointer !important;
    background-color: #fff !important;
    border: none !important;
    max-width: 120px !important;
    min-width: 100px !important;
}

.asset-selector-input:hover {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

.asset-selector-input:focus {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

.asset-selector-input[disabled] {
    cursor: not-allowed !important;
    background-color: #e9ecef !important;
    opacity: 0.6 !important;
}

/* Allocation input styling */
input[type="number"]#goldAllocStd[disabled],
input[type="number"]#goldAllocStd[readonly] {
    background-color: #e9ecef !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Asset Selection Modal Styling */
#assetSelectionModal {
    z-index: 10000 !important;
}

#assetSelectionModal .modal-dialog {
    max-width: 800px;
    max-height: calc(100vh - 2rem);
    margin: 1rem auto;
    display: flex;
    z-index: 10001 !important;
}

#assetSelectionModal .modal-content {
    flex: 1;
    max-height: 100%;
    overflow: hidden;
    z-index: 10002 !important;
}

/* Ensure modal is properly hidden when not shown */
#assetSelectionModal:not(.show) {
    display: none !important;
}

/* Remove any backdrop interference */
.modal-backdrop {
    z-index: 9999 !important;
}

.asset-item {
    transition: all 0.2s ease;
    border: 1px solid #dee2e6;
}

.asset-item:hover {
    border-color: #86b7fe;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transform: translateY(-1px);
}

.asset-item.selected {
    border-color: #0d6efd;
    background-color: #e7f1ff;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.asset-item h6 {
    color: #212529;
    font-weight: 600;
}

.asset-item small {
    font-size: 0.875rem;
}

.asset-item .badge {
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    line-height: 1.2;
}


/* Brand colors for asset items in modal */
.asset-item[data-asset-class="STOCK"] .badge {
    background-color: var(--asset-stock-color) !important;
}

.asset-item[data-asset-class="BOND"] .badge {
    background-color: var(--asset-bond-color) !important;
}

.asset-item[data-asset-class="GOLD"] .badge {
    background-color: var(--asset-gold-color) !important;
    color: #000 !important;
}

.asset-item[data-asset-class="STOCK"] .badge.badge-index,
.asset-item[data-asset-class="BOND"] .badge.badge-index,
.asset-item[data-asset-class="GOLD"] .badge.badge-index {
    background-color: #f2f2f2 !important;
    color: #212529 !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

/* Ensure lessoptimal badge always has bg-danger, overriding asset class colors */
.asset-item .badge.lessoptimal,
.badge.lessoptimal {
    background-color: #dc3545 !important;
    color: #fff !important;
}

/* Search input styling */
#assetSearchInput {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
}

#assetSearchInput:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Asset list container */
#assetListContainer {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background-color: #fff;
}

#assetSelectionModal .modal-body {
    overflow-y: auto;
    max-height: calc(100vh - 2rem - 120px);
}

#assetListContainer::-webkit-scrollbar {
    width: 8px;
}

#assetListContainer::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#assetListContainer::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#assetListContainer::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mobile responsive styles for asset selection modal */
@media (max-width: 768px) {
    #assetSelectionModal .modal-dialog {
        max-width: calc(100vw - 1rem) !important;
        margin: 0.5rem auto !important;
        max-height: calc(100vh - 1rem) !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    #assetSelectionModal .modal-content {
        max-height: calc(100vh - 1rem) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important; /* No scroll on modal-content */
    }
    
    #assetSelectionModal .modal-header {
        flex-shrink: 0 !important;
        padding: 1rem 0.75rem !important;
    }
    
    #assetSelectionModal .modal-body {
        flex-shrink: 0 !important; /* Don't shrink */
        overflow: visible !important; /* No scroll on modal-body */
        padding: 1rem 0.75rem !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    #assetSelectionModal .modal-footer {
        flex-shrink: 0 !important;
        padding: 0.75rem !important;
        background: white;
        border-top: 1px solid #dee2e6;
        position: sticky;
        bottom: 0;
        z-index: 10;
    }
    
    /* ONLY the asset list container should scroll */
    #assetListContainer {
        max-height: calc(100vh - 320px) !important; /* Account for header, search, filters, footer */
        overflow-y: auto !important;
        flex: 1 1 auto !important;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    #assetSelectionModal .modal-title {
        font-size: 1.1rem !important;
    }
    
    #assetSearchInput {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    #assetSelectionModal .modal-dialog {
        max-width: calc(100vw - 0.5rem) !important;
        margin: 0.25rem auto !important;
        max-height: calc(100vh - 0.5rem) !important;
    }
    
    #assetSelectionModal .modal-content {
        max-height: calc(100vh - 0.5rem) !important;
        overflow: hidden !important;
    }
    
    /* Adjust for smaller screens */
    #assetListContainer {
        max-height: calc(100vh - 300px) !important;
    }
    
    .asset-item {
        padding: 0.75rem !important;
    }
    
    .asset-item h6 {
        font-size: 0.95rem !important;
    }
    
    .asset-item small {
        font-size: 0.8rem !important;
    }
}

/* Ensure proper spacing for embedded selectors */
.card .pharosSwitchPanel .tickersSTOCK,
.card .pharosSwitchPanel .tickersBOND,
.card .pharosSwitchPanel .tickersGOLD {
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.card .pharosSwitchPanel:not(.disabled) .tickersSTOCK,
.card .pharosSwitchPanel:not(.disabled) .tickersBOND,
.card .pharosSwitchPanel:not(.disabled) .tickersGOLD {
    opacity: 1;
}

/* Style disabled panels */
.pharosSwitchPanel.disabled {
    opacity: 0.7;
}

.pharosSwitchPanel.disabled * {
    pointer-events: none;
}

/* Icons in disabled panels - more faded */
.pharosSwitchPanel.disabled i,
.pharosSwitchPanel.disabled .asset-icon,
.pharosSwitchPanel.disabled .calendar-icon {
    opacity: 0.5 !important;
}

/* Labels in disabled panels */
.pharosSwitchPanel.disabled label {
    color: lightgray !important;
}

/* Flex layout for assets and risk control */
.assets-risk-flex-container {
    display: flex;
    align-items: flex-start;
    gap: 0; /* No gap between sections */
    width: 100%;
}

.assets-flex-section {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Small gap between asset inputs */
}

.risk-flex-section {
    flex-shrink: 0;
    margin: 0; /* Small margin to separate from assets */
    align-self: flex-start;
}

/* Responsive behavior for smaller screens */
@media (max-width: 768px) {
    /* Ensure Section 1 overflow visible on mobile */
    .simulator-page #section1 {
        overflow: visible !important;
    }
    
    .assets-risk-flex-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .risk-flex-section {
        width: 100%;
        align-self: stretch;
    }
    
    .risk-flex-section .input-param-box {
        flex-direction: row !important;
        height: 40px;
        width: 100%;
    }
    
    .risk-flex-section label {
        flex-direction: row !important;
        border-right: 1px solid #000;
        padding: 0.5rem;
        width: auto;
        white-space: nowrap;
    }
    
    .risk-flex-section label br {
        display: none;
    }
    
    .risk-flex-section .d-flex.flex-column {
        flex-direction: row !important;
        gap: 0.5rem !important;
        align-items: center;
    }
    
    .risk-flex-section button.risk-btn {
        width: 40px !important;
        height: 40px !important;
    }
    
    .risk-flex-section #riskValue,
    .risk-flex-section #riskValueComp {
        padding: 0 0.5rem;
    }
    
    /* Remove justify-content-center for risk control on mobile */
    .risk-flex-section .input-param-box.justify-content-center {
        justify-content: flex-start !important;
    }
}

/* Mobile responsive labels and inputs */
@media (max-width: 480px) {
    /* Ensure Section 1 overflow visible on small mobile */
    .simulator-page #section1 {
        overflow: visible !important;
    }
    
    .input-param-box label {
        width: 60px; /* Smaller width on mobile */
        min-width: 50px; /* Even smaller minimum */
        font-size: 0.8rem; /* Smaller font */
    }
    
    .input-param-box input.form-control {
        width: 70px !important; /* 70px width on mobile */
    }
    
    .input-param-box input[type="number"][id*="Alloc"] {
        width: 70px !important; /* Smaller percentage inputs on mobile */
        max-width: 70px !important;
    }
}

@media (max-width: 360px) {
    /* Ensure Section 1 overflow visible on very small phones */
    .simulator-page #section1 {
        overflow: visible !important;
    }
    
    .input-param-box label {
        width: 50px; /* Very small width on small phones */
        min-width: 45px; /* Very small minimum */
        font-size: 0.75rem; /* Even smaller font */
    }
    
    .input-param-box input.form-control {
        width: 80px; /* Very small input width on small phones */
    }
    
    .input-param-box input[type="number"][id*="Alloc"] {
        width: 60px !important; /* Very small percentage inputs on small phones */
        max-width: 60px !important;
    }
}

/* Section width control - always 85% desktop, 80% mobile */
.w-85 {
    width: 85% !important; /* Always 85% on desktop */
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Normal desktop padding - pt-4 */
.container-fluid.pt-5 {
    padding-top: 1.5rem !important; /* pt-4 equivalent */
}

/* Mobile responsive sections - 100% width on small screens, no rounded corners */
@media (max-width: 768px) {
    /* Ensure Section 1 overflow visible on mobile */
    .simulator-page #section1 {
        overflow: visible !important;
    }
    
    .w-85 {
        width: 100% !important; /* Full width on small screens */
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .card.main-section-card {
        border-radius: 0 !important; /* Remove rounded corners */
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Remove container padding on small screens */
    .container-fluid {
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-top: 0 !important; /* Remove top padding on small screens */
    }
    
    /* Apply same styling to section2 results container */
    #simResultsContainer {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    #simResultsContainer .card.main-section-card {
        border-radius: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* Ensure proper spacing for asset inputs within flex container */
.assets-flex-section .input-group {
    margin-bottom: 0; /* Remove margin since flex gap handles spacing */
}

.assets-flex-section .input-group:last-child {
    margin-bottom: 0;
}

/* Rebalancing label - make it wider */
.input-param-box label[for*="rebalancing"] {
    width: 100px !important; /* Wider than asset labels */
    min-width: 90px !important;
    flex-shrink: 0 !important; /* Don't shrink */
}

/* Percentage allocation inputs - make them consistent width */
.input-param-box input[type="number"][id*="Alloc"] {
    width: 80px !important; /* Fixed width for percentage inputs */
    flex: 0 0 auto !important; /* Don't grow, don't shrink */
    max-width: 80px !important; /* Override inline max-width */
}


/* Initial Investment label - shrink to content */
.input-param-box label[for="amountInvested"] {
    width: auto !important; /* Shrink to content */
    min-width: auto !important; /* No minimum width */
    flex-shrink: 1 !important; /* Allow shrinking */
}

/* Initial Investment label mobile behavior */
@media (max-width: 480px) {
    /* Ensure Section 1 overflow visible on small mobile */
    .simulator-page #section1 {
        overflow: visible !important;
    }
    
    .input-param-box label[for="amountInvested"] {
        width: auto !important; /* Still shrink to content on mobile */
        min-width: auto !important;
        white-space: normal !important; /* Allow text wrapping */
        line-height: 1.2 !important; /* Better line spacing for wrapped text */
        text-align: center !important; /* Center the wrapped text */
    }
}

/* Main section cards - should fill 85% of screen always */
.card.main-section-card {
    width: 100%;
    max-width: 100%;
}

/* Simulator panel cards - should shrink to fit content */
.card.simulator-panel-card {
    width: fit-content;
    max-width: 100%;
    display: inline-block;
    min-width: 300px; /* Minimum width to prevent too narrow cards */
    vertical-align: top; /* Align all cards to the top */
    height: 280px; /* Fixed height for all cards */
}

/* Center the three panels container */
.mx-2.pt-1 {
    text-align: center; /* Center the inline-block panel cards */
}

/* Ensure simulator panel cards are displayed inline to fit content */
.mx-2 .card.simulator-panel-card {
    display: inline-block;
    width: fit-content;
    min-width: 300px; /* Minimum width to prevent too narrow cards */
    vertical-align: top; /* Align all cards to the top */
    height: 280px; /* Fixed height for all cards */
}

/* Ensure consistent alignment for all card content */
.mx-2 .card .card-body {
    vertical-align: top;
}

/* Responsive height for simulator panel cards on smaller screens */
@media (max-width: 768px) {
    /* Ensure Section 1 overflow visible on mobile */
    .simulator-page #section1 {
        overflow: visible !important;
    }
    
    .card.simulator-panel-card,
    .mx-2 .card.simulator-panel-card {
        height: auto; /* Adapt to content on mobile */
        min-height: 200px; /* Minimum height to prevent too small cards */
    }
}

/* Comment out old table styles - keeping for reference
.assets-risk-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0.75rem 0;
}

.assets-column {
    width: auto;
    vertical-align: top;
}

.risk-column {
    width: 1%;
    white-space: nowrap;
    vertical-align: top;
}
*/

/* Remove border from Pharos Risk input-param-box */
.input-param-box.flex-column {
    border: none !important;
}

.input-param-box.flex-column label {
    border-right: none !important;
}

/* Risk control styling */
.risk-btn {
    border-radius: 0 !important;
}

.risk-btn[data-risk="up"] {
    border-radius: 0.375rem 0.375rem 0 0 !important;
}

.risk-btn[data-risk="down"] {
    border-radius: 0 0 0.375rem 0.375rem !important;
}

#riskValue, #riskValueComp {
    width: 40px;
    height: 40px;
    border-left: 1px solid #000;
    border-right: 1px solid #000;
    border-top: none;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 0;
    background-color: #dc3545;
    color: #fff !important;
    font-size: 1.2rem;
}

.risk-btn {
    border-radius: 0 !important;
    color: #dc3545 !important;
    border-color: #dc3545 !important;
}

.risk-btn span {
    color: #dc3545 !important;
}

.risk-btn:hover,
.risk-btn:active,
.risk-btn:focus {
    background-color: transparent !important;
    border-color: #dc3545 !important;
    box-shadow: none !important;
}

.risk-btn:hover span,
.risk-btn:active span,
.risk-btn:focus span {
    color: #dc3545 !important;
}

/* Make percentage spans black for active allocation inputs */
#etfAllocStd + span,
#bondAllocStd + span {
    color: #000 !important;
}

/* Make percentage spans gray when inputs are disabled */
#etfAllocStd:disabled + span,
#bondAllocStd:disabled + span,
#goldAllocStd + span {
    color: #6c757d !important; /* Gray color for disabled state */
}

/* Make text-muted paragraph span full width while keeping button inside */
.card-header {
    flex-direction: column !important;
    align-items: stretch !important;
}

.card-header .flex-grow-1 {
    width: 100% !important;
    margin-bottom: 0.5rem;
}

.card-header .text-muted {
    width: 100% !important;
    max-width: 100% !important;
}

.card-header button {
    align-self: flex-end;
    margin-top: 0.5rem;
}

/* Ensure all elements in section 2 card-header stay on the same line */
#section2 .card-header {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
}

#section2 .card-header .flex-grow-1 {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    margin: 0 1rem !important;
}

#section2 .card-header h4,
#section2 .card-header button,
#section2 .card-header .form-check {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

/* Portrait mode: show section1 + rotation message card */
@media screen and (orientation: portrait) and (max-width: 768px) {
    #section1 {
        display: block !important;
        padding-bottom: calc(40px + env(safe-area-inset-bottom));
    }
    
    #section2 {
        display: block !important;
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
    
    #section2 .card-header {
        display: none !important;
    }
    
    #simResultsContainer .card:not(#portrait-message .card) .card-body {
        display: none !important;
    }
    
    #portrait-message.d-none {
        display: block !important;
    }
}

/* Landscape mode: full screen section2 for all phones */
/* Covers all iPhone models: SE (320x568), 6/7/8 (375x667), X/XS/11 Pro (375x812), XR/11 (414x896), 12/13/14 (390x844), Plus/Max (414x736, 428x926) */
@media screen and (orientation: landscape) and (max-height: 600px) and (max-width: 768px) {
    /* Hide navbar, footer, and section1 for full screen */
    nav.navbar,
    footer,
    #section1 {
        display: none !important;
    }
    
    #portrait-message {
        display: none !important;
    }
    
    /* Show landscape message when no simulation has been run */
    #landscape-no-simulation-message {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        z-index: 10001 !important;
        width: 100vw !important;
        height: 100vh !important;
        align-items: center;
        justify-content: center;
        background: white !important;
    }
    
    
    /* Ensure simResultsContainer is visible in landscape */
    #simResultsContainer {
        display: block !important;
    }
    
    /* Hide landscape message when simulation is completed */
    #landscape-no-simulation-message.simulation-completed {
        display: none !important;
    }
    
    #section2 {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        z-index: 9999;
        background: white;
        overflow: auto;
    }
    
    /* Show section2 when landscape message should be displayed */
    #section2.show-landscape-message {
        display: block !important;
    }
    
    #section2 .container-fluid {
        width: 100%;
        height: 100%;
        padding: 1rem;
    }
    
    #simResultsContainer {
        width: 100% !important;
        padding: 0 !important;
    }
    
    #section2 .card {
        height: calc(100vh - 2rem);
        overflow: auto;
    }
}

/* ===== MOVED FROM STYLES.CSS ===== */

/* Simulator-specific label styling */
label {
    font-weight: bold;
    white-space: nowrap;
}

/* Disabled text and input styling */
.disabledText {
    color: lightgray;
}

input:disabled,
select:disabled,
textarea:disabled {
    color: lightgray;
}

/* Chart containers: apply to all 'chart-container*' IDs and class */
[id^="chart-container"],
.chart-container {
    position: relative;
    max-width: 100%;
    height: 90%;
}

/* Ensure canvases fill their containers */
section [id^="chart-container"] > canvas,
section .chart-container > canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Fix chart containers: set viewport-based height to prevent dynamic resizing */
#section2 .chart-container,
#section2 [id^="chart-container"] {
    height: calc(75svh - var(--nav-h) - var(--footer-h));
    min-height: 300px;
}

/* Ensure canvases respect container size and scale with viewport */
#section2 .chart-container canvas,
#section2 [id^="chart-container"] canvas {
    max-height: 100%;
    width: 100% !important;
    height: 100% !important;
}

/* Make plots span full width of the section content */
#section2 #resultsPanels .panel-item {
    padding: 0; /* override default padding to maximize plot area */
}
#section2 #resultsPanels .panel-item .row {
    --bs-gutter-x: 0;
}

/* Full-width content in section 2 (no max width cap) */
#section2 .container-fluid.w-75 {
    height: 80% !important;
    max-width: 90% !important;
}

/* Risk help icon styling */
.risk-help-icon {
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.5rem !important;
    background-color: white !important;
    padding: 2px !important;
    border: none !important;
    text-align: center !important;
}

.risk-help-icon:hover {
    color: #0d6efd !important;
    transform: scale(1.1);
}

/* Tutorial button fit to content */
#introButton,
#introButtonB,
#mainIntroButton {
    width: fit-content;
    flex-shrink: 1;
    margin-left: 0 !important;
}

/* Loader modal styling */
.modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    border: none;
}

/* Force allocation and heatmap charts to stack vertically */
#panel-allocation .row,
#panel-heatmap .row {
    display: flex;
    flex-direction: column;
}

#panel-allocation .chart-container,
#panel-heatmap .chart-container {
    width: 100%;
    margin-bottom: 1rem;
}

/* Fix excessive scrolling - apply to all screen sizes */
.simulator-page section {
    overflow-y: visible;
    height: auto;
}

body.simulator-page {
    overflow-x: hidden;
    overflow-y: auto;
    height: 100vh;
    max-height: 100vh;
}

/* Sections should grow naturally - no overflow constraints */
.simulator-page #section1,
.simulator-page #section2 {
    overflow: visible;
    height: auto;
    min-height: auto;
    max-height: none;
}

/* Override styles.css section overflow rules for simulator */
.simulator-page section {
    overflow: visible !important;
    overflow-y: visible !important;
    height: auto !important;
}

/* Ensure Section 1 always has overflow visible */
.simulator-page #section1 {
    overflow: visible !important;
}

/* Fix Section 2 positioning to start immediately after Section 1 */
.simulator-page #section2 {
    padding-top: 0 !important;
    margin-top: 0 !important;
    position: static !important; /* Ensure it flows naturally below Section 1 */
    top: auto !important;
    left: auto !important;
    width: auto !important;
    height: auto !important;
    z-index: auto !important;
}

.simulator-page #section2 .container-fluid {
    padding-top: 1rem !important; /* Minimal padding instead of pt-5 */
}

/* Ensure hidden sections don't take up scrollable space */
.simulator-page section.d-none {
    height: 0;
    min-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .simulator-page section {
        min-height: auto; /* Let sections grow naturally */
    }
    
    /* Ensure Section 1 overflow visible on mobile */
    .simulator-page #section1 {
        overflow: visible !important;
    }
    
    /* Use standard padding from styles.css (40px) instead of forcing 80px */
    body.simulator-page {
        padding-bottom: calc(40px + env(safe-area-inset-bottom)); /* Match styles.css with safe area */
    }
    
    /* Risk panel horizontal layout for mobile */
    .risk-flex-section .input-param-box {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .risk-flex-section .input-param-box label {
        order: 0;
        margin-right: 0.5rem !important;
        margin-bottom: 0 !important;
        position: relative !important;
}

/* Rebalance Comparison Table Styles */
#rebalanceComparisonTable {
    font-size: 0.9rem;
}

#rebalanceComparisonTable th {
    background-color: rgba(17, 26, 60, 0.05);
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

#rebalanceComparisonTable td {
    vertical-align: middle;
}

.rebalance-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.rebalance-row:hover {
    background-color: rgba(17, 26, 60, 0.03);
}

.rebalance-row.table-primary {
    background-color: rgba(13, 110, 253, 0.15) !important;
}

.select-rebalance-btn {
    min-width: 80px;
}

/* Responsive table on small screens */
@media (max-width: 767.98px) {
    #rebalanceComparisonTable {
        font-size: 0.8rem;
    }
    
    #rebalanceComparisonTable th,
    #rebalanceComparisonTable td {
        padding: 0.5rem 0.25rem;
    }
    
    .select-rebalance-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        min-width: 60px;
    }
    
    #rebalanceComparisonTable small {
        font-size: 0.7rem;
    }
}

.risk-flex-section .input-param-box .d-flex {
        flex-direction: row !important;
        align-items: stretch !important;
        gap: 0 !important;
        order: 1;
    }
    
    .risk-flex-section .risk-btn[data-risk="down"] {
        order: 1;
        border-radius: 0.375rem 0 0 0.375rem !important;
        border-right: none !important;
        width: 40px !important;
        height: 40px !important;
    }
    
    .risk-flex-section #riskValue,
    .risk-flex-section #riskValueComp {
        order: 2;
        border-left: 1px solid #dc3545 !important;
        border-right: 1px solid #dc3545 !important;
        height: 40px !important;
        width: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .risk-flex-section .risk-btn[data-risk="up"] {
        order: 3;
        border-radius: 0 0.375rem 0.375rem 0 !important;
        border-left: none !important;
        width: 40px !important;
        height: 40px !important;
    }
    
    .risk-flex-section .risk-help-icon {
        order: 4;
    }
}

/* ============================================
   Asset Selection Step (for missing assets before rebalancing)
   ============================================ */

.asset-selection-step {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1rem;
    position: relative;
    z-index: 1; /* Lower than asset selector modal (2000) */
}

.asset-selection-step h6 {
    font-weight: 600;
    color: var(--text-primary);
}

.asset-selection-step .text-muted {
    color: rgba(108, 117, 125, 0.85) !important;
}

#bondMissingWarning {
    background-color: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.4);
    color: var(--text-primary);
}

#bondMissingWarning .fas {
    color: #ffc107;
}

.missing-asset-card .initial-asset-card {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.85rem;
    padding: 0.5rem;
    background-color: rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.missing-asset-card .initial-asset-card:hover {
    background-color: rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

/* Brand colors for asset selection cards */
.missing-asset-card .initial-asset-card.tickersSTOCK {
    border-left: 4px solid var(--asset-stock-color);
    background: linear-gradient(145deg, var(--asset-stock-bg), rgba(0, 0, 0, 0.15));
}

.missing-asset-card .initial-asset-card.tickersBOND {
    border-left: 4px solid var(--asset-bond-color);
    background: linear-gradient(145deg, var(--asset-bond-bg), rgba(0, 0, 0, 0.15));
}

.missing-asset-card .initial-asset-card.tickersGOLD {
    border-left: 4px solid var(--asset-gold-color);
    background: linear-gradient(145deg, var(--asset-gold-bg), rgba(0, 0, 0, 0.15));
}

.missing-asset-card .asset-icon {
    font-size: 1.25rem;
}

.missing-asset-card .badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

.missing-asset-card .form-check {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.missing-asset-card .form-check-label {
    color: var(--text-primary);
    cursor: pointer;
}

.missing-asset-card .asset-selector-input {
    cursor: pointer;
    min-height: 45px;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
}

.missing-asset-card .asset-selector-input:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.missing-asset-card .asset-selector-input.disabled {
    opacity: 0.5;
    pointer-events: none;
    background-color: rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments for asset selection step */
@media (max-width: 991.98px) {
    .asset-selection-step .row {
        flex-direction: column;
    }
    
    .missing-asset-card {
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    .asset-selection-step {
        padding: 1rem;
    }
    
    .asset-selection-step .d-flex {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .asset-selection-step .btn {
        width: 100%;
    }
}

/* Rebalancing interval select styling */
#rebalancingIntervalSelect {
    display: inline-block;
    max-width: 150px;
    font-size: 1rem;
    font-weight: 500;
}

/* Rebalancing date input styling */
#lastRebalancingDateInput {
    display: inline-block;
    max-width: 150px;
    font-size: 1.25rem;
    font-weight: 500;
}

/* Edit icon styling for rebalancing settings */
.edit-rebalancing-interval-icon,
.edit-rebalancing-date-icon {
    cursor: pointer;
    opacity: 0.7;
}

/* Save and cancel icon styling */
.save-rebalancing-interval-icon,
.cancel-rebalancing-interval-icon,
.save-rebalancing-date-icon,
.cancel-rebalancing-date-icon {
    cursor: pointer;
}

/* Timeline accordion header */
#timelineAccordionHeader {
    cursor: pointer;
}

/* Portrait message mobile icon */
#portrait-message .fa-mobile-alt {
    font-size: 3rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

/* Portfolio Performance Analysis header */
#section2 .card-header h5.mb-0.me-2 {
    white-space: nowrap;
}

/* Results tabs */
#resultsTabs {
    white-space: nowrap;
}

/* Simulation results table container */
#panel-table .row {
    overflow-x: auto;
}

/* Transaction modal input styling */
#newCashAmount {
    border-color: green;
}
