/*
 * Instant quote — styles. Everything is scoped under .iq.
 * Theming: override any --iq-* property on `.iq` (or a more specific selector) from the host.
 * Defaults fall back to the host site's tokens (--bg, --surface, --text, --primary, … from
 * site/assets/styles.css) when present, otherwise to the neutral values below.
 * Dark mode: prefers-color-scheme (unless [data-theme="light"] on <html>) or [data-theme="dark"].
 */
:where(.iq) {
  --iq-bg: var(--bg, #F6F5F2);
  --iq-surface: var(--surface, #FFFFFF);
  --iq-surface-2: var(--surface-2, #EEECE7);
  --iq-line: var(--line, #D9D6CF);
  --iq-text: var(--text, #14171A);
  --iq-text-2: var(--text-2, #4A5058);
  --iq-accent: var(--primary, #C2410C);
  --iq-accent-hover: var(--primary-hover, #A8380A);
  --iq-accent-ink: var(--primary-ink, #FFFFFF);
  --iq-accent-soft: var(--primary-soft, #FBE7DC);
  --iq-ok: var(--ok, #1F7A4D);
  --iq-warn: var(--warn, #A15C00);
  --iq-err: var(--err, #B42318);
  --iq-stage-bg: radial-gradient(120% 90% at 50% 15%, #FFFFFF 0%, #E9E7E2 100%);
  --iq-font: var(--f-body, "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
  --iq-font-display: var(--f-display, var(--iq-font));
  --iq-mono: var(--f-mono, "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  --iq-radius: var(--r-md, 8px);
  --iq-radius-sm: var(--r-sm, 4px);
  --iq-focus: 0 0 0 2px var(--iq-surface), 0 0 0 5px var(--iq-accent);
  --iq-shadow: var(--shadow, 0 1px 2px rgb(0 0 0 / .06), 0 8px 24px rgb(0 0 0 / .07));
  --iq-viewer-h: clamp(280px, 52vw, 460px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :where(.iq) {
    --iq-bg: var(--bg, #0F1113);
    --iq-surface: var(--surface, #171A1D);
    --iq-surface-2: var(--surface-2, #1E2226);
    --iq-line: var(--line, #2C3136);
    --iq-text: var(--text, #ECEDEE);
    --iq-text-2: var(--text-2, #A9AFB6);
    --iq-accent: var(--primary, #F26B2A);
    --iq-accent-hover: var(--primary-hover, #FF8447);
    --iq-accent-ink: var(--primary-ink, #0F1113);
    --iq-accent-soft: var(--primary-soft, #3A2015);
    --iq-ok: var(--ok, #4CC38A);
    --iq-warn: var(--warn, #F5A524);
    --iq-err: var(--err, #F97066);
    --iq-stage-bg: radial-gradient(120% 90% at 50% 15%, #2A2F34 0%, #121417 100%);
  }
}
:root[data-theme="dark"] :where(.iq), :where(.iq[data-theme="dark"]) {
  --iq-bg: var(--bg, #0F1113);
  --iq-surface: var(--surface, #171A1D);
  --iq-surface-2: var(--surface-2, #1E2226);
  --iq-line: var(--line, #2C3136);
  --iq-text: var(--text, #ECEDEE);
  --iq-text-2: var(--text-2, #A9AFB6);
  --iq-accent: var(--primary, #F26B2A);
  --iq-accent-hover: var(--primary-hover, #FF8447);
  --iq-accent-ink: var(--primary-ink, #0F1113);
  --iq-accent-soft: var(--primary-soft, #3A2015);
  --iq-ok: var(--ok, #4CC38A);
  --iq-warn: var(--warn, #F5A524);
  --iq-err: var(--err, #F97066);
  --iq-stage-bg: radial-gradient(120% 90% at 50% 15%, #2A2F34 0%, #121417 100%);
}

.iq {
  container-type: inline-size;
  font-family: var(--iq-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--iq-text);
  -webkit-font-smoothing: antialiased;
}
.iq *, .iq *::before, .iq *::after { box-sizing: border-box; }
.iq [hidden] { display: none !important; }
.iq-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.iq__mono { font-family: var(--iq-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.iq__muted { color: var(--iq-text-2); margin: 0; }
.iq__fine { color: var(--iq-text-2); font-size: 13px; margin: 8px 0 0; }
.iq__center { text-align: center; margin: 12px 0 0; }
.iq__h { font-family: var(--iq-font-display); font-size: 18px; line-height: 1.3; font-weight: 700; margin: 0; }
.iq__h:focus { outline: none; }
.iq__label { display: block; font-family: var(--iq-mono); font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--iq-text-2); margin: 0 0 8px; padding: 0; }

/* layout */
.iq__layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 860px) {
  .iq__layout { grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); gap: 24px; align-items: start; }
  .iq__panel { position: sticky; top: 16px; }
}
.iq__stage, .iq__panel { min-width: 0; }
.iq__panel { background: var(--iq-surface); border: 1px solid var(--iq-line); border-radius: var(--iq-radius); padding: 20px; box-shadow: var(--iq-shadow); }
@container (max-width: 420px) { .iq__panel { padding: 16px; } }

/* drop zone */
.iq__drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center;
  min-height: var(--iq-viewer-h); padding: 32px 20px;
  border: 1.5px dashed var(--iq-line); border-radius: var(--iq-radius);
  background: var(--iq-surface);
  background-image: linear-gradient(var(--iq-surface-2) 1px, transparent 1px), linear-gradient(90deg, var(--iq-surface-2) 1px, transparent 1px);
  background-size: 24px 24px;
  transition: border-color .15s, background-color .15s;
}
.iq--drag .iq__drop, .iq--drag .iq__viewer { border-color: var(--iq-accent); background-color: var(--iq-accent-soft); }
.iq__drop-icon { width: 44px; height: 44px; color: var(--iq-text-2); }
.iq__drop-title { font-family: var(--iq-font-display); font-size: 20px; font-weight: 700; line-height: 1.25; margin: 0; max-width: 28ch; }
.iq__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 6px; }
.iq__form .iq__actions { justify-content: flex-start; }

/* viewer */
.iq__viewer { position: relative; border: 1px solid var(--iq-line); border-radius: var(--iq-radius); overflow: hidden; background: var(--iq-stage-bg); }
.iq__canvas-slot { position: relative; height: var(--iq-viewer-h); overflow: hidden; }
.iq__canvas { position: absolute; inset: 0; }
.iq-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.iq-canvas:active { cursor: grabbing; }
.iq-canvas:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--iq-accent); }
.iq-dim {
  position: absolute; left: 0; top: 0; pointer-events: none; white-space: nowrap;
  font-family: var(--iq-mono); font-size: 11.5px; font-variant-numeric: tabular-nums;
  padding: 2px 6px; border-radius: var(--iq-radius-sm);
  background: color-mix(in srgb, var(--iq-surface) 88%, transparent); color: var(--iq-text);
  border: 1px solid var(--iq-line); transition: opacity .15s;
}
.iq-dim--h { color: var(--iq-accent); }
.iq__nopreview { position: absolute; inset: auto 16px 50% 16px; text-align: center; }
.iq__toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between;
  padding: 8px; border-top: 1px solid var(--iq-line); background: color-mix(in srgb, var(--iq-surface) 70%, transparent);
}
.iq__tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: auto; }
.iq__chip {
  font-size: 12px; padding: 4px 8px; border-radius: var(--iq-radius-sm); max-width: 100%; min-width: 0; flex: 0 1 auto;
  background: color-mix(in srgb, var(--iq-surface) 90%, transparent); border: 1px solid var(--iq-line);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.iq__status {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 24px; text-align: center; background: color-mix(in srgb, var(--iq-surface) 82%, transparent); z-index: 2;
}
.iq__spinner { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--iq-line); border-top-color: var(--iq-accent); animation: iq-spin .8s linear infinite; }
.iq__bar { width: min(260px, 80%); height: 4px; border-radius: 2px; background: var(--iq-line); overflow: hidden; }
.iq__bar i { display: block; height: 100%; width: 0; background: var(--iq-accent); transition: width .15s; }
.iq__bar--indet i { width: 35% !important; animation: iq-indet 1.2s ease-in-out infinite; }
@keyframes iq-spin { to { transform: rotate(360deg); } }
@keyframes iq-indet { from { transform: translateX(-100%); } to { transform: translateX(290%); } }

/* alerts & notes */
.iq__alert { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--iq-radius-sm); border: 1px solid var(--iq-err); color: var(--iq-err); background: color-mix(in srgb, var(--iq-err) 8%, var(--iq-surface)); font-size: 14px; }
.iq__note { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--iq-radius-sm); border-left: 3px solid var(--iq-warn); background: color-mix(in srgb, var(--iq-warn) 9%, var(--iq-surface)); font-size: 14px; }
.iq__note p { margin: 0; }
.iq__note--err { border-left-color: var(--iq-err); background: color-mix(in srgb, var(--iq-err) 8%, var(--iq-surface)); }
.iq__note-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.iq__note-row--plain { margin-top: 12px; }
.iq__note-row--plain .iq__fine { margin: 0; }
.iq-units { display: inline-flex; border: 1px solid var(--iq-line); border-radius: var(--iq-radius-sm); overflow: hidden; background: var(--iq-surface); }
.iq-units__opt { position: relative; }
.iq-units__opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.iq-units__opt span { display: block; padding: 4px 10px; font-size: 12.5px; border-right: 1px solid var(--iq-line); }
.iq-units__opt:last-child span { border-right: 0; }
.iq-units__opt input:checked + span { background: var(--iq-text); color: var(--iq-surface); }
.iq-units__opt input:focus-visible + span { box-shadow: inset 0 0 0 2px var(--iq-accent); }

/* metrics */
.iq__metrics-wrap { margin-top: 16px; }
.iq__metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0; margin: 0; background: var(--iq-surface); border: solid var(--iq-line); border-width: 1px 0 0 1px; border-radius: var(--iq-radius-sm); overflow: hidden; }
.iq__metrics > div { padding: 8px 10px; box-shadow: inset -1px -1px 0 var(--iq-line); }
.iq__metrics dt { font-size: 12px; color: var(--iq-text-2); }
.iq__metrics dd { margin: 2px 0 0; font-size: 14px; }

/* fields */
.iq__field { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.iq__row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
@container (min-width: 520px) { .iq__row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@container (min-width: 860px) { .iq__row { grid-template-columns: minmax(0, 1fr); } }
@container (min-width: 1100px) { .iq__row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.iq-input {
  width: 100%; height: 44px; padding: 0 12px; font: inherit; color: var(--iq-text);
  background: var(--iq-surface); border: 1px solid var(--iq-line); border-radius: var(--iq-radius-sm);
}
textarea.iq-input { height: auto; padding: 10px 12px; resize: vertical; }
select.iq-input { appearance: auto; }
.iq-input:focus-visible { outline: none; border-color: var(--iq-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--iq-accent) 30%, transparent); }
.iq-input[aria-invalid="true"] { border-color: var(--iq-err); }
.iq__err { display: block; color: var(--iq-err); font-size: 13px; min-height: 0; margin-top: 4px; }
.iq__err:empty { display: none; }

/* materials */
.iq__materials { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@container (min-width: 480px) { .iq__materials { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.iq-mat {
  position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 2px 10px; align-items: start;
  padding: 10px 12px; border: 1px solid var(--iq-line); border-radius: var(--iq-radius-sm); cursor: pointer;
  background: var(--iq-surface); transition: border-color .12s, background-color .12s;
}
.iq-mat:hover { border-color: var(--iq-text-2); }
.iq-mat input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.iq-mat__swatch { grid-row: span 2; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0, var(--sw) 55%, color-mix(in srgb, var(--sw) 60%, #000) 100%); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .15); }
.iq-mat__name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.iq-mat__desc { font-size: 12.5px; color: var(--iq-text-2); line-height: 1.35; }
.iq-mat:has(input:checked) { border-color: var(--iq-accent); background: var(--iq-accent-soft); box-shadow: inset 0 0 0 1px var(--iq-accent); }
.iq-mat:has(input:focus-visible) { box-shadow: var(--iq-focus); }

/* qty */
.iq-stepper { display: flex; }
.iq-stepper .iq-input { border-radius: 0; text-align: center; border-left: 0; border-right: 0; -moz-appearance: textfield; }
.iq-stepper .iq-input::-webkit-inner-spin-button, .iq-stepper .iq-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.iq-stepper__btn { flex: 0 0 44px; height: 44px; font: 500 18px/1 var(--iq-mono); color: var(--iq-text); background: var(--iq-surface-2); border: 1px solid var(--iq-line); cursor: pointer; }
.iq-stepper__btn:first-child { border-radius: var(--iq-radius-sm) 0 0 var(--iq-radius-sm); }
.iq-stepper__btn:last-child { border-radius: 0 var(--iq-radius-sm) var(--iq-radius-sm) 0; }
.iq-stepper__btn:hover { background: var(--iq-line); }
.iq__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.iq-chip { min-width: 40px; height: 30px; padding: 0 10px; font-size: 13px; color: var(--iq-text); background: var(--iq-surface); border: 1px solid var(--iq-line); border-radius: 999px; cursor: pointer; }
.iq-chip:hover { border-color: var(--iq-text-2); }
.iq-chip[aria-pressed="true"] { background: var(--iq-text); color: var(--iq-surface); border-color: var(--iq-text); }

/* checkboxes */
.iq__opts { display: grid; gap: 6px; }
.iq-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.iq__opts .iq-check { padding: 8px 10px; border: 1px solid var(--iq-line); border-radius: var(--iq-radius-sm); }
.iq__opts .iq-check:has(input:checked) { border-color: var(--iq-accent); background: var(--iq-accent-soft); }
.iq-check input { flex: 0 0 auto; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--iq-accent); }
.iq-check > span:nth-of-type(1) { flex: 1 1 auto; min-width: 0; }
.iq-check__name { font-weight: 600; }
.iq-check__desc { color: var(--iq-text-2); font-size: 12.5px; }
.iq-check__price { flex: 0 0 auto; font-size: 12px; color: var(--iq-text-2); text-align: right; max-width: 45%; }
.iq-check--small { font-size: 12.5px; align-items: center; padding: 4px 8px; border-radius: var(--iq-radius-sm); background: color-mix(in srgb, var(--iq-surface) 90%, transparent); border: 1px solid var(--iq-line); }
.iq-check--small input { margin: 0; width: 16px; height: 16px; }
.iq-check--consent { font-size: 13px; color: var(--iq-text-2); }

/* segmented lead time */
.iq-seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.iq-seg__opt { position: relative; }
.iq-seg__opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.iq-seg__opt > span { display: flex; flex-direction: column; padding: 8px 12px; border: 1px solid var(--iq-line); border-radius: var(--iq-radius-sm); }
.iq-seg__name { font-weight: 600; font-size: 14px; }
.iq-seg__days { font-size: 12px; color: var(--iq-text-2); }
.iq-seg__opt input:checked + span { border-color: var(--iq-accent); background: var(--iq-accent-soft); box-shadow: inset 0 0 0 1px var(--iq-accent); }
.iq-seg__opt input:focus-visible + span { box-shadow: var(--iq-focus); }

/* buttons */
.iq-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; font: 600 15px/1 var(--iq-font); border-radius: var(--iq-radius); cursor: pointer;
  border: 1px solid transparent; text-decoration: none; white-space: nowrap; transition: background-color .12s, border-color .12s;
}
.iq-btn--primary { background: var(--iq-accent); color: var(--iq-accent-ink); }
.iq-btn--primary:hover { background: var(--iq-accent-hover); }
.iq-btn--secondary { background: var(--iq-surface); color: var(--iq-text); border-color: var(--iq-text); }
.iq-btn--secondary:hover { background: var(--iq-surface-2); }
.iq-btn--quiet { background: transparent; color: var(--iq-text); border-color: transparent; }
.iq-btn--quiet:hover { background: var(--iq-surface-2); }
.iq__toolbar .iq-btn--quiet { background: color-mix(in srgb, var(--iq-surface) 90%, transparent); border-color: var(--iq-line); }
.iq-btn--small { height: 32px; padding: 0 10px; font-size: 13px; font-weight: 500; border-radius: var(--iq-radius-sm); }
.iq-btn--block { width: 100%; }
.iq-btn:disabled { opacity: .5; cursor: progress; }
.iq-btn:focus-visible, .iq-btn:has(input:focus-visible), .iq-chip:focus-visible, .iq-stepper__btn:focus-visible, .iq-link:focus-visible, .iq__details summary:focus-visible { outline: none; box-shadow: var(--iq-focus); }
.iq-check input:focus-visible { outline: 2px solid var(--iq-accent); outline-offset: 2px; }
.iq-link { font: inherit; font-size: 14px; color: var(--iq-accent); background: none; border: 0; padding: 2px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; border-radius: 2px; }
.iq-link:hover { text-decoration-thickness: 2px; }

/* price card */
.iq__price { border-top: 1px solid var(--iq-line); padding-top: 18px; margin-top: 4px; }
.iq__price-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.iq__range { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 8px 0 12px; font-size: clamp(26px, 7cqi, 34px); font-weight: 500; line-height: 1.1; }
.iq__range-sep { color: var(--iq-text-2); }
.iq__kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0 0 16px; background: var(--iq-line); border: 1px solid var(--iq-line); border-radius: var(--iq-radius-sm); overflow: hidden; }
.iq__kv > div { background: var(--iq-surface); padding: 8px 10px; }
.iq__kv dt { font-size: 12px; color: var(--iq-text-2); }
.iq__kv dd { margin: 2px 0 0; font-size: 15px; }
.iq__kv small { display: block; font-size: 11.5px; color: var(--iq-text-2); }
.iq__drivers { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.iq-driver { position: relative; font-size: 13.5px; }
.iq-driver:not(:has(.iq-driver__bar)) { padding-left: 14px; }
.iq-driver:not(:has(.iq-driver__bar))::before { content: ""; position: absolute; left: 0; top: .55em; width: 6px; height: 6px; border-radius: 1px; background: var(--iq-text-2); }
.iq-driver__bar { display: block; height: 3px; width: var(--w); background: color-mix(in srgb, var(--iq-accent) 45%, transparent); border-radius: 2px; margin-bottom: 4px; }
.iq__details { margin: 0 0 12px; font-size: 13.5px; }
.iq__details summary { cursor: pointer; color: var(--iq-text-2); padding: 4px 0; border-radius: 2px; }
.iq__table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.iq__table th, .iq__table td { padding: 5px 0; border-bottom: 1px solid var(--iq-line); text-align: left; font-weight: 400; }
.iq__table td { text-align: right; white-space: nowrap; padding-left: 12px; }
.iq__table tfoot th, .iq__table tfoot td { font-weight: 600; border-bottom: 0; }
.iq__disclaimer { font-size: 13px; color: var(--iq-text-2); margin: 0 0 12px; padding: 8px 10px; border-left: 2px solid var(--iq-line); }

/* form & success */
.iq__form .iq__h { margin-bottom: 6px; }
.iq__form > .iq__muted { margin-bottom: 12px; font-size: 14px; }
.iq__summary { font-size: 12px; padding: 8px 10px; background: var(--iq-surface-2); border-radius: var(--iq-radius-sm); margin: 0 0 16px; overflow-wrap: anywhere; }
.iq__form .iq__field { margin-bottom: 14px; }
.iq__form .iq__actions { margin-top: 16px; }
.iq__success { text-align: center; padding: 24px 8px; display: grid; justify-items: center; gap: 12px; }
.iq__success p { margin: 0; max-width: 46ch; color: var(--iq-text-2); }
.iq__success-icon { width: 48px; height: 48px; color: var(--iq-ok); }

@media (prefers-reduced-motion: reduce) {
  .iq *, .iq *::before, .iq *::after { animation-duration: .01ms !important; transition: none !important; }
  .iq__spinner { animation: iq-spin 1.6s linear infinite !important; }
}
@media (forced-colors: active) {
  .iq-mat:has(input:checked), .iq-seg__opt input:checked + span, .iq-chip[aria-pressed="true"] { outline: 2px solid Highlight; }
}
