:root {
  --color-primary: #F48B29;
  --color-primary-dark: #DD7714;
  --color-primary-tint: #FDECD8;
  --color-bg: #FAF7F2;
  --color-surface: #FFFFFF;
  --color-text: #33302B;
  --color-text-light: #8A8078;
  --color-success: #28A745;
  --color-success-tint: #E3F5E7;
  --color-danger: #d70015;
  --color-danger-tint: #FBE4E4;
  --color-border: #E7E0D6;
  --color-border-strong: #cfc3b3;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(51, 33, 12, 0.06), 0 1px 3px rgba(51, 33, 12, 0.08);
  --shadow-md: 0 4px 10px rgba(51, 33, 12, 0.08), 0 2px 4px rgba(51, 33, 12, 0.06);
  --shadow-lg: 0 12px 28px rgba(51, 33, 12, 0.16);
  --font-family: 'Inter', 'Segoe UI', sans-serif;
}

html {
  font-size: 16px;
}

* { box-sizing: border-box; }

*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Cualquier elemento con el atributo "hidden" debe quedar oculto SIEMPRE, sin importar que
   otra regla mas abajo (como .pos-split o .cashier-bar) le de su propio display: flex/block --
   sin este !important, esa regla le gana al [hidden] de base del navegador y el elemento se ve
   igual aunque el JS ya le haya puesto hidden=true. */
[hidden] {
  display: none !important;
}

body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  padding: 0 0 3rem;
}

header {
  background: var(--color-primary);
  color: white;
  padding: 0.6rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  position: relative;
  z-index: 10;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-logo {
  height: 72px;
  width: auto;
  border-radius: 10px;
  background: white;
  padding: 8px 14px;
  box-shadow: var(--shadow-sm);
  display: block;
}

@media (min-width: 640px) {
  .brand-logo {
    height: 88px;
  }
}

header button {
  background: #3a3a3c;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

header button:hover {
  background: #55555a;
}

header button:active {
  transform: scale(0.97);
}

.cashier-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

.cashier-bar #cashierName {
  font-weight: 600;
  margin-right: 0.5rem;
}

.tienda-label {
  background: #3a3a3c;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  margin-right: 0.5rem;
}

.pending-badge {
  background: white;
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  margin-right: 0.5rem;
}

.rejected-badge {
  background: var(--color-danger);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  margin-right: 0.5rem;
}

.ghost-btn {
  background: transparent;
  border: 1.5px solid var(--color-border-strong);
  color: var(--color-text);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.ghost-btn:hover {
  background: var(--color-primary-tint);
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}

.ghost-btn:active {
  transform: scale(0.97);
}

header .ghost-btn {
  background: #000000;
  color: white;
  border-color: #000000;
  border-radius: 999px;
}

header .ghost-btn:hover {
  background: #2c2c2e;
  border-color: #2c2c2e;
  color: white;
}

main {
  max-width: none;
  width: 100%;
  margin: 1.5rem auto;
  padding: 0 2rem;
}

.view-narrow {
  max-width: 520px;
  margin: 1.5rem auto;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem 2rem;
  box-shadow: var(--shadow-md);
}

.view {
  animation: view-fade-in 0.18s ease;
}

@keyframes view-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .view {
    animation: none;
  }
}

.view h2 {
  margin: 0 0 1.1rem;
  padding-bottom: 0.6rem;
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text);
  border-bottom: 2px solid var(--color-border);
}

.view h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 1.75rem 0 0.75rem;
}

.view h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 1.25rem 0 0.6rem;
}

.view label {
  display: block;
  font-weight: 600;
  margin: 0.75rem 0 0.3rem;
}

.view input[type='text'],
.view input[type='password'],
.view input[type='number'],
.view select,
.view textarea {
  width: 100%;
  font-size: 1.1rem;
  padding: 0.6rem;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.view input[type='text']:focus,
.view input[type='password']:focus,
.view input[type='number']:focus,
.view select:focus,
.view textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-tint);
}

