
body {
  margin: 0;
  padding: 0;
  background-color: #1e1e1e;
  color: #e0e0e0;
  font-family: 'Segoe UI', sans-serif;
  font-size: 14px;
}
input {
  width: 95%;
  font-size: 16px;
  padding: 6px;
  background: #2a2a2a;
  color: #fff;
  border: 1px solid #555;
  border-radius: 4px;
  padding-right: 15px;
  box-sizing: border-box;
}
button {
  font-size: 16px;
  padding: 8px 14px;
  margin: 6px 4px 0 0;
  background: #444;
  color: white;
  border: 1px solid #555;
  border-radius: 6px;
  cursor: pointer;
  min-width: 150px;
}
button:hover { background: #d9c898; color: black; }
button:focus { background-color: #1f3f1f; }
button:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.factura-box {
  background: #2a2a2a;
  padding: 16px;
  min-width: 1000px;
  margin: auto;
  box-sizing: border-box;
}
.factura-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #444;
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.seccion-info {
  background: #21252d;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 5px;
  margin-top: 5px;
  min-width: 1000px;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
}
.tipo-contado { color: #2ecc71; }
.tipo-credito { color: #e056fd; }
.tipo-apartado { color: #ffa502; }
.productos {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.productos th, .productos td {
  border-bottom: 1px solid #444;
  padding: 7px 8px;
  vertical-align: top;
}
.productos th { background-color: #333; color: #ccc; }
.productos tr:hover { background-color: #2d2121; cursor: pointer; }
.productos tr.seleccionada { background-color: #444 !important; }
.fila {
  display: flex;
  justify-content: space-between;
  margin: 2px;
}
.fila .etiqueta {
  text-align: right;
  flex: 1;
  padding-right: 6px;
}
.fila .monto {
  text-align: right;
  width: 130px;
  font-weight: bold;
}
#divA {
  background: #2a2a2a;
  padding: 5px;
  text-align: center;
  border-bottom: 1px solid #444;
}
#divA h1 {
  margin: 0;
  font-size: 24px;
  color: #7fffd4;
}
#divB {
  display: flex;
  width: 100%;
  height: calc(100vh - 92px);
}
#divB2 {
  flex: 0 0 160px;
  background: #2c2c2c;
  padding: 10px;
  overflow: auto;
  border-left: 1px solid #404040;
}
#divB2 button {
  width: 100%;
  min-width: 0;
  margin-right: 0;
}
#divBLineasLibres {
  flex: 1;
  min-width: 0;
  overflow: auto;
}
#divB1 {
  min-width: 0;
  padding: 10px;
}
#factura-container {
  min-width: 0;
}
.tabla-contenedor {
  overflow: auto;
  min-height: 300px;
  max-height: 390px;
  border: 1px solid #444;
  background: #252525;
}
.factura-layout {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.col-codigo { width: 240px; }
.col-detalle { flex: 1; }
.col-cantidad { width: 160px; }
.col-imagen {
  width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.col-imagen img {
  max-width: 84px;
  max-height: 84px;
  object-fit: contain;
}
.col-datos {
  flex: 1;
}
.col-datos p {
  margin: 8px 0;
}
.col-datos-secundarios {
  max-width: 300px;
}
.col-resumen {
  width: 280px;
  border-left: 1px solid #404040;
  padding-left: 12px;
}
.resumen {
  background: rgba(46, 204, 113, 0.05);
  border: 1px solid rgba(46, 204, 113, 0.18);
  border-radius: 8px;
  padding: 10px;
}
.fila-total {
  font-size: 16px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #4b4b4b;
}
.alinear-centro { text-align: center; }
.alinear-derecha { text-align: right; }
.texto-secundario { color: #b6bcc6; }
.margen-top-pequeno { margin-top: 6px; }
.texto-acciones {
  display: block;
  color: #7fffd4;
  margin-bottom: 6px;
  letter-spacing: .04em;
}
.abonos { background: #185c37; border-color: #1a7043; }
.del { background: #6b2020; border-color: #8a2e2e; }
.boton-margin-top { margin-top: 18px !important; }
.demo-ribbon {
  background: linear-gradient(90deg, #0f172a, #1d4ed8);
  color: #fff;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.demo-ribbon__inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  font-size: 13px;
}
.demo-ribbon__inner a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
}
.demo-side-note {
  margin-top: 18px;
  padding: 10px;
  border-radius: 8px;
  background: #232d38;
  border: 1px solid #334155;
  text-align: left;
  font-size: 12px;
  line-height: 1.6;
}
.demo-side-note__title {
  color: #93c5fd;
  font-weight: 700;
  margin-bottom: 6px;
}
.sq-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.62);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 18px;
}
.sq-modal.is-open { display: flex; }
.sq-modal__dialog {
  width: min(720px, 100%);
  background: #20252d;
  border: 1px solid #3b4654;
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0,0,0,.35);
  overflow: hidden;
}
.sq-modal__dialog--lg { width: min(980px, 100%); }
.sq-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #364152;
  background: #1b2028;
}
.sq-modal__header h3 { margin: 0; color: #fff; font-size: 20px; }
.sq-modal__close {
  width: 40px;
  min-width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  font-size: 24px;
  background: transparent;
  border: 1px solid #475569;
}
.sq-modal__body { padding: 18px; }
.sq-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 18px 18px;
}
.sq-modal__table-wrap {
  max-height: 420px;
  overflow: auto;
  margin-top: 14px;
  border: 1px solid #3f4854;
  border-radius: 10px;
}
.sq-modal__table {
  width: 100%;
  border-collapse: collapse;
}
.sq-modal__table th,
.sq-modal__table td {
  padding: 10px 12px;
  border-bottom: 1px solid #3a434d;
  text-align: left;
}
.sq-modal__table th {
  background: #28313b;
  color: #dbeafe;
}
.sq-modal__table tr:hover { background: #2b3440; }
.sq-btn-demo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-width: 170px;
  padding: 11px 16px;
  border-radius: 10px;
  font-weight: 700;
  border: 1px solid transparent;
}
.sq-btn-demo--primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.sq-btn-demo--ghost {
  background: transparent;
  color: #fff;
  border-color: #475569;
}
.sq-btn-demo--ghost-light {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,.24);
}
.sq-payment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
  margin-top: 16px;
}
.sq-payment-grid label {
  display: block;
  font-weight: 600;
  color: #d7dde6;
}
.sq-payment-grid input { margin-top: 8px; }
.sq-payment-summary {
  background: #182028;
  border: 1px solid #2f3c49;
  border-radius: 10px;
  padding: 12px;
}
.sq-payment-result {
  margin-top: 16px;
  padding: 12px;
  border-radius: 10px;
  background: #182028;
  border: 1px solid #2f3c49;
  color: #cbd5e1;
}
.sq-message-text {
  margin: 0;
  color: #d7dde6;
  line-height: 1.7;
}
.demo-footer-cta {
  background: linear-gradient(90deg, #111827, #0f3b8b);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 24px;
  flex-wrap: wrap;
}
.demo-footer-cta h2 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 28px;
}
.demo-footer-cta p {
  margin: 0;
  color: rgba(255,255,255,.8);
}
.demo-footer-cta__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
@media (max-width: 1200px) {
  .factura-box, .seccion-info { min-width: 920px; }
  .col-resumen { width: 250px; }
}
@media (max-width: 991.98px) {
  #divB { flex-direction: column; height: auto; }
  #divB2 {
    flex: none;
    border-left: 0;
    border-top: 1px solid #404040;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  #divB2 button { margin: 0; min-width: 0; }
  .demo-side-note { grid-column: 1 / -1; }
}
@media (max-width: 767.98px) {
  .factura-box, .seccion-info { min-width: 0; }
  .factura-layout,
  .factura-layout--cliente {
    flex-direction: column;
  }
  .col-codigo, .col-cantidad, .col-imagen, .col-datos, .col-datos-secundarios, .col-resumen {
    width: auto;
    max-width: none;
    border-left: 0;
    padding-left: 0;
  }
  .col-resumen {
    border-top: 1px solid #404040;
    padding-top: 10px;
  }
  .sq-payment-grid { grid-template-columns: 1fr; }
  #divB2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .demo-footer-cta { padding: 22px 18px; }
  .demo-footer-cta h2 { font-size: 24px; }
}

