﻿/* ==== Theme ==== */
:root {
    --bg: #fff;
    --panel: #fff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --accent: #ffb020;
    --link: #2563eb;
}

/* ==== Layout ==== */
.investments-page {
    padding: 0;
    max-width: 1200px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
}

    .page-header h1 {
        font-size: 24px;
        font-weight: 700;
        margin: 0;
    }

/* Tabs */
.tabs {
    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
}

    .tabs li {
        padding: 10px 0;
        margin: 0;
    }

.tab-link {
    text-decoration: none;
    color: inherit;
    font-weight: 500;
    font-family: Calibri;
}

.tabs li.active {
    border-bottom: 2px solid var(--accent);
}

/* KPI cards */
.portfolio-summary {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(6,minmax(0,1fr));
    padding: 16px 0;
}

.kpi-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

.kpi-value {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.1;
}

.kpi-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 2px;
}

/* Toolbar */
.list-section {
    margin-top: 8px;
}

.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 10px;
}

.list-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.filters {
    display: flex;
    align-items: center;
    gap: 10px;
}

.investment-toolbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.ri-welcome .investment-toolbar-button,
.ri-welcome input[type="submit"].investment-toolbar-button {
    box-sizing: border-box;
    flex: 0 0 auto;
    width: auto;
    min-width: 90px;
    height: 20px;
    min-height: 20px;
    margin: 0;
    padding: 1px 12px;
    border: 1px solid #050076;
    border-radius: 10px;
    font-family: Georgia;
    font-size: 11px;
    font-weight: bold;
    line-height: normal;
    white-space: nowrap;
    overflow: visible;
}

.performance-toolbar {
    margin: 10px 0 16px;
}

.nav-asof-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 8px;
    color: #555;
}

