/* =========================================
   VARIABLES GLOBALES Y TEMA
========================================= */
:root {
  --cream: #E7E3D9;
  --sand: #CAB4A8;
  --clay: #9C6F63;
  --terracotta: #B16458;
  --turquoise-deep: #689689;
  --turquoise-light: #95B6A9;
  --brown: #4A3321;
  --paper: #fffef9;
  --line: #CAB4A8;
  color: var(--brown);
  font-family: Georgia, "Times New Roman", serif;
  background: var(--cream);
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; background: var(--cream); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

/* =========================================
   PÁGINA DE LOGIN
========================================= */
.login-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 14% 15%, #ffffff88 0 15%, transparent 35%), linear-gradient(135deg, var(--cream), #d3cdc1);
}

.login-card {
  width: min(100%, 432px);
  padding: 20px 40px;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--sand);
  border-radius: 22px;
  box-shadow: 0 20px 45px #68968920;
}

.login-logo {
  display: block;
  width: 168px;
  height: 168px;
  margin: -8px auto 4px;
  object-fit: contain;
}

h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 8px;
  color: var(--terracotta);
  font-size: clamp(1.5rem, 3vw, 2.05rem);
  letter-spacing: -.03em;
}

h2 { margin-bottom: 4px; font-size: 1.13rem; }
.subtitle, .panel-heading p { color: #4A3321cc; line-height: 1.5; }
.subtitle { margin-bottom: 0; }

form { display: grid; gap: 9px; margin-top: 24px; text-align: left; }
label { font-family: Arial, sans-serif; font-size: .81rem; font-weight: 700; letter-spacing: .02em; }

input, select {
  width: 100%;
  padding: 11px 12px;
  color: var(--brown);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

input:focus, select:focus { outline: 3px solid #95b6a955; border-color: var(--turquoise-deep); }
.feedback { min-height: 1.25rem; margin: 18px 0 0; color: var(--terracotta); font-family: Arial, sans-serif; font-size: .88rem; text-align: left; }

#login-form button {
  width: 100%;
  padding: 12px 16px;
  margin-top: 12px;
  color: #fff;
  background: var(--turquoise-deep);
  border: 1px solid var(--turquoise-deep);
  border-radius: 25px;
  font-family: Arial, sans-serif;
  font-weight: 800;
  transition: background .2s ease, border-color .2s ease;
}
#login-form button:hover { background: #537a6f; border-color: #537a6f; }

/* =========================================
   ESTRUCTURA GENERAL (APP SHELL & LAYOUT)
========================================= */
.app-shell {
  min-height: 100vh;
  padding-top: 40px;
  background: linear-gradient(160deg, var(--cream) 0 64%, #dbe4e1 100%);
}

.page-header, .sales-layout {
  width: min(1280px, calc(100% - 48px));
  margin-inline: auto;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 48px 20px 16px;
}

.order-number {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  color: var(--turquoise-deep);
  background: var(--paper);
  border: 1px solid var(--turquoise-light);
  border-radius: 10px;
  font-family: Arial, sans-serif;
  font-size: .75rem;
  white-space: nowrap;
}
.order-number strong { color: var(--turquoise-deep); font-family: Georgia, serif; font-size: 1.1rem; }

/* Layout de pedidos: catálogo + panel de resumen, lado a lado */
.sales-layout {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  padding-bottom: 38px;
}

.sales-main-column {
  flex: 1;
  min-width: 0;
}

.sidebar-column {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  min-width: 0;
  background: #fffef9ef;
  border: 1px solid var(--sand);
  border-radius: 16px;
  box-shadow: 0 10px 24px #68968915;
}

.catalog-panel { flex: 1.6; padding: 24px; height: 550px; display: flex; flex-direction: column; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.panel-heading p { margin: 0; font-family: Arial, sans-serif; font-size: .84rem; }
.panel-heading.compact { margin-bottom: 12px; }

.search-field { position: relative; display: block; min-width: 205px; }
.search-field span { position: absolute; top: 8px; left: 11px; color: var(--turquoise-deep); font-family: Arial, sans-serif; font-size: 1.3rem; }
.search-field input { padding-left: 34px; border-color: var(--turquoise-light); }

/* =========================================
   CATÁLOGO DE PRODUCTOS (PEDIDOS)
========================================= */
.product-filters { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-button {
  padding: 8px 12px;
  color: var(--brown);
  background: #fffef9;
  border: 1px solid var(--sand);
  border-radius: 20px;
  font-family: Arial, sans-serif;
  font-size: .78rem;
  font-weight: 700;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.filter-button:hover { background: #95b6a933; border-color: var(--turquoise-light); }
.filter-button.active { color: #fff; background: var(--turquoise-deep); border-color: var(--turquoise-deep); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  overflow-y: auto;
  padding-right: 8px;
  flex: 1;
  align-content: start;
}

.product-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid #dcd4ce;
  border-radius: 12px;
  background: #fffef9;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.product-card:hover { transform: translateY(-2px); border-color: var(--turquoise-deep); box-shadow: 0 7px 14px #68968922; }
.product-image { width: 100%; height: 120px; object-fit: contain; border-radius: 10px; }
.product-category { color: var(--terracotta); font-family: Arial, sans-serif; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.product-name { margin: 0; color: var(--brown); font-weight: 700; }
.product-price { color: var(--turquoise-deep); font-family: Arial, sans-serif; font-size: .95rem; font-weight: 800; }

.add-product {
  margin-top: auto;
  padding: 8px 12px;
  color: #fff;
  background: var(--turquoise-deep);
  border: 1px solid var(--turquoise-deep);
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-size: .82rem;
  font-weight: 800;
  transition: background .2s ease;
}
.add-product:hover { background: #537a6f; border-color: #537a6f; }

.no-results { grid-column: 1/-1; padding: 28px; color: #4A3321cc; font-family: Arial, sans-serif; text-align: center; border: 1px dashed var(--sand); border-radius: 10px; }

/* =========================================
   RESUMEN DEL PEDIDO
========================================= */
.order-panel {
  flex-shrink: 0;
  width: 340px;
  display: flex;
  flex-direction: column;
  padding: 22px;
  background: #f2f6f5;
  border: 1px solid var(--turquoise-light);
  height: 550px;
}

.order-items {
  flex: 1;
  min-height: 160px;
  overflow-y: auto;
  border-top: 1px solid var(--sand);
  border-bottom: 1px solid var(--sand);
  padding-right: 6px;
}

.empty-state { padding: 34px 16px; color: #4A3321a8; font-family: Arial, sans-serif; font-size: .88rem; text-align: center; }

.order-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 13px 2px; border-bottom: 1px solid #cab4a866; }
.order-item:last-child { border-bottom: 0; }
.order-item-name { margin: 0 0 3px; font-size: .93rem; font-weight: 700; }
.order-item-price { color: var(--turquoise-deep); font-family: Arial, sans-serif; font-size: .8rem; font-weight: 700; }

.quantity-control { display: inline-flex; align-items: center; gap: 7px; margin-top: 7px; }
.quantity-control button {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  padding: 0;
  color: #fff;
  background: var(--turquoise-deep);
  border: none;
  border-radius: 50%;
  font-weight: 800;
}
.quantity-control span { min-width: 18px; text-align: center; font-family: Arial, sans-serif; font-size: .84rem; font-weight: 800; }
.item-subtotal { color: var(--brown); font-family: Arial, sans-serif; font-size: .9rem; font-weight: 700; }

.order-total { display: flex; justify-content: space-between; padding: 24px 0; color: var(--brown); font-family: Arial, sans-serif; font-size: 1rem; }
.order-total strong { font-family: Georgia, serif; font-size: 1.35rem; color: var(--turquoise-deep); }

.checkout-fields { display: grid; gap: 8px; margin-bottom: 16px; }
.invoice-details { margin-top: 4px; color: #4A3321cc; font-family: Arial, sans-serif; font-size: .86rem; }
.invoice-details summary { cursor: pointer; color: var(--terracotta); font-weight: 800; }
.invoice-inputs { display: grid; gap: 7px; margin-top: 12px; }

.button-primary {
  width: 100%;
  padding: 12px 16px;
  color: #fff;
  background: var(--turquoise-deep);
  border: 1px solid var(--turquoise-deep);
  border-radius: 9px;
  font-family: Arial, sans-serif;
  font-weight: 800;
  transition: background .2s ease;
}
.button-primary:hover { background: #537a6f; border-color: #537a6f; }
.icon-button { width: 34px; height: 34px; border-radius: 8px; }
.order-feedback { min-height: 18px; margin: 12px 0 0; color: #557a62; font-family: Arial, sans-serif; font-size: .84rem; text-align: center; }

/* =========================================
   HISTORIAL Y TABLA DE COMPROBANTES (VENTAS)
========================================= */
.history-panel {
  height: auto;
  min-height: 300px;
}

.table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.header-search-container {
  min-width: 260px;
  max-width: 320px;
}

.header-search-input {
  width: 100%;
  background-color: #f0eee9;
  border: 1px solid #dcd8d0;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: #333;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.header-search-input:focus {
  border-color: var(--turquoise-deep);
  box-shadow: 0 0 0 3px #68968922;
}

.invoice-history-table {
  display: grid;
  gap: 8px;
  width: 100%;
}

.history-header,
.history-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr 1fr 1.1fr;
  align-items: center;
}

.history-header {
  padding: 0 16px 8px;
  font-size: 0.75rem;
  font-weight: bold;
  color: #706055;
  text-transform: uppercase;
  border-bottom: 1px dashed #d1c7bd;
}

.history-row {
  padding: 12px;
  background: #fff;
  border: 1px solid var(--sand);
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  gap: 12px;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.history-row:hover { border-color: var(--turquoise-light); box-shadow: 0 4px 12px #68968915; }

.history-view-button {
  justify-self: end;
  padding: 8px 12px;
  color: #fff;
  background: var(--turquoise-deep);
  border: 1px solid var(--turquoise-deep);
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-size: .76rem;
  font-weight: 800;
  transition: background .2s ease, transform .15s ease;
}
.history-view-button:hover {
  background: var(--terracotta);
  border-color: var(--terracotta);
  transform: translateY(-1px);
}

/* =========================================
   FILTROS DE VENTAS (SIDEBAR)
========================================= */
.custom-filter-card {
  background-color: #ffffff;
  border-radius: 16px;
  padding: 22px;
  border: 1px solid var(--sand);
  box-shadow: 0 8px 20px #68968912;
}

.filter-title {
  font-family: Georgia, serif;
  color: var(--brown);
  font-size: 1.08rem;
  font-weight: 800;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee3d9;
}

/* Panel de método de pago: select con flecha propia */
.select-wrapper { position: relative; }
.select-wrapper::after {
  content: "▾";
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--turquoise-deep);
  transform: translateY(-50%);
  pointer-events: none;
  font-size: .8rem;
}
.select-wrapper select { appearance: none; padding-right: 32px; }

.custom-filter-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.filter-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: #faf8f4;
  border: 1px solid #eee3d9;
  border-radius: 12px;
  transition: border-color .2s ease, background .2s ease;
}
.filter-row:has(.custom-radio input:checked) {
  border-color: var(--turquoise-light);
  background: #f2f6f5;
}

.custom-radio {
  display: flex;
  align-items: center;
  gap: 9px;
}

.custom-radio input[type="radio"] {
  width: 17px;
  height: 17px;
  accent-color: var(--turquoise-deep);
}

.radio-label {
  font-family: Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brown);
}

.field-container.multi-fields {
  display: flex;
  gap: 8px;
  padding-left: 26px;
}

.custom-input,
.custom-select {
  width: 100%;
  background-color: #f0eee9;
  border: 1px solid var(--sand);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.85rem;
  color: var(--brown);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.custom-input:focus, .custom-select:focus {
  border-color: var(--turquoise-deep);
  box-shadow: 0 0 0 3px #68968922;
}

.custom-actions-group {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.btn-apply {
  flex: 1;
  background-color: var(--turquoise-deep);
  color: #ffffff;
  border: 1px solid var(--turquoise-deep);
  border-radius: 10px;
  padding: 11px 0;
  font-family: Arial, sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  transition: background .2s ease, border-color .2s ease;
}
.btn-apply:hover { background: #537a6f; border-color: #537a6f; }

.btn-reset {
  background-color: #fff;
  color: var(--terracotta);
  border: 1px solid var(--terracotta);
  border-radius: 10px;
  padding: 11px 14px;
  font-family: Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  transition: background .2s ease, color .2s ease;
}
.btn-reset:hover { background: var(--terracotta); color: #fff; }

/* =========================================
   BANNER SUPERIOR & NAVEGACIÓN
========================================= */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 72px;
  z-index: 1000;
  padding: 0 28px;
  overflow: hidden;
  background: var(--paper);
  border-bottom: 2px solid var(--turquoise-deep);
}

.topbar-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 72px;
  object-fit: cover;
  opacity: .9;
  z-index: 0;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 8px 16px;
  background: #fffef9dd;
  border: 1px solid var(--sand);
  border-radius: 16px;
  z-index: 1;
}

.topbar-content {
  position: relative;
  z-index: 2;
  width: min(1220px, 100%);
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.menu-toggle {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--brown);
  background: transparent;
  border: none;
  border-radius: 12px;
  font-size: 1.7rem;
  transition: background .2s ease, color .2s ease, transform .15s ease;
}
.menu-toggle:hover { color: #fff; background: var(--turquoise-deep); transform: scale(1.05); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  padding: 4px;
  color: var(--turquoise-deep);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-decoration: none;
}

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-email {
  max-width: 250px;
  overflow: hidden;
  color: var(--brown);
  font-family: Arial, sans-serif;
  font-size: .82rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button-secondary {
  padding: 8px 16px;
  color: #fff;
  background: var(--clay);
  border: 1px solid var(--clay);
  border-radius: 16px;
  font-family: Arial, sans-serif;
  font-size: .78rem;
  font-weight: 700;
  transition: background .2s ease, border-color .2s ease;
}
.button-secondary:hover { background: var(--terracotta); border-color: var(--terracotta); }

/* =========================================
   MENÚ LATERAL DESPLEGABLE
========================================= */
.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  padding: 28px 18px;
  background: rgba(255, 254, 249, .88);
  backdrop-filter: blur(16px);
  box-shadow: 8px 0 30px #4A332125;
  transform: translateX(-100%);
  transition: transform .3s ease;
}
.side-menu.open { transform: translateX(0); }

.side-menu-header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 8px 24px;
  border-bottom: 1px solid var(--sand);
}

.side-menu-logo { width: 82px; height: 82px; margin-bottom: 8px; }
.menu-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  font-size: 1.6rem;
}

.side-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 16px;
  color: var(--brown);
  border-radius: 10px;
  text-decoration: none;
  font-family: Arial, sans-serif;
  font-size: .88rem;
  font-weight: 700;
  transition: background .2s ease, color .2s ease, transform .15s ease;
}
.menu-item:hover { color: var(--turquoise-deep); background: #95b6a933; transform: translateX(3px); }
.menu-item.active { color: #fff; background: var(--turquoise-deep); }
.menu-item.active:hover { transform: none; }

.menu-icon { width: 28px; display: grid; place-items: center; font-size: 1.15rem; }

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: #4A332155;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease;
}
.menu-overlay.open { opacity: 1; visibility: visible; }

/* =========================================
   VENTANA MODAL DE FACTURA
========================================= */
.invoice-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}
.invoice-modal[hidden] { display: none; }

.invoice-overlay {
  position: absolute;
  inset: 0;
  background: #73503266;
  backdrop-filter: blur(3px);
}

.invoice-window {
  position: relative;
  background-color: #fffdf9;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  padding: 2.5rem 1.8rem 2rem;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  font-family: 'Courier New', Courier, monospace;
}

.invoice-actions {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
}

.invoice-close, .invoice-print-btn {
  background: transparent;
  border: none;
  font-size: 1.2rem;
}

.invoice-header { display: flex; align-items: center; gap: 12px; }
.invoice-logo { width: 58px; height: 58px; object-fit: contain; }
.invoice-divider { height: 1px; margin: 16px 0; background: #BF8E6366; }
.invoice-info { display: flex; justify-content: space-between; }
.invoice-label { color: #73503299; font-family: Arial, sans-serif; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.invoice-value { font-size: .9rem; }

.invoice-items {
  display: grid;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.invoice-total { display: flex; justify-content: space-between; margin-top: 18px; padding: 16px; background: #8BA3A733; border-radius: 10px; }
.invoice-total-label { font-family: Arial, sans-serif; font-size: .82rem; font-weight: 800; letter-spacing: .05em; }
.invoice-total-value { font-size: 1.35rem; }

.invoice-payment { display: grid; gap: 7px; margin-top: 18px; }
.invoice-payment-row { display: flex; justify-content: space-between; gap: 20px; font-family: Arial, sans-serif; font-size: .78rem; }

.invoice-footer { margin-top: 24px; text-align: center; color: #735032aa; font-family: Arial, sans-serif; }
.invoice-thanks { margin-bottom: 4px; font-size: .82rem; font-weight: 700; }
.invoice-brand { font-size: .7rem; }

/* Tabla de items de la factura */
.invoice-table-header,
.invoice-item {
  display: grid;
  grid-template-columns: 2fr 0.6fr 1fr 1fr;
  gap: 8px;
  align-items: center;
}

.invoice-table-header {
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: #73503299;
  letter-spacing: .05em;
  border-bottom: 1px dashed var(--sand);
  padding-bottom: 6px;
  margin-bottom: 6px;
}

.invoice-item { font-family: 'Courier New', Courier, monospace; font-size: 0.88rem; }
.invoice-table-header span:not(:first-child),
.invoice-item span:not(:first-child) { text-align: right; }

/* =========================================
   DASHBOARD
========================================= */
.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 40px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(3, 1fr);
  gap: 18px;
}

.payment-breakdown-card {
  grid-column: 2;
  grid-row: 1 / span 3;
}

.kpi-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
}

.kpi-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: #95b6a933;
  border-radius: 12px;
  font-size: 1.3rem;
}

.kpi-body { min-width: 0; }

.kpi-label {
  margin: 0 0 4px;
  color: #4A3321cc;
  font-family: Arial, sans-serif;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.kpi-title {
  margin: 0;
  color: #4A3321cc;
  font-family: Arial, sans-serif;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.kpi-title .kpi-value {
  display: inline;
  margin-left: 4px;
  color: var(--brown);
  font-family: Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
  white-space: nowrap;
}

.kpi-value {
  display: block;
  color: var(--brown);
  font-family: Georgia, serif;
  font-size: 1.55rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-sub {
  margin: 4px 0 0;
  color: #4A3321a8;
  font-family: Arial, sans-serif;
  font-size: .76rem;
}

/* Tarjeta de método de pago */
.payment-breakdown-card {
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.payment-breakdown {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.payment-row { display: flex; flex-direction: column; gap: 6px; }

.payment-row-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: Arial, sans-serif;
}

.payment-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.payment-method-name {
  flex: 1;
  color: var(--brown);
  font-size: .85rem;
  font-weight: 700;
}

.payment-amount {
  color: var(--brown);
  font-size: .88rem;
  white-space: nowrap;
}

.payment-count {
  color: #4A3321a8;
  font-size: .72rem;
  font-weight: 400;
}

.payment-bar-track {
  height: 8px;
  background: #eee3d9;
  border-radius: 6px;
  overflow: hidden;
}

.payment-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width .4s ease;
}

/* Gráficos */
.charts-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.chart-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.chart-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 320px;
}

.chart-canvas-wrapper canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* =========================================
   RESPONSIVE (ADAPTACIÓN A MÓVILES)
========================================= */
@media (max-width: 850px) {
  .sales-layout { flex-direction: column; }
  .sidebar-column { width: 100%; }
  .order-panel { width: 100%; min-height: 480px; height: auto; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; }
  .payment-breakdown-card { grid-column: 1 / -1; grid-row: auto; }
  .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .login-card { padding: 24px; }
  .page-header { padding-inline: 18px; align-items: flex-start; gap: 15px; flex-direction: column; }
  .sales-layout { width: calc(100% - 32px); }
  .catalog-panel, .order-panel { padding: 18px; }
  .panel-heading { align-items: stretch; flex-direction: column; }
  .search-field { min-width: 0; }
  .table-header-row { flex-direction: column; align-items: stretch; }
  .header-search-container { max-width: none; }
  .history-header { display: none; }
  .history-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .history-view-button { justify-self: start; }
  .kpi-grid { grid-template-columns: 1fr; }
  .payment-breakdown-card { grid-column: auto; grid-row: auto; }
  .chart-canvas-wrapper { min-height: 240px; }
}

/* =========================================
   REGLAS PARA IMPRESIÓN DE COMPROBANTES
========================================= */
@media print {
  @page { margin: 0; }
  body > *:not(.invoice-modal) { display: none !important; }
  .invoice-modal { position: static; display: block; padding: 0; }
  .invoice-overlay, .invoice-actions { display: none !important; }
  .invoice-window { box-shadow: none; max-height: none; width: 100%; }
}