/* ==========================================
   MODALES DEMO ESTILO POS REAL
========================================== */

.modalBuscarProducto,
.modalBuscarCliente {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  padding: 18px;
}

.modalBuscarProducto.is-open,
.modalBuscarCliente.is-open {
  display: flex;
}

.modalBuscarProductoin,
.modalBuscarClientein {
  width: min(1240px, 96vw);
  background: #20242c;
  border: 1px solid #444;
  border-radius: 8px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: #2a2a2a;
  border-bottom: 1px solid #444;
}

.modal-header h3 {
  margin: 0;
  font-size: 24px;
  color: #7fffd4;
  font-weight: 700;
}

.boton-cerrar-modal {
  width: 42px;
  min-width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  font-size: 26px;
  line-height: 1;
  border-radius: 6px;
  background: #3a3a3a;
  color: #fff;
  border: 1px solid #555;
  cursor: pointer;
}

.boton-cerrar-modal:hover {
  background: #d9c898;
  color: #000;
}

.demo-modal-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.demo-modal-toolbar .campo,
.demo-modal-toolbar input {
  flex: 1 1 280px;
  width: auto;
  min-width: 240px;
  background: #111;
  border: 1px solid #555;
  color: #fff;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 15px;
  box-sizing: border-box;
}

.search-btn {
  background: #47ad69;
  color: #fff;
  border: 1px solid #398b55;
  min-width: 150px;
}