.nav-asof-controls {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.nav-asof-help {
    font-size: 12px;
    color: #777;
}

.filter-caption {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Pill select */
.select-wrap {
    position: relative;
}

.pill-select {
    appearance: none;
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 16px 6px 6px;
    font-weight: 600;
    line-height: 1.4;
    background-color: ghostwhite;
}

.pill-input {
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 6px;
    line-height: 1.1;
    font-weight: 500;
    outline: none;
}

    .pill-input:focus {
        border-color: var(--accent);
        background: #fff;
    }

.select-wrap::after {
    content: "▾";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--muted);
    pointer-events: none;
}

/* ==== Table container ==== */
.table-wrapper {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-header th {
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 12px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.table-row td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 15px;
}

.table-row.alt td {
    background: #fcfcfd;
}

.cell-link {
    color: var(--link);
    text-decoration: none;
    font-weight: 600;
}

    .cell-link:hover {
        text-decoration: underline;
    }

/* ==== GridView: investments ==== */
.table.investments {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 11px !important;
}

    .table.investments .table-row td {
        font-size: 13px !important;
    }

    .table.investments thead tr,
    .table.investments tbody tr {
        display: table-row !important;
    }

    .table.investments th,
    .table.investments td {
        display: table-cell !important;
        vertical-align: middle;
        padding: 6px 10px;
        text-align: left;
    }

        /* fixed first column (toggle) */
        .table.investments th:first-child,
        .table.investments td:first-child {
            width: 24px;
        }

        /* alignment by class (stable across reordering) */
        .table.investments th.col-investment,
        .table.investments td.col-investment {
            text-align: left !important;
        }

        .table.investments th.col-type,
        .table.investments td.col-type {
            text-align: center !important;
        }

        /* headers: allow wrapping */
        .table.investments th.col-money {
            text-align: center !important;
            white-space: normal !important;
            overflow-wrap: anywhere;
            word-break: break-word;
        }

        /* body cells: keep nowrap so money stays on one line */
        .table.investments td.col-money {
            text-align: right !important;
            white-space: nowrap;
        }

    /* header look */
    .table.investments thead th {
        text-transform: uppercase;
        font-weight: 600;
        letter-spacing: .02em;
        background: #fff;
    }
    /* optional sticky header */
    .table.investments thead th {
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 1;
    }

    /* toggle */
    .table.investments .toggle {
        display: inline-block;
        width: 20px;
        text-align: center;
        font-weight: 600;
    }

        .table.investments .toggle:hover {
            opacity: .75;
            cursor: pointer;
            text-decoration: none;
        }

    /* details row (child wrapper) */
    .table.investments .details {
        position: relative;
        background: #fbfbfb;
        border-top: 1px solid var(--border);
        padding: 6px 10px 8px 28px; /* left indent */
    }

        /* faint connector line */
        .table.investments .details::before {
            content: "";
            position: absolute;
            left: 14px;
            top: 0;
            bottom: 8px;
            width: 1px;
            background: #e9e9e9;
        }

    /* child grid inherits alignment; hide its header for compact look */
    .table.investments.child {
        font-size: .95em;
    }

        .table.investments.child thead {
            display: none;
        }

    .table.investments .details .table.investments.child td {
        border-bottom: 0;
    }
    /* avoid double borders */

    /* name clamping (optional but tidy) */
    .table.investments .cell-link {
        max-width: 520px;
        display: inline-block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding-left: 0;
    }

    /* row hover */
    .table.investments .table-row:hover,
    .table.investments.child .table-row:hover {
        background: #fafafa;
    }

/* ==== Responsive ==== */
@media (max-width:1000px) {
    .portfolio-summary {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
}

@media (max-width:640px) {
    .portfolio-summary {
        grid-template-columns: 1fr;
    }

    .list-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .table-wrapper {
        overflow-x: auto;
    }
}

.table.investments tr.table-row td {
    border-bottom: 1px solid #dbeafe; /* Tailwind sky-200 vibe */
}

/* child block too */
.table.investments .details .table.investments.child tr.table-row td {
    border-bottom: 1px solid #e5effd;
}

/* last row in a block */
.table.investments tbody tr.table-row:last-child td {
    border-bottom-color: #e5e7eb; /* keep end of section tidy */
}

.table.investments tr td {
    border-bottom: 1px solid #dbeafe;
}

.investment-columns-dialog {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10020;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, .45);
}

.nav-columns-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.nav-columns-toolbar .buttonstyle {
    margin: 0;
}

.investment-columns-dialog.is-open {
    display: flex;
}

.investment-columns-card {
    display: flex;
    flex-direction: column;
    width: min(560px, 100%);
    max-height: calc(100vh - 32px);
    overflow: hidden;
    box-sizing: border-box;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel, #fff);
    color: var(--text, #111827);
    box-shadow: 0 18px 45px rgba(15, 23, 42, .25);
}

.investment-columns-card h3 {
    margin: 0 0 6px;
}

.investment-columns-help {
    margin: 0 0 12px;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.35;
}

.investment-columns-options {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    overflow-y: auto;
    padding: 1px 4px 1px 1px;
}

.investment-column-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 30px 30px 30px;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 5px 7px;
    border: 1px solid var(--border, #d1d5db);
    border-radius: 6px;
    background: var(--panel, #fff);
}

.investment-column-row.is-dragging {
    opacity: .55;
    border-color: #225d8a;
}

.investment-column-row label {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.investment-column-row label > span:first-of-type {
    min-width: 0;
    overflow-wrap: normal;
    word-break: normal;
}

.investment-column-row input:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.ri-welcome .investment-columns-card .investment-column-drag-handle,
.ri-welcome .investment-columns-card .investment-column-order-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 30px;
    min-width: 0;
    max-width: 30px;
    height: 26px;
    min-height: 26px;
    max-height: 26px;
    padding: 0;
    margin: 0;
    color: rgba(34, 93, 138, 1);
    background-color: ghostwhite;
    border: 1px solid #050076;
    border-radius: 5px;
    font-family: Arial, sans-serif;
    font-size: 15px;
    line-height: 24px;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: background-color .2s, border-color .2s;
}

.ri-welcome .investment-columns-card .investment-column-drag-handle:hover,
.ri-welcome .investment-columns-card .investment-column-order-control:hover:not(:disabled) {
    border-color: #050076;
    background-color: #b3d9ff;
}

.ri-welcome .investment-columns-card .investment-column-drag-handle:focus-visible,
.ri-welcome .investment-columns-card .investment-column-order-control:focus-visible {
    outline: 2px solid #225d8a;
    outline-offset: 1px;
}

.ri-welcome .investment-columns-card .investment-column-drag-handle {
    cursor: grab;
    letter-spacing: -4px;
    padding-right: 4px;
}

.ri-welcome .investment-columns-card .investment-column-drag-handle:active {
    cursor: grabbing;
}

.ri-welcome .investment-columns-card .investment-column-order-control:disabled {
    cursor: not-allowed;
    opacity: .4;
}

.required-column {
    color: #6b7280;
    font-size: 10px;
}

.investment-columns-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

@media (max-width: 520px) {
    .investment-columns-dialog {
        padding: 8px;
    }

    .investment-columns-card {
        max-height: calc(100vh - 16px);
        padding: 14px;
    }

    .investment-column-row {
        grid-template-columns: minmax(0, 1fr) 28px 28px 28px;
        gap: 4px;
        padding: 5px;
    }

    .ri-welcome .investment-columns-card .investment-column-drag-handle,
    .ri-welcome .investment-columns-card .investment-column-order-control {
        width: 28px;
        max-width: 28px;
    }
}

.help-tip {
    cursor: help;
    font-weight: 600;
    margin-left: 4px;
}

.table.investments thead th,
.table.investments .table-header th {
    white-space: normal !important;
    overflow-wrap: anywhere; /* modern */
    word-break: break-word; /* fallback */
}

    .table.investments thead th a,
    .table.investments .table-header th a {
        white-space: normal !important;
        display: inline; /* ensure anchor doesn’t force single-line */
    }

/* subtle gray for closed rows/links */
.muted {
    opacity: 0.6;
}

/* small pill badge for the “Closed” chip */
.badge.badge-closed {
    display: inline-block;
    margin-left: .5rem;
    padding: 2px 6px;
    font-size: 11px;
    line-height: 1.2;
    border-radius: 10px;
    background: #eee;
    border: 1px solid #ddd;
    color: #555;
}

/* same box for chevron or spacer so indentation is consistent */
.gv-indent {
    display: inline-block;
    width: 16px;
}

/* ==== Activity / Performance sections ==== */
#sectionActivity,
#sectionPerformance {
    margin-top: 8px;
}

    /* reuse the list-toolbar look */
    #sectionActivity .list-toolbar,
    #sectionPerformance .list-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin: 8px 0 10px;
    }

    #sectionActivity .filters .pill-input {
        background: #f9fafb;
        border: 1px solid var(--border);
        border-radius: 999px;
        padding: 6px 12px;
        line-height: 1.4;
        min-width: 120px;
    }

/* ==== Activity cards ==== */
.activity-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px 10px;
    margin-bottom: 10px;
    box-shadow: 0 1px 0 rgba(0,0,0,.02);
}

