/* =========================================================================
   QUOTATION DOCUMENT — styles for the letterhead rendered by
   renderDocumentHTML() in quote-doc.js. Uses the colour tokens from
   app.css (load it first).
   ========================================================================= */
.doc{
  width:680px; margin:0 auto; background:#fff; padding:40px 44px 34px; position:relative;
  font-size:12px; color:#22282F; box-shadow:0 2px 10px rgba(0,0,0,.08); border:1px solid #E4E7EA;
}
.doc .stamp{
  flex-shrink:0; margin-right:6px; border:3px solid var(--draft); color:var(--draft);
  padding:5px 14px; font-weight:800; font-size:15px; letter-spacing:.12em; transform:rotate(-8deg);
  border-radius:6px; opacity:.55; font-family:'IBM Plex Mono',monospace;
}
.doc .stamp.sent{ border-color:var(--success); color:var(--success); }
.doc-head{ display:grid; grid-template-columns:1fr auto; align-items:center; gap:18px; margin-bottom:14px; }
.doc-head .co{ text-align:center; white-space:nowrap; font-weight:800; font-size:31px; line-height:1.1; color:var(--navy); letter-spacing:.01em; text-transform:uppercase; }
.doc-head .co .co-name{ font-size:13px; font-weight:700; letter-spacing:0; margin-top:6px; white-space:normal; color:var(--ink, #1f2937); }
.doc-head .tax{ justify-self:end; text-align:right; font-size:10.5px; color:var(--muted); }
.doc-rule{ height:3px; background:linear-gradient(90deg,var(--navy),var(--amber)); border-radius:2px; margin-bottom:16px; }
.doc-meta{ display:grid; grid-template-columns:1fr 1fr; gap:2px 18px; margin-bottom:14px; }
.doc-meta .mrow{ display:flex; font-size:11.5px; padding:2px 0; }
.doc-meta .mrow .k{ width:112px; color:var(--muted); flex-shrink:0; }
.doc-meta .mrow .v{ font-weight:600; }
.doc-meta .mrow.wide{ grid-column:1 / -1; }
.doc-intro{ display:flex; justify-content:space-between; align-items:center; gap:12px; font-size:11.5px; margin:14px 0 8px; color:#3A4149; }
.doc-intro > span{ font-style:italic; }
table.doc-items{ width:100%; border-collapse:collapse; margin-bottom:2px; }
table.doc-items thead th{
  background:var(--navy); color:#fff; font-size:9.5px; text-transform:uppercase; letter-spacing:.04em;
  padding:6px 6px; text-align:left; font-weight:700;
}
table.doc-items thead th.r{ text-align:right; }
table.doc-items thead th.c{ text-align:center; }
table.doc-items thead th .en{ text-transform:none; font-weight:500; opacity:.75; letter-spacing:.02em; }
table.doc-items tbody td{ padding:6px 6px; font-size:11px; border-bottom:1px solid #EEF0F2; vertical-align:top; }
table.doc-items tbody td.r{ text-align:right; font-family:'IBM Plex Mono',monospace; }
table.doc-items tbody td.c{ text-align:center; }
.doc-totals{ display:flex; justify-content:flex-end; margin-top:4px; }
.doc-totals table{ border-collapse:collapse; width:260px; }
.doc-totals td{ padding:4px 4px; font-size:11px; }
.doc-totals td.l{ color:var(--muted); }
.doc-totals td.r{ text-align:right; font-family:'IBM Plex Mono',monospace; font-weight:600; }
.doc-totals tr.grand td{ border-top:1.5px solid var(--ink); font-weight:800; font-size:12.5px; padding-top:7px; color:var(--amber-dark); }
.doc-terms{ margin-top:16px; }
.doc-terms .mrow{ display:flex; font-size:11px; padding:2.5px 0; }
.doc-terms .mrow .k{ width:136px; color:var(--muted); flex-shrink:0; }
.doc-terms .mrow .v{ font-weight:500; white-space:pre-line; }
.doc-foot{ margin-top:24px; text-align:center; border-top:1px solid #EEF0F2; padding-top:12px; }
.doc-foot .name{ font-weight:800; font-size:11.5px; color:var(--navy); }
.doc-foot .addr{ font-size:9.5px; color:var(--muted); margin-top:3px; line-height:1.5; white-space:pre-line; }

/* ---------- Document extras ---------- */
.doc-words{ margin-top:8px; font-size:11px; text-align:right; font-style:italic; color:#3A4149; }
.doc-words .k{ color:var(--muted); }
table.doc-items tbody td.desc{ white-space:pre-wrap; }
table.doc-items tbody tr.note-row td{ font-style:italic; }
table.doc-items tbody td.desc .item-img{ display:block; margin-top:6px; max-width:180px; max-height:130px; object-fit:contain; }
/* bilingual labels (biLabel in quote-doc.js): English line under the Vietnamese one */
.doc .en{ display:block; font-size:.85em; font-style:italic; line-height:1.25; opacity:.8; }
.doc .stamp .en{ font-size:9px; font-style:normal; text-align:center; letter-spacing:.2em; opacity:1; }
.doc-totals td.l .en{ font-size:.8em; }

/* ---------- PDF export (see exportQuotationPDF in quote-doc.js) ---------- */
.pdf-host{ position:fixed; left:-10000px; top:0; }
/* a little narrower than the ~718px A4 content width, or html2pdf crops the right edge */
.doc.doc-pdf{ width:700px; margin:0; padding:0; border:none; box-shadow:none; }

/* =========================================================================
   TEMPLATES (resolveTemplate in quote-doc.js). Colours come from the
   template through --navy / --amber / --doc-tint set on .doc itself.
   ========================================================================= */
.doc .doc-logo{ width:auto; max-width:200px; object-fit:contain; display:inline-block; }
.doc .doc-foot .addr.note{ margin-top:6px; font-style:italic; }
.doc .doc-words .en{ font-size:.92em; }
.doc-sign{ display:grid; grid-template-columns:1fr 1fr; gap:24px; margin-top:22px; text-align:center; }
.doc-sign .sig{ min-height:96px; }
.doc-sign .sig-k{ font-weight:700; font-size:11.5px; color:var(--navy); }
.doc-sign .sig-hint{ font-size:9.5px; color:var(--muted); font-style:italic; margin-top:2px; }

/* classic: logo left / center */
.doc-head.logo-left{ grid-template-columns:auto 1fr; }
.doc-head.logo-left .tax{ justify-self:start; text-align:left; }
.doc-head.logo-center{ grid-template-columns:1fr auto; }
.doc-head .co-logo{ margin-bottom:8px; }
.doc.lang-vi .doc-head .co, .doc.lang-en .doc-head .co{ font-size:34px; }
.doc.lang-bi .doc-head .co{ font-size:31px; }

/* modern */
.doc.layout-modern{ padding-top:0; }
.doc-band{ display:flex; justify-content:space-between; align-items:center; gap:18px; background:var(--navy); color:#fff;
  margin:0 -44px 18px; padding:22px 44px; }
.doc.doc-pdf .doc-band{ margin:0 0 18px; padding:20px 22px; border-radius:6px; }
.doc-band .band-co{ display:flex; align-items:center; gap:14px; min-width:0; }
.doc-band .band-logo{ background:#fff; border-radius:8px; padding:6px 8px; line-height:0; flex-shrink:0; }
.doc-band .band-name{ font-weight:800; font-size:14px; letter-spacing:.01em; }
.doc-band .band-line{ font-size:10px; opacity:.85; line-height:1.5; }
.doc-band .band-line strong{ color:#fff; }
.doc-band .band-title{ font-size:26px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; text-align:right; white-space:nowrap; color:#fff; }
.doc-band .band-title .en{ font-size:12px; letter-spacing:.3em; color:var(--amber); opacity:1; font-style:normal; }
.doc.layout-modern .doc-meta{ background:var(--doc-tint); border-radius:8px; padding:10px 14px; }
.doc.layout-modern table.doc-items thead th{ background:var(--amber); }
.doc.layout-modern table.doc-items tbody tr:nth-child(even) td{ background:#FAFBFC; }
.doc.layout-modern .doc-totals tr.grand td{ background:var(--navy); color:#fff; border-top:none; padding:8px 8px; }
.doc.layout-modern .doc-totals tr.grand td .en{ color:#fff; }

/* minimal */
.doc-head-min{ display:flex; justify-content:space-between; align-items:flex-start; gap:18px; padding-bottom:14px;
  border-bottom:1.5px solid var(--navy); margin-bottom:16px; }
.doc-head-min.logo-right{ flex-direction:row-reverse; }
.doc-head-min.logo-right .min-co{ text-align:right; }
.doc-head-min.logo-center{ flex-direction:column; align-items:center; text-align:center; }
.doc-head-min .min-co .doc-logo{ margin-bottom:6px; }
.doc-head-min .min-name{ font-weight:700; font-size:13px; color:var(--navy); }
.doc-head-min .min-line{ font-size:10px; color:var(--muted); line-height:1.5; }
.doc-head-min .min-title{ font-size:22px; font-weight:300; letter-spacing:.28em; text-transform:uppercase; color:var(--navy); white-space:nowrap; }
.doc.layout-minimal table.doc-items thead th{ background:transparent; color:var(--navy); border-bottom:1.5px solid var(--navy); }
.doc.layout-minimal table.doc-items thead th .en{ opacity:.6; }
.doc.layout-minimal .doc-totals tr.grand td{ color:var(--navy); border-top:1.5px solid var(--navy); }
.doc.layout-minimal .doc-intro > span{ font-style:normal; }

/* elegant */
.doc-head-ele{ text-align:center; margin-bottom:16px; }
.doc-head-ele .doc-logo{ margin-bottom:8px; }
.doc-head-ele .ele-name{ font-size:16px; font-weight:700; color:var(--navy); letter-spacing:.04em; text-transform:uppercase; }
.doc-head-ele .ele-line{ font-size:10px; color:var(--muted); line-height:1.6; }
.doc-head-ele .ele-title{ margin:14px auto 0; padding:8px 0; border-top:3px double var(--amber); border-bottom:3px double var(--amber);
  font-size:20px; font-weight:700; letter-spacing:.2em; color:var(--navy); text-transform:uppercase; }
.doc.layout-elegant table.doc-items thead th{ background:var(--doc-tint); color:var(--navy); border-top:1px solid var(--navy); border-bottom:1px solid var(--navy); }
.doc.layout-elegant .doc-meta{ border-bottom:1px solid #EEF0F2; padding-bottom:10px; }
.doc.layout-elegant .doc-totals tr.grand td{ color:var(--navy); border-top:3px double var(--navy); }
