/* Exact print templates for Registro de Gastos Menores & Liquidacion de Cheques */

.print-sheet {
  background: #fff;
  color: #000;
  width: 8.5in;
  min-height: 10.6in;
  padding: 0.45in 0.55in;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  font-family: Calibri, 'Segoe UI', Arial, sans-serif;
  font-size: 11pt;
  line-height: 1.2;
}

/* ==================== PLANTILLA 1: REGISTRO DE GASTOS MENORES ==================== */
.tpl-reg-top {
  display: grid;
  grid-template-columns: 185px 1fr;
  align-items: end;
  gap: 12px;
}

.tpl-reg-logo {
  width: 170px;
  height: auto;
  display: block;
}

.tpl-reg-title {
  text-align: center;
  font-size: 12pt;
  font-weight: 700;
  padding-bottom: 4px;
  letter-spacing: 0.2px;
}

.tpl-reg-entity-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 2px;
  margin-bottom: 14px;
  font-size: 10.5pt;
}

.tpl-reg-entity-left div { line-height: 1.3; }

.tpl-reg-ncf-box {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 14px;
  row-gap: 3px;
  text-align: left;
  margin-top: 2px;
}
.tpl-reg-ncf-box .lbl { font-weight: 700; text-align: right; }
.tpl-reg-ncf-box .lbl-sm { font-size: 9.5pt; font-weight: 700; }
.tpl-reg-ncf-box .val-right { text-align: right; }

