/* Documentele tipărite și PDF-urile (oferte, comenzi, facturi). Culoarea de accent vine din brand (--accent). */
* { box-sizing: border-box; }
body { margin: 0; background: #e9eaec; color: #1d2327; font: 10pt/1.45 "Segoe UI", -apple-system, Roboto, Arial, sans-serif; }
.bar { position: sticky; top: 0; z-index: 2; display: flex; gap: 10px; align-items: center; padding: 12px 20px; background: #fff; border-bottom: 1px solid #dcdcde; }
.button { display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border: 1px solid #2271b1; color: #2271b1;
  background: #fff; border-radius: 3px; font: inherit; font-size: 13px; cursor: pointer; text-decoration: none; }
.button.primary { background: #2271b1; color: #fff; }
.muted { color: #646970; font-size: 12px; }

.sheet { --accent: #2271b1; --on-accent: #fff; position: relative; width: 210mm; min-height: 297mm; margin: 24px auto; padding: 16mm 15mm 18mm;
  background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.sheet::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--accent); }
.draft { position: absolute; top: 9mm; right: 15mm; color: #d63638; border: 1.5px solid #d63638; border-radius: 3px; padding: 1px 8px;
  font-size: 9pt; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

/* Antet: siglă și firmă în stânga, tipul documentului în dreapta */
.dh { display: flex; justify-content: space-between; gap: 12mm; align-items: flex-start; padding-bottom: 5mm; border-bottom: 1px solid #dcdcde; }
.dh-left { min-width: 0; }
.logo { display: block; max-width: 62mm; max-height: 20mm; object-fit: contain; object-position: left center; margin-bottom: 4mm; }
.wordmark { font-size: 20pt; font-weight: 700; letter-spacing: -.01em; color: var(--accent); line-height: 1.1; margin-bottom: 3mm; }
.firm { font-size: 8.5pt; color: #50575e; line-height: 1.5; }
.firm-name { font-weight: 600; color: #1d2327; font-size: 9.5pt; }
.dh-right { text-align: right; flex-shrink: 0; }
.dh-type { font-size: 19pt; font-weight: 700; letter-spacing: .01em; color: #1d2327; margin-bottom: 3mm; line-height: 1.1; }
.dh-meta { margin-left: auto; border-collapse: collapse; }
.dh-meta th { text-align: right; font-weight: 400; color: #646970; padding: 1px 0 1px 8mm; font-size: 9pt; white-space: nowrap; vertical-align: baseline; }
.dh-meta td { text-align: right; font-weight: 600; padding: 1px 0 1px 4mm; white-space: nowrap; vertical-align: baseline; }

/* Client */
.client { margin: 5mm 0 5mm; padding: 3.5mm 5mm; background: #f6f7f7; border-left: 3px solid var(--accent); border-radius: 2px; font-size: 9pt; color: #50575e; }
.label { font-size: 7.5pt; text-transform: uppercase; letter-spacing: .08em; color: #646970; font-weight: 600; margin-bottom: 1mm; }
.client-name { font-size: 12pt; font-weight: 700; color: #1d2327; margin-bottom: .5mm; }

/* Linii */
table { width: 100%; border-collapse: collapse; }
.lines { margin-bottom: 2mm; }
.lines th { text-align: left; font-size: 8pt; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #50575e;
  padding: 2mm; border-bottom: 1.5px solid var(--accent); vertical-align: bottom; line-height: 1.25; }
.lines td { padding: 2mm; border-bottom: 1px solid #ececed; vertical-align: top; }
.lines tbody tr:nth-child(even) td { background: #fafafa; }
.lines tr { page-break-inside: avoid; }
.lines thead { display: table-header-group; }
.nr { width: 9mm; color: #8c8f94; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong { font-weight: 700; }
.section { font-size: 10.5pt; font-weight: 700; margin: 4.5mm 0 0; color: #1d2327; }
.section:first-child { margin-top: 0; }
.variant { page-break-inside: avoid; }
.vsummary { margin-top: 5mm; page-break-inside: avoid; }
.vcards { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4mm; margin-top: 2mm; }
.vcard { border: 1px solid #dcdcde; border-top: 3px solid var(--accent); border-radius: 2px; padding: 3.5mm 4mm; }
.vname { font-weight: 700; font-size: 10.5pt; }
.vtotal { font-size: 15pt; font-weight: 700; margin: 1mm 0 .5mm; font-variant-numeric: tabular-nums; }

/* Subsol: mențiuni și totaluri */
.doc-foot { display: grid; grid-template-columns: 1fr 76mm; gap: 10mm; margin-top: 5mm; align-items: start; }
.doc-foot > * { page-break-inside: avoid; }
.notes p { margin: 0 0 3mm; }
.note-block { margin-bottom: 4mm; }
.note-block p { margin: 0; }
.note-block.pay { padding: 3mm 4mm; border: 1px solid #dcdcde; border-radius: 2px; }
.small { font-size: 8pt; color: #646970; }
.totals td { padding: 1.5mm 2mm; white-space: nowrap; }
.totals .vat td { color: #646970; font-size: 8.5pt; }
.totals .grand { background: var(--accent); color: var(--on-accent); }
.totals .grand td { font-size: 12pt; font-weight: 700; padding: 3mm; }
.doc-foot:not(:has(.totals)) { grid-template-columns: 1fr; }

@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; }
  .screen-only { display: none !important; }
  .sheet { margin: 0; box-shadow: none; width: auto; min-height: 0; padding: 0; }
  .sheet::before { top: -16mm; height: 4px; }
  .draft { top: 0; right: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* Aceleași lățimi de coloane în toate tabelele (variantele se aliniază una sub alta) */
.lines { table-layout: fixed; }
.lines th:nth-child(1) { width: 9mm; }
.lines th:nth-child(3) { width: 15mm; }
.lines th:nth-child(4) { width: 13mm; }
.lines th:nth-child(5) { width: 25mm; }
.lines th:nth-child(6) { width: 24mm; }
.lines th:nth-child(7) { width: 20mm; }
.lines td:nth-child(2) { overflow-wrap: anywhere; }
