/**
 * TPV — estética caja registradora
 */
:root {
  --tpv-case: #2b2b2b;
  --tpv-bezel: #1a1a1a;
  --tpv-led-bg: #0d1f0d;
  --tpv-led-text: #39ff14;
  --tpv-led-dim: #10cf10;
  --tpv-keypad: #e8dcc8;
  --tpv-keypad-border: #c4b8a4;
  --tpv-btn: #f5f0e6;
  --tpv-btn-accent: #c41e3a;
  --tpv-receipt: #faf6ef;
  --tpv-receipt-border: #d4cfc4;
}

body.tpv-body {
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #3a3a3a 0%, var(--tpv-bezel) 55%);
  color: #eee;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
}

/*
 * Modales Bootstrap en TPV: el backdrop va a body (dashboard.css z-index 10890).
 * Los diálogos deben estar también en body (tpv.js vfEnsureTpvModalsInBody), no dentro de
 * .tpv-machine { overflow: hidden }, o solo se ve la máscara semitransparente.
 */
body > #tpvCobrarConfirmModal.modal.show {
  z-index: 11050 !important;
}

body > #tpvCobrarConfirmModal.modal.show .modal-dialog,
body > #tpvCobrarConfirmModal.modal.show .modal-content {
  pointer-events: auto;
}

body > #tpvZettleReaderModal.modal.show,
body > #tpvAppointmentModal.modal.show,
body > #tpvTrVariantModal.modal.show,
body > #tpvGuardarPedidoModal.modal.show,
body > #tpvDeleteOrderConfirmModal.modal.show,
body > #tpvAgentGateModal.modal.show,
body > #tpvManageOrdersModal.modal.show,
body > #tpvOrderPrintModal.modal.show,
body > #tpvQuotationPrintModal.modal.show,
body > #salesReportModal.modal.show {
  z-index: 10900 !important;
}

body > #tpvStoreCustomerModal.modal.show {
  z-index: 11050 !important;
}

/* Modal gestor: el body TPV usa color claro; forzar texto oscuro sobre fondo blanco del modal */
#tpvAgentGateModal .modal-content {
  background: #fff !important;
  color: #212529 !important;
}
#tpvAgentGateModal .modal-title {
  color: #212529 !important;
}
#tpvAgentGateModal .modal-body {
  color: #212529 !important;
}

#tpvStoreCustomerModal .modal-content {
  background: #fff !important;
  color: #212529 !important;
}
#tpvStoreCustomerModal .modal-title,
#tpvStoreCustomerModal .form-label,
#tpvStoreCustomerModal .text-muted {
  color: #212529 !important;
}

/* Pedidos pendientes / imprimir pedido / cotización — texto oscuro sobre fondo claro */
#tpvManageOrdersModal .modal-content,
#tpvOrderPrintModal .modal-content,
#tpvQuotationPrintModal .modal-content {
  background: #fff !important;
  color: #212529 !important;
}

#tpvManageOrdersModal .modal-title,
#tpvManageOrdersModal .modal-body,
#tpvManageOrdersModal .form-label,
#tpvOrderPrintModal .modal-title,
#tpvOrderPrintModal .modal-body,
#tpvQuotationPrintModal .modal-title,
#tpvQuotationPrintModal .modal-body {
  color: #212529 !important;
}

#vf-session-renew-modal .modal-content,
#tpvLinePriceModal .modal-content,
#tpvOrderTotalModal .modal-content {
  background: #fff !important;
  color: #212529 !important;
}
#vf-session-renew-modal .modal-title,
#vf-session-renew-modal .modal-body,
#tpvLinePriceModal .modal-title,
#tpvLinePriceModal .modal-body,
#tpvLinePriceModal .form-label,
#tpvOrderTotalModal .modal-title,
#tpvOrderTotalModal .modal-body,
#tpvOrderTotalModal .form-label {
  color: #212529 !important;
}
#vf-session-renew-modal .text-muted,
#tpvLinePriceModal .text-muted,
#tpvOrderTotalModal .text-muted {
  color: #6c757d !important;
}

.tpv-receipt-price-edit {
  color: #6c757d;
  line-height: 1;
}
.tpv-receipt-price-edit:hover {
  color: #0d6efd;
}

.tpv-class-card {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.tpv-class-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
}

.tpv-receipt-line-appt {
    line-height: 1.35;
}

#tpvAppointmentModal .modal-content {
  color: #212529;
}

