/* ============================================================================
   Financial Analyst — the design-system layer (2026-10-20)
   ----------------------------------------------------------------------------
   Founder, on the whole role: «шрифты везде одинаковые… сейчас выглядит всё
   огромно… всё должно быть аккуратно, изящно… на каждую страницу заходишь — и
   понятно, что это и зачем это… гигантские отступы».

   ONE pass through the shared layer instead of forty page fixes. The cockpit
   CSS grew in layers (cv5 → cv5-ed/fvr → cv5-brief → cv5d → fr-/fd- → fa- kit
   → r2/r4 page sheets), each with its own scale; this file states the scale
   once and makes every layer speak it:

     1. One typeface        — Latin and Cyrillic in the same family.
     2. The shell           — brand · context · tabs · sub-tabs, tightened.
     3. Page anatomy        — the page header (name · purpose · actions).
     4. Type scale          — figures, titles, the analyst's sentence, links.
     5. Spacing scale       — card padding, grid gaps, block rhythm.
     6. Surfaces            — one card, one radius, one hairline shadow.
     7. Tables              — 13px, ~32px rows, nothing spills out of a cell.
     8. Phone (≤760px).

   Contract
   * Tokens live on the kit root (fpa-analyst.css, ``--fa-*``); this file only
     READS them. Change a size there, not here.
   * Loaded LAST — fpa/_base.html fills ``head_last`` (templates/base.html),
     which comes after every page's own head_extra stylesheets — so a rule
     here wins a tie. Selectors that must beat a page sheet's longer chain
     repeat that chain; nothing here uses !important except the one typeface
     invariant (§1), which must hold against every inline/utility font stack.
   * Restyle only: no rule hides, removes or reorders a control.
   * Spec for designers: docs/design/fpa-design-system.md.
   ============================================================================ */

/* ── 1. One typeface ──────────────────────────────────────────────────────────
   General Sans has no Cyrillic glyphs, so a Russian page set its Latin and
   digits in General Sans and every Cyrillic letter in the Segoe UI fallback —
   «19,2» in one face, «млн ₽» in another. The role now uses the platform UI
   face everywhere on the page (the app bar and footer included, so the
   cockpit never sits under a second face). Code samples keep monospace. */
body:has(.cv5-fpa),
body:has(.cv5-fpa) :where(*:not(code, kbd, pre, samp, .fa-mono)) {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}
:is(.cv5, .fa-root) { overflow-wrap: break-word; }
:is(.cv5, .fa-root) :is(table, .cv5-tnum, .fa-num, .fa-tile-v) { font-variant-numeric: tabular-nums; }

/* ── 2. The shell ─────────────────────────────────────────────────────────────
   Four rows — brand · context · six tabs · sub-tabs — used ~260px before the
   first figure. Tightened to ~170px, one caption size, one value size. */
.cv5.cv5-fpa .cv5sh .cv5sh-brand { min-height: 46px; padding: 7px 16px; }
.cv5.cv5-fpa .cv5sh .cv5sh-mark { width: 28px; height: 28px; border-radius: var(--fa-r-sm); font-size: 11px; }
.cv5.cv5-fpa .cv5sh .cv5sh-id .wm { font-size: 10px; letter-spacing: .1em; line-height: 1.2; }
.cv5.cv5-fpa .cv5sh .cv5sh-id .cv5-role { font-size: var(--fa-fs-card); font-weight: 600; line-height: 1.2; letter-spacing: 0; }
.cv5.cv5-fpa .cv5sh .cv5-subchips .cv5-chip { font-size: var(--fa-fs-small); }

