/* Báo giá (HQ-29): chip trạng thái, form nhiều dòng, bản báo giá in được, trang khách xem /public/q/<token>. */
.badge.info { background: var(--brand-soft); color: var(--brand-dark); }
.badge.qt-kind { background: var(--accent-soft); color: var(--accent-text); margin-left: 4px; }
.qt-prog { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 12px; }
.qt-prog .bar { display: inline-block; width: 64px; height: 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.qt-prog .bar i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.qt-why { font-size: 12px; color: var(--err); }
.qt-toolbar { align-items: center; }
.qt-sumline { margin-left: auto; }
.qt-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em; }
.qt-head { flex-wrap: wrap; gap: 10px; }
.qt-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

/* ---- Form tạo / sửa ---- */
.modal.qt-modal { max-width: 1080px; }
.qt-h { margin: 14px 0 6px; font-size: 14px; }
.qt-lines-wrap { max-height: none; }
.qt-lines td { vertical-align: top; padding: 6px; }
.qt-lines input, .qt-lines select, .qt-lines textarea { width: 100%; min-width: 0; box-sizing: border-box; }
.qt-lines td.qt-desc { min-width: 240px; }
.qt-lines td.qt-desc textarea { resize: vertical; min-height: 36px; }
.qt-lines td:nth-child(2) { width: 72px; } .qt-lines td:nth-child(3) { width: 80px; } .qt-lines td:nth-child(4) { width: 130px; }
.qt-lines td:nth-child(5) { width: 70px; } .qt-lines td:nth-child(6) { width: 128px; }
.qt-lines td:nth-child(4) { width: 150px; }
.qt-head h1 > .muted { white-space: nowrap; }
.qt-lines .qt-lt { white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 14px; }
.qt-add { margin-top: 8px; flex-wrap: wrap; }
.qt-pick { border: 1px dashed var(--btn-border); border-radius: 12px; padding: 10px 12px; margin-top: 8px; background: var(--hover); }
.qt-pick h4 { margin: 0 0 6px; font-size: 13px; }
.qt-pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.qt-pick-list label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.qt-pick-actions { display: flex; gap: 8px; margin-top: 8px; }
.qt-sums { margin: 12px 0 0 auto; max-width: 360px; display: flex; flex-direction: column; gap: 4px; font-variant-numeric: tabular-nums; }
.qt-sums > div { display: flex; justify-content: space-between; gap: 16px; }
.qt-sums .qt-grand { border-top: 1px solid var(--line); padding-top: 6px; font-size: 16px; }
.qt-note { font-size: 12px; text-align: right; margin: 4px 0 10px; }

