/*
=============================================================
ZENTY EMITE 2.0 — MÓDULO BOLETAS
Diseño moderno, compacto y 100 % responsive
Versión 3.0.0
=============================================================

Este archivo modifica solamente la presentación visual.
No altera la API, base de datos, folios, CAF, XML, TED ni PDF.
*/

:root {
  --zenty-primary: #0f766e;
  --zenty-primary-dark: #115e59;
  --zenty-primary-light: #14b8a6;
  --zenty-primary-soft: #e6fffb;
  --zenty-ink: #16343b;
  --zenty-muted: #60757b;
  --zenty-border: #dbe7ea;
  --zenty-surface: #ffffff;
  --zenty-surface-soft: #f6fafb;
  --zenty-danger: #dc3545;
  --zenty-shadow: 0 14px 38px rgba(24, 57, 66, 0.09);
  --zenty-radius-xl: 22px;
  --zenty-radius-lg: 16px;
  --zenty-radius-md: 12px;
}

/* Evita cualquier desborde horizontal global. */
html,
body,
#root {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

html,
body {
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Solo se aplica cuando React está mostrando /boletas. */
body.zenty-boletas-page {
  background:
    radial-gradient(circle at 7% 2%, rgba(20, 184, 166, 0.10), transparent 28rem),
    linear-gradient(180deg, #f7fbfb 0%, #eef5f6 100%);
}

body.zenty-boletas-page .app-shell,
body.zenty-boletas-page .app-main,
body.zenty-boletas-page .app-content,
body.zenty-boletas-page .page-stack {
  min-width: 0;
  max-width: 100%;
}

body.zenty-boletas-page .app-content {
  padding: clamp(0.85rem, 1.6vw, 1.35rem);
}

body.zenty-boletas-page .page-stack {
  display: grid;
  gap: 1rem;
  width: 100%;
}

/* =========================================================
   ENCABEZADO COMPACTO
   ========================================================= */

body.zenty-boletas-page .welcome-panel.compact-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  overflow: hidden;
  min-height: auto;
  margin: 0;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--zenty-radius-xl);
  background:
    radial-gradient(circle at 92% 10%, rgba(255, 255, 255, 0.17), transparent 30%),
    linear-gradient(135deg, #0f766e 0%, #115e59 54%, #134e4a 100%);
  box-shadow: 0 14px 34px rgba(15, 76, 72, 0.18);
  color: #ffffff;
}

body.zenty-boletas-page .welcome-panel.compact-panel::after {
  content: "";
  position: absolute;
  right: -55px;
  bottom: -85px;
  width: 170px;
  height: 170px;
  border: 25px solid rgba(255, 255, 255, 0.055);
  border-radius: 50%;
  pointer-events: none;
}

body.zenty-boletas-page .welcome-panel.compact-panel > div {
  position: relative;
  z-index: 1;
  min-width: 0;
}

body.zenty-boletas-page .welcome-panel .eyebrow {
  color: #a7f3d0;
  font-size: 0.68rem;
  letter-spacing: 0.13em;
}

body.zenty-boletas-page .welcome-panel h2 {
  margin: 0.18rem 0 0.28rem;
  color: #ffffff;
  font-size: clamp(1.25rem, 2.1vw, 1.8rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

body.zenty-boletas-page .welcome-panel p {
  max-width: 900px;
  margin: 0;
  color: rgba(255, 255, 255, 0.79);
  font-size: clamp(0.78rem, 1.1vw, 0.92rem);
  line-height: 1.45;
}

body.zenty-boletas-page .welcome-panel .status-pill {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  margin: 0;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
}

/* =========================================================
   ESTRUCTURA: EMISIÓN ARRIBA E HISTORIAL DEBAJO
   ========================================================= */

body.zenty-boletas-page .content-grid.two-columns-wide {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  align-items: start;
  gap: 1rem;
  width: 100%;
  min-width: 0;
}

body.zenty-boletas-page .content-grid.two-columns-wide > .panel-card {
  width: 100%;
  min-width: 0;
  margin: 0;
}

body.zenty-boletas-page .panel-card {
  overflow: hidden;
  padding: clamp(0.95rem, 1.6vw, 1.25rem);
  border: 1px solid var(--zenty-border);
  border-radius: var(--zenty-radius-xl);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--zenty-shadow);
}

body.zenty-boletas-page .panel-card.muted-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfc 100%);
}

