/* Step-by-step quote form + popup (Website Factory shared engine).
   Append to a site's CSS, then set the --sf-* tokens to the brand in a :root block AFTER this.
   Every class is q-prefixed so it can never clash with the site's own styles (.chip, .field, .card...). */
:root {
  --sf-head: #1f2937;        /* header band */
  --sf-head-ink: #e5e7eb;
  --sf-accent: #f97316;      /* progress, selected tiles */
  --sf-accent-on: #fff;
  --sf-accent-soft: #fff4ec;
  --sf-btn: #c2410c;         /* submit / continue */
  --sf-btn-ink: #fff;
  --sf-ink: #111827;
  --sf-muted: #6b7280;
  --sf-line: #d9dee5;
  --sf-soft: #f3f5f7;
  --sf-radius: 18px;
  --sf-tile-radius: 12px;
  --sf-pill: 999px;
  --sf-font: inherit;
  --sf-title-font: inherit;
  --sf-title-weight: 700;
  --sf-title-transform: none;
  --sf-title-style: normal;
}
.qmodal { border: 0; padding: 0; background: transparent; width: min(580px, calc(100% - 24px)); max-width: none; max-height: calc(100dvh - 24px); overflow: visible; color: var(--sf-ink); }
.qmodal::backdrop { background: rgba(10, 14, 20, .62); backdrop-filter: blur(3px); }
.qmodal[open] { animation: qpop .22s ease-out; }
@keyframes qpop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.qwrap { max-height: calc(100dvh - 24px); overflow: auto; border-radius: var(--sf-radius); }
.qform { position: relative; background: #fff; border-radius: var(--sf-radius); padding: 0 0 18px; box-shadow: 0 30px 70px -20px rgba(0,0,0,.5); overflow: hidden; text-align: left; font-family: var(--sf-font); font-size: 16px; line-height: 1.5; color: var(--sf-ink); }
.qform *, .qform *::before, .qform *::after { box-sizing: border-box; }
.qform [hidden] { display: none !important; }
.qform svg { width: 1.1em; height: 1.1em; flex: none; }
.qform p, .qform label, .qform li { color: inherit; }
.qclose { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--sf-head), #fff 16%); color: #fff; font: 400 1.6rem/1 system-ui, sans-serif; cursor: pointer; z-index: 2; display: grid; place-items: center; padding: 0; }
.qclose:hover { background: color-mix(in srgb, var(--sf-head), #fff 30%); }
[data-qform-inline] .qclose { display: none !important; }
.qhead { display: flex; gap: 14px; align-items: center; background: var(--sf-head); color: var(--sf-head-ink); padding: 22px 60px 16px 24px; }
.qhead img { width: 46px; height: 46px; object-fit: contain; flex: none; }
.qform .qhead h2 { color: #fff; font-family: var(--sf-title-font); font-weight: var(--sf-title-weight); text-transform: var(--sf-title-transform); font-style: var(--sf-title-style); font-size: 1.35rem; line-height: 1.15; margin: 0 0 3px; letter-spacing: 0; }
.qform .qhead p { margin: 0; font-size: .85rem; line-height: 1.4; color: var(--sf-head-ink); }
.qsteps { list-style: none; margin: 0; padding: 4px 24px 18px; background: var(--sf-head); display: flex; justify-content: space-between; position: relative; }
.qsteps::before { content: ""; position: absolute; left: 46px; right: 46px; top: 19px; height: 2px; background: rgba(255,255,255,.2); }
.qsteps::after { content: ""; position: absolute; left: 46px; top: 19px; height: 2px; background: var(--sf-accent); width: calc((100% - 92px) * var(--p, 0)); transition: width .3s; }
.qsteps li { position: relative; z-index: 1; display: grid; justify-items: center; gap: 4px; font-size: .72rem; color: rgba(255,255,255,.6); width: 44px; white-space: nowrap; text-align: center; line-height: 1.2; margin: 0; padding: 0; }
.qsteps li::before, .qsteps li::marker { content: none; }
.qsteps b { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--sf-head); border: 2px solid rgba(255,255,255,.3); color: #fff; font-size: .8rem; transition: .2s; }
.qsteps li.on { color: #fff; }
.qsteps li.on b { background: var(--sf-accent); border-color: var(--sf-accent); color: var(--sf-accent-on); }
.qsteps li.done b { background: #fff; border-color: #fff; color: var(--sf-head); }
.qstep { border: 0; margin: 0; padding: 22px 24px 4px; min-width: 0; }
.qform .qstep legend { float: left; width: 100%; font-family: var(--sf-title-font); font-weight: var(--sf-title-weight); text-transform: var(--sf-title-transform); font-style: var(--sf-title-style); font-size: 1.25rem; line-height: 1.25; color: var(--sf-ink); margin: 0 0 14px; padding: 0; letter-spacing: 0; }
.qstep legend + * { clear: both; }
.qstep.is-in { animation: qin .25s ease-out; }
@keyframes qin { from { opacity: 0; transform: translateX(16px); } }

/* Answer cards: every card in a set is the same size, media is the same size and sits at the same height */
.qtiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 10px; }
.qtiles--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.qtiles--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.qtiles--list { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
.qtile { position: relative; cursor: pointer; display: block; margin: 0; min-width: 0; }
.qtile input, .qchip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.qtile > span { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; text-align: center; gap: 2px; padding: 16px 8px 14px; border: 1.5px solid var(--sf-line); border-radius: var(--sf-tile-radius); background: #fff; transition: border-color .15s, background .15s; height: 100%; }
.qtile .qmedia { width: 54px; height: 54px; flex: none; display: grid; place-items: center; margin-bottom: 8px; border-radius: 50%; background: var(--sf-soft); color: var(--sf-head); overflow: hidden; }
.qtile .qmedia svg { width: 26px; height: 26px; }
.qtile .qmedia img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qtile b { font-size: .9rem; color: var(--sf-ink); line-height: 1.25; font-weight: 700; }
.qtile small { font-size: .75rem; color: var(--sf-muted); line-height: 1.3; }
.qtiles--list .qtile > span { display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; justify-items: start; text-align: left; column-gap: 14px; row-gap: 0; padding: 12px 14px; }
.qtiles--list .qtile .qmedia { width: 44px; height: 44px; margin: 0; grid-row: 1 / span 2; }
.qtiles--list .qtile .qmedia svg { width: 22px; height: 22px; }
.qtiles--list .qtile b { align-self: end; }
.qtiles--list .qtile small { align-self: start; }
.qtile:hover > span { border-color: var(--sf-accent); }
.qtile input:checked + span { border-color: var(--sf-accent); background: var(--sf-accent-soft); box-shadow: 0 0 0 2px var(--sf-accent) inset; }
.qtile input:checked + span .qmedia { background: #fff; box-shadow: 0 0 0 2px var(--sf-accent); }
.qtile input:focus-visible + span, .qchip input:focus-visible + span { outline: 3px solid var(--sf-accent); outline-offset: 2px; }
.qform .qhint { text-align: center; font-size: .8rem; color: var(--sf-muted); margin: 12px 0 0; }
.qform .qhint.warn { color: #B42318; font-weight: 600; }
.qform .qsub { font-weight: 600; color: var(--sf-ink); margin: 18px 0 8px; font-size: .95rem; }
.qform .qsub--first { margin-top: 0; }
.qchips + .qhint { text-align: left; margin-top: 8px; }
.qsub small, .qform label small { color: var(--sf-muted); font-weight: 400; }
.qchips { display: flex; flex-wrap: wrap; gap: 8px; }
.qchip { position: relative; cursor: pointer; margin: 0; display: inline-flex; }
.qchip span { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1.5px solid var(--sf-line); border-radius: var(--sf-pill); font-size: .86rem; font-weight: 500; background: #fff; color: var(--sf-ink); white-space: nowrap; }
.qchip span::before { content: "+"; color: var(--sf-btn); font-weight: 700; }
.qchip input:checked + span { background: var(--sf-head); border-color: var(--sf-head); color: #fff; }
.qchip input:checked + span::before { content: "✓"; color: #fff; }

/* Text fields */
.qfield { display: grid; gap: 6px; margin: 0 0 14px; }
.qfield label { font-weight: 600; font-size: .88rem; color: var(--sf-ink); }
.qfield input, .qfield select, .qfield textarea { width: 100%; min-height: 48px; padding: 11px 14px; border: 1.5px solid var(--sf-line); border-radius: var(--sf-tile-radius); font: inherit; font-size: 1rem; color: var(--sf-ink); background: #fff; margin: 0; }
.qfield textarea { min-height: 76px; resize: vertical; }
.qfield input:focus, .qfield select:focus, .qfield textarea:focus { border-color: var(--sf-head); outline: 3px solid color-mix(in srgb, var(--sf-accent) 35%, transparent); outline-offset: 0; }
.qrow2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qerr { color: #B42318; font-size: .8rem; display: none; }
.qfield.bad .qerr { display: block; }
.qfield.bad input, .qfield.bad select { border-color: #B42318; }

/* Buttons */
.qnav { display: flex; gap: 10px; margin-top: 18px; }
.qnav .qgo { flex: 1; }
.qgo { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 52px; padding: 0 22px; border: 0; border-radius: var(--sf-pill); background: var(--sf-btn); color: var(--sf-btn-ink); font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none; }
.qgo:hover { filter: brightness(.92); }
.qback { min-height: 52px; padding: 0 18px; border-radius: var(--sf-pill); border: 1.5px solid var(--sf-line); background: #fff; color: var(--sf-ink); font: inherit; font-weight: 500; font-size: .92rem; cursor: pointer; }
.qback:hover { border-color: var(--sf-head); }
.qskip { display: block; margin: 12px auto 0; background: none; border: 0; color: var(--sf-muted); text-decoration: underline; font: inherit; font-size: .85rem; cursor: pointer; }
.qform .qtip { display: flex; gap: 10px; align-items: flex-start; font-size: .84rem; line-height: 1.45; color: var(--sf-ink); background: var(--sf-soft); border-radius: var(--sf-tile-radius); padding: 10px 12px; margin: 14px 0 0; }
.qtip svg { width: 18px; height: 18px; color: var(--sf-btn); margin-top: 1px; }
.qtip a { color: var(--sf-btn); font-weight: 700; }
.qform .qsend-err { color: #B42318; font-size: .85rem; font-weight: 600; margin: 10px 0 0; text-align: center; }
.qform .qsend-err a { color: inherit; }
.qform .qconsent { font-size: .74rem; line-height: 1.4; color: var(--sf-muted); margin: 12px 0 0; text-align: center; }
.qtrust { display: flex; justify-content: center; gap: 16px; font-size: .78rem; color: var(--sf-muted); padding: 14px 0 0; border-top: 1px solid var(--sf-line); margin: 18px 24px 0; }
.qtrust span { display: inline-flex; gap: 5px; align-items: center; }
.qtrust svg { width: 14px; height: 14px; color: var(--sf-head); }

/* Thank-you screen */
.qsuccess { display: none; }
.qform.q-sent > *:not(.qsuccess):not(.qhead):not(.qclose) { display: none !important; }
.qform.q-sent .qsuccess { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; gap: 4px; padding: 26px 24px 8px; }
.qok { width: 64px; height: 64px; border-radius: 50%; background: var(--sf-accent); color: var(--sf-accent-on); display: grid; place-items: center; margin-bottom: 8px; }
.qok svg { width: 30px; height: 30px; }
.qform .qsuccess h3 { margin: 0; color: var(--sf-ink); font-family: var(--sf-title-font); font-weight: var(--sf-title-weight); text-transform: var(--sf-title-transform); font-style: var(--sf-title-style); font-size: 1.4rem; }
.qform .qsuccess p { margin: 0; }
.qsummary { list-style: none; padding: 14px 16px; margin: 12px 0 16px; background: var(--sf-soft); border-radius: var(--sf-tile-radius); width: 100%; text-align: left; font-size: .88rem; display: grid; gap: 4px; }
.qsummary li { margin: 0; padding: 0; }
.qsummary li::before { content: none; }
.qsummary b { color: var(--sf-ink); }
.qsuccess .qgo { white-space: normal; text-align: center; max-width: 100%; }
.qform .qnum { white-space: nowrap; }
.qsuccess .qactions { display: grid; gap: 10px; width: 100%; max-width: 360px; }
.qsuccess .qgo--wa { background: #128C4A; }
.qsuccess .qgo--line { background: #fff; color: var(--sf-ink); border: 1.5px solid var(--sf-line); }
[data-qform-inline] .qform { box-shadow: var(--shadow, 0 14px 34px -16px rgba(0,0,0,.35)); }
body.qm-open { overflow: hidden; }

@media (max-width: 560px) {
  .qmodal { width: 100%; max-height: 100dvh; height: 100dvh; margin: 0; }
  .qwrap { max-height: 100dvh; height: 100dvh; border-radius: 0; background: #fff; }
  .qmodal .qform { border-radius: 0; min-height: 100%; box-shadow: none; }
  .qhead { padding: 18px 56px 14px 18px; }
  .qhead h2 { font-size: 1.15rem; }
  .qstep { padding: 18px 18px 4px; }
  .qtrust { margin-inline: 18px; gap: 10px; flex-wrap: wrap; }
  .qtiles, .qtiles--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qtiles--3m { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .qtiles--list { grid-template-columns: minmax(0, 1fr); }
  .qsteps { padding-inline: 12px; }
  .qsteps::before, .qsteps::after { left: 34px; }
  .qsteps::before { right: 34px; }
  .qsteps::after { width: calc((100% - 68px) * var(--p, 0)); }
  .qsteps li { font-size: .64rem; }
  .qrow2 { grid-template-columns: 1fr; gap: 0; }
}