.cv5.cv5-fpa .cv5sh .cv5sh-ctx { min-height: 46px; padding: 6px 16px; gap: 6px; }
.cv5.cv5-fpa .cv5sh .cv5sh-ctx.is-bare { min-height: 40px; }
.cv5.cv5-fpa .cv5sh :is(.cv5sh-fact, .cv5sh-ccy, .cv5sh-ctl > summary, .cv5sh-example) {
  min-height: 32px; padding: 4px 10px; border-radius: var(--fa-r-sm);
}
.cv5.cv5-fpa .cv5sh :is(.cv5sh-fact, .cv5sh-ccy, .cv5sh-ctl) small,
.cv5.cv5-fpa .cv5sh .cv5sh-ctx .fa-r2-co .k {
  font-size: 9.5px; font-weight: 600; letter-spacing: .06em; color: var(--fa-label);
}
.cv5.cv5-fpa .cv5sh :is(.cv5sh-fact, .cv5sh-ccy, .cv5sh-ctl) b,
.cv5.cv5-fpa .cv5sh .cv5sh-ctx .fa-r2-co .k ~ span:not(.chev) {
  font-size: var(--fa-fs-small); font-weight: 600; line-height: 1.3;
}
.cv5.cv5-fpa .cv5sh .cv5sh-ctx .fa-r2-co > summary.cv5-chip,
.cv5.cv5-fpa .cv5sh .cv5sh-ctx :is(span, a).fa-r2-co.cv5-chip { min-height: 32px; padding: 4px 10px; border-radius: var(--fa-r-sm); }
.cv5.cv5-fpa .cv5sh :is(.cv5sh-refresh button, .cv5sh-ask) {
  min-height: 32px; padding: 0 12px; border-radius: var(--fa-r-sm); font-size: var(--fa-fs-small); font-weight: 600;
}
.cv5.cv5-fpa .cv5sh .cv5sh-ask { box-shadow: none; }

.cv5.cv5-fpa .cv5sh .cv5sh-nav { min-height: 40px; padding: 0 8px; }
/* Height from padding, not min-height: the tab keeps its own display, which
   the phone rule uses to fold tabs 4-6 into the ⋯ menu. */
.cv5.cv5-fpa .cv5sh .cv5sh-nav .cv5-tab {
  min-height: 0; padding: 11px 12px; line-height: 18px;
  font-size: var(--fa-fs-small); font-weight: 600; letter-spacing: .04em;
}
.cv5.cv5-fpa .cv5sh nav.cv5-seg {
  min-height: 38px; padding: 0 16px; margin: 0; gap: 20px; flex-wrap: nowrap; overflow-x: auto;
  scrollbar-width: none;
}
.cv5.cv5-fpa .cv5sh nav.cv5-seg a {
  min-height: 38px; padding: 0; font-size: var(--fa-fs-ui); font-weight: 500; color: var(--fa-muted);
  white-space: nowrap; display: inline-flex; align-items: center;
}
.cv5.cv5-fpa .cv5sh nav.cv5-seg a.on { color: var(--fa-accent); font-weight: 600; }
.cv5.cv5-fpa .cv5sh nav.cv5-seg a[data-fpa-sample-signup] { color: var(--fa-label); }

.cv5.cv5-fpa .cv5-wrap,
.cv5.cv5-fpa .cv5-wrap.fd-wide { padding: var(--fa-s4) var(--fa-s4) var(--fa-s5); }

/* ── 3. Page anatomy: the page header ─────────────────────────────────────────
   name (h1) · one line saying what the page is for · the page's actions.
   Then the analyst's note (.fa-strip), then the content. */
:is(.cv5, .fa-root) .fa-ph {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--fa-s4);
  margin: 0 0 var(--fa-s3); padding: 0 2px; min-width: 0;
}
:is(.cv5, .fa-root) .fa-ph-main { min-width: 0; }
:is(.cv5, .fa-root) .fa-ph-t {
  margin: 0; font-size: var(--fa-fs-page); font-weight: 600; line-height: 1.25;
  letter-spacing: -.01em; color: var(--fa-ink);
}
:is(.cv5, .fa-root) .fa-ph-p {
  margin: 2px 0 0; max-width: 900px; font-size: var(--fa-fs-ui); line-height: var(--fa-lh); color: var(--fa-muted);
}
:is(.cv5, .fa-root) .fa-ph-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--fa-s2); flex: none; }
:is(.cv5, .fa-root) .fa-ph-acts:empty { display: none; }

