/* KPI card component — .ptf-kpi-card stat tiles + the hero total it can host.
 * Layout: label pinned top-right, value/hero centered in the space below.
 * Value colour: NEUTRAL by default; opt into --pos / --neg / --warn to colour by
 * the value's sign/threshold (some KPIs are semantic, others always neutral).
 * Reusable across portfolio pages (client_detail, portfolio_detail). Loaded
 * globally via base.html. Tenant-aware: --do-* / --contract-* tokens only.
 */

.ptf-kpi-card {
    background: var(--do-card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 0.875rem 1.25rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;              /* clip the header bar to the rounded corners */
}

/* Label = a small uppercase muted tag pinned to the top-right of the tile (no
   header bar). Single global style — both client_detail and portfolio_detail. */
.ptf-kpi-label {
    align-self: flex-end;
    margin-bottom: 0.85rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--do-text-muted);
    text-align: right;
}

.ptf-kpi-value {
    align-self: center;            /* centered in the free space below the label */
    margin-top: auto;
    margin-bottom: auto;
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    color: var(--do-text);         /* NEUTRAL by default */
}

/* Semantic value colours — opt-in, chosen by the value (sign/threshold).
   Omit all three for a neutral metric (e.g. VaR, Drawdown, Volatilità). */
.ptf-kpi-value--pos  { color: var(--contract-success-color); }   /* green */
.ptf-kpi-value--warn { color: var(--contract-warning-color); }   /* amber */
.ptf-kpi-value--neg  { color: var(--bs-danger, #dc3545); }       /* red   */

/* Dominant total-value card — darker header bar + big value body. Shared by
   client_detail and portfolio_detail (moved here from client-details.css). */
.ptf-total-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.ptf-total-label {
    background: var(--do-progress-track-bg);
    border-bottom: 1px solid var(--contract-gray-200);
    padding: 0.65rem 1.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--do-text-muted);
}

.ptf-total-value {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    line-height: 1;
    padding: 1.5rem;
}

.ptf-total-currency {
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--do-text-muted);
}

.ptf-total-amount {
    font-size: 3.25rem;
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--do-text);
}

/* ── Card/chart header titles — shared by portfolio_detail and client_detail
   (moved here from pages/portfolio-detail.css when client_detail adopted the
   same card-title style). ── */
.ptf-chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.ptf-chart-head__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--do-text);
}

.ptf-chart-head__subtitle {
    display: block;
    margin-top: .1rem;
    font-size: .8rem;
    color: var(--do-text-muted);
}