.activity-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.activity-date {
    font-weight: 600;
    color: var(--text);
}

.activity-type {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
}

.activity-amount {
    margin-left: auto;
    font-weight: 700;
}

.activity-card-body {
    font-size: 13px;
    color: var(--muted);
}

.activity-transfer {
    margin-top: 6px;
    display: inline-block;
    background: rgba(255,176,32,.1);
    color: #92400e;
    border: 1px solid rgba(255,176,32,.4);
    border-radius: 999px;
    padding: 2px 10px 3px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

@media (max-width: 640px) {
    .activity-card-top {
        flex-wrap: wrap;
    }

    .activity-amount {
        margin-left: 0;
    }
}

.date-input {
    background-image: url(/images/icon-calendar.svg); /* optional */
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    padding-right: 30px; /* room for icon */
}

#sectionActivity .pill-input {
    width: 130px;
}
/* Activity feed */
.activity-day {
    margin-bottom: 16px;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 12px;
    margin: 4px 0;
}

.ai-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ai-title {
    font-size: 13px;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-sub {
    font-size: 12px;
    color: #6b7280;
}

.ai-right {
    font-weight: 800;
    font-size: 14px;
    white-space: nowrap;
}

/* amount coloring */
.money.in {
    color: #065f46;
}
/* green */
.money.out {
    color: #b91c1c;
}
/* red */

/* type chip */
.chip {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-radius: 999px;
    padding: 3px 8px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #374151;
}

    .chip.Distribution {
        background: #ecfdf5;
        border-color: #a7f3d0;
        color: #065f46;
    }

    .chip.Investment {
        background: #fff7ed;
        border-color: #fed7aa;
        color: #9a3412;
    }

    .chip["Return of Capital"], .chip.Return\ of\ Capital {
        background: #eff6ff;
        border-color: #bfdbfe;
        color: #1e40af;
    }

    .chip["Transfer in Capital"], .chip.Transfer\ in\ Capital {
        background: #eef2ff;
        border-color: #c7d2fe;
        color: #3730a3;
    }

    .chip["Transfer out Capital"], .chip.Transfer\ out\ Capital {
        background: #fee2e2;
        border-color: #fecaca;
        color: #991b1b;
    }

.badge {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    padding: 2px 6px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #6b7280;
}

/* Scrollable activity region: keeps header/KPIs in view */
.activity-scroll {
    /* header (tabs) + KPI block height ≈ 220–280px in your UI.
     Use viewport math so it fits any screen. */
    max-height: calc(100vh - 320px);
    overflow: auto;
    padding-right: 6px; /* room for scrollbar */
}

/* optional: sticky date headers inside the scroll */
.activity-day-header {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
}

/* container for inline chart */
.perf-chart-inline-container {
    margin-top: 10px;
}

/* chart wrapper so we can absolutely-position the buttons */
.perf-chart-inner {
    position: static;
    display: inline-block; /* chart width controls size */
}

/* bigger wrapper for the large chart inside modal */
.perf-chart-inner-large {
    /* optional: constrain size inside modal */
    max-width: 90vw;
    max-height: 75vh;
    overflow: hidden;
}

/* generic button style (both expand + close) */
.perf-chart-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    line-height: 24px;
    text-align: center;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(0,0,0,0.25);
    z-index: 5;
}

    .perf-chart-btn:hover {
        background: white;
    }