/* The tab's one download (templates/fpa/ui/_xbook.html): a primary button
   at button height — the file's description stays inside it, one size
   down, instead of a 64px banner. */
:is(.cv5, .fa-root) .fx-book-main { padding: 5px 12px 5px 6px; gap: var(--fa-s2); box-shadow: none; }
:is(.cv5, .fa-root) .fx-book-t { line-height: 1.3; }
:is(.cv5, .fa-root) .fx-book-t b { font-size: var(--fa-fs-ui); font-weight: 600; }
:is(.cv5, .fa-root) .fx-book-t small { font-size: 11.5px; font-weight: 400; }
:is(.cv5, .fa-root) .fx-book-main .fa-fmt.xlsx { font-size: 9.5px; padding: 4px 5px; }

/* ── 4. Type scale ────────────────────────────────────────────────────────────
   Figures 22px, the analyst's sentence 17px, card titles 15px, text 13–14px,
   captions 12px, eyebrows 11px — on every layer, old and new. */

/* 4a. Figures — a number that is the point of its box. */
:is(.cv5, .fa-root) :is(.fa-cc-big, .fa-xpanel .big b, .fa-plan .fa-model-v, .fa-fl .v),
:is(.cv5, .fa-root) [data-r2p] :is(.r4-sc-v, .r2-co-big),
:is(.cv5, .fa-root) [data-r2p] .r2-detail .pnl2-total,
:is(.cv5, .fa-root) .r2c-num,
:is(.cv5, .fa-root) .r2ev-tiles .fa-tile-v.good,
:is(.cv5, .fa-root) .r2ev-tiles .fa-tile-v.bad,
:is(.cv5, .fa-root) .fa-bs2-after .fa-tile-v,
.cv5-kbig .n, .cv5-kpale .n, .fpa-am-weight .n,
.ufx :is(.fd-p3-cell-value, .modal-value) {
  font-size: var(--fa-fs-figure); line-height: var(--fa-lh-tight); letter-spacing: -.01em;
}
/* 4b. Secondary figures — a number beside other numbers in a card. */
:is(.cv5, .fa-root) :is(.r2c-wct-v, .fa-ga-own-pct, .fr-co-v, .fs-plan p),
:is(.cv5, .fa-root) .fa-r2p-sec > .fa-sec-h .v,
:is(.cv5, .fa-root) .fa-decisions .fa-num,
.ev-m-big, .ev-mini-v, .cv5bm2 .nd.hl .vl,
.cashv2 .bc .v {
  font-size: var(--fa-fs-figure-sm); line-height: 1.3;
}
/* 4c. The analyst's sentence — the one-line answer at the top of a page or
   of a featured card. */
:is(.cv5, .fa-root) .fb-ostrip .fa-strip-t,
:is(.cv5, .fa-root) .fa-decisions .fa-dq-card.hot .fa-dq-t,
.ev-v-t {
  font-size: var(--fa-fs-lead); line-height: 1.35; letter-spacing: -.005em;
}
.ev-v-t { margin: var(--fa-s2) 0 var(--fa-s1); }
/* 4d. Card and section titles. */
:is(.cv5, .fa-root) :is(.fa-bs2 .fa-card-t, .fa-bs2-after .fa-card-t, .fa-r2p-band .fa-card-t),
:is(.cv5, .fa-root) [data-r2p] .r2-mv .fa-card-t,
:is(.cv5, .fa-root) [data-r2p] .r2-detail :is(.fd-rc-h, .pnl2-h),
:is(.cv5, .fa-root) :is(.cf2s-h, .r2c-h, .fa-sechead h2, .fa-maphd p, .fa-case .c.big),
:is(.cv5, .fa-root) .fa-decisions .fa-dq-t,
.cv5 .cv5-wrap :is(h2, h3):not([class]),
.cv5 .fpa-cc-name, .cv5 .fd-rc-h {
  font-size: var(--fa-fs-card); line-height: 1.4; letter-spacing: 0;
}
:is(.cv5, .fa-root) .fa-rp-title { font-size: var(--fa-fs-figure-sm); }
/* 4e. Links and controls never outgrow the text around them. */
:is(.cv5, .fa-root) :is(.fr-lnk, .fa-more, .cv5-quiet) { font-size: var(--fa-fs-ui); }
/* 4f. Today: the note keeps its hierarchy at the shared scale. */
:is(.cv5, .fa-root) .fa-today .fa-note .fa-note-band .cv5-brief-kpi .value { font-size: var(--fa-fs-figure); }