body.zenty-boletas-page .panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin: 0 0 0.9rem;
  padding: 0 0 0.75rem;
  border-bottom: 1px solid #e7eff1;
}

body.zenty-boletas-page .panel-card-header > div {
  min-width: 0;
}

body.zenty-boletas-page .panel-card-header h3 {
  margin: 0.08rem 0 0;
  color: var(--zenty-ink);
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  line-height: 1.15;
}

body.zenty-boletas-page .panel-card-header > i {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--zenty-primary-soft);
  color: var(--zenty-primary);
  font-size: 1rem;
}

/* =========================================================
   FORMULARIO COMPACTO Y ORDENADO
   ========================================================= */

body.zenty-boletas-page .admin-form {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
}

body.zenty-boletas-page .admin-form .form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  min-width: 0;
}

body.zenty-boletas-page .admin-form label {
  display: grid;
  min-width: 0;
  gap: 0.35rem;
  margin: 0;
  color: #344f56;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.25;
}

body.zenty-boletas-page .admin-form input,
body.zenty-boletas-page .admin-form select,
body.zenty-boletas-page .admin-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 41px;
  margin: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid #ccdde1;
  border-radius: 10px;
  background: #ffffff;
  color: var(--zenty-ink);
  font-size: 0.86rem;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

body.zenty-boletas-page .admin-form textarea {
  min-height: 64px;
  resize: vertical;
}

body.zenty-boletas-page .admin-form input:hover,
body.zenty-boletas-page .admin-form select:hover,
body.zenty-boletas-page .admin-form textarea:hover {
  border-color: #afc9ce;
}

body.zenty-boletas-page .admin-form input:focus,
body.zenty-boletas-page .admin-form select:focus,
body.zenty-boletas-page .admin-form textarea:focus {
  border-color: var(--zenty-primary-light);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

/* Empresa seleccionada. */
body.zenty-boletas-page .soft-info-box {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  margin: 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid #cce9e5;
  border-radius: 12px;
  background: #f0fdfa;
}

body.zenty-boletas-page .soft-info-box i {
  flex: 0 0 auto;
  color: var(--zenty-primary);
}

body.zenty-boletas-page .soft-info-box div {
  min-width: 0;
}

body.zenty-boletas-page .soft-info-box strong,
body.zenty-boletas-page .soft-info-box span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

body.zenty-boletas-page .soft-info-box strong {
  color: var(--zenty-ink);
  font-size: 0.82rem;
}

body.zenty-boletas-page .soft-info-box span {
  color: var(--zenty-muted);
  font-size: 0.72rem;
}

/* =========================================================
   PRODUCTOS Y SERVICIOS
   ========================================================= */

body.zenty-boletas-page .items-block {
  min-width: 0;
  margin: 0;
  padding: 0.85rem;
  border: 1px solid #dce8eb;
  border-radius: 14px;
  background: #f7fafb;
}

body.zenty-boletas-page .section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  margin: 0 0 0.65rem;
}

body.zenty-boletas-page .section-title-row h4 {
  margin: 0.08rem 0 0;
  color: var(--zenty-ink);
  font-size: 0.98rem;
}

