.estimate-builder { padding-bottom: 36px; }
.estimate-builder .page-hero { padding-bottom: 14px; }
.estimate-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(295px, 1fr); gap: 24px; align-items: start; }
.estimate-catalog, .estimate-builder section.result { min-width: 0; }
.estimate-catalog h2, .estimate-builder section.result h2 { margin: 0 0 12px; font: 600 28px/1.15 var(--head); }
.estimate-search { margin-bottom: 12px; }
.estimate-categories:not([hidden]) { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 14px; }
.estimate-category, .work-toggle { border: 1px solid var(--field); border-radius: 9px; background: #fff; color: var(--ink); padding: 7px 10px; min-height: 36px; font: inherit; font-size: 14px; cursor: pointer; }
.estimate-category:hover, .work-toggle:hover { border-color: var(--ink); }
.estimate-category[aria-pressed="true"] { background: var(--dark); color: white; border-color: var(--dark); }
.estimate-settings { margin-bottom: 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.estimate-settings summary { cursor: pointer; font-weight: 600; }
.estimate-settings .tools { margin: 10px 0; gap: 12px; }
.estimate-settings .field.chk { display: flex; align-items: center; gap: 9px; }
.estimate-settings .field.chk input { flex: none; width: 20px; height: 20px; accent-color: var(--ink); }
.estimate-settings .field.chk label { margin: 0; }
.estimate-builder .row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "pick pick" "qty price" "plan plan" "sum sum"; gap: 6px 12px; }
.estimate-builder .row:not(.sel) { grid-template-areas: "pick pick"; }
.estimate-builder .pick { grid-area: pick; cursor: default; gap: 10px; min-width: 0; }
.estimate-builder .pick .name { flex: 1; overflow-wrap: anywhere; }
.estimate-builder .work-unit { color: var(--muted); font-size: 14px; white-space: nowrap; }
.estimate-builder .work-toggle { flex: none; }
.estimate-builder .price { grid-area: price; }
.estimate-builder .qty { grid-area: qty; justify-content: flex-start; visibility: visible; }
.estimate-builder .planpick { grid-area: plan; flex-wrap: wrap; }
.estimate-builder .sum { grid-area: sum; text-align: left; }
.estimate-builder .row:not(.sel) :is(.price, .qty, .sum), .estimate-builder .sum:empty { display: none; }
.estimate-builder .price input, .estimate-builder .qty input { max-width: 65%; }
.estimate-builder section.result { position: sticky; top: 96px; margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); scroll-margin-top: 84px; }
.estimate-summary { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 15px; border-radius: 12px; background: var(--dark); color: white; }
.estimate-summary strong { color: var(--accent); font: 600 30px/1 var(--head); }
.estimate-selected { margin-top: 12px; }
.estimate-selected ul { margin: 0; padding: 0; list-style: none; max-height: 32vh; overflow: auto; }
.estimate-selected li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.estimate-selected li span, .estimate-selected li small { display: block; }
.estimate-selected li small { color: var(--muted); }
.estimate-selected li b { white-space: nowrap; }
.estimate-builder .actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.estimate-builder .actions .btn { min-height: 42px; padding: 6px 10px; text-align: center; font-size: 14px; }
#to-docs { grid-column: 1/-1; }
#to-docs[hidden] { display: none; }
.estimate-builder .actions button:disabled { opacity: .55; cursor: default; }
@media screen {
  .estimate-builder #rbody { display: none; }
  .estimate-builder + .bar { display: none; }
}
@media screen and (max-width: 850px) {
  .estimate-layout { grid-template-columns: minmax(0, 1fr); }
  .estimate-categories:not([hidden]) { flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 8px; }
  .estimate-category { flex: none; white-space: nowrap; }
  .estimate-builder { padding-bottom: 100px; }
  .estimate-builder section.result { position: static; }
  .estimate-selected ul { max-height: none; }
  .estimate-builder + .bar:not([hidden]) { display: block; position: fixed; inset: auto 0 0; z-index: 12; }
}
@media (max-width: 420px) {
  .estimate-builder .row { padding-inline: 10px; }
  .estimate-builder .pick { gap: 6px; }
  .estimate-builder section.result { padding: 12px; }
}
@media print {
  @page { size: A4; margin: 12mm 12mm 14mm; }
  .estimate-layout { display: block; }
  .estimate-builder { padding-bottom: 0; }
  .estimate-builder section.result { position: static; padding: 0; border: 0; background: transparent; }
  .estimate-builder #rbody tr, .estimate-builder #rbody .total { break-inside: avoid; }
  .estimate-builder #rbody tr.group { break-after: avoid; }
  .estimate-builder #rtitle { margin-bottom: 4mm; padding: 0 0 3mm; border-bottom: 2px solid #26364a; color: #26364a; font: 700 21pt/1.12 Arial, sans-serif; }
  .estimate-builder #printhead { margin: 0 0 5mm; color: #4b5968; font-size: 9pt; }
  .estimate-builder #rbody table { font-size: 9.5pt; line-height: 1.32; }
  .estimate-builder #rbody th, .estimate-builder #rbody td { padding: 2mm 1.7mm; }
  .estimate-builder #rbody th { background: #26364a; color: #fff; font-size: 8.5pt; print-color-adjust: exact; }
  .estimate-builder #rbody tr.group td { background: #eaf0f5; color: #26364a; print-color-adjust: exact; }
  .estimate-builder #rbody .total { margin-top: 5mm; padding: 3mm 4mm; border-color: #a8b5c2; border-radius: 3mm; }
  .estimate-builder #rbody .total .big { color: #26364a; font: 700 20pt/1.2 Arial, sans-serif; }
  .estimate-builder #disclaimer { font-size: 8pt; color: #4b5968; }
}
