/* FINISH-02: Finish this pizza on Build. Design D3, "the pass"
   (run 2026-10-10-finish, design-decision-r1, with the critic's must-fixes).
   Desktop: a non-modal panel over the ticket rail column, in the stations'
   white-card language, sized to its content and pinned in the viewport.
   Phone: a bottom sheet over a scrim that covers the site header. The meter
   inside is Build's own ticket meter; chips follow the station chips. */

/* ── The doors ── */
.build-start-row.has-finish { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.build-start-row.has-finish:not(.has-describe) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.build-start-row > [hidden] { display: none !important; }
@media (max-width: 640px) {
    .build-start-row.has-finish { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .build-start-row.has-finish.has-describe .build-start-finish { grid-column: 1 / -1; }
}
@media (max-width: 369.98px) {
    .build-start-row.has-finish,
    .build-start-row.has-finish:not(.has-describe) { grid-template-columns: minmax(0, 1fr); }
}

/* The rail card's quiet button, above today's rule lines. */
.fin-rail { margin-top: 14px; }
/* Build's own secondary button (doc-editor.css .doc-editor-icon-btn.with-label),
   the same as the start-action row's Get ideas door: rectangular, outlined,
   uppercase and tracked. Only its spacing is set here. */
.fin-rail-btn.doc-editor-icon-btn.with-label { gap: 7px; padding: 0 14px; width: auto; }
/* doc-editor.css collapses its buttons to 44px icons under 640px; this one
   keeps its words, as the start-action row does. */
.fin-rail-btn.doc-editor-icon-btn.with-label .doc-btn-label { display: inline-block; }
.fin-rail-line {
    margin: 6px 0 0;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 12px;
    line-height: 1.4;
}

/* The station chip an idea just landed on. */
.chip.fin-landed { animation: fin-land .6s ease-out; }
@keyframes fin-land {
    0% { box-shadow: 0 0 0 0 rgba(var(--sage-rgb), .55); }
    100% { box-shadow: 0 0 0 10px rgba(var(--sage-rgb), 0); }
}

/* ── The surface ── */
.fin-panel {
    --fin-gutter: 20px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    max-height: var(--fin-max, 640px);
    overflow: hidden;
    color: var(--ink);
    font-family: var(--font-app);
    background: var(--card-bg);
    transition: opacity .18s ease, transform .18s ease;
}
.fin-panel *, .fin-panel *::before, .fin-panel *::after { box-sizing: border-box; }
.fin-panel.is-sizing { transition: height .24s ease, opacity .18s ease, transform .18s ease; }
.fin-panel.is-entering { opacity: 0; transform: translateY(6px); }

/* Desktop: the pass. The ticket steps back while the panel is up and
   comes back exactly on close. */
#ticket.fin-open { filter: none; }
#ticket.fin-open > :not(.fin-panel) { visibility: hidden; }
#ticket.fin-open::before, #ticket.fin-open::after { visibility: hidden; }
#ticket.fin-open { background: transparent; }
.fin-panel.is-pass {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
    border: 1px solid rgba(var(--ink-rgb), .10);
    border-radius: 12px;
    box-shadow: 0 2px 1px rgba(60, 42, 30, .05), 0 12px 28px rgba(60, 42, 30, .12);
}

/* Phone: a bottom sheet sized to its content, over everything. */
.fin-scrim {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(43, 30, 22, .38);
}
.fin-panel.is-sheet {
    --fin-gutter: 16px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2001;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 40px rgba(43, 30, 22, .22);
}
.fin-panel.is-sheet.is-entering { transform: translateY(24px); }
/* A tablet held wide: the sheet keeps a readable measure, centred. */
@media (min-width: 641px) {
    .fin-panel.is-sheet { width: min(640px, calc(100% - 32px)); margin: 0 auto; }
}
body.fin-sheet-open { overflow: hidden; }
.fin-grab { flex: 0 0 auto; display: flex; justify-content: center; padding-top: 8px; }
.fin-grab span { width: 40px; height: 4px; border-radius: 999px; background: rgba(var(--ink-rgb), .18); }

/* ── Header: the Describe a pizza sheet's header type ── */
.fin-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 14px var(--fin-gutter);
    border-bottom: 1px solid rgba(var(--ink-rgb), .10);
}
.fin-panel.is-sheet .fin-head { padding: 6px 10px 12px var(--fin-gutter); }
.fin-title {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.2;
}
.fin-panel.is-sheet .fin-title { font-size: 18px; }
.fin-title:focus { outline: none; }
.fin-beta {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border: 1px solid rgba(var(--sage-rgb), .5);
    border-radius: 999px;
    color: var(--sage-deep);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}
.fin-spacer { flex: 1 1 auto; }
.fin-close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(var(--ink-rgb), .12);
    border-radius: 999px;
    background: var(--card-bg);
    color: var(--stone);
    cursor: pointer;
}
.fin-panel.is-sheet .fin-close { width: 44px; height: 44px; margin-right: 6px; }
.fin-close:hover { color: var(--ink); border-color: rgba(var(--rust-rgb), .3); }

