/* bike-builds.css — the Bike Builds page (js/pages/bike-builds.js). Phone first. */
.bb-wrap { max-width: 1100px; margin: 0 auto; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.75rem; }
.bb-note { color: var(--text-muted); }
.bb-bar { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; }
.bb-bar .btn { min-height: 44px; }
.bb-cols { display: flex; flex-direction: column; gap: 0.75rem; }
.bb-main { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.bb-side { display: flex; flex-direction: column; gap: 0.75rem; }
.bb-card {
    padding: 0.75rem 1rem; background: var(--bg-card); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.bb-fields { display: grid; grid-template-columns: 1fr; gap: 0.6rem; }
.bb-fields label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; color: var(--text-muted); }
.bb-fields input, .bb-fields textarea { min-height: 44px; font-size: 1rem; width: 100%; box-sizing: border-box; }
.bb-warn { margin: 0; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); background: var(--warning-soft); color: var(--text); font-size: 0.9rem; }
.bb-flag { margin: 0.5rem 0 0; color: var(--danger); font-size: 0.9rem; }

/* The Shopify customer and the Send card (#3424). */
.bb-customer { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.bb-customer-box { position: relative; }
.bb-customer-note { color: var(--text-muted); font-size: 0.8rem; overflow-wrap: anywhere; }
.bb-add-customer { color: var(--accent); }
.bb-muted { color: var(--text-muted); cursor: default; }
.bb-send-head { margin: 0 0 0.5rem; font-size: 1rem; }
.bb-send .bb-note { margin: 0 0 0.5rem; font-size: 0.85rem; }
.bb-send-btns { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.bb-send-btns .btn { min-height: 44px; flex: 1 1 auto; }
.bb-sent { margin: 0.6rem 0 0; padding-left: 1.1rem; font-size: 0.85rem; color: var(--text-muted); }

.bb-slot {
    display: flex; flex-direction: column; gap: 0.4rem; padding: 0.6rem 0.75rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
}
.bb-slot-set { border-left: 4px solid var(--success); }
.bb-slot-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.bb-slot-name { font-weight: 600; color: var(--text-strong); }
.bb-search { width: 100%; min-height: 44px; font-size: 1rem; box-sizing: border-box; }
.bb-picked { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.bb-picked-name { flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere; }
.bb-sub { display: block; color: var(--text-muted); font-size: 0.8rem; }
.bb-picked-prices { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; }
.bb-qty { display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; color: var(--text-muted); }
.bb-qty input { width: 4rem; min-height: 44px; font-size: 1rem; }
.bb-clear { min-height: 44px; }

.bb-results { display: flex; flex-direction: column; gap: 0.25rem; max-height: 22rem; overflow-y: auto; }
.bb-results:empty { display: none; }
.bb-result {
    display: flex; align-items: center; gap: 0.6rem; text-align: left; min-height: 44px;
    padding: 0.5rem 0.75rem; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
/* The photo square on the left (shared .part-thumb, #3442), the words beside it. */
.bb-result-body { display: flex; flex-direction: column; gap: 0.1rem; flex: 1; min-width: 0; }
.bb-result:hover, .bb-result:focus-visible { background: var(--bg-hover); }
.bb-result-name { font-weight: 600; overflow-wrap: anywhere; }
.bb-result-meta, .bb-result-prices { color: var(--text-muted); font-size: 0.85rem; }
.bb-stock.bb-in { color: var(--success); font-weight: 600; }
.bb-stock.bb-out { color: var(--danger); }

/* Slot pictures (#3415): the part, muted at rest and green once a part is picked. */
.bb-slot-name { display: inline-flex; align-items: center; gap: 0.6rem; }
.bb-icon { width: 40px; height: 40px; flex: none; color: var(--text-muted); }
.bb-slot-set .bb-icon { color: var(--success); }

/* The frame card and the head tube measurement. */
.bb-frame > summary, .bb-rules > summary { cursor: pointer; font-weight: 600; color: var(--text-strong); min-height: 44px; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.bb-frame .bb-fields select:not(.pick-select) { min-height: 44px; font-size: 1rem; width: 100%; box-sizing: border-box; }
/* The sizing dropdowns (pick.js) read like the card's other labels. */
.bb-fields .pick-label { font-size: 0.85rem; font-weight: 400; letter-spacing: 0; text-transform: none; }
.bb-fields .pick-btn, .bb-fields .pick-opt { font-size: 1rem; }
.bb-measure { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; min-width: 0; }
.bb-measure legend { padding: 0 0.3rem; color: var(--text-muted); font-size: 0.85rem; }
.bb-measure-result { grid-column: 1 / -1; font-size: 0.9rem; }
.bb-measure-result .btn { min-height: 44px; margin-left: 0.25rem; }
.bb-draft { display: block; color: var(--text-muted); }

/* A slot's results in bands. Fits has the green edge, Size not stated the amber, Doesn't fit is folded. */
.bb-matching { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.bb-chip { display: inline-block; margin: 0 0.25rem 0.25rem 0; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--bg-hover); color: var(--text); }
.bb-band-title, .bb-band-no > summary { margin: 0.4rem 0 0.2rem; font-size: 0.95rem; font-weight: 600; color: var(--text-strong); }
.bb-band-no > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--text-muted); }
.bb-count { margin-left: 0.3rem; padding: 0 0.45rem; border-radius: 999px; background: var(--bg-hover); font-weight: 400; font-size: 0.8rem; }
.bb-band .bb-result, .bb-band-no .bb-result { width: 100%; box-sizing: border-box; margin-bottom: 0.25rem; }
.bb-frame .bb-note { margin: 0.25rem 0 0.6rem; }
.bb-result-fit { border-left: 4px solid var(--success); }
.bb-result-unknown { border-left: 4px solid var(--warning); }
.bb-result-no { border-left: 4px solid var(--border); opacity: 0.8; }
.bb-why { color: var(--text-muted); font-size: 0.85rem; }
.bb-why-fit { color: var(--text); }   /* a fit's note: what it needs, e.g. a spacer (#3461) */

/* The fit rules on the list page. */
.bb-rules h4 { margin: 0.75rem 0 0.35rem; font-size: 0.95rem; }
.bb-rule-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; }
.bb-rules select, .bb-rules .btn { min-height: 44px; }
.bb-rules select { width: auto; min-width: 7rem; }
.bb-checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-bottom: 0.75rem; }
.bb-check { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px; }

.bb-extra { display: flex; gap: 0.5rem; }
.bb-extra input { flex: 1 1 auto; min-width: 0; min-height: 44px; font-size: 1rem; }
.bb-extra .btn { min-height: 44px; }

.bb-sums { display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 1rem; margin: 0; }
.bb-sums dt { color: var(--text-muted); }
.bb-sums dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.bb-sums .bb-big { font-size: 1.2rem; font-weight: 700; color: var(--text-strong); }

.bb-table .bb-row { cursor: pointer; }
.bb-table .btn { min-height: 44px; }
/* Six short columns: drop the shared 900px table minimum so Delete stays in the box (#3413). */
.bb-table.data-table { min-width: 0; }
.bb-table td.bb-c-title, .bb-table td.bb-c-cust { max-width: 15rem; white-space: normal; overflow-wrap: anywhere; }

/* Phone: each saved build stacks as a card, Delete on its own line at the right. */
@media (max-width: 640px) {
    .bb-table thead { display: none; }
    .bb-table, .bb-table tbody { display: block; width: 100%; }
    .bb-table .bb-row {
        display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.15rem 0.75rem;
        grid-template-areas: "title quote" "cust margin" "date act";
        align-items: center; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border);
    }
    .bb-table .bb-row td { display: block; padding: 0; border: 0; }
    .bb-table .bb-c-title { grid-area: title; font-weight: 600; color: var(--text-strong); }
    .bb-table .bb-c-cust { grid-area: cust; }
    .bb-table .bb-c-quote { grid-area: quote; font-weight: 600; }
    .bb-table .bb-c-margin { grid-area: margin; }
    .bb-table .bb-c-margin::before { content: "Margin "; color: var(--text-muted); }
    .bb-table .bb-c-date { grid-area: date; color: var(--text-muted); font-size: 0.85rem; }
    .bb-table .bb-c-act { grid-area: act; }
    .bb-table .bb-c-quote, .bb-table .bb-c-margin, .bb-table .bb-c-act { justify-self: end; }
}

