/* Professional Solid Enterprise Business Design System */

:root {
    --bg-base: #f8f9fa;
    /* Flat, solid business off-white background */
    --bg-sidebar: #ffffff;
    /* Pure opaque white for side panel */
    --bg-card: #ffffff;
    /* Opaque white for solid card panels */
    --bg-card-hover: #ffffff;
    --border-base: #dee2e6;
    /* Sharp, clean solid borders */
    --border-active: #0050aa;
    /* Professional corporate navy highlight */
    --text-main: #212529;
    /* High-contrast dark charcoal text */
    --text-muted: #495057;
    /* Professional gray text */
    --text-glow: #0050aa;
    /* Solid navy tone, glow eliminated */

    /* Strict Corporate Colors */
    --accent-purple: #0050aa;
    /* Trustworthy Navy Blue */
    --accent-blue: #0f62fe;
    /* IBM Blue accent */
    --accent-green: #198038;
    /* Solid green for income */
    --accent-red: #da1e28;
    /* Solid red for expense/risk */
    --accent-yellow: #b28600;

    /* Flat fills instead of transparent gradients */
    --gradient-primary: #0050aa;
    --gradient-green: #198038;
    --gradient-red: #da1e28;

    /* Corner and Shadow Specs - Bloomberg-style Flat Grid */
    --radius-base: 4px;
    --shadow-flat: none;
    --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.05);
}

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

.hidden {
    display: none !important;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Malgun Gothic", sans-serif;
    font-size: 13.5px;
    /* dense business scale */
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* --- Background Blobs completely disabled for zero decoration --- */
.nebula-bg-1,
.nebula-bg-2 {
    display: none !important;
}

/* --- App layout division (2-column splits) --- */
.app-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* --- LEFT SIDEBAR PANEL (Width: 320px for high efficiency) --- */
.sidebar-wizard {
    width: 320px;
    min-width: 320px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-base);
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

/* Sidebar Logo */
.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.logo-img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: var(--radius-base);
    filter: none;
}

.logo-text h1 {
    font-family: inherit;
    font-weight: 700;
    font-size: 17px;
    line-height: 1.3;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.logo-text p {
    color: var(--text-muted);
    font-size: 10.5px;
    margin-top: 2px;
}

/* Wizard Steps list container */
.wizard-steps-container {
    flex: 1;
    margin-top: 10px;
    overflow-y: auto;
}

.wizard-header {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding-left: 4px;
}

.wizard-steps-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Step Item Flat Corporate Styling */
.step-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-base);
    cursor: pointer;
    background: #ffffff;
    border: 1px solid var(--border-base);
    transition: background 0.15s ease, border-color 0.15s ease;
    position: relative;
    overflow: hidden;
}

.step-item:hover {
    background: #f8f9fa;
    border-color: #ced4da;
}

.step-item.active {
    background: #e8f0fe;
    border-color: var(--border-active);
}

/* Neon Left Bar Indicator for active step */
.step-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--border-active);
}

.step-num {
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-muted);
    opacity: 0.5;
    margin-right: 12px;
    transition: none;
}

.step-item.active .step-num {
    opacity: 1;
    color: var(--border-active);
}

.step-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.step-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: inherit;
    transition: none;
}

.step-item.active .step-title {
    color: var(--text-main);
}

.step-desc {
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.8;
}

/* Status Indicator complete badge */
.badge-complete {
    background: rgba(25, 128, 56, 0.1);
    color: #198038;
    border: 1px solid rgba(25, 128, 56, 0.2);
    font-size: 9.5px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: var(--radius-base);
    margin-left: 5px;
    vertical-align: middle;
}

/* Sidebar Integrated Fund Filter Solid Panel */
.sidebar-filter-glass {
    background: #ffffff;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    padding: 14px;
    margin-top: 15px;
}

.base-portfolio-filter {
    margin-top: 0;
    margin-bottom: 18px;
}

.base-portfolio-filter .filter-controls {
    display: grid;
    grid-template-columns: 180px 220px minmax(360px, 1fr);
    align-items: end;
    gap: 12px;
}

.base-portfolio-filter .fund-chip-container {
    width: 100%;
    height: 34px;
    min-height: 34px;
    max-height: 34px;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 8px;
    background: #ffffff;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
}

.base-portfolio-filter .fund-chip {
    flex: 0 0 auto;
}

.base-portfolio-filter .control-group {
    min-width: 0;
}

.base-portfolio-filter .control-group select {
    height: 34px;
}

.base-portfolio-filter .fund-chip {
    color: var(--text-main);
    font-size: 11.5px;
    font-weight: 600;
}

.filter-action-group {
    align-self: end;
}

.btn-query {
    width: 100%;
    min-width: 72px;
    height: 34px;
    padding: 0 14px;
}

.empty-table-row td {
    height: 120px;
    text-align: center;
    color: var(--text-muted);
    font-weight: 600;
}

.filter-header {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-base);
    padding-bottom: 6px;
}

.filter-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-group label {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.control-group select {
    background: #ffffff;
    border: 1px solid var(--border-base);
    color: var(--text-main);
    padding: 6px 10px;
    border-radius: var(--radius-base);
    outline: none;
    font-size: 12.5px;
    font-family: inherit;
    transition: border-color 0.15s ease;
    width: 100%;
}

.control-group select:focus {
    border-color: var(--border-active);
}

/* Multi-select styling */
.multiselect-container {
    background: #ffffff;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    max-height: 100px;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.multiselect-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    cursor: pointer;
    user-select: none;
    color: var(--text-muted);
}

.multiselect-item:hover {
    color: var(--text-main);
}

.multiselect-item input[type="checkbox"] {
    accent-color: var(--border-active);
    cursor: pointer;
}

/* Custom Scrollbar for Containers */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.01);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 80, 170, 0.3);
}

/* --- RIGHT MAIN DASHBOARD AREA (Width: flex-fill) --- */
.main-dashboard {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px 32px;
    height: 100vh;
    position: relative;
}

/* --- Solid Business Cards --- */
.card-premium {
    background: #ffffff;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    box-shadow: var(--shadow-subtle);
    transition: border-color 0.15s ease;
}

.card-premium:hover {
    border-color: #ced4da;
}

/* --- Tab Content Sections (Step Views) --- */
.tab-content {
    display: none;
    animation: fadeIn 0.25s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(3px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-header {
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-base);
    padding-bottom: 10px;
}

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

.base-date-picker-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.base-date-label {
    color: var(--text-muted);
    font-weight: 700;
    white-space: nowrap;
}

.tab-header h2 {
    font-family: inherit;
    font-weight: 700;
    font-size: 21px;
    letter-spacing: -0.5px;
}

.badge {
    background: var(--border-active);
    padding: 3px 8px;
    border-radius: var(--radius-base);
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
    margin-left: 8px;
    box-shadow: none;
    color: #ffffff;
}

/* --- KPI Metrics Grid --- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.metric-card {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 85px;
}

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-family: inherit;
    font-size: 23px;
    font-weight: 700;
    color: var(--accent-blue);
    margin-top: 6px;
    letter-spacing: -0.5px;
}

.metric-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* Glowing Accent overrides */
.accent-red {
    color: var(--accent-red) !important;
}

.accent-green {
    color: var(--accent-green) !important;
}

.accent-blue {
    color: var(--accent-blue) !important;
}

.text-blue {
    color: var(--accent-blue) !important;
}

.text-green {
    color: var(--accent-green) !important;
}

.text-red {
    color: var(--accent-red) !important;
}

/* --- Charts Grid --- */
.charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.chart-container {
    padding: 15px;
}

.chart-container h3,
.plot-container h3 {
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 12px;
    border-left: 3px solid var(--border-active);
    padding-left: 8px;
}

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

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

/* --- Detailed Portfolio Grid Table Section --- */
.table-section {
    padding: 16px;
    margin-bottom: 18px;
}

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

.table-header h3 {
    font-family: inherit;
    font-weight: 600;
    font-size: 15px;
    text-align: center;
}

.portfolio-table-header {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
}

.portfolio-table-header h3 {
    grid-column: 1;
    justify-self: start;
    text-align: left;
}

.result-save-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(0, 80, 170, 0.24);
    border-radius: var(--radius-base);
    background: linear-gradient(135deg, rgba(0, 80, 170, 0.07), rgba(255, 255, 255, 0.95));
}

.result-save-panel.hidden {
    display: none;
}

.result-save-panel strong {
    display: block;
    margin-bottom: 3px;
    color: var(--text-main);
    font-size: 14px;
}

.result-save-panel p {
    margin: 0;
    color: var(--text-muted);
    font-size: 12.5px;
}

.result-save-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.result-save-status {
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

.result-save-status.pending {
    color: #8a4b00;
    background: #fff4ce;
}

.result-save-status.saved {
    color: #0e6027;
    background: #defbe6;
}

.result-save-status.saving {
    color: #0b5cad;
    background: #eaf3fc;
}

.result-save-status.failed {
    color: #b4232d;
    background: #fdecee;
}

.result-view-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    background: #f8f9fa;
}

.result-view-tab {
    height: 28px;
    padding: 0 10px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.result-view-tab.active {
    background: #ffffff;
    color: var(--border-active);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.result-view-frequency {
    height: 28px;
    min-width: 78px;
    border: 0;
    border-left: 1px solid var(--border-base);
    background: transparent;
    color: var(--text-base);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 0 6px;
}

.result-export-button {
    height: 28px;
    padding: 0 10px;
    margin-left: 4px;
    font-size: 12px;
    white-space: nowrap;
}

.result-view-pane {
    display: none;
}

.result-view-pane.active {
    display: block;
}

#portfolio-daily-table {
    min-width: 1450px;
    table-layout: fixed;
}

.portfolio-daily-scroll {
    position: relative;
}

.portfolio-daily-loading {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 64px;
    background: rgba(255, 255, 255, 0.76);
    backdrop-filter: blur(1px);
}

.portfolio-daily-loading.hidden {
    display: none;
}

.portfolio-daily-loading-card {
    width: min(460px, calc(100% - 48px));
    padding: 18px 20px 20px;
    border: 1px solid #d7e1ef;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}

.portfolio-daily-loading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
    color: #1f2937;
    font-size: 14px;
    font-weight: 700;
}

.portfolio-daily-loading-row strong {
    color: #005bac;
    font-variant-numeric: tabular-nums;
}

.portfolio-daily-loading-message {
    min-height: 18px;
    margin-bottom: 10px;
    color: #5f6b7a;
    font-size: 12px;
    line-height: 1.45;
}

.portfolio-daily-loading-track {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8edf3;
}

.portfolio-daily-loading-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #005bac, #4f8df7);
    transition: width 180ms ease;
}

#portfolio-daily-table th:nth-child(1) { width: 100px; }
#portfolio-daily-table th:nth-child(2) { width: 130px; }
#portfolio-daily-table th:nth-child(3),
#portfolio-daily-table th:nth-child(4) { width: 110px; }
#portfolio-daily-table th:nth-child(n+5):nth-child(-n+10) { width: 145px; }
#portfolio-daily-table th:nth-child(11) { width: 76px; }

#portfolio-daily-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#portfolio-daily-table tr.portfolio-actual-row td:first-child {
    box-shadow: inset 3px 0 0 #0f766e;
}

#portfolio-daily-table tr.portfolio-mixed-row td:first-child {
    box-shadow: inset 3px 0 0 #7c3aed;
}

#portfolio-daily-table tr.portfolio-year-end-snap td {
    animation: portfolio-year-end-snap-pulse 1.1s ease-out;
}

@keyframes portfolio-year-end-snap-pulse {
    0% {
        background: #fff1b8;
        box-shadow: inset 0 0 0 9999px rgba(255, 193, 7, 0.24);
    }
    100% {
        background: transparent;
        box-shadow: inset 0 0 0 9999px rgba(255, 193, 7, 0);
    }
}

#btn-save-result {
    min-width: 154px;
    height: 34px;
    padding: 0 14px;
}

