/* ============================================================================
   portfolio-v2.css — gold-header dashboard restyle for the investor Portfolio
   page's Active and Realized tabs (KPI cards, section headers, 2-across deal
   cards, paging). Scoped under .portfolio-v2 so the Archived tab, Drafts,
   modals, and the onboarding gate are untouched.
   Palette matches Dashboard / Deal Flow / Matches.
   ========================================================================== */

/* ── KPI cards ─────────────────────────────────────────────────────────── */
.portfolio-v2 .pv-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
    gap: 12px;
    margin: 8px 0 22px;
}
.portfolio-v2 .pv-kpi {
    position: relative;
    border: 1px solid #1f2740;
    border-radius: 14px;
    background: #151b2b;
    padding: 16px 18px 18px;
    overflow: hidden;
}
.portfolio-v2 .pv-kpi::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--pv-accent, #5b8def);
}
.portfolio-v2 .pv-kpi-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
    border-radius: 9px; font-size: 16px; font-weight: 800; margin-bottom: 12px;
}
.portfolio-v2 .pv-kpi-label {
    font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: #7d879e;
}
.portfolio-v2 .pv-kpi-value {
    margin-top: 6px; font-family: 'JetBrains Mono', monospace; font-size: 23px; font-weight: 800; color: #fff;
    line-height: 1.1; letter-spacing: -0.02em; overflow-wrap: anywhere;
}
.portfolio-v2 .pv-kpi-sub { margin-top: 8px; font-size: 12px; color: #8b93a8; }

/* ── Gold section header ───────────────────────────────────────────────── */
.portfolio-v2 .pv-section-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 14px 20px; border-radius: 12px; margin-bottom: 14px;
    background: linear-gradient(135deg, #ecc97c, #d4a64a);
}
/* Gold-framed section: the gold header's border continues around the cards and pager beneath it and closes
   at the bottom (same treatment as Deal Flow's .df2-section "Pipeline Snapshot"). Deliberately no
   overflow:hidden — the "N slots available" tooltip (.pv-slots-tip) drops out of the header over the body
   and must not be clipped — so the header rounds its own top corners to the frame's inner radius
   (14px outer - 1px border) and keeps square bottom corners. */
.portfolio-v2 .pv-section {
    border: 1px solid #d9a53f;
    border-radius: 14px;
    background: #111727;
    margin-bottom: 22px;
}
.portfolio-v2 .pv-section > .pv-section-head { margin-bottom: 0; border-radius: 13px 13px 0 0; }
.portfolio-v2 .pv-section-body { padding: 16px; }
.portfolio-v2 .pv-section-body > :last-child { margin-bottom: 0; }
@media (max-width: 480px) {
    .portfolio-v2 .pv-section > .pv-section-head { padding: 12px 14px; }
    .portfolio-v2 .pv-section-body { padding: 12px; }
}
.portfolio-v2 .pv-section-title { font-family: 'Outfit', sans-serif; font-size: 18px; font-weight: 700; color: #241a04; }
.portfolio-v2 .pv-head-pill {
    font-size: 12px; font-weight: 800; letter-spacing: .03em; padding: 5px 12px; border-radius: 999px;
    background: #241a04; color: #f0cd7e;
}

/* Outside-investment slots beside the position count, with an explanation on hover and keyboard focus. */
.portfolio-v2 .pv-head-pills { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.portfolio-v2 .pv-slots { position: relative; display: inline-flex; border-radius: 999px; cursor: help; outline: none; }
.portfolio-v2 .pv-slots:focus-visible { box-shadow: 0 0 0 2px #241a04, 0 0 0 4px #f0cd7e; }
.portfolio-v2 .pv-head-pill--slots { background: #064e3b; color: #a7f3d0; }
.portfolio-v2 .pv-head-pill--slots.is-full { background: #5b1d1d; color: #fecaca; }
.portfolio-v2 .pv-slots-tip {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: min(300px, 80vw);
    padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(240,205,126,0.45);
    background: #101a33; color: #e0e6f5; font-size: 12.5px; font-weight: 500; line-height: 1.5; letter-spacing: 0;
    text-transform: none; box-shadow: 0 12px 28px rgba(0,0,0,0.45);
    opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.portfolio-v2 .pv-slots:hover .pv-slots-tip,
.portfolio-v2 .pv-slots:focus .pv-slots-tip,
.portfolio-v2 .pv-slots:focus-within .pv-slots-tip { opacity: 1; visibility: visible; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .portfolio-v2 .pv-slots-tip { transition: none; transform: none; } }
@media (max-width: 480px) { .portfolio-v2 .pv-slots-tip { right: auto; left: 0; } }

/* ── Deal card grid: 2-across desktop, 1 on mobile ─────────────────────── */
.portfolio-v2 .pv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
@media (max-width: 768px) {
    .portfolio-v2 .pv-grid { grid-template-columns: 1fr; }
}

/* Restyle the existing deal card into a self-contained card (was a full-width row). Column layout with a
   consistent bottom footer (invested amount + actions) so both cards align regardless of content length —
   the content block grows to push the footer to the bottom, keeping footers level across a row. */
.portfolio-v2 .pv-grid .pf-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border: 1px solid #262f45;
    border-radius: 16px;
    background: linear-gradient(160deg, #161d31, #0f1424 60%);
    padding: 18px 18px 16px;
    overflow: hidden;
    cursor: pointer;
}
.portfolio-v2 .pv-grid .pf-card::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: #5b8def;
}
.portfolio-v2 .pv-grid .pf-card:hover { border-color: #33405e; }
.portfolio-v2 .pv-grid .pf-card > div:first-child { flex: 1 1 auto; min-width: 0; }
.portfolio-v2 .pv-grid .pf-right {
    flex: 0 0 auto;
    text-align: left;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #1f2740;
}
.portfolio-v2 .pv-grid .pf-right .pf-actions { margin-top: 12px; justify-content: flex-start; }

/* ── Pager ─────────────────────────────────────────────────────────────── */
.portfolio-v2 .pv-pager {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    margin: 18px 0 6px; justify-content: center;
}
.portfolio-v2 .pv-page-btn {
    min-width: 34px; height: 34px; padding: 0 10px; border-radius: 8px; cursor: pointer;
    border: 1px solid #262f45; background: #131a2c; color: #aab3c8; font: inherit; font-weight: 700;
    font-family: 'JetBrains Mono', monospace; font-size: 13px;
}
.portfolio-v2 .pv-page-btn:hover:not(:disabled) { border-color: #33405e; color: #fff; }
.portfolio-v2 .pv-page-btn.on { border-color: #5b8def; background: #1a2644; color: #fff; }
.portfolio-v2 .pv-page-btn:disabled { opacity: .4; cursor: default; }
.portfolio-v2 .pv-page-info { margin-left: 8px; font-size: 12.5px; color: #7d879e; }

/* ── Tabs as buttons (Active / Realized / Archived) ────────────────────── */
.portfolio-v2 .pf-tabs {
    border-bottom: 0;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.portfolio-v2 .pf-tab {
    border: 1px solid #33405e;
    border-bottom: 1px solid #33405e;   /* override the underline-tab base */
    border-radius: 10px;
    background: #131a2c;
    color: #c4ccdc;
    font-size: 15px;
    font-weight: 700;
    padding: 11px 24px;
    line-height: 1;
    transition: background .12s, border-color .12s, color .12s;
}
.portfolio-v2 .pf-tab:hover { background: #1a2238; border-color: #4a5b80; color: #fff; }
.portfolio-v2 .pf-tab.active {
    background: linear-gradient(135deg, #5b8def, #3f6fe0);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 16px -8px rgba(91, 141, 239, .7);
}
.portfolio-v2 .pf-tab:focus-visible { outline: 2px solid #8fb2ff; outline-offset: 2px; }

/* ── Drafts (Active tab): blue actions, red Archive (the gold frame comes from .pv-section) ── */
/* Open / Edit / Mark ready → blue; Archive (danger) → red background. Scoped to the Active drafts only. */
.portfolio-v2 .pf-drafts--v2 .pf-draft-actions .pf-mini-btn,
.portfolio-v2 .pf-drafts--v2 .pf-draft-actions .pf-add-btn {
    border: 1px solid transparent;
    background: linear-gradient(135deg, #5b8def, #3f6fe0);
    color: #fff;
    font-weight: 700;
}
.portfolio-v2 .pf-drafts--v2 .pf-draft-actions .pf-mini-btn:hover:not(:disabled),
.portfolio-v2 .pf-drafts--v2 .pf-draft-actions .pf-add-btn:hover:not(:disabled) { filter: brightness(1.08); }
.portfolio-v2 .pf-drafts--v2 .pf-draft-actions .pf-mini-btn.danger {
    background: linear-gradient(135deg, #ef5b5b, #d63f3f);
    color: #fff;
}
@media (max-width: 480px) { .portfolio-v2 .pv-page-info { width: 100%; margin: 4px 0 0; text-align: center; } }
