:root {
    font-family: Barlow, Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
    --hf-radius: 14px;
    --hf-shadow: 0 10px 28px rgba(20, 50, 55, 0.08);
}

body { margin: 0; }

.cfo-numeric-table,
.cfo-card-value,
.cfo-property-facts dd,
.cfo-fact-list dd,
.cfo-status-grid dd {
    font-family: Inter, Barlow, "Segoe UI", system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
}

.cfo-alert {
    align-items: flex-start;
    border: 1px solid;
    border-radius: 12px;
    display: flex;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
}

.cfo-alert strong { flex: 0 0 auto; }
.cfo-alert-warning { background: var(--portal-warning-surface); border-color: color-mix(in srgb, var(--portal-warning) 45%, transparent); color: var(--portal-warning-strong); }
.cfo-alert-info { background: var(--portal-alert-info-surface); border-color: var(--portal-alert-info-border); color: var(--portal-alert-info-text); }
.cfo-alert-success { background: var(--portal-alert-success-surface); border-color: var(--portal-alert-success-border); color: var(--portal-alert-success-text); }
.cfo-alert-danger { background: var(--portal-alert-danger-surface); border-color: var(--portal-alert-danger-border); color: var(--portal-alert-danger-text); }

.cfo-two-column,
.cfo-card-grid,
.cfo-action-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 1rem;
}

.cfo-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cfo-investment-grid { grid-template-columns: repeat(3, minmax(220px, 1fr)); }
.cfo-action-grid { grid-template-columns: 1fr; }
.cfo-two-column.compact { margin-top: 0; }

.cfo-panel,
.cfo-property-card,
.cfo-small-card,
.cfo-action-card,
.cfo-state-panel {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: var(--hf-radius);
    box-shadow: var(--hf-shadow);
    padding: 1.1rem;
}

