/* ============================================================================
   report.css — SIGNATURE REPORT DESIGN LANGUAGE
   ----------------------------------------------------------------------------
   One editorial, token-driven look for every printable / public-facing document
   (statements, receipts, offer letters, verification pages, financial reports).

   WHY THIS EXISTS
   Hand-rolled report headers had drifted into a generic, "AI-generated" look:
   centered logos, Bootstrap bg-primary banners, rainbow status chips, filled
   multicolor icons, equal-weight card grids. This file replaces that with a
   restrained, distinctive system whose personality comes from TYPOGRAPHY and
   LAYOUT, not decoration — and whose colour is driven entirely by tenant tokens,
   so every tenant's documents are simultaneously on-brand for them AND
   unmistakably one product family.

   SIGNATURE DEVICES (what makes a document recognisably "ours")
     1. Brand spine        — a vertical gradient bar down the masthead's edge.
     2. Eyebrow labels     — uppercase, letter-spaced, brand-coloured kickers.
     3. Editorial hero     — one large headline figure, left-aligned, not a card row.
     4. Hairline tables    — no zebra; a single accent rule; tabular figures.
     5. Monochrome icons   — Tabler line icons in muted ink; colour reserved for status.

   RULES
     - Colour ONLY through var(--token) — never a raw hex (build lint enforces this).
     - Reserve --theme-primary for the spine, eyebrows, section rules and the hero
       figure. Everything else is ink (--text-*) on --bg-surface. Restraint reads
       as "designed"; rainbow reads as "generated".
     - Every colour has a dark-mode answer via tokens; @media print maps to ink.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   1. MASTHEAD — brand spine + document identity
   --------------------------------------------------------------------------- */
.fsh-report-masthead {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 0.25rem 0 1.1rem 1.1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* The brand spine — the recognisable device. Re-tints per tenant automatically. */
.fsh-report-masthead::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0.75rem;
    left: 0;
    width: 4px;
    border-radius: 4px;
    background: linear-gradient(to bottom, var(--theme-primary) 0%, var(--theme-primary-emphasis) 100%);
}

.fsh-report-identity {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.fsh-report-logo {
    max-height: 56px;
    max-width: 168px;
    object-fit: contain;
}

.fsh-report-orgname {
    margin: 0;
    font-family: var(--font-heading, inherit);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--text-heading);
}

.fsh-report-orgmeta {
    margin: 0.15rem 0 0;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--text-muted);
}

/* Right column: document type + title + generated stamp */
.fsh-report-docmeta {
    text-align: right;
    flex-shrink: 0;
    padding-top: 0.15rem;
}

/* Eyebrow / kicker — the uppercase brand-coloured document type */
.fsh-report-eyebrow {
    display: inline-block;
    margin: 0 0 0.2rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--theme-primary);
}

.fsh-report-doctitle {
    margin: 0;
    font-family: var(--font-heading, inherit);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-heading);
}

.fsh-report-docsub {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.fsh-report-stamp {
    margin: 0.35rem 0 0;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ---------------------------------------------------------------------------
   2. EDITORIAL HERO — lead with ONE number, not a card row
   --------------------------------------------------------------------------- */
.fsh-report-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.4rem 2.5rem;
    margin: 0 0 1.6rem;
}

.fsh-report-hero-figure {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.fsh-report-hero-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.fsh-report-hero-value {
    font-family: var(--font-heading, inherit);
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--text-heading);
}

/* Optional semantic tint on the hero value (e.g. owing vs credit) */
.fsh-report-hero-value.is-positive { color: var(--theme-success-text); }
.fsh-report-hero-value.is-negative { color: var(--theme-danger-text); }
.fsh-report-hero-value.is-brand    { color: var(--theme-primary); }

.fsh-report-hero-caption {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ---------------------------------------------------------------------------
   3. SECTION HEADERS — eyebrow with a short accent underline
   --------------------------------------------------------------------------- */
.fsh-report-section {
    margin: 0 0 1.4rem;
}

.fsh-report-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.7rem;
    padding-bottom: 0.35rem;
    font-family: var(--font-heading, inherit);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-heading);
    border-bottom: 2px solid var(--theme-primary);
}

.fsh-report-section-title > i {
    font-size: 1rem;
    color: var(--text-muted);
}

/* ---------------------------------------------------------------------------
   4. KEY / VALUE META GRID (the "who/what/when" block under a title)
   --------------------------------------------------------------------------- */
.fsh-report-kv {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem 1.75rem;
    margin: 0 0 1.4rem;
}

.fsh-report-kv-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.fsh-report-kv-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.fsh-report-kv-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-word;
}

/* ---------------------------------------------------------------------------
   5. SIGNATURE TABLE — hairline rules, one accent header, tabular figures
   --------------------------------------------------------------------------- */
.fsh-report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.fsh-report-table thead th {
    padding: 0.5rem 0.65rem;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: transparent;
    border-bottom: 2px solid var(--theme-primary);
    white-space: nowrap;
}

.fsh-report-table tbody td {
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}