.table-actions {
    grid-column: 2;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn-secondary {
    background: #ffffff;
    border: 1px solid var(--border-base);
    color: var(--text-main);
    border-radius: var(--radius-base);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
    background: #f8f9fa;
    border-color: var(--border-active);
}

.btn-download {
    height: 34px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.btn-delete-selected {
    height: 34px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-delete-selected:not(:disabled) {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.btn-delete-selected:disabled {
    color: #adb5bd;
    cursor: not-allowed;
    background: #f8f9fa;
}

.table-search input {
    background: #ffffff;
    border: 1px solid var(--border-base);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: var(--radius-base);
    font-size: 12.5px;
    outline: none;
    width: 220px;
    height: 34px;
    transition: border-color 0.15s ease;
}

.table-search input:focus {
    border-color: var(--border-active);
    box-shadow: none;
    width: 250px;
}

.table-scroll-container {
    overflow: auto;
    max-height: min(58vh, 620px);
    min-height: 320px;
    border-radius: var(--radius-base);
    border: 1px solid var(--border-base);
    box-shadow: none;
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 10px;
    color: var(--text-muted);
    font-size: 13px;
}

.pagination-summary {
    white-space: nowrap;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pagination-controls select {
    height: 32px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    background: #ffffff;
    color: var(--text-main);
    padding: 4px 8px;
    font-family: inherit;
}

.btn-page {
    height: 32px;
    padding: 4px 10px;
    white-space: nowrap;
}

.btn-page:disabled {
    color: #adb5bd;
    cursor: not-allowed;
    background: #f8f9fa;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    text-align: left;
    border: 1px solid var(--border-base);
}

th {
    background: #f1f3f5;
    color: #212529;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 4; /* Increased from 2 to 4 to stay above sticky td.liability-date-col */
    font-size: 12px;
    border-bottom: 2px solid var(--border-base);
    border-right: 1px solid var(--border-base);
}

th,
td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-base);
}

td {
    border-right: 1px solid var(--border-base);
}

tr {
    background: #ffffff; /* Solid opaque white background to prevent transparent overlay scrolling */
}

tr:nth-child(even) {
    background: #f8f9fa;
}

tr:hover {
    background: #e8f0fe !important;
}

/* Wizard Flow Next button styles */
.next-step-guide {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    padding-bottom: 4px;
}

.btn-guide-next {
    background: var(--gradient-primary);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-base);
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease;
    box-shadow: none;
}

.btn-guide-next:hover {
    background: #003f88;
    transform: none;
    box-shadow: none;
}

/* --- STEP 2 Settings & Editors --- */
.setup-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 15px;
}

.setup-col-left,
.setup-col-right {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-card,
.editor-card {
    padding: 16px;
}

.control-card h3,
.editor-card h3 {
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
    border-left: 3px solid var(--border-active);
    padding-left: 8px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.form-group input[type="text"],
.form-group select {
    background: #ffffff;
    border: 1px solid var(--border-base);
    color: var(--text-main);
    padding: 6px 10px;
    border-radius: var(--radius-base);
    font-size: 12.5px;
    outline: none;
    transition: border-color 0.15s ease;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    border-color: var(--border-active);
    box-shadow: none;
}

/* Styled Slider Range */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: var(--radius-base);
    background: #e9ecef;
    outline: none;
    margin-top: 6px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-active);
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #003f88;
    transform: none;
}

.editor-header {
    margin-bottom: 8px;
}

.helper-text {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* Styled interactive editors */
.table-editor-container {
    overflow-y: auto;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    margin-bottom: 10px;
}

.table-editor-container table {
    width: 100%;
}

.table-editor-container input,
.table-editor-container select {
    background: #ffffff;
    border: 1px solid var(--border-base);
    color: var(--text-main);
    padding: 5px 8px;
    border-radius: var(--radius-base);
    outline: none;
    width: 100%;
    font-size: 11.5px;
    text-align: inherit;
}

.table-editor-container input:focus,
.table-editor-container select:focus {
    border-color: var(--border-active);
    box-shadow: none;
}

/* Action Buttons */
.btn-secondary {
    background: #ffffff;
    border: 1px solid var(--border-base);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-base);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    align-self: flex-start;
}

.btn-secondary:hover {
    background: #f8f9fa;
    color: var(--text-main);
    border-color: var(--border-active);
}

.btn-danger {
    background: rgba(218, 30, 40, 0.08);
    border: 1px solid rgba(218, 30, 40, 0.2);
    color: #da1e28;
    padding: 4px 8px;
    border-radius: var(--radius-base);
    cursor: pointer;
    font-size: 10.5px;
    transition: background 0.15s ease;
}

.btn-danger:hover {
    background: var(--accent-red);
    color: #ffffff;
    border-color: transparent;
}

/* Flat Professional Action button */
.run-action-area {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--border-base);
}

.btn-primary-run {
    background: var(--gradient-primary);
    color: #ffffff;
    border: none;
    width: 100%;
    padding: 10px 18px;
    border-radius: var(--radius-base);
    font-family: inherit;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    text-shadow: none;
    box-shadow: none;
}

.btn-primary-run:hover {
    background: #003f88;
    transform: none;
    box-shadow: none;
}

/* --- STEP 3 Results Visuals --- */
.warning-banner {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(241, 194, 27, 0.06);
    border: 1px solid rgba(241, 194, 27, 0.18);
    border-radius: var(--radius-base);
    padding: 15px 20px;
    margin-bottom: 15px;
}

.warning-icon {
    font-size: 24px;
}

.warning-text h4 {
    font-family: inherit;
    color: #b28600;
    font-size: 14.5px;
    margin-bottom: 2px;
}

.warning-text p {
    font-size: 12px;
    color: var(--text-muted);
}

.result-filter-bar {
    padding: 14px;
    margin-bottom: 15px;
}

.result-ledger-filter {
    margin-bottom: 12px;
    min-width: 0;
    overflow: hidden;
    container-type: inline-size;
}

.result-filter-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
}

.result-filter-grid .control-group {
    min-width: 0;
}

.result-filter-grid > .control-group:nth-child(1) {
    grid-column: 1 / span 3;
}

.result-filter-grid > .control-group:nth-child(2) {
    grid-column: 4 / span 3;
}

.result-filter-grid .control-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}

.result-filter-grid select,
.result-filter-grid input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    height: 34px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    background: #fff;
    color: var(--text-main);
    padding: 5px 9px;
    font-family: inherit;
    font-size: 12px;
}

.result-fund-chip-group {
    grid-column: 7 / -1;
}

.result-filter-grid > .control-group:nth-child(4) {
    grid-column: 1 / span 2;
}

.result-filter-grid > .control-group:nth-child(5) {
    grid-column: 3 / span 2;
}

.result-filter-grid > .control-group:nth-child(6) {
    grid-column: 5 / span 6;
}

.result-filter-grid > .filter-action-group {
    grid-column: 11 / span 2;
    min-width: 0;
    max-width: none;
}

.result-filter-grid .btn-query {
    width: 100%;
    min-width: 0;
}

.result-ledger-filter .fund-chip-container {
    width: 100%;
    min-height: 44px;
    max-height: 82px;
    overflow: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
}

.result-ledger-summary {
    display: flex;
    align-items: center;
    gap: 8px 18px;
    min-height: 38px;
    padding: 8px 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border-base);
    background: #f8f9fa;
    color: var(--text-muted);
    font-size: 12px;
    flex-wrap: wrap;
}

.result-ledger-summary strong {
    color: var(--text-main);
}

.result-diagnostics {
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid #f0c36d;
    border-radius: var(--radius-base);
    background: #fff8e6;
    color: #5f4600;
    font-size: 12px;
}

.result-diagnostics-title {
    font-weight: 800;
    margin-bottom: 6px;
}

.result-diagnostics ul {
    margin: 0;
    padding-left: 18px;
}

.result-diagnostics li {
    margin: 3px 0;
}

.result-diagnostics .diagnostic-error strong {
    color: #b00020;
}

.result-diagnostics code {
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    color: #6b4d00;
    font-size: 11px;
}

.result-ledger-section {
    padding: 12px;
}

.result-period-label {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 11px;
}

.result-ledger-scroll {
    max-height: calc(100vh - 360px);
    min-height: 420px;
}

#result-ledger-table {
    table-layout: fixed;
}

#result-ledger-table th,
#result-ledger-table td {
    padding: 7px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#result-ledger-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f1f3f5;
}

.column-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 9px;
    height: 100%;
    cursor: col-resize;
    touch-action: none;
    user-select: none;
    z-index: 5;
}

.column-resize-handle::after {
    content: "";
    position: absolute;
    top: 20%;
    bottom: 20%;
    left: 4px;
    width: 1px;
    background: transparent;
}

.column-resize-handle:hover::after,
.column-resize-handle.active::after {
    background: var(--accent-purple);
}

body.resizing-table-column {
    cursor: col-resize;
    user-select: none;
}

#result-ledger-table .numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

#result-ledger-table .interest-accrual {
    color: #8a5a00;
    background: #fffaf0;
}

#result-ledger-table .interest-earned,
#result-ledger-table .interest-cashflow {
    color: #146c43;
    font-weight: 700;
}

#result-ledger-table tr.interest-cashflow-row td {
    border-top-color: #9bc8ad;
    border-bottom-color: #9bc8ad;
}

.result-filter-bar h4 {
    font-family: inherit;
    font-size: 12.5px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-main);
}

.result-filter-controls {
    display: flex;
    gap: 15px;
}

.res-filter-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.res-filter-group label {
    font-size: 11px;
    color: var(--text-muted);
}

.res-filter-group select {
    background: #ffffff;
    border: 1px solid var(--border-base);
    color: var(--text-main);
    padding: 6px 10px;
    border-radius: var(--radius-base);
    outline: none;
    font-size: 12px;
    transition: border-color 0.15s ease;
}

.res-filter-group select:focus {
    border-color: var(--border-active);
}

.results-plots-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.plot-container {
    padding: 15px;
}

/* --- STEP 4 MS SQL Server Guide --- */
.sql-guide-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.sql-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.sql-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-base);
    padding-bottom: 8px;
}

.sql-badge {
    background: rgba(0, 80, 170, 0.1);
    color: var(--border-active);
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-base);
    text-transform: uppercase;
}

.sql-card-header h3 {
    font-family: inherit;
    font-weight: 600;
    font-size: 13.5px;
}

.sql-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 10px;
}

.code-box-container {
    position: relative;
    margin-top: auto;
}

pre {
    background: #f8f9fa;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    padding: 10px 12px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    line-height: 1.5;
    color: #2d3142;
    box-shadow: none;
}

.non-bond-guide-banner {
    background: #f8f9fa;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    padding: 8px 10px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    text-align: left;
    backdrop-filter: none;
}

.non-bond-guide-banner strong {
    color: var(--border-active);
}

.btn-copy {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #ffffff;
    border: 1px solid var(--border-base);
    color: var(--text-muted);
    padding: 3px 6px;
    border-radius: var(--radius-base);
    font-size: 9.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-copy:hover {
    background: #f8f9fa;
    color: var(--border-active);
    border-color: var(--border-active);
}

/* --- Flat Loading Overlay --- */
.hidden-overlay {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: none;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hidden-overlay#loading-overlay {
    display: none;
}

.spinner-container {
    text-align: center;
    width: 460px;
    position: relative;
}

.cosmic-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid #dee2e6;
    border-top-color: var(--border-active);
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spinFlat 1s linear infinite;
    box-shadow: none;
}

@keyframes spinFlat {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.spinner-logo {
    font-size: 20px;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    animation: none;
}

.spinner-container h3 {
    font-family: inherit;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.spinner-container p {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.6;
}

.simulation-progress-panel {
    margin-top: 22px;
    padding: 18px;
    text-align: left;
    background: #ffffff;
    border: 1px solid var(--border-base);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(20, 35, 55, 0.08);
}

.simulation-progress-row + .simulation-progress-row {
    margin-top: 15px;
}

.simulation-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    color: var(--text-main);
    font-size: 12px;
}

.simulation-progress-label strong {
    color: var(--border-active);
    font-variant-numeric: tabular-nums;
}

.simulation-progress-track {
    height: 8px;
    overflow: hidden;
    background: #e9ecef;
    border-radius: 999px;
}

.simulation-progress-track.overall {
    height: 11px;
}

.simulation-progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--border-active);
    transition: width 0.35s ease;
}

.simulation-progress-fill.calculation {
    background: #2f6fed;
}

.simulation-progress-fill.database {
    background: #198754;
}

/* --- Flat Toast notification style --- */
.toast-hidden {
    opacity: 0;
    transform: translateY(10px) translateX(-50%);
    pointer-events: none;
    transition: all 0.25s ease;
}

#toast {
    position: fixed;
    bottom: 25px;
    left: 50%;
    background: #ffffff;
    border: 1px solid var(--border-active);
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: var(--radius-base);
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    z-index: 10000;
    backdrop-filter: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

#toast.active {
    opacity: 1;
    transform: translateY(0) translateX(-50%);
}

/* Premium business dropdown select layout */
.premium-select {
    padding: 6px 12px;
    border-radius: var(--radius-base);
    border: 1px solid var(--border-base);
    background: #ffffff;
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    font-size: 12.5px;
    outline: none;
    transition: border-color 0.15s ease;
}

.premium-select:focus {
    border-color: var(--border-active);
}

/* --- Readability font scale overrides --- */
body {
    font-size: 15px;
}

.logo-text h1 {
    font-size: 18px;
}

.logo-text p,
.wizard-header,
.step-desc,
.control-group label,
.multiselect-item,
.metric-label,
.metric-sub,
.warning-text p,
.res-filter-group label,
.sql-desc,
.non-bond-guide-banner,
.spinner-container p,
#toast {
    font-size: 13px;
}

.badge-complete,
.sql-badge,
.btn-copy {
    font-size: 11.5px;
}

.step-num {
    font-size: 17px;
}