.tpv-machine {
  max-width: 1200px;
  margin: 0 auto;
  background: linear-gradient(180deg, #3d3d3d 0%, var(--tpv-case) 8%, var(--tpv-case) 100%);
  border-radius: 12px;
  border: 3px solid #111;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.tpv-machine-header {
  background: linear-gradient(180deg, #4a4a4a 0%, #333 100%);
  border-bottom: 2px solid #111;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tpv-brand-title {
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 0.95rem;
  text-transform: uppercase;
  color: #ddd;
  text-shadow: 0 1px 2px #000;
}

.tpv-return-appointment-link {
  font-size: 0.78rem;
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.4);
  color: #f0f0f0;
  text-transform: none;
  letter-spacing: normal;
}

.tpv-user-menu .tpv-user-menu-toggle {
  width: 2.25rem;
  height: 2.25rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(255, 255, 255, 0.35);
}

.tpv-user-menu .tpv-user-menu-toggle:hover,
.tpv-user-menu .tpv-user-menu-toggle:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
}

.tpv-user-dropdown {
  min-width: 260px;
  max-width: min(92vw, 320px);
  max-height: min(70vh, 28rem);
  overflow-y: auto;
}

.tpv-user-dropdown-header {
  background: #f8f9fa;
}

.tpv-user-nav-links .dropdown-item {
  white-space: normal;
}

.tpv-user-nav-links .dropdown-item.active {
  font-weight: 600;
}

.tpv-led-panel {
  background: var(--tpv-led-bg);
  border: 3px solid #0a0a0a;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 1rem;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.85);
  font-family: "Consolas", "Courier New", monospace;
}

.tpv-led-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.tpv-led-label {
  color: var(--tpv-led-dim);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.tpv-led-value {
  color: var(--tpv-led-text);
  font-size: 1.35rem;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.45);
}

.tpv-led-value-sm {
  font-size: 0.95rem;
  color: #7dff6a;
}

.tpv-keypad-area {
  background: var(--tpv-keypad);
  color: #222;
  border-top: 3px solid var(--tpv-keypad-border);
  padding: 1rem 1.25rem 1.25rem;
  border-radius: 0 0 8px 8px;
}