/* expand (inline) specific, just for clarity */
.perf-chart-btn-expand {
}

/* close (modal) specific */
.perf-chart-btn-close {
}

/* FULLSCREEN MODAL SHELL */
.perf-chart-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1000000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.perf-chart-modal-content {
    width: min(96vw, 1600px);
    height: min(92vh, 980px);
    background: #fff;
    border-radius: 12px;
    position: relative;
    padding: 12px;
    box-sizing: border-box;
    overflow: auto; /* <-- key: allow scroll if chart is tall */
}

/* make the chart image fit the viewport height */
.perf-chart-inner-large img {
    width: 100%;
    height: auto;
    max-height: calc(92vh - 80px); /* header/close button space */
    display: block;
}

/* Performance controls stay anchored to their own chart, outside its scroll area. */
#sectionPerformance .perf-chart-inline-container {
    position: relative;
    width: fit-content;
    max-width: 100%;
    padding-top: 38px;
}

#sectionPerformance .perf-chart-btn {
    width: 34px;
    height: 34px;
    min-height: 34px;
    line-height: 30px;
}

#sectionPerformance .perf-chart-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

#sectionPerformance .perf-chart-modal-content {
    padding-top: 46px;
    height: auto;
    max-height: 92vh;
}

#sectionPerformance .perf-chart-inner-large {
    display: block;
    width: 100%;
    max-width: none;
    max-height: none;
    overflow: auto;
}

#sectionPerformance .perf-chart-inner-large img {
    /* Override Web Forms Chart's generated inline bitmap dimensions. */
    width: 100% !important;
    min-width: 1100px;
    height: auto !important;
    max-height: none !important;
}

