/* ===================== Quotations module ===================== */
a.tab { display: inline-block; color: var(--muted); }
a.tab.on { color: var(--primary); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: #fff; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--primary); color: #fff; }
.total-box { background: var(--primary-l); border-radius: 10px; padding: 14px 16px; }
.total-box .big { font-size: 20px; font-weight: 750; }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pick { position: relative; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px; cursor: pointer; text-align: center; font: inherit; color: var(--text); transition: border-color .15s, box-shadow .15s, transform .05s; }
.pick:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.pick:active { transform: scale(.98); }
.pick .im { height: 78px; display: grid; place-items: center; background: #f7f8fb; border-radius: 7px; overflow: hidden; font-size: 28px; }
.pick .im img { max-width: 100%; max-height: 78px; object-fit: contain; }
.pick .nm { font-size: 12px; font-weight: 600; margin-top: 6px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pick .added { position: absolute; top: 6px; right: 6px; background: var(--green); color: #fff; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 99px; }

.bitem { display: grid; grid-template-columns: 26px 64px minmax(0, 1fr) 250px 34px; gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: #fcfcfe; }
.bi-n { font-weight: 700; color: var(--muted); padding-top: 9px; text-align: center; }
.bi-img { width: 64px; height: 52px; border-radius: 8px; background: #f1f3f8; display: grid; place-items: center; overflow: hidden; font-size: 22px; }
.bi-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.bi-main { display: grid; gap: 6px; }
.bi-main textarea { min-height: 44px; font-size: 13px; }
.bi-main details summary { cursor: pointer; font-size: 12.5px; color: var(--primary); font-weight: 600; padding: 2px 0; }
.bi-main details textarea { margin-top: 6px; }
.bi-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bi-nums label { font-size: 11.5px; }
.bi-nums input { height: 34px; }
.bi-acts { display: grid; gap: 2px; }
.bi-acts .icon-btn { width: 30px; height: 28px; font-size: 12px; }

.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.ref-card { border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: grid; gap: 6px; background: #fff; }
.ref-card img { width: 100%; height: 100px; object-fit: contain; background: #f7f8fb; border-radius: 6px; }
.ref-card input { height: 32px; font-size: 12.5px; }
.term-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto 34px; gap: 8px; align-items: start; margin-bottom: 8px; }
.term-row textarea { min-height: 38px; }
.term-row .switch { padding-top: 9px; white-space: nowrap; }

.drop { border: 2px dashed #c9cfe0; border-radius: 14px; padding: 28px 16px; text-align: center; display: grid; gap: 8px; background: #fafbff; transition: background .15s, border-color .15s; }
.drop.over { background: var(--primary-l); border-color: var(--primary); }
.imp-card.reading { opacity: .7; }
.imp-card .card-h { flex-wrap: wrap; }

.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.pcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; box-shadow: var(--shadow); transition: transform .1s, box-shadow .15s; }
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.pcard.off { opacity: .5; }
.pcard .im { height: 130px; background: #f4f5f9; display: grid; place-items: center; font-size: 36px; }
.pcard .im img { max-width: 100%; max-height: 130px; object-fit: contain; }
.pcard .pb { padding: 10px 12px 12px; display: grid; gap: 3px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: #4a5263; }
.pm-img { height: 190px; border: 1px solid var(--line); border-radius: 10px; background: #f6f7fb; display: grid; place-items: center; text-align: center; font-size: 34px; overflow: hidden; }
.pm-img img { max-width: 100%; max-height: 100%; object-fit: contain; }

.preview-bg { position: fixed; inset: 0; z-index: 120; background: #dfe3ea; display: flex; flex-direction: column; animation: fade .15s; }
.preview-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.preview-scroll { flex: 1; overflow: auto; padding: 20px 12px 40px; }
.print-tip { max-width: 210mm; margin: 0 auto 12px; font-size: 12.5px; color: var(--muted); text-align: center; }
.qdoc-wrap { background: #dfe3ea; border-radius: 12px; padding: 20px 10px; overflow-x: auto; }

/* ---- Quotation document (matches the Divya Scale PDF layout) ---- */
.qdoc { --acc: #d71920; font-family: "Times New Roman", Georgia, serif; color: #1f2430; font-size: 12.5px; line-height: 1.4; }
.qd-page { background: #fff; width: 210mm; max-width: 100%; min-height: 297mm; margin: 0 auto 18px; padding: 9mm 11mm 7mm; display: flex; flex-direction: column; box-shadow: 0 6px 24px rgba(0,0,0,.12); }
.qd-body { flex: 1; }
.qd-h { text-align: center; color: var(--acc); font-weight: 700; font-size: 13.5px; margin-bottom: 12px; }
.qd-f { text-align: center; color: #555; font-size: 11px; margin-top: 14px; font-family: "Segoe UI", Arial, sans-serif; }
.qd-co { text-align: center; }
.qd-title { color: var(--acc); font-weight: 700; font-size: 12.5px; letter-spacing: .3px; }
.qd-sub { font-weight: 700; font-size: 11.5px; margin-top: 2px; }
.qd-tag { color: #555; font-weight: 700; font-size: 11.5px; margin-top: 14px; letter-spacing: .2px; }
.qd-banner { background: var(--acc); color: #fff; text-align: center; font-size: 22px; font-weight: 700; padding: 6px 0 9px; margin: 12px 0 22px; border-bottom: 3px solid #b5b8c0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.qd-info { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 13px; }
.qd-info th, .qd-info td { border: 1px solid #dfe2e8; padding: 5px 7px; text-align: left; vertical-align: top; }
.qd-info th { width: 48%; background: #eef0f4; font-weight: 400; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.qd-info th.b { font-weight: 700; }
.qd-info td { font-family: Arial, sans-serif; font-size: 12.5px; }
.qd-subject { color: var(--acc); font-weight: 700; font-size: 12px; margin: 10px 0 8px; }
.qd-dear { font-weight: 700; margin: 10px 0 8px; }
.qd-p { margin: 0 0 12px; text-align: justify; }
.qd-h2 { color: var(--acc); font-weight: 700; font-size: 12.5px; margin: 16px 0 8px; }
.qd-h2.center { text-align: center; }
.qd-refs { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid #e3e5ea; margin: 0 6%; }
.qd-ref { border: 1px solid #e3e5ea; padding: 6px 8px 8px; text-align: center; display: flex; flex-direction: column; justify-content: space-between; break-inside: avoid; }
.qd-ref .im { height: 105px; display: grid; place-items: center; }
.qd-ref img { max-width: 100%; max-height: 105px; object-fit: contain; }
.qd-ref .cap { color: var(--acc); font-weight: 700; font-size: 13px; line-height: 1.15; margin-top: 4px; }
.qd-note { text-align: center; font-style: italic; color: #555; font-size: 11.5px; margin-top: 8px; }
.qd-items { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.qd-items th { background: var(--acc); color: #fff; padding: 8px 6px; border: 1px solid #fff; font-weight: 700; font-size: 12.5px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.qd-items td { border: 1px solid #e1e3e8; padding: 6px 7px; vertical-align: middle; }
.qd-items td b { font-weight: 700; }
.qd-items .c { text-align: center; }
.qd-items .r { text-align: right; }
.qd-items tr { break-inside: avoid; }
.qd-tot td { background: #fdeeee; font-size: 13px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.qd-clients { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid #e3e5ea; }
.qd-clients > div { border: 1px solid #e3e5ea; padding: 10px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 92px; break-inside: avoid; }
.qd-clients img { max-width: 85%; max-height: 68px; object-fit: contain; }
.qd-clients b { font-size: 10.5px; }
.qd-st { font-weight: 700; font-size: 12.5px; margin: 10px 0 4px; }
.qd-ul { margin: 0 0 6px; padding-left: 16px; }
.qd-ul li { margin-bottom: 4px; font-size: 12px; }
.qd-terms { width: 92%; border-collapse: collapse; font-size: 11.5px; }
.qd-terms th { width: 23%; text-align: left; color: var(--acc); font-weight: 700; background: #eef0f4; border: 1px solid #dfe2e8; padding: 7px 6px; vertical-align: top; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.qd-terms td { border: 1px solid #dfe2e8; padding: 7px 7px; }
.qd-terms mark { background: #ffff3a; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.qd-sign { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 18px; font-size: 12px; }
.qd-sign img { max-height: 90px; max-width: 160px; object-fit: contain; }

@media (max-width: 860px) {
  .bitem { grid-template-columns: 22px 48px minmax(0, 1fr) 30px; }
  .bi-img { width: 48px; height: 44px; }
  .bi-nums { grid-column: 2 / 4; }
  .bi-acts { grid-column: 4; grid-row: 1; display: flex; flex-direction: column; }
  .term-row { grid-template-columns: minmax(0, 1fr) 34px; }
  .term-row textarea, .term-row .switch { grid-column: 1; }
  .qd-page { width: 100%; min-height: 0; padding: 18px 14px; }
  .qd-refs, .qd-clients { grid-template-columns: repeat(2, 1fr); margin: 0; }
}
@media print {
  .preview-bar, .print-tip, .print-bar { display: none !important; }
  .print-page { padding: 0; background: #fff; }
  .qd-page { box-shadow: none; margin: 0; width: auto; min-height: 270mm; padding: 0 2mm; break-after: page; }
  .qd-page:last-child { break-after: auto; }
}