/* ── 5. Spacing scale ─────────────────────────────────────────────────────────
   Card padding 16, grid gaps 12, blocks 12 apart — no 30px wells, no 36px
   gutters. */
:is(.cv5, .fa-root) .fa-card:is(.fa-rp-feature, .fa-acts-card, .fa-feed-card, .fa-bridge-card, .fa-outlook-card, .c2r,
  .r4-bridge, .r4-normal, .r4-moved, .r4-land, .r2-mv, .cf2s, .r2c-card, .r2c-wc, .ev-mini, .fa-ga-own, .fa-casecard,
  .fa-cash-tools, .fa-solve, .fa-rp-before, .fa-rp-also, .fa-rp-who, .fa-sc-cal, .fa-sc-where, .fa-sc-letter, .fa-sc-save,
  .fa-rv-steps, .fa-rv-empty, .fa-rv-buttons, .fa-rv-card, .fs-pipe-card, .fs-rhythm, .fs-help, .fs-ways, .fa-r2-chk,
  .fa-rl-sign, .fb-loaded, .fa-att) {
  padding: var(--fa-pad);
}
:is(.cv5, .fa-root) .fa-strip.fa-note { padding: var(--fa-pad) 18px; }
:is(.cv5, .fa-root) :is(.fa-rp-feature, .fs-rows.two, .fpa-am-facts, .fd-dc-outgrid, .ev-v-main, .ev-meter, .fs-gives,
  .c2r-grid, .fr-cs-k, .cv5-rail, .ev-tie-foot, .fa-att-list, .fa-rp-also-in, .cv5-fresh, .fa-rp-hold) {
  gap: var(--fa-s3) var(--fa-s4);
}
:is(.cv5, .fa-root) .fa-sechead { margin-top: var(--fa-s4); margin-bottom: var(--fa-s2); }
:is(.cv5, .fa-root) :is(.cv5-empty, .fpa-am-weight, .fpa-am-side, .fa-r2-brief, .fa-dq-card, .ev-meter) { padding: var(--fa-pad); }
:is(.cv5, .fa-root) .fa-decisions :is(.fa-dq-card, .fa-dq-card.hot) { padding: var(--fa-pad); }
.cv5 .cv5-wrap :is(.rounded-xl, .rounded-2xl).border:is(.p-5, .p-6, .p-8) { padding: var(--fa-pad); }
.cv5 .cv5-wrap :is(.rounded-xl, .rounded-2xl).border:is(.px-5, .px-6) { padding-left: var(--fa-pad); padding-right: var(--fa-pad); }

/* The sample's closing card and the methodology / reference links under it
   (templates/fpa/_sample_close_cta.html, fpa/_base.html) — kit classes
   instead of one-off inline sizes. */