/* align headers explicitly */
.table-nav-header th.text-left {
    text-align: left;
}

.table-nav-header th.text-center {
    text-align: center;
}

.table-nav-header th.text-right {
    text-align: right;
}

/* align data rows explicitly (normal + alternating) */
.table-nav-row td.text-left,
.table-row.alt td.text-left {
    text-align: left;
}

.table-nav-row td.text-center,
.table-row.alt td.text-center {
    text-align: center;
}

.table-nav-row td.text-right,
.table-row.alt td.text-right {
    text-align: right;
}

/* keep what you already have */
.table-nav-header th {
    padding: 4px 10px;
    white-space: nowrap;
}

    .table-nav-header th a {
        text-decoration: underline;
        cursor: pointer;
    }

.table-nav-header th {
    font-size: 13px;
}

/* Both regular and alternating rows */
#gvNavDetail .table-nav-row td,
#gvNavDetail .table-row.alt td {
    font-size: 13px;
}

/* Layout for KPI row: flex instead of grid so sortable works correctly */
#perfKpiRow .kpi-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* KPI card must be relative so checkbox can sit in corner */
.kpi-card {
    position: relative;
    flex: 0 0 160px;
}

/* Checkbox – hidden outside customize mode */
.kpi-visibility-toggle {
    position: absolute;
    top: 4px;
    right: 6px;
    display: none;
    cursor: pointer;
}

/* When customizing, show checkboxes & move cursor */
body.perf-kpi-customizing .kpi-visibility-toggle {
    display: block;
}

body.perf-kpi-customizing .kpi-card {
    cursor: move;
    user-select: none; /* <- so dragging doesn't select text */
}

/* Placeholder slot when dragging KPI cards */
.kpi-card-placeholder {
    border: 2px dashed #999;
    border-radius: 12px;
    background: #fafafa;
    min-height: 90px;
    flex: 0 0 160px; /* match .kpi-card */
}

/* Outside customize mode, any card with kpi-hidden should not be shown */
body:not(.perf-kpi-customizing) #perfKpiRow .kpi-card.kpi-hidden {
    display: none;
}

.kpi-group {
    margin-bottom: 12px;
}

.kpi-group-header {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin: 4px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* In normal mode, hide KPI groups that have no visible cards */
body:not(.perf-kpi-customizing) .kpi-group.kpi-group-empty {
    display: none;
}

/* In customize mode, always show KPI groups so user can re-enable hidden cards */
body.perf-kpi-customizing .kpi-group {
    display: block !important;
}

.kpi-badge {
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10px;
    text-transform: uppercase;
    vertical-align: middle;
}

.kpi-badge-range {
    background: #e6f1ff;
    color: #0b4a97;
}

.kpi-badge-si {
    background: #f3e9ff;
    color: #5a1997;
}

.kpi-badge-asof {
    background: #f1f1f1;
    color: #555;
}

.kpi-badge-ttm {
    background: #e8fff3;
    color: #1c7a3b;
}

/* Make sure the NAV/Holdings datepicker floats above nearby buttons */
#ui-datepicker-div,
.ui-datepicker {
    z-index: 9999 !important;
}

/* ============================================================
   Investment detail overlay (investor view) – Option 3
   All classes prefixed with .invdetail-* to avoid collisions
   ============================================================ */

body.invdetail-lockscroll {
    overflow: hidden;
}

.invdetail-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none; /* shown via JS */
    align-items: center;
    justify-content: center;
    font-family: Calibri, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.invdetail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

.invdetail-panel {
    position: relative;
    background: var(--panel);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    max-width: 1100px;
    width: 75vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 520px; /* keeps it from shrinking on small tabs */
    max-height: 80vh;
}

.invdetail-header {
    padding: 14px 20px 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.invdetail-header-left {
    min-width: 0;
}

.invdetail-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.invdetail-type-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #f9fafb;
    color: #4b5563;
}

.invdetail-meta {
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
}

    .invdetail-meta strong {
        font-weight: 600;
        color: var(--text);
    }

.invdetail-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.invdetail-admin-btn {
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: #f9fafb;
    cursor: pointer;
}

.invdetail-close-btn {
    border: none;
    background: #f3f4f6;
    border-radius: 999px;
    width: 28px;
    height: 28px;
    font-size: 16px;
    line-height: 26px;
    text-align: center;
    cursor: pointer;
}

    .invdetail-close-btn:hover {
        background: #e5e7eb;
    }

/* pill tabs */
.invdetail-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px 8px;
    border-bottom: 1px solid var(--border);
    background: #f9fafb;
}