.cfo-panel-wide { margin-top: 1rem; }
.cfo-panel-heading,
.cfo-card-heading {
    align-items: flex-start;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.cfo-panel-heading h2,
.cfo-card-heading h2,
.cfo-property-card h2,
.cfo-small-card h2,
.cfo-action-card h2,
.cfo-state-panel h2 {
    color: var(--portal-ink);
    font-size: 1.05rem;
    line-height: 1.25;
    margin: 0;
}

.cfo-kicker,
.cfo-state-kicker {
    color: var(--brand-primary);
    display: block;
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 0.22rem;
}

.cfo-panel-lead,
.cfo-muted,
.cfo-footnote,
.cfo-small-card p,
.cfo-action-card p,
.cfo-state-panel p {
    color: var(--portal-muted);
    line-height: 1.5;
}

.cfo-footnote { font-size: 0.84rem; margin-bottom: 0; }
.cfo-count {
    background: var(--portal-soft-surface);
    border-radius: 999px;
    color: var(--portal-ink);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.6rem;
}

.cfo-status {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 650;
    line-height: 1;
    padding: 0.35rem 0.55rem;
    white-space: nowrap;
}

.status-confirmed { background: var(--portal-status-ready-bg); color: var(--portal-status-ready-text); }
.status-partial,
.status-historical { background: var(--portal-status-pending-bg); color: var(--portal-status-pending-text); }
.status-missing,
.status-discrepant { background: var(--portal-alert-danger-surface); color: var(--portal-alert-danger-text); }
.status-notcalculable { background: var(--portal-status-planned-bg); color: var(--portal-status-planned-text); }

.cfo-fact-list,
.cfo-property-facts,
.cfo-mini-facts,
.cfo-status-grid {
    display: grid;
    gap: 0;
    margin: 0.75rem 0 1rem;
}

.cfo-fact-list div,
.cfo-mini-facts div,
.cfo-status-grid div {
    align-items: baseline;
    border-bottom: 1px solid var(--portal-border);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 0.55rem 0;
}

.cfo-fact-list dt,
.cfo-property-facts dt,
.cfo-mini-facts dt,
.cfo-status-grid dt { color: var(--portal-muted); font-size: 0.8rem; }
.cfo-fact-list dd,
.cfo-property-facts dd,
.cfo-mini-facts dd,
.cfo-status-grid dd { color: var(--portal-ink); font-weight: 600; margin: 0; text-align: right; }

.cfo-action-preview,
.cfo-check-list,
.cfo-source-list { margin: 0.75rem 0 1rem; padding: 0; }
.cfo-action-preview { list-style: none; }
.cfo-action-preview li { align-items: flex-start; display: flex; gap: 0.75rem; padding: 0.55rem 0; }
.cfo-action-preview li > span,
.cfo-rank {
    align-items: center;
    background: var(--portal-soft-surface);
    border-radius: 50%;
    color: var(--brand-primary);
    display: inline-flex;
    flex: 0 0 1.8rem;
    font-family: Inter, sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
    height: 1.8rem;
    justify-content: center;
}
.cfo-action-preview strong,
.cfo-action-preview small { display: block; }
.cfo-action-preview small { color: var(--portal-muted); line-height: 1.35; margin-top: 0.15rem; }

.cfo-text-link { color: var(--brand-primary); font-weight: 650; text-decoration: none; }
.cfo-text-link:hover { color: var(--brand-primary-hover); text-decoration: underline; }

.cfo-property-strip { display: grid; gap: 0.75rem; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0.9rem 0; }
.cfo-property-strip article { background: var(--portal-card-soft); border: 1px solid var(--portal-border); border-radius: 10px; padding: 0.85rem; }
.cfo-property-strip article > strong,
.cfo-property-strip article > span { display: block; }
.cfo-property-strip article > span { color: var(--portal-muted); font-size: 0.78rem; margin-top: 0.2rem; }
.cfo-property-strip dl { margin: 0.75rem 0 0; }
.cfo-property-strip dl div { display: flex; justify-content: space-between; padding: 0.25rem 0; }
.cfo-property-strip dt { color: var(--portal-muted); font-size: 0.74rem; }
.cfo-property-strip dd { font-family: Inter, sans-serif; font-size: 0.78rem; font-weight: 600; margin: 0; }

.cfo-explainer { border-left: 3px solid; border-radius: 8px; padding: 0.85rem; }
.cfo-explainer.status-partial { background: var(--portal-status-pending-bg); border-color: var(--portal-status-pending-text); }
.cfo-explainer.status-missing { background: var(--portal-alert-danger-surface); border-color: var(--portal-alert-danger-text); }
.cfo-explainer p { line-height: 1.45; margin-bottom: 0; }

.cfo-table-wrap { overflow-x: auto; width: 100%; }
.cfo-table { border-collapse: collapse; min-width: 760px; width: 100%; }
.cfo-table th,
.cfo-table td { border-bottom: 1px solid var(--portal-border); padding: 0.72rem 0.65rem; text-align: left; vertical-align: top; }
.cfo-table thead th { color: var(--portal-muted); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.cfo-table tbody th { color: var(--portal-ink); font-weight: 600; }
.cfo-numeric-table td:not(.cfo-note-cell) { white-space: nowrap; }
.cfo-note-cell { color: var(--portal-muted); min-width: 220px; }

.cfo-property-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cfo-property-facts div { border-bottom: 1px solid var(--portal-border); padding: 0.65rem 0; }
.cfo-property-facts dd { margin-top: 0.2rem; text-align: left; }
.cfo-missing-block { background: var(--portal-warning-surface); border-radius: 10px; color: var(--portal-warning-strong); padding: 0.8rem; }
.cfo-missing-block p { line-height: 1.4; margin: 0.25rem 0 0; }

.cfo-small-card { min-height: 180px; }
.cfo-card-value { color: var(--portal-ink); display: block; font-size: 1.6rem; margin: 0.75rem 0; }
.cfo-list-card { align-items: center; border-bottom: 1px solid var(--portal-border); display: flex; gap: 1rem; justify-content: space-between; padding: 0.8rem 0; }
.cfo-list-card span { color: var(--portal-muted); display: block; font-size: 0.8rem; }

.cfo-check-list { list-style: none; }
.cfo-check-list li { color: var(--portal-ink); line-height: 1.4; padding: 0.45rem 0 0.45rem 1.35rem; position: relative; }
.cfo-check-list li::before { color: var(--brand-accent); content: "•"; font-size: 1.35rem; left: 0.3rem; position: absolute; top: 0.25rem; }

.cfo-tax-gate {
    align-items: stretch;
    background: linear-gradient(135deg, var(--portal-topbar), color-mix(in srgb, var(--portal-topbar) 72%, var(--brand-primary)));
    border-radius: var(--hf-radius);
    color: var(--portal-on-topbar);
    display: grid;
    gap: 2rem;
    grid-template-columns: 1.35fr 1fr;
    padding: 1.25rem;
}
.cfo-tax-gate > div > strong { color: var(--brand-accent); display: block; font-family: Inter, sans-serif; font-size: 2rem; margin-top: 0.25rem; }
.cfo-tax-gate p { color: var(--portal-topbar-muted); line-height: 1.45; }
.cfo-tax-gate dl { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; }
.cfo-tax-gate dl div { border-left: 1px solid var(--portal-topbar-border); padding: 0.5rem 0.8rem; }
.cfo-tax-gate dt { color: var(--portal-topbar-muted); font-size: 0.72rem; }
.cfo-tax-gate dd { font-family: Inter, sans-serif; font-size: 1.05rem; font-weight: 650; margin: 0.35rem 0 0; }

.cfo-source-list { list-style: none; }
.cfo-source-list li { align-items: flex-start; border-bottom: 1px solid var(--portal-border); display: flex; gap: 0.75rem; justify-content: space-between; padding: 0.7rem 0; }
.cfo-source-list span { color: var(--portal-muted); display: block; font-size: 0.8rem; margin-top: 0.1rem; }
.cfo-source-list code,
.cfo-status-grid code { color: var(--brand-primary); font-size: 0.72rem; overflow-wrap: anywhere; }

.cfo-document-panel { margin-top: 1rem; }
.cfo-upload-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cfo-upload-grid label { color: var(--portal-muted); display: grid; font-size: 0.75rem; gap: 0.3rem; }
.cfo-upload-grid input {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    color: var(--portal-ink);
    min-height: 40px;
    padding: 0.5rem 0.65rem;
}
.cfo-upload-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1rem 0; }
.cfo-document-table { min-width: 820px; }
.cfo-document-link { color: var(--brand-primary); font-weight: 650; }

.cfo-action-card { display: grid; gap: 0.9rem; grid-template-columns: auto 1fr; }
.cfo-action-card > div > strong { color: var(--brand-primary); display: block; margin: 0.65rem 0; }
.cfo-action-card .cfo-mini-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cfo-action-card .cfo-mini-facts div { display: block; }
.cfo-action-card .cfo-mini-facts dd { margin-top: 0.15rem; text-align: left; }

.cfo-discrepancy-list article { border-bottom: 1px solid var(--portal-border); padding: 0.8rem 0; }
.cfo-discrepancy-list article > div { align-items: center; display: flex; gap: 1rem; justify-content: space-between; }
.cfo-discrepancy-list p { line-height: 1.45; }
.cfo-discrepancy-list small { color: var(--portal-muted); }

.cfo-state-panel { margin-top: 1rem; }
.cfo-state-warning { border-color: color-mix(in srgb, var(--portal-warning) 40%, var(--portal-border)); }
.cfo-button {
    background: var(--brand-primary);
    border: 0;
    border-radius: 8px;
    color: var(--portal-on-primary);
    cursor: pointer;
    font: inherit;
    font-weight: 650;
    min-height: 40px;
    padding: 0.55rem 0.9rem;
}
.cfo-button:hover { background: var(--brand-primary-hover); }

.hf-auth-shell .portal-public-brand-copy { max-width: 34rem; }
.google-sign-in-button { align-items: center; display: inline-flex; gap: 0.65rem; justify-content: center; }
.google-sign-in-button img { height: 18px; width: 18px; }
.login-privacy-note { color: var(--portal-muted); font-size: 0.78rem; line-height: 1.45; margin: 0; }

@media (max-width: 1080px) {
    .cfo-card-grid,
    .cfo-investment-grid,
    .cfo-property-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cfo-tax-gate { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .cfo-two-column,
    .cfo-card-grid,
    .cfo-investment-grid,
    .cfo-property-strip { grid-template-columns: 1fr; }
    .cfo-alert { display: block; }
    .cfo-alert strong { display: block; margin-bottom: 0.25rem; }
    .cfo-property-facts { grid-template-columns: 1fr; }
    .cfo-tax-gate dl { grid-template-columns: 1fr; }
    .cfo-tax-gate dl div { border-left: 0; border-top: 1px solid var(--portal-topbar-border); }
    .cfo-action-card .cfo-mini-facts { grid-template-columns: 1fr; }
    .cfo-upload-grid { grid-template-columns: 1fr; }
}
