/* ============================================================
   HANDLE BAR ROOFING — Quote Builder (live configurator)
   Everything is scoped under .qb so it can't collide with styles.css.
   ============================================================ */

.quote-section {
    background: var(--dark-2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.qb {
    --qb-panel: #161616;
    --qb-panel-2: #1d1d1d;
    --qb-line: #2c2a29;
    --qb-line-strong: #3b3836;
    --qb-red-hot: #e0503f;
    --qb-red-wash: rgba(var(--primary-rgb), 0.14);
    --qb-ok: #3fae6a;
    --qb-warn: #e8a33d;
    --qb-display: 'Barlow Condensed', 'Barlow', 'Arial Narrow', sans-serif;
    color: var(--text);
    font-size: 16px;
    line-height: 1.55;
}

.qb *, .qb *::before, .qb *::after { box-sizing: border-box; }
.qb h2, .qb h3 { margin: 0; color: var(--heading); line-height: 1.15; }
.qb p { margin: 0; }
.qb button, .qb input, .qb select, .qb textarea { font: inherit; color: inherit; }
.qb :focus-visible { outline: 2px solid var(--qb-red-hot); outline-offset: 2px; }

.qb-shell { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; align-items: start; }

/* ---------- preview stage ---------- */
.qb-stage { position: sticky; top: 110px; border-radius: 14px; overflow: hidden; border: 1px solid var(--qb-line); background: var(--qb-panel); }
.qb-photo { aspect-ratio: 16 / 11; max-width: 100%; background: #1b1b1b center / cover no-repeat; position: relative; }
.qb-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.85) 100%); }
.qb-photo.empty { background: repeating-linear-gradient(135deg, #191919 0 14px, #1d1d1d 14px 28px); }
.qb-photo .qb-q { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--qb-display); font-size: 72px; font-weight: 800; color: var(--text-muted); }
.qb-over { position: absolute; left: 20px; right: 20px; bottom: 18px; z-index: 1; display: grid; gap: 6px; }
.qb-over .k { font-family: var(--qb-display); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 13px; color: #ffb3aa; }
.qb-over h3 { font-family: var(--qb-display); font-weight: 800; font-size: clamp(28px, 4vw, 42px); text-transform: uppercase; color: #fff; }
.qb-flag { position: absolute; z-index: 1; right: 14px; top: 14px; background: var(--qb-warn); color: #1a1205; font-weight: 800; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding: 5px 10px; border-radius: 4px; }
.qb-specs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--qb-line); }
.qb-specs div { padding: 12px 14px; border-right: 1px solid var(--qb-line); display: grid; gap: 2px; min-width: 0; }
.qb-specs div:last-child { border-right: 0; }
.qb-specs span { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.qb-specs b { color: var(--heading); font-size: 15px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.qb-stage-foot { padding: 12px 14px; border-top: 1px solid var(--qb-line); font-size: 14px; color: var(--text-muted); }
.qb-stage-foot a { color: var(--heading); font-weight: 700; }

/* ---------- control panel ---------- */
.qb-panel { display: grid; gap: 10px; }
.qb-group { border: 1px solid var(--qb-line); border-radius: 12px; background: var(--qb-panel); }
.qb-hint { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-light); background: var(--qb-panel); border: 1px dashed var(--qb-line-strong); border-radius: 10px; padding: 10px 14px; }
.qb-hint i { color: var(--primary); margin-top: 3px; }
.qb-hint strong { color: var(--heading); }
.qb-group { transition: border-color .2s; }
.qb-group:hover { border-color: var(--qb-line-strong); }
.qb-group.open { border-color: var(--primary); }
.qb-ghead { width: 100%; background: none; border: 0; padding: 14px 16px; cursor: pointer; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; text-align: left; border-radius: 12px; }
.qb-gtext { display: grid; gap: 1px; min-width: 0; }
.qb-gaction { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--heading); border: 1px solid var(--qb-line-strong); border-radius: 999px; padding: 5px 12px; white-space: nowrap; transition: background .2s, border-color .2s; }
.qb-ghead:hover .qb-gaction { border-color: var(--primary); background: var(--qb-red-wash); }
.qb-group.open .qb-gaction { background: var(--qb-panel-2); }
.qb-missing { font-size: 14px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; }
.qb-missing.ready { color: var(--qb-ok); font-weight: 600; }
.qb-num { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--qb-line-strong); display: grid; place-items: center; font-family: var(--qb-display); font-weight: 700; color: var(--text-muted); }
.qb-group.filled .qb-num { background: var(--primary); border-color: var(--primary); color: #fff; }
.qb-gt { font-weight: 700; color: var(--heading); }
.qb-gv { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qb-group.filled .qb-gv { color: var(--text-light); }
.qb-gbody { padding: 0 16px 16px; display: grid; gap: 20px; }

.qb-prop { display: grid; grid-template-columns: 1fr 1fr; background: var(--qb-panel-2); border: 1px solid var(--qb-line); border-radius: 999px; padding: 4px; gap: 4px; }
.qb-prop button { border: 0; background: transparent; border-radius: 999px; padding: 10px 16px; cursor: pointer; font-weight: 700; color: var(--text-muted); display: flex; align-items: center; justify-content: center; gap: 8px; transition: background .2s, color .2s; }
.qb-prop button[aria-pressed="true"] { background: var(--primary); color: #fff; }

.qb-q-block { display: grid; gap: 10px; }
.qb-label { font-weight: 700; color: var(--heading); }
.qb-label .opt { font-weight: 400; color: var(--text-muted); font-size: 14px; }
.qb-help { color: var(--text-muted); font-size: 14px; }

.qb-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.qb-pill { border: 1px solid var(--qb-line-strong); background: var(--qb-panel-2); border-radius: 999px; padding: 8px 14px; cursor: pointer; font-weight: 500; transition: border-color .15s, background .15s; }
.qb-pill:hover { border-color: var(--text-muted); }
.qb-pill[aria-pressed="true"] { border-color: var(--primary); background: var(--qb-red-wash); color: var(--heading); }
.qb-checks .qb-pill::before { content: "+ "; color: var(--text-muted); }
.qb-checks .qb-pill[aria-pressed="true"]::before { content: "\2713  "; color: var(--qb-red-hot); }

.qb-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.qb-chip { border: 1px solid var(--qb-line); border-radius: 8px; background: var(--qb-panel-2); overflow: hidden; padding: 0; cursor: pointer; text-align: left; transition: border-color .2s; }
.qb-chip:hover { border-color: var(--qb-line-strong); }
.qb-chip .ph { aspect-ratio: 3 / 2; max-width: 100%; background: #222 center / cover no-repeat; }
.qb-chip .ph.unsure { display: grid; place-items: center; background: #202020; font-family: var(--qb-display); font-weight: 800; font-size: 26px; color: var(--text-muted); }
.qb-chip span { display: block; padding: 6px 8px; font-size: 13px; font-weight: 600; color: var(--heading); }
.qb-chip[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }

.qb-range-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.qb-range-val { font-family: var(--qb-display); font-weight: 700; font-size: 26px; color: var(--heading); font-variant-numeric: tabular-nums; }
.qb-range-val small { font-family: inherit; font-size: 14px; font-weight: 500; color: var(--text-muted); }
.qb input[type="range"] { width: 100%; accent-color: var(--primary); }
.qb-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.qb-squares { display: inline-flex; align-items: baseline; gap: 8px; flex-wrap: wrap; background: var(--qb-panel-2); border: 1px dashed var(--qb-line-strong); border-radius: 8px; padding: 8px 12px; font-size: 14px; color: var(--text-muted); }
.qb-squares b { font-family: var(--qb-display); font-size: 22px; color: var(--heading); font-variant-numeric: tabular-nums; }

.qb-hail { border: 1px solid var(--qb-line); border-radius: 10px; background: var(--qb-panel-2); display: grid; grid-template-columns: 130px minmax(0, 1fr); overflow: hidden; }
.qb-hail.on { border-color: var(--qb-warn); }
.qb-hail-ph { background: center / cover no-repeat; min-height: 100%; }
.qb-hail-in { padding: 14px; display: grid; gap: 16px; }
.qb-callout { font-size: 14px; background: rgba(232, 163, 61, .1); border-left: 3px solid var(--qb-warn); padding: 8px 12px; border-radius: 0 6px 6px 0; }

.qb-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.qb-fields .full { grid-column: 1 / -1; }
.qb-field { display: grid; gap: 6px; }
.qb-field label { font-size: 14px; font-weight: 600; }
.qb-field input, .qb-field select, .qb-field textarea { background: var(--qb-panel-2); border: 1px solid var(--qb-line-strong); border-radius: 8px; padding: 11px 12px; width: 100%; min-width: 0; }
.qb-field input:focus, .qb-field select:focus, .qb-field textarea:focus { border-color: var(--primary); outline: none; }
.qb-field input::placeholder, .qb-field textarea::placeholder { color: #666; }
.qb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.qb-err { color: var(--qb-red-hot); font-size: 14px; font-weight: 600; }
.qb-send { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 6px; }
.qb-btn { border: 0; border-radius: 8px; padding: 13px 22px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.qb-btn[disabled] { opacity: .45; cursor: not-allowed; }
.qb-btn-red { background: var(--primary); color: #fff; }
.qb-btn-red:hover { background: var(--qb-red-hot); }
.qb-btn-ghost { background: transparent; border: 1px solid var(--qb-line-strong); color: var(--text); }
.qb-btn-ghost:hover { border-color: var(--text-muted); }

.qb-done { border: 1px solid var(--qb-ok); background: rgba(63, 174, 106, .08); border-radius: 14px; padding: 26px; display: grid; gap: 14px; max-width: 720px; margin: 0 auto; }
.qb-done h3 { font-family: var(--qb-display); font-size: 30px; text-transform: uppercase; }
.qb-sum { display: grid; margin: 0; }
.qb-sum div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--qb-line); font-size: 14px; }
.qb-sum div:last-child { border-bottom: 0; }
.qb-sum dt { color: var(--text-muted); }
.qb-sum dd { margin: 0; color: var(--heading); font-weight: 600; overflow-wrap: anywhere; }

.qb-credits { margin-top: 22px; font-size: 12px; color: var(--text-muted); }
.qb-credits summary { cursor: pointer; }
.qb-credits ul { margin: 8px 0 0; padding-left: 18px; columns: 2; column-gap: 28px; }
.qb-credits a { color: var(--text-light); }

@media (max-width: 1024px) {
    .qb-shell { grid-template-columns: 1fr; }
    .qb-stage { position: static; }
}
@media (max-width: 560px) {
    .qb-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .qb-specs div:nth-child(2) { border-right: 0; }
    .qb-specs div:nth-child(-n+2) { border-bottom: 1px solid var(--qb-line); }
    .qb-fields { grid-template-columns: 1fr; }
    .qb-hail { grid-template-columns: 1fr; }
    .qb-hail-ph { min-height: 110px; }
    .qb-credits ul { columns: 1; }
}
@media (prefers-reduced-motion: reduce) { .qb * { transition: none !important; } }