.step-title,
.filter-header,
.control-group select,
.table-search input,
table,
.form-group input[type="text"],
.form-group select,
.table-editor-container input,
.table-editor-container select,
.premium-select {
    font-size: 14px;
}

.tab-header h2 {
    font-size: 23px;
}

/* --- STEP 2 개편: 가정 버전 관리 바 (Assumptions Version Control Bar) --- */
.version-control-card {
    background: #ffffff;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    padding: 12px 16px;
    margin-bottom: 15px;
}

.version-control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.vc-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vc-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    white-space: nowrap;
}

.vc-input {
    background: #ffffff;
    border: 1px solid var(--border-base);
    color: var(--text-main);
    padding: 5px 10px;
    border-radius: var(--radius-base);
    font-size: 12px;
    outline: none;
    height: 30px;
    width: 180px;
    transition: border-color 0.15s ease;
}

.vc-input:focus {
    border-color: var(--border-active);
}

.vc-select {
    background: #ffffff;
    border: 1px solid var(--border-base);
    color: var(--text-main);
    padding: 4px 8px;
    border-radius: var(--radius-base);
    font-size: 12px;
    outline: none;
    height: 30px;
    width: 220px;
    cursor: pointer;
}

.btn-vc {
    height: 30px;
    padding: 0 12px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: var(--radius-base);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
}

.btn-vc-save {
    background: var(--border-active);
    color: #ffffff;
    border: none;
}

.btn-vc-save:hover {
    background: #003f88;
}

.btn-vc-load {
    background: #ffffff;
    border: 1px solid var(--border-active);
    color: var(--border-active);
}

.btn-vc-load:hover {
    background: rgba(0, 80, 170, 0.05);
}

.btn-vc-delete {
    background: rgba(218, 30, 40, 0.08);
    border: 1px solid rgba(218, 30, 40, 0.2);
    color: var(--accent-red);
}

.btn-vc-delete:hover {
    background: var(--accent-red);
    color: #ffffff;
    border-color: transparent;
}

/* --- STEP 2 개편: 서브 탭 컨트롤 (Sub-Tabs Layout) --- */
.sub-tabs-container {
    background: #ffffff;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sub-tabs-bar {
    display: flex;
    background: #f1f3f5;
    border-bottom: 1px solid var(--border-base);
    padding: 0 10px;
    overflow-x: auto;
}

.sub-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
}

.sub-tab-btn:hover {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.02);
}

.sub-tab-btn.active {
    color: var(--border-active);
    border-bottom-color: var(--border-active);
    background: #ffffff;
}

.sub-tab-pane {
    display: none;
    padding: 15px;
    background: #ffffff;
    animation: subTabFadeIn 0.2s ease;
}

.sub-tab-pane.active {
    display: block;
}

@keyframes subTabFadeIn {
    from {
        opacity: 0;
        transform: translateY(2px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 초밀착 고밀도 대용량 데이터 전용 에디터 셀렉터 */
.table-editor-container.compact-editor {
    max-height: 380px;
    overflow: auto;
    /* 수백 수천라인 스크롤 대응 */
    margin-bottom: 10px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
}

.table-editor-container.compact-editor table {
    font-size: 11.5px;
    /* 글자 크기 축소 */
}

.table-editor-container.compact-editor th {
    background: #f8f9fa;
    padding: 5px 8px;
    font-size: 11px;
    text-align: center;
}

.table-editor-container.compact-editor td {
    padding: 3px 6px;
    /* 극단적인 세로 공간 최적화 */
}

.table-editor-container.compact-editor input,
.table-editor-container.compact-editor select {
    padding: 3px 6px;
    font-size: 11px;
    height: 24px;
}

.editor-action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    padding-top: 5px;
    gap: 12px;
    flex-wrap: wrap;
}

.editor-bulk-info {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

#subtab-orders.active {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 210px);
    min-height: 420px;
    max-height: none;
    overflow: hidden;
    padding-bottom: 0;
}

.orders-pane-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-shrink: 0;
}

#subtab-orders .liquidity-preview-container {
    flex-shrink: 0;
    margin-bottom: 12px !important;
}

#subtab-orders .chart-wrapper-large {
    height: clamp(150px, 20vh, 240px) !important;
}

.table-editor-container.compact-editor.orders-editor-container {
    flex: 1 1 auto;
    min-height: 120px;
    max-height: none;
    margin-bottom: 0;
}

.orders-action-row {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 0 -15px;
    padding: 10px 15px;
    border-top: 1px solid var(--border-base);
    background: #ffffff;
    align-items: center;
}

.orders-bottom-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

.orders-bottom-actions .btn-secondary,
.orders-bottom-actions .btn-danger {
    height: 28px;
    padding: 0 10px;
    font-size: 11px;
    white-space: nowrap;
}

@media (max-height: 760px) {
    #subtab-orders.active {
        height: calc(100vh - 202px);
        min-height: 360px;
    }

    #subtab-orders .liquidity-preview-container {
        padding: 12px !important;
    }

    #subtab-orders .chart-wrapper-large {
        height: clamp(130px, 18vh, 180px) !important;
    }

    .table-editor-container.compact-editor.orders-editor-container {
        min-height: 96px;
    }
}

.badge {
    font-size: 13.5px;
}

.metric-value {
    font-size: 25px;
}

.chart-container h3,
.plot-container h3,
.table-header h3,
.warning-text h4,
.result-filter-bar h4,
.sql-card-header h3 {
    font-size: 16px;
}

th {
    font-size: 13.5px;
}

.btn-guide-next,
.btn-primary-run {
    font-size: 14.5px;
}

pre {
    font-size: 12.5px;
}

.spinner-logo {
    font-size: 22px;
}

.spinner-container h3 {
    font-size: 17.5px;
}

/* --- Base portfolio table layout refinements --- */
.base-metrics-grid {
    grid-template-columns: repeat(4, 1fr);
}

#portfolio-detail-table {
    min-width: 1680px;
}

.standard-table .select-col,
#portfolio-detail-table .select-col {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    text-align: center;
    padding-left: 8px;
    padding-right: 8px;
}

.standard-table input[type="checkbox"],
#portfolio-detail-table input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--border-active);
}

#portfolio-detail-table th {
    text-align: center;
}

#portfolio-detail-table th,
#portfolio-detail-table td {
    white-space: nowrap;
}

#portfolio-detail-table th:nth-child(6),
#portfolio-detail-table td:nth-child(6) {
    min-width: 120px;
}

#liability-editor-table {
    width: max-content;
    min-width: 100%;
}

#liability-editor-table th {
    text-align: center;
}

#liability-editor-table th,
#liability-editor-table td {
    white-space: nowrap;
}

#liability-editor-table .liability-date-col {
    position: sticky;
    left: 0;
    z-index: 3;
    min-width: 112px;
    background: #f8f9fa;
    font-weight: 700;
}

#liability-editor-table td.liability-date-col {
    background: inherit;
}

#liability-editor-table th.liability-date-col {
    z-index: 5; /* Keep the top-left intersection above both header (z-index 4) and body (z-index 3) */
    background: #f1f3f5; /* Match table header background */
}

#liability-editor-table input[type="number"] {
    min-width: 92px;
    text-align: right;
}

.rate-eq-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}

.rate-eq-board {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: clamp(360px, 58vh, 680px);
    min-height: 420px;
    overflow: hidden;
    padding: 2px;
}

.rate-graph-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.rate-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.rate-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    background: #ffffff;
    padding: 6px 9px;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.rate-filter-chip.active {
    border-color: var(--border-active);
    color: var(--border-active);
    background: #e8f0fe;
}

.rate-filter-chip input {
    accent-color: var(--border-active);
}

.rate-edit-tenor {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.rate-edit-tenor select {
    height: 34px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    background: #ffffff;
    padding: 5px 8px;
    font-family: inherit;
    font-size: 13px;
}

.rate-graph-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 12px;
}

.rate-chart-panel,
.rate-point-panel {
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    background: #ffffff;
    min-height: 0;
}

.rate-chart-panel {
    position: relative;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rate-chart-panel canvas {
    width: 100% !important;
    height: 100% !important;
    cursor: crosshair;
    min-width: 0;
    min-height: 320px;
}

.rate-point-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rate-point-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-base);
    color: var(--text-main);
}

.rate-point-panel-header span {
    color: var(--text-muted);
    font-size: 12px;
}

.rate-point-table-wrap {
    overflow: auto;
    min-height: 0;
    flex: 1 1 auto;
}

#rate-point-table {
    min-width: 310px;
}

#rate-point-table input {
    width: 100%;
    height: 28px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    padding: 4px 6px;
    font-family: inherit;
    font-size: 12.5px;
}

#rate-point-table th,
#rate-point-table td {
    white-space: nowrap;
    text-align: center;
}

.liability-table-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 16px;
}

.liability-value-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    padding: 3px 0;
    cursor: pointer;
    user-select: none;
}

.liability-value-filter-label {
    color: var(--text-main);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.liability-value-filter input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.liability-toggle-track {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 34px;
    height: 18px;
    flex: 0 0 34px;
    border: 1px solid #adb5bd;
    border-radius: 9px;
    background: #dee2e6;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.liability-toggle-thumb {
    position: absolute;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
    transition: transform 0.15s ease;
}

.liability-value-filter input:checked + .liability-toggle-track {
    border-color: var(--border-active);
    background: var(--border-active);
}

.liability-value-filter input:checked + .liability-toggle-track .liability-toggle-thumb {
    transform: translateX(16px);
}

.liability-value-filter input:focus-visible + .liability-toggle-track {
    outline: 2px solid rgba(0, 80, 170, 0.24);
    outline-offset: 2px;
}

.liability-bulk-toolbar {
    margin-bottom: 10px;
    max-width: 100%;
}

.bulk-date-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bulk-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.bulk-field label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
}

.bulk-field input,
.bulk-field select {
    height: 32px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    background: #ffffff;
    color: var(--text-main);
    padding: 4px 8px;
    font-family: inherit;
    font-size: 13px;
}

.bulk-field select[multiple] {
    height: 104px;
    padding: 4px;
}

.bulk-funds {
    width: 260px;
}

.bulk-amount-action {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bulk-amount-action input {
    width: 130px;
}

.liability-table-scroll {
    max-height: clamp(320px, 55vh, 620px);
    min-height: min(260px, 42vh);
}

@media (min-width: 901px) {
    .sub-tabs-container {
        max-height: calc(100vh - 80px);
    }

    .sub-tab-pane.active {
        min-height: 0;
    }

    #subtab-liability.active {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 210px);
        min-height: 420px;
    }

    #subtab-liability .liability-table-header {
        flex: 0 0 auto;
    }

    #subtab-liability .liability-table-scroll {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
    }

    #subtab-liability .editor-action-row {
        flex: 0 0 auto;
        position: sticky;
        bottom: 0;
        z-index: 5;
        margin: 0 -15px -15px;
        padding: 10px 15px;
        border-top: 1px solid var(--border-base);
        background: #ffffff;
    }

    #subtab-liability .liability-bottom-actions {
        margin-left: auto;
    }

    #subtab-rates.active {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 210px);
        min-height: 420px;
    }

    #subtab-rates .rate-eq-header {
        flex: 0 0 auto;
    }

    #subtab-rates .rate-eq-board {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
    }

    #subtab-rates .rate-graph-layout {
        min-height: 0;
    }
}

/* --- Responsive layout sizing --- */
.app-layout {
    min-width: 0;
}

.sidebar-wizard {
    width: clamp(260px, 22vw, 320px);
    min-width: clamp(260px, 22vw, 320px);
    padding: 18px clamp(10px, 1vw, 15px);
}

.main-dashboard {
    min-width: 0;
    padding: clamp(14px, 1.7vw, 20px) clamp(14px, 2vw, 25px) 28px;
}

.metrics-grid,
.base-metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.metric-card {
    min-width: 0;
}

.setup-grid,
.results-plots-row,
.sql-guide-grid,
.charts-row {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
}

.portfolio-table-header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.table-actions {
    min-width: 0;
}

.table-search {
    min-width: min(100%, 180px);
}

.table-search input,
.table-search input:focus {
    width: clamp(180px, 22vw, 280px);
    max-width: 100%;
}

.btn-download,
.btn-delete-selected,
.btn-guide-next,
.btn-primary-run,
.btn-vc {
    min-width: 0;
    max-width: 100%;
}

.table-section {
    min-width: 0;
    overflow: hidden;
}

.table-scroll-container {
    width: 100%;
    max-width: 100%;
    max-height: clamp(340px, 56vh, 660px);
    min-height: min(320px, 45vh);
}

#portfolio-detail-table {
    width: max-content;
    min-width: max(100%, 1420px);
}

.version-control-bar,
.result-filter-controls {
    min-width: 0;
}

.vc-group {
    min-width: 0;
}

.vc-input,
.vc-select {
    width: clamp(150px, 18vw, 220px);
    max-width: 100%;
}

