/* Quote builder · version 18
   One loud element: the navy-and-gold price readout. Everything else is quiet white cards on a
   cool concrete-gray canvas, big touch targets, and numbers that line up. */
.qb-page {
  --qb-canvas: #eef1f4;
  --qb-line: #d7dde5;
  --qb-ink: #142033;
  --qb-soft: #5a6678;
  --qb-navy: #101827;
  --qb-gold: #f4c430;
  --qb-red: #c91d32;
  --qb-radius: 14px;
}
.qb-page .qb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Header */
.qb-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; margin: 0 0 18px; }
.qb-head h2 { margin: 0; color: var(--qb-ink); font-size: 28px; line-height: 1.1; letter-spacing: -.03em; }
.qb-head .back-button { font-size: 13px; }
.qb-head .draft-indicator { margin: 0; align-self: center; padding: 6px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--qb-line); color: var(--qb-soft); font-size: 12px; font-weight: 700; }
.qb-head .draft-indicator::first-letter { color: inherit; }
.qb-offline { margin: -6px 0 16px; padding: 12px 14px; border-radius: 12px; background: #fff7dc; border: 1px solid #f1d27a; color: #5d4708; font-size: 13px; font-weight: 650; line-height: 1.45; }

/* Layout */
.quote-builder.qb { grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.qb .builder-main { gap: 0; }
.qb #quoteFields { display: grid; gap: 16px; }
.qb-card { padding: 20px; border: 1px solid var(--qb-line); border-radius: var(--qb-radius); background: #fff; }
.qb-card > h3, .qb-work-head h3 { margin: 0 0 14px; color: var(--qb-ink); font-size: 17px; letter-spacing: -.01em; }
.qb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.qb-wide { grid-column: 1 / -1; }

/* Fields: label above, 48px boxes, 16px text so iPhone doesn't zoom */
.qb-field { display: grid; align-content: start; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.qb-field > span:first-child, .qb-field > legend { padding: 0; color: #3d4a5d; font-size: 13px; font-weight: 700; }
.qb-field small { color: var(--qb-soft); font-size: 12px; line-height: 1.35; }
.qb-page .qb-field input:not([type=checkbox]):not([type=radio]), .qb-page .qb-field select, .qb-page .qb-field textarea {
  width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid #c4ccd7; border-radius: 11px; color: var(--qb-ink); background: #fff;
  font: inherit; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.qb-page .qb-field textarea { padding: 12px 13px; min-height: 72px; resize: vertical; line-height: 1.4; }
.qb-page .qb-field input:focus, .qb-page .qb-field select:focus, .qb-page .qb-field textarea:focus { border-color: #3b82f6; box-shadow: 0 0 0 4px rgba(59,130,246,.16); }
.qb-page .qb-field input:disabled, .qb-page .qb-field select:disabled { background: #f4f6f8; color: #778396; }
.qb-unit { position: relative; display: block; }
.qb-page .qb-unit input:not([type=checkbox]) { padding-right: 62px; font-variant-numeric: tabular-nums; font-weight: 700; }
.qb-page input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.qb-page input[type=number]::-webkit-inner-spin-button, .qb-page input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.qb-unit b { position: absolute; top: 50%; right: 13px; transform: translateY(-50%); color: var(--qb-soft); font-size: 13px; font-weight: 700; pointer-events: none; }

/* Work lines */
.qb-work-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 2px; }
.qb-work-head span { color: var(--qb-soft); font-size: 13px; font-weight: 700; }
.qb .line-items { display: grid; gap: 12px; }
.qb-line.line-item { padding: 0; border: 1px solid var(--qb-line); border-radius: var(--qb-radius); background: #fff; overflow: hidden; }
.qb-line .qb-line-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; margin: 0; padding: 12px 12px 12px 14px; border-bottom: 1px solid #e6eaf0; background: #fafbfc; }
.qb-line .qb-line-photo { width: 52px; height: 52px; overflow: hidden; border-radius: 10px; background: var(--qb-canvas); cursor: pointer; }
.qb-line .qb-line-photo[hidden] { display: none; }
.qb-line .qb-line-photo img { width: 100%; height: 100%; object-fit: cover; }
.qb-page img.is-missing, .service-photo-card img.is-missing { visibility: hidden; }
.qb-line .qb-line-service { min-width: 0; }
.qb-page .qb-line .qb-line-service select { width: 100%; min-height: 40px; padding: 0 28px 0 0; border: 0; background: transparent; color: var(--qb-ink); font: inherit; font-size: 17px; font-weight: 800; letter-spacing: -.01em; text-overflow: ellipsis; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #5a6678 50%), linear-gradient(135deg, #5a6678 50%, transparent 50%); background-position: calc(100% - 12px) 52%, calc(100% - 7px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.qb-page .qb-line .qb-line-service select:focus-visible { outline: 3px solid rgba(59,130,246,.35); outline-offset: 2px; border-radius: 6px; }
.qb-line .qb-line-total { color: var(--qb-ink); font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qb-line .qb-remove { display: grid; width: 36px; height: 36px; place-items: center; border: 0; border-radius: 10px; background: transparent; color: #8a95a6; font-size: 22px; line-height: 1; cursor: pointer; }
.qb-line .qb-remove:hover, .qb-line .qb-remove:focus-visible { background: #fdecee; color: var(--qb-red); outline: none; }
.qb-line .qb-line-fields { display: block; padding: 16px 14px 4px; }
.qb-line .qb-line-note { min-height: 0; margin: 0; padding: 0 14px 14px; color: #8a5a00; font-size: 12px; font-weight: 700; }
.qb-line .qb-line-note:empty { display: none; }
.qb-hint { margin: 0 0 12px; color: var(--qb-soft); font-size: 14px; }

/* Segmented control (4 in / 6 in) */
.qb-segment > div, .qb-segment { min-width: 0; }
.qb-segment { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; column-gap: 0; }
.qb-segment legend { grid-column: 1 / -1; margin-bottom: 6px; }
.qb-segment label { position: relative; display: block; }
.qb-page .qb-line .qb-segment input[type=radio] { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; opacity: 0; cursor: pointer; }
.qb-segment label span { display: grid; min-height: 48px; place-items: center; border: 1px solid #c4ccd7; background: #fff; color: #3d4a5d; font-size: 14px; font-weight: 750; }
.qb-segment label:first-of-type span { border-radius: 11px 0 0 11px; }
.qb-segment label:last-of-type span { border-left: 0; border-radius: 0 11px 11px 0; }
.qb-segment input:checked + span { border-color: var(--qb-navy); background: var(--qb-navy); color: #fff; }
.qb-segment input:focus-visible + span { box-shadow: 0 0 0 4px rgba(59,130,246,.3); }

/* Toggle chips (wire mesh, grass, property sides) */
.qb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.qb-chips-field { gap: 8px; }
.qb-chip { position: relative; display: inline-flex; }
.qb-page .qb-chip input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; opacity: 0; cursor: pointer; }
.qb-chip span { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid #c4ccd7; border-radius: 999px; background: #fff; color: #3d4a5d; font-size: 14px; font-weight: 700; }
.qb-chip span::before { content: ""; width: 16px; height: 16px; border: 2px solid #9aa5b5; border-radius: 5px; box-sizing: border-box; }
.qb-chip input:checked + span { border-color: var(--qb-navy); background: #eef2fb; color: var(--qb-navy); }
.qb-chip input:checked + span::before { border-color: var(--qb-navy); background: var(--qb-navy) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat; }
.qb-chip input:focus-visible + span { box-shadow: 0 0 0 4px rgba(59,130,246,.3); }

.qb-owner { margin-top: 2px; padding: 10px 12px; border-radius: 11px; background: #f6f7f9; }
.qb-owner summary { color: #3d4a5d; font-size: 13px; font-weight: 750; cursor: pointer; }
.qb-owner[open] summary { margin-bottom: 12px; }

/* Add work */
.qb-add { display: flex; width: 100%; min-height: 56px; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; border: 2px dashed #b8c2cf; border-radius: var(--qb-radius); background: transparent; color: var(--qb-ink); font: inherit; font-size: 15px; font-weight: 800; cursor: pointer; }
.qb-add span { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; background: var(--qb-red); color: #fff; font-size: 18px; line-height: 1; }
.qb-add.is-first { min-height: 132px; margin-top: 0; flex-direction: column; background: #fff; font-size: 17px; }
.qb-add.is-first span { width: 44px; height: 44px; font-size: 26px; }
.qb-add:hover, .qb-add:focus-visible { border-color: var(--qb-navy); outline: none; }

/* Terms (collapsed by default, with a one-line summary) */
.qb-terms summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; cursor: pointer; }
.qb-terms summary::-webkit-details-marker { display: none; }
.qb-terms summary::after { content: ""; width: 9px; height: 9px; margin-right: 4px; border-right: 2px solid #5a6678; border-bottom: 2px solid #5a6678; transform: rotate(45deg); transition: transform .15s; }
.qb-terms[open] summary::after { transform: rotate(-135deg); }
.qb-terms[open] summary { margin-bottom: 16px; }
.qb-terms-title { display: grid; gap: 3px; }
.qb-terms-title strong { color: var(--qb-ink); font-size: 17px; }
.qb-terms-title small { color: var(--qb-soft); font-size: 13px; }

/* The price readout */
.quote-summary.qb-readout { position: sticky; top: 96px; display: grid; gap: 0; padding: 0; overflow: hidden; border: 0; border-radius: 18px; background: var(--qb-navy); color: #e8edf6; box-shadow: 0 20px 44px rgba(16,24,39,.22); }
.qb-readout-toggle { display: grid; gap: 4px; width: 100%; padding: 22px 22px 18px; border: 0; background: transparent; color: inherit; text-align: left; font: inherit; cursor: default; }
.qb-readout-label { color: #9aa8bf; font-size: 13px; font-weight: 700; }
.qb-readout-total { color: var(--qb-gold); font-size: 44px; line-height: 1; font-weight: 800; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.qb-readout-source { display: inline-flex; align-items: center; gap: 7px; color: #b9c4d6; font-size: 13px; font-weight: 600; }
.qb-readout-source::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #5d6b82; }
.qb-readout-source[data-state="confirmed"]::before { background: #34d399; }
.qb-readout-source[data-state="local"]::before { background: var(--qb-gold); }
.qb-readout-source[data-state="error"]::before { background: #f87171; }
.qb-readout-detail { display: grid; gap: 0; padding: 0 22px 6px; }
.qb-readout .summary-head { display: none; }
.qb-readout .summary-lines { display: grid; gap: 10px; min-height: 0; padding: 14px 0; border-top: 1px solid rgba(255,255,255,.1); }
.qb-readout .summary-lines:empty { display: none; }
.qb-readout .summary-line { display: flex; justify-content: space-between; gap: 12px; }
.qb-readout .summary-line span { color: #e8edf6; font-size: 14px; font-weight: 650; }
.qb-readout .summary-line span small { display: block; margin-top: 2px; color: #93a1b8; font-size: 12px; font-weight: 500; }
.qb-readout .summary-line strong { color: #fff; font-size: 14px; font-variant-numeric: tabular-nums; }
.qb-readout .summary-totals { display: grid; gap: 7px; margin: 0; padding: 14px 0; border-top: 1px solid rgba(255,255,255,.1); }
.qb-readout .summary-totals > div { display: flex; justify-content: space-between; color: #a7b3c7; font-size: 13px; }
.qb-readout .summary-totals dt { font-weight: 600; }
.qb-readout .summary-totals dd { margin: 0; color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.qb-readout #summaryRounding { color: #93a1b8; font-size: 12px; }
.qb-readout #summaryRounding:empty { display: none; }
.qb-readout .summary-warning { display: block; margin: 0 0 12px; padding: 10px 12px; border: 1px solid rgba(244,196,48,.35); border-radius: 10px; background: rgba(244,196,48,.1); }
.qb-readout .summary-warning[hidden] { display: none; }
.qb-readout .summary-warning p { margin: 0; color: #f9e4a0; font-size: 13px; line-height: 1.45; }
.qb-readout .quote-photo-setting { margin: 4px 0 12px; color: #c9d2e1; font-size: 13px; font-weight: 600; }
.qb-readout .quote-photo-setting input { accent-color: var(--qb-gold); }
.qb-readout-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.qb-readout .qb-ghost { min-height: 44px; border: 1px solid rgba(255,255,255,.22); background: transparent; color: #fff; font-size: 13px; }
.qb-readout .qb-ghost:disabled { color: #6f7d94; border-color: rgba(255,255,255,.1); cursor: not-allowed; transform: none; }
.qb-readout .qb-ghost[hidden] { display: none; }
.qb-error { margin: 0 22px; color: #fca5a5; font-size: 13px; font-weight: 700; }
.qb-error:empty { display: none; }
.qb-readout .qb-save { min-height: 54px; margin: 12px 22px 22px; border-radius: 12px; font-size: 16px; }
.qb-readout .qb-save:disabled { background: #2b3648; color: #7d8aa1; box-shadow: none; cursor: not-allowed; transform: none; }

/* Quotes saved on this phone */
.device-drafts { margin: 0 0 18px; padding: 16px; border: 1px solid #f1d27a; border-radius: var(--radius); background: #fffbeb; }
.device-drafts header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; margin-bottom: 10px; }
.device-drafts h3 { margin: 0; color: #4a3906; font-size: 16px; }
.device-drafts header p { margin: 0; color: #7a6216; font-size: 13px; }
.device-drafts ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.device-draft { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid #f3e2a7; }
.device-draft > div:first-child { display: grid; gap: 2px; min-width: 0; }
.device-draft strong { color: var(--ink); font-size: 14px; }
.device-draft span { color: #3d4a5d; font-size: 13px; }
.device-draft small { color: #7a6216; font-size: 12px; }
.device-draft.review { border-color: #f5b4bc; }
.device-draft.review small { color: var(--red); font-weight: 700; }
.device-draft-actions { display: flex; align-items: center; gap: 8px; }

/* Service picker as a sheet */
.service-picker-dialog .quote-modal-heading h2 { font-size: 22px; letter-spacing: -.02em; }
.service-picker-dialog .service-picker-note { display: none; }
.service-photo-card strong { font-size: 14px; }

/* Tablet and phone: the readout becomes a bar pinned above the bottom navigation */
@media (max-width: 940px) {
  .quote-builder.qb { grid-template-columns: 1fr; padding-bottom: 120px; }
  .quote-summary.qb-readout {
    position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); top: auto; z-index: 45;
    grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-radius: 18px 18px 0 0; box-shadow: 0 -12px 32px rgba(16,24,39,.25);
  }
  .qb-readout-toggle { grid-column: 1; padding: 12px 16px; gap: 2px; cursor: pointer; }
  .qb-readout-label { font-size: 12px; }
  .qb-readout-label::after { content: " · tap for details"; color: #6f7d94; font-weight: 600; }
  .quote-summary.qb-readout.is-open .qb-readout-label::after { content: " · tap to close"; }
  .qb-readout-total { font-size: 30px; }
  .qb-readout-source { font-size: 12px; }
  .qb-readout .qb-save { grid-column: 2; grid-row: 1; min-height: 50px; margin: 0 16px 0 0; padding: 0 22px; white-space: nowrap; }
  .qb-error { grid-column: 1 / -1; grid-row: 2; margin: 0 16px 10px; }
  .qb-readout-detail { grid-column: 1 / -1; grid-row: 3; display: none; max-height: 55dvh; overflow-y: auto; padding: 0 16px 14px; }
  .quote-summary.qb-readout.is-open .qb-readout-detail { display: grid; }
  .qb-readout-toggle:focus-visible { outline: 3px solid rgba(244,196,48,.6); outline-offset: -3px; }
}
@media (max-width: 760px) {
  .qb-head { grid-template-columns: auto minmax(0, 1fr); gap: 10px; margin-bottom: 14px; }
  .qb-head h2 { font-size: 23px; }
  .qb-head .draft-indicator { grid-column: 1 / -1; justify-self: start; }
  .qb-card { padding: 16px; }
  .qb-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .qb-customer .qb-grid { grid-auto-flow: row dense; }
  .qb-customer .qb-grid > .qb-field:nth-child(2), .qb-customer .qb-grid > .qb-field:nth-child(4) { grid-column: 1 / -1; }
  .qb-line .qb-line-head { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; row-gap: 0; padding: 10px; }
  .qb-line .qb-line-photo { grid-column: 1; grid-row: 1 / span 2; width: 48px; height: 48px; }
  .qb-line .qb-line-head > .qb-line-service { grid-column: 2; grid-row: 1; }
  .qb-line .qb-line-total { grid-column: 2; grid-row: 2; font-size: 15px; color: #3d4a5d; }
  .qb-line .qb-remove { grid-column: 3; grid-row: 1 / span 2; }
  .qb-line .qb-line-fields { padding: 14px 12px 2px; }
  .qb-segment, .qb-chips.qb-wide, .qb-owner { grid-column: 1 / -1; }
  .qb-line .qb-grid > .qb-field:has(select) { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { .qb-terms summary::after { transition: none; } }
