/* Statement of Operations — financial statement styling for P&L card */

/* ── Header ── */
.stmt-header {
    padding: 24px 24px 16px;
}

.stmt-title {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin: 0;
}

.stmt-subtitle {
    display: block;
    font-size: 0.8125rem;
    color: var(--muted);
    margin-top: 2px;
}

/* Hide the old pnl-header when statement header is present */
.pnl-card:has(.stmt-header) .pnl-header,
.pnl-card:has(.stmt-header) .pnl-header + .pnl-divider {
    display: none;
}

/* ── Card overrides ── */
.pnl-card:has(.stmt-header) {
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.pnl-card:has(.stmt-header) .pnl-body-top {
    padding: 0 24px;
}

.pnl-card:has(.stmt-header) .pnl-body-bottom {
    padding: 0 24px 24px;
}

/* ── Section labels (DEBT SERVICE, etc.) ── */
.stmt-section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 0 6px;
}

/* ── Expandable section headers ── */
.pnl-card:has(.stmt-header) .pnl-section-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fg);
    text-transform: none;
    padding: 10px 0;
}

.pnl-card:has(.stmt-header) .pnl-expand-icon {
    width: 12px;
    height: 12px;
    color: var(--muted);
    transition: transform 0.2s ease;
}

.pnl-card:has(.stmt-header) .pnl-section-expandable.expanded .pnl-expand-icon {
    transform: rotate(90deg);
}

.pnl-card:has(.stmt-header) .pnl-section-total {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fg);
}

/* Don't hide total when expanded in statement mode */
.pnl-card:has(.stmt-header) .pnl-section-expandable.expanded .pnl-section-total {
    opacity: 0.4;
}

/* ── Statement rows (always visible, outside collapsible) ── */
.stmt-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 10px 18px;
    border-bottom: 1px solid var(--border);
}

.stmt-row-tinted {
    background: #f8fafc;
}

.stmt-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--fg);
}

.stmt-indent {
    padding-left: 16px;
}

.stmt-value {
    font-size: 0.8125rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--fg);
}

.stmt-value-positive {
    color: #15803d;
}

/* ── Subtotals ── */
.stmt-subtotal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 10px 18px;
    border-top: 1px solid var(--fg);
}

.stmt-subtotal .stmt-label {
    font-weight: 700;
}

.stmt-subtotal .stmt-value {
    font-weight: 700;
}

/* ── NOI highlight ── */
.stmt-noi {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px 12px 18px;
    background: #f0fdf4;
    border-top: 3px double #15803d;
    border-bottom: 3px double #15803d;
}

.stmt-noi .stmt-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: #15803d;
}

.stmt-noi .stmt-value {
    font-size: 1rem;
    font-weight: 700;
    color: #15803d;
}

/* ── Cash Flow Before Tax ── */
.stmt-cashflow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 14px 18px;
    background: var(--fg);
    border-radius: 6px;
}

.stmt-cashflow .stmt-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--bg);
}

.stmt-cashflow .stmt-value {
    font-size: 1rem;
    font-weight: 700;
    color: #22c55e;
}

/* ── Cash Flow After Tax ── */
.stmt-highlight {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px 12px 18px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
}

.stmt-highlight .stmt-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: #1e40af;
}

.stmt-highlight .stmt-value {
    font-size: 1rem;
    font-weight: 700;
    color: #1d4ed8;
}

/* ── Spacers ── */
.stmt-spacer {
    height: 12px;
}

.stmt-spacer-lg {
    height: 20px;
}

/* ── Row styling inside collapsible sections ── */
.pnl-card:has(.stmt-header) .pnl-row {
    border-bottom: 1px solid var(--border);
    padding: 8px 0 8px 12px;
}

.pnl-card:has(.stmt-header) .pnl-row-label {
    font-size: 0.8125rem;
    color: var(--fg);
}

.pnl-card:has(.stmt-header) .pnl-row-value {
    font-size: 0.8125rem;
    color: var(--fg);
}

/* Remove red coloring — use parentheses instead */
.pnl-card:has(.stmt-header) .pnl-row-value.negative {
    color: var(--fg);
}

/* Tinted rows inside collapsible */
.pnl-card:has(.stmt-header) .pnl-row.stmt-row-tinted {
    background: #f8fafc;
}

/* ── Financing box ── */
.pnl-card:has(.stmt-header) .pnl-financing-box {
    margin: 4px 0 8px;
    border-radius: 6px;
}

/* ── Collapsible section transition ── */
.pnl-card:has(.stmt-header) .pnl-section-collapsible {
    border-left: 2px solid var(--border);
    margin-left: 6px;
    padding-left: 8px;
}

.pnl-card:has(.stmt-header) .pnl-section-expandable.expanded + .pnl-section-collapsible {
    margin-bottom: 4px;
}

/* ── Metrics ── */
.pnl-card:has(.stmt-header) .pnl-metrics {
    padding: 0 0 4px;
}


/* ── Multi-Year Projection Table ── */
.projection-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
}

.projection-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.projection-table th {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 10px;
    text-align: right;
    border-bottom: 2px solid var(--fg);
}

.projection-table th:first-child {
    text-align: left;
}

.projection-label-col {
    min-width: 110px;
}

.projection-table td {
    padding: 7px 10px;
    text-align: right;
    color: var(--fg);
    font-weight: 400;
    border-bottom: 1px solid var(--border);
}

.projection-label {
    text-align: left !important;
    font-weight: 500;
    color: var(--fg);
}

.projection-row-tinted {
    background: #f8fafc;
}

.projection-row-bold td {
    font-weight: 600;
}

.projection-row-highlight {
    border-top: 1px solid var(--fg);
    border-bottom: 1px solid var(--fg);
}

.projection-row-highlight td {
    font-weight: 600;
    border-bottom: none;
}

.projection-positive {
    color: #15803d;
}

.projection-negative {
    color: #dc2626;
}