.search-btn:hover {
  background: #d9c898;
  color: #000;
}

.tabla-buscaproducto {
  width: 100%;
  height: 620px;
  overflow: auto;
  border: 1px solid #444;
  border-radius: 6px;
  background: #252525;
}

.tabla-buscaproducto .productos {
  width: 100%;
  margin-top: 0;
  border-collapse: collapse;
}

.tabla-buscaproducto .productos th,
.tabla-buscaproducto .productos td {
  border-bottom: 1px solid #444;
  padding: 8px 10px;
  vertical-align: middle;
  white-space: nowrap;
}

.tabla-buscaproducto .productos td:nth-child(4),
.tabla-buscaproducto .productos td:nth-child(3) {
  white-space: normal;
}

.tabla-buscaproducto .productos th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #333;
  color: #ccc;
}

.tabla-buscaproducto .productos tr:hover {
  background-color: #2d2121;
  cursor: pointer;
}

.demo-table-action-btn {
  min-width: 110px;
  width: auto;
  padding: 6px 10px;
  font-size: 13px;
  margin: 0;
  background: #47ad69;
  border: 1px solid #398b55;
  color: #fff;
}

.demo-table-action-btn:hover {
  background: #d9c898;
  color: #000;
}

@media (max-width: 991.98px) {
  .modalBuscarProductoin,
  .modalBuscarClientein {
    width: 98vw;
  }

  .tabla-buscaproducto {
    height: 520px;
  }

  .modal-header h3 {
    font-size: 20px;
  }
}

@media (max-width: 767.98px) {
  .modalBuscarProducto,
  .modalBuscarCliente {
    padding: 10px;
  }

  .tabla-buscaproducto {
    height: 420px;
  }

  .modal-header {
    padding: 12px;
  }

  .modal-header h3 {
    font-size: 18px;
  }

  .demo-modal-toolbar {
    flex-direction: column;
  }

  .demo-modal-toolbar .campo,
  .demo-modal-toolbar input,
  .search-btn {
    width: 100%;
    min-width: 0;
  }
}

/* ==========================================
   CSS FALTANTE / AJUSTES FINALES
========================================== */

/* Layout cliente más parecido al POS real */
.factura-layout--cliente {
  align-items: flex-start;
}

#idDetalle {
  display: block;
  width: 100%;
  color: #ddd;
  line-height: 1.45;
  padding-top: 4px;
}

#btnSeleccionarCliente,
#btnDetalleCredito {
  width: 100%;
}

#creditos-vencidos-info,
#monto-pendiente-info,
#CodigoActividad,
#NumeroDocExoneracion {
  word-break: break-word;
}

/* Apertura correcta de modales genéricos con el JS actual */
.sq-modal[aria-hidden="false"] {
  display: flex;
}

/* Body del modal custom */
.modal-body {
  padding: 14px 16px 16px;
}

/* Mejor lectura de tablas dentro de modales */
.tabla-buscaproducto .productos td:last-child,
.tabla-buscaproducto .productos th:last-child {
  text-align: center;
}

.tabla-buscaproducto .productos td:nth-child(3),
.tabla-buscaproducto .productos td:nth-child(4) {
  line-height: 1.45;
}

/* Estado visual para fila seleccionada en demo */
.tabla-buscaproducto .productos tr.seleccionada {
  background-color: #444 !important;
}

/* Botón de acción dentro de tabla */
.demo-table-action-btn:focus {
  background-color: #1f3f1f;
  color: #fff;
}

/* Ajustes modales de pago */
.sq-modal__body .fila {
  margin: 4px 0;
}

.sq-modal__footer .sq-btn-demo,
.sq-modal__footer button {
  margin-top: 0;
}

/* Mejor espaciado footer CTA */
.demo-footer-cta__actions a {
  margin: 0;
}

/* Ajustes responsive adicionales */
@media (max-width: 1200px) {
  .factura-layout--cliente {
    flex-wrap: wrap;
  }

  .col-imagen {
    width: 100px;
  }

  .col-datos,
  .col-datos-secundarios {
    min-width: 260px;
  }
}

@media (max-width: 991.98px) {
  .factura-layout--cliente {
    gap: 10px;
  }

  .col-datos-secundarios {
    max-width: none;
  }

  .col-resumen {
    width: 100%;
  }
}

@media (max-width: 767.98px) {
  .modal-body {
    padding: 12px;
  }

  .tabla-buscaproducto .productos th,
  .tabla-buscaproducto .productos td {
    padding: 7px 8px;
    font-size: 13px;
  }

  .sq-modal__header h3 {
    font-size: 18px;
  }

  .sq-modal__footer {
    flex-direction: column;
  }

  .sq-modal__footer .sq-btn-demo,
  .sq-modal__footer button {
    width: 100%;
  }
}