.input-with-calc {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.input-with-calc input {
  flex: 1 1 0%;
  min-width: 0;
}

.calc-trigger-btn {
  flex: 0 0 auto;
  font-size: 1.3rem;
  line-height: 1;
  padding: 0 0.8rem;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.calc-trigger-btn:active {
  transform: scale(0.95);
}

.calc-trigger-btn:hover {
  background: var(--color-primary-tint);
  border-color: var(--color-primary);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 20, 10, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: modal-fade-in 0.15s ease;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.calculator-box {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1rem;
  width: 100%;
  max-width: 300px;
  box-shadow: var(--shadow-lg);
  animation: modal-pop-in 0.15s ease;
}

@keyframes modal-pop-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .calculator-box {
    animation: none;
  }
}

.calculator-display {
  background: #1c1c1e;
  color: white;
  font-size: 2rem;
  font-weight: 600;
  text-align: right;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  overflow-x: auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.calc-btn {
  padding: 0.9rem 0;
  font-size: 1.15rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: #ececee;
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
}

.calc-btn:hover {
  background: #dcdce0;
}

.calc-btn-op {
  background: var(--color-primary-tint);
  color: var(--color-primary);
}

.calc-btn-op:hover {
  background: #fbdcb3;
}

.calc-btn-equals {
  background: var(--color-primary);
  color: white;
}

.calc-btn-equals:hover {
  background: #d97717;
}

.calc-span-2 {
  grid-column: span 2;
}

.calc-span-4 {
  grid-column: span 4;
}

.calculator-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.calc-usar-btn {
  flex: 1;
  padding: 0.7rem;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  background: var(--color-success);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.calc-usar-btn:hover {
  background: #218838;
}

.calculator-actions .ghost-btn {
  flex: 0 0 auto;
}

.tienda-fija-note {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin: 0.3rem 0 0;
}

.view select:disabled {
  background: #ececee;
  color: var(--color-text);
  font-weight: 600;
  border-color: #a9a9ad;
  opacity: 1;
  -webkit-text-fill-color: var(--color-text);
}

#loginBtn,
#openCashBtn,
#confirmCloseCashBtn,
#invoiceSearchBtn,
#confirmReturnBtn,
#confirmRemisionBtn {
  margin-top: 1rem;
  padding: 0.9rem 1.2rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  background: var(--color-primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

#loginBtn:hover,
#openCashBtn:hover,
#confirmCloseCashBtn:hover,
#invoiceSearchBtn:hover,
#confirmReturnBtn:hover,
#confirmRemisionBtn:hover {
  background: var(--color-primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

#loginBtn:active,
#openCashBtn:active,
#confirmCloseCashBtn:active,
#invoiceSearchBtn:active,
#confirmReturnBtn:active,
#confirmRemisionBtn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.customer-area {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.transaction-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.transaction-card .customer-area {
  background: none;
  border-radius: 0;
  padding: 0.75rem 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--color-border);
  box-shadow: none;
}

.transaction-card .customer-area:last-child {
  border-bottom: none;
}

#customerSearchBox {
  width: 100%;
  margin-top: 0.5rem;
}

#customerResults {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.5rem 0;
  max-height: 200px;
  overflow-y: auto;
}

#scanResults {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.5rem 0;
  max-height: 200px;
  overflow-y: auto;
}

#crearClienteForm label {
  display: block;
  font-weight: 600;
  margin: 0.5rem 0 0.3rem;
  font-size: 0.9rem;
}

#crearClienteForm input,
#crearClienteForm select {
  width: 100%;
  padding: 0.5rem;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.hint-text {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin: 0.3rem 0;
}

.guia-col {
  display: none;
  min-width: 140px;
}

#cartTable.con-guia .guia-col {
  display: table-cell;
}

.guia-line-select {
  width: 100%;
  padding: 0.3rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}

.joyeria-toggle {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.joyeria-toggle input:disabled {
  cursor: not-allowed;
}

.guia-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--color-primary-tint);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  margin-right: 0.3rem;
}