/* ── Body ── */
.fin-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 16px var(--fin-gutter) 18px;
}
.fin-meter.balance-meter {
    margin: 0;
    padding: 0 0 14px;
    border-top: 0;
    border-bottom: 1px solid rgba(var(--ink-rgb), .10);
}
.fin-meter .balance-meter-title { margin-bottom: 8px; }
.fin-meter .meter-row { margin-bottom: 4px; }
.fin-meter .meter-row:last-child { margin-bottom: 0; }
/* The change column is held in every state, so the bars never shorten
   when a riff's "+1" appears (critic must-fix 4). */
.fin-meter .meter-row:not(:has(.meter-delta))::after { content: ""; flex: 0 0 22px; }
/* Desktop: Build's six rows in two columns of three, so the answer sits
   above the fold (the D3 mock's layout, Build's own component). */
/* Both surfaces: Build's six rows in two columns of three, so the ideas sit
   high (the phone sheet too). Below 360 px the rows go back to one column. */
.fin-panel .fin-meter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto repeat(3, auto);
    grid-auto-flow: column;
    column-gap: 20px;
    row-gap: 4px;
    padding-bottom: 11px;
}
.fin-panel .fin-meter .balance-meter-title { grid-column: 1 / -1; grid-row: 1; margin-bottom: 2px; }
.fin-panel .fin-meter .meter-row { margin: 0; gap: 7px; }
.fin-panel .fin-meter .meter-row:not(:has(.meter-delta))::after,
.fin-panel .fin-meter .meter-delta { flex-basis: 16px; }
.fin-panel.is-sheet .fin-meter { column-gap: 16px; }
@media (max-width: 359.98px) {
    .fin-panel.is-sheet .fin-meter { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; row-gap: 3px; }
}
.fin-panel.is-pass .fin-scroll { padding-top: 12px; }
.fin-panel.is-pass .fin-head { padding-top: 10px; padding-bottom: 10px; }
.fin-panel.is-pass .fin-foot { padding-top: 10px; padding-bottom: 10px; }
.fin-panel.is-pass .fin-foot-status { margin-bottom: 8px; }
/* Dev hosts: the A/B switch shares the footer row when it fits. */

/* The read: Build's reading size, on Build's 12px rhythm (FINISH-04 tighten). */
.fin-read {
    margin: var(--space-3) 0 0;
    color: var(--ink);
    font-size: var(--type-size-reading);
    font-weight: 500;
    line-height: 1.4;
    text-wrap: pretty;
}
.fin-read.is-status { margin-bottom: 0; color: var(--stone-ink); font-size: 15px; }
.fin-read:focus { outline: none; }

.fin-ideas { margin: 0; padding: 0; list-style: none; }
/* One idea, one unit: the chip, its effect tags right after it (or under it,
   left-aligned, when they don't fit), and the reason under both, flush with
   the chip. Rows part on Build's hairline. */
.fin-idea {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 10px;
    row-gap: 6px;
    padding: var(--space-3) 0;
    border-top: var(--hairline-width) solid var(--hairline-color);
}
.fin-idea:first-child { border-top: 0; }
.fin-idea:last-child { padding-bottom: var(--space-1); }
/* Ideas are Build's own chips (build.html .chip; palette.css .chip.selected):
   unselected, white and outlined with + or −; applied, the selected sage chip
   with a check, and the X on hover or focus. Only placement and the sign
   are set here. */