@media (max-width: 1180px) {
    .sidebar-wizard {
        width: 260px;
        min-width: 260px;
    }

    .base-portfolio-filter .filter-controls {
        grid-template-columns: minmax(160px, 1fr) minmax(180px, 1fr);
    }

    .filter-action-group {
        max-width: 120px;
    }

    .base-portfolio-filter .fund-chip-container {
        max-width: none;
    }

    .logo-area {
        gap: 8px;
    }

    .logo-img {
        width: 44px;
        height: 44px;
    }

    .step-item {
        padding: 9px 10px;
    }

    .portfolio-table-header {
        grid-template-columns: 1fr;
    }

    .portfolio-table-header h3,
    .liability-table-header>div,
    .rate-eq-header>div,
    .table-actions {
        grid-column: 1;
        justify-self: stretch;
    }

    .liability-table-header,
    .rate-eq-header {
        grid-template-columns: 1fr;
    }

    .liability-bulk-toolbar {
        width: 100%;
    }

    .bulk-funds,
    .bulk-amount-field {
        grid-column: auto;
    }

    .table-actions {
        justify-content: space-between;
    }

    .result-save-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .btn-delete-selected,
    .btn-download {
        flex: 0 0 auto;
    }

    .table-search {
        flex: 1;
    }

    .table-search input,
    .table-search input:focus {
        width: 100%;
    }
}

@media (min-width: 901px) {
    #tab1.active {
        display: flex;
        flex-direction: column;
        min-height: calc(100vh - 68px);
    }

    #tab1 .table-section {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
        margin-bottom: 12px;
    }

    #tab1 .table-scroll-container {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
    }

    #tab1 .next-step-guide {
        flex: 0 0 auto;
        margin-top: 4px;
    }
}

@media (max-width: 900px) {
    body {
        overflow: auto;
    }

    .app-layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .sidebar-wizard {
        width: 100%;
        min-width: 0;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--border-base);
        gap: 14px;
    }

    .wizard-steps-container {
        flex: none;
        overflow: visible;
    }

    .wizard-steps-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .sidebar-filter-glass {
        margin-top: 0;
    }

    .base-portfolio-filter .filter-controls {
        grid-template-columns: 1fr;
    }

    .filter-action-group {
        max-width: none;
    }

    .main-dashboard {
        height: auto;
        overflow: visible;
    }

    .table-scroll-container {
        max-height: 60vh;
    }

    #portfolio-detail-table {
        min-width: 1180px;
    }

    .rate-eq-board {
        max-height: none;
        overflow: visible;
    }

    .rate-graph-toolbar,
    .rate-graph-layout {
        grid-template-columns: 1fr;
    }

    .rate-chart-panel canvas {
        min-height: 330px;
    }

}

@media (max-width: 620px) {

    .base-tab-header,
    .base-date-picker-area,
    .table-actions,
    .editor-action-row,
    .rate-filter-group,
    .liability-bulk-toolbar,
    .table-pagination,
    .pagination-controls,
    .next-step-guide,
    .version-control-bar,
    .vc-group,
    .result-filter-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .tab-header h2 {
        display: flex;
        flex-direction: column;
        gap: 6px;
        align-items: flex-start;
    }

    .badge {
        margin-left: 0;
        width: fit-content;
    }

    .premium-select,
    .btn-download,
    .btn-delete-selected,
    .btn-page,
    .pagination-controls select,
    .btn-guide-next,
    .vc-input,
    .vc-select,
    .btn-vc,
    .res-filter-group select {
        width: 100%;
    }

    .metrics-grid,
    .base-metrics-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 78px;
    }
}

/* --- Early Redemptions and Liquidity Preview Custom Styles --- */
.liquidity-preview-container {
    background: var(--bg-card);
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    box-shadow: var(--shadow-subtle);
    margin-bottom: 20px;
    padding: 16px;
    transition: border-color 0.15s ease;
}

#btn-subtab-early-redemptions {
    transition: background 0.15s ease, border-color 0.15s ease;
}

.warning-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: rgba(218, 30, 40, 0.08);
    border: 1px solid rgba(218, 30, 40, 0.2);
    border-radius: var(--radius-base);
    color: var(--accent-red);
    margin-bottom: 15px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.warning-banner.hidden {
    display: none !important;
}

.warning-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.warning-text h4 {
    font-size: 13.5px;
    font-weight: 700;
    margin-bottom: 3px;
    color: var(--accent-red);
}

.warning-text p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* Premium Select styles in tools bar */
.premium-select {
    background: #ffffff;
    border: 1px solid var(--border-base);
    color: var(--text-main);
    padding: 4px 8px;
    border-radius: var(--radius-base);
    outline: none;
    font-size: 12px;
    font-family: inherit;
    transition: border-color 0.15s ease;
    cursor: pointer;
}
.premium-select:focus {
    border-color: var(--border-active);
}

/* Custom checkable chip styling for liability bulk input */
.fund-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f8f9fa;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}
.fund-chip:hover {
    background: #e9ecef;
}
.fund-chip input[type="checkbox"] {
    margin: 0;
    width: 13px;
    height: 13px;
    cursor: pointer;
    accent-color: var(--border-active);
}
.fund-chip.active {
    background: rgba(0, 80, 170, 0.08) !important;
    color: var(--border-active) !important;
    border-color: var(--border-active) !important;
}

@container (max-width: 760px) {
    .result-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .result-filter-grid > .control-group:nth-child(1) {
        grid-column: 1;
    }

    .result-filter-grid > .control-group:nth-child(2) {
        grid-column: 2;
    }

    .result-fund-chip-group {
        grid-column: 1 / -1;
    }

    .result-filter-grid > .control-group:nth-child(4),
    .result-filter-grid > .control-group:nth-child(5),
    .result-filter-grid > .control-group:nth-child(6) {
        grid-column: auto;
    }

    .result-filter-grid .filter-action-group {
        grid-column: 2;
    }
}

@container (max-width: 520px) {
    .result-filter-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .result-filter-grid > .control-group:nth-child(1),
    .result-filter-grid > .control-group:nth-child(2),
    .result-fund-chip-group,
    .result-filter-grid > .control-group:nth-child(4),
    .result-filter-grid > .control-group:nth-child(5),
    .result-filter-grid > .control-group:nth-child(6),
    .result-filter-grid .filter-action-group {
        grid-column: 1;
    }
}

/* --- Daily yield backtest --- */
.yield-backtest-filter {
    container-type: inline-size;
}

.yield-backtest-filter-grid {
    display: grid;
    grid-template-columns: 150px 150px 190px minmax(320px, 1fr) 150px minmax(220px, 0.7fr) 90px;
    gap: 10px;
    align-items: end;
}

.yield-backtest-fund-group {
    min-width: 0;
}

.yield-backtest-fund-group .fund-chip-container {
    min-height: 34px;
    max-height: 76px;
    overflow-y: auto;
    padding: 3px;
}

.yield-backtest-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.yield-summary-item {
    min-width: 0;
    padding: 11px 13px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-base);
    background: #fff;
}

.yield-summary-item span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
}

.yield-summary-item strong {
    color: var(--text-main);
    font-size: 18px;
    font-weight: 750;
}

.yield-backtest-section {
    min-height: 0;
}

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

.yield-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 23px;
    padding: 0 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.yield-band-legend button.yield-status {
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.yield-band-legend button.yield-status:hover {
    filter: brightness(.98);
    transform: translateY(-1px);
}

.yield-band-legend button.yield-status.is-active {
    border-color: currentColor;
    box-shadow: 0 0 0 2px rgba(20, 82, 133, .13), 0 2px 5px rgba(31, 50, 73, .12);
    transform: translateY(-1px);
}

.yield-band-legend button.yield-status:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 80, 170, .22);
}

.yield-status.fit {
    color: #146c43;
    background: #e8f6ef;
    border: 1px solid #a9ddc3;
}

.yield-status.good {
    color: #0b5cad;
    background: #eaf3fc;
    border: 1px solid #b4d3f1;
}

.yield-status.warning {
    color: #895c00;
    background: #fff6db;
    border: 1px solid #ead18a;
}

.yield-status.anomaly {
    color: #b4232d;
    background: #fdecee;
    border: 1px solid #efb4b9;
}

.yield-status.unknown {
    color: #5f6875;
    background: #f1f3f5;
    border: 1px solid #cdd3da;
}

.yield-backtest-scroll {
    max-height: calc(100vh - 390px);
    min-height: 280px;
}

#yield-backtest-table {
    min-width: 1900px;
    table-layout: fixed;
}

#yield-backtest-table th:nth-child(1) { width: 100px; }
#yield-backtest-table th:nth-child(2) { width: 78px; }
#yield-backtest-table th:nth-child(3) { width: 245px; }
#yield-backtest-table th:nth-child(4) { width: 125px; }
#yield-backtest-table th:nth-child(5) { width: 250px; }
#yield-backtest-table th:nth-child(6) { width: 160px; }
#yield-backtest-table th:nth-child(n+7):nth-child(-n+13) { width: 125px; }
#yield-backtest-table th:nth-child(14) { width: 72px; }
#yield-backtest-table th:nth-child(15) { width: 72px; }

#yield-backtest-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#yield-backtest-table .yield-difference,
#yield-backtest-table .yield-row-anomaly .numeric {
    color: #b4232d;
    font-weight: 650;
}

#yield-backtest-table .yield-row-fit .yield-difference {
    color: #146c43;
}

#yield-backtest-table .yield-row-unknown .numeric,
#yield-backtest-table .yield-row-unknown .yield-difference {
    color: #7a828c;
    font-weight: 500;
}

@container (max-width: 1250px) {
    .yield-backtest-filter-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .yield-backtest-fund-group {
        grid-column: 1 / -1;
    }

    .yield-backtest-search {
        grid-column: span 2;
    }
}

@container (max-width: 720px) {
    .yield-backtest-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .yield-backtest-fund-group,
    .yield-backtest-search {
        grid-column: 1 / -1;
    }
}

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

    .yield-band-legend {
        display: none;
    }

    .yield-backtest-scroll {
        max-height: 62vh;
    }
}

/* --- Fixed top process bar layout --- */
.app-layout { flex-direction: column; }
.top-process-bar { width: 100%; min-height: 72px; padding: 10px 24px; display: flex; align-items: center; gap: 28px; background: var(--bg-sidebar); border-bottom: 1px solid var(--border-base); flex: 0 0 auto; z-index: 10; }
.top-process-bar .logo-area { gap: 9px; margin: 0; flex: 0 0 auto; }
.top-process-bar .logo-img { width: 42px; height: 42px; }
.top-process-bar .logo-text h1 { font-size: 15px; line-height: 1.2; }
.top-process-bar .wizard-steps-container { flex: 1; min-width: 0; margin: 0; overflow: hidden; }
.top-process-bar .wizard-header { display: none; }
.top-process-bar .wizard-steps-list { display: flex; align-items: stretch; gap: 8px; width: 100%; }
.top-process-bar .step-item { min-width: 0; flex: 1 1 0; padding: 8px 10px; }
.top-process-bar .step-item.active::before { width: 3px; }
.top-process-bar .step-num { font-size: 13px; margin-right: 8px; }
.top-process-bar .step-info { min-width: 0; gap: 0; }
.top-process-bar .step-title { font-size: 12.5px; }
.top-process-bar .step-desc { display: none; }
.main-dashboard { height: calc(100vh - 72px); padding: 16px clamp(16px, 2vw, 30px) 28px; }
@media (min-width: 901px) { #tab1.active { min-height: calc(100vh - 72px); } }
@media (max-width: 1180px) { .top-process-bar { gap: 16px; padding-inline: 16px; } .top-process-bar .step-item { padding: 7px 8px; } .top-process-bar .step-title { font-size: 12px; } }
@media (max-width: 900px) { .top-process-bar { position: sticky; top: 0; align-items: flex-start; flex-wrap: wrap; gap: 8px; padding: 10px 14px 8px; } .top-process-bar .logo-img { width: 36px; height: 36px; } .top-process-bar .wizard-steps-container { flex: 1 1 100%; overflow-x: auto; padding-bottom: 2px; } .top-process-bar .wizard-steps-list { width: max-content; min-width: 100%; } .top-process-bar .step-item { flex: 0 0 155px; } .main-dashboard { height: auto; } }

/* --- Horizontal stepper correction --- */
.top-process-bar .wizard-steps-list { flex-direction: row; }

/* --- Workspace fit and data table polish --- */
@media (min-width: 901px) {
    #tab1.active {
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    #tab1.active > .tab-header,
    #tab1.active > .base-portfolio-filter,
    #tab1.active > .base-metrics-grid,
    #tab1.active > .next-step-guide {
        flex: 0 0 auto;
    }

    #tab1 .tab-header {
        margin-bottom: 12px;
        padding-bottom: 8px;
    }

    #tab1 .base-portfolio-filter,
    #tab1 .metrics-grid {
        margin-bottom: 12px;
    }

    #tab1 .metric-card {
        min-height: 88px;
        padding: 10px 14px;
    }

    #tab1 .table-section {
        flex: 1 1 auto;
        min-height: 160px;
        margin-bottom: 8px;
        padding: 12px;
    }

    #tab1 .table-header {
        margin-bottom: 8px;
    }

    #tab1 .table-scroll-container {
        min-height: 0;
        max-height: none;
    }

    #tab1 .table-pagination {
        padding-top: 8px;
    }

    #tab1 .next-step-guide {
        margin-top: 6px;
        padding-bottom: 0;
    }
}