.guia-chip button {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.telefono-row {
  display: flex;
  gap: 0.5rem;
}

.telefono-row label:first-child {
  flex: 0 0 70px;
}

.telefono-row label:last-child {
  flex: 1;
}

#guardarClienteBtn {
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  font-weight: 700;
  color: white;
  background: var(--color-success);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
}

.customer-area select {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 6px;
  font-size: 0.95rem;
  width: auto;
  min-width: 170px;
  max-width: 260px;
}

.vendedor-select-group {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.vendedor-codigo-quick-input {
  width: 90px !important;
  padding: 0.3rem 0.5rem !important;
  font-size: 0.95rem !important;
}

.vendedor-result-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.vendedor-result-row .result-btn {
  flex: 1;
}

.vendedor-codigo-admin-input {
  width: 80px !important;
  padding: 0.4rem 0.5rem !important;
  font-size: 0.9rem !important;
}

#guiaBox {
  width: 100%;
  margin-top: 0.5rem;
}

#guiaResults {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.5rem 0;
  max-height: 200px;
  overflow-y: auto;
}

#vendedorBox {
  width: 100%;
  margin-top: 0.5rem;
}

#vendedorResults {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.5rem 0;
  max-height: 200px;
  overflow-y: auto;
}

#guiaSelectedArea label {
  display: block;
  font-weight: 600;
  margin: 0.5rem 0 0.3rem;
}

#guiaSelectedArea select {
  width: 100%;
  padding: 0.5rem;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-size: 1rem;
}

.result-btn {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--color-border-strong);
  background: #f9f9fb;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
}

.return-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background: var(--color-surface);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.return-item-row input {
  width: 80px;
}

.receipt {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 1rem;
  max-width: 320px;
  margin: 0 auto 1rem;
  font-family: 'Courier New', monospace;
  box-shadow: var(--shadow-md);
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 0.15rem 0;
}

.receipt-row.total {
  font-weight: 700;
  font-size: 1.1rem;
  border-top: 1px solid var(--color-text);
  margin-top: 0.4rem;
  padding-top: 0.4rem;
}

#printBtn,
#newSaleBtn {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0.5rem auto;
  padding: 0.9rem;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.1s ease, background-color 0.15s ease;
}

#printBtn:hover,
#newSaleBtn:hover,
.pdf-btn:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

#printBtn {
  background: #1c1c1e;
  color: white;
}

#printBtn:hover {
  background: #000000;
}

#newSaleBtn {
  background: var(--color-success);
  color: white;
}

#newSaleBtn:hover {
  background: #1f7a34;
}

.pdf-btn {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0.5rem auto;
  padding: 0.9rem;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: var(--color-primary);
  color: white;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.1s ease, background-color 0.15s ease;
}

.pdf-btn:hover {
  background: var(--color-primary-dark);
}

@media print {
  header,
  .mode-banner,
  #printBtn,
  #newSaleBtn,
  .pdf-btn {
    display: none !important;
  }
  main {
    max-width: none;
  }
  .receipt {
    box-shadow: none;
    width: 80mm;
    margin: 0;
  }
}

.mode-banner {
  background: #fff3cd;
  border: 1px solid #ffe08a;
  color: #7a5b00;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.mode-banner.mode-banner-demo {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.mode-banner code {
  background: rgba(0, 0, 0, 0.12);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

/* ---- Cobro: layout split-screen (65% carrito / 35% resumen y accion) ---- */

.pos-split {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
}

.pos-left {
  flex: 0 0 65%;
  max-width: 65%;
  min-width: 0;
}

.pos-right {
  flex: 0 0 35%;
  max-width: 35%;
  min-width: 0;
  position: sticky;
  top: 1rem;
}

@media (max-width: 900px) {
  .pos-split {
    flex-direction: column;
  }
  .pos-left,
  .pos-right {
    flex: 1 1 auto;
    max-width: 100%;
    position: static;
  }
}

.cart-area {
  overflow-x: auto;
}

.precuentas-area {
  margin-bottom: 1.5rem;
}

.precuentas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.precuentas-header p {
  font-weight: 600;
  margin: 0;
}

.precuentas-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.precuenta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--color-primary-tint);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 999px;
  padding: 0.15rem 0.15rem 0.15rem 0.7rem;
}