/* ---- Bản báo giá (chi tiết + in + trang khách) ---- */
.qt-doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.qt-doc-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; border-bottom: 2px solid var(--brand); padding-bottom: 12px; }
.qt-co { font-size: 13px; line-height: 1.5; } .qt-co strong { font-size: 16px; }
.qt-doc-title { text-align: right; } .qt-doc-title h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: .04em; color: var(--brand-dark); }
.qt-doc-to { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.qt-doc-to > div { display: flex; flex-direction: column; gap: 2px; }
.qt-doc-lines td { font-variant-numeric: tabular-nums; }
.qt-terms p { margin: 4px 0 0; white-space: normal; }
.qt-pay { display: flex; gap: 18px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--hover); flex-wrap: wrap; }
.qt-pay.none p { margin: 4px 0 0; color: var(--muted); }
.qt-pay dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0; }
.qt-pay dt { color: var(--muted); } .qt-pay dd { margin: 0; }
.qt-qr { width: 220px; height: auto; max-width: 100%; background: #fff; border-radius: 10px; border: 1px solid var(--line); }
.qt-linkbox { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.qt-linkrow { display: flex; gap: 8px; } .qt-linkrow input { flex: 1; min-width: 0; }
.qt-internal { margin-top: 12px; } .qt-internal p { margin: 6px 0 0; }

@media (max-width: 760px) {
  .qt-doc { padding: 14px; }
  .qt-doc-title { text-align: left; }
  .qt-doc-to { grid-template-columns: 1fr; }
  .qt-sums { max-width: none; }
  .qt-acts { margin-left: 0; }
  /* bảng dòng: thành thẻ trên điện thoại */
  .qt-doc-lines { border: 0; overflow: visible; }
  .qt-doc-lines table, .qt-doc-lines tbody { display: block; width: 100%; }
  .qt-doc-lines thead { display: none; }
  .qt-doc-lines tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
  .qt-doc-lines td { display: block; border: 0 !important; padding: 0 !important; white-space: normal !important; overflow-wrap: anywhere; text-align: left; font-size: 13px; width: auto; min-width: 0; }
  .qt-doc-lines td:first-child, .qt-doc-lines td[data-label="Đơn vị"], .qt-doc-lines td[data-label="Thành tiền"],
  .qt-doc-lines td[data-label="Tiền VAT"] { display: none; }
  .qt-doc-lines td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: 12px; }
  .qt-doc-lines td[data-label="Nội dung"] { grid-column: 1 / -1; font-weight: 600; font-size: 14px; }
  .qt-doc-lines td[data-label="Nội dung"]::before { content: none; }
  .qt-doc-lines td[data-label="Cộng"] { grid-column: 1 / -1; text-align: right; }
  .qt-lines thead { display: none; }
  .qt-lines, .qt-lines tbody, .qt-lines tr, .qt-lines td { display: block; width: 100% !important; box-sizing: border-box; }
  .qt-lines tr { border-bottom: 1px solid var(--line); padding: 6px 0; display: grid; grid-template-columns: 1fr 1fr; }
  .qt-lines td.qt-desc { grid-column: 1 / -1; min-width: 0; }
  .qt-lines td { border: 0 !important; padding: 4px 6px !important; }
  .qt-lines td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
  .qt-lines td.qt-lt { padding-top: 4px !important; font-weight: 600; }
  .qt-lines td.qt-x { text-align: right; }
}

/* ---- Trang khách xem ---- */
body.pq-body { background: var(--bg); }
.pq-wrap { max-width: 980px; margin: 0 auto; padding: 18px 16px 40px; box-sizing: border-box; }
.pq-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pq-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; text-align: center; }
.pq-err h1 { margin: 0 0 8px; font-size: 20px; }
.pq-foot { font-size: 12px; text-align: center; margin-top: 14px; }

/* ---- In / Lưu PDF: chỉ in bản báo giá (ẩn khung ứng dụng, thanh bước, tab, nút) ---- */
@media print {
  .topbar, .sidenav, .crumb, .page-head, .path, .path-guide, .highlights, .tabs, .msg, .qt-linkbox, .qt-internal, #toasts,
  .pq-top, .pq-foot, [data-panel]:not([data-panel="doc"]), .qt-doc [data-copy], body > div[style*="position:fixed"] { display: none !important; }
  section[data-panel="doc"] { display: block !important; }
  html, body, .layout, .main, .pq-wrap { display: block !important; margin: 0 !important; padding: 0 !important; background: #fff !important;
    animation: none !important; transform: none !important; max-width: none !important; overflow: visible !important; }
  .main > * { animation: none !important; }
  .qt-doc { border: 0; padding: 0; background: #fff; color: #000; box-shadow: none; }
  .qt-pay { background: #fff; break-inside: avoid; }
  .qt-doc-lines { overflow: visible; max-height: none; }
  .qt-doc-lines table { display: table; width: 100%; } .qt-doc-lines thead { display: table-header-group; }
  .qt-doc-lines tbody { display: table-row-group; } .qt-doc-lines tr { display: table-row; }
  .qt-doc-lines td, .qt-doc-lines td:first-child { display: table-cell; width: auto; } .qt-doc-lines td::before { content: none !important; }
  @page { margin: 14mm; }
}