body.zenty-boletas-page .item-editor {
  display: grid;
  grid-template-columns:
    minmax(180px, 2.2fr)
    minmax(78px, 0.65fr)
    minmax(110px, 1fr)
    minmax(95px, 0.85fr)
    minmax(78px, 0.65fr)
    minmax(82px, 0.65fr)
    38px;
  align-items: end;
  gap: 0.55rem;
  min-width: 0;
  margin-bottom: 0.6rem;
  padding: 0.7rem;
  border: 1px solid #dce7ea;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(23, 52, 59, 0.035);
}

body.zenty-boletas-page .item-editor:last-child {
  margin-bottom: 0;
}

body.zenty-boletas-page .item-editor .checkbox-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 41px;
  padding: 0 0.45rem;
  border: 1px solid #d7e4e7;
  border-radius: 10px;
  background: #f7fafb;
  white-space: nowrap;
}

body.zenty-boletas-page .item-editor .checkbox-line input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

body.zenty-boletas-page .item-editor > .btn-link {
  display: grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  height: 41px;
  min-height: 41px;
  padding: 0;
  border-radius: 10px;
  background: #fff1f2;
  text-decoration: none;
}

/* =========================================================
   TOTALES COMPACTOS
   ========================================================= */

body.zenty-boletas-page .totals-box {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  min-width: 0;
  margin: 0;
  border: 1px solid #d7e5e8;
  border-radius: 13px;
  background: #f8fbfc;
}

body.zenty-boletas-page .totals-box > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.7rem 0.8rem;
  border-right: 1px solid #e2ebed;
}

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

body.zenty-boletas-page .totals-box span {
  color: var(--zenty-muted);
  font-size: 0.73rem;
  font-weight: 700;
}

body.zenty-boletas-page .totals-box strong {
  color: var(--zenty-ink);
  font-size: 0.9rem;
  white-space: nowrap;
}

body.zenty-boletas-page .totals-box .total-final {
  background: linear-gradient(135deg, var(--zenty-primary), var(--zenty-primary-dark));
}

body.zenty-boletas-page .totals-box .total-final span,
body.zenty-boletas-page .totals-box .total-final strong {
  color: #ffffff;
}

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

/* =========================================================
   BOTONES
   ========================================================= */

body.zenty-boletas-page .btn {
  border-radius: 10px;
  font-weight: 750;
  line-height: 1.2;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    filter 0.16s ease;
}

body.zenty-boletas-page .btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

body.zenty-boletas-page .btn-primary {
  border-color: var(--zenty-primary);
  background: linear-gradient(135deg, var(--zenty-primary), #0d9488);
  box-shadow: 0 7px 17px rgba(15, 118, 110, 0.18);
}

body.zenty-boletas-page .admin-form > .btn-primary.w-100 {
  min-height: 44px;
  margin: 0;
  font-size: 0.87rem;
}

/* =========================================================
   HISTORIAL DESKTOP SIN SCROLL HORIZONTAL
   ========================================================= */

body.zenty-boletas-page .soft-table-wrapper,
body.zenty-boletas-page .table-responsive.soft-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow: hidden !important;
  border: 1px solid #dfe9ec;
  border-radius: 13px;
  background: #ffffff;
}