.precuenta-resume-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.3rem 0;
  font-family: inherit;
}

.precuenta-delete-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: bold;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  line-height: 1;
}

#guardarPrecuentaBox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

#guardarPrecuentaBox input {
  flex: 1;
  padding: 0.5rem;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

#confirmarGuardarPrecuentaBtn {
  padding: 0.5rem 1rem;
  font-weight: 700;
  color: white;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.favoritos-area {
  margin-bottom: 1.5rem;
}

.favoritos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.favoritos-header p {
  font-weight: 600;
  margin: 0;
}

.favoritos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem;
}

.favorito-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.favorito-btn:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.favorito-btn:active {
  background: var(--color-primary-tint);
}

.favorito-nombre {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.25;
}

.favorito-precio {
  color: var(--color-primary);
  font-weight: 700;
}

#favoritosBox {
  margin-top: 0.75rem;
}

#favoritoSearchResults {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.5rem 0;
  max-height: 200px;
  overflow-y: auto;
}

#favoritosActualesLista {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0;
}

.scan-area {
  margin-bottom: 1.5rem;
}

.scan-area label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

#barcodeInput {
  width: 100%;
  font-size: 1.5rem;
  padding: 0.75rem;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius);
  font-family: inherit;
}

.error {
  color: var(--color-danger);
  font-weight: 600;
  min-height: 1.2em;
}

.success {
  color: var(--color-success);
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

th, td {
  text-align: left;
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
}

th {
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

tbody tr {
  transition: background-color 0.1s ease;
}

tbody tr:hover {
  background: #FBF5EC;
}

tbody tr:last-child td {
  border-bottom: none;
}

.tag {
  font-size: 0.7rem;
  background: var(--color-primary);
  color: white;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  vertical-align: middle;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.qty-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--color-border-strong);
  background: #f9f9fb;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.1s ease, border-color 0.1s ease;
}

.qty-btn:hover {
  background: var(--color-primary-tint);
  border-color: var(--color-primary);
}

.qty-btn:active {
  background: var(--color-border);
}

.qty-input {
  width: 48px;
  padding: 0.3rem;
  text-align: center;
  border: 1px solid var(--color-border-strong);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-input {
  -moz-appearance: textfield;
}

.remove-btn {
  background: none;
  border: none;
  color: var(--color-danger);
  font-weight: bold;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
  transition: background-color 0.1s ease;
}

.remove-btn:hover {
  background: var(--color-danger-tint);
}

.combo-area {
  margin: 0.75rem 0;
  min-height: 1.4em;
  font-weight: 600;
  color: var(--color-primary);
}

.totals-area {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin: 1rem 0;
  box-shadow: var(--shadow-sm);
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
}

.totals-row.discount span:last-child {
  color: var(--color-danger);
}

.totals-row.grand {
  font-size: 1.4rem;
  font-weight: 700;
  border-top: 2px solid var(--color-border);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

.totals-row.grand span:last-child {
  color: var(--color-primary);
}

.payment-area {
  margin: 1rem 0;
}

.payment-area p {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

#paymentButtons {
  display: flex;
  gap: 0.5rem;
}

.payment-btn {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid var(--color-border-strong);
  background: var(--color-surface);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.payment-btn:hover {
  border-color: var(--color-primary);
}

.payment-btn.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-tint);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.payment-shortcut {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-text-light);
  background: #f1f2f3;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
}

.payment-btn.selected .payment-shortcut {
  color: var(--color-primary);
  background: white;
}

.divisa-cobro-area {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}

.divisa-cobro-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.divisa-cobro-area label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  margin: 0;
}

.divisa-cobro-area select {
  padding: 0.4rem;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-family: inherit;
}

.divisa-cobro-row #cobroDivisaTasaInput {
  flex: 1;
  margin-top: 0;
}

.divisa-cobro-area input {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-family: inherit;
}

.divisa-cobro-area .hint-text {
  margin-top: 0.4rem;
}

.checkout-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