#portfolio-detail-table {
    min-width: 1610px;
    table-layout: fixed;
}

#portfolio-detail-table th,
#portfolio-detail-table td {
    padding: 5px 8px;
    overflow: hidden;
    text-overflow: ellipsis;
}

#portfolio-detail-table th:nth-child(1) { width: 90px; }
#portfolio-detail-table th:nth-child(2) { width: 90px; }
#portfolio-detail-table th:nth-child(3) { width: 108px; }
#portfolio-detail-table th:nth-child(4) { width: 230px; }
#portfolio-detail-table th:nth-child(5) { width: 66px; }
#portfolio-detail-table th:nth-child(6) { width: 90px; }
#portfolio-detail-table th:nth-child(7) { width: 112px; }
#portfolio-detail-table th:nth-child(8) { width: 68px; }
#portfolio-detail-table th:nth-child(9),
#portfolio-detail-table th:nth-child(10) { width: 78px; }
#portfolio-detail-table th:nth-child(11) { width: 104px; }
#portfolio-detail-table th:nth-child(12) { width: 96px; }
#portfolio-detail-table th:nth-child(13) { width: 80px; }
#portfolio-detail-table th:nth-child(14) { width: 84px; }
#portfolio-detail-table th:nth-child(15) { width: 90px; }
#portfolio-detail-table th:nth-child(16) { width: 96px; }

@media (max-width: 900px) {
    #portfolio-detail-table {
        min-width: 1180px;
    }
}

/* --- Portfolio workspace density refinement --- */
@media (min-width: 901px) {
    #tab1.active {
        position: relative;
    }

    #tab1 .tab-header {
        padding-right: 310px;
    }

    #tab1 .next-step-guide {
        position: absolute;
        top: 0;
        right: 0;
        z-index: 5;
        margin: 0;
        padding: 0;
    }
}

#portfolio-detail-table th,
#portfolio-detail-table td {
    min-width: 0;
}

#portfolio-detail-table th:nth-child(6),
#portfolio-detail-table td:nth-child(6) {
    min-width: 90px;
}

/* --- Result ledger data grid polish --- */
#result-ledger-table th {
    white-space: normal;
    line-height: 1.25;
    vertical-align: middle;
}

#result-ledger-table th:nth-child(n+8):nth-child(-n+18) {
    text-align: right;
}

/* --- Compact data table typography --- */
.table-scroll-container table {
    font-size: 11.5px;
}

.table-scroll-container table th {
    font-size: 11px;
    line-height: 1.2;
    padding: 5px 7px;
}

.table-scroll-container table td {
    padding: 5px 7px;
}

/* --- Biz plan brand lockup --- */
.top-process-bar .logo-area {
    min-width: 244px;
    padding-right: 18px;
    border-right: 1px solid var(--border-base);
    gap: 10px;
}

.top-process-bar .logo-img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.top-process-bar .logo-text {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 9px;
    min-width: 0;
    white-space: nowrap;
}

.top-process-bar .logo-text h1 {
    margin: 0;
    color: #1c2a22;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1.05px;
}

.top-process-bar .logo-text h1::after {
    display: none;
}

.top-process-bar .logo-text p {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    margin: 0;
    padding: 2px 9px;
    border: 1px solid #bfe3cd;
    border-radius: 999px;
    color: #177a42;
    background: #eaf6ef;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1px;
    line-height: 1.1;
    white-space: nowrap;
}

@media (max-width: 1180px) {
    .top-process-bar .logo-area {
        min-width: 224px;
        padding-right: 12px;
    }

    .top-process-bar .logo-text h1 {
        font-size: 18px;
    }
}

@media (max-width: 900px) {
    .top-process-bar .logo-area {
        min-width: 0;
        padding-right: 0;
        border-right: 0;
    }
}

/* --- Compact base KPI cards --- */
#tab1 .base-metrics-grid {
    gap: 10px;
    margin-bottom: 10px;
}

#tab1 .metric-card {
    min-height: 60px;
    padding: 9px 13px;
    justify-content: center;
    gap: 4px;
}

#tab1 .metric-label {
    font-size: 10px;
    line-height: 1.2;
    letter-spacing: 0.25px;
}

#tab1 .metric-value {
    margin-top: 0;
    font-size: 20px;
    line-height: 1.1;
}

/* --- Base portfolio sub-tabs and composition view --- */
.base-view-tabs {
    display: inline-flex;
    align-self: flex-start;
    gap: 3px;
    margin: -2px 0 12px;
    padding: 4px;
    border: 1px solid var(--border-base);
    border-radius: 8px;
    background: #f5f7fa;
}

.base-view-tab {
    min-height: 30px;
    padding: 5px 13px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.base-view-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.72);
}

.base-view-tab.active {
    border-color: #d8e2ef;
    background: #ffffff;
    color: var(--border-active);
    box-shadow: 0 1px 2px rgba(18, 32, 51, 0.08);
}

.base-assets-content.base-view-hidden {
    display: none !important;
}

.base-composition-panel {
    display: none;
}

.base-composition-panel.active {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    overflow: auto;
    padding: 1px 1px 8px;
    animation: subTabFadeIn 0.2s ease;
}

.base-yield-backtest-panel {
    display: none;
}

.base-yield-backtest-panel.active {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    overflow: auto;
    padding: 1px 1px 8px;
    animation: subTabFadeIn 0.2s ease;
}

.composition-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin: 2px 0 14px;
    padding: 16px 18px;
    border: 1px solid #d8e2ef;
    border-radius: 8px;
    background: linear-gradient(110deg, #f7fbff 0%, #ffffff 62%);
}

.composition-eyebrow,
.composition-card-kicker {
    display: block;
    color: var(--border-active);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
}

.composition-toolbar h3,
.composition-card-header h4 {
    margin: 3px 0 0;
    color: var(--text-main);
    font-size: 17px;
    letter-spacing: -0.4px;
}

.composition-toolbar p {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 11.5px;
}

.composition-select-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 190px;
}

.composition-select-group label {
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 700;
}

.composition-select-group .premium-select {
    height: 34px;
    min-width: 190px;
}

.composition-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.28fr) minmax(310px, 0.72fr);
    gap: 14px;
    min-height: 0;
}

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

.composition-card-header h4 {
    font-size: 14px;
}

.composition-count-chip {
    flex: 0 0 auto;
    padding: 4px 7px;
    border-radius: 999px;
    background: #edf4fd;
    color: var(--border-active);
    font-size: 10px;
    font-weight: 800;
}














@media (min-width: 901px) {
    #tab1.composition-active .tab-header {
        padding-right: 0;
    }

    #tab1 .base-view-tabs {
        flex: 0 0 auto;
    }

    #tab1 .base-composition-panel.active,
    #tab1 .base-yield-backtest-panel.active {
        margin-bottom: 0;
    }
}

@media (max-width: 900px) {
    .base-view-tabs {
        width: 100%;
        margin-bottom: 10px;
    }

    .base-view-tab {
        flex: 1 1 0;
    }

    .composition-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .composition-select-group,
    .composition-select-group .premium-select {
        width: 100%;
    }

    .composition-grid {
        grid-template-columns: 1fr;
    }

    .composition-chart-card {
        min-height: 0;
    }
}

/* --- Base portfolio table column resizing --- */
#portfolio-detail-table th .column-resize-handle {
    right: -4px;
    width: 10px;
}

#portfolio-detail-table th .column-resize-handle::after {
    top: 16%;
    bottom: 16%;
}

#portfolio-detail-table th:has(.column-resize-handle:hover),
#portfolio-detail-table th:has(.column-resize-handle.active) {
    background: #e8f1fb;
}

/* --- Portfolio sticky header body mask --- */
#portfolio-table-scroll {
    position: relative;
    isolation: isolate;
}

#portfolio-detail-table {
    border-collapse: separate;
    border-spacing: 0;
}

#portfolio-detail-table thead {
    position: relative;
    z-index: 8;
}

#portfolio-detail-table th {
    z-index: 10;
    background: #f1f3f5;
    background-clip: padding-box;
    box-shadow: 0 -3px 0 #f1f3f5, 0 1px 0 var(--border-base);
}

#portfolio-detail-table th .column-resize-handle {
    z-index: 12;
}


/* --- Composition horizontal bar chart --- */
.composition-grid {
    grid-template-columns: minmax(0, 1fr);
    flex: 0 0 auto;
    align-items: start;
}

.composition-chart-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    align-self: stretch;
}

.composition-bar-frame {
    position: relative;
    flex: 0 0 auto;
    min-height: 360px;
    margin-top: 12px;
}

.composition-bar-frame canvas {
    position: relative;
    z-index: 2;
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 900px) {
    .composition-bar-frame {
        min-height: 340px;
    }
}

/* --- Kyobo green process bar --- */
.top-process-bar {
    background: linear-gradient(90deg, #1c2a22 0%, #203c2b 48%, #177a42 100%);
    border-bottom-color: rgba(234, 246, 239, 0.32);
    box-shadow: 0 2px 10px rgba(20, 49, 32, 0.18);
}

.top-process-bar .logo-area {
    border-right-color: rgba(234, 246, 239, 0.32);
}

.top-process-bar .logo-text h1 {
    color: #ffffff;
}

.top-process-bar .logo-text h1::after {
    background: #bfe3cd;
}

.top-process-bar .logo-text p {
    border-color: rgba(234, 246, 239, 0.48);
    color: #f4fff7;
    background: rgba(234, 246, 239, 0.16);
}

.top-process-bar .step-item {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(234, 246, 239, 0.28);
}

.top-process-bar .step-item:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(234, 246, 239, 0.52);
}

.top-process-bar .step-item.active {
    background: #eaf6ef;
    border-color: #bfe3cd;
}

.top-process-bar .step-item.active::before {
    background: #177a42;
}

.top-process-bar .step-num {
    color: #eaf6ef;
    opacity: 0.72;
}

.top-process-bar .step-title {
    color: #f4fff7;
}

.top-process-bar .step-item.active .step-num,
.top-process-bar .step-item.active .step-title {
    color: #1c2a22;
}

/* --- Portfolio table sorting --- */
#portfolio-detail-table th.sortable-header {
    position: sticky;
    padding-right: 7px;
    cursor: pointer;
    user-select: none;
}

#portfolio-detail-table th.sortable-header::after {
    content: "";
    display: none;
    position: absolute;
    top: 50%;
    right: 8px;
    z-index: 11;
    width: 12px;
    height: 12px;
    pointer-events: none;
    background-color: var(--border-active);
    transform: translateY(-50%);
}

#portfolio-detail-table th.sortable-header.sort-asc,
#portfolio-detail-table th.sortable-header.sort-desc {
    padding-right: 22px;
}

#portfolio-detail-table th.sortable-header.sort-asc::after {
    display: block;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 10V2M3 5l3-3 3 3' fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 10V2M3 5l3-3 3 3' fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
}

#portfolio-detail-table th.sortable-header.sort-desc::after {
    display: block;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 2v8M3 7l3 3 3-3' fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 2v8M3 7l3 3 3-3' fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
}

#portfolio-detail-table th.sortable-header:hover {
    background: #e8f1fb;
}

#portfolio-detail-table th.sortable-header:focus-visible {
    outline: 2px solid var(--border-active);
    outline-offset: -2px;
}

.portfolio-table-sorting {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 58px 18px 18px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(1px);
}

.portfolio-table-sorting[hidden] {
    display: none;
}

.portfolio-table-sorting-card {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(420px, 100%);
    padding: 13px 15px;
    border: 1px solid #c9dcec;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 24px rgba(19, 58, 90, 0.16);
}

.portfolio-table-sorting-card strong,
.portfolio-table-sorting-card span:not(.portfolio-table-sorting-spinner) {
    display: block;
}

.portfolio-table-sorting-card strong {
    margin-bottom: 2px;
    color: #173b5e;
    font-size: 12px;
}

.portfolio-table-sorting-card span:not(.portfolio-table-sorting-spinner) {
    color: var(--text-muted);
    font-size: 11px;
}

.portfolio-table-sorting-spinner {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    border: 2px solid #c8d8e8;
    border-top-color: var(--border-active);
    border-radius: 50%;
    animation: portfolio-table-sorting-spin 0.72s linear infinite;
}

@keyframes portfolio-table-sorting-spin {
    to {
        transform: rotate(360deg);
    }
}