.invdetail-tab {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
}

    .invdetail-tab:hover {
        background: #eef2ff;
        color: #111827;
    }

    .invdetail-tab.invdetail-tab-active {
        background: var(--accent);
        border-color: #fbbf24;
        color: #111827;
    }

/* body / sections */
.invdetail-body {
    padding: 12px 18px 16px;
    overflow: auto;
    flex: 1 1 auto;
}

.invdetail-section {
    display: none;
}

    .invdetail-section.invdetail-section-active {
        display: block;
    }

/* General section layout */
.invdetail-general-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 24px; /* row gap, column gap */
    margin-top: 6px;
    max-width: 400px; /* <<< keeps both columns closer together */
    width: 100%;
}

    /* each field block (City, State, etc.) */
    .invdetail-general-grid > div {
        margin-bottom: 2px; /* reduce extra vertical padding between items */
    }

.invdetail-field-label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    margin-bottom: 1px;
}

.invdetail-field-value {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.invdetail-kpi-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.invdetail-kpi-pill {
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: 4px 10px;
    font-size: 12px;
    background: #f9fafb;
}

/* Documents */
.invdetail-docs-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* makes colgroup widths apply cleanly */
    font-size: 13px;
    margin-top: 4px;
}

    .invdetail-docs-table th,
    .invdetail-docs-table td {
        padding: 6px 14px;
        border-bottom: 1px solid #e5e7eb;
        font-size: 13px;
    }

    .invdetail-docs-table th {
        text-align: left;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .08em;
        color: var(--muted);
    }

.invdetail-doc-namecell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.invdetail-doc-maincell {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Column widths (match <colgroup> classes) */
.invdetail-docs-table col.inv-col-name {
    width: 64%;
}

.invdetail-docs-table col.inv-col-modified {
    width: 18%;
}

.invdetail-docs-table col.inv-col-size {
    width: 10%;
}

.invdetail-docs-table col.inv-col-type {
    width: 8%;
}

.invdetail-docs-table col.inv-col-actions {
    width: 52px;
}

.invdetail-doc-name {
    white-space: normal;
    word-wrap: break-word;
}

.invdetail-doc-icon {
    width: 16px;
    height: 16px;
}

/* make the whole row clickable for folders */
.invdetail-folder-click {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: block; /* give it size */
    z-index: 1; /* sit above the row contents */
    opacity: 0; /* invisible but clickable */
    cursor: pointer;
}

.invdetail-doc-actions img {
    vertical-align: middle;
}

.invdetail-docs-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 6px;
    font-size: 13px;
}

.invdetail-docs-title {
    font-weight: 600;
    font-size: 14px;
}

.invdetail-docs-path-row {
    display: flex;
    align-items: center;
    gap: 8px; /* space between path text and Back */
    margin-top: 4px;
}

.invdetail-docs-path {
    font-style: italic;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
}

.invdetail-docs-back {
    margin-left: 0;
    font-size: 12px;
    text-decoration: none;
    border: none;
    background: transparent;
    color: #2563eb;
    cursor: pointer;
}

    .invdetail-docs-back:hover {
        text-decoration: underline;
    }



/* Images */
.invdetail-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 6px;
}

.invdetail-image-thumb {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}

    .invdetail-image-thumb img {
        width: 100%;
        height: 120px;
        object-fit: cover;
        display: block;
    }

