/* Documentos: cotización y contrato (pantalla e impresión en carta).
   Papel membretado con la marca de Xtra PC: jerarquía tipográfica clara, tablas de líneas finas, banda de total y firmas con espacio. */
.doc { --doc-ink: #142330; position: relative; background: #fff; color: var(--doc-ink); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 10px 30px rgba(18, 50, 71, .10); max-width: 816px; padding: 54px 62px 58px; line-height: 1.5; }
.doc::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: linear-gradient(90deg, var(--brand-bright), var(--brand)); border-radius: 4px 4px 0 0; }
.doc strong { font-weight: 600; }
.eyebrow { font-family: var(--sans); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); font-weight: 700; }

/* Membrete */
.lh { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 16px; margin-bottom: 26px; border-bottom: 1px solid var(--line); font-family: var(--sans); }
.lh-logo { height: 56px; width: auto; display: block; }
.lh-id { text-align: right; font-size: 11px; line-height: 1.6; color: var(--muted); max-width: 310px; }
.lh-id strong { display: block; font-size: 13px; color: var(--doc-ink); }

/* Cotización */
.q-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 22px; }
.doc-title { font-family: var(--serif); font-weight: 500; font-size: 31px; line-height: 1.1; margin: 4px 0 3px; color: var(--navy); }
.doc-sub { color: var(--muted); font-size: 13px; }
.meta { display: grid; grid-template-columns: repeat(3, auto); gap: 0 24px; margin: 0; }
.meta dt { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.meta dd { margin: 2px 0 0; font-family: var(--mono); font-size: 13px; font-weight: 500; white-space: nowrap; }
.q-cards { display: grid; grid-template-columns: 1.25fr 1fr; gap: 14px; margin-bottom: 18px; }
.q-card { background: var(--paper); border-left: 3px solid var(--brand-bright); border-radius: 4px; padding: 12px 16px; font-size: 13px; }
.q-card strong { display: block; font-size: 14.5px; margin: 3px 0 2px; }
.q-line { color: var(--muted); font-size: 12px; line-height: 1.5; }
.plan { border: 1px solid var(--line); border-radius: 6px; margin-bottom: 22px; overflow: hidden; }
.plan-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--brand-bg); }
.plan-head strong { font-family: var(--serif); font-size: 21px; font-weight: 500; color: var(--brand-dk); }
.plan-equip { font-size: 12px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); }
.stats > div { padding: 10px 14px; border-left: 1px solid var(--line-soft); }
.stats > div:first-child { border-left: 0; }
.stats b { display: block; font-size: 15px; font-weight: 600; }
.stats span { font-size: 10.5px; color: var(--muted); line-height: 1.3; display: block; }
.items { width: 100%; border-collapse: collapse; font-size: 13px; }
.items th { text-align: left; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 0 0 8px; border-bottom: 2px solid var(--navy); font-weight: 700; }
.items td { padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.items th.r, .items td.r { text-align: right; }
.items td.r { font-family: var(--mono); white-space: nowrap; padding-left: 16px; }
.items tr.strong td { font-weight: 600; border-bottom-color: var(--line); }
.items tr.good td { color: var(--good); }
.items tr.dim td { color: var(--muted); }
.total-band { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 14px; padding: 16px 22px; border-radius: 6px; color: #fff;
  background: linear-gradient(100deg, var(--navy), var(--brand-dk)); }
.total-band > span:first-child { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }
.total-band small { display: block; margin-top: 2px; font-size: 11px; letter-spacing: .03em; text-transform: none; font-weight: 400; opacity: .8; }
.total-band .amt { font-family: var(--serif); font-size: 31px; font-weight: 500; white-space: nowrap; }
.fine { margin: 12px 0 0; font-size: 11px; line-height: 1.55; color: var(--muted); }
.accept { margin-top: 30px; }
.accept-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 46px; margin-top: 50px; }
.sigline { border-top: 1px solid var(--doc-ink); padding-top: 6px; font-size: 11px; color: var(--muted); text-align: center; }