/* --- Shared data-table workspace --- */
#portfolio-table-scroll,
#yield-backtest-scroll {
    position: relative;
    isolation: isolate;
}

table.table-workspace {
    border-collapse: separate;
    border-spacing: 0;
}

table.table-workspace thead {
    position: relative;
    z-index: 8;
}

table.table-workspace th,
table.table-workspace td {
    white-space: nowrap;
}

table.table-workspace th {
    position: sticky;
    top: 0;
    z-index: 10;
    text-align: center;
    background: #f1f3f5;
    background-clip: padding-box;
    box-shadow: 0 -3px 0 #f1f3f5, 0 1px 0 var(--border-base);
}

table.table-workspace th .column-resize-handle {
    right: -4px;
    width: 10px;
    z-index: 12;
}

table.table-workspace th .column-resize-handle::after {
    top: 16%;
    bottom: 16%;
}

table.table-workspace th:has(.column-resize-handle:hover),
table.table-workspace th:has(.column-resize-handle.active),
table.table-workspace th.sortable-header:hover {
    background: #e8f1fb;
}

table.table-workspace th.sortable-header {
    padding-right: 7px;
    cursor: pointer;
    user-select: none;
}

table.table-workspace th.sortable-header::after {
    content: "";
    display: none;
    position: absolute;
    top: 50%;
    right: 8px;
    z-index: 11;
    width: 12px;
    height: 12px;
    pointer-events: none;
    background-color: var(--border-active);
    transform: translateY(-50%);
}

table.table-workspace th.sortable-header.sort-asc,
table.table-workspace th.sortable-header.sort-desc {
    padding-right: 22px;
}

table.table-workspace th.sortable-header.sort-asc::after {
    display: block;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 10V2M3 5l3-3 3 3' fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 10V2M3 5l3-3 3 3' fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
}

table.table-workspace th.sortable-header.sort-desc::after {
    display: block;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 2v8M3 7l3 3 3-3' fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 2v8M3 7l3 3 3-3' fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
}

table.table-workspace th.sortable-header:focus-visible {
    outline: 2px solid var(--border-active);
    outline-offset: -2px;
}

.table-sorting-overlay {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 58px 18px 18px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(1px);
}

.table-sorting-overlay[hidden] {
    display: none;
}


/* --- Yield backtest filter polish 20260805 --- */
.yield-backtest-filter {
    container-type: inline-size;
    padding: 14px 15px 15px;
    border-color: #d7e1ec;
    border-radius: 10px;
    background: linear-gradient(110deg, #fff 0%, #fbfdff 68%, #f4f8fd 100%);
    box-shadow: 0 1px 2px rgba(31, 50, 73, .05), 0 8px 22px rgba(31, 50, 73, .035);
}
.yield-backtest-filter .filter-header {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 18px;
    margin: 0 0 11px;
    padding: 0 0 9px;
    border-bottom: 1px solid #e6edf4;
    color: #25384e;
    font-size: 11.5px;
    font-weight: 750;
    letter-spacing: -.05px;
    line-height: 1;
    text-transform: none;
}
.yield-backtest-filter .filter-header::before {
    content: "";
    width: 3px;
    height: 13px;
    border-radius: 999px;
    background: linear-gradient(180deg, #1681e8, #0050aa);
    box-shadow: 0 0 0 3px rgba(15, 98, 254, .08);
}
.yield-backtest-filter-grid {
    display: grid;
    grid-template-columns: clamp(136px, 8.2vw, 158px) clamp(136px, 8.2vw, 158px) clamp(170px, 11vw, 210px) minmax(250px, 1.9fr) clamp(128px, 8vw, 152px) minmax(170px, 1.05fr) 82px;
    gap: 8px;
    align-items: end;
}
.yield-backtest-filter .control-group {
    min-width: 0;
    gap: 5px;
}
.yield-backtest-filter .control-group label {
    min-height: 12px;
    color: #536579;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: -.05px;
    line-height: 12px;
    white-space: nowrap;
}
.yield-backtest-filter input[type="date"],
.yield-backtest-filter input[type="search"],
.yield-backtest-filter select,
.yield-backtest-filter .fund-chip-container {
    width: 100%;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    border: 1px solid #cfd9e5;
    border-radius: 7px;
    background-color: #fff;
    color: #233247;
    box-shadow: 0 1px 1px rgba(31, 50, 73, .035);
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 550;
    line-height: 1;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.yield-backtest-filter input[type="date"],
.yield-backtest-filter input[type="search"],
.yield-backtest-filter select {
    outline: none;
}
.yield-backtest-filter input[type="date"] {
    padding: 0 9px 0 11px;
    color-scheme: light;
}
.yield-backtest-filter input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: .55;
    cursor: pointer;
}
.yield-backtest-filter select {
    appearance: none;
    -webkit-appearance: none;
    padding: 0 31px 0 11px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235b6b7d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6%209%206%206%206-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
.yield-backtest-filter input[type="search"] {
    padding: 0 11px 0 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%2368798b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20%2020l-4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 11px center;
}
.yield-backtest-filter input[type="search"]::placeholder {
    color: #8794a3;
    font-weight: 500;
}
.yield-backtest-filter input[type="date"]:hover,
.yield-backtest-filter input[type="search"]:hover,
.yield-backtest-filter select:hover,
.yield-backtest-filter .fund-chip-container:hover {
    border-color: #aebdcd;
}
.yield-backtest-filter input[type="date"]:focus,
.yield-backtest-filter input[type="search"]:focus,
.yield-backtest-filter select:focus,
.yield-backtest-filter .fund-chip-container:focus-within {
    border-color: #2675c9;
    box-shadow: 0 0 0 3px rgba(0, 80, 170, .11);
}
.yield-backtest-filter .yield-backtest-fund-group,
.yield-backtest-filter .yield-backtest-search {
    min-width: 0;
    grid-column: auto;
}
.yield-backtest-filter .yield-backtest-fund-group .fund-chip-container {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 5px;
    scrollbar-color: #aebdcd transparent;
    scrollbar-width: thin;
}
.yield-backtest-filter #yield-bt-fund-codes .fund-chip {
    position: relative;
    flex: 0 0 auto;
    height: 26px;
    gap: 5px;
    padding: 0 9px 0 7px;
    border: 1px solid #d6e0ea;
    border-radius: 999px;
    background: #f7f9fc;
    color: #536579;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1;
    box-shadow: none;
}
.yield-backtest-filter #yield-bt-fund-codes .fund-chip::before {
    content: "";
    width: 13px;
    height: 13px;
    flex: 0 0 13px;
    border: 1px solid #9cabbc;
    border-radius: 4px;
    background: #fff center/13px no-repeat;
}
.yield-backtest-filter #yield-bt-fund-codes .fund-chip:hover {
    border-color: #91a7bf;
    background: #f0f5fa;
}
.yield-backtest-filter #yield-bt-fund-codes .fund-chip input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}
.yield-backtest-filter #yield-bt-fund-codes .fund-chip.active {
    border-color: #8bb8e8 !important;
    background: #edf5ff !important;
    color: #0755a4 !important;
}
.yield-backtest-filter #yield-bt-fund-codes .fund-chip.active::before {
    border-color: #0b67c3;
    background-color: #0b67c3;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3.5%208%202.8%202.8%206.2-6.2'/%3E%3C/svg%3E");
}
.yield-backtest-filter .filter-action-group {
    min-width: 0;
    align-self: end;
}
.yield-backtest-filter .btn-query {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
    height: 36px;
    padding: 0 13px;
    border: 1px solid #00498f;
    border-radius: 7px;
    background: linear-gradient(135deg, #0c69c7, #0050aa);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 80, 170, .2);
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
    transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}
.yield-backtest-filter .btn-query::before {
    content: "";
    width: 13px;
    height: 13px;
    flex: 0 0 13px;
    background: center/13px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20%2020l-4-4'/%3E%3C/svg%3E");
}
.yield-backtest-filter .btn-query:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #075bae, #003f88);
    box-shadow: 0 4px 10px rgba(0, 80, 170, .24);
}
.yield-backtest-filter .btn-query:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 80, 170, .2), 0 2px 6px rgba(0, 80, 170, .2);
}
.yield-backtest-summary {
    gap: 8px;
    margin: 10px 0 12px;
}
.yield-summary-item {
    position: relative;
    padding: 9px 12px 10px;
    overflow: hidden;
    border-color: #dce5ee;
    border-radius: 8px;
    background: linear-gradient(135deg, #fff, #fbfdff);
    box-shadow: 0 1px 2px rgba(31, 50, 73, .035);
}
.yield-summary-item::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 2px;
    background: #2f78bf;
    opacity: .58;
}
.yield-summary-item span {
    margin-bottom: 3px;
    color: #607185;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.2;
}
.yield-summary-item strong {
    color: #1f3045;
    font-size: 16px;
    font-weight: 750;
    line-height: 1.2;
}
@container (max-width: 1150px) {
    .yield-backtest-filter-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
    }
    .yield-backtest-filter .yield-backtest-fund-group {
        grid-column: 1 / -1;
    }
    .yield-backtest-filter .yield-backtest-search {
        grid-column: span 2;
    }
}
@container (max-width: 720px) {
    .yield-backtest-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .yield-backtest-filter .yield-backtest-fund-group,
    .yield-backtest-filter .yield-backtest-search {
        grid-column: 1 / -1;
    }
}
@container (max-width: 520px) {
    .yield-backtest-filter {
        padding: 12px;
    }
    .yield-backtest-filter-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .yield-backtest-filter .yield-backtest-fund-group,
    .yield-backtest-filter .yield-backtest-search {
        grid-column: 1;
    }
}


/* --- Yield backtest request feedback 20260805 --- */
.yield-backtest-filter .yield-backtest-query-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 22px;
    margin-left: auto;
    padding: 0 8px;
    border: 1px solid #b8d4ef;
    border-radius: 999px;
    background: #eff7ff;
    color: #0755a4;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: -0.05px;
    line-height: 1;
    white-space: nowrap;
}
.yield-backtest-filter .yield-backtest-query-state[hidden] { display: none; }
.yield-backtest-filter .yield-backtest-query-state::before {
    content: "";
    width: 11px;
    height: 11px;
    flex: 0 0 11px;
    border: 1.8px solid #9fc6eb;
    border-top-color: #0b67c3;
    border-radius: 50%;
    animation: yield-backtest-request-spin 0.75s linear infinite;
}
.yield-backtest-filter[aria-busy="true"] { border-color: #b4d2ed; }
.yield-backtest-filter .btn-query.is-loading {
    cursor: wait;
    opacity: 0.9;
    transform: none;
}
.yield-backtest-filter .btn-query.is-loading::before {
    width: 12px;
    height: 12px;
    flex-basis: 12px;
    border: 1.8px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    border-radius: 50%;
    background: none;
    animation: yield-backtest-request-spin 0.75s linear infinite;
}
@keyframes yield-backtest-request-spin {
    to { transform: rotate(360deg); }
}


/* --- Yield backtest filter space rebalance 20260805 --- */
.yield-backtest-filter-grid {
    grid-template-columns:
        clamp(122px, 7vw, 138px)
        clamp(122px, 7vw, 138px)
        clamp(145px, 8vw, 165px)
        minmax(600px, 1fr)
        clamp(110px, 6.4vw, 125px)
        clamp(150px, 9vw, 180px)
        74px;
}

@container (max-width: 1400px) {
    .yield-backtest-filter-grid {
        grid-template-columns: 128px 128px 155px 118px 180px 74px minmax(0, 1fr);
        gap: 8px;
    }

    .yield-backtest-filter-grid > .control-group:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }

    .yield-backtest-filter-grid > .control-group:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }

    .yield-backtest-filter-grid > .control-group:nth-child(3) {
        grid-column: 3;
        grid-row: 1;
    }

    .yield-backtest-filter .yield-backtest-fund-group {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .yield-backtest-filter-grid > .control-group:nth-child(5) {
        grid-column: 4;
        grid-row: 1;
    }

    .yield-backtest-filter .yield-backtest-search {
        grid-column: 5;
        grid-row: 1;
    }

    .yield-backtest-filter .filter-action-group {
        grid-column: 6;
        grid-row: 1;
    }
}

@container (max-width: 900px) {
    .yield-backtest-filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .yield-backtest-filter-grid > .control-group,
    .yield-backtest-filter .filter-action-group {
        grid-row: auto;
        grid-column: auto;
    }

    .yield-backtest-filter .yield-backtest-fund-group {
        grid-column: 1 / -1;
    }

    .yield-backtest-filter .yield-backtest-search {
        grid-column: span 2;
    }

    .yield-backtest-filter .yield-backtest-fund-group .fund-chip-container {
        height: auto;
        min-height: 36px;
        max-height: none;
        flex-wrap: wrap;
        overflow: visible;
    }
}

@container (max-width: 720px) {
    .yield-backtest-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .yield-backtest-filter .yield-backtest-fund-group,
    .yield-backtest-filter .yield-backtest-search {
        grid-column: 1 / -1;
    }
}

