/* ---------- Estimating (estimate builder, cost picker, invoice, print) — same tokens as styles.css ---------- */
.est-tab { display: grid; gap: 8px; }
.btn.est-new { width: 100%; flex: none; }
.est-list { display: grid; gap: 6px; }
.est-sub { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 6px; }
.est-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; min-height: 58px; padding: 8px 12px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--panel); text-align: left; }
.est-row-t { display: grid; min-width: 0; }
.est-row-t b, .est-row-t small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.est-row-t small { color: var(--muted); font-size: 12px; }
.est-row-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.st { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.st-sent { background: #1f3b63; color: #cfe1ff; } .st-accepted, .st-paid { background: #16402a; color: #c9f5d9; }
.st-declined, .st-void { background: #5b2020; color: #ffd7d7; } .st-converted { background: #4a3b10; color: #ffe8a6; }

.est-sheet h2 input { flex: 1; min-width: 0; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); padding: 0 10px; font-size: 17px; font-weight: 700; }
.est-sheet h2 select { width: auto; flex: 0 0 auto; height: 42px; }
.est-for { margin: 0 0 8px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel2); margin-bottom: 10px; }
.seg button { height: 42px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: 15px; }
.seg button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }

.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0 6px; }
.tier { display: grid; gap: 1px; height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); place-content: center; }
.tier small { font-size: 12px; color: var(--muted); }
.tier[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tier[aria-pressed="true"] small { color: inherit; opacity: .8; }
.q-big { padding: 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 4px; }
.q-range { font-size: 28px; font-weight: 800; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.q-sel { font-size: 15px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.q-panel > .btn { width: 100%; margin-top: 10px; }

.compare { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; padding: 8px 10px; border-radius: 10px;
  border: 1px dashed var(--accent); color: var(--muted); margin-bottom: 8px; }
.compare b { color: var(--text); }
.items { display: grid; gap: 8px; }
.item { border: 1px solid var(--line); border-left: 4px solid var(--chip-other); border-radius: 12px; padding: 8px; background: var(--panel); }
.item.k-material { border-left-color: var(--chip-reno); } .item.k-labor { border-left-color: var(--chip-gc); }
.it-top { display: flex; gap: 6px; align-items: flex-start; }
.it-desc { flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 11px 10px; font-size: 16px; resize: none; line-height: 1.25; }
.btn.it-mic, .btn.it-del { flex: 0 0 44px; height: 44px; font-size: 17px; padding: 0; }
.btn.it-mic.live { background: var(--red); color: #fff; border-color: var(--red); }
.btn.it-del { color: var(--muted); }
.it-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px; }
.it-grid .field input, .it-grid .field select { height: 42px; padding: 0 8px; font-size: 16px; }
.it-more { margin-top: 6px; }
.it-more summary { display: flex; justify-content: space-between; align-items: center; min-height: 36px; font-size: 13px; color: var(--muted); cursor: pointer; list-style: none; }
.it-more summary::-webkit-details-marker { display: none; }
.it-more summary span::before { content: '▸ '; } .it-more[open] summary span::before { content: '▾ '; }
.it-total { color: var(--text); font-size: 16px; font-variant-numeric: tabular-nums; }
.flags { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; }
.flag { display: flex; gap: 6px; align-items: center; min-height: 36px; }
.flag input { width: 20px; height: 20px; accent-color: var(--accent); }
.add-btns .btn { flex: 1; }

.rates { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--panel); }
.rates summary { font-size: 13px; color: var(--muted); min-height: 30px; display: flex; align-items: center; cursor: pointer; }
.rates .it-grid .field input { background: var(--bg); }
.est-totals { margin-top: 10px; display: grid; gap: 3px; padding: 10px 12px; border-radius: 12px; background: var(--panel2); font-variant-numeric: tabular-nums; }
.est-totals .tr { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); }
.est-totals .tr b { color: var(--text); }
.est-totals .tr.grand { font-size: 20px; color: var(--text); border-top: 1px solid var(--line); padding-top: 6px; margin-top: 3px; }
.est-actions { display: flex; gap: 8px; margin-top: 10px; }

.pick-chips { display: flex; gap: 6px; overflow-x: auto; margin: 8px 0; padding-bottom: 2px; }
.pick-chips .chipbtn { flex: 0 0 auto; padding: 0 12px; }
.pick-list { display: grid; gap: 6px; max-height: 56dvh; overflow-y: auto; }
.pick-row { display: flex; gap: 6px; }
.pick-main { flex: 1; display: grid; text-align: left; gap: 2px; min-height: 56px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); }
.pick-main small { color: var(--muted); font-size: 12px; }
.btn.pick-edit { flex: 0 0 48px; height: auto; }
.inv-lines { display: grid; gap: 4px; margin-top: 10px; }
.inv-line { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--panel); font-size: 14px; }
.inv-line small { color: var(--muted); }

/* print view: on screen it's a full-screen preview; window.print() (Save as PDF on phones) prints only the paper */
.print-root { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: #d9dde5; padding: 10px 10px 40px; }
.print-toolbar { display: flex; gap: 8px; flex-wrap: wrap; max-width: 820px; margin: 0 auto 10px; }
.print-toolbar .hint { flex-basis: 100%; color: #344054; }
.paper { max-width: 820px; margin: 0 auto; background: #fff; color: #101828; padding: 28px 26px; border-radius: 4px; font-size: 13px; line-height: 1.4;
  box-shadow: 0 2px 12px rgba(0,0,0,.2); color-scheme: light; }
.p-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #101828; padding-bottom: 12px; }
.p-biz { font-size: 20px; font-weight: 800; }
.p-placeholder { color: #98a2b3; border: 1px dashed #98a2b3; padding: 0 6px; display: inline-block; }
.p-doc { text-align: right; } .p-kind { font-size: 18px; font-weight: 800; letter-spacing: .08em; }
.p-to { margin: 14px 0; } .p-to small { text-transform: uppercase; color: #667085; font-size: 11px; letter-spacing: .05em; }
.p-table { width: 100%; border-collapse: collapse; }
.p-table th { text-align: left; font-size: 11px; text-transform: uppercase; color: #667085; border-bottom: 1px solid #d0d5dd; padding: 6px 4px; }
.p-table td { border-bottom: 1px solid #eaecf0; padding: 7px 4px; vertical-align: top; }
.p-table .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.p-totals { margin: 12px 0 0 auto; max-width: 300px; display: grid; gap: 3px; font-variant-numeric: tabular-nums; }
.p-totals .tr { display: flex; justify-content: space-between; }
.p-totals .grand { border-top: 2px solid #101828; padding-top: 5px; font-size: 16px; }
.p-quick .p-range { font-size: 20px; font-weight: 800; }
.p-small, .p-foot { color: #667085; font-size: 11px; }
.p-notes { margin-top: 14px; white-space: pre-wrap; }
.p-foot { margin-top: 24px; border-top: 1px solid #eaecf0; padding-top: 8px; }
@media print {
  @page { margin: 14mm; }
  html, body { height: auto; background: #fff !important; overflow: visible; }
  body > *:not(.print-root) { display: none !important; }
  .print-root { position: static; padding: 0; background: #fff; overflow: visible; }
  .print-toolbar { display: none !important; }
  .paper { box-shadow: none; max-width: none; padding: 0; border-radius: 0; }
}