.fin-chip.chip { flex: 0 1 auto; max-width: 100%; gap: 6px; }
.fin-chip.chip[aria-disabled="true"] { cursor: default; }
/* Just tapped (pointer, not keyboard): the applied chip shows its check; the X
   still comes on hover, as on the stations. */
.fin-chip.chip.selected.is-tapped:focus-visible { border-color: var(--state-color); background: var(--state-color); }
.fin-chip.chip.selected.is-tapped:focus-visible .chip-check-icon { display: inline-block; }
.fin-chip.chip.selected.is-tapped:focus-visible::before { content: none; }
/* The X on hover only where there is real hover (as Build's station chips),
   so a touch screen's sticky hover never shows it; keyboard focus keeps it. */
@media (hover: hover) {
    .fin-chip.chip.selected.is-tapped:hover { border-color: var(--state-hover); background: var(--state-hover); }
    .fin-chip.chip.selected.is-tapped:hover .chip-check-icon { display: none; }
    .fin-chip.chip.selected.is-tapped:hover::before { content: "\00d7"; }
}
.fin-sign { display: inline-flex; justify-content: center; width: 12px; font-size: 15px; font-weight: 600; line-height: 1; }
.fin-chip.chip.is-pantry,
.fin-chip.chip.is-pantry:hover { border-color: rgba(var(--stone-rgb), .3); background: transparent; color: var(--stone); }
.fin-tags { display: inline-flex; flex: 0 0 auto; gap: 10px; }
.fin-tag { color: var(--stone-ink); font-size: 12.5px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-tag.is-up { color: var(--sage-deep); }
.fin-tag.is-down { color: var(--stone); }
.fin-tag.is-done { color: var(--sage-deep); }
.fin-reason,
.fin-pantry {
    flex: 0 0 100%;
    margin: 0;
    color: var(--stone);
    font-size: var(--type-size-body);
    line-height: 1.45;
    text-wrap: pretty;
}
.fin-idea.is-done .fin-reason { color: var(--stone); }
.fin-pantry { color: var(--stone); font-size: 13px; }
.fin-gone {
    flex: 0 0 100%;
    margin: 0;
    color: var(--stone);
    font-size: 14px;
    line-height: 1.45;
}

/* No new ideas: information in its own row under the ideas, not over the fade. */
.fin-note {
    margin: 12px 0 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--cream);
    color: var(--stone-ink);
    font-size: 14px;
    line-height: 1.45;
    text-wrap: pretty;
}
.fin-note:focus { outline: none; }
/* The rare leave-it line: it points somewhere, so it reads as a note. */
.fin-leave {
    margin: 12px 0 0;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--cream);
    color: var(--ink);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    text-wrap: pretty;
}

/* The read slot while waiting holds two lines, so a rotating line that wraps
   on a phone never moves the placeholder rows. */
.fin-status { display: flex; align-items: center; gap: 10px; min-height: calc(2 * 1.4em); margin: var(--space-3) 0 0; color: var(--stone-ink); font-size: var(--type-size-reading); font-weight: 500; line-height: 1.4; }
.fin-wait-line { flex: 1 1 auto; min-width: 0; opacity: 1; transition: opacity .1s ease; }
.fin-wait-line.is-fading { opacity: 0; }
.fin-spin { flex: 0 0 auto; width: 16px; height: 16px; border: 2px solid rgba(var(--stone-rgb), .25); border-top-color: var(--stone-ink); border-radius: 50%; animation: fin-spin .9s linear infinite; }
@keyframes fin-spin { to { transform: rotate(360deg); } }
.fin-skel { display: block; border-radius: 8px; background: rgba(var(--ink-rgb), .07); animation: fin-pulse 1.6s ease-in-out infinite; }
.fin-skel.is-chip { height: 44px; border-radius: 999px; }
.fin-skel.is-chip.is-s { width: 108px; }
.fin-skel.is-chip.is-m { width: 132px; }
.fin-skel.is-chip.is-l { width: 168px; }
/* The placeholder rows take the idea row's shape: chip, tag beside it, reason under. */
.fin-skel.is-tag { width: 48px; height: 12px; }
.fin-skel.is-reason { flex: 0 0 100%; max-width: 78%; height: 13px; margin: 3px 0; }
@keyframes fin-pulse { 50% { opacity: .55; } }