.tpl-reg-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.tpl-reg-field {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.tpl-reg-field .flbl {
  font-weight: 700;
  font-size: 11pt;
  white-space: nowrap;
  line-height: 1.1;
  padding-bottom: 1px;
}
.tpl-reg-field .fval {
  flex: 1;
  border-bottom: 1px solid #000;
  font-size: 11.5pt;
  padding: 6px 4px 1px 4px;
  min-height: 22px;
  line-height: 1.15;
}
.tpl-reg-field.fecha-row .fval {
  flex: 0 0 170px;
  border-bottom: 1px solid #000;
  padding: 6px 4px 1px 4px;
}

.tpl-reg-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.tpl-reg-table th, .tpl-reg-table td {
  border: 1px solid #000;
  padding: 3px 6px 2px 6px;
  vertical-align: bottom;
}
.tpl-reg-table thead th {
  background: #8c8c8c;
  color: #000;
  font-weight: 700;
  font-size: 11pt;
  text-align: center;
  vertical-align: middle;
  padding: 4px 6px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.tpl-reg-table tbody td {
  height: 30px;
  font-size: 11pt;
}
.tpl-reg-table col.c-ord  { width: 14%; }
.tpl-reg-table col.c-desc { width: 56%; }
.tpl-reg-table col.c-totl { width: 13%; }
.tpl-reg-table col.c-imp  { width: 17%; }

.tpl-reg-table td.ord { text-align: center; }
.tpl-reg-table td.desc { text-align: left; word-wrap: break-word; }
.tpl-reg-table td.imp { text-align: right; font-variant-numeric: tabular-nums; }

.tpl-reg-total-row td {
  border: none !important;
  height: 22px !important;
  padding: 2px 6px;
  vertical-align: bottom;
}
.tpl-reg-total-row td.tot-lbl {
  border: 1px solid #000 !important;
  border-top: none !important;
  font-weight: 700;
  text-align: left;
}
.tpl-reg-total-row td.tot-val {
  border: 1px solid #000 !important;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tpl-reg-signs {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.tpl-reg-sign-line {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 65%;
}
.tpl-reg-sign-line .slbl {
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.1;
  padding-bottom: 1px;
}
.tpl-reg-sign-line .sval {
  flex: 1;
  border-bottom: 1px solid #000;
  min-height: 20px;
  padding: 4px 4px 1px 4px;
  line-height: 1.1;
}

/* ==================== PLANTILLA 2: LIQUIDACION DE CHEQUES ==================== */
.tpl-liq {
  padding: 0.35in 0.45in;
}

.tpl-liq-title {
  border: 1px solid #000;
  text-align: center;
  font-weight: 700;
  font-size: 11.5pt;
  padding: 6px;
  margin-bottom: 6px;
}

.tpl-liq-header-grid {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}
.tpl-liq-header-grid td {
  padding: 10px 5px 1px 5px;
  vertical-align: bottom;
  line-height: 1.15;
}
.tpl-liq-header-grid .hlbl {
  font-family: Arial, Calibri, sans-serif;
  font-weight: 700;
  font-size: 10.5pt;
  white-space: nowrap;
}
.tpl-liq-header-grid .hlbl-wrap {
  font-family: Calibri, Arial, sans-serif;
  font-weight: 700;
  font-size: 11pt;
}
.tpl-liq-header-grid .hval {
  font-size: 11.5pt;
  border-bottom: 1px solid #000;
  padding-left: 4px;
  padding-right: 4px;
}
.tpl-liq-header-grid .hval-bold {
  font-weight: 700;
}

.tpl-liq-sec-tab {
  display: inline-block;
  border: 1px solid #000;
  font-weight: 700;
  font-size: 10.5pt;
  padding: 2px 18px;
  margin-bottom: -1px;
  position: relative;
  background: #fff;
}

.tpl-liq-cheque-box {
  border: 1px solid #000;
  height: 2.95in;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  padding: 2px;
  overflow: hidden;
}
.tpl-liq-cheque-box img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}

.tpl-liq-fact-tab {
  display: inline-block;
  border: 1px solid #000;
  font-weight: 700;
  font-size: 10.5pt;
  padding: 2px 22px;
  margin-bottom: 10px;
}

.tpl-liq-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.tpl-liq-table th, .tpl-liq-table td {
  border: 1px solid #000;
  padding: 4px 6px 2px 6px;
  vertical-align: bottom;
  font-size: 10.5pt;
}
.tpl-liq-table thead th {
  font-weight: 700;
  text-align: center;
  vertical-align: middle;
  padding: 6px 5px;
}
.tpl-liq-table col.c-part  { width: 35%; }
.tpl-liq-table col.c-nfac  { width: 18%; }
.tpl-liq-table col.c-fec   { width: 17%; }
.tpl-liq-table col.c-imp   { width: 15%; }
.tpl-liq-table col.c-dorso { width: 15%; }

.tpl-liq-table tbody td {
  min-height: 28px;
}
.tpl-liq-table td.part { text-align: left; word-wrap: break-word; }
.tpl-liq-table td.nfac { text-align: center; word-wrap: break-word; }
.tpl-liq-table td.fec  { text-align: right; }
.tpl-liq-table td.imp  { text-align: right; font-variant-numeric: tabular-nums; }
.tpl-liq-table th.no-b,
.tpl-liq-table td.no-b { border: none !important; }
.tpl-liq-table td.s-lbl-wide { text-align: right; font-weight: 700; }
.tpl-liq-table td.s-lbl-box { font-weight: 700; text-align: left; }
.tpl-liq-table td.s-val-box { text-align: right; font-variant-numeric: tabular-nums; }
.tpl-liq-table td.s-val-box.center { text-align: center; }
.tpl-liq-table td.s-lbl-bold { font-weight: 700; }
.tpl-liq-table td.s-note { border: none !important; font-weight: 700; padding-left: 10px; }

/* ==================== PRINT MEDIA QUERY ==================== */
@page {
  size: letter portrait;
  margin: 0.25in;
}

@media print {
  body { background: #fff !important; margin: 0 !important; }
  #auth-screen, #app-shell, #modal-registro, #modal-liquidacion, #modal-import-reg, #modal-gasto-directo, #toast, .no-print {
    display: none !important;
  }
  #modal-print {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
    display: block !important;
  }
  #modal-print .modal-preview {
    max-width: none !important;
    max-height: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 0 !important;
  }
  #modal-print .modal-body, .preview-scroll {
    padding: 0 !important;
    overflow: visible !important;
  }
  .print-sheet {
    box-shadow: none !important;
    width: 100% !important;
    min-height: auto !important;
    padding: 0.2in 0.3in !important;
    page-break-after: avoid;
  }
}