@container (max-width: 520px) {
    .yield-backtest-filter-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .yield-backtest-filter .yield-backtest-fund-group,
    .yield-backtest-filter .yield-backtest-search {
        grid-column: 1;
    }
}


/* --- Brand title scale refinement 20260805 --- */
.top-process-bar .logo-text h1 {
    font-size: 24px;
    letter-spacing: -1.2px;
}

.top-process-bar .logo-text p {
    font-size: 11.5px;
}

@media (max-width: 1180px) {
    .top-process-bar .logo-text h1 {
        font-size: 21px;
    }
}

@media (max-width: 900px) {
    .top-process-bar .logo-text h1 {
        font-size: 18px;
    }

    .top-process-bar .logo-text p {
        font-size: 10.5px;
    }
}


/* --- Dynamic table loading viewport 20260805 --- */
.portfolio-table-sorting,
.table-sorting-overlay {
    --workspace-overlay-x: 0px;
    --workspace-overlay-y: 0px;
    --workspace-overlay-inline-size: 100%;
    --workspace-overlay-block-size: 100%;
    --workspace-overlay-gutter: clamp(14px, 2vw, 32px);
    position: absolute;
    inset: auto;
    top: var(--workspace-overlay-y);
    left: var(--workspace-overlay-x);
    z-index: 30;
    display: grid;
    place-items: center;
    width: var(--workspace-overlay-inline-size);
    height: var(--workspace-overlay-block-size);
    min-width: 0;
    min-height: 0;
    padding: var(--workspace-overlay-gutter);
    overflow: hidden;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.74);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    cursor: wait;
}

.portfolio-table-sorting[hidden],
.table-sorting-overlay[hidden] {
    display: none;
}

.portfolio-table-sorting-card {
    width: min(440px, 100%);
    max-width: 100%;
    padding: clamp(12px, 1.25vw, 17px) clamp(14px, 1.5vw, 20px);
    box-sizing: border-box;
    overflow-wrap: anywhere;
}

.portfolio-table-sorting-spinner {
    width: clamp(17px, 1.7vw, 21px);
    height: clamp(17px, 1.7vw, 21px);
}

/* --- Foreign-currency FX hedge status --- */
.fx-hedge-filter-grid {
    display: grid;
    grid-template-columns: minmax(150px, 190px) minmax(150px, 190px) minmax(320px, 1fr) 82px;
    gap: 8px;
    align-items: end;
}

.fx-hedge-section {
    min-height: 0;
}

.fx-hedge-scroll {
    max-height: calc(100vh - 300px);
    min-height: 280px;
}

#fx-hedge-table {
    min-width: 2130px;
    table-layout: fixed;
}

#fx-hedge-table th:nth-child(1) { width: 100px; }
#fx-hedge-table th:nth-child(2) { width: 78px; }
#fx-hedge-table th:nth-child(3) { width: 250px; }
#fx-hedge-table th:nth-child(4) { width: 155px; }
#fx-hedge-table th:nth-child(5) { width: 70px; }
#fx-hedge-table th:nth-child(6),
#fx-hedge-table th:nth-child(12),
#fx-hedge-table th:nth-child(14) { width: 150px; }
#fx-hedge-table th:nth-child(7),
#fx-hedge-table th:nth-child(8),
#fx-hedge-table th:nth-child(11) { width: 135px; }
#fx-hedge-table th:nth-child(9),
#fx-hedge-table th:nth-child(10) { width: 150px; }
#fx-hedge-table th:nth-child(13) { width: 110px; }
#fx-hedge-table th:nth-child(15),
#fx-hedge-table th:nth-child(17) { width: 100px; }
#fx-hedge-table th:nth-child(16) { width: 150px; }

#fx-hedge-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#fx-hedge-table .fx-hedge-net,
#fx-hedge-table .fx-hedge-row-anomaly .numeric {
    color: #b4232d;
    font-weight: 650;
}

#fx-hedge-table .fx-hedge-row-fit .fx-hedge-net {
    color: #146c43;
}

#fx-hedge-scroll {
    position: relative;
    isolation: isolate;
}

@container (max-width: 900px) {
    .fx-hedge-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fx-hedge-search {
        grid-column: 1 / -1;
    }
}

@container (max-width: 520px) {
    .fx-hedge-filter-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .fx-hedge-search {
        grid-column: 1;
    }

    .fx-hedge-scroll {
        max-height: 62vh;
    }
}


/* --- Authentication --- */
.login-screen[hidden],
#app-shell[hidden] {
    display: none !important;
}

.login-screen {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(28, 42, 34, 0.96), rgba(23, 122, 66, 0.9)),
        #1c2a22;
}

.login-card {
    width: min(430px, 100%);
    padding: 36px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.25);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.login-brand img {
    width: 86px;
    height: 86px;
    object-fit: contain;
}

.login-brand p {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

.login-brand h1 {
    margin-top: 3px;
    color: #2c2925;
    font-size: 30px;
}

.login-description {
    margin: 24px 0 18px;
    color: #6a655e;
    font-size: 15px;
    line-height: 1.55;
}

.login-form {
    display: grid;
    gap: 9px;
}

.login-form label {
    margin-top: 5px;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 700;
}

.login-form input {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid #e7e4e0;
    border-radius: 11px;
    color: #2c2925;
    font: inherit;
}

.login-form input:focus {
    outline: none;
    border-color: #1f9d55;
    box-shadow: 0 0 0 3px rgba(31, 157, 85, 0.14);
}

.login-button {
    min-height: 50px;
    margin-top: 4px;
    border: 0;
    border-radius: 11px;
    background: #1f9d55;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.login-button:hover:not(:disabled) {
    background: #177a42;
}

.login-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.login-error {
    margin-top: 4px;
    padding: 9px 10px;
    border: 1px solid rgba(192, 86, 63, 0.25);
    border-radius: 10px;
    background: rgba(192, 86, 63, 0.08);
    color: #c0563f;
    font-weight: 700;
    line-height: 1.45;
}

.app-auth {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: auto;
    padding: 12px 4px 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.auth-role-badge {
    padding: 3px 7px;
    border-radius: 99px;
    background: #e8f0fe;
    color: #004b99;
    font-size: 10px;
}

#logout-button {
    margin-left: auto;
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid #b9c7d6;
    border-radius: 4px;
    background: #ffffff;
    color: var(--text-muted);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

#logout-button:hover {
    border-color: var(--border-active);
    color: var(--border-active);
}

@media (max-width: 640px) {
    .login-screen { padding: 16px; }
    .login-card { padding: 28px 22px; }
    .app-auth #auth-user-name,
    .auth-role-badge { display: none; }
}


/* --- FX hedge relationship map --- */
.fx-hedge-row.fx-hedge-detail-trigger {
    cursor: zoom-in;
}

.fx-hedge-row.fx-hedge-detail-trigger:focus-visible {
    position: relative;
    z-index: 2;
    outline: 2px solid var(--border-active);
    outline-offset: -2px;
}

.fx-hedge-detail-modal[hidden] {
    display: none !important;
}

.fx-hedge-detail-modal {
    position: fixed;
    z-index: 1200;
    inset: 0;
    display: grid;
    place-items: center;
    padding: clamp(12px, 2.4vw, 36px);
}

.fx-hedge-detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(19, 42, 62, .52);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.fx-hedge-detail-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(1220px, 100%);
    max-height: min(860px, calc(100vh - 24px));
    overflow: hidden;
    border: 1px solid #cbd8e5;
    border-radius: 14px;
    background: #f8fbfd;
    box-shadow: 0 22px 60px rgba(10, 34, 55, .32);
}

.fx-hedge-detail-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px 15px;
    border-bottom: 1px solid #dce6ee;
    background: linear-gradient(135deg, #ffffff, #edf6f6);
}

.fx-hedge-detail-eyebrow {
    display: block;
    margin-bottom: 3px;
    color: #267263;
    font-size: 11px;
    font-weight: 750;
}

.fx-hedge-detail-dialog h2 {
    margin: 0;
    color: #193b57;
    font-size: 21px;
    line-height: 1.25;
}

.fx-hedge-detail-dialog-header p {
    margin: 5px 0 0;
    color: #60758a;
    font-size: 12px;
}

.fx-hedge-detail-close {
    display: grid;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    place-items: center;
    padding: 0;
    border: 1px solid #c8d6df;
    border-radius: 8px;
    background: #fff;
    color: #36536a;
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}

