:root {
  --verde: #174d45;
  --tinta: #203a35;
  --suave: #edf3ee;
  --borde: #dedfd5;
  --papel: #fffef9;
  --gris: #69746d;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(130deg, #eef2e7, #faf8f1 65%, #e9f0ea);
  color: var(--tinta);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #b98235;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.app {
  max-width: 1040px;
  margin: auto;
  padding: 0 28px;
}
.cabecera {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 0 22px;
  border-bottom: 1px solid var(--borde);
}
.marca {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--verde);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.8px;
}
.marca small {
  display: block;
  font-size: 9px;
  letter-spacing: 1.7px;
  font-weight: 600;
}
.isotipo {
  border: 2px solid var(--verde);
  border-radius: 9px;
  display: grid;
  place-content: center;
  width: 46px;
  height: 49px;
  font-size: 18px;
  line-height: 1.1;
}
.isotipo span {
  font-size: 20px;
  text-align: center;
}
.version,
.nota,
.ayuda {
  font-size: 13px;
  color: var(--gris);
}
nav {
  display: flex;
  gap: 8px;
  padding: 16px 0;
}
nav button {
  border: none;
  background: transparent;
  padding: 10px 18px;
  color: var(--gris);
  border-radius: 9px;
  font-weight: bold;
}
nav button.activo {
  background: var(--verde);
  color: white;
}
main {
  min-height: 65vh;
}
.vista {
  padding-bottom: 26px;
}
h1 {
  font-size: 38px;
  line-height: 1.15;
  letter-spacing: -1.3px;
  margin: 14px 0 20px;
}
h2 {
  font-size: 19px;
  letter-spacing: -0.4px;
  margin: 0 0 16px;
}
h3 {
  font-size: 16px;
  margin: 0;
}
.portada {
  position: relative;
  background: var(--papel);
  border: 1px solid var(--borde);
  border-radius: 17px;
  padding: 42px;
  margin: 12px 0 30px;
  box-shadow: 0 8px 24px #273f2e05;
  border-top: 5px solid var(--verde);
}
.portada:after {
  content: "P / R";
  position: absolute;
  right: 32px;
  top: 34px;
  border: 1px solid #d2d9cc;
  border-radius: 50%;
  width: 75px;
  height: 75px;
  display: grid;
  place-content: center;
  color: #aab7a2;
  font-family: Georgia, serif;
  font-size: 24px;
  transform: rotate(-14deg);
}
.portada p {
  max-width: 430px;
  color: var(--gris);
  margin-bottom: 26px;
}
.etiqueta {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: bold;
  color: var(--verde);
}
.acciones {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.primario,
.secundario,
.boton-importar {
  border: 1px solid transparent;
  border-radius: 9px;
  min-height: 48px;
  padding: 12px 19px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.primario {
  background: var(--verde);
  color: white;
}
.primario:hover {
  background: #23685b;
}
.secundario {
  background: var(--suave);
  color: var(--verde);
  border-color: #cedbcf;
}
.secundario:hover {
  background: #dce8de;
}
.ancho {
  width: 100%;
}
.nota {
  display: block;
  margin-top: 20px;
  font-size: 11px;
}
.encabezado-seccion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 14px;
}
.encabezado-seccion h2 {
  margin: 0;
}
.texto {
  background: none;
  border: 0;
  color: var(--verde);
  padding: 10px 0;
  font-weight: bold;
  font-size: 14px;
}
.estadisticas {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.estadistica {
  background: #ffffff80;
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 18px;
}
.estadistica strong {
  display: block;
  font-size: 26px;
}
.estadistica span {
  font-size: 12px;
  color: var(--gris);
}
.consejo {
  border-left: 3px solid #c6a46e;
  padding: 12px 20px;
  margin-top: 28px;
}
.consejo p {
  margin: 4px 0;
  font-size: 14px;
  color: var(--gris);
}
.tarjeta {
  background: var(--papel);
  padding: 24px;
  border: 1px solid var(--borde);
  border-radius: 13px;
  margin-bottom: 16px;
}
.paso {
  display: inline-grid;
  place-content: center;
  width: 26px;
  height: 26px;
  background: var(--suave);
  border-radius: 6px;
  font-size: 13px;
  margin-right: 8px;
}
label {
  display: block;
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 7px;
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid #ced5ca;
  border-radius: 8px;
  background: white;
  color: var(--tinta);
  padding: 12px;
  min-height: 46px;
  margin: 0 0 16px;
  outline: none;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--verde);
  box-shadow: 0 0 0 3px #174d4512;
}
input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  margin: 0;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dos-columnas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}
.sello {
  font-size: 9px;
  border: 1px solid #96a99a;
  padding: 8px;
  text-align: center;
  letter-spacing: 1px;
  color: var(--gris);
}
.error {
  color: #a3312a;
  font-size: 13px;
  min-height: 0;
}
.error:empty {
  display: none;
}
.renglon {
  border-bottom: 1px dashed var(--borde);
  padding: 14px 0;
  display: flex;
  gap: 12px;
  align-items: center;
}
.renglon .detalle {
  flex: 1;
  overflow-wrap: anywhere;
}
.renglon small {
  display: block;
  color: var(--gris);
}
.eliminar {
  border: 0;
  border-radius: 8px;
  background: #f8e9e3;
  color: #923b2e;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 2px solid var(--verde);
}
.total strong {
  font-size: 25px;
}
.barra-guardar {
  position: sticky;
  bottom: 10px;
  padding: 8px;
  background: #f4f5eccf;
  backdrop-filter: blur(8px);
  border-radius: 12px;
  z-index: 2;
}
.doc-fila {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--papel);
  border: 1px solid var(--borde);
  border-radius: 10px;
  margin-bottom: 10px;
}
.doc-fila .info {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.doc-fila small {
  display: block;
  color: var(--gris);
  font-size: 12px;
}
.tipo-icono {
  width: 40px;
  height: 45px;
  display: grid;
  place-content: center;
  background: #ebeee2;
  border: 1px solid #d2d8c4;
  border-radius: 5px;
  font-family: Georgia, serif;
  font-size: 23px;
  color: var(--verde);
}
.doc-fila .abrir {
  border: 0;
  background: var(--suave);
  border-radius: 7px;
  color: var(--verde);
  padding: 10px 13px;
  font-weight: bold;
}
.vacio {
  border: 1px dashed #bcc9b6;
  border-radius: 12px;
  padding: 35px 20px;
  text-align: center;
  color: var(--gris);
}
.vacio strong {
  display: block;
  color: var(--tinta);
  margin-bottom: 5px;
}
.filtros {
  display: flex;
  gap: 12px;
}
.filtros input {
  flex: 1;
  min-width: 0;
}
.filtros select {
  width: 170px;
}
.herramientas {
  margin: 12px 0;
}
.herramientas .acciones {
  margin-top: 8px;
}
.papel {
  background: white;
  border: 1px solid #d5d7cd;
  box-shadow: 0 10px 30px #00000006;
  padding: 38px;
  overflow-wrap: anywhere;
  color: #202620;
  font-family: Arial, sans-serif;
}
.doc-cabecera {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 2px solid #34493b;
}
.doc-cabecera h2 {
  font-size: 25px;
  margin: 3px 0 10px;
  font-family: Georgia, serif;
}
.doc-cabecera p {
  margin: 3px 0;
  font-size: 12px;
}
.doc-derecha {
  text-align: right;
}
.letra-doc {
  display: inline-grid;
  place-content: center;
  border: 2px solid #34493b;
  width: 40px;
  height: 40px;
  font-size: 25px;
  font-family: Georgia, serif;
}
.doc-cliente {
  margin: 22px 0;
  font-size: 13px;
}
.doc-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.doc-tabla th {
  background: #edf1e9;
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.doc-tabla td,
.doc-tabla th {
  padding: 12px 7px;
  border-bottom: 1px solid #dee2d8;
  vertical-align: top;
}
.doc-tabla .numero {
  text-align: right;
  width: 20%;
}
.doc-tabla .cantidad-col {
  width: 14%;
  text-align: center;
}
.doc-total {
  text-align: right;
  font-size: 21px;
  font-weight: bold;
  margin: 22px 0;
}
.doc-notas {
  white-space: pre-wrap;
  font-size: 12px;
  margin: 24px 0;
  line-height: 1.7;
}
.firmas {
  display: flex;
  justify-content: space-around;
  gap: 25px;
  margin: 80px 0 20px;
  font-size: 11px;
  text-align: center;
}
.firmas span {
  border-top: 1px solid #8b9388;
  padding-top: 8px;
  flex: 1;
}
.doc-pie {
  border-top: 1px solid #dee2d8;
  text-align: center;
  font-size: 9px;
  margin-top: 35px;
  padding-top: 14px;
  letter-spacing: 0.5px;
}
.logo-doc {
  max-width: 130px;
  max-height: 70px;
  object-fit: contain;
  margin-bottom: 8px;
}
#logo-actual img {
  max-width: 130px;
  max-height: 80px;
}
.boton-importar {
  cursor: pointer;
  margin-top: 10px;
  border-color: var(--borde);
  width: 100%;
  font-size: 14px;
}
footer {
  text-align: center;
  color: var(--gris);
  font-size: 12px;
  border-top: 1px solid var(--borde);
  padding: 24px 0;
  margin-top: 20px;
}
footer span {
  padding: 0 7px;
}
footer p {
  font-size: 10px;
  margin: 7px 0;
}
#aviso {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  width: max-content;
  background: var(--verde);
  color: white;
  padding: 13px 22px;
  border-radius: 10px;
  box-shadow: 0 5px 25px #0002;
  z-index: 10;
  font-size: 14px;
}
@media (max-width: 600px) {
  .app {
    padding: 0 16px;
  }
  .cabecera {
    padding: 20px 0 16px;
  }
  .marca {
    font-size: 23px;
  }
  .version {
    font-size: 10px;
    max-width: 75px;
    text-align: right;
  }
  nav {
    gap: 2px;
  }
  nav button {
    padding: 10px 13px;
    flex: 1;
    font-size: 13px;
  }
  h1 {
    font-size: 30px;
  }
  .portada {
    padding: 26px 22px;
    margin-top: 5px;
  }
  .portada:after {
    display: none;
  }
  .portada .acciones {
    display: grid;
  }
  .portada p {
    font-size: 14px;
  }
  .encabezado-seccion {
    gap: 8px;
  }
  .encabezado-seccion h2 {
    font-size: 18px;
  }
  .estadistica {
    padding: 13px 10px;
  }
  .estadistica strong {
    font-size: 23px;
  }
  .estadistica span {
    font-size: 10px;
  }
  .tarjeta {
    padding: 20px 16px;
  }
  .dos-columnas {
    gap: 0 12px;
  }
  .dos-columnas > div:first-child:nth-last-child(n + 3),
  .dos-columnas > div:nth-child(2):nth-last-child(n + 3),
  .dos-columnas > div:nth-child(3):nth-last-child(n + 2) {
    grid-column: 1/-1;
  }
  .filtros {
    gap: 8px;
  }
  .filtros select {
    width: 125px;
    font-size: 13px;
  }
  .doc-fila {
    gap: 10px;
    padding: 14px 11px;
  }
  .doc-fila strong {
    font-size: 14px;
  }
  .doc-fila .abrir {
    padding: 10px;
  }
  .papel {
    padding: 20px 12px;
  }
  .doc-cabecera {
    gap: 10px;
  }
  .doc-cabecera h2 {
    font-size: 19px;
  }
  .doc-tabla {
    font-size: 11px;
  }
  .doc-tabla td,
  .doc-tabla th {
    padding: 10px 4px;
  }
  .doc-tabla th {
    font-size: 8px;
  }
  .herramientas .acciones {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .herramientas button {
    font-size: 12px;
    padding: 11px;
  }
  .total strong {
    font-size: 22px;
  }
}
@page {
  size: A4;
  margin: 14mm;
}
@media print {
  body {
    background: white;
  }
  .app {
    max-width: none;
    padding: 0;
  }
  .cabecera,
  nav,
  footer,
  #aviso,
  .herramientas,
  .pantalla {
    display: none !important;
  }
  main,
  .vista {
    padding: 0;
    min-height: 0;
  }
  .papel {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  .doc-tabla thead {
    display: table-header-group;
  }
  .doc-tabla tr {
    break-inside: avoid;
  }
  .doc-cabecera,
  .doc-total,
  .firmas {
    break-inside: avoid;
  }
  .doc-tabla th {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* Flecha del selector centrada, con espacio propio dentro del campo. */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23174d45' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 16px 16px;
  background-position: right 14px center;
}
/* Flechas numéricas alineadas al centro del área útil del campo. */
input[type="number"] {
  line-height: 24px;
}
input[type="number"]::-webkit-inner-spin-button {
  opacity: 1;
  height: 24px;
  margin: 0;
}
@media (forced-colors: active) {
  select {
    appearance: auto;
    background-image: none;
  }
}

/* Acceso y estado de sincronización. */
.acceso {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 52px;
  align-items: start;
  padding: 54px 0 28px;
  min-height: 66vh;
}
.presentacion-acceso h1 {
  font-size: 42px;
  margin-top: 18px;
  line-height: 1.15;
}
.presentacion-acceso p {
  color: var(--gris);
  max-width: 360px;
  font-size: 16px;
}
.presentacion-acceso ul {
  padding-left: 19px;
  color: var(--verde);
  line-height: 2.1;
  font-size: 14px;
}
.tarjeta-acceso {
  padding: 30px;
  margin: 0;
}
.tarjeta-acceso h2 {
  font-size: 24px;
  margin-bottom: 8px;
}
.pestanas-acceso {
  display: flex;
  padding: 4px;
  background: var(--suave);
  border-radius: 10px;
  margin-bottom: 26px;
  gap: 4px;
}
.pestanas-acceso button {
  flex: 1;
  border: 0;
  border-radius: 7px;
  padding: 10px 6px;
  background: none;
  color: var(--verde);
  font-weight: bold;
  font-size: 14px;
}
.pestanas-acceso button.activo {
  background: white;
  box-shadow: 0 2px 5px #0001;
}
.campo-clave {
  position: relative;
}
.campo-clave input {
  padding-right: 58px;
}
.campo-clave button {
  position: absolute;
  right: 7px;
  top: 5px;
  height: 36px;
  width: 44px;
  border: 0;
  border-radius: 5px;
  background: var(--suave);
  color: var(--verde);
  font-size: 12px;
  font-weight: bold;
}
.mensaje-acceso {
  font-size: 13px;
  white-space: pre-wrap;
}
.mensaje-acceso.error {
  color: #a3312a;
}
.mensaje-config {
  padding: 16px;
  border: 1px solid #d4be8b;
  border-radius: 9px;
  background: #faf4e4;
  font-size: 13px;
}
.mensaje-config p {
  margin-bottom: 0;
}
.barra-cuenta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--borde);
}
.barra-cuenta > div {
  min-width: 0;
}
.barra-cuenta strong {
  display: block;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.barra-cuenta small {
  display: block;
  color: var(--gris);
  font-size: 11px;
}
.barra-cuenta button {
  flex-shrink: 0;
  font-size: 12px;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.rescate-local {
  border-top: 1px solid var(--borde);
  margin-top: 24px;
  padding-top: 20px;
  font-size: 13px;
}
#panel-verificacion .secundario {
  margin-top: 10px;
}
#mensaje-verificacion,
#mensaje-error-nube {
  font-size: 13px;
  color: var(--gris);
}
@media (max-width: 720px) {
  .acceso {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 28px 0;
  }
  .presentacion-acceso h1 {
    font-size: 31px;
  }
  .presentacion-acceso p {
    font-size: 14px;
    max-width: none;
  }
  .presentacion-acceso ul {
    display: none;
  }
  .tarjeta-acceso {
    padding: 24px 18px;
  }
  .barra-cuenta strong {
    font-size: 12px;
  }
}
@media print {
  #acceso,
  #barra-cuenta {
    display: none !important;
  }
}