/* Org table */
.invdetail-org-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 4px;
}

    .invdetail-org-table th,
    .invdetail-org-table td {
        padding: 6px 4px;
        border-bottom: 1px solid #e5e7eb;
    }

/* Perf metrics */
.invdetail-perf-kpis {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 4px 0 10px;
}

.invdetail-perf-kpi {
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 8px 10px;
    min-width: 150px;
    background: #fff;
}

.invdetail-perf-kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}

.invdetail-perf-kpi-value {
    font-size: 16px;
    font-weight: 700;
}

@media (max-width: 900px) {
    .invdetail-panel {
        width: 94vw;
        max-width: 94vw;
        max-height: 90vh;
    }

    .invdetail-general-grid {
        grid-template-columns: 1fr;
    }
}

/* --- IMAGES CAROUSEL --- */

.invdetail-images-carousel {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 18px;
}

.invdetail-images-stage {
    position: relative;
    width: 100%;
    max-width: 860px; /* a bit narrower so it fits comfortably */
    height: 400px;
    margin: 0 auto;
    overflow: hidden; /* prevents any horizontal overflow */
}

/* base style for each image slot */
.invdetail-image-slot {
    position: absolute !important; /* force absolute so they don't stack */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    pointer-events: none;
    display: none; /* hidden by default, JS turns on 3 */
    transition: transform 0.35s ease, opacity 0.35s ease, box-shadow 0.35s ease;
}

    .invdetail-image-slot img {
        display: block;
        border-radius: 18px;
        max-height: 400px;
        max-width: 100%; /* don't let image be wider than slot/stage */
        width: auto;
        object-fit: cover;
    }

    /* center / main image */
    .invdetail-image-slot.is-active {
        display: block;
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
        pointer-events: auto;
        z-index: 3;
        box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
    }

    /* left neighbor */
    .invdetail-image-slot.is-prev {
        display: block;
        transform: translate(-130%, -50%) scale(0.90);
        opacity: 0.95;
        pointer-events: auto;
        z-index: 2;
        box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
    }

    /* right neighbor */
    .invdetail-image-slot.is-next {
        display: block;
        transform: translate(30%, -50%) scale(0.90);
        opacity: 0.95;
        pointer-events: auto;
        z-index: 2;
        box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
    }

    /* subtle emphasis on main image */
    .invdetail-image-slot.is-active img {
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
    }