.fx-hedge-detail-close:hover { background: #edf5f8; }

.fx-hedge-detail-modal-body {
    min-height: 0;
    padding: 18px 22px 22px;
    overflow: auto;
}

.fx-hedge-detail-dialog-footer {
    display: flex;
    justify-content: flex-end;
    padding: 12px 22px;
    border-top: 1px solid #dce6ee;
    background: #fff;
}

.fx-hedge-detail-dialog-footer button {
    min-width: 82px;
    padding: 8px 14px;
    border: 1px solid #8aa9bd;
    border-radius: 7px;
    background: #fff;
    color: #22506c;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.fx-hedge-detail-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.fx-hedge-detail-metric {
    padding: 10px 12px;
    border: 1px solid #d9e5ec;
    border-radius: 9px;
    background: #fff;
}

.fx-hedge-detail-metric span,
.fx-hedge-detail-metric small {
    display: block;
    color: #657b8e;
    font-size: 10px;
    font-weight: 700;
}

.fx-hedge-detail-metric strong {
    display: block;
    margin-top: 3px;
    color: #173b5e;
    font-size: 16px;
}

.fx-relationship-note {
    margin: -4px 0 14px;
    color: #5d7488;
    font-size: 11px;
    line-height: 1.5;
}

.fx-relationship-graph-wrap {
    overflow: auto;
    border: 1px solid #d6e2e9;
    border-radius: 11px;
    background:
        linear-gradient(rgba(223, 237, 240, .4) 1px, transparent 1px),
        linear-gradient(90deg, rgba(223, 237, 240, .4) 1px, transparent 1px),
        #fbfdfd;
    background-size: 24px 24px;
}

.fx-relationship-graph {
    display: block;
    width: 100%;
    min-width: 920px;
}

.fx-relationship-graph .column-label {
    fill: #557084;
    font-size: 13px;
    font-weight: 750;
}

.fx-relationship-graph .edge {
    fill: none;
    stroke: #4d8f9e;
    stroke-width: 2.1;
    opacity: .84;
}

.fx-relationship-graph .edge.risk {
    stroke: #8899b0;
    stroke-dasharray: 7 5;
}

.fx-relationship-graph .edge.primary { stroke-width: 3.2; }
.fx-relationship-graph .edge.mismatch { stroke: #c77b41; }

.fx-relationship-graph .edge-label {
    fill: #536f80;
    font-size: 10px;
    font-weight: 700;
}

.fx-relationship-graph .node rect {
    stroke-width: 1.25;
    rx: 10;
}

.fx-relationship-graph .asset-node rect {
    fill: #edf7f4;
    stroke: #77ad9e;
}

.fx-relationship-graph .asset-node.selected rect {
    fill: #d9f0e8;
    stroke: #23876e;
    stroke-width: 2.2;
}

.fx-relationship-graph .derivative-node rect {
    fill: #edf4fb;
    stroke: #719dc8;
}

.fx-relationship-graph .node-title {
    fill: #193b57;
    font-size: 13px;
    font-weight: 750;
}

.fx-relationship-graph .node-line {
    fill: #526f82;
    font-size: 11px;
}

.fx-relationship-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 10px 2px 20px;
    color: #5c7487;
    font-size: 11px;
}

.fx-relationship-legend span { display: inline-flex; align-items: center; gap: 5px; }
.fx-relationship-legend i { display: inline-block; width: 21px; border-top: 2px solid #4d8f9e; }
.fx-relationship-legend i.dashed { border-top-color: #8899b0; border-top-style: dashed; }
.fx-relationship-legend i.warning { border-top-color: #c77b41; }

.fx-rollover-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 9px;
}

.fx-rollover-heading h3 {
    margin: 0;
    color: #20425e;
    font-size: 15px;
}

.fx-rollover-heading span {
    color: #61788a;
    font-size: 11px;
}

.fx-rollover-list {
    display: grid;
    gap: 8px;
}

.fx-rollover-item {
    display: grid;
    grid-template-columns: 122px minmax(170px, 1fr) minmax(180px, 1.2fr) 116px;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #d9e4eb;
    border-left: 4px solid #59a98f;
    border-radius: 8px;
    background: #fff;
}

.fx-rollover-item.overdue { border-left-color: #c1574b; }
.fx-rollover-item.soon { border-left-color: #d18c2e; }
.fx-rollover-item.unknown { border-left-color: #9badba; }

.fx-rollover-date strong,
.fx-rollover-item .fx-rollover-trade {
    display: block;
    color: #21435f;
    font-size: 12px;
    font-weight: 750;
}

.fx-rollover-date small,
.fx-rollover-item .fx-rollover-product {
    display: block;
    margin-top: 2px;
    color: #637a8d;
    font-size: 10.5px;
}

.fx-rollover-position {
    color: #49677d;
    font-size: 11px;
}

.fx-rollover-countdown {
    justify-self: end;
    padding: 4px 7px;
    border-radius: 999px;
    background: #edf6f2;
    color: #1d735e;
    font-size: 10.5px;
    font-weight: 750;
    white-space: nowrap;
}

.fx-rollover-item.overdue .fx-rollover-countdown { background: #fff0ee; color: #ae4036; }
.fx-rollover-item.soon .fx-rollover-countdown { background: #fff6e5; color: #a26711; }
.fx-rollover-item.unknown .fx-rollover-countdown { background: #f0f3f5; color: #647787; }

.fx-hedge-detail-loading,
.fx-hedge-detail-empty {
    display: grid;
    min-height: 180px;
    place-items: center;
    align-content: center;
    gap: 8px;
    color: #5d7487;
    text-align: center;
    font-size: 12px;
}

.fx-hedge-detail-loading::before {
    content: "";
    width: 24px;
    height: 24px;
    border: 3px solid #c7dce2;
    border-top-color: #2a8a74;
    border-radius: 50%;
    animation: portfolio-table-sorting-spin .75s linear infinite;
}

.fx-hedge-detail-empty strong { color: #27475f; }

@media (max-width: 760px) {
    .fx-hedge-detail-modal { padding: 0; }
    .fx-hedge-detail-dialog { width: 100%; max-height: 100vh; border-radius: 0; }
    .fx-hedge-detail-dialog-header, .fx-hedge-detail-modal-body, .fx-hedge-detail-dialog-footer { padding-left: 14px; padding-right: 14px; }
    .fx-hedge-detail-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fx-rollover-item { grid-template-columns: 1fr; gap: 5px; }
    .fx-rollover-countdown { justify-self: start; }
}


.fx-hedge-match-cell small {
    display: block;
    margin-top: 2px;
    color: #267263;
    font-size: 9.5px;
    font-weight: 750;
    line-height: 1.15;
}


.fx-hedge-match-cell .fx-hedge-unwind-badge {
    color: #7254a3;
}

.fx-relationship-graph .edge.inferred-unwind {
    stroke: #7551a6;
    stroke-dasharray: 3 5;
}

.fx-relationship-legend i.inferred {
    border-top-color: #7551a6;
    border-top-style: dashed;
}


.fx-hedge-method {
    color: var(--primary, #246b50);
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

/* --- FX hedge NAV history and transaction timeline --- */
.fx-detail-basis {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -5px 0 17px;
    color: #5d7488;
    font-size: 11px;
}

.fx-detail-basis > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fx-detail-basis > b {
    flex: 0 0 auto;
    padding: 3px 7px;
    border-radius: 999px;
    background: #f1ebf8;
    color: #70509b;
    font-size: 10px;
}

.fx-detail-info {
    display: inline-grid;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #2b8b74;
    color: #fff;
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
    line-height: 1;
    cursor: help;
}

.fx-detail-info:focus-visible {
    outline: 2px solid #2b8b74;
    outline-offset: 2px;
}

.fx-history-section,
.fx-current-relationship {
    margin: 0 0 22px;
}

.fx-history-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 10px;
}

.fx-history-heading h3 {
    margin: 0;
    color: #20425e;
    font-size: 15px;
}

.fx-history-heading > div > span {
    display: block;
    margin-top: 3px;
    color: #63798a;
    font-size: 10.5px;
}

.fx-history-latest {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.fx-history-latest > span {
    padding: 5px 8px;
    border: 1px solid #d7e3e9;
    border-radius: 7px;
    background: #fff;
    color: #647b8b;
    font-size: 10px;
}

.fx-history-latest strong {
    margin-left: 3px;
    color: #214762;
    font-size: 11px;
}

.fx-history-insight {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 9px;
    padding: 9px 12px;
    border: 1px solid #d5e2e8;
    border-left: 4px solid #6d91a6;
    border-radius: 8px;
    background: #fff;
}

.fx-history-insight.over {
    border-left-color: #c76553;
    background: #fff8f6;
}

.fx-history-insight.under {
    border-left-color: #d39936;
    background: #fffbf2;
}

.fx-history-insight strong {
    color: #25465f;
    font-size: 11.5px;
}

.fx-history-insight span {
    flex: 0 0 auto;
    color: #647a8c;
    font-size: 10.5px;
    white-space: nowrap;
}

.fx-history-chart-card {
    overflow: hidden;
    border: 1px solid #d5e2e9;
    border-radius: 11px;
    background: #fff;
}

.fx-history-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 15px;
    padding: 10px 13px;
    border-bottom: 1px solid #e1eaef;
    background: #f9fbfc;
    color: #557084;
    font-size: 10.5px;
}

.fx-history-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.fx-history-chart-legend i {
    display: inline-block;
    width: 22px;
    border-top: 3px solid;
}

.fx-history-chart-legend i.nav { border-color: #2b8b74; }
.fx-history-chart-legend i.hedge { border-color: #3978b8; }
.fx-history-chart-legend i.ratio {
    border-color: #d08c2f;
    border-top-style: dashed;
}

.fx-history-chart-legend b.event {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.fx-history-chart-legend .event.asset { background: #27936f; }
.fx-history-chart-legend .event.hedge { background: #3d78b5; }
.fx-history-chart-legend .event.reduction { background: #8b5cac; }
.fx-history-chart-legend .event.rollover { background: #7c8793; }

.fx-history-chart-scroll {
    overflow-x: auto;
    background:
        linear-gradient(180deg, rgba(239, 247, 247, .52), rgba(255, 255, 255, 0) 35%),
        #fff;
}

.fx-history-chart {
    display: block;
    width: 100%;
    min-width: 880px;
}

.fx-history-chart .grid-line {
    stroke: #e4ebef;
    stroke-width: 1;
}

.fx-history-chart .x-tick {
    stroke: #a9bac5;
    stroke-width: 1;
}

.fx-history-chart .axis-label {
    fill: #738694;
    font-size: 10px;
}

.fx-history-chart .axis-label.ratio { fill: #b27627; }

.fx-history-chart .axis-title {
    fill: #567184;
    font-size: 11px;
    font-weight: 750;
}

.fx-history-chart .axis-title.ratio { fill: #ae7225; }

.fx-history-chart .ratio-target-band {
    fill: #dff1e9;
    opacity: .85;
}

.fx-history-chart .ratio-reference {
    stroke: #89a89d;
    stroke-width: 1;
    stroke-dasharray: 4 5;
}

.fx-history-chart .hedge-gap-area {
    fill: #e6a34e;
    opacity: .11;
}

.fx-history-chart .history-line {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.fx-history-chart .history-line.nav {
    stroke: #2b8b74;
    stroke-width: 2.5;
}

.fx-history-chart .history-line.hedge {
    stroke: #3978b8;
    stroke-width: 2.4;
}

.fx-history-chart .history-line.ratio {
    stroke: #d08c2f;
    stroke-width: 1.8;
    stroke-dasharray: 5 4;
}

.fx-history-chart .history-event-marker line {
    stroke-width: 1;
    stroke-dasharray: 2 5;
    opacity: .2;
}

.fx-history-chart .history-event-marker circle {
    stroke: #fff;
    stroke-width: 2;
    cursor: help;
}

.fx-history-chart .history-event-marker.asset line,
.fx-history-chart .history-event-marker.asset circle { stroke: #27936f; fill: #27936f; }
.fx-history-chart .history-event-marker.hedge line,
.fx-history-chart .history-event-marker.hedge circle { stroke: #3d78b5; fill: #3d78b5; }
.fx-history-chart .history-event-marker.reduction line,
.fx-history-chart .history-event-marker.reduction circle { stroke: #8b5cac; fill: #8b5cac; }
.fx-history-chart .history-event-marker.rollover line,
.fx-history-chart .history-event-marker.rollover circle { stroke: #7c8793; fill: #7c8793; }
.fx-history-chart .history-event-marker.current line,
.fx-history-chart .history-event-marker.current circle { stroke: #c65c4c; fill: #c65c4c; }

.fx-history-chart .latest-point {
    stroke: #fff;
    stroke-width: 2;
}

.fx-history-chart .latest-point.nav { fill: #17735c; }
.fx-history-chart .latest-point.hedge { fill: #285f98; }

.fx-history-timeline {
    margin: 0 0 24px;
    border: 1px solid #d6e2e9;
    border-radius: 11px;
    background: #fff;
}

.fx-history-timeline > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.fx-history-timeline > summary::-webkit-details-marker { display: none; }

.fx-history-timeline > summary::after {
    content: "⌄";
    order: 3;
    color: #567185;
    font-size: 18px;
    transition: transform .18s ease;
}

.fx-history-timeline:not([open]) > summary::after { transform: rotate(-90deg); }

.fx-history-timeline > summary > span:first-child {
    display: grid;
    gap: 2px;
}

.fx-history-timeline > summary strong {
    color: #20425e;
    font-size: 14px;
}

.fx-history-timeline > summary small {
    color: #657b8d;
    font-size: 10.5px;
}

.fx-history-timeline > summary .fx-detail-info {
    margin-left: auto;
}

.fx-history-timeline-body {
    max-height: 610px;
    padding: 4px 14px 15px;
    overflow: auto;
    border-top: 1px solid #e2eaef;
}

.fx-history-event-group {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;
}

.fx-history-event-rail {
    position: relative;
    min-height: 100%;
}

.fx-history-event-rail::after {
    position: absolute;
    z-index: 0;
    top: 0;
    bottom: 0;
    left: 11px;
    width: 1px;
    background: #d4e0e6;
    content: "";
}

.fx-history-event-rail > span {
    position: sticky;
    z-index: 1;
    top: 9px;
    display: block;
    width: 10px;
    height: 10px;
    margin: 15px 0 0 7px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px currentColor;
    background: currentColor;
    color: #3d78b5;
}

.fx-history-event-rail > span.asset { color: #27936f; }
.fx-history-event-rail > span.reduction { color: #8b5cac; }
.fx-history-event-rail > span.rollover { color: #7c8793; }
.fx-history-event-rail > span.current { color: #c65c4c; }

.fx-history-event-card {
    margin: 8px 0;
    padding: 10px 12px;
    border: 1px solid #e0e8ed;
    border-radius: 8px;
    background: #fbfcfd;
}

.fx-history-event-card > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}

.fx-history-event-card time {
    color: #234963;
    font-size: 12px;
    font-weight: 800;
}

.fx-history-snapshot {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
}

.fx-history-snapshot span {
    padding: 3px 6px;
    border-radius: 5px;
    background: #edf3f6;
    color: #5d7486;
    font-size: 9.5px;
}

.fx-history-snapshot .status {
    background: #edf1f4;
    color: #607383;
    font-weight: 800;
}

.fx-history-snapshot .status.fit { background: #e7f3ee; color: #27725f; }
.fx-history-snapshot .status.warning { background: #fff3dc; color: #9a6317; }
.fx-history-snapshot .status.anomaly { background: #fff0ed; color: #b04b3e; }

.fx-history-event-list {
    display: grid;
    gap: 5px;
}

.fx-history-event {
    display: grid;
    grid-template-columns: minmax(120px, auto) auto minmax(180px, 1fr);
    gap: 8px;
    align-items: baseline;
    padding-left: 9px;
    border-left: 3px solid #3d78b5;
    color: #516d80;
    font-size: 10.5px;
}

.fx-history-event.asset { border-left-color: #27936f; }
.fx-history-event.reduction { border-left-color: #8b5cac; }
.fx-history-event.rollover { border-left-color: #7c8793; }
.fx-history-event.current { border-left-color: #c65c4c; }

.fx-history-event b {
    color: #294b63;
    font-size: 10.5px;
}

.fx-history-event em {
    color: #365e78;
    font-size: 10px;
    font-style: normal;
    font-weight: 750;
    white-space: nowrap;
}

.fx-history-event small {
    grid-column: 3;
    color: #738592;
    font-size: 9.5px;
}

.fx-current-relationship .fx-relationship-legend {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .fx-history-heading,
    .fx-history-insight,
    .fx-history-event-card > header {
        align-items: flex-start;
        flex-direction: column;
    }

    .fx-history-latest,
    .fx-history-snapshot {
        justify-content: flex-start;
    }

    .fx-history-insight span {
        white-space: normal;
    }

    .fx-history-event {
        grid-template-columns: 1fr auto;
    }

    .fx-history-event > span,
    .fx-history-event small {
        grid-column: 1 / -1;
    }
}

@media (max-width: 600px) {
    .fx-detail-basis > span {
        white-space: normal;
    }

    .fx-history-chart {
        min-width: 760px;
    }

    .fx-history-timeline-body {
        padding-left: 8px;
        padding-right: 8px;
    }

    .fx-history-event-card {
        padding: 9px;
    }
}