/* Group / subtotal rows: a sunken well, no rainbow */
.fsh-report-table tbody tr.is-group td,
.fsh-report-table tbody tr.is-subtotal td {
    background: var(--bg-surface-sunken);
    font-weight: 600;
}

.fsh-report-table tfoot td {
    padding: 0.6rem 0.65rem;
    border-top: 2px solid var(--border-strong);
    font-weight: 700;
    color: var(--text-heading);
}

/* Numeric cells — right-aligned, monospaced figures that line up */
.fsh-report-table .num,
.fsh-report-table td.num,
.fsh-report-table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fsh-report-table .muted { color: var(--text-muted); }
.fsh-report-table .mono  { font-family: var(--font-mono, ui-monospace, monospace); }

/* Zebra is deliberately OFF. A subtle hover only, screen-only. */
@media screen {
    .fsh-report-table tbody tr:hover td {
        background: var(--bg-hover);
    }
}

/* ---------------------------------------------------------------------------
   6. STATUS / CALLOUTS — semantic tokens only (never Bootstrap contextual)
   --------------------------------------------------------------------------- */
.fsh-report-callout {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
    margin: 0 0 1.2rem;
    border: 1px solid var(--border-color);
    border-left-width: 3px;
    border-radius: var(--radius-sm, 0.375rem);
    background: var(--bg-surface-sunken);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.fsh-report-callout > i { font-size: 1.05rem; line-height: 1.3; color: var(--text-muted); }

.fsh-report-callout.is-success { background: var(--theme-success-subtle); border-left-color: var(--theme-success); color: var(--theme-success-text); }
.fsh-report-callout.is-warning { background: var(--theme-warning-subtle); border-left-color: var(--theme-warning); color: var(--theme-warning-text); }
.fsh-report-callout.is-danger  { background: var(--theme-danger-subtle);  border-left-color: var(--theme-danger);  color: var(--theme-danger-text); }
.fsh-report-callout.is-info    { background: var(--theme-info-subtle);    border-left-color: var(--theme-info);    color: var(--theme-info-text); }
.fsh-report-callout.is-success > i { color: var(--theme-success); }
.fsh-report-callout.is-warning > i { color: var(--theme-warning); }
.fsh-report-callout.is-danger  > i { color: var(--theme-danger); }
.fsh-report-callout.is-info    > i { color: var(--theme-info); }

/* Monochrome inline report icon — colour reserved for status only */
.fsh-report-icon { color: var(--text-muted); }

/* ---------------------------------------------------------------------------
   7. FOOTER IDENTITY LINE
   --------------------------------------------------------------------------- */
.fsh-report-signoff {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-top: 2rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.fsh-report-signoff .brand { color: var(--text-secondary); font-weight: 600; }

/* ---------------------------------------------------------------------------
   8. SECURITY WATERMARK (verification / official documents)
   --------------------------------------------------------------------------- */
.fsh-report-watermark {
    position: relative;
}

.fsh-report-watermark::after {
    content: attr(data-watermark);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading, inherit);
    font-size: 5rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--theme-primary);
    opacity: 0.05;
    transform: rotate(-24deg);
    pointer-events: none;
    z-index: 0;
}

/* ---------------------------------------------------------------------------
   9. RESPONSIVE — documents render on phones too (public verify / offer pages)
   --------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .fsh-report-masthead {
        flex-direction: column;
        gap: 1rem;
    }
    .fsh-report-docmeta { text-align: left; }
    .fsh-report-hero-value { font-size: 1.7rem; }
    .fsh-report-table { font-size: 0.8rem; }
    .fsh-report-table thead th,
    .fsh-report-table tbody td { padding: 0.4rem 0.45rem; }
}

/* ---------------------------------------------------------------------------
   10. PRINT — paper is white; map ink to true black, keep brand accents.
        (@media print is exempt from the colour-token lint — paper is white.)
   --------------------------------------------------------------------------- */
@media print {
    .fsh-report-masthead {
        border-bottom-color: #000;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .fsh-report-orgname,
    .fsh-report-doctitle,
    .fsh-report-hero-value,
    .fsh-report-section-title { color: #000; }
    .fsh-report-orgmeta,
    .fsh-report-stamp,
    .fsh-report-kv-label,
    .fsh-report-hero-label,
    .fsh-report-signoff { color: #333; }

    /* Keep the brand spine, eyebrows and accent rules — print-color-adjust:exact
       (set globally in print.css) preserves the tenant hue on paper. */
    .fsh-report-table thead th { border-bottom-color: var(--theme-primary); color: #333; }
    .fsh-report-table tbody td { border-bottom-color: #ddd; }
    .fsh-report-table tfoot td { border-top-color: #000; color: #000; }

    .fsh-report-table thead { display: table-header-group; }
    .fsh-report-table tfoot { display: table-footer-group; }
    .fsh-report-table tr { break-inside: avoid; page-break-inside: avoid; }

    .fsh-report-callout { break-inside: avoid; }
    .fsh-report-watermark::after { opacity: 0.07; }
}
