/* Results — finishing the approved R-concepts (R2 working capital in money,
   R3 minimum-cash floor, R6 bridge switch, R5 proof on hover + history grid).
   Kit tokens only (fpa-analyst.css); nothing here overrides an existing rule. */

/* ── Shared ─────────────────────────────────────────────────────────────── */
.fd .r5f-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: var(--fa-track); color: var(--fa-muted); white-space: nowrap; }
.fd .r5f-pill.bad { background: var(--fa-bad-tint); color: var(--fa-bad-deep); }
.fd .r5f-pill.good { background: var(--fa-good-tint); color: var(--fa-good-deep); }
.fd .r5f-pill.warn { background: var(--fa-warn-tint); color: var(--fa-warn); }

/* ── R2 · Working capital in money ──────────────────────────────────────── */
.r5f-wc { margin-top: 16px; }
.r5f-wc-days { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.r5f-wc-d { border: 1px solid var(--fa-line-soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.r5f-wc-dh { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.r5f-wc-dh .fa-tile-l { margin: 0; }
.r5f-wc-v { font-size: 24px; font-weight: 600; letter-spacing: -.01em; color: var(--fa-ink); margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.r5f-wc-na { font-size: 13px; color: var(--fa-muted); margin: 4px 0 0; }
.r5f-wc-m { font-size: 12px; line-height: 1.4; color: var(--fa-muted); margin: 0; }
.fd .r5f-wc-spark { height: 30px; margin-top: 4px; overflow: hidden; }
.fd .r5f-wc-spark .fa-spark { width: 100%; height: 30px; margin: 0; display: block; }
.r5f-wc-money { font-size: 13px; font-weight: 600; line-height: 1.35; margin: auto 0 0; padding-top: 8px; border-top: 1px solid var(--fa-line-soft); }
.r5f-wc-money.bad { color: var(--fa-bad-deep); }
.r5f-wc-money.good { color: var(--fa-good); }
.r5f-wc-money.mut { color: var(--fa-muted); font-weight: 500; }
.r5f-wc-basis { margin: 10px 0 0; }
.r5f-wc-bar { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.r5f-wc-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 110px; gap: 12px; align-items: center; font-size: 13px; color: var(--fa-ink2); }
.r5f-wc-row.net { font-weight: 600; color: var(--fa-ink); }
.r5f-wc-rv { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.r5f-wc-track { display: flex; height: 14px; border-radius: 4px; background: var(--fa-track); overflow: hidden; }
.r5f-seg { display: inline-block; height: 100%; background: var(--fa-grey-bar); }
.r5f-seg.receivables { background: var(--fa-navy); }
.r5f-seg.inventory { background: var(--fa-warn-bar); }
.r5f-seg.advances_paid { background: #8fa3c4; }
.r5f-seg.payables { background: var(--fa-good-bar); }
.r5f-seg.advances_received { background: #9fd8bc; }
.r5f-seg.taxes_payroll { background: #c7e9d7; }
.r5f-seg.prior { background: #a9b9d6; }
.r5f-seg.absorbed { background: var(--fa-bad-bar); }
.r5f-seg.released { background: var(--fa-good-bar); }
.r5f-wc-legend { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--fa-muted); }
.r5f-wc-legend li { display: inline-flex; align-items: center; gap: 6px; }
.r5f-wc-legend .r5f-seg { width: 10px; height: 10px; border-radius: 2px; }
.r5f-wc-legend b { color: var(--fa-ink2); font-weight: 600; }

@media (max-width: 900px) {
  .r5f-wc-days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .r5f-wc-days { grid-template-columns: minmax(0, 1fr); }
  .r5f-wc-row { grid-template-columns: minmax(0, 1fr) auto; }
  .r5f-wc-track { grid-column: 1 / -1; grid-row: 2; }
}

/* ── R3 · Cash flow: three figures, the floor, the pinch week ───────────── */
.r5f-cf { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.r5f-cf-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.r5f-cf-tile { border: 1px solid var(--fa-line); border-radius: 14px; padding: 14px 16px; background: var(--fa-accent-soft); min-width: 0; }
.r5f-cf-tile.operating.good { background: var(--fa-good-tint); border-color: #bfe3cd; }
.r5f-cf-tile.bad { background: var(--fa-bad-tint); border-color: #f2c2c8; }
.r5f-cf-tile .fa-tile-l { margin: 0; }
.r5f-cf-v { font-size: 26px; font-weight: 600; letter-spacing: -.01em; margin: 4px 0 2px; color: var(--fa-ink); font-variant-numeric: tabular-nums; }
.r5f-cf-tile.good .r5f-cf-v { color: var(--fa-good-deep); }
.r5f-cf-tile.bad .r5f-cf-v { color: var(--fa-bad-deep); }
.r5f-cf-m { font-size: 12.5px; line-height: 1.45; color: var(--fa-muted); margin: 2px 0 0; }
.r5f-cf-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.r5f-cf-grid.one { grid-template-columns: minmax(0, 1fr); }
.r5f-cf-rule { font-size: 13px; line-height: 1.5; color: var(--fa-ink2); margin: 0 0 4px; }
.r5f-cf-chart { margin-top: 8px; }
.r5f-cf-under { font-size: 12.5px; font-weight: 600; color: var(--fa-bad-deep); margin: 6px 0 0; }
.r5f-cf-ptbl { width: 100%; }

@media (max-width: 900px) {
  .r5f-cf-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .r5f-cf-tiles { grid-template-columns: minmax(0, 1fr); }
}

/* ── R6 · Group: the bridge card's switch ───────────────────────────────── */
.r5f-switch { display: inline-flex; border: 1px solid var(--fa-btn-line); border-radius: 9px; overflow: hidden; background: #fff; flex-wrap: wrap; }
.r5f-switch a { font-size: 12.5px; font-weight: 600; color: var(--fa-accent); padding: 6px 11px; text-decoration: none; border-left: 1px solid var(--fa-btn-line); white-space: nowrap; }
.r5f-switch a:first-child { border-left: 0; }
.r5f-switch a.on { background: var(--fa-accent); color: #fff; }
.r5f-switch a:focus-visible { outline: 2px solid var(--fa-accent); outline-offset: -2px; }
.r5f-gb-note { margin: 6px 0 0; }
@media (max-width: 640px) {
  .r5f-gb .fa-card-head { flex-wrap: wrap; }
}

/* ── R5 stage 2 · Evidence: proof on hover, the history grid ────────────── */
.r5f-ev { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.r5f-pf-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.r5f-pf { position: relative; }
.r5f-pf-btn { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 2px 8px; align-items: center; text-align: left; background: #fff; border: 1px solid var(--fa-line); border-radius: 12px; padding: 10px 12px; cursor: help; font: inherit; color: var(--fa-ink); }
.r5f-pf-btn:hover, .r5f-pf.open .r5f-pf-btn { border-color: var(--fa-accent); background: var(--fa-accent-soft); }
.r5f-pf-btn:focus-visible { outline: 2px solid var(--fa-accent); outline-offset: 2px; }
.r5f-pf-btn .l { font-size: 12px; font-weight: 600; color: var(--fa-label); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px dotted #9aa8bf; justify-self: start; }
.r5f-pf-btn .v { grid-column: 1; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.r5f-pf-btn .v.na { font-size: 12.5px; font-weight: 500; color: var(--fa-muted); }
.r5f-pf-btn .dot { grid-column: 2; grid-row: 1 / span 2; width: 10px; height: 10px; border-radius: 50%; background: #cfd7e3; }
.r5f-pf-btn .dot.good { background: var(--fa-good-bar); }
.r5f-pf-btn .dot.bad { background: var(--fa-bad-bar); }
.r5f-pop { display: none; position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(380px, 86vw); background: #fff; border: 1px solid var(--fa-line); border-radius: 12px; box-shadow: 0 12px 32px rgba(23, 35, 61, .16); padding: 12px 14px; font-size: 12.5px; line-height: 1.45; color: var(--fa-ink2); }
.r5f-pf:nth-child(4n) .r5f-pop, .r5f-pf:nth-child(4n - 1) .r5f-pop { left: auto; right: 0; }
.r5f-pf:hover .r5f-pop, .r5f-pf:focus-within .r5f-pop, .r5f-pf.open .r5f-pop { display: block; }
.r5f-pf.shut .r5f-pop { display: none; }
.r5f-pop-h { margin: 0 0 8px; font-weight: 600; color: var(--fa-ink); }
.r5f-pop dl { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 5px 10px; margin: 0; }
.r5f-pop dt { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fa-label); padding-top: 2px; }
.r5f-pop dd { margin: 0; }
.r5f-pop dd.good { color: var(--fa-good); font-weight: 600; }
.r5f-pop dd.bad { color: var(--fa-bad-deep); font-weight: 600; }
.r5f-pop dd.na { color: var(--fa-muted); }
.r5f-hist-scroll { overflow-x: auto; }
.r5f-hist-t { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.r5f-hist-t th, .r5f-hist-t td { padding: 6px 4px; text-align: center; border-bottom: 1px solid var(--fa-line-soft); white-space: nowrap; }
.r5f-hist-t thead th { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--fa-label); }
.r5f-hist-t tbody th { text-align: left; font-weight: 600; color: var(--fa-ink); padding-right: 12px; }
.r5f-hist-t .rec { text-align: left; color: var(--fa-muted); padding-left: 12px; white-space: normal; min-width: 150px; }
.r5f-hist-t .rec.bad { color: var(--fa-bad-deep); font-weight: 600; }
.r5f-cell { display: inline-grid; place-items: center; width: 24px; height: 22px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.r5f-cell.s-tie { background: var(--fa-good-tint); color: var(--fa-good-deep); }
.r5f-cell.s-off { background: var(--fa-bad-tint); color: var(--fa-bad-deep); }
.r5f-cell.s-fixed { background: var(--fa-warn-tint); color: var(--fa-warn); }
.r5f-cell.s-na { background: #fff; color: #8a97ad; border: 1px dashed #c4cddb; }
.r5f-hist-leg { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--fa-muted); }
.r5f-hist-leg li { display: inline-flex; align-items: center; gap: 6px; }
.r5f-hist-leg .r5f-cell { width: 18px; height: 16px; font-size: 10px; }

@media (max-width: 900px) {
  .r5f-pf-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .r5f-pf:nth-child(2n) .r5f-pop { left: auto; right: 0; }
  .r5f-pf:nth-child(2n + 1) .r5f-pop { left: 0; right: auto; }
}