:is(.cv5, .fa-root) .fa-cta { margin-top: var(--fa-s4); }
:is(.cv5, .fa-root) .fa-cta-txt { margin: 2px 0 0; max-width: 46rem; font-size: var(--fa-fs-ui); line-height: var(--fa-lh); color: var(--fa-ink2); }
:is(.cv5, .fa-root) .fa-cta-get { margin-top: var(--fa-s3); padding-top: var(--fa-s3); border-top: 1px solid var(--fa-line-soft); }
:is(.cv5, .fa-root) .fa-cta-acts { display: flex; flex-wrap: wrap; gap: var(--fa-s2); margin-top: var(--fa-s3); }
:is(.cv5, .fa-root) .fa-foot-links { margin-top: var(--fa-s4); font-size: var(--fa-fs-small); }
:is(.cv5, .fa-root) .fa-foot-sep { padding: 0 6px; }
:is(.cv5, .fa-root) .fa-today .fa-note .fa-r2-brief { padding: var(--fa-s3) var(--fa-s4) var(--fa-s1); margin-top: var(--fa-s3); }

/* ── 6. Surfaces — one card ───────────────────────────────────────────────────
   White, 1px hairline, 10px radius, a hairline shadow. The older layers'
   panels (cv5 cards, Tailwind ``rounded-xl`` blocks in Settings) are drawn
   the same way so a page never mixes three card styles. */
:is(.cv5, .fa-root) :is(.fa-card, .fa-tile, .fa-strip, .cv5-card, .cv5-panel, .fa-dq-card) {
  border-radius: var(--fa-r);
}
:is(.cv5, .fa-root) .fa-today .fa-note { border-radius: var(--fa-r); }
.cv5 .cv5-wrap :is(.rounded-xl, .rounded-2xl).border { border-radius: var(--fa-r); }
/* One chip: the kit pill's geometry for the older chip classes. */
:is(.cv5, .fa-root) :is(.r4-pill, .fa-chip, .cv5-pill) {
  border-radius: 999px; font-size: var(--fa-fs-small); line-height: 1.4; padding: 1px 8px;
}

/* ── 7. Tables — 13px, ~32px rows, nothing spills out of a cell ───────────────
   Numbers never wrap; a label wraps (or breaks a long word) instead of
   pushing the table out of its card. */
:is(.cv5, .fa-root) .fa-tbl :is(td, th):not(:first-child):not(.l) { white-space: nowrap; }
:is(.cv5, .fa-root) .fa-tbl :is(td:first-child, td.l) { overflow-wrap: anywhere; }
:is(.cv5, .fa-root) table :is(td, th) { overflow-wrap: break-word; }
:is(.cv5, .fa-root) table td :is(.cv5-tnum, .fa-num, .cv5-drillnum) { white-space: nowrap; }
:is(.cv5, .fa-root) .dim2-name { white-space: normal; overflow-wrap: anywhere; }
:is(.cv5, .fa-root) .dim2-name > :is(span, small, em, b) { display: inline-block; max-width: 100%; }
/* An ellipsised cell must say what it hides: the template puts the full text
   in title=""; the rule only applies where the cell opts in. */
:is(.cv5, .fa-root) :is(td, th).fa-ell {
  max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
:is(.cv5, .fa-root) .fa-tbl-wrap { max-width: 100%; }

/* ── 8. Phone ─────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .cv5.cv5-fpa .cv5-wrap,
  .cv5.cv5-fpa .cv5-wrap.fd-wide { padding: var(--fa-s3) var(--fa-s3) var(--fa-s5); }
  .cv5.cv5-fpa .cv5sh .cv5sh-brand { padding: 6px 12px; }
  .cv5.cv5-fpa .cv5sh .cv5sh-ctx { padding: 6px 12px; }
  .cv5.cv5-fpa .cv5sh nav.cv5-seg { padding: 0 12px; gap: 16px; }
  :is(.cv5, .fa-root) .fa-ph { flex-direction: column; align-items: flex-start; gap: var(--fa-s2); }
  /* A badge beside a long name in a narrow column wraps rather than spill. */
  :is(.cv5, .fa-root) .dim2-name .dim2-pill { white-space: normal; overflow-wrap: anywhere; }
  /* A table wider than a phone scrolls inside its own box instead of
     pushing the page sideways. */
  :is(.cv5, .fa-root) :is(.fa-card-body, .fa-fold-body, .r2-co-earn):has(table) { overflow-x: auto; }
}