.tpv-receipt-panel {
  background: #fff8f0;
  border: 2px solid var(--tpv-receipt-border);
  border-radius: 8px;
  color: #1a1a1a;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  min-height: 200px;
  max-height: min(55vh, 480px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.tpv-receipt-empty {
  color: #424242;
  font-size: 0.95rem;
}

.tpv-receipt-line {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.65rem;
  font-size: 0.9rem;
  padding: 0.55rem 0;
  border-bottom: 1px dotted #b8b0a0;
}

.tpv-receipt-line:last-child {
  border-bottom: none;
}

.tpv-receipt-thumb-wrap {
  flex-shrink: 0;
}

.tpv-receipt-thumb {
  display: block;
  width: 88px;
  height: 88px;
  object-fit: cover;
  background: #e8e4dc;
  border-color: #a09078 !important;
}

@media (min-width: 576px) {
  .tpv-receipt-thumb {
    width: 96px;
    height: 96px;
  }
}

.tpv-receipt-line-main {
  min-width: 0;
}

.tpv-receipt-line-title {
  color: #111;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
}

.tpv-receipt-line-meta {
  color: #424242;
  font-size: 0.82rem;
  margin-top: 0.15rem;
}

.tpv-receipt-line-subtotal {
  color: #0d47a1;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
}

.tpv-receipt-line-notes {
  margin-top: 0.35rem;
  padding: 0.35rem 0.5rem;
  border-radius: 0.35rem;
  background: rgba(255, 193, 7, 0.12);
  color: #5c4a00;
  font-size: 0.78rem;
  line-height: 1.35;
  font-style: italic;
}

.tpv-receipt-line-notes-label {
  font-style: normal;
  font-weight: 600;
}

.tpv-receipt-line--shipping .tpv-receipt-ship-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border-radius: 0.5rem;
  border: 1px solid #a09078;
  background: #e8f4fc;
  color: #0d6efd;
  font-size: 2rem;
}

.tpv-main-tabs .nav-link {
  font-size: 0.95rem;
  font-weight: 600;
  color: #495057;
  padding: 0.55rem 1rem;
}

.tpv-main-tabs .nav-link.active {
  color: #0d47a1;
  background: #fff;
  border-bottom-color: #fff;
}

.tpv-main-tab-content {
  min-height: 0;
}

.tpv-tab-layout,
.tpv-shipping-tab-layout {
  align-items: flex-start;
}

.tpv-panel-block {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(196, 184, 164, 0.65);
  border-radius: 0.65rem;
  padding: 1rem 1.1rem;
}

.tpv-panel-block--ticket {
  position: sticky;
  top: 0.5rem;
}

.tpv-catalog-scroll {
  max-height: min(52vh, 520px);
  overflow-y: auto;
}

.tpv-shipping-client-info--wide {
  font-size: 0.92rem;
  padding: 0.85rem 1rem;
}

.tpv-shipping-client-info .tpv-ship-addr-label {
  font-size: 0.85rem;
  color: #212529;
  margin-top: 0.15rem;
}

.tpv-shipping-client-info .tpv-ship-addr-lines {
  font-size: 0.82rem;
  color: #495057;
  margin-top: 0.1rem;
}

.tpv-shipping-quote-status {
  padding: 0.35rem 0.5rem;
  border-radius: 0.35rem;
  background: rgba(13, 110, 253, 0.08);
  color: #0d47a1;
}

.tpv-shipping-client-info {
  font-size: 0.82rem;
  line-height: 1.4;
  padding: 0.55rem 0.65rem;
  border-radius: 0.45rem;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
}

.tpv-shipping-client-info .tpv-ship-client-label {
  font-weight: 600;
  color: #495057;
}

@media (min-width: 576px) {
  .tpv-receipt-line--shipping .tpv-receipt-ship-icon {
    width: 96px;
    height: 96px;
  }
}

.tpv-receipt-qty-group .tpv-receipt-qty-btn {
  min-width: 48px;
  min-height: 48px;
  padding: 0.35rem 0.45rem;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 8px;
  touch-action: manipulation;
}

.tpv-receipt-qty-group .tpv-receipt-qty-btn .bi {
  font-size: 1.1rem;
}

/* Catálogo en TPV: miniaturas más grandes (dedos / tablet) */
.tpv-product-thumb-col {
  max-width: 42%;
}

.tpv-product-thumb-wrap {
  min-height: 100px;
  height: 100%;
  background: #e8e4dc;
  border-radius: 0.375rem 0 0 0.375rem;
  overflow: hidden;
}

.tpv-product-thumb {
  width: 100%;
  height: 100%;
  min-height: 100px;
  object-fit: cover;
}

@media (min-width: 576px) {
  .tpv-product-thumb-wrap {
    min-height: 112px;
  }

  .tpv-product-thumb {
    min-height: 112px;
  }
}

.tpv-product-card-body {
  font-size: 0.95rem;
}

.tpv-product-name {
  color: #1a1a1a;
}

.tpv-product-price {
  color: #0a4a8c;
  font-weight: 800;
  font-size: 1.05rem;
  margin-top: 0.2rem;
}

.tpv-btn-register {
  background: linear-gradient(180deg, #e85d6b 0%, var(--tpv-btn-accent) 100%);
  border: 2px solid #8b0000;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.85rem 1.5rem;
  border-radius: 6px;
  box-shadow: 0 4px 0 #5c1018, 0 6px 12px rgba(0, 0, 0, 0.25);
}

.tpv-btn-register:hover:not(:disabled) {
  filter: brightness(1.08);
  color: #fff;
}

.tpv-btn-register:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #5c1018;
}

.tpv-btn-register:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tpv-key {
  background: linear-gradient(180deg, #fff 0%, var(--tpv-btn) 100%);
  border: 1px solid #999;
  border-radius: 4px;
  box-shadow: 0 2px 0 #888;
}

.tpv-login-shell {
  max-width: 440px;
  margin: 2rem auto;
  background: var(--tpv-machine);
  border-radius: 12px;
  border: 3px solid #111;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.tpv-login-shell .card-body {
  background: var(--tpv-keypad);
  color: #222;
  border-radius: 0 0 8px 8px;
}

.tpv-login-shell .nav-link {
  color: #444 !important;
}

.tpv-login-shell .nav-link.active {
  background: var(--tpv-case) !important;
  color: #fff !important;
}

.tpv-product-card {
  cursor: pointer;
  transition: transform 0.12s ease;
}

.tpv-product-card:hover {
  transform: scale(1.02);
}

.tpv-muted {
  color: #454545;
  font-size: 0.8rem;
}

/* Texto secundario sobre fondo crema del teclado: más contraste */
.tpv-keypad-area .text-muted {
  color: #3d3d3d !important;
}

.tpv-class-card .text-muted {
  color: #4a4a4a !important;
}

@media (max-width: 768px) {
  .tpv-led-value {
    font-size: 1.1rem;
  }

  .tpv-product-thumb-wrap {
    min-height: 108px;
  }

  .tpv-product-thumb {
    min-height: 108px;
  }
}

.tpv-fiscal-ticket-strip {
  color: #c8c8c8 !important;
  line-height: 1.35;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

@media print {
  body.tpv-body {
    background: #fff !important;
    color: #000 !important;
  }
  #tpv-login {
    display: none !important;
  }
  .tpv-machine {
    border: none;
    box-shadow: none;
    max-width: none;
  }
  #btn-tpv-logout,
  .tpv-keypad-area .btn,
  .tpv-keypad-area button,
  #cs-post-sale-actions .btn,
  #tpv-cobrar-owner-only,
  #btn-tpv-guardar-pedido,
  #btn-tpv-delete-order,
  #btn-tpv-corte,
  #tpv-customer-search-wrap,
  #cs-customer-info .btn,
  #btn-tpv-clear-customer {
    display: none !important;
  }
}

.tpv-quotations-panel {
  border-top: 2px solid #111;
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
}

.tpv-quotations-panel-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  margin: 0;
  padding: 0.65rem 1rem;
  border: none;
  background: transparent;
  color: #f5f0e6;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: left;
}