body.zenty-boletas-page .soft-table {
  width: 100% !important;
  max-width: 100%;
  min-width: 0 !important;
  margin: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

body.zenty-boletas-page .soft-table th,
body.zenty-boletas-page .soft-table td {
  min-width: 0 !important;
  padding: 0.72rem 0.65rem;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  vertical-align: middle;
}

body.zenty-boletas-page .soft-table thead th {
  border-bottom: 1px solid #dce7ea;
  background: #f2f7f8;
  color: #4f686e;
  font-size: 0.67rem;
  font-weight: 850;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

body.zenty-boletas-page .soft-table tbody td {
  border-color: #ebf1f3;
  color: #2f484f;
  font-size: 0.78rem;
}

body.zenty-boletas-page .soft-table tbody tr:hover {
  background: #f8fcfc;
}

body.zenty-boletas-page .soft-table th:nth-child(1),
body.zenty-boletas-page .soft-table td:nth-child(1) {
  width: 12%;
}

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

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

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

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

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

body.zenty-boletas-page .soft-table td:last-child {
  min-width: 0 !important;
}

body.zenty-boletas-page .soft-table td:last-child.d-flex {
  display: flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem !important;
}

body.zenty-boletas-page .soft-table td:last-child .btn {
  flex: 1 1 92px;
  min-width: 0;
  min-height: 34px;
  padding: 0.38rem 0.5rem;
  font-size: 0.68rem;
  white-space: normal;
}

body.zenty-boletas-page .badge-soft {
  display: inline-flex;
  max-width: 100%;
  padding: 0.35rem 0.5rem;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 0.66rem;
}

/* =========================================================
   XML PREVIEW
   ========================================================= */

body.zenty-boletas-page .xml-preview {
  width: 100%;
  max-width: 100%;
  min-height: 260px;
  overflow: auto;
  border: 1px solid #d7e5e8;
  border-radius: 12px;
  background: #0d2024;
  color: #d8f5f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.5;
}

/* =========================================================
   ALERTAS
   ========================================================= */

body.zenty-boletas-page .alert {
  margin: 0;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 7px 18px rgba(24, 57, 66, 0.06);
}

/* =========================================================
   RESPONSIVE — NOTEBOOK Y TABLET
   ========================================================= */

@media (max-width: 1350px) {
  body.zenty-boletas-page .item-editor {
    grid-template-columns:
      minmax(220px, 2fr)
      repeat(3, minmax(100px, 1fr));
  }

  body.zenty-boletas-page .item-editor > label:nth-child(1) {
    grid-column: span 2;
  }

  body.zenty-boletas-page .item-editor .checkbox-line {
    grid-column: span 1;
  }
}

@media (max-width: 1199px) {
  body.zenty-boletas-page .admin-form .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  body.zenty-boletas-page .item-editor > label:nth-child(1) {
    grid-column: span 2;
  }

  /*
  El historial deja de ser tabla y se convierte en tarjetas.
  De esta manera nunca necesita scroll horizontal.
  */
  body.zenty-boletas-page .soft-table-wrapper,
  body.zenty-boletas-page .table-responsive.soft-table-wrapper {
    overflow: visible !important;
    border: 0;
    background: transparent;
  }

  body.zenty-boletas-page .soft-table,
  body.zenty-boletas-page .soft-table tbody {
    display: block;
    width: 100%;
  }

  body.zenty-boletas-page .soft-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  body.zenty-boletas-page .soft-table tbody {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
  }

  body.zenty-boletas-page .soft-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    overflow: hidden;
    min-width: 0;
    border: 1px solid #dce7ea;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(24, 57, 66, 0.07);
  }

  body.zenty-boletas-page .soft-table tbody td {
    display: flex !important;
    width: auto !important;
    min-width: 0 !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.7rem 0.8rem;
    border: 0;
    border-bottom: 1px solid #edf2f4;
    background: transparent;
    font-size: 0.78rem;
  }

  body.zenty-boletas-page .soft-table tbody td::before {
    content: attr(data-label);
    color: #6b7f85;
    font-size: 0.61rem;
    font-weight: 850;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }

  body.zenty-boletas-page .soft-table tbody td:nth-child(3),
  body.zenty-boletas-page .soft-table tbody td:nth-child(6) {
    grid-column: 1 / -1;
  }

  body.zenty-boletas-page .soft-table tbody td:nth-child(6) {
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.4rem !important;
    padding-top: 0.75rem;
    border-bottom: 0;
    background: #f7fafb;
  }

  body.zenty-boletas-page .soft-table tbody td:nth-child(6)::before {
    flex: 0 0 100%;
  }

  body.zenty-boletas-page .soft-table tbody td:nth-child(6) .btn {
    flex: 1 1 125px;
    min-height: 36px;
    font-size: 0.7rem;
  }

  body.zenty-boletas-page .soft-table tbody td[colspan] {
    grid-column: 1 / -1;
    align-items: center;
    padding: 1.25rem;
    border: 0;
  }

  body.zenty-boletas-page .soft-table tbody td[colspan]::before {
    display: none;
  }
}

/* =========================================================
   RESPONSIVE — CELULAR
   ========================================================= */

@media (max-width: 760px) {
  body.zenty-boletas-page .app-content {
    padding: 0.65rem;
  }

  body.zenty-boletas-page .page-stack,
  body.zenty-boletas-page .content-grid.two-columns-wide {
    gap: 0.75rem;
  }

  body.zenty-boletas-page .welcome-panel.compact-panel {
    align-items: flex-start;
    padding: 0.85rem 0.95rem;
    border-radius: 16px;
  }

  body.zenty-boletas-page .welcome-panel p {
    display: none;
  }

  body.zenty-boletas-page .welcome-panel h2 {
    margin-bottom: 0;
    font-size: 1.14rem;
  }

  body.zenty-boletas-page .welcome-panel .status-pill {
    padding: 0.42rem 0.6rem;
    font-size: 0.72rem;
  }

  body.zenty-boletas-page .panel-card {
    padding: 0.8rem;
    border-radius: 16px;
  }

  body.zenty-boletas-page .panel-card-header {
    margin-bottom: 0.7rem;
    padding-bottom: 0.6rem;
  }

  body.zenty-boletas-page .panel-card-header > i {
    width: 34px;
    height: 34px;
  }

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

  body.zenty-boletas-page .item-editor > label:nth-child(1),
  body.zenty-boletas-page .item-editor .checkbox-line {
    grid-column: auto;
  }

  body.zenty-boletas-page .item-editor {
    gap: 0.5rem;
    padding: 0.65rem;
  }

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

  body.zenty-boletas-page .section-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  body.zenty-boletas-page .section-title-row .btn {
    width: 100%;
    min-height: 39px;
  }

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

  body.zenty-boletas-page .totals-box > div {
    border-right: 1px solid #e2ebed;
    border-bottom: 1px solid #e2ebed;
  }

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

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

  body.zenty-boletas-page .soft-table tbody {
    grid-template-columns: 1fr;
  }

  body.zenty-boletas-page .soft-table tbody tr {
    grid-template-columns: 1fr;
  }

  body.zenty-boletas-page .soft-table tbody td,
  body.zenty-boletas-page .soft-table tbody td:nth-child(3),
  body.zenty-boletas-page .soft-table tbody td:nth-child(6) {
    grid-column: 1;
  }

  body.zenty-boletas-page .soft-table tbody td:nth-child(6) .btn {
    flex-basis: 100%;
    width: 100%;
  }
}

@media (max-width: 430px) {
  body.zenty-boletas-page .welcome-panel.compact-panel {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  body.zenty-boletas-page .welcome-panel .eyebrow {
    font-size: 0.58rem;
  }

  body.zenty-boletas-page .welcome-panel h2 {
    font-size: 1rem;
  }

  body.zenty-boletas-page .items-block {
    padding: 0.6rem;
  }

  body.zenty-boletas-page .totals-box {
    grid-template-columns: 1fr;
  }

  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;
    border-bottom: 1px solid #e2ebed;
  }

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

/* Respeta usuarios con reducción de movimiento. */
@media (prefers-reduced-motion: reduce) {
  body.zenty-boletas-page *,
  body.zenty-boletas-page *::before,
  body.zenty-boletas-page *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}


/* =========================================================
   V3.3 — HISTORIAL CORREGIDO
   Escritorio:
   - Una boleta por fila.
   - Cinco botones visibles en una sola línea.
   - La celda Acciones conserva display: table-cell.
   Tablet y celular:
   - Historial en tarjetas.
   ========================================================= */

@media (min-width: 1200px) {
  body.zenty-boletas-page .soft-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
  }

  body.zenty-boletas-page .soft-table th,
  body.zenty-boletas-page .soft-table td {
    padding: 0.72rem 0.58rem !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.zenty-boletas-page .soft-table tbody td {
    height: 56px !important;
    font-size: 0.78rem !important;
    line-height: 1.15 !important;
  }

  body.zenty-boletas-page .soft-table th:nth-child(1),
  body.zenty-boletas-page .soft-table td:nth-child(1) {
    width: 10% !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: 20% !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: 47% !important;
  }

  /*
   * Bootstrap agrega d-flex a la celda.
   * Aquí se restaura table-cell para conservar el ancho real de la columna.
   */
  body.zenty-boletas-page .soft-table td:last-child,
  body.zenty-boletas-page .soft-table td:last-child.d-flex {
    display: table-cell !important;
    width: 47% !important;
    overflow: visible !important;
    white-space: nowrap !important;
  }

  body.zenty-boletas-page .soft-table td:last-child .btn,
  body.zenty-boletas-page .soft-table td:last-child .zenty-action-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: 62px !important;
    min-height: 36px !important;
    margin: 0 0.34rem 0 0 !important;
    padding: 0.42rem 0.72rem !important;
    border-radius: 9px !important;
    font-size: 0.72rem !important;
    font-weight: 750 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    vertical-align: middle !important;
  }

  body.zenty-boletas-page .soft-table td:last-child .btn:last-child,
  body.zenty-boletas-page .soft-table td:last-child .zenty-action-button:last-child {
    margin-right: 0 !important;
  }

  body.zenty-boletas-page
    .soft-table
    td:last-child
    [data-zenty-action="base"] {
    min-width: 66px !important;
  }

  body.zenty-boletas-page
    .soft-table
    td:last-child
    [data-zenty-action="ted"] {
    min-width: 58px !important;
  }

  body.zenty-boletas-page
    .soft-table
    td:last-child
    [data-zenty-action="firmado"] {
    min-width: 78px !important;
  }

  body.zenty-boletas-page
    .soft-table
    td:last-child
    [data-zenty-action="pdf"] {
    min-width: 58px !important;
  }

  body.zenty-boletas-page
    .soft-table
    td:last-child
    [data-zenty-action="imprimir"] {
    min-width: 78px !important;
  }
}

@media (min-width: 1200px) and (max-width: 1365px) {
  body.zenty-boletas-page .soft-table th,
  body.zenty-boletas-page .soft-table td {
    padding-left: 0.4rem !important;
    padding-right: 0.4rem !important;
    font-size: 0.7rem !important;
  }

  body.zenty-boletas-page .soft-table td:last-child .btn,
  body.zenty-boletas-page .soft-table td:last-child .zenty-action-button {
    min-width: 52px !important;
    margin-right: 0.22rem !important;
    padding-left: 0.48rem !important;
    padding-right: 0.48rem !important;
    font-size: 0.64rem !important;
  }
}

/* Fase EnvioBOLETA SII */
body.zenty-boletas-page .soft-table td:last-child .zenty-sii-button {
  background: linear-gradient(135deg, #0f766e, #0d9488) !important;
  border: 1px solid #0f766e !important;
  color: #fff !important;
  min-width: 58px !important;
  box-shadow: 0 7px 16px rgba(15, 118, 110, 0.2) !important;
}

body.zenty-boletas-page .soft-table td:last-child .zenty-sii-button:hover,
body.zenty-boletas-page .soft-table td:last-child .zenty-sii-button:focus-visible {
  background: linear-gradient(135deg, #115e59, #0f766e) !important;
  border-color: #115e59 !important;
  color: #fff !important;
  transform: translateY(-1px);
}

body.zenty-boletas-page .soft-table td:last-child .zenty-sii-button:disabled {
  opacity: 0.72;
  cursor: wait;
  transform: none;
}
