/* ===== Documentos comerciales (cotización, pedido, OV, remisión, financieros) =====
   Siempre en tinta clara: un documento se ve igual en modo oscuro que impreso. */
.doc-wrap { background: var(--surface-3); border-radius: var(--r-lg); padding: 18px; overflow-x: auto; }
.doc {
  --doc-accent: #4B4FC4;
  --doc-accent-2: #2E3266;
  --doc-ink: #0F172A;
  --doc-muted: #64748B;
  --doc-line: #E2E8F0;
  width: 100%; max-width: 820px; margin: 0 auto; background: #fff; color: var(--doc-ink);
  font-family: var(--font); font-size: 12px; line-height: 1.45; padding: 40px 44px; border-radius: 4px;
  box-shadow: 0 2px 6px rgba(15,23,42,.08), 0 12px 32px rgba(15,23,42,.12); color-scheme: light;
}
.doc * { color-scheme: light; }
.doc-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.doc-logo { display: flex; align-items: center; gap: 10px; }
.doc-logo .mark { width: 40px; height: 40px; }
.doc-logo b { font-size: 15px; display: block; color: var(--doc-ink); }
.doc-logo span { font-size: 10.5px; color: var(--doc-muted); display: block; }
.doc-title { text-align: right; }
.doc-title h1 { font-size: 22px; letter-spacing: .02em; color: var(--doc-accent); }
.doc-title .num { font-size: 13px; font-weight: 700; margin-top: 2px; }
.doc-title .meta { color: var(--doc-muted); font-size: 11px; margin-top: 4px; }
.doc-parties { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 26px 0 18px; }
.doc-box h4 { font-size: 10px; color: var(--doc-muted); font-weight: 700; letter-spacing: .06em; margin-bottom: 5px; }
.doc-box p { margin: 0; font-size: 11.5px; }
.doc-box b { font-size: 12.5px; }
.doc-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.doc-table th { background: var(--doc-accent); color: #fff; font-size: 10.5px; font-weight: 700; text-align: left; padding: 7px 8px; letter-spacing: .02em; }
.doc-table th.n, .doc-table td.n { text-align: right; white-space: nowrap; }
.doc-table td { padding: 7px 8px; border-bottom: 1px solid var(--doc-line); vertical-align: top; font-size: 11.5px; }
.doc-table td .sku { color: var(--doc-muted); font-size: 10px; }
.doc-table tr.note td { color: var(--doc-muted); font-style: italic; }
.doc-table tr.section td { font-weight: 700; background: #F1F5F9; }
.doc-table tr { page-break-inside: avoid; break-inside: avoid; }
.doc-table thead { display: table-header-group; }
.doc-summary { display: grid; grid-template-columns: 1fr 280px; gap: 24px; margin-top: 16px; page-break-inside: avoid; break-inside: avoid; }
.doc-totals .r { display: flex; justify-content: space-between; padding: 4px 0; font-size: 11.5px; }
.doc-totals .r span:first-child { color: var(--doc-muted); }
.doc-totals .r.grand { border-top: 2px solid var(--doc-ink); margin-top: 6px; padding-top: 8px; font-size: 15px; font-weight: 800; }
.doc-totals .r.grand span:first-child { color: var(--doc-ink); }
.doc-terms { margin-top: 22px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; page-break-inside: avoid; break-inside: avoid; }
.doc-terms h4 { font-size: 10px; color: var(--doc-muted); letter-spacing: .06em; margin-bottom: 3px; }
.doc-terms p { margin: 0; font-size: 11px; white-space: pre-line; }
.doc-sign { margin-top: 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; page-break-inside: avoid; break-inside: avoid; }
.doc-sign .line { border-top: 1px solid var(--doc-ink); padding-top: 6px; font-size: 11px; color: var(--doc-muted); }
.doc-sign img { max-height: 60px; }
.doc-foot { margin-top: 28px; padding-top: 10px; border-top: 1px solid var(--doc-line); font-size: 10px; color: var(--doc-muted); display: flex; justify-content: space-between; gap: 12px; }
.doc-stamp { display: inline-block; border: 2px solid currentColor; border-radius: 6px; padding: 3px 10px; font-weight: 800; font-size: 11px; letter-spacing: .08em; transform: rotate(-4deg); }
.doc-stamp.ok { color: #059669; } .doc-stamp.bad { color: #DC2626; } .doc-stamp.demo { color: #B45309; }
.doc-demo-band { margin-top: 14px; padding: 8px 12px; background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; border-radius: 6px; font-size: 10.5px; }

/* Plantilla: Corporativa (por defecto) */
.doc.tpl-corporate .doc-head { padding-bottom: 18px; border-bottom: 3px solid var(--doc-accent); }

/* Plantilla: Moderna premium */
.doc.tpl-modern { padding-top: 0; overflow: hidden; }
.doc.tpl-modern .doc-head { margin: 0 -44px; padding: 30px 44px 26px; background: linear-gradient(120deg, #0E1838 0%, var(--doc-accent) 65%, var(--doc-accent-2) 100%); color: #fff; }
.doc.tpl-modern .doc-logo b, .doc.tpl-modern .doc-title h1, .doc.tpl-modern .doc-title .num { color: #fff; }
.doc.tpl-modern .doc-logo span, .doc.tpl-modern .doc-title .meta { color: rgba(255,255,255,.75); }
.doc.tpl-modern .doc-parties .doc-box { background: #F8FAFC; border-radius: 8px; padding: 10px 12px; border: 1px solid var(--doc-line); }
.doc.tpl-modern .doc-table th { background: #0F172A; }
.doc.tpl-modern .doc-table tbody tr:nth-child(even) td { background: #F8FAFC; }
.doc.tpl-modern .doc-totals { background: #F8FAFC; border-radius: 10px; padding: 12px 14px; border: 1px solid var(--doc-line); }
.doc.tpl-modern .doc-totals .r.grand { border-top-color: var(--doc-accent); color: var(--doc-accent); }

/* Plantilla: Minimalista comercial */
.doc.tpl-minimal { font-size: 11.5px; }
.doc.tpl-minimal .doc-title h1 { color: var(--doc-ink); font-weight: 300; font-size: 26px; letter-spacing: .08em; }
.doc.tpl-minimal .doc-logo .mark { filter: grayscale(1) brightness(.4); }
.doc.tpl-minimal .doc-table th { background: none; color: var(--doc-muted); border-bottom: 1.5px solid var(--doc-ink); padding-left: 0; }
.doc.tpl-minimal .doc-table td { padding-left: 0; }
.doc.tpl-minimal .doc-totals .r.grand { border-top-width: 1px; font-weight: 700; }
.doc.tpl-minimal .doc-box h4, .doc.tpl-minimal .doc-terms h4 { letter-spacing: .1em; }
.doc-totals .r span:last-child { white-space: nowrap; padding-left: 8px; }