.fin-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: underline;
    text-decoration-color: rgba(var(--stone-rgb), .4);
    text-underline-offset: 3px;
    cursor: pointer;
}
.fin-link:hover { color: var(--ink); text-decoration-color: currentColor; }
.fin-how { margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--cream); }
.fin-how[hidden] { display: none; }
.fin-how-title { margin: 0 0 8px; color: var(--ink); font-size: 15px; font-weight: 700; line-height: 1.3; }
.fin-how p { margin: 0 0 8px; color: var(--stone-ink); font-size: 13.5px; line-height: 1.5; text-wrap: pretty; }
.fin-how p:last-child { margin-bottom: 0; }

/* ── Footer: the status line, then one secondary button and How it works ── */
.fin-foot {
    position: relative;
    flex: 0 0 auto;
    padding: 12px 14px 12px var(--fin-gutter);
    border-top: 1px solid rgba(var(--ink-rgb), .10);
    background: var(--card-bg);
}
.fin-panel.is-sheet .fin-foot { padding: 12px var(--fin-gutter) calc(12px + env(safe-area-inset-bottom, 0px)); }
/* More below: a soft fade over the body's last lines. */
.fin-foot::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 28px;
    background: linear-gradient(to bottom, rgba(var(--card-bg-rgb, 255, 252, 245), 0), var(--card-bg));
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease;
}
.fin-panel.has-more .fin-foot::before { opacity: 1; }
.fin-foot-status {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0 0 10px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}
.fin-foot-status:focus { outline: none; }
.fin-link:focus-visible,
.fin-btn:focus-visible,
.fin-close:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }
.fin-foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
/* The footer's one primary: Other ideas, or Ask again after a change. */
.fin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 18px;
    border: 1px solid var(--rust);
    border-radius: 8px;
    background: var(--rust);
    color: #fff;
    font-family: var(--font-app);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}
.fin-btn:hover:not(:disabled) { border-color: var(--rust-hover); background: var(--rust-hover); }
/* Waiting, not broken: a quiet outline while it can't be used. */
.fin-btn:disabled { border-color: rgba(var(--stone-rgb), .35); background: transparent; color: var(--stone-ink); cursor: default; }
.fin-panel.is-sheet .fin-btn { min-height: 44px; }
/* The one quiet link row under it. */
.fin-foot-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 10px 0 0; }
.fin-dot { color: var(--stone); font-size: 13px; }
.fin-how-link { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
    .fin-panel, .fin-panel.is-sizing { transition: none; }
    .fin-panel.is-entering { opacity: 1; transform: none; }
    .fin-spin { animation-duration: 2.4s; }
    .fin-wait-line { transition: none; }
    .fin-skel { animation: none; }
    .chip.fin-landed { animation: none; }
}
@media (forced-colors: active) {
    .fin-btn, .fin-leave, .fin-how { border: 1px solid CanvasText; }
    .fin-skel { background: GrayText; }
}

/* AIUX-03: secondary ideas controls and usable isolated targets. */
.fin-btn.is-secondary { background: transparent; color: var(--rust); }
.fin-btn.is-secondary:hover:not(:disabled) { background: rgba(var(--rust-rgb), .07); }
.fin-link { min-height: 44px; display: inline-flex; align-items: center; }
.fin-close { min-width: 44px; min-height: 44px; }
.fin-foot-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fin-explanation { flex: 0 0 100%; min-width: 0; }
.fin-explanation p { margin: 6px 0; font-size: 13px; line-height: 1.5; }
.fin-comparison { width: 100%; font-size: 13px; text-align: left; border-collapse: collapse; }
.fin-comparison th, .fin-comparison td { padding: 4px 8px 4px 0; }
.fin-panel.is-sheet > .toast-stack { position: static; transform: none; width: auto; max-width: none; padding: 0 16px; flex-shrink: 0; }
.fin-panel .toast-action, .fin-panel .toast-dismiss { min-height: 44px; min-width: 44px; }