#checkoutBtn {
  flex: 1;
  padding: 1.1rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: white;
  background: var(--color-primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: var(--shadow-md);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

#checkoutBtn:hover:not(:disabled) {
  background: var(--color-primary-dark);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

#checkoutBtn:active:not(:disabled) {
  transform: translateY(0);
}

#checkoutBtn:disabled {
  background: #a9a9ad;
  cursor: not-allowed;
  box-shadow: none;
}

#limpiarVentaBtn {
  flex: 0 0 auto;
  padding: 0 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkout-shortcut {
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.25);
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
}

.reports-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-sm);
}

.reports-toolbar label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  margin: 0;
}

.reports-toolbar input[type='date'] {
  padding: 0.4rem;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-family: inherit;
}

.reports-totals {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.divisa-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.divisa-row select {
  padding: 0.4rem;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-family: inherit;
}

.divisa-row input {
  padding: 0.4rem;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-family: inherit;
}

.divisa-moneda-otra {
  width: 90px;
}

.divisa-monto-input {
  width: 120px;
}

.divisa-hint {
  font-size: 0.8rem;
  color: var(--color-text-light);
  flex: 1;
}

.divisa-remove-btn {
  background: none;
  border: none;
  color: var(--color-danger);
  font-weight: bold;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  transition: background-color 0.1s ease;
}

.divisa-remove-btn:hover {
  background: var(--color-danger-tint);
}

.reports-table-wrap {
  overflow-x: auto;
}

.dashboard-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dashboard-cards-grid .reports-totals {
  margin-bottom: 0;
}

.dashboard-cards-grid h4 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--color-text);
  text-transform: none;
  letter-spacing: normal;
}

.dashboard-chart-wrap {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.dashboard-chart-svg {
  display: block;
}

.chart-bar {
  fill: var(--color-primary);
  transition: fill 0.15s ease;
}

.chart-bar:hover {
  fill: var(--color-primary-dark);
}

.chart-bar-label {
  font-size: 11px;
  fill: var(--color-text-light);
}

.chart-axis {
  stroke: var(--color-border-strong);
  stroke-width: 1;
}

.estado-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  color: white;
}

.estado-pill.pendiente {
  background: var(--color-danger);
}

.estado-pill.parcial {
  background: var(--color-primary);
}

.estado-pill.pagado {
  background: var(--color-success);
}

#promocionTiendasBox {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.3rem 0 0.75rem;
}

.promocion-tienda-check {
  display: flex !important;
  align-items: center;
  gap: 0.3rem;
  font-weight: 400 !important;
  margin: 0 !important;
}

.promocion-tramo-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.promocion-tramo-row input {
  width: 120px;
}

.promocion-tramo-row span {
  color: var(--color-text-light);
  font-size: 0.85rem;
}

#promocionProductoResults {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.5rem 0;
  max-height: 200px;
  overflow-y: auto;
}

#promocionProductosChips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

#reportTable {
  min-width: 1100px;
}

#reportTable td,
#reportTable th {
  white-space: nowrap;
}

.dian-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.dian-badge.dian-aprobada {
  background: #d4f4dd;
  color: #1f7a3d;
}

.dian-badge.dian-rechazada {
  background: #fbd8d8;
  color: #b3271e;
}

.dian-badge.dian-pendiente {
  background: #fff3cd;
  color: #7a5b00;
}

.report-detail-row td {
  background: #f9f9fb;
  white-space: normal;
}

.reports-toolbar select {
  width: auto;
  padding: 0.4rem;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-family: inherit;
}

#remisionesTable {
  min-width: 900px;
}

#remisionesTable td,
#remisionesTable th {
  white-space: nowrap;
}

#gastosTable {
  min-width: 700px;
}

#gastosTable td,
#gastosTable th {
  white-space: nowrap;
}

.estado-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.estado-badge.estado-pendiente {
  background: #fff3cd;
  color: #7a5b00;
}

.estado-badge.estado-recibida {
  background: #d4f4dd;
  color: #1f7a3d;
}

.report-detail {
  padding: 0.5rem 0;
  max-width: 480px;
}
