/* Flow 2 · From a candidate site to a formal instruction (tools/genFlowToInstruction.mjs). Classes .fti-…; tokens only.
   The key screens' own styles come from screens-pipeline.css, screens-insights.css, screens-site.css and emails.css. */

/* The hero: actors, start, end */
.fti-hero { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5) var(--space-6); margin-bottom: var(--space-6); }
.fti-hero__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); margin: 0; }
.fti-hero__list dt { margin-bottom: var(--space-1); color: var(--color-muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: 0.04em; text-transform: uppercase; }
.fti-hero__list dd { margin: 0; font-size: var(--text-sm); line-height: var(--leading-sm); }
.fti-hero p { margin: 0; }
@media (max-width: 900px) { .fti-hero__list { grid-template-columns: 1fr; } }

/* A step with more than one picture: frames and letters one under another */
.fti-stack { display: flex; flex-direction: column; align-items: center; gap: var(--space-6); width: 100%; }
.fti-letterwrap { width: 600px; max-width: 100%; }
.fti-letters { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-6); }
.fti-letters > .mail { width: 600px; zoom: 0.8; }

/* The frame: the page holds a toast; a dialog sits over the dimmed screen */
.fti-frame .ap-main { position: relative; }
.fti-dim { position: relative; }
.fti-over { position: absolute; inset: 0; z-index: var(--z-modal); display: flex; align-items: flex-start; justify-content: center; padding: 96px var(--space-6) var(--space-6); background: var(--color-overlay); }
.fti-over .c-modal { box-shadow: var(--shadow-overlay); }
.fti-toast { position: absolute; right: var(--space-6); bottom: var(--space-6); z-index: var(--z-toast); max-width: 420px; box-shadow: var(--shadow-overlay); }

/* Grids of the Lead page for the steps that need a wider card */
.sp-grid.fti-grid3 > .sp-col:nth-child(2) { grid-column: span 1; }
.sp-grid.fti-grid21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.fti-span2 { min-width: 0; }

/* Fields drawn closed */
.fti-form { display: grid; gap: var(--space-3); margin-bottom: var(--space-3); }
.fti-form--1 { grid-template-columns: minmax(0, 1fr); }
.fti-form--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fti-form--3 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); }
.fti-field { gap: var(--space-1); }
.fti-field .c-select__trigger { width: 100%; }
.fti-field--inline { flex-direction: row; align-items: center; gap: var(--space-2); }
.fti-field--inline .c-select__trigger { min-width: 96px; }
.fti-input { display: flex; align-items: center; min-height: var(--size-control); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fti-input.c-input--area { align-items: flex-start; min-height: 72px; padding-top: var(--space-2); white-space: normal; }
.fti-input--empty { color: var(--color-subtle); }

/* Small shared pieces */
.fti-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.fti-row--end { justify-content: flex-end; margin-top: var(--space-3); }
.fti-pad { padding: 0 var(--space-4) var(--space-3); margin: 0; }
.fti-block { display: block; }
.fti-muted { color: var(--color-muted); }
.fti-late { color: var(--color-danger-text); }
.fti-none { padding: var(--space-2) var(--space-3); border: 1px dashed var(--color-default); border-radius: var(--radius-control); color: var(--color-subtle); font-size: var(--text-label); }
.fti-q { display: inline-flex; align-items: center; gap: var(--space-1); margin: var(--space-2) 0; color: var(--color-info-text); font-size: var(--text-xs); }
.fti-filter-on { border-color: var(--color-primary); background: var(--color-primary-soft); }
.fti-alert { margin-bottom: var(--space-3); }

/* The approach letter, drafted on the Lead */
.fti-letter { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-3) 0 0; padding: var(--space-4); border: 1px solid var(--color-default); border-radius: var(--radius-control); background: var(--color-surface-muted); }
.fti-letter__addr { display: flex; flex-direction: column; font-size: var(--text-label); line-height: var(--leading-sm); }
.fti-letter__title { font-size: var(--text-sm); }
.fti-lines { display: flex; flex-direction: column; gap: 6px; }
.fti-lines i { display: block; height: 8px; border-radius: var(--radius-full); background: var(--color-default); }
.fti-lines i:nth-child(2) { width: 92%; }
.fti-lines i:nth-child(4) { width: 60%; }

/* Contacts and consent */
.fti-contact { display: flex; align-items: center; gap: var(--space-2); }
.fti-consent { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); margin-top: var(--space-3); padding: var(--space-2); }

/* Clocks and the slots of Find a time */
.fti-clock { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.fti-slots { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.fti-slot { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid var(--color-primary); border-radius: var(--radius-control); background: var(--color-primary-soft); color: var(--color-primary-strong); font-size: var(--text-label); }
.fti-slot span { flex: 1; }

/* Decisions: Accept / Edit / Reject, Confirm / Dismiss */
.fti-dec { margin-left: auto; }
.fti-dec .segmented__item { padding: 2px var(--space-2); font-size: var(--text-xs); }
.fti-trace { padding: 0 var(--space-2); }
.fti-finds > li { align-items: center; }
.fti-team { display: inline-flex; flex-wrap: wrap; gap: var(--space-2); }
.fti-notify { display: inline-flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); }

/* Instruction Approval: the evidence being attached, the fee agreement's three actions */
.fti-evi { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-1); }
.fti-evi .fti-input { min-height: 32px; font-size: var(--text-label); }
.fti-feesteps { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-2); }
.fti-feestep { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.fti-sig { margin-top: var(--space-2); }

/* Site Review Pending, reject reasons */
.fti-missing { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-2); }
.fti-rejs { margin: 0; }
.fti-rejs > li { display: grid; grid-template-columns: minmax(0, 1fr) 220px; align-items: end; gap: var(--space-3); padding: var(--space-2) 0; }

/* Site › Overview with three tiles */
.ss-tiles.fti-tiles3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Inputs drawn in the flows wrap their source, note and decision onto a second line when they must */
.fti-frame .si-in__bot { flex-wrap: wrap; row-gap: var(--space-1); }
.fti-frame .si-in__bot .c-source { max-width: 260px; }
.fti-q { display: flex; flex-wrap: wrap; }
.fti-finds > li { flex-wrap: wrap; }
.fti-finds .fti-dec { margin-left: 0; }
.fti-team { flex-direction: row; }
/* A flow frame grows with its page, so nothing a step shows is cut at the bottom */
.fti-frame .ap { height: auto; min-height: 800px; }
.fti-finds .ap-list__text { flex: 1 1 100%; }
.fti-finds .ap-list__text > span { white-space: normal; }
.fti-toast--top { top: 64px; bottom: auto; }
.fti-over--end { justify-content: flex-end; padding-top: 140px; }
.fti-clock .badge, .fti-sig { white-space: normal; height: auto; text-align: left; }

/* Review fixes. A ring inside a card that clips (ap-card hides its overflow): a card that is itself the target shows its
   number, and a row or table flush with the card's edge is ringed inside its own box */
#toInstruction .ap-card[data-flow-target] { overflow: visible; }
#toInstruction .ap-card :where(.sp-cand, .sp-bulk, .table-wrap)[data-flow-target] { outline-offset: -2px; }
#toInstruction .ap-card :where(.sp-cand, .sp-bulk, .table-wrap)[data-flow-target]::after { top: 4px; left: 4px; }
/* An input's note goes to its own line, so the Trace button and the decision never cover it */
.fti-frame .si-in__note { flex: 1 1 100%; justify-content: flex-start; text-align: left; order: 3; }
.fti-frame .si-in__bot .fti-dec { order: 4; }
.fti-frame .si-controls { gap: var(--space-4); }
/* Site › Overview: next actions and clock lengths wrap, never cut */
.fti-frame .ss-act__t, .fti-frame .ss-dc__l2 .t-caption { white-space: normal; overflow: visible; }
/* The evidence being attached wraps its file name */
.fti-evi .fti-input { white-space: normal; height: auto; padding-block: var(--space-1); }
/* A toast low on the left, over the empty space under the queue list */
.fti-toast--low { left: var(--space-6); right: auto; bottom: var(--space-5); }