@media (min-width: 900px) {
    .bb-cols { flex-direction: row; align-items: flex-start; }
    .bb-main { flex: 1 1 auto; }
    .bb-side { flex: 0 0 22rem; position: sticky; top: 0.75rem; }
    .bb-fields { grid-template-columns: 1fr 1fr; }
    .bb-fields .bb-wide { grid-column: 1 / -1; }
}

/* Templates (#3416): the saved templates card on the list, and the note on a sheet started from one. */
.bb-templates > summary { cursor: pointer; font-weight: 600; color: var(--text-strong); min-height: 44px; display: flex; align-items: center; gap: 0.5rem; }
.bb-tpl { border-top: 1px solid var(--border); padding: 0.75rem 0; }
.bb-tpl:first-child { border-top: 0; }
.bb-tpl-head { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: baseline; }
.bb-tpl-slots { margin: 0.4rem 0 0.6rem; padding-left: 1.1rem; font-size: 0.9rem; }
.bb-tpl-btns { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.bb-tpl-btns .btn, .bb-tpl-choice { min-height: 44px; }
.bb-tpl-pick { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.5rem 0; }
.bb-tpl-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; text-align: left; width: 100%; }
.bb-tpl-note { margin: 0; font-size: 0.9rem; }
.bb-tpl-flag { margin: 0.25rem 0; }
.bb-bar-btns { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }
