/*
=============================================================
Zenty Emite 2.0
BOLETAS — INTERFAZ COMPACTA Y SIMPLE
=============================================================
Solo modifica distribución y presentación.
No altera API, CAF, folios, XML, TED, firma, PDF ni base de datos.
*/

/* Ocultar el bloque grande Paso 8 / PDF */
body.zenty-boletas-page
  .page-stack
  > .welcome-panel.compact-panel {
  display: none !important;
}

/* Aprovechar el espacio desde el inicio */
body.zenty-boletas-page .page-stack {
  gap: 12px !important;
}

body.zenty-boletas-page .content-grid.two-columns-wide {
  gap: 14px !important;
}

/* Tarjetas principales */
body.zenty-boletas-page .panel-card {
  padding: 16px !important;
  border-radius: 18px !important;
  box-shadow: 0 10px 27px rgba(24, 57, 66, 0.07) !important;
}

body.zenty-boletas-page .panel-card-header {
  margin-bottom: 12px !important;
  padding-bottom: 10px !important;
}

body.zenty-boletas-page .panel-card-header .eyebrow {
  margin-bottom: 3px !important;
  font-size: 0.62rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.085em !important;
}

body.zenty-boletas-page .panel-card-header h3 {
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  letter-spacing: -0.025em !important;
}

body.zenty-boletas-page .panel-card-header > i {
  width: 36px !important;
  height: 36px !important;
  border-radius: 11px !important;
}

/* Formulario principal */
body.zenty-boletas-page .admin-form {
  display: grid !important;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(300px, 0.38fr) !important;
  gap: 12px !important;
  align-items: start !important;
}

body.zenty-boletas-page .admin-form > .form-grid,
body.zenty-boletas-page .admin-form > .soft-info-box,
body.zenty-boletas-page .admin-form > .items-block,
body.zenty-boletas-page .admin-form > .btn-primary.w-100 {
  grid-column: 1 / -1 !important;
}

/* Observación a la izquierda y totales a la derecha */
body.zenty-boletas-page .admin-form > label {
  grid-column: 1 !important;
  align-self: stretch !important;
}

body.zenty-boletas-page .admin-form > .totals-box {
  grid-column: 2 !important;
  align-self: stretch !important;
}

/* Datos básicos */
body.zenty-boletas-page .admin-form .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

body.zenty-boletas-page .admin-form label {
  gap: 5px !important;
  color: #3b555c !important;
  font-size: 0.72rem !important;
  font-weight: 500 !important;
}

body.zenty-boletas-page .admin-form input,
body.zenty-boletas-page .admin-form select,
body.zenty-boletas-page .admin-form textarea {
  min-height: 40px !important;
  padding: 8px 10px !important;
  border-radius: 9px !important;
  font-family: "Inter", sans-serif !important;
  font-size: 0.79rem !important;
  font-weight: 400 !important;
}

body.zenty-boletas-page .admin-form textarea {
  height: 100% !important;
  min-height: 92px !important;
}

/* Empresa seleccionada */
body.zenty-boletas-page .soft-info-box {
  min-height: 54px !important;
  padding: 10px 12px !important;
  border-radius: 11px !important;
}

body.zenty-boletas-page .soft-info-box strong {
  font-size: 0.76rem !important;
  font-weight: 600 !important;
}

body.zenty-boletas-page .soft-info-box span {
  font-size: 0.66rem !important;
}

/* Detalle de productos */
body.zenty-boletas-page .items-block {
  padding: 12px !important;
  border-radius: 13px !important;
}

body.zenty-boletas-page .section-title-row {
  margin-bottom: 9px !important;
}

body.zenty-boletas-page .section-title-row h4 {
  font-size: 0.91rem !important;
  font-weight: 600 !important;
}

body.zenty-boletas-page .section-title-row .btn {
  min-height: 35px !important;
  padding: 0 11px !important;
  font-size: 0.68rem !important;
  font-weight: 600 !important;
}

/* Cada producto completo en una fila */
body.zenty-boletas-page .item-editor {
  grid-template-columns:
    minmax(210px, 2.25fr)
    minmax(78px, 0.62fr)
    minmax(112px, 0.95fr)
    minmax(94px, 0.78fr)
    minmax(76px, 0.62fr)
    minmax(76px, 0.62fr)
    36px !important;
  gap: 8px !important;
  margin-bottom: 8px !important;
  padding: 10px !important;
  border-radius: 11px !important;
  box-shadow: none !important;
}

body.zenty-boletas-page .item-editor .checkbox-line {
  min-height: 40px !important;
  border-radius: 9px !important;
  font-size: 0.68rem !important;
  font-weight: 500 !important;
}

body.zenty-boletas-page .item-editor > .btn-link {
  width: 36px !important;
  min-width: 36px !important;
  height: 40px !important;
  min-height: 40px !important;
  border-radius: 9px !important;
}

/* Totales: 2 x 2, compactos y legibles */
body.zenty-boletas-page .totals-box {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  height: 100% !important;
  min-height: 92px !important;
  border-radius: 11px !important;
}

body.zenty-boletas-page .totals-box > div {
  min-height: 46px !important;
  padding: 8px 10px !important;
  border-right: 1px solid #e2ebed !important;
  border-bottom: 1px solid #e2ebed !important;
}

body.zenty-boletas-page .totals-box > div:nth-child(2n) {
  border-right: 0 !important;
}

body.zenty-boletas-page .totals-box > div:nth-last-child(-n + 2) {
  border-bottom: 0 !important;
}

body.zenty-boletas-page .totals-box span {
  font-size: 0.66rem !important;
  font-weight: 500 !important;
}

body.zenty-boletas-page .totals-box strong {
  font-size: 0.82rem !important;
  font-weight: 600 !important;
}

body.zenty-boletas-page .totals-box .total-final strong {
  font-size: 0.94rem !important;
}

/* Botón de emisión */
body.zenty-boletas-page .admin-form > .btn-primary.w-100 {
  min-height: 43px !important;
  margin: 0 !important;
  border-radius: 10px !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
}

/* Historial más compacto */
body.zenty-boletas-page .panel-card.muted-card {
  padding-top: 14px !important;
}

body.zenty-boletas-page .soft-table th,
body.zenty-boletas-page .soft-table td {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

body.zenty-boletas-page .soft-table thead th {
  font-size: 0.62rem !important;
  font-weight: 600 !important;
}

body.zenty-boletas-page .soft-table tbody td {
  height: 52px !important;
  font-size: 0.73rem !important;
}

/* Mantener acciones en una fila amplia */
@media (min-width: 1200px) {
  body.zenty-boletas-page .soft-table th:nth-child(1),
  body.zenty-boletas-page .soft-table td:nth-child(1) {
    width: 9% !important;
  }

  body.zenty-boletas-page .soft-table th:nth-child(2),
  body.zenty-boletas-page .soft-table td:nth-child(2) {
    width: 6% !important;
  }

  body.zenty-boletas-page .soft-table th:nth-child(3),
  body.zenty-boletas-page .soft-table td:nth-child(3) {
    width: 19% !important;
  }

  body.zenty-boletas-page .soft-table th:nth-child(4),
  body.zenty-boletas-page .soft-table td:nth-child(4) {
    width: 9% !important;
  }

  body.zenty-boletas-page .soft-table th:nth-child(5),
  body.zenty-boletas-page .soft-table td:nth-child(5) {
    width: 8% !important;
  }

  body.zenty-boletas-page .soft-table th:nth-child(6),
  body.zenty-boletas-page .soft-table td:nth-child(6) {
    width: 49% !important;
  }

  body.zenty-boletas-page .soft-table td:last-child,
  body.zenty-boletas-page .soft-table td:last-child.d-flex {
    overflow: visible !important;
    white-space: nowrap !important;
  }

  body.zenty-boletas-page .soft-table td:last-child .btn {
    min-height: 34px !important;
    margin-right: 4px !important;
    padding: 0 9px !important;
    font-size: 0.64rem !important;
    font-weight: 600 !important;
  }
}

/* Notebook */
@media (max-width: 1350px) and (min-width: 1051px) {
  body.zenty-boletas-page .item-editor {
    grid-template-columns:
      minmax(190px, 1.8fr)
      repeat(4, minmax(80px, 0.75fr))
      minmax(76px, 0.65fr)
      36px !important;
  }
}

/* Tablet: observación y totales dejan de compartir fila */
@media (max-width: 1050px) {
  body.zenty-boletas-page .admin-form {
    grid-template-columns: 1fr !important;
  }

  body.zenty-boletas-page .admin-form > label,
  body.zenty-boletas-page .admin-form > .totals-box {
    grid-column: 1 !important;
  }

  body.zenty-boletas-page .admin-form .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.zenty-boletas-page .item-editor {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body.zenty-boletas-page .item-editor > label:first-child {
    grid-column: span 2 !important;
  }

  body.zenty-boletas-page .admin-form textarea {
    min-height: 70px !important;
  }

  body.zenty-boletas-page .totals-box {
    min-height: 0 !important;
  }
}

/* Celular */
@media (max-width: 720px) {
  body.zenty-boletas-page .panel-card {
    padding: 12px !important;
    border-radius: 15px !important;
  }

  body.zenty-boletas-page .admin-form .form-grid,
  body.zenty-boletas-page .item-editor {
    grid-template-columns: 1fr !important;
  }

  body.zenty-boletas-page .item-editor > label:first-child {
    grid-column: 1 !important;
  }

  body.zenty-boletas-page .section-title-row {
    align-items: stretch !important;
  }

  body.zenty-boletas-page .section-title-row .btn {
    width: 100% !important;
  }

  body.zenty-boletas-page .item-editor > .btn-link {
    width: 100% !important;
    min-width: 100% !important;
  }

  body.zenty-boletas-page .totals-box {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.zenty-boletas-page .soft-table tbody td {
    height: auto !important;
  }
}

@media (max-width: 430px) {
  body.zenty-boletas-page .totals-box {
    grid-template-columns: 1fr !important;
  }

  body.zenty-boletas-page .totals-box > div,
  body.zenty-boletas-page .totals-box > div:nth-child(2n),
  body.zenty-boletas-page .totals-box > div:nth-last-child(-n + 2) {
    border-right: 0 !important;
    border-bottom: 1px solid #e2ebed !important;
  }

  body.zenty-boletas-page .totals-box > div:last-child {
    border-bottom: 0 !important;
  }
}
