/* Estimates (Pro): pipeline, walk-through editor, customer page (/e), and the shared document + print styles. */

/* ---------- pipeline ---------- */
.est-tools { display: grid; gap: 10px; margin-bottom: 12px; }
.est-filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
@media (min-width: 700px) { .est-filters { flex-wrap: wrap; } }
.chip-toggle.on, .chip-toggle[aria-pressed="true"] { background: var(--brand-3); border-color: var(--brand-2); color: var(--ink); }
button.chip-toggle { color: var(--ink); font-family: inherit; white-space: nowrap; }
.est-row .badge { flex: none; }
.est-row-money { text-align: right; font-variant-numeric: tabular-nums; flex: none; }
.est-row-money b, .est-row-money small { display: block; }
@media (max-width: 520px) { .row-list .est-row { flex-wrap: wrap; } .row-list .est-row .main { flex: 1 1 100%; } .est-row-money { text-align: left; flex: 1; } .est-row-money b, .est-row-money small { display: inline; margin-right: 6px; } }

/* ---------- editor ---------- */
.est-save { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.est-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.est-step { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 54px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-2); font: 600 13px var(--font); cursor: pointer; }
.est-step .n { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); font-weight: 800; }
.est-step.on { border-color: var(--brand); background: var(--brand-3); color: var(--ink); }
.est-step.on .n { background: var(--brand); color: var(--brand-ink); }
@media (min-width: 700px) { .est-step { flex-direction: row; justify-content: center; font-size: 15px; gap: 8px; } }
.est-fs { border: 0; padding: 0; margin: 0; min-width: 0; }
.est-fs:disabled { opacity: .75; }
.est-body .card + .card, .est-body .card + div, .est-walk .card { margin-top: 12px; }
.est-quick { margin-top: 6px; }
.est-lock { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.est-area-top, .est-line-top { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.est-area-top input { font-weight: 700; font-size: 17px; }
.est-find-chips .chip-toggle { min-height: 42px; }
.est-other { width: 130px; min-height: 42px; border-radius: 999px; padding: 0 12px; }
.est-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 420px; }
.est-seg button { min-height: var(--tap); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-2); font: 700 15px var(--font); cursor: pointer; }
.est-seg button.on.sev-low { background: var(--good-bg); color: var(--good); border-color: var(--good); }
.est-seg button.on.sev-medium { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.est-seg button.on.sev-high { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.est-photo-box { display: flex; flex-direction: column; gap: 8px; }

.photo-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-strip figure { position: relative; margin: 0; width: 104px; }
.photo-strip img { width: 104px; height: 104px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); display: block; }
.photo-strip figcaption { font-size: 12px; color: var(--ink-3); }
.photo-strip figure .btn { position: absolute; top: 4px; right: 4px; min-height: 30px; padding: 0 8px; background: var(--surface); }

.est-line { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: var(--surface-2); }
.est-line-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.est-line-nums label:last-child { grid-column: 1 / -1; }
@media (min-width: 640px) { .est-line-nums { grid-template-columns: 90px 140px 1fr; } .est-line-nums label:last-child { grid-column: auto; } }
.est-line-nums label { font-size: 13px; }
.est-line-amt { display: block; margin-top: 6px; }

.est-totals { margin-top: 12px; border-top: 2px solid var(--line); padding-top: 8px; max-width: 460px; margin-left: auto; }
.est-trow { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-variant-numeric: tabular-nums; }
.est-trow.est-big { font-size: 1.15rem; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; }
.est-totals-live { max-width: none; }
.est-value { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--good-bg); color: var(--good); font-weight: 600; }
.est-small { font-size: 14px; }
.est-acts { margin: 12px 0; }
.est-link { display: grid; gap: 8px; padding: 12px; border: 1px dashed var(--brand-2); border-radius: 10px; margin: 12px 0; }
.est-hist { margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.est-hist ul { margin: 6px 0 0; padding-left: 18px; }
.est-pick { max-height: 55vh; overflow: auto; margin-top: 8px; }
.est-pick .row { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line-2); text-align: left; font: inherit; color: inherit; cursor: pointer; }
.est-preview { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--bg); overflow: hidden; }