/* Contrato */
.doc-contract { font-family: Georgia, 'Times New Roman', serif; font-size: 14px; line-height: 1.62; }
.c-title { font-family: Georgia, 'Times New Roman', serif; font-weight: 500; font-size: 23px; line-height: 1.25; text-align: center; text-transform: uppercase; letter-spacing: .02em; color: var(--navy); margin: 2px 0 6px; }
.c-folio { text-align: center; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.c-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 30px; margin: 18px 0 24px; padding: 16px 20px; background: var(--paper); border-top: 2px solid var(--brand-bright); border-bottom: 1px solid var(--line); font-family: var(--sans); }
.c-kv dt { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.c-kv dd { margin: 1px 0 0; font-size: 13px; font-weight: 600; line-height: 1.35; }
.c-h { font-family: var(--sans); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--brand-dk); padding-bottom: 5px; margin: 28px 0 12px; border-bottom: 1px solid var(--brand-line); }
.c-h.anexo { font-size: 12.5px; letter-spacing: .06em; margin-top: 30px; }
.c-p { margin: 0 0 9px; text-align: justify; hyphens: auto; }
.c-p > strong:first-child { color: var(--brand-dk); }
.c-list { margin: 0 0 10px; padding-left: 26px; text-align: justify; }
.c-list li { margin-bottom: 4px; padding-left: 2px; }
.c-list li::marker { color: var(--brand); font-weight: 600; }
.doc table.c-table { width: 100%; border-collapse: collapse; margin: 8px 0 14px; font-family: var(--sans); font-size: 12.5px; line-height: 1.4; }
.c-table th { background: var(--navy); color: #fff; text-align: left; padding: 7px 9px; font-weight: 600; font-size: 11.5px; letter-spacing: .02em; border: 1px solid var(--navy); }
.c-table th.r { text-align: right; }
.doc .c-table td { padding: 6px 9px; border: 1px solid var(--line); vertical-align: top; }
.c-table tbody tr:nth-child(even) td { background: #f7fafc; }
.c-table td.r { text-align: right; font-family: var(--mono); white-space: nowrap; }
.c-table td.hl, .c-table tr.hl-row td { background: var(--brand-bg) !important; font-weight: 600; color: var(--brand-dk); }
.c-table.grid td { height: 31px; }
.c-pb { height: 0; margin-top: 34px; border-top: 1px dashed var(--line); }
.sign2 { display: grid; grid-template-columns: 1fr 1fr; gap: 58px; margin: 26px 0 10px; }
.sig { text-align: center; font-family: var(--sans); font-size: 12px; }
.sig .sig-space { height: 80px; }
.sig .sig-line { border-top: 1px solid var(--doc-ink); }
.sig .role { margin-top: 7px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--brand-dk); }
.sig .nm { margin-top: 3px; font-weight: 600; font-size: 13px; }
.sig .co { color: var(--muted); }

/* Contrato anterior (cotizaciones guardadas antes del contrato completo) */
.doc-logo { height: 52px; width: auto; display: block; margin-bottom: 10px; }
.sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 56px; text-align: center; }
.sign div { border-top: 1px solid var(--ink); padding-top: 6px; }

@media (max-width: 800px) {
  .doc { padding: 30px 18px 34px; }
  .lh { flex-direction: column; gap: 12px; }
  .lh-id { text-align: left; max-width: none; }
  .q-head { flex-direction: column; align-items: flex-start; }
  .q-cards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats > div { border-top: 1px solid var(--line-soft); }
  .stats > div:nth-child(odd) { border-left: 0; }
  .total-band .amt { font-size: 24px; }
  .c-kv, .sign2, .accept-grid { grid-template-columns: 1fr; gap: 26px; }
  .c-kv { gap: 12px; }
  .c-title { font-size: 19px; }
  .doc-contract { font-size: 13.5px; }
  .doc table.c-table { display: block; overflow-x: auto; }
}

/* Impresión: carta, sin elementos de la app, con pie de página y numeración (los navegadores recientes pintan los cuadros de margen) */
@page {
  size: letter; margin: 16mm 15mm 20mm;
  @bottom-left { content: var(--doc-foot, ""); font: 7.5pt/1.3 'IBM Plex Sans', Arial, sans-serif; color: #587084; }
  @bottom-right { content: "Página " counter(page) " de " counter(pages); font: 7.5pt/1.3 'IBM Plex Sans', Arial, sans-serif; color: #587084; }
}
@media print {
  [data-noprint], #toast, #geo-modal { display: none !important; }
  body { background: #fff; font-size: 10pt; }
  .shell { display: block; }
  .main { padding: 0; }
  .doc { box-shadow: none; border: 0; border-radius: 0; margin: 0; max-width: none; padding: 0; }
  .doc::before { display: none; }
  .doc, .doc * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-title { font-size: 26pt; }
  .doc-contract { font-size: 10.5pt; line-height: 1.5; }
  .c-title { font-size: 17pt; }
  .c-pb { break-after: page; border: 0; margin: 0; }
  .c-h { break-after: avoid; }
  .c-table, .sign2, .plan, .total-band, .accept, .q-cards, .c-kv { break-inside: avoid; }
  .c-table tr { break-inside: avoid; }
  .c-p, .c-list li { orphans: 3; widows: 3; }
  /* la cotización debe caber en una carta: espacios más compactos */
  .doc-quote .lh { margin-bottom: 16px; padding-bottom: 12px; }
  .doc-quote .q-head { margin-bottom: 14px; }
  .doc-quote .q-cards { margin-bottom: 12px; }
  .doc-quote .plan { margin-bottom: 14px; }
  .doc-quote .total-band { margin-top: 10px; padding: 12px 20px; }
  .doc-quote .fine { margin-top: 8px; }
  .doc-quote .lh-logo { height: 48px; }
  .doc-quote .doc-title { font-size: 22pt; margin: 2px 0; }
  .doc-quote .q-card { padding: 9px 14px; }
  .doc-quote .plan-head { padding: 8px 14px; }
  .doc-quote .stats > div { padding: 7px 12px; }
  .doc-quote .items td { padding: 5px 0; }
  .doc-quote .accept { margin-top: 18px; }
  .doc-quote .accept-grid { margin-top: 32px; }
}