/* controls row */
.invdetail-images-controls {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.invdetail-images-nav {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .invdetail-images-nav:hover {
        background: #f3f4f6;
    }

/* Org chart layout */
.orgchart-wrapper {
    position: relative;
    width: 100%;
    height: 420px;
    margin-top: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
}

.orgchart-canvas {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    width: 100%;
    height: 100%;
    cursor: grab;
    position: relative;
}

    .orgchart-canvas.orgchart-dragging {
        cursor: grabbing;
    }

.orgchart-inner {
    position: absolute;
    top: 24px;
    left: 0; /* was 20px */
    transform-origin: 0 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 11px;
}

/* Tree structure */

.org-tree {
    padding-left: 0;
    margin: 0;
    list-style: none;
    text-align: center; /* center the root li */
}

.org-tree,
.org-tree ul {
    padding-left: 0;
    margin: 0;
    list-style: none;
}
    .org-tree > li {
        display: inline-block;
    }

    /* each generation in a row */
    .org-tree ul {
        display: flex;
        justify-content: center;
        align-items: flex-start;
        margin-top: 24px;
        position: relative;
    }

    .org-tree li {
        position: relative;
        padding: 18px 12px 0 12px;
    }

        /* horizontal connectors between siblings */
        .org-tree li::before,
        .org-tree li::after {
            content: "";
            position: absolute;
            top: 0;
            border-top: 1px solid #d1d5db;
            width: 50%;
            height: 12px;
        }

        .org-tree li::before {
            right: 50%;
        }

        .org-tree li::after {
            left: 50%;
        }

        /* Remove extra lines on single child / first / last */
        .org-tree li:only-child::before,
        .org-tree li:only-child::after {
            display: none;
        }

        .org-tree li:only-child {
            padding-top: 0;
        }

        .org-tree li:first-child::before {
            border: 0 none;
        }

        .org-tree li:last-child::after {
            border: 0 none;
        }

/* make wrapper a positioning context */
.org-node-wrapper {
    position: relative;
}

/* vertical line from parent row down to each card */
.org-tree li > .org-node-wrapper::before {
    content: "";
    position: absolute;
    top: -18px; /* distance above the card */
    left: 50%;
    width: 0;
    height: 18px;
    border-left: 1px solid #d1d5db;
}

/* do NOT draw the line above the very top root node */
.org-tree > li > .org-node-wrapper::before {
    border: none;
}

/* vertical line from parent card DOWN to child row, for all levels */
.org-tree li.org-has-children > .org-node-wrapper::after {
    content: "";
    position: absolute;
    top: 100%; /* start at bottom of the card */
    left: 50%;
    width: 0;
    height: 24px; /* tweak to match your row spacing */
    border-left: 1px solid #d1d5db;
}


/* Node card */
.org-node {
    display: inline-block;
    min-width: 160px;
    max-width: 220px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.org-node-header {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    margin-bottom: 2px;
}

.org-node-title {
    font-size: 11px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
    /* allow wrapping */
    white-space: normal;
    word-break: break-word; /* break long words/codes if needed */
    /* show up to 2 lines, then clip */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* change to 3 if you want 3 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.org-node-sub {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #4b5563;
}

.org-node-type-Asset .org-node {
    border-color: #60a5fa;
    background: #eff6ff;
}

.org-node-type-Entity .org-node {
    border-color: #34d399;
    background: #ecfdf5;
}

.org-node-type-Investor .org-node {
    border-color: #fbbf24;
    background: #fffbeb;
}

.invdetail-perf-history-toolbar {
    margin-top: 12px;
    margin-bottom: 6px;
    font-size: 12px;
}

.invdetail-perf-charts {
    margin-top: 16px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 12px; /* left/right padding */
    box-sizing: border-box;
    position: relative;
}

/* each chart “card” */
.invdetail-perf-chart {
    width: 100%;
    overflow: hidden; /* prevents horizontal scroll */
    position: relative; /* lets the expand button anchor */
}

    /* ASP.NET Chart renders as <img> */
    .invdetail-perf-chart img {
        width: 100%; /* key */
        max-width: 100%;
        height: auto;
        display: block;
    }

/* Perf: "Show next 12 months" link */
.invdetail-perf-more-row .linkbutton {
    display: inline-block !important;
    width: auto !important;
    white-space: nowrap;
}

.invdetail-perf-more-row .linkbutton,
.invdetail-perf-more-row .linkbutton:visited {
    color: var(--muted); /* match caption tone */
    background: transparent !important;
    border: 0;
    padding: 0;
    display: inline-block;
    text-decoration: none;
    /* make it feel like the caption */
    font-size: 12px;
    font-weight: 500;
}

    .invdetail-perf-more-row .linkbutton:hover,
    .invdetail-perf-more-row .linkbutton:focus {
        color: #374151; /* slightly darker muted */
        background: transparent !important;
        text-decoration: underline;
        outline: none;
    }

.invdetail-perf-chart .perf-chart-inner {
    width: 100%;
    overflow: hidden; /* kills horizontal scroll */
    text-align: center; /* centers the rendered <img> if needed */
}

.invdetail-perf-caption {
    margin-top: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: static; /* important: not absolute/fixed */
}

.invdetail-perf-more-row {
    margin: 6px 0 12px;
    display: flex;
    flex-direction: row; /* puts link under caption */
    gap: 12px;
    align-items: center;
    flex-wrap: nowrap;
    clear: both; /* safety */
    position: relative; /* required for z-index */
    z-index: 2; /* safety */
}

.table.perf-history {
    margin-bottom: 0;
}

#lblInvPerfHistoryCaption,
.invdetail-perf-history-caption {
    display: block;
    margin: 6px 0 8px;
}