/* sticky step bar (sits above the phone bottom nav) */
.est-bar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 10px; margin: 14px -16px 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.est-bar-totals { flex: 1; min-width: 0; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { .est-bar { bottom: calc(58px + env(safe-area-inset-bottom)); padding-bottom: 10px; } }

/* ---------- the estimate document (customer page, preview, print) ---------- */
.doc-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; padding-bottom: 12px; border-bottom: 2px solid var(--brand); margin-bottom: 14px; }
.doc-logo { max-width: 120px; max-height: 80px; object-fit: contain; }
.doc-co { flex: 1; min-width: 180px; font-size: 14px; color: var(--ink-2); line-height: 1.35; }
.doc-co-name { font-size: 1.15rem; font-weight: 800; color: var(--ink); }
.doc-lic { font-size: 12.5px; color: var(--ink-3); }
.doc-title { text-align: right; margin-left: auto; }
.doc-title-main { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; color: var(--brand); }
.doc-title-meta { font-size: 13.5px; color: var(--ink-3); }
@media (max-width: 520px) { .doc-title { text-align: left; margin-left: 0; flex-basis: 100%; } }

.est-doc { color: var(--ink); background: var(--surface); }
.est-doc h2 { font-size: 1.1rem; margin: 0 0 10px; }
.est-doc h3 { font-size: 1rem; margin: 0; }
.est-to { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 16px; font-size: 15px; }
.est-to-right { text-align: right; }
@media (max-width: 520px) { .est-to-right { text-align: left; } }
.est-k { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 700; }
.est-sec { margin-top: 18px; }
.est-area { padding: 12px 0; border-top: 1px solid var(--line-2); break-inside: avoid; }
.est-area-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.est-sev { font-size: 12.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.est-sev.sev-low { background: var(--good-bg); color: var(--good); }
.est-sev.sev-medium { background: var(--warn-bg); color: var(--warn); }
.est-sev.sev-high { background: var(--bad-bg); color: var(--bad); }
.est-findings { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.est-find { font-size: 13.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.est-notes { white-space: pre-wrap; margin: 4px 0; }
.est-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.est-photos figure { margin: 0; }
.est-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); display: block; }
.est-photos figcaption { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.est-lines td:first-child { font-weight: 600; }
.est-signed .est-sig { display: block; max-width: 320px; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.est-foot { margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-3); }

/* ---------- customer page (/e) ---------- */
.est-public-main { max-width: 860px; padding-bottom: 40px; }
.est-public .est-doc { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; box-shadow: var(--shadow); }
.est-pub-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.est-pub-bar .spacer { flex: 1; }
.est-accept { margin-top: 14px; }
.est-accept .btn.big { flex: 1; min-width: 180px; }
.est-decline { display: grid; gap: 8px; margin-top: 12px; }
.est-missing { max-width: 480px; margin: 10vh auto 0; text-align: center; }
.est-missing h1 { font-size: 1.3rem; }
.sig-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.sigpad { width: 100%; max-width: 600px; height: auto; aspect-ratio: 10 / 3; border: 1px solid var(--line); border-radius: 10px; background: #fff; touch-action: none; }

/* ---------- printing / Save as PDF ---------- */
@media print {
  :root, :root[data-theme="dark"] { color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #f3f5f7; --line: #cfd6de; --line-2: #e3e8ee; --ink: #0f172a; --ink-2: #334155; --ink-3: #5b6777; --brand: #0e7490; --brand-2: #0b7f9c; --brand-3: #e3f6fa; --good: #0f7a3d; --good-bg: #e2f4e8; --warn: #9a5b00; --warn-bg: #fdf1dc; --bad: #b42318; --bad-bg: #fde8e6; --shadow: none; }
  body { background: #fff !important; }
  body.printing > *:not(.print-holder) { display: none !important; }
  .print-holder { display: block; }
  .no-print, .info-btn { display: none !important; }
  main, .est-public-main { max-width: none; padding: 0; margin: 0; }
  .est-public .est-doc { border: 0; box-shadow: none; padding: 0; }
  .est-photos { grid-template-columns: repeat(3, 1fr); }
  .est-area, .est-totals, .est-signed, .doc-head { break-inside: avoid; }
  .table-wrap { overflow: visible; }
  a { color: inherit; text-decoration: none; }
  @page { margin: 14mm; }
}
@media screen { .print-holder { display: none; } }
.est-trow b, .est-lines td.num { white-space: nowrap; }
/* service agreement the customer signs with the estimate */
.est-agreement > label:first-child { font-weight: 800; }
.est-ag-text { white-space: pre-wrap; max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); font-size: 14px; line-height: 1.55; margin: 6px 0 10px; }
.est-ag-check { align-items: flex-start; border-radius: 12px; padding: 8px 12px; min-height: 0; line-height: 1.4; }
.est-ag-check input { margin-top: 2px; flex: none; }
.est-ag-signed { margin-top: 10px; } .est-ag-signed summary { cursor: pointer; font-weight: 700; color: var(--brand); }
@media print { .est-ag-signed .est-ag-text { max-height: none; overflow: visible; } }
