/* ════════════════════════════════════════════════════════════════
   PLATFORM CFO — Financial Overview Module
   Scoped to the pcfo-* namespace (no conflicts with cfo-logic.js)
   Dark mode = default; light mode gated by html[data-brightness="light"]
   ════════════════════════════════════════════════════════════════ */

/* ── Top bar ─────────────────────────────────────────────────── */
.pcfo-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 0 20px 0;
    flex-wrap: wrap;
}

.pcfo-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pcfo-icon {
    font-size: 2rem;
    color: var(--color-accent, #C8A951);
    opacity: 0.9;
}

.pcfo-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.2;
}

.pcfo-subtitle {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pcfo-topbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Stats row ─────────────────────────────────────────────────*/
.pcfo-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.pcfo-stat-icon {
    font-size: 1.3rem;
    color: var(--color-accent, #C8A951);
    margin-bottom: 4px;
    opacity: 0.8;
}

.pcfo-empty-stats {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}
.pcfo-empty-stats i {
    font-size: 1.4rem;
    flex-shrink: 0;
    color: var(--color-warning, #f5a623);
}

/* ── Cash timeline row ─────────────────────────────────────── */
.pcfo-cash-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.pcfo-cash-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 10px;
    border-radius: var(--radius-card, 12px);
    background: var(--color-bg-elevated, rgba(255,255,255,0.04));
    border: 1px solid var(--color-border, rgba(255,255,255,0.07));
    gap: 4px;
}

.pcfo-cash-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.pcfo-cash-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

/* ── Section header ─────────────────────────────────────────── */
.pcfo-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 8px 0;
    border-top: 1px solid var(--color-border, rgba(255,255,255,0.07));
    margin-bottom: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    gap: 8px;
}
.pcfo-section-header i {
    margin-right: 6px;
    opacity: 0.7;
}

/* ── Pipeline table ─────────────────────────────────────────── */
.pcfo-table-wrap {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: var(--radius-card, 12px);
}

.pcfo-table {
    width: 100%;
}

.pcfo-td-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.pcfo-td-date {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.pcfo-td-sub {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.pcfo-table-note {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    padding: 8px 4px 0;
}
.pcfo-table-note a {
    color: var(--color-accent, #C8A951);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Status pills ───────────────────────────────────────────── */
.pcfo-status-pill {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 2px 9px;
    border-radius: 999px;
    text-transform: uppercase;
}
.pcfo-pill--won      { background: rgba(52,199,89,0.15);  color: #34c759; }
.pcfo-pill--active   { background: rgba(0,122,255,0.13);  color: #4a9eff; }
.pcfo-pill--lead     { background: rgba(255,196,0,0.15);  color: #ffc400; }
.pcfo-pill--quote    { background: rgba(255,149,0,0.15);  color: #ff9500; }
.pcfo-pill--pending  { background: rgba(142,142,147,0.15); color: #8e8e93; }
.pcfo-pill--lost     { background: rgba(255,59,48,0.13);  color: #ff3b30; }
.pcfo-pill--invoice  { background: rgba(52,199,89,0.10);  color: #34c759; }

/* ── Loading / empty states ─────────────────────────────────── */
.pcfo-loading {
    color: var(--color-text-muted);
    padding: 28px 16px;
    text-align: center;
    font-size: 0.9rem;
}

.pcfo-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 20px;
    text-align: center;
    color: var(--color-text-muted);
}
.pcfo-empty i { font-size: 2.5rem; opacity: 0.4; }
.pcfo-empty p { max-width: 340px; font-size: 0.88rem; line-height: 1.5; }
.pcfo-empty p strong { color: var(--color-accent, #C8A951); }

/* ── Footer ─────────────────────────────────────────────────── */
.pcfo-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-top: 1px solid var(--color-border, rgba(255,255,255,0.07));
    border-radius: 0 0 var(--radius-card, 12px) var(--radius-card, 12px);
    background: var(--color-bg-elevated, rgba(255,255,255,0.03));
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    flex-wrap: wrap;
    margin-top: 4px;
}
.pcfo-footer strong { color: var(--color-text-secondary); }


/* ════════════════════════════════════════════════════════════════
   SOG WORKSPACE OVERRIDES — Dark (default)
   ════════════════════════════════════════════════════════════════ */
body.theme-sog .pcfo-topbar {
    border-bottom: 1px solid rgba(200,169,81,0.15);
    padding-bottom: 18px;
    margin-bottom: 4px;
}

body.theme-sog .pcfo-icon {
    color: var(--sog-gold, #C8A951);
}

body.theme-sog .pcfo-title {
    font-family: var(--sog-font-heading, 'Rajdhani'), sans-serif;
    font-size: 1.35rem;
    letter-spacing: 0.02em;
    color: var(--sog-light, #EBE8D0);
}

body.theme-sog .pcfo-subtitle {
    color: var(--sog-tan, #C4B590);
    font-family: var(--sog-font-body, 'Barlow'), sans-serif;
}

body.theme-sog .pcfo-stat-icon {
    color: var(--sog-gold, #C8A951);
}

body.theme-sog .pcfo-cash-card {
    background: rgba(43,63,110,0.18);
    border: 1px solid rgba(200,169,81,0.12);
    border-radius: var(--sog-radius-card, 16px);
}

body.theme-sog .pcfo-cash-label {
    color: var(--sog-tan, #C4B590);
    font-family: var(--sog-font-body, 'Barlow'), sans-serif;
}

body.theme-sog .pcfo-cash-value {
    color: var(--sog-light, #EBE8D0);
    font-family: var(--sog-font-heading, 'Rajdhani'), sans-serif;
    font-size: 1.1rem;
}

body.theme-sog .pcfo-section-header {
    color: var(--sog-tan, #C4B590);
    border-top-color: rgba(200,169,81,0.15);
    font-family: var(--sog-font-body, 'Barlow'), sans-serif;
}

body.theme-sog .pcfo-status-pill {
    font-family: var(--sog-font-body, 'Barlow'), sans-serif;
}

body.theme-sog .pcfo-td-date {
    color: var(--sog-tan, #C4B590);
}

body.theme-sog .pcfo-td-sub {
    color: var(--sog-tan, #C4B590);
}

body.theme-sog .pcfo-table-note {
    color: var(--sog-tan, #C4B590);
}
body.theme-sog .pcfo-table-note a {
    color: var(--sog-gold, #C8A951);
}

body.theme-sog .pcfo-footer {
    background: rgba(43,63,110,0.10);
    border-top-color: rgba(200,169,81,0.12);
    color: var(--sog-tan, #C4B590);
    font-family: var(--sog-font-body, 'Barlow'), sans-serif;
}
body.theme-sog .pcfo-footer strong { color: var(--sog-light, #EBE8D0); }

body.theme-sog .pcfo-empty i {
    color: var(--sog-gold, #C8A951);
}
body.theme-sog .pcfo-empty p strong {
    color: var(--sog-gold, #C8A951);
}

body.theme-sog .pcfo-empty-stats {
    color: var(--sog-tan, #C4B590);
}
body.theme-sog .pcfo-empty-stats i {
    color: var(--sog-gold, #C8A951);
}


/* ════════════════════════════════════════════════════════════════
   SOG WORKSPACE OVERRIDES — Light mode
   ════════════════════════════════════════════════════════════════ */
html[data-brightness="light"] body.theme-sog .pcfo-topbar {
    border-bottom-color: rgba(43,63,110,0.2);
}

html[data-brightness="light"] body.theme-sog .pcfo-title {
    color: var(--sog-navy, #2B3F6E);
}

html[data-brightness="light"] body.theme-sog .pcfo-subtitle {
    color: var(--sog-navy, #2B3F6E);
    opacity: 0.7;
}

html[data-brightness="light"] body.theme-sog .pcfo-cash-card {
    background: rgba(43,63,110,0.06);
    border-color: rgba(43,63,110,0.18);
}

html[data-brightness="light"] body.theme-sog .pcfo-cash-label {
    color: var(--sog-navy, #2B3F6E);
    opacity: 0.7;
}

html[data-brightness="light"] body.theme-sog .pcfo-cash-value {
    color: var(--sog-navy, #2B3F6E);
}

html[data-brightness="light"] body.theme-sog .pcfo-section-header {
    color: var(--sog-navy, #2B3F6E);
    border-top-color: rgba(43,63,110,0.2);
    opacity: 0.85;
}

html[data-brightness="light"] body.theme-sog .pcfo-td-date,
html[data-brightness="light"] body.theme-sog .pcfo-td-sub {
    color: var(--sog-navy, #2B3F6E);
    opacity: 0.6;
}

html[data-brightness="light"] body.theme-sog .pcfo-footer {
    background: rgba(43,63,110,0.04);
    border-top-color: rgba(43,63,110,0.15);
    color: var(--sog-navy, #2B3F6E);
    opacity: 0.8;
}
html[data-brightness="light"] body.theme-sog .pcfo-footer strong {
    color: var(--sog-navy, #2B3F6E);
    opacity: 1;
}

html[data-brightness="light"] body.theme-sog .pcfo-empty i {
    color: var(--sog-navy, #2B3F6E);
    opacity: 0.4;
}
html[data-brightness="light"] body.theme-sog .pcfo-empty p strong {
    color: var(--sog-navy, #2B3F6E);
}