.tpv-quotations-panel-toggle:hover,
.tpv-quotations-panel-toggle:focus {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.tpv-quotations-panel-toggle:focus-visible {
  outline: 2px solid #7dff6a;
  outline-offset: -2px;
}

.tpv-quotations-panel-title {
  display: inline-flex;
  align-items: center;
  font-size: 0.95rem;
}

.tpv-quotations-chevron {
  font-size: 1rem;
  opacity: 0.9;
  transition: transform 0.2s ease;
}

.tpv-quotations-panel-toggle.collapsed .tpv-quotations-chevron {
  transform: rotate(180deg);
}

.tpv-quotations-panel-body {
  padding: 0.75rem 1rem 1rem;
  background: var(--tpv-keypad);
  color: #222;
  border-top: 1px solid var(--tpv-keypad-border);
}

.tpv-quotations-list {
  max-height: 220px;
  overflow-y: auto;
}

.tpv-quotation-row .btn-group .btn {
  font-size: 0.75rem;
}

.tpv-quotation-print-area {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 11pt;
  line-height: 1.45;
  color: #111;
  max-width: 7.5in;
  margin: 0 auto;
}

.tpv-quotation-print-area .vf-qt-print-header {
  text-align: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #333;
}

.tpv-quotation-print-area .vf-qt-print-header h1 {
  font-size: 1.35rem;
  margin: 0 0 0.25rem;
}

.tpv-quotation-print-area .vf-qt-print-meta {
  margin-bottom: 1rem;
}

.tpv-quotation-print-area .vf-qt-print-meta .row-line {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.tpv-quotation-print-area table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 10pt;
}

.tpv-quotation-print-area th,
.tpv-quotation-print-area td {
  padding: 6px 8px;
  border-bottom: 1px solid #ccc;
}

.tpv-quotation-print-area thead th {
  background: #f3f4f6;
  font-weight: 600;
  border-bottom: 2px solid #333;
}

.tpv-quotation-print-area .text-end {
  text-align: right;
}

.tpv-quotation-print-area .text-center {
  text-align: center;
}

.tpv-quotation-print-area .vf-qt-print-total {
  text-align: right;
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 2px solid #333;
}

.tpv-quotation-print-area .vf-qt-thermal-hdr {
  font-size: 0.85rem;
  white-space: pre-wrap;
  margin-bottom: 0.75rem;
  text-align: center;
}

#tpv-quotation-email-body .note-editor {
  border-radius: 0.5rem;
}

/* Pedido completo — vista previa e impresión (print.js, formato carta) */
.tpv-order-print-area {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 11pt;
  line-height: 1.45;
  color: #111;
  max-width: 7.5in;
  margin: 0 auto;
}

.tpv-order-print-area .vf-order-print-header {
  text-align: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #333;
}

.tpv-order-print-area .vf-order-print-header h1 {
  font-size: 1.35rem;
  margin: 0 0 0.25rem;
}

.tpv-order-print-area .vf-order-print-doc-title {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.tpv-order-print-area .info-row,
.tpv-order-print-area .vf-order-print-meta .info-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.tpv-order-print-area table.items-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 10pt;
}

.tpv-order-print-area table.items-table th,
.tpv-order-print-area table.items-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #ccc;
}

.tpv-order-print-area table.items-table thead th {
  background: #f3f4f6;
  font-weight: 600;
  border-bottom: 2px solid #333;
}

.tpv-order-print-area .text-end {
  text-align: right;
}

.tpv-order-print-area .text-center {
  text-align: center;
}

.tpv-order-print-area .letter-muted {
  color: #555;
  font-size: 0.9rem;
}

.tpv-order-print-area .letter-section {
  margin-top: 1rem;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
}

.tpv-order-print-area .letter-section h4 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #444;
}

.tpv-order-print-area .letter-section .row-line {
  margin: 4px 0;
  font-size: 0.95rem;
}

.tpv-order-print-area .vf-order-print-total-line {
  font-size: 1.15rem;
  margin-top: 0.5rem;
}

.tpv-order-print-area .vf-order-print-promo-detail {
  font-size: 0.88rem;
  margin: -4px 0 8px;
}

.tpv-order-print-area .vf-order-print-total-words {
  margin-top: 6px;
  margin-bottom: 6px;
}

@media print {
  @page {
    size: letter portrait;
    margin: 12mm;
  }
}
