:root {
  color-scheme: light;
  --h-paper: 200 43% 98%;
  --h-surface: 0 0% 100%;
  --h-surface-2: 150 45% 95%;
  --h-ink: 221 38% 15%;
  --h-muted: 220 13% 46%;
  --h-soft: 217 24% 27%;
  --h-line: 221 38% 15%;
  --h-field: 210 40% 99%;
  --h-blue: 216 74% 47%;
  --h-blue-2: 215 100% 59%;
  --h-green: 158 71% 30%;
  --h-red: 3 61% 48%;
  --h-gold: 39 72% 49%;
  --paper: hsl(var(--h-paper));
  --surface: hsl(var(--h-surface));
  --surface-2: hsl(var(--h-surface-2));
  --ink: hsl(var(--h-ink));
  --muted: hsl(var(--h-muted));
  --soft: hsl(var(--h-soft));
  --line: hsl(var(--h-line) / 0.14);
  --blue: hsl(var(--h-blue));
  --blue-2: hsl(var(--h-blue-2));
  --red: hsl(var(--h-red));
  --green: hsl(var(--h-green));
  --gold: hsl(var(--h-gold));
  --field: hsl(var(--h-field));
  --primary-gradient: linear-gradient(135deg, hsl(var(--h-blue)), hsl(219 82% 38%));
  --success-gradient: linear-gradient(135deg, hsl(151 73% 46%), hsl(var(--h-green)));
  --warning-gradient: linear-gradient(135deg, hsl(28 88% 62%), hsl(43 88% 62%));
  --shadow: 0 20px 46px hsl(221 38% 15% / 0.10);
  --shadow-elevated: 0 26px 72px hsl(221 38% 15% / 0.18);
  --radius: 8px;
  --motion-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --motion-fast: 170ms;
  --motion-mid: 360ms;
  --motion-slow: 640ms;
}

/* Facturas: acciones compactas, trazabilidad y resultados por periodo. */
.sales-history-actions {
  align-items: flex-start;
  gap: 8px;
}

.sale-action-menu {
  min-width: 150px;
}

.sale-action-menu > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.sale-action-menu > summary::-webkit-details-marker {
  display: none;
}

.sale-action-menu[open] > summary {
  border-color: #ff5a62;
  color: #e80e18;
}

.sale-action-menu-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding: 8px 0 0;
  border-top: 1px solid #e4e8ec;
}

.sale-management-menu {
  flex: 1 1 100%;
}

.sale-management-actions .btn {
  flex: 1 1 180px;
}

.sale-audit-empty {
  margin-top: 8px;
  padding: 12px;
  border: 1px dashed #cfd6de;
  color: #5d6671;
  font-weight: 700;
}

.sale-audit-list {
  display: grid;
  width: 100%;
  margin-top: 10px;
  border: 1px solid #dce1e6;
}

.sale-audit-list article {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #dce1e6;
}

.sale-audit-list article:last-child {
  border-bottom: 0;
}

.sale-audit-list article > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sale-audit-list article > div:first-child span {
  color: #68717d;
  font-size: .78rem;
  font-weight: 700;
}

.sale-audit-changes {
  display: grid;
  gap: 5px;
}

.sale-audit-changes > span {
  display: grid;
  grid-template-columns: minmax(140px, .8fr) minmax(120px, 1fr) 24px minmax(120px, 1fr);
  align-items: start;
  gap: 8px;
  padding-top: 5px;
  border-top: 1px solid #edf0f3;
}

.sale-audit-changes em,
.sale-audit-changes strong {
  overflow-wrap: anywhere;
  font-style: normal;
}

.sale-audit-changes em {
  color: #68717d;
}

.sale-audit-changes i {
  color: #e80e18;
  font-style: normal;
  text-align: center;
}

.dashboard-period-results {
  display: grid;
  gap: 16px;
}

.dashboard-period-total {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 2px 16px;
  padding: 10px 0;
  border-top: 1px solid #e1e5e9;
  border-bottom: 1px solid #e1e5e9;
}

.dashboard-period-total span,
.dashboard-period-total small {
  color: #636c78;
  font-weight: 800;
}

.dashboard-period-total strong {
  grid-row: span 2;
  color: #ef111b;
  font-size: 2rem;
}

.dashboard-period-products {
  display: grid;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid #e1e5e9;
}

@media (max-width: 760px) {
  .sale-action-menu,
  .sale-management-menu,
  .sales-history-actions > .btn {
    width: 100%;
  }

  .sale-action-menu > summary,
  .sale-action-menu-body .btn {
    width: 100%;
  }

  .sale-audit-list article > div:first-child {
    align-items: flex-start;
    flex-direction: column;
  }

  .sale-audit-changes > span {
    grid-template-columns: 1fr;
  }

  .sale-audit-changes i {
    display: none;
  }

  .dashboard-period-total {
    grid-template-columns: 1fr;
  }

  .dashboard-period-total strong {
    grid-row: auto;
  }
}

body {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(22, 131, 90, 0.08) 0 1px, transparent 1px 28px),
    linear-gradient(45deg, rgba(31, 102, 209, 0.055) 0 1px, transparent 1px 34px),
    linear-gradient(180deg, #ffffff 0%, var(--paper) 48%, #eef4f8 100%);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

body::before {
  background:
    radial-gradient(circle at 12% 8%, rgba(22, 131, 90, 0.14), transparent 28%),
    radial-gradient(circle at 88% 16%, rgba(31, 102, 209, 0.10), transparent 32%),
    linear-gradient(rgba(23, 32, 51, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 51, 0.025) 1px, transparent 1px);
  background-size: auto, auto, 54px 54px, 54px 54px;
  mask-image: linear-gradient(180deg, #000 0%, #000 72%, transparent 100%);
}

body::after {
  background: linear-gradient(90deg, var(--green), var(--blue-2), #f2b84b, var(--red));
  background-size: 260% 100%;
  box-shadow: 0 0 18px rgba(22, 131, 90, 0.22);
}

.app-shell {
  padding-top: env(safe-area-inset-top);
}

.login-panel,
.panel,
.metric,
.module-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.98)),
    var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.login-panel {
  border-top-color: var(--green);
}

.module-tab {
  color: var(--ink);
  background: #ffffff;
}

.module-tab.active,
.module-tab:hover {
  border-color: rgba(22, 131, 90, 0.28);
  background: rgba(22, 131, 90, 0.08);
}

.brand-logo {
  background: #111827;
  box-shadow: 0 12px 28px rgba(19, 32, 53, 0.16);
}

.topbar {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: var(--line);
  box-shadow: 0 10px 30px rgba(19, 32, 53, 0.08);
}

.sidebar {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
}

.nav-item,
.btn,
.module-card,
.metric,
.panel,
.smart-result {
  transition:
    transform var(--motion-mid) var(--motion-ease),
    box-shadow var(--motion-mid) var(--motion-ease),
    border-color var(--motion-mid) var(--motion-ease),
    background var(--motion-mid) var(--motion-ease),
    opacity var(--motion-mid) var(--motion-ease);
}

.nav-item:hover,
.nav-item.active {
  border-color: rgba(22, 131, 90, 0.26);
  color: var(--ink);
  background: rgba(22, 131, 90, 0.10);
}

.btn {
  color: var(--ink);
  background: #eef2f6;
}

.btn.primary {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.btn.danger {
  border-color: #f2b8b5;
  background: #fff5f5;
  color: #991b1b;
}

.btn.ghost {
  background: #ffffff;
  color: var(--soft);
  border-color: var(--line);
}

input,
select,
textarea {
  color: var(--ink);
  background: var(--field);
  border-left-color: rgba(22, 131, 90, 0.62);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 131, 90, 0.13);
}

.view.active > * {
  animation: motionFadeUp 520ms var(--motion-ease) both;
}

.view.active > *:nth-child(2) {
  animation-delay: 45ms;
}

.view.active > *:nth-child(3) {
  animation-delay: 90ms;
}

.metric,
.module-card,
.panel {
  will-change: transform;
}

.module-card:hover,
.metric:hover,
.panel:hover {
  border-color: rgba(22, 131, 90, 0.28);
  transform: translate3d(0, -2px, 0);
}

.module-card strong,
.metric strong,
.scan-card span {
  color: var(--green);
}

.product-photo,
.empty-state,
.scan-card,
.count-box,
.sale-product-box,
.totals-box {
  background: #f8fbff;
}

.empty-state {
  color: var(--muted);
}

.scan-panel {
  color: #ffffff;
  background: #111827;
}

.scanner-status {
  color: #ffffff;
  background: rgba(17, 24, 39, 0.72);
  backdrop-filter: blur(10px);
}

.payment-method-grid {
  align-items: end;
}

.payment-note {
  min-height: 52px;
  padding: 14px 16px;
  color: var(--soft);
  background: rgba(22, 131, 90, 0.08);
  border: 1px solid rgba(22, 131, 90, 0.18);
  border-radius: var(--radius);
  font-weight: 700;
  line-height: 1.35;
}

.receivable-sale-note {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  color: var(--soft);
  background: rgba(31, 102, 209, 0.06);
  border: 1px solid rgba(31, 102, 209, 0.18);
  border-radius: var(--radius);
  font-weight: 800;
  line-height: 1.35;
}

.receivable-sale-note strong {
  color: var(--ink);
  font-size: 18px;
}

.receivable-sale-note em {
  color: var(--red);
  font-style: normal;
  font-weight: 900;
}

.sale-edit-panel {
  border-color: rgba(31, 102, 209, 0.22) !important;
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.94), #ffffff) !important;
}

.sale-edit-panel .section-head {
  gap: 12px;
  align-items: start;
}

.sale-edit-panel .payment-note {
  min-height: auto;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid rgba(22, 131, 90, 0.18);
  border-radius: 8px;
  background: rgba(22, 131, 90, 0.06);
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.toggle-line input {
  width: 20px;
  min-width: 20px;
  height: 20px;
  padding: 0;
  border-left-width: 1px;
}

.sale-edit-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(22, 131, 90, 0.2);
  border-radius: 8px;
  background: rgba(22, 131, 90, 0.07);
}

.sale-edit-summary span,
.sale-edit-summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.sale-edit-summary strong {
  color: var(--red);
  font-size: 24px;
  line-height: 1;
  white-space: nowrap;
}

.sale-edit-summary small {
  grid-column: 1 / -1;
  text-transform: none;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.receivable-edit-banner {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  color: var(--soft);
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: var(--radius);
  font-weight: 800;
}

.receivable-edit-banner strong {
  color: var(--ink);
}

.payment-split {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
  background: rgba(22, 131, 90, 0.055);
  border: 1px solid rgba(22, 131, 90, 0.16);
  border-radius: var(--radius);
}

.payment-split-single {
  grid-template-columns: minmax(240px, 460px);
  justify-content: start;
}

.payment-split-full {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.document-print-options {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(31, 102, 209, 0.18);
  border-radius: 8px;
  background: rgba(31, 102, 209, 0.055);
}

.document-print-options small {
  color: var(--soft);
  font-weight: 800;
  line-height: 1.35;
}

.document-print-check {
  justify-content: flex-start;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.delivery-change-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: var(--radius);
}

.delivery-change-box small {
  color: #92400e;
  font-weight: 800;
}

.pending-payment {
  color: var(--red);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.table-actions {
  justify-content: flex-end;
}

.import-panel + .import-panel {
  margin-top: 18px;
}

.scan-confirm {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(22, 131, 90, 0.92);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, -10px, 0) scale(0.96);
  transition:
    opacity 220ms var(--motion-ease),
    transform 220ms var(--motion-ease);
}

.scan-confirm.show {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.scan-confirm small {
  margin-left: auto;
  overflow: hidden;
  max-width: 46%;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.check-icon {
  position: relative;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #ffffff;
}

.check-icon::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  width: 9px;
  height: 14px;
  border-right: 3px solid var(--green);
  border-bottom: 3px solid var(--green);
  transform: rotate(42deg);
}

.sales-layout {
  display: grid;
  grid-template-columns: minmax(520px, 0.9fr) minmax(520px, 1.1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.sales-layout > * {
  min-width: 0;
}

.sale-product-box {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(22, 131, 90, 0.16);
  border-radius: 8px;
}

.scan-smart-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(31, 102, 209, 0.16);
  border-radius: 8px;
  background: rgba(31, 102, 209, 0.04);
}

.compact-grid {
  grid-template-columns: 1.2fr 0.7fr 0.9fr auto;
  align-items: end;
}

.sale-history-head {
  align-items: start;
}

.sale-history-filters {
  display: grid;
  grid-template-columns: minmax(130px, 0.75fr) minmax(130px, 0.75fr) minmax(220px, 1.5fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.sale-history-filters > *,
.sale-history-filters input,
.sale-history-filters .btn {
  min-width: 0;
  width: 100%;
}

.sale-history-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.sale-history-summary span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(31, 102, 209, 0.06);
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.warning-text {
  color: #9a5b00 !important;
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.28) !important;
}

@media (max-width: 1500px) {
  .sales-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1180px) {
  .sale-history-filters,
  .compact-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .sale-history-search,
  .sale-history-filters .btn {
    grid-column: 1 / -1;
  }
}

.smart-results {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.smart-result {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
}

.smart-result:hover {
  border-color: rgba(22, 131, 90, 0.28);
  transform: translate3d(0, -1px, 0);
}

.smart-result .product-photo {
  width: 44px;
  height: 44px;
}

.smart-result span,
.smart-result em {
  min-width: 0;
  color: var(--muted);
  font-style: normal;
  line-height: 1.25;
  overflow-wrap: break-word;
  word-break: normal;
}

.smart-result em {
  grid-column: 2;
  display: block;
  margin-top: -4px;
}

.smart-result strong {
  display: block;
  color: var(--ink);
}

.smart-product-table-wrap {
  display: grid;
  gap: 6px;
  max-height: min(62vh, 640px);
  overflow: auto;
  overscroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.smart-results-meta {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 8px 10px;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 900;
}

.smart-product-header,
.smart-product-row {
  display: grid;
  grid-template-columns:
    64px
    minmax(110px, 0.85fr)
    minmax(110px, 0.85fr)
    minmax(320px, 2.2fr)
    minmax(120px, 0.8fr)
    minmax(92px, 0.65fr)
    minmax(118px, 0.75fr)
    minmax(128px, 0.75fr);
  gap: 10px;
  align-items: center;
  min-width: 1160px;
}

.smart-product-header {
  position: sticky;
  top: 34px;
  z-index: 2;
  padding: 8px 10px;
  color: var(--soft);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.smart-product-list {
  display: grid;
}

.smart-product-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
  cursor: pointer;
}

.smart-product-row:hover {
  background: rgba(22, 131, 90, 0.06);
}

.smart-product-row > span {
  min-width: 0;
}

.smart-product-row small {
  display: none;
  color: var(--soft);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.smart-product-row strong {
  display: block;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.smart-product-row em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.2;
}

.smart-product-description strong {
  font-size: 14px;
}

.smart-product-price strong {
  color: var(--danger);
  font-weight: 950;
}

.smart-product-photo .product-photo,
.smart-product-photo .product-photo.empty {
  width: 46px;
  height: 46px;
}

.sale-items {
  display: grid;
  gap: 10px;
}

.totals-box {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.totals-box span {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--soft);
}

.totals-box .grand-total {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.quick-create {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(22, 131, 90, 0.16);
  border-radius: 8px;
  background: #f8fbff;
}

.label-print-button {
  margin-top: 12px;
}

.label-scanner-panel {
  min-height: 260px;
  overflow: hidden;
}

.label-scanner-panel .scan-video,
.label-scanner-panel .quagga-viewport {
  min-height: 220px;
}

.preview-label {
  border: 1px dashed rgba(23, 32, 51, 0.22);
  box-shadow: 0 14px 28px rgba(19, 32, 53, 0.10);
  transform-origin: top left;
}

.print-label {
  width: 60mm;
  height: 30mm;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto 9mm;
  gap: 1mm;
  padding: 2mm 2.4mm 1.8mm;
  overflow: hidden;
  color: #111827;
  background: #ffffff;
  font-family: Arial, "Helvetica Neue", sans-serif;
}

.label-brand {
  font-size: 7.4px;
  font-weight: 900;
  letter-spacing: 0.2px;
}

.label-desc {
  min-height: 0;
  overflow: hidden;
  font-size: 11.8px;
  font-weight: 900;
  line-height: 1.04;
  text-transform: uppercase;
}

.label-code {
  overflow: hidden;
  font-size: 10.6px;
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: 0.15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-barcode {
  width: 100%;
  height: 11mm;
  display: block;
  fill: #111827;
}

.focus-flash {
  animation: focusFlash 900ms var(--motion-ease) both;
}

#printRoot {
  display: none;
}

@keyframes focusFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(22, 131, 90, 0.0), var(--shadow);
  }
  35% {
    box-shadow: 0 0 0 5px rgba(22, 131, 90, 0.18), var(--shadow);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(22, 131, 90, 0.0), var(--shadow);
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding-top: 0;
  }

  .topbar {
    position: sticky;
    top: 0;
    padding-top: calc(12px + env(safe-area-inset-top));
    background: rgba(255, 255, 255, 0.96);
  }

  .sidebar {
    background: #ffffff;
  }

  .sales-layout,
  .compact-grid {
    grid-template-columns: 1fr;
  }

  .preview-label {
    max-width: 100%;
  }

  tr {
    background: #ffffff;
  }

  td:nth-child(3)::before,
  td:nth-child(4)::before,
  td:nth-child(5)::before,
  td:nth-child(6)::before {
    content: none;
  }

  td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-weight: 900;
  }

  td[data-label="Foto"]::before,
  td[data-label="Accion"]::before {
    content: "";
  }

  td:nth-child(n + 3) {
    color: var(--soft);
  }

  .smart-result {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .smart-result em {
    grid-column: 2;
  }

  .scan-confirm {
    left: 12px;
    right: 12px;
  }

  .bulk-actions {
    grid-template-columns: 1fr;
  }

  .bulk-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .bulk-footer .btn {
    width: 100%;
  }

  .bulk-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .bulk-table {
    min-width: 760px;
  }

  #products .table-wrap {
    overflow-x: visible;
  }

  #products tr,
  #movements tr,
  #sales tr {
    max-width: 100%;
  }

  .preview-label {
    width: 60mm;
    max-width: min(100%, 60mm);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

.bcv-rate-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #b7e4d1;
  border-radius: 8px;
  background: #f0fdf7;
  color: #0f5132;
  font-weight: 800;
}

.duplicate-product-warning {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #f2b8b5;
  border-radius: 8px;
  background: #fff5f5;
  color: #7f1d1d;
}

.duplicate-product-warning .product-photo {
  width: 58px;
  height: 58px;
}

.duplicate-product-warning div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.duplicate-product-warning span,
.duplicate-product-warning small {
  color: #991b1b;
  overflow-wrap: anywhere;
}

.sale-form-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.84);
}

.form-step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.form-step-title span {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--green);
  color: #ffffff;
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid #b7e4d1;
  border-radius: 999px;
  background: #f0fdf7;
  color: #0f5132;
  font-weight: 900;
}

.status-pill.danger {
  border-color: #f2b8b5;
  background: #fff5f5;
  color: #991b1b;
}

.status-pill.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.sale-return-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #b7e4d1;
  border-radius: var(--radius);
  background: #f8fffb;
}

.sale-return-table input {
  min-width: 92px;
}

.bcv-rate-line .btn {
  width: auto;
}

.cash-table td.num span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

@media print {
  @page {
    size: 80mm auto;
    margin: 2mm;
  }

  html,
  body {
    width: 80mm;
    min-height: 0;
    color: #111827;
    background: #ffffff !important;
  }

  body::before,
  body::after,
  #loginScreen,
  #appShell {
    display: none !important;
  }

  #printRoot {
    display: block !important;
  }

  .print-ticket {
    width: 76mm;
    margin: 0 auto;
    padding-top: 1mm;
    color: #111827;
    background: #ffffff;
    font-family: Arial, "Helvetica Neue", sans-serif;
    font-size: 11px;
    line-height: 1.22;
  }

  .ticket-heading {
    display: grid;
    gap: 3px;
    margin-bottom: 8px;
    text-align: right;
  }

  .ticket-heading strong {
    font-size: 15px;
  }

  .ticket-status {
    font-weight: 900;
    color: #991b1b;
  }

  .ticket-client {
    display: grid;
    gap: 2px;
    margin-bottom: 6px;
  }

  .ticket-row,
  .ticket-item,
  .ticket-totals span {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22mm;
    gap: 6px;
    align-items: start;
  }

  .ticket-head {
    padding: 3px 0;
    border-top: 1px solid #111827;
    border-bottom: 1px solid #111827;
    text-decoration: underline;
  }

  .ticket-lines {
    display: grid;
    gap: 4px;
    padding: 5px 0 6px;
    border-bottom: 1px solid #111827;
  }

  .ticket-item span,
  .ticket-item small {
    display: block;
  }

  .ticket-item > strong,
  .ticket-totals strong {
    text-align: right;
  }

  .ticket-totals {
    display: grid;
    gap: 3px;
    padding-top: 6px;
    font-weight: 700;
  }

  .ticket-grand {
    font-size: 16px;
    font-weight: 900;
  }

  .ticket-notice {
    margin-top: 7px;
    padding-top: 5px;
    border-top: 1px solid #111827;
    color: #111827;
    font-size: 8px;
    line-height: 1.18;
    font-weight: 700;
    text-align: center;
  }
}

.sale-history-items {
  display: grid;
  gap: 5px;
  min-width: 0;
  max-width: 520px;
  margin-top: 8px;
}

.sale-history-items span {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 7px;
  align-items: baseline;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid rgba(22, 131, 90, 0.14);
  border-radius: 8px;
  background: rgba(22, 131, 90, 0.055);
}

.sale-history-items strong {
  color: var(--green);
  font-size: 12px;
  white-space: nowrap;
}

.sale-history-items em {
  min-width: 0;
  color: var(--soft);
  font-size: 12px;
  font-style: normal;
  line-height: 1.25;
  overflow-wrap: break-word;
  word-break: normal;
}

.sale-history-items small,
.sale-history-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.sale-history-items span small {
  grid-column: 2;
}

.sale-history-items .sale-history-price,
.sale-total-note {
  display: block;
  margin-top: 2px;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
}

@media (max-width: 860px) {
  .sale-history-items {
    max-width: 100%;
  }

  .sale-history-items span {
    grid-template-columns: minmax(0, 1fr);
  }

  .sale-history-items strong {
    white-space: normal;
  }

  .sale-history-items span small {
    grid-column: 1;
  }
}

/* Final iPhone/Android guardrails: keep absolutely last. */
@media (max-width: 860px) {
  html,
  body,
  .app-shell,
  .workspace,
  .content,
  .view,
  .panel {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .content {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .section-head,
  .bulk-footer,
  .cash-month-head,
  .topbar-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }

  .section-head > *,
  .bulk-footer > *,
  .topbar-actions > *,
  .cash-month-head > * {
    width: 100%;
    min-width: 0;
  }

  .sales-layout,
  .split-layout,
  .scanner-grid,
  .form-grid,
  .compact-grid,
  .bulk-actions,
  .metrics-grid,
  .cash-metrics {
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  label,
  input,
  select,
  textarea,
  button,
  .btn,
  .empty-state,
  .bulk-summary,
  .sale-product-box,
  .totals-box {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  input,
  select,
  textarea,
  .btn {
    width: 100%;
  }

  input[type="file"] {
    display: block;
    overflow: hidden;
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  input[type="file"]::file-selector-button,
  input[type="file"]::-webkit-file-upload-button {
    max-width: 58%;
    margin-right: 8px;
    white-space: nowrap;
  }

  .table-wrap,
  .bulk-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
  }

  table,
  tbody,
  .bulk-table,
  .cash-table,
  .sale-items-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  thead {
    display: none !important;
  }

  tbody {
    display: grid !important;
    gap: 10px;
  }

  tr {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
  }

  td {
    grid-column: 1 / -1 !important;
    width: 100%;
    min-width: 0 !important;
    border: 0;
    padding: 4px 0;
    text-align: left !important;
    overflow-wrap: anywhere;
  }

  td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-weight: 900;
  }

  td input,
  td select,
  td textarea,
  .inline-pay,
  .supplier-pay {
    width: 100%;
    min-width: 0;
  }

  .inline-pay,
  .supplier-pay {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .quick-search-panel {
    place-items: stretch;
    padding: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
  }

  .quick-product {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .quick-product em,
  .quick-product b {
    grid-column: 2;
  }
}

/* Final iPhone/Android guardrails: keep absolutely last. */
@media (max-width: 860px) {
  html,
  body,
  .app-shell,
  .workspace,
  .content,
  .view,
  .panel {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .content {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .section-head,
  .bulk-footer,
  .cash-month-head,
  .topbar-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }

  .section-head > *,
  .bulk-footer > *,
  .topbar-actions > *,
  .cash-month-head > * {
    width: 100%;
    min-width: 0;
  }

  .sales-layout,
  .split-layout,
  .scanner-grid,
  .form-grid,
  .compact-grid,
  .bulk-actions,
  .metrics-grid,
  .cash-metrics {
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  label,
  input,
  select,
  textarea,
  button,
  .btn,
  .empty-state,
  .bulk-summary,
  .sale-product-box,
  .totals-box {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  input,
  select,
  textarea,
  .btn {
    width: 100%;
  }

  input[type="file"] {
    display: block;
    overflow: hidden;
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  input[type="file"]::file-selector-button,
  input[type="file"]::-webkit-file-upload-button {
    max-width: 58%;
    margin-right: 8px;
    white-space: nowrap;
  }

  .table-wrap,
  .bulk-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
  }

  table,
  tbody,
  .bulk-table,
  .cash-table,
  .sale-items-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  thead {
    display: none !important;
  }

  tbody {
    display: grid !important;
    gap: 10px;
  }

  tr {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
  }

  td {
    grid-column: 1 / -1 !important;
    width: 100%;
    min-width: 0 !important;
    border: 0;
    padding: 4px 0;
    text-align: left !important;
    overflow-wrap: anywhere;
  }

  td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-weight: 900;
  }

  td input,
  td select,
  td textarea,
  .inline-pay,
  .supplier-pay {
    width: 100%;
    min-width: 0;
  }

  .inline-pay,
  .supplier-pay {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .quick-search-panel {
    place-items: stretch;
    padding: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
  }

  .quick-product {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .quick-product em,
  .quick-product b {
    grid-column: 2;
  }
}

.quick-search-panel {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: start center;
  padding: calc(18px + env(safe-area-inset-top)) 14px 18px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(12px);
}

.quick-search-card {
  width: min(720px, 100%);
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.24);
}

.quick-search-card input {
  width: 100%;
}

.quick-search-results {
  display: grid;
  gap: 8px;
  max-height: min(70vh, 620px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.quick-product {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
}

.quick-product span,
.quick-product small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.quick-product small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

.quick-product em,
.quick-product b {
  white-space: nowrap;
  font-style: normal;
}

.quick-product em {
  color: var(--green);
  font-weight: 900;
}

/* Final iPhone/Android guardrails: every module must stay inside the screen. */
@media (max-width: 860px) {
  html,
  body,
  .app-shell,
  .workspace,
  .content,
  .view,
  .panel {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .content {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .section-head,
  .bulk-footer,
  .cash-month-head,
  .topbar-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }

  .section-head > *,
  .bulk-footer > *,
  .topbar-actions > *,
  .cash-month-head > * {
    width: 100%;
    min-width: 0;
  }

  .sales-layout,
  .split-layout,
  .scanner-grid,
  .form-grid,
  .compact-grid,
  .bulk-actions,
  .metrics-grid,
  .cash-metrics {
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  label,
  input,
  select,
  textarea,
  button,
  .btn,
  .empty-state,
  .bulk-summary,
  .sale-product-box,
  .totals-box {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  input,
  select,
  textarea,
  .btn {
    width: 100%;
  }

  input[type="file"] {
    display: block;
    overflow: hidden;
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  input[type="file"]::file-selector-button,
  input[type="file"]::-webkit-file-upload-button {
    max-width: 58%;
    margin-right: 8px;
    white-space: nowrap;
  }

  .table-wrap,
  .bulk-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
  }

  table,
  tbody,
  .bulk-table,
  .cash-table,
  .sale-items-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  thead {
    display: none !important;
  }

  tbody {
    display: grid !important;
    gap: 10px;
  }

  tr {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
  }

  td {
    grid-column: 1 / -1 !important;
    width: 100%;
    min-width: 0 !important;
    border: 0;
    padding: 4px 0;
    text-align: left !important;
    overflow-wrap: anywhere;
  }

  td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-weight: 900;
  }

  td input,
  td select,
  td textarea,
  .inline-pay,
  .supplier-pay {
    width: 100%;
    min-width: 0;
  }

  .inline-pay,
  .supplier-pay {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .quick-search-panel {
    place-items: stretch;
    padding: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
  }

  .quick-product {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .quick-product em,
  .quick-product b {
    grid-column: 2;
  }
}

/* Inventario mobile/print overrides: keep last so iPhone and Android do not crop document tools. */
@media (max-width: 860px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .view,
  .panel,
  .table-wrap,
  .bulk-table-wrap,
  .sales-layout,
  .split-layout,
  .scanner-grid,
  .form-grid,
  .bulk-actions,
  .cash-tabs {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .bulk-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
    align-items: stretch !important;
  }

  .bulk-actions > label,
  .bulk-actions > .btn,
  .bulk-actions input[type="file"],
  .bulk-actions textarea {
    width: 100% !important;
    min-width: 0 !important;
  }

  .bulk-actions input[type="file"] {
    display: block;
    overflow: hidden;
    padding: 10px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .bulk-actions input[type="file"]::file-selector-button,
  .bulk-actions input[type="file"]::-webkit-file-upload-button {
    max-width: 58%;
    margin-right: 8px;
    border: 0;
    border-radius: 999px;
    padding: 8px 12px;
    background: #eef2f6;
    font-weight: 900;
  }

  .bulk-footer,
  .cash-month-head {
    display: grid !important;
    grid-template-columns: 1fr !important;
    justify-content: stretch !important;
  }

  .bulk-footer .btn,
  .cash-month-head input {
    width: 100%;
  }

  .cash-tabs {
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .cash-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

.preview-label,
.print-label {
  border: 0.35mm solid #111827 !important;
}

@media print {
  #printRoot[data-print-mode="label"] .print-label {
    width: 60mm !important;
    height: 30mm !important;
    border: 0.35mm solid #111827 !important;
    padding: 3mm 3.2mm 2.7mm !important;
    box-shadow: none !important;
  }
}

/* Caja mensual y etiquetas: reglas finales para ganar sobre bloques antiguos. */
.cash-month-head {
  margin-bottom: 14px;
}

.cash-month-head input {
  max-width: 190px;
}

.cash-period-copy span,
.cash-day-picker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.cash-period-copy h3 {
  margin-top: 2px;
}

.cash-day-picker {
  display: grid;
  gap: 3px;
}

.cash-day-picker input {
  min-width: 170px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  text-transform: none;
}

.cash-table tr.cash-day-selected > td {
  background: rgba(18, 135, 97, 0.1);
  box-shadow: inset 0 1px rgba(18, 135, 97, 0.24), inset 0 -1px rgba(18, 135, 97, 0.24);
}

.cash-table tr.cash-day-selected > td:first-child {
  box-shadow: inset 4px 0 #128761, inset 0 1px rgba(18, 135, 97, 0.24), inset 0 -1px rgba(18, 135, 97, 0.24);
}

.cash-table tr[data-cash-select-day] {
  cursor: pointer;
}

.cash-day-overview {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.cash-day-overview-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 2px 2px 10px;
}

.cash-day-overview-head > div:first-child > span,
.cash-overview-metric > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.cash-day-overview-head h3 {
  margin: 2px 0;
  font-size: 24px;
  text-transform: capitalize;
}

.cash-day-overview-head small {
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.cash-day-navigation {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cash-day-arrow {
  width: 38px;
  min-width: 38px;
  padding-inline: 0 !important;
  font-size: 20px !important;
}

.cash-overview-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(145px, 1fr));
  gap: 8px;
}

.cash-overview-metric {
  min-width: 0;
  min-height: 108px;
  border: 1px solid var(--line);
  border-left: 4px solid #9aa5b1;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.cash-overview-metric.tone-sales,
.cash-overview-metric.tone-received {
  border-left-color: var(--red);
}

.cash-overview-metric.tone-cash,
.cash-overview-metric.tone-available {
  border-left-color: #128761;
}

.cash-overview-metric.tone-bolivar {
  border-left-color: #1f66d1;
}

.cash-overview-metric.tone-cashea {
  border-left-color: #b7791f;
}

.cash-overview-metric > strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 8px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.05;
}

.cash-overview-metric > small {
  display: block;
  margin-top: 8px;
  color: var(--soft);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
}

.cash-overview-details {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.85fr);
  gap: 10px;
  margin-bottom: 10px;
}

.cash-overview-method-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
}

.cash-overview-method {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  border-bottom: 1px solid var(--line);
  padding: 6px 2px;
  opacity: 0.58;
}

.cash-overview-method.has-value {
  opacity: 1;
}

.cash-overview-method span,
.cash-overview-method-values {
  min-width: 0;
}

.cash-overview-method b,
.cash-overview-method small {
  display: block;
}

.cash-overview-method b {
  font-size: 13px;
}

.cash-overview-method small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.cash-overview-method-values {
  text-align: right;
}

.cash-overview-method-values strong {
  color: var(--ink);
  font-size: 15px;
  white-space: nowrap;
}

.cash-overview-method-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 12px;
  align-items: center;
  margin-top: 10px;
  border-top: 2px solid var(--ink);
  padding-top: 10px;
}

.cash-overview-method-total span {
  font-weight: 900;
}

.cash-overview-method-total strong {
  color: var(--red);
  font-size: 21px;
}

.cash-overview-method-total small {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.cash-overview-reconcile-list {
  display: grid;
  gap: 4px;
}

.cash-overview-reconcile-list > span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
}

.cash-overview-reconcile-list b {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.cash-overview-reconcile-list strong {
  white-space: nowrap;
}

.cash-overview-reconcile-total {
  border-top: 2px solid var(--ink);
  border-bottom: 0 !important;
}

.cash-month-secondary,
.cash-month-history {
  margin-bottom: 10px;
}

.cash-month-secondary > summary,
.cash-month-history > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-weight: 900;
  list-style-position: inside;
}

.cash-month-secondary > summary strong {
  color: var(--red);
  text-transform: capitalize;
}

.cash-month-secondary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.cash-month-secondary-grid > div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.cash-month-secondary-grid span,
.cash-month-secondary-grid strong {
  display: block;
}

.cash-month-secondary-grid span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.cash-month-secondary-grid strong {
  margin-top: 5px;
  font-size: 18px;
}

.cash-settings-inline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.cash-month-history[open] > summary,
.cash-month-secondary[open] > summary {
  margin-bottom: 10px;
}

@media (max-width: 1320px) {
  .cash-overview-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .cash-day-overview-head {
    align-items: stretch;
    flex-direction: column;
  }

  .cash-overview-metrics,
  .cash-overview-method-grid,
  .cash-overview-details,
  .cash-month-secondary-grid,
  .cash-settings-inline {
    grid-template-columns: minmax(0, 1fr);
  }

  .cash-day-navigation {
    justify-content: space-between;
  }

  .cash-day-navigation .btn:not(.cash-day-arrow) {
    flex: 1 1 auto;
  }

  .cash-overview-metric {
    min-height: 94px;
  }

  .cash-overview-method-total small {
    grid-column: 1 / -1;
  }
}

.cash-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 14px;
  scrollbar-width: thin;
}

.cash-tab {
  flex: 0 0 auto;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--soft);
  background: #ffffff;
  font-weight: 900;
  cursor: pointer;
  transition:
    transform 180ms var(--motion-ease),
    border-color 180ms var(--motion-ease),
    background 180ms var(--motion-ease);
}

.cash-tab.active,
.cash-tab:hover {
  color: var(--green);
  border-color: rgba(22, 131, 90, 0.42);
  background: #edfdf4;
  transform: translateY(-1px);
}

.cash-invoices-panel {
  display: grid;
  gap: 12px;
}

.cash-invoice-guidance {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cash-invoice-guidance span {
  min-width: 0;
  border: 1px solid rgba(22, 131, 90, 0.16);
  border-radius: 8px;
  padding: 12px;
  background: rgba(22, 131, 90, 0.06);
  color: var(--soft);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.cash-invoice-guidance strong {
  color: var(--ink);
}

@media (max-width: 860px) {
  .cash-invoice-guidance {
    grid-template-columns: minmax(0, 1fr);
  }
}

.control-list,
.cash-list-grid {
  display: grid;
  gap: 10px;
}

.control-list span,
.cash-list-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbff;
}

.control-list strong {
  display: block;
  color: var(--ink);
}

.cash-list-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cash-list-grid > div {
  display: grid;
  align-content: start;
}

.cash-list-grid strong {
  margin-bottom: 8px;
}

.cash-list-grid span {
  padding: 5px 0;
  color: var(--soft);
  font-weight: 800;
}

.user-admin-panel {
  margin-top: 18px;
}

.user-admin-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}

.user-admin-summary > div {
  border: 1px solid rgba(22, 131, 90, 0.18);
  border-radius: 10px;
  padding: 12px;
  background: #f4fbf7;
}

.user-admin-summary span {
  display: block;
  color: var(--soft);
  font-weight: 900;
  font-size: 12px;
  text-transform: uppercase;
}

.user-admin-summary strong {
  display: block;
  color: var(--green);
  font-family: "Outfit", sans-serif;
  font-size: 28px;
  line-height: 1.1;
}

.user-admin-error {
  margin: 8px 0 12px;
}

.user-permission-help {
  max-width: 900px;
  margin: 6px 0 0;
  color: var(--soft);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.user-permission-help strong {
  color: var(--ink);
}

.user-create-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 0.9fr minmax(260px, 1.4fr) auto;
  gap: 12px;
  align-items: end;
  margin: 14px 0 18px;
}

.user-admin-list {
  display: grid;
  gap: 12px;
}

.user-admin-card {
  display: grid;
  grid-template-columns: minmax(190px, 1.3fr) minmax(150px, 0.9fr) minmax(130px, 0.7fr) minmax(150px, 0.8fr) minmax(260px, 1.3fr) auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #f8fbff;
}

.user-admin-main {
  display: grid;
  gap: 3px;
  align-self: center;
}

.user-admin-main strong {
  color: var(--ink);
  font-size: 16px;
}

.user-admin-main span,
.user-admin-main small {
  color: var(--soft);
  font-weight: 800;
}

.user-actions-picker {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  max-height: none;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #ffffff;
}

.user-actions-picker summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 900;
  font-size: 17px;
  list-style: none;
}

.user-actions-picker summary::-webkit-details-marker {
  display: none;
}

.permission-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.permission-preset-help {
  display: block;
  margin-top: 8px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.btn.tiny {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 12px;
}

.permission-picker-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin: 14px 0 12px;
  padding: 12px;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  background: #f7faff;
}

.permission-search-label {
  display: grid;
  gap: 6px;
  color: var(--soft);
  font-size: 13px;
  font-weight: 900;
}

.permission-search-label input {
  min-height: 44px;
}

.permission-selected-count {
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap;
}

.user-permission-groups {
  display: grid;
  gap: 12px;
}

.user-permission-group {
  min-width: 0;
  padding: 14px;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  background: #ffffff;
}

.user-permission-group[hidden],
.user-action-check[hidden] {
  display: none;
}

.user-permission-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.user-permission-group-head h4 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.user-permission-group-head p {
  margin: 3px 0 0;
  color: var(--soft);
  font-size: 13px;
  font-weight: 700;
}

.user-permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 10px;
}

.user-action-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(14, 22, 36, 0.08);
  border-radius: 8px;
  background: #f8fbff;
  cursor: pointer;
}

.user-action-check input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
}

.user-action-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.user-action-copy strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}

.user-action-copy small {
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}

.photo-only-product-summary {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  background: #f7faff;
}

.photo-only-product-summary .product-photo,
.photo-only-product-summary .product-photo-wrap {
  width: 76px;
  height: 76px;
}

.photo-only-product-summary > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.photo-only-product-summary span,
.photo-only-product-summary small {
  color: var(--soft);
  font-weight: 800;
  line-height: 1.35;
}

.product-photo-only-editor .form-grid {
  grid-template-columns: minmax(0, 1fr);
}

.product-photo-only-editor .product-data-field {
  display: none !important;
}

@media (max-width: 1100px) {
  .user-create-grid,
  .user-admin-card {
    grid-template-columns: 1fr 1fr;
  }

  .user-admin-main {
    grid-column: 1 / -1;
  }

  .user-actions-picker {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .user-admin-summary {
    grid-template-columns: 1fr;
  }

  .user-create-grid,
  .user-admin-card {
    grid-template-columns: 1fr;
  }

  .user-permissions-grid {
    grid-template-columns: 1fr;
  }

  .permission-picker-toolbar {
    grid-template-columns: 1fr;
  }

  .permission-selected-count {
    white-space: normal;
  }

  .user-permission-group-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

.cash-expected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(22, 131, 90, 0.18);
  border-radius: 8px;
  padding: 12px;
  color: var(--soft);
  background: #f4fbf7;
  font-weight: 900;
}

.cash-expected strong {
  color: var(--green);
  font-size: 20px;
}

.driver-expected {
  background: #fff8ed;
  border-color: rgba(242, 184, 75, 0.34);
}

.driver-expected strong {
  color: #a15c06;
}

.driver-expected.received {
  background: #f4fbf7;
  border-color: rgba(22, 131, 90, 0.22);
}

.driver-expected.received strong {
  color: var(--green);
}

.row-warning {
  background: rgba(242, 184, 75, 0.12);
}

.driver-cash-table .btn {
  white-space: nowrap;
}

.inline-pay {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.compact-metrics {
  margin-bottom: 14px;
}

.cash-table td span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cash-close-report {
  display: grid;
  gap: 14px;
  border-color: rgba(22, 131, 90, 0.22) !important;
  background: linear-gradient(180deg, rgba(244, 251, 247, 0.74), rgba(255, 255, 255, 0.96)) !important;
}

.cash-arqueo-panel {
  display: grid;
  gap: 14px;
  border-color: rgba(242, 13, 13, 0.22) !important;
  background: linear-gradient(180deg, rgba(255, 245, 245, 0.72), rgba(255, 255, 255, 0.96)) !important;
}

.cash-arqueo-panel .section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.cash-arqueo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.cash-arqueo-sheet {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.cash-sheet-block {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
}

.cash-sheet-block h4 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
  background: #f8fafc;
  color: var(--ink);
  font-size: 15px;
}

.cash-sheet-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px 12px;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.cash-sheet-row:last-child {
  border-bottom: 0;
}

.cash-sheet-row span,
.cash-sheet-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.cash-sheet-row span {
  min-width: 0;
}

.cash-sheet-row strong {
  color: var(--ink);
  font-size: 16px;
  text-align: right;
  white-space: nowrap;
}

.cash-sheet-row small {
  grid-column: 1 / -1;
  line-height: 1.25;
  text-transform: none;
}

.cash-sheet-row.tone-total {
  border-top: 2px solid rgba(15, 23, 42, 0.72);
  background: #fafafa;
}

.cash-sheet-row.tone-total strong,
.cash-sheet-row.tone-danger strong {
  color: var(--red);
}

.cash-sheet-row.tone-cash {
  background: #fff;
}

.cash-sheet-row.tone-bank {
  background: #fff;
}

.cash-close-report-card.tone-cash {
  border-color: rgba(22, 131, 90, 0.25);
  background: rgba(244, 251, 247, 0.9);
}

.cash-close-report-card.tone-bank {
  border-color: rgba(31, 102, 209, 0.22);
  background: rgba(239, 246, 255, 0.92);
}

.cash-close-report-card.tone-digital {
  border-color: rgba(99, 102, 241, 0.2);
  background: rgba(245, 243, 255, 0.92);
}

.cash-close-report-card.tone-credit {
  border-color: rgba(245, 158, 11, 0.28);
  background: rgba(255, 248, 237, 0.92);
}

.cash-close-report-card.tone-exit {
  border-color: rgba(242, 13, 13, 0.22);
  background: rgba(255, 241, 242, 0.92);
}

.cash-close-report-card.tone-cash strong {
  color: var(--green);
}

.cash-close-report-card.tone-bank strong,
.cash-close-report-card.tone-digital strong {
  color: #1f66d1;
}

.cash-close-report-card.tone-credit strong {
  color: #a15c06;
}

.cash-arqueo-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
  gap: 12px;
  align-items: start;
}

.cash-balance-ledger {
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.94);
}

.cash-balance-ledger h4 {
  margin: 0 0 4px;
  font-size: 17px;
}

.cash-ledger-divider {
  height: 1px;
  margin: 4px 0;
  background: var(--line);
}

.cash-balance-ledger span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  padding: 5px 0;
}

.cash-balance-ledger span:last-of-type {
  border-bottom: 0;
}

.cash-balance-ledger b,
.cash-balance-ledger small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.cash-balance-ledger strong {
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}

.cash-balance-ledger .total-line {
  border-top: 2px solid var(--ink);
  margin-top: 4px;
  padding-top: 8px;
}

.cash-balance-ledger .total-line strong {
  color: var(--red);
  font-size: 20px;
}

.cash-balance-ledger .warning-line strong {
  color: var(--red);
}

.cash-close-form {
  width: 100%;
}

.cash-close-form label > small {
  display: block;
  margin-top: 6px;
  line-height: 1.35;
}

.cash-close-report .section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.cash-close-report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.cash-close-report-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.cash-close-report-card span,
.cash-close-report-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 1000;
  text-transform: uppercase;
}

.cash-close-report-card strong {
  display: block;
  margin: 6px 0 3px;
  color: var(--red);
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.cash-close-report-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.4fr);
  gap: 16px;
  align-items: start;
}

.cash-close-report-layout.single {
  grid-template-columns: minmax(0, 1fr);
}

.cash-close-report-layout h4 {
  margin: 0 0 10px;
  font-size: 17px;
}

.cash-close-report .dashboard-insight-row {
  cursor: default;
}

.cash-close-products-table .cash-table {
  min-width: 760px;
}

.cash-close-payments-table .cash-table {
  min-width: 620px;
}

.cash-close-products-table td {
  vertical-align: top;
}

.cash-close-payments-table td {
  vertical-align: top;
}

.cash-close-products-table .money {
  color: var(--red);
  white-space: nowrap;
}

.cash-close-payments-table .money {
  color: var(--red);
  white-space: nowrap;
}

.cash-close-reminder {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 9000;
  width: min(420px, calc(100vw - 28px));
}

.cash-close-reminder-card {
  border: 1px solid rgba(242, 13, 13, 0.28);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-elevated);
}

.cash-close-reminder-card strong {
  display: block;
  color: var(--red);
  font-size: 20px;
  line-height: 1.1;
}

.cash-close-reminder-card p {
  margin: 8px 0 14px;
  color: var(--soft);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.cash-close-reminder-card div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.7fr);
  gap: 8px;
}

.print-label {
  position: relative;
  border: 0.35mm solid #111827 !important;
  padding: 3mm 3.2mm 2.7mm !important;
  box-shadow: inset 0 0 0 0.25mm #ffffff;
}

.preview-label {
  border-style: solid !important;
  border-color: #111827 !important;
}

@media (max-width: 860px) {
  .cash-month-head {
    display: grid;
    align-items: stretch;
  }

  .cash-month-head input {
    max-width: none;
    width: 100%;
  }

  .cash-list-grid {
    grid-template-columns: 1fr;
  }

  .inline-pay {
    grid-template-columns: 1fr;
  }

  .cash-daily-wrap .cash-table {
    min-width: 960px;
  }

  .cash-arqueo-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .cash-arqueo-sheet {
    grid-template-columns: minmax(0, 1fr);
  }

  .cash-close-report-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .cash-close-reminder {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
  }

  .cash-close-reminder-card div {
    grid-template-columns: minmax(0, 1fr);
  }
}

body {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(22, 131, 90, 0.075) 0 1px, transparent 1px 30px),
    linear-gradient(45deg, rgba(31, 102, 209, 0.055) 0 1px, transparent 1px 36px),
    linear-gradient(180deg, #ffffff 0%, #f7fafc 50%, #edf4f8 100%);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

h1,
h2,
h3,
.metric strong,
.module-card strong,
.brand-lockup small {
  font-family: Outfit, Inter, sans-serif;
}

.topbar,
.sidebar,
.panel,
.metric,
.login-panel,
.quick-search-card,
.confirm-modal {
  background: rgba(255, 255, 255, 0.75) !important;
  border: 1px solid rgba(255, 255, 255, 0.42) !important;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar {
  top: 10px;
  margin: 10px auto 0;
  width: min(calc(100% - 24px), 1480px);
  border-radius: 14px;
}

.sidebar {
  margin: 12px;
  border-radius: 14px;
}

.view.active {
  animation: viewSlideIn 300ms var(--motion-ease) both;
}

.metric {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 8px;
}

.metric svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--green);
}

.metric-products {
  box-shadow: 0 8px 30px rgba(31, 102, 209, 0.14), var(--shadow) !important;
}

.metric-units,
.metric.cash-main {
  box-shadow: 0 8px 30px rgba(36, 196, 126, 0.17), var(--shadow) !important;
}

.metric-low,
.metric.pending {
  box-shadow: 0 8px 30px rgba(200, 51, 46, 0.14), var(--shadow) !important;
}

.metric-low svg,
.metric.pending svg {
  color: var(--red);
}

.metric-photo {
  box-shadow: 0 8px 30px rgba(216, 155, 34, 0.18), var(--shadow) !important;
}

.metric-photo svg {
  color: var(--gold);
}

.metric:hover,
.module-card:hover,
.panel:hover {
  transform: translateY(-4px) scale(1.005);
  box-shadow: 0 28px 70px rgba(19, 32, 53, 0.16), inset 0 1px 0 rgba(255,255,255,.74) !important;
}

.btn.primary,
.btn.success {
  background: var(--success-gradient) !important;
  border-color: rgba(18, 128, 84, 0.42) !important;
  color: #ffffff !important;
}

.btn.primary::after,
.btn.success::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.28), transparent);
  transform: translateX(-120%);
  transition: transform 420ms var(--motion-ease);
}

.btn:hover::after {
  transform: translateX(120%);
}

.btn,
.nav-item,
.module-card,
.metric,
tr,
.smart-result,
.quick-product {
  position: relative;
  overflow: hidden;
  transition: all 0.2s var(--motion-ease) !important;
}

input,
select,
textarea {
  border: 1px solid rgba(23, 32, 51, 0.12) !important;
  border-left: 4px solid rgba(22, 131, 90, 0.46) !important;
  background: var(--field) !important;
  color: var(--ink) !important;
}

input:focus,
select:focus,
textarea:focus {
  background: #ffffff !important;
  border-color: var(--green) !important;
  box-shadow: 0 0 0 4px rgba(22, 131, 90, 0.18) !important;
}

.stock-cell {
  display: grid;
  gap: 4px;
  min-width: 96px;
}

.stock-cell strong {
  color: var(--ink);
}

.stock-cell small {
  color: var(--muted);
  font-weight: 800;
}

.stock-meter {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}

.stock-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--success-gradient);
}

.stock-cell.warning .stock-meter i {
  background: var(--warning-gradient);
}

.stock-cell.danger .stock-meter i {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  animation: pulseStock 1.2s ease-in-out infinite;
}

.stock-cell.neutral .stock-meter i {
  background: linear-gradient(135deg, #94a3b8, #64748b);
}

.product-photo-wrap {
  position: relative;
  display: inline-block;
}

.product-photo-wrap:hover .product-photo {
  transform: scale(1.85) translateY(-6px);
  box-shadow: 0 22px 54px rgba(17, 24, 39, 0.24);
  z-index: 8;
}

.product-photo-wrap:hover::after {
  content: attr(data-price) " · " attr(data-location);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 9;
  width: max-content;
  max-width: 220px;
  transform: translateX(-50%);
  border: 1px solid rgba(23, 32, 51, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(17, 24, 39, 0.18);
  font-size: 12px;
  font-weight: 900;
}

.smart-result mark,
.quick-product mark {
  border-radius: 4px;
  padding: 0 2px;
  background: rgba(36, 196, 126, 0.18);
  color: inherit;
  font-weight: 900;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 4px;
  border: 1px solid rgba(31, 102, 209, 0.18);
  border-radius: 999px;
  padding: 2px 8px;
  color: #114bb0;
  background: rgba(31, 102, 209, 0.08);
  font-size: 11px;
  font-weight: 900;
}

.group-badge {
  color: #114bb0;
  background: rgba(31, 102, 209, 0.08);
  border-color: rgba(31, 102, 209, 0.18);
}

.subgroup-badge {
  color: #116b48;
  background: rgba(22, 131, 90, 0.10);
  border-color: rgba(22, 131, 90, 0.20);
}

.product-tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.row-actions {
  display: grid;
  gap: 8px;
  min-width: 170px;
}

.product-photo-cell {
  display: grid;
  width: min-content;
  gap: 6px;
  justify-items: center;
}

.product-photo-edit-button {
  width: 100%;
  min-width: 92px;
  white-space: nowrap;
}

.row-category-note {
  display: block;
  max-width: 180px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.quick-category-label {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.category-quick-select {
  min-width: 160px;
  max-width: 220px;
  min-height: 38px;
  padding: 8px 28px 8px 10px;
  font-size: 12px;
  font-weight: 800;
}

.model-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: min(100%, 420px);
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid rgba(22, 131, 90, 0.2);
  border-radius: 999px;
  padding: 2px 8px;
  color: #116144;
  background: rgba(22, 131, 90, 0.08);
  font-size: 11px;
  font-weight: 900;
}

.check-row input[type="checkbox"] {
  appearance: none;
  position: relative;
  width: 48px !important;
  min-width: 48px;
  height: 28px;
  border: 0 !important;
  border-radius: 999px;
  padding: 0 !important;
  background: #cbd5e1 !important;
  box-shadow: inset 0 2px 6px rgba(15, 23, 42, 0.16);
  transition: all 200ms var(--motion-ease);
}

.check-row input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.22);
  transition: transform 220ms var(--motion-ease);
}

.check-row input[type="checkbox"]:checked {
  background: var(--success-gradient) !important;
}

.check-row input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}

.shimmer,
.shimmer-ready,
.empty-state:has(+ .shimmer-target) {
  background: linear-gradient(90deg, #f0f3f6 25%, #e1e5eb 50%, #f0f3f6 75%) !important;
  background-size: 200% 100% !important;
  animation: shimmerEffect 1.5s infinite;
}

.ripple {
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.42);
  transform: translate(-50%, -50%) scale(0);
  animation: rippleEffect 520ms var(--motion-ease);
}

.draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.draft-autosave {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(22, 131, 90, 0.18);
  border-radius: 999px;
  background: rgba(22, 131, 90, 0.08);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.draft-menu {
  position: relative;
}

.draft-menu summary {
  list-style: none;
}

.draft-list {
  position: absolute;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 8px;
  width: min(420px, 86vw);
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 24px 54px rgba(17, 24, 39, 0.18);
}

.draft-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.draft-item > button:first-child {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: #f8fbff;
  text-align: left;
}

.cost-history {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(31,102,209,.14);
  border-radius: 8px;
  padding: 10px;
  background: rgba(31,102,209,.05);
}

.money-pair {
  display: grid;
  gap: 2px;
}

.money-pair strong {
  color: var(--green);
  font-size: clamp(24px, 3vw, 34px);
}

.money-pair small {
  color: var(--muted);
  font-weight: 900;
}

.product-price-pair {
  display: grid;
  gap: 3px;
  min-width: 118px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.product-price-pair strong,
.product-price-pair small,
.product-price-pair em {
  display: grid;
  gap: 1px;
  justify-items: end;
  font-style: normal;
}

.product-price-pair strong {
  color: var(--green);
  font-size: 14px;
}

.product-price-pair small {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.product-price-pair em {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.product-price-pair span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.print-a4 {
  color: #111827;
  background: #ffffff;
  font-family: Inter, Arial, sans-serif;
}

@keyframes viewSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulseStock {
  0%, 100% { opacity: 1; }
  50% { opacity: .48; }
}

@keyframes shimmerEffect {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@keyframes rippleEffect {
  to { transform: translate(-50%, -50%) scale(18); opacity: 0; }
}

@media print {
  @page a4 {
    size: letter;
    margin: 14mm;
  }

  #printRoot[data-print-mode="a4"] {
    display: block !important;
    width: 100%;
  }

  #printRoot[data-print-mode="a4"] .print-a4 {
    page: a4;
    width: 100%;
    font-size: 12px;
  }

  .print-a4 header,
  .print-a4 footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 18px;
  }

  .print-a4 header img {
    width: 170px;
  }

  .print-a4 table {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse;
  }

  .print-a4 thead {
    display: table-header-group !important;
  }

  .print-a4 tbody {
    display: table-row-group !important;
  }

  .print-a4 tr {
    display: table-row !important;
    padding: 0;
    border: 0;
  }

  .print-a4 th,
  .print-a4 td {
    display: table-cell !important;
    border-bottom: 1px solid #d0d5dd;
    padding: 8px;
    text-align: left !important;
  }

  .print-a4 footer {
    margin-top: 18px;
    margin-bottom: 8px;
    font-size: 20px;
    font-weight: 900;
  }

  .print-a4 .a4-notice {
    margin: 10px 0 0;
    padding-top: 8px;
    border-top: 1px solid #d0d5dd;
    color: #667085;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
  }
}

@media (max-width: 860px) {
  .topbar {
    top: 0;
    width: 100%;
    margin: 0;
    border-radius: 0;
  }

  .sidebar {
    margin: 0;
    border-radius: 0;
  }

  .draft-actions {
    display: grid;
    justify-content: stretch;
  }

  .draft-list {
    position: static;
    width: 100%;
  }
}

@media print {
  @page label {
    size: 60mm 30mm;
    margin: 0;
  }

  #printRoot[data-print-mode="label"] {
    width: 60mm !important;
  }

  #printRoot[data-print-mode="label"] .print-label {
    page: label;
    width: 60mm !important;
    height: 30mm !important;
    border: 0.35mm solid #111827 !important;
    break-after: page;
    page-break-after: always;
  }
}

/* Final mobile fixes for document/list import controls. Keep this at the end so it wins over older theme blocks. */
@media (max-width: 860px) {
  .bulk-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
    align-items: stretch !important;
  }

  .bulk-actions > label,
  .bulk-actions > .btn {
    width: 100%;
    min-width: 0;
  }

  .bulk-actions textarea {
    min-height: 112px;
    resize: vertical;
  }

  .bulk-actions input[type="file"] {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    padding: 10px;
    font-size: 14px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .bulk-actions input[type="file"]::file-selector-button,
  .bulk-actions input[type="file"]::-webkit-file-upload-button {
    max-width: 62%;
    margin-right: 8px;
    border: 0;
    border-radius: 999px;
    padding: 8px 12px;
    color: var(--ink);
    background: #eef2f6;
    font-weight: 900;
  }

  .bulk-footer {
    justify-content: stretch;
  }

  .bulk-footer .btn {
    width: 100%;
  }
}

@media print {
  @page ticket {
    size: 80mm auto;
    margin: 4mm;
  }

  @page label {
    size: 60mm 30mm;
    margin: 0;
  }

  html,
  body {
    width: auto;
    min-height: 0;
    background: #ffffff !important;
  }

  #printRoot[data-print-mode="ticket"] {
    width: 80mm;
  }

  #printRoot[data-print-mode="label"] {
    width: 60mm;
  }

  .print-ticket {
    page: ticket;
  }

  .print-label {
    page: label;
    width: 60mm;
    height: 30mm;
    box-shadow: none;
    border: 0;
    break-after: page;
    page-break-after: always;
  }
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  min-height: 100%;
  margin: 0;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(26, 86, 232, 0.10) 0 1px, transparent 1px 26px),
    linear-gradient(45deg, rgba(232, 37, 26, 0.07) 0 1px, transparent 1px 32px),
    linear-gradient(180deg, #070b14 0%, var(--paper) 38%, #080d18 100%);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 16%, rgba(26, 86, 232, 0.22), transparent 28%),
    radial-gradient(circle at 88% 20%, rgba(232, 37, 26, 0.16), transparent 30%),
    linear-gradient(rgba(240, 244, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 244, 255, 0.018) 1px, transparent 1px);
  background-size: auto, auto, 52px 52px, 52px 52px;
  mask-image: linear-gradient(180deg, #000 0%, #000 72%, transparent 100%);
}

body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 60;
  pointer-events: none;
  background: linear-gradient(90deg, var(--red), var(--blue-2), var(--green), var(--red));
  background-size: 260% 100%;
  box-shadow: 0 0 24px rgba(47, 125, 255, 0.4);
  animation: motionTopScan 5.2s linear infinite;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* Los permisos deben prevalecer sobre cualquier display de navegacion. */
[hidden],
.permission-hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.login-panel,
.panel,
.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(240, 244, 255, 0.05), transparent 38%),
    rgba(15, 25, 41, 0.94);
  box-shadow: var(--shadow);
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 26px;
  border-top: 4px solid var(--blue);
  animation: motionPanelIn var(--motion-slow) var(--motion-ease) both;
}

.module-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.module-tab {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
  transition:
    transform var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    background var(--motion-fast) ease;
}

.module-tab span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.module-tab strong {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.15;
}

.module-tab:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 125, 255, 0.46);
  background: rgba(26, 86, 232, 0.18);
}

.module-tab.active {
  border-color: rgba(31, 102, 209, 0.35);
  background: rgba(31, 102, 209, 0.09);
}

.inventory-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 2px 0 10px;
}

.inventory-mode-tabs .module-tab {
  flex: 0 0 auto;
  width: auto;
  min-height: 0;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: min(190px, 52vw);
  height: auto;
  max-height: 72px;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.brand-logo.compact {
  width: 148px;
  max-height: 54px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 4px;
  color: var(--ink);
  background: #111a2c;
  font-weight: 900;
}

.brand-mark span {
  color: var(--red);
}

.brand-lockup small,
.muted,
.view-title span,
.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.login-panel h1,
.view-title h2 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
}

.stacked-form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  padding: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-left: 4px solid rgba(47, 125, 255, 0.62);
  border-radius: 6px;
  padding: 12px;
  color: var(--ink);
  background: var(--field);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 102, 209, 0.14);
}

.btn {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--ink);
  background: #2a3a55;
  font-weight: 900;
  transition:
    transform var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease,
    background var(--motion-fast) ease,
    border-color var(--motion-fast) ease;
}

.btn.primary {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.btn.success {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--soft);
}

.btn.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.form-error {
  min-height: 18px;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.form-success {
  min-height: 18px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  background: rgba(7, 11, 20, 0.94);
  backdrop-filter: blur(14px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(22, 131, 90, 0.22);
  border-radius: 999px;
  background: rgba(22, 131, 90, 0.08);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.app-status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(22, 131, 90, 0.12);
}

.app-status-pill.offline {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.12);
  color: #a16207;
}

.app-status-pill.update-ready {
  border-color: rgba(31, 102, 209, 0.28);
  background: rgba(31, 102, 209, 0.1);
  color: var(--blue);
}

.workspace {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: calc(100vh - 68px);
}

.sidebar {
  position: sticky;
  top: 68px;
  align-self: start;
  height: calc(100vh - 68px);
  padding: 14px;
  border-right: 1px solid var(--line);
  background: rgba(11, 17, 32, 0.76);
}

.nav-item {
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-weight: 900;
}

.nav-item:hover,
.nav-item.active {
  border-color: rgba(31, 102, 209, 0.24);
  color: var(--ink);
  background: rgba(26, 86, 232, 0.18);
  transform: translateX(2px);
}

.content {
  min-width: 0;
  padding: 22px;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
  min-width: 0;
  animation: motionViewIn var(--motion-mid) var(--motion-ease) both;
}

.view-title {
  display: grid;
  gap: 5px;
}

#products.view.active {
  gap: 8px;
}

#products .view-title {
  gap: 2px;
}

#products .view-title span {
  font-size: 10px;
}

#products .view-title h2 {
  font-size: clamp(26px, 2.7vw, 34px);
}

.products-toolbar,
.receiving-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  min-width: 0;
}

.products-toolbar .products-title,
.receiving-toolbar .receiving-title {
  flex: 0 0 auto;
}

.products-toolbar .product-subtabs,
.receiving-toolbar .inventory-mode-tabs {
  flex: 1 1 520px;
  margin: 0;
}

.receiving-toolbar {
  align-items: center;
}

.receiving-toolbar.embedded {
  margin-top: -2px;
}

.receiving-toolbar .embedded-section-head {
  margin-bottom: 0;
}

.receiving-toolbar .embedded-section-head h3 {
  font-size: 20px;
  line-height: 1;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.module-card {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  transition:
    transform var(--motion-mid) var(--motion-ease),
    border-color var(--motion-mid) ease,
    box-shadow var(--motion-mid) ease;
}

.module-card:hover,
.metric:hover,
.panel:hover {
  border-color: rgba(47, 125, 255, 0.36);
  transform: translateY(-2px);
}

.module-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.module-card strong {
  font-size: 22px;
}

.metric {
  padding: 16px;
}

.metric strong {
  display: block;
  margin-top: 7px;
  font-size: 32px;
}

.cash-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.28;
}

.metric.cash-main {
  border-color: rgba(22, 131, 90, 0.34);
  background: linear-gradient(180deg, #effaf4, #ffffff);
}

.metric.pending {
  border-color: rgba(200, 51, 46, 0.28);
  background: linear-gradient(180deg, #fff5f5, #ffffff);
}

.metric.pending strong {
  color: var(--red);
}

.dashboard-sales-metrics .metric {
  display: grid;
  gap: 6px;
  border-color: rgba(22, 131, 90, 0.22);
  background: linear-gradient(180deg, #f1faf7, #ffffff);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dashboard-sales-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-sales-metrics .metric-day,
.dashboard-sales-metrics .metric-month {
  border-color: rgba(255, 18, 18, 0.22);
}

.dashboard-sales-metrics .metric strong {
  margin-top: 0;
  color: var(--red);
  font-size: clamp(26px, 2.4vw, 42px);
  line-height: 1;
}

.dashboard-sales-metrics .metric small {
  margin-top: 0;
}

.dashboard-sales-metrics .metric:hover,
.dashboard-insight-row:hover {
  border-color: rgba(242, 13, 13, 0.34);
  transform: translateY(-2px);
}

.dashboard-detail-panel {
  display: grid;
  gap: 14px;
  border-color: rgba(242, 13, 13, 0.24);
  background: linear-gradient(180deg, #fffafa, #ffffff);
}

.dashboard-detail-panel .section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-day-summary-panel {
  display: grid;
  gap: 14px;
}

.dashboard-day-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-day-summary-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.dashboard-day-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 1000;
  text-transform: uppercase;
}

.dashboard-day-summary-card strong {
  display: block;
  margin-top: 6px;
  color: var(--red);
  font-size: clamp(22px, 2vw, 34px);
  line-height: 1;
}

.dashboard-day-summary-card small {
  display: block;
  margin-top: 8px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
}

.dashboard-day-summary-card.tone-cash {
  border-color: rgba(22, 131, 90, 0.28);
  background: linear-gradient(180deg, #effaf4, #ffffff);
}

.dashboard-day-summary-card.tone-bank {
  border-color: rgba(31, 102, 209, 0.24);
  background: linear-gradient(180deg, #f0f6ff, #ffffff);
}

.dashboard-day-summary-card.tone-digital {
  border-color: rgba(124, 58, 237, 0.20);
  background: linear-gradient(180deg, #f6f1ff, #ffffff);
}

.dashboard-day-summary-card.tone-credit,
.dashboard-day-summary-card.tone-exit {
  border-color: rgba(200, 51, 46, 0.22);
  background: linear-gradient(180deg, #fff7f7, #ffffff);
}

.dashboard-day-summary-table {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.dashboard-day-summary-table .compact-head {
  margin: 0;
}

.dashboard-day-summary-table h4,
.dashboard-documents-header h4 {
  margin: 0;
  font-size: 18px;
}

.dashboard-documents-panel {
  display: grid;
  gap: 12px;
}

.dashboard-documents-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.dashboard-documents-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.3;
  text-transform: none;
}

.dashboard-documents-header .btn {
  min-width: 142px;
}

.dashboard-documents-collapsed {
  border-color: rgba(31, 102, 209, 0.16);
  background: #f8fbff;
}

.dashboard-sales-detail-list {
  display: grid;
  gap: 14px;
}

.dashboard-sale-detail-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.dashboard-sale-detail-card h4 {
  margin: 0;
  font-size: 22px;
}

.dashboard-sale-detail-card .section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-sale-summary-grid,
.dashboard-sale-payment {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-sale-summary-grid span,
.dashboard-sale-payment span,
.dashboard-payment-parts {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
  color: var(--soft);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.dashboard-sale-summary-grid b,
.dashboard-sale-payment b,
.dashboard-payment-parts b {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 1000;
  text-transform: uppercase;
}

.dashboard-sale-summary-grid .wide,
.dashboard-sale-payment .wide {
  grid-column: 1 / -1;
}

.dashboard-payment-parts {
  display: grid;
  gap: 7px;
  background: rgba(22, 131, 90, 0.06);
}

.dashboard-payment-parts small {
  color: var(--soft);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-sale-items-table td {
  vertical-align: top;
}

.dashboard-sale-items-table .money {
  color: var(--red);
  white-space: nowrap;
}

.dashboard-sale-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 2px;
}

.dashboard-sale-actions .btn {
  min-height: 38px;
  min-width: 132px;
}

.dashboard-results-panel .section-head {
  gap: 10px;
}

.dashboard-results-panel .section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-range-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 22px;
}

.dashboard-analytics-block {
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.dashboard-analytics-block h4 {
  margin: 0 0 12px;
  font-size: 18px;
}

.dashboard-insight-list {
  display: grid;
  gap: 10px;
}

.dashboard-insight-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, auto);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  border: 0;
  padding: 10px 0 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  color: var(--ink);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease;
}

.dashboard-insight-row strong,
.dashboard-insight-row small,
.dashboard-insight-row span {
  position: relative;
  z-index: 1;
}

.dashboard-insight-row strong {
  display: block;
  line-height: 1.18;
}

.dashboard-insight-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-insight-row span {
  color: var(--red);
  font-weight: 1000;
  text-align: right;
  white-space: nowrap;
}

.dashboard-insight-row i {
  position: absolute;
  left: 0;
  right: auto;
  bottom: 0;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red), rgba(22, 131, 90, 0.75));
}

.dashboard-delivery-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.dashboard-delivery-split span {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-delivery-split b {
  color: var(--ink);
  font-size: 18px;
}

.section-divider-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dashboard-products-table td {
  vertical-align: top;
}

.dashboard-products-table .money {
  color: var(--red);
  white-space: nowrap;
}

.panel {
  min-width: 0;
  max-width: 100%;
  padding: 16px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.search-head {
  align-items: end;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.search-head input {
  max-width: 360px;
}

.section-actions input {
  min-width: 220px;
}

.section-actions select {
  min-width: 156px;
  max-width: 230px;
}

.sync-message {
  margin: 0 0 12px;
  padding: 10px 12px;
  color: var(--soft);
  background: rgba(22, 131, 90, 0.08);
  border: 1px solid rgba(22, 131, 90, 0.16);
  border-radius: var(--radius);
  font-weight: 800;
}

.list-limit-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  color: var(--soft);
  background: rgba(31, 102, 209, 0.08);
  border: 1px solid rgba(31, 102, 209, 0.14);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
}

.product-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.product-subtab {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.8);
  font-family: Outfit, Inter, sans-serif;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.product-subtab.active,
.product-subtab:hover {
  color: var(--green);
  border-color: rgba(22, 131, 90, 0.34);
  background: rgba(22, 131, 90, 0.1);
  box-shadow: 0 14px 30px rgba(22, 131, 90, 0.12);
  transform: translateY(-1px);
}

@media (max-width: 720px) {
  .products-toolbar .product-subtabs {
    flex: 1 1 100% !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    padding-bottom: 3px !important;
  }

  .products-toolbar .product-subtab {
    flex: 0 0 auto !important;
    white-space: nowrap;
  }
}

.quotation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
  align-items: start;
  min-height: calc(100dvh - 170px);
}

.quotation-search-panel,
.quotation-basket-panel {
  min-width: 0;
  max-height: calc(100dvh - 122px);
  overflow-y: auto;
  overscroll-behavior: auto;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.quotation-search-input {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
  font-weight: 800;
}

.quotation-filter-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.6fr) minmax(160px, 0.9fr) minmax(150px, 0.82fr) minmax(150px, 0.82fr) minmax(112px, auto);
  gap: 10px;
  margin-bottom: 12px;
  align-items: stretch;
}

.quotation-filter-row select,
.quotation-filter-row input,
.quotation-clear-button {
  width: 100%;
  min-height: 52px;
  margin: 0;
  font-size: 15px;
}

.quotation-clear-button {
  justify-content: center;
  white-space: nowrap;
}

.quotation-model-filter {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid rgba(22, 131, 90, 0.16);
  border-radius: 8px;
  background: rgba(22, 131, 90, 0.06);
}

.quotation-model-filter strong,
.quotation-model-filter span {
  display: block;
}

.quotation-model-filter strong {
  color: var(--ink);
  font-family: Outfit, Inter, sans-serif;
  font-size: 15px;
}

.quotation-model-filter span {
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.quotation-model-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quotation-model-chip {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.84);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.quotation-model-chip.active,
.quotation-model-chip:hover {
  color: #ffffff;
  border-color: var(--green);
  background: var(--green);
  box-shadow: 0 10px 22px rgba(22, 131, 90, 0.18);
}

.quotation-rate-line {
  margin-bottom: 14px;
}

.quotation-results {
  display: grid;
  gap: 10px;
  max-height: clamp(360px, calc(100dvh - 360px), 760px);
  overflow-y: auto;
  overscroll-behavior: auto;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

.quotation-result-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) minmax(120px, auto) 48px;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(15, 23, 42, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.quotation-result-card h4 {
  margin: 3px 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.quotation-result-card p,
.quotation-result-card small {
  display: block;
  margin: 0;
  color: var(--soft);
  font-weight: 800;
}

.quotation-price-box {
  display: grid;
  justify-items: end;
  gap: 3px;
  font-variant-numeric: tabular-nums;
}

.quotation-price-box span {
  color: var(--soft);
  font-size: 12px;
  font-weight: 900;
}

.quotation-price-box strong {
  color: var(--green);
  font-family: Outfit, Inter, sans-serif;
  font-size: 17px;
}

.quotation-price-box em {
  color: var(--ink);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.quotation-price-box em small,
.quotation-unit-label small,
.quotation-line-label small,
.quotation-total-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.quotation-bcv-label {
  display: inline-block;
  color: var(--green);
  font-weight: 900;
}

.quotation-add-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0 !important;
  border-radius: 999px !important;
  font-size: 24px;
  line-height: 1;
}

.quotation-basket-panel {
  position: sticky;
  top: 88px;
}

.quotation-basket-list {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.quotation-basket-item {
  display: grid;
  grid-template-columns: minmax(68px, 0.7fr) minmax(86px, 0.9fr) minmax(82px, auto);
  gap: 9px;
  align-items: end;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(22, 131, 90, 0.14);
  border-radius: 8px;
  background: rgba(22, 131, 90, 0.055);
}

.quotation-edit-fields {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
  min-width: 0;
}

.quotation-edit-fields label {
  margin: 0;
  gap: 5px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 900;
}

.quotation-edit-fields input {
  min-height: 38px;
  font-size: 13px;
  font-weight: 800;
}

.quotation-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.quotation-basket-item strong,
.quotation-basket-item span,
.quotation-basket-item small {
  display: block;
  overflow-wrap: anywhere;
}

.quotation-basket-item span,
.quotation-basket-item small {
  color: var(--soft);
  font-weight: 800;
}

.quotation-basket-item label {
  gap: 5px;
  margin: 0;
  color: var(--soft);
  font-size: 12px;
  font-weight: 900;
}

.quotation-basket-item input {
  min-height: 40px;
  text-align: center;
  width: 100%;
}

.quotation-basket-item > .btn {
  width: 100%;
  justify-content: center;
  align-self: end;
  min-height: 40px;
  padding-inline: 10px;
}

.quotation-basket-compact {
  gap: 6px;
}

.quotation-basket-item-compact {
  grid-template-columns: minmax(0, 1fr) 78px 76px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: #ffffff;
  border-color: rgba(17, 17, 17, 0.12);
}

.quotation-basket-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.quotation-basket-main strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.quotation-basket-main .quotation-meta-line,
.quotation-basket-main small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--soft);
  font-size: 11px;
  font-weight: 800;
}

.quotation-basket-main .quotation-meta-line {
  font-style: normal;
}

.quotation-basket-main > span {
  display: none;
}

.quotation-basket-item-compact .quotation-qty-compact {
  gap: 3px;
  color: var(--soft);
  font-size: 10px;
  text-transform: uppercase;
}

.quotation-basket-item-compact .quotation-qty-compact input {
  width: 68px;
  min-height: 34px;
  padding: 6px;
  text-align: center;
  font-size: 14px;
  font-weight: 900;
}

.quotation-basket-item-compact .quotation-remove-btn {
  width: 100%;
  min-height: 34px;
  padding-inline: 8px;
  font-size: 12px;
}

.quotation-total-compact {
  margin-top: 8px;
}

.quotation-total-card {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(22, 131, 90, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(22, 131, 90, 0.08), rgba(31, 102, 209, 0.06));
}

.quotation-total-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.quotation-total-card span {
  color: var(--soft);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.15;
  min-width: 0;
}

.quotation-total-card strong {
  color: var(--green);
  font-family: Outfit, Inter, sans-serif;
  font-size: clamp(18px, 4vw, 22px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  justify-self: end;
  white-space: nowrap;
}

.quotation-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.quotation-copy-button {
  width: 100%;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
}

.whatsapp-badge {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #ffffff;
  background: #22c55e;
  font-family: Outfit, Inter, sans-serif;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(34, 197, 94, 0.24);
}

.split-layout,
.scanner-grid {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.adjustment-search-grid {
  grid-template-columns: minmax(0, 1fr);
}

.adjustment-draft-box {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.adjustment-draft-box .section-head {
  padding-bottom: 0;
  border-bottom: 0;
}

.adjustment-draft-box .section-actions {
  flex-direction: row;
  justify-content: flex-end;
  width: auto;
}

.adjustment-draft-table {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.adjustment-draft-header,
.adjustment-draft-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(260px, 2fr) minmax(110px, 0.8fr) 112px 86px 120px 82px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.adjustment-draft-header {
  color: var(--muted);
  background: rgba(15, 23, 42, 0.04);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.adjustment-draft-row:last-child {
  border-bottom: 0;
}

.adjustment-draft-row strong,
.adjustment-draft-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.adjustment-draft-row input,
.adjustment-draft-row select {
  min-height: 40px;
  padding: 8px 10px;
}

.split-layout > *,
.scanner-grid > * {
  min-width: 0;
}

.product-readonly-layout {
  grid-template-columns: minmax(0, 1fr);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.delivery-charge-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 0.9fr);
  gap: 10px;
  align-items: end;
}

.delivery-paid-check {
  min-height: 54px;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid rgba(22, 131, 90, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(22, 131, 90, 0.06);
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.delivery-paid-check span {
  min-width: 0;
  line-height: 1.2;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

td span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.product-photo {
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: var(--field);
}

.product-photo.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.product-photo-zoom {
  cursor: zoom-in;
}

.product-photo-zoom:hover .product-photo {
  transform: none;
  box-shadow: 0 0 0 3px rgba(239, 23, 23, 0.14);
}

.product-photo-zoom:hover::after {
  display: none;
}

.product-image-manager {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f7f9fc;
}

.product-image-manager-head,
.product-image-link-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.product-image-manager-head strong,
.product-image-manager-head small {
  display: block;
}

.product-image-manager-head small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.product-image-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.product-image-slot {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: #ffffff;
}

.product-image-slot > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.product-image-slot-preview {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
}

.product-image-slot-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-image-slot-preview b {
  color: var(--muted);
  font-size: 12px;
}

.product-image-slot-status {
  display: block;
  min-height: 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.product-image-slot-status.processing {
  color: #9a6700;
}

.product-image-slot-status.ready {
  color: #087443;
}

.product-image-slot-status.error {
  color: #b42318;
}

.product-image-file-label {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: #ffffff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.product-image-file-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.product-image-remove {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  color: #b42318;
  font-size: 12px;
  font-weight: 800;
}

.product-image-remove input {
  width: 18px;
  height: 18px;
}

.product-image-loading {
  margin-top: 10px;
  color: var(--muted);
  font-weight: 800;
}

body.product-gallery-open {
  overflow: hidden;
}

.product-gallery-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10, 13, 19, 0.88);
}

.product-gallery-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: min(1120px, 100%);
  height: min(92vh, 920px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #ffffff;
}

.product-gallery-modal > header,
.product-gallery-modal > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.product-gallery-modal > footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.product-gallery-modal > header strong,
.product-gallery-modal > header span {
  display: block;
}

.product-gallery-modal > header span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.product-gallery-close {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: #ef1717;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.product-gallery-stage {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
  background: #f3f5f8;
}

.product-gallery-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-gallery-thumbnails {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: #ffffff;
}

.product-gallery-thumbnails button {
  width: 66px;
  height: 66px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 5px;
  padding: 2px;
  background: #ffffff;
  cursor: pointer;
}

.product-gallery-thumbnails button.active {
  border-color: #ef1717;
}

.product-gallery-thumbnails img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 720px) {
  .product-image-slots {
    grid-template-columns: 1fr;
  }

  .product-image-slot {
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: center;
  }

  .product-image-slot > span,
  .product-image-remove {
    grid-column: 1 / -1;
  }

  .product-image-slot-preview {
    width: 92px;
  }

  .product-gallery-overlay {
    padding: 0;
  }

  .product-gallery-modal {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .product-gallery-modal > footer {
    display: grid;
    grid-template-columns: 1fr;
  }
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 18px;
  color: var(--muted);
  background: var(--field);
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 6px;
  color: #fff;
  background: var(--green);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast[data-type="error"] {
  background: var(--red);
}

.scan-panel {
  position: relative;
  overflow: hidden;
  min-height: 420px;
  display: grid;
  align-content: end;
  background: #111827;
}

.scan-panel video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quagga-viewport {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
}

.scan-panel.quagga-mode > video {
  display: none;
}

.scan-panel.quagga-mode .quagga-viewport {
  display: block;
}

.quagga-viewport video,
.quagga-viewport canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

.scan-line {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  height: 2px;
  background: var(--red);
  box-shadow: 0 0 22px rgba(199, 51, 47, 0.5);
}

.scanner-status,
.scanner-actions {
  position: relative;
  z-index: 2;
}

.scanner-status {
  margin: 0 0 12px;
  padding: 9px 10px;
  border-radius: 6px;
  color: #fff;
  background: rgba(0, 0, 0, 0.52);
  font-weight: 900;
}

.scanner-actions {
  display: flex;
  gap: 10px;
}

.scan-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
}

.scan-card .product-photo {
  width: 74px;
  height: 74px;
}

.scan-card span {
  color: var(--blue);
  font-weight: 900;
}

.scan-card p {
  margin: 4px 0 8px;
  color: var(--muted);
}

.scan-duplicate-button {
  margin-top: 8px;
  width: fit-content;
}

.count-box {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(47, 125, 255, 0.32);
  border-radius: 6px;
  background: rgba(26, 86, 232, 0.1);
}

.photo-capture-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(22, 131, 90, 0.18);
  border-radius: 8px;
  background: #f4fbf7;
  color: var(--soft);
  font-weight: 900;
}

@keyframes motionFadeUp {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes motionPanelIn {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(.985);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes motionViewIn {
  from {
    opacity: 0;
    transform: translate3d(0, 10px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes motionTopScan {
  from { background-position: 0% 50%; }
  to { background-position: 260% 50%; }
}

@media (max-width: 860px) {
  body {
    overflow-x: hidden;
  }

  .login-panel {
    padding: 20px;
  }

  .module-switch {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .sidebar {
    position: static;
    top: 0;
    z-index: 18;
    height: auto;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-item {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    margin-bottom: 0;
  }

  .content {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    padding: 16px 12px calc(26px + env(safe-area-inset-bottom));
  }

  .metrics-grid,
  .module-grid,
  .split-layout,
  .scanner-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .section-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .section-actions input,
  .section-actions select,
  .section-actions .btn {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .search-head input {
    width: 100%;
    max-width: none;
  }

  .panel {
    padding: 14px;
    overflow: hidden;
  }

  .stacked-form,
  .form-grid,
  label,
  input,
  select,
  textarea,
  .btn {
    max-width: 100%;
  }

  .stacked-form > .btn,
  .count-box > .btn {
    width: 100%;
  }

  .inventory-mode-tabs {
    gap: 6px;
    margin-bottom: 8px;
  }

  .inventory-mode-tabs .module-tab {
    flex: 1 1 calc(50% - 6px);
    padding: 7px 8px;
    font-size: 12px;
  }

  .adjustment-draft-box .section-actions {
    width: 100%;
  }

  .adjustment-draft-header {
    display: none;
  }

  .adjustment-draft-row {
    grid-template-columns: minmax(0, 1fr) minmax(100px, 0.45fr);
    gap: 8px;
    padding: 10px;
  }

  .adjustment-draft-row > span:nth-child(2) {
    grid-column: 1 / -1;
  }

  .adjustment-draft-row input,
  .adjustment-draft-row select,
  .adjustment-draft-row .btn {
    width: 100%;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    padding: 12px 14px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .topbar-actions .btn {
    min-height: 38px;
    padding: 8px 11px;
  }

  .brand-logo.compact {
    width: 104px;
    max-height: 40px;
  }

  .view-title h2 {
    font-size: 30px;
    line-height: 1.05;
  }

  .table-wrap {
    overflow-x: visible;
  }

  table,
  tbody {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 7px 10px;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(19, 32, 57, 0.72);
  }

  td {
    min-width: 0;
    border: 0;
    padding: 0;
    overflow-wrap: anywhere;
  }

  td:first-child {
    grid-row: span 5;
  }

  td:nth-child(2) strong {
    font-size: 16px;
  }

  td:nth-child(3)::before {
    content: "Marca: ";
    color: var(--muted);
    font-weight: 900;
  }

  td:nth-child(4)::before {
    content: "Stock: ";
    color: var(--muted);
    font-weight: 900;
  }

  td:nth-child(5)::before {
    content: "Precio: ";
    color: var(--muted);
    font-weight: 900;
  }

  td:nth-child(n + 3) {
    grid-column: 2;
    color: var(--soft);
    font-size: 13px;
    text-align: left;
  }

  td:last-child {
    grid-column: 1 / -1;
    padding-top: 8px;
  }

  td:last-child .btn {
    width: 100%;
  }

  .scan-panel {
    min-height: min(64vh, 460px);
  }

  .scanner-actions {
    flex-wrap: wrap;
  }

  .brand-lockup small,
  #sessionLabel {
    display: none;
  }
}

body {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(22, 131, 90, 0.08) 0 1px, transparent 1px 28px),
    linear-gradient(45deg, rgba(31, 102, 209, 0.055) 0 1px, transparent 1px 34px),
    linear-gradient(180deg, #ffffff 0%, var(--paper) 48%, #eef4f8 100%);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

body::before {
  background:
    radial-gradient(circle at 12% 8%, rgba(22, 131, 90, 0.14), transparent 28%),
    radial-gradient(circle at 88% 16%, rgba(31, 102, 209, 0.10), transparent 32%),
    linear-gradient(rgba(23, 32, 51, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 51, 0.025) 1px, transparent 1px);
  background-size: auto, auto, 54px 54px, 54px 54px;
}

body::after {
  background: linear-gradient(90deg, var(--green), var(--blue-2), #f2b84b, var(--red));
  background-size: 260% 100%;
  box-shadow: 0 0 18px rgba(22, 131, 90, 0.22);
}

.app-shell {
  padding-top: env(safe-area-inset-top);
}

.login-panel,
.panel,
.metric,
.module-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.98)),
    var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.login-panel {
  border-top-color: var(--green);
}

.topbar {
  background: rgba(255, 255, 255, 0.94);
  border-bottom-color: var(--line);
  box-shadow: 0 10px 30px rgba(19, 32, 53, 0.08);
}

.sidebar {
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(14px);
}

.module-tab,
.btn.ghost {
  color: var(--ink);
  background: #ffffff;
}

.module-tab.active,
.module-tab:hover,
.nav-item:hover,
.nav-item.active {
  border-color: rgba(22, 131, 90, 0.28);
  color: var(--ink);
  background: rgba(22, 131, 90, 0.10);
}

.btn {
  color: var(--ink);
  background: #eef2f6;
  transition:
    transform var(--motion-mid) var(--motion-ease),
    box-shadow var(--motion-mid) var(--motion-ease),
    border-color var(--motion-mid) var(--motion-ease),
    background var(--motion-mid) var(--motion-ease),
    opacity var(--motion-mid) var(--motion-ease);
}

.btn.primary {
  border-color: var(--green);
  color: #ffffff;
  background: var(--green);
}

input,
select,
textarea {
  color: var(--ink);
  background: var(--field);
  border-left-color: rgba(22, 131, 90, 0.62);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 131, 90, 0.13);
}

.nav-item,
.module-card,
.metric,
.panel,
.smart-result {
  transition:
    transform var(--motion-mid) var(--motion-ease),
    box-shadow var(--motion-mid) var(--motion-ease),
    border-color var(--motion-mid) var(--motion-ease),
    background var(--motion-mid) var(--motion-ease),
    opacity var(--motion-mid) var(--motion-ease);
}

.view.active > * {
  animation: motionFadeUp 520ms var(--motion-ease) both;
}

.view.active > *:nth-child(2) {
  animation-delay: 45ms;
}

.view.active > *:nth-child(3) {
  animation-delay: 90ms;
}

.module-card:hover,
.metric:hover,
.panel:hover,
.smart-result:hover {
  border-color: rgba(22, 131, 90, 0.28);
  transform: translate3d(0, -2px, 0);
}

.module-card strong,
.metric strong,
.scan-card span {
  color: var(--green);
}

.brand-logo {
  background: #111827;
  box-shadow: 0 12px 28px rgba(19, 32, 53, 0.16);
}

.product-photo,
.empty-state,
.scan-card,
.count-box,
.sale-product-box,
.totals-box {
  background: #f8fbff;
}

.scan-panel {
  color: #ffffff;
  background: #111827;
}

.scanner-status {
  color: #ffffff;
  background: rgba(17, 24, 39, 0.72);
  backdrop-filter: blur(10px);
}

.scan-confirm {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(22, 131, 90, 0.92);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, -10px, 0) scale(0.96);
  transition:
    opacity 220ms var(--motion-ease),
    transform 220ms var(--motion-ease);
}

.scan-confirm.show {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.scan-confirm small {
  margin-left: auto;
  overflow: hidden;
  max-width: 46%;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.check-icon {
  position: relative;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #ffffff;
}

.check-icon::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  width: 9px;
  height: 14px;
  border-right: 3px solid var(--green);
  border-bottom: 3px solid var(--green);
  transform: rotate(42deg);
}

.sales-layout {
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.sale-product-box {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(22, 131, 90, 0.16);
  border-radius: 8px;
}

.compact-grid {
  grid-template-columns: 1.2fr 0.7fr 0.9fr auto;
  align-items: end;
}

.smart-results {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  overscroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
}

.smart-result {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
  transition: transform 160ms var(--motion-ease), border-color 160ms var(--motion-ease), box-shadow 160ms var(--motion-ease);
}

.smart-result:hover {
  transform: translateY(-1px);
  border-color: rgba(22, 131, 90, 0.32);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.smart-result .product-photo {
  width: 44px;
  height: 44px;
}

.smart-result span,
.smart-result em {
  min-width: 0;
  color: var(--muted);
  font-style: normal;
  line-height: 1.25;
  overflow-wrap: break-word;
  word-break: normal;
}

.smart-result em {
  grid-column: 2;
  display: block;
  margin-top: -4px;
}

.smart-result strong {
  display: block;
  color: var(--ink);
}

.totals-box {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.totals-box span {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--soft);
}

.totals-box .grand-total {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.bulk-actions {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.bulk-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(22, 131, 90, 0.18);
  border-radius: 8px;
  background: #f4fbf7;
}

.bulk-summary span,
.row-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bulk-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.bulk-table {
  min-width: 820px;
}

.bulk-table input,
.bulk-table select {
  min-height: 38px;
  padding: 8px 10px;
}

.bulk-table td {
  vertical-align: top;
}

.bulk-table td[data-label="Producto"] {
  min-width: 220px;
}

.bulk-table td[data-label="Coincidencia"] {
  min-width: 240px;
}

.bulk-table td[data-label="Accion"] {
  width: 88px;
}

.row-error {
  background: rgba(200, 51, 46, 0.08);
}

.compact-state {
  padding: 12px;
}

.bulk-footer {
  display: flex;
  justify-content: flex-end;
}

.print-label {
  grid-template-rows: auto minmax(0, 1fr) auto 8.8mm;
  gap: 0.8mm;
  padding: 3mm 3.2mm 2.8mm;
}

.label-barcode {
  height: 8.8mm;
}

.label-desc {
  font-size: 11.8px;
}

.label-code {
  font-size: 10.8px;
}

.focus-flash {
  animation: focusFlash 900ms var(--motion-ease) both;
}

#printRoot {
  display: none;
}

@keyframes focusFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(22, 131, 90, 0), var(--shadow);
  }
  35% {
    box-shadow: 0 0 0 5px rgba(22, 131, 90, 0.18), var(--shadow);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(22, 131, 90, 0), var(--shadow);
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding-top: 0;
  }

  .topbar {
    position: sticky;
    top: 0;
    padding-top: calc(12px + env(safe-area-inset-top));
    background: rgba(255, 255, 255, 0.96);
  }

  .sidebar {
    background: #ffffff;
  }

  .sales-layout,
  .compact-grid {
    grid-template-columns: 1fr;
  }

  .payment-split {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .payment-note {
    min-height: 0;
  }

  .table-actions {
    justify-content: stretch;
  }

  .table-actions .btn {
    flex: 1 1 120px;
  }

  tr {
    background: #ffffff;
  }

  td:nth-child(3)::before,
  td:nth-child(4)::before,
  td:nth-child(5)::before,
  td:nth-child(6)::before {
    content: none;
  }

  td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-weight: 900;
  }

  td[data-label="Foto"]::before,
  td[data-label="Accion"]::before {
    content: "";
  }

  td:nth-child(n + 3) {
    color: var(--soft);
  }

  .smart-result {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .smart-result em {
    grid-column: 2;
  }

  .scan-confirm {
    left: 12px;
    right: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media print {
  @page {
    size: 80mm auto;
    margin: 4mm;
  }

  html,
  body {
    width: 80mm;
    min-height: 0;
    color: #111827;
    background: #ffffff !important;
  }

  body::before,
  body::after,
  #loginScreen,
  #appShell {
    display: none !important;
  }

  #printRoot {
    display: block !important;
  }

  .print-ticket {
    width: 72mm;
    color: #111827;
    background: #ffffff;
    font-family: Arial, "Helvetica Neue", sans-serif;
    font-size: 11px;
    line-height: 1.22;
  }

  .ticket-heading {
    display: grid;
    gap: 3px;
    margin-bottom: 12px;
    text-align: right;
  }

  .ticket-heading strong {
    font-size: 15px;
  }

  .ticket-client {
    display: grid;
    gap: 2px;
    margin-bottom: 8px;
  }

  .ticket-row,
  .ticket-item,
  .ticket-totals span {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22mm;
    gap: 6px;
    align-items: start;
  }

  .ticket-head {
    padding: 3px 0;
    border-top: 1px solid #111827;
    border-bottom: 1px solid #111827;
    text-decoration: underline;
  }

  .ticket-lines {
    display: grid;
    gap: 5px;
    padding: 6px 0 8px;
    border-bottom: 1px solid #111827;
  }

  .ticket-item span,
  .ticket-item small {
    display: block;
  }

  .ticket-item > strong,
  .ticket-totals strong {
    text-align: right;
  }

  .ticket-totals {
    display: grid;
    gap: 3px;
    padding-top: 6px;
    font-weight: 700;
  }

  .ticket-grand {
    font-size: 16px;
    font-weight: 900;
  }

  .ticket-notice {
    margin-top: 7px;
    padding-top: 5px;
    border-top: 1px solid #111827;
    color: #111827;
    font-size: 8px;
    line-height: 1.18;
    font-weight: 700;
    text-align: center;
  }
}

/* Sales step-by-step wizard and confirmation modal */
.sale-steps-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  background: var(--surface);
  padding: 14px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.step-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease);
}
.step-indicator.active {
  opacity: 1;
  transform: translateY(-1px);
}
.step-indicator.completed {
  opacity: 0.85;
}
.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  transition: all var(--motion-fast) var(--motion-ease);
}
.step-indicator.active .step-number {
  background: var(--green);
  color: #ffffff;
}
.step-indicator.completed .step-number {
  background: var(--surface-2);
  color: var(--green);
  border: 2px solid var(--green);
  font-size: 0;
}
.step-indicator.completed .step-number::after {
  content: "✓";
  font-size: 15px;
  line-height: 1;
}
.step-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--muted);
  transition: color var(--motion-fast) var(--motion-ease);
}
.step-indicator.active .step-label {
  color: var(--green);
}
.step-indicator.completed .step-label {
  color: var(--ink);
}
.step-connector {
  flex: 1;
  height: 2px;
  background: var(--line);
  margin: 0 16px;
  transition: background var(--motion-mid) var(--motion-ease);
}
.step-indicator.completed + .step-connector {
  background: var(--green);
}

.step-content {
  display: none;
}
.step-content.active {
  display: block;
  animation: stepFadeIn 300ms cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: opacity, transform;
}

@keyframes stepFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sale-recovery-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid rgba(22, 131, 90, 0.22);
  border-radius: var(--radius);
  background: rgba(236, 253, 245, 0.9);
  box-shadow: 0 12px 28px rgba(16, 185, 129, 0.12);
}

.sale-recovery-banner strong {
  display: block;
  color: var(--green);
  font-weight: 900;
}

.sale-recovery-banner span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 700;
}

.sale-recovery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.step-actions .btn {
  margin: 0;
}

/* Shake animation for validation feedback */
.shake-animation {
  animation: shakeEffect 0.4s var(--motion-ease) both;
}
.validation-danger {
  border-color: rgba(239, 68, 68, 0.8) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}
@keyframes shakeEffect {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Confirmation Modal */
.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(11, 17, 32, 0.45);
  backdrop-filter: blur(8px);
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-mid) var(--motion-ease);
}
.confirm-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.confirm-modal-card {
  width: min(720px, 100%);
  max-height: min(90vh, 800px);
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--motion-mid) var(--motion-ease);
}
.confirm-modal-overlay.active .confirm-modal-card {
  transform: scale(1) translateY(0);
}
.confirm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.confirm-modal-header h3 {
  margin: 0;
  color: var(--green);
  font-size: 18px;
  font-weight: 900;
}
.confirm-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: color var(--motion-fast) var(--motion-ease);
}
.confirm-modal-close:hover {
  color: var(--red);
}
.confirm-modal-body {
  padding: 24px;
  overflow-y: auto;
  display: grid;
  gap: 20px;
  -webkit-overflow-scrolling: touch;
}
.confirm-section {
  display: grid;
  gap: 10px;
}
.confirm-section-title {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
.confirm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.confirm-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.confirm-field label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  margin: 0;
}
.confirm-field span {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.confirm-item-desc {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: normal;
  margin-top: 2px;
}
.compact-confirm-table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.compact-confirm-table table {
  margin: 0;
  width: 100%;
}
.compact-confirm-table th,
.compact-confirm-table td {
  padding: 8px 12px;
}
.confirm-totals-summary {
  display: grid;
  justify-content: end;
  gap: 6px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.confirm-totals-row {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  font-size: 13px;
  color: var(--soft);
}
.confirm-totals-row.grand-total-row {
  font-size: 16px;
  color: var(--green);
  font-weight: 900;
}
.confirm-payment-split-details {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  border: 1px solid var(--line);
}
.confirm-modal-footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}
.confirm-modal-footer .btn {
  margin: 0;
  min-width: 130px;
}

.confirm-modal-footer .confirm-copy-image-btn {
  min-width: 220px;
}

.confirm-delay-btn {
  opacity: 0.82;
  cursor: wait;
}

.mini-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 999px;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 860px) {
  .sale-recovery-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .sale-recovery-actions,
  .sale-recovery-actions .btn {
    width: 100%;
  }

  .sale-steps-indicator {
    padding: 10px 12px;
  }
  .step-label {
    display: none;
  }
  .step-connector {
    margin: 0 8px;
  }
  .confirm-modal-card {
    max-height: 95vh;
  }
  .confirm-modal-body {
    padding: 16px;
  }
  .confirm-modal-footer {
    padding: 12px 16px;
  }

  .confirm-modal-footer .btn {
    width: 100%;
    min-width: 0;
  }
}

/* Ventas: guardrail final para PC Windows, zoom alto y pantallas medianas. */
.sales-layout {
  grid-template-columns: minmax(520px, 0.92fr) minmax(520px, 1.08fr);
}

.sales-layout > * {
  min-width: 0;
}

.sale-history-head {
  align-items: start;
}

.sale-history-filters {
  display: grid;
  grid-template-columns: minmax(130px, 0.75fr) minmax(130px, 0.75fr) minmax(240px, 1.5fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.sale-history-filters > *,
.sale-history-filters input,
.sale-history-filters .btn {
  min-width: 0;
  width: 100%;
}

.sale-history-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.sale-history-summary span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(31, 102, 209, 0.06);
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.warning-text {
  color: #9a5b00 !important;
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.28) !important;
}

.sales-history-table {
  min-width: 960px;
}

.sales-history-table td {
  vertical-align: top;
}

.sales-history-table td[data-label="Cliente"] {
  min-width: 230px;
}

.sales-history-table td[data-label="Accion"] {
  min-width: 190px;
}

.sales-history-table .table-actions {
  justify-content: flex-start;
}

.sales-history-list {
  display: grid;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.sales-history-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, auto);
  gap: 12px;
  align-items: stretch;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.sales-history-main {
  display: grid;
  grid-template-columns: 52px minmax(220px, 1.35fr) minmax(210px, 1fr) minmax(120px, auto);
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.sales-history-number small,
.sales-history-meta b {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.sales-history-number strong {
  color: var(--ink);
  font-size: 18px;
  font-family: Outfit, Inter, sans-serif;
}

.sales-history-client,
.sales-history-meta,
.sales-history-state {
  min-width: 0;
}

.sales-history-client > strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.sales-history-meta {
  display: grid;
  gap: 7px;
  color: var(--soft);
  font-size: 13px;
  font-weight: 800;
}

.sales-history-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sales-history-state {
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 8px;
}

.sales-history-actions {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 170px;
}

.sales-history-actions .btn {
  width: 100%;
  min-height: 38px;
  justify-content: center;
  white-space: normal;
}

.sales-history-actions .primary-action {
  order: -1;
  box-shadow: 0 10px 24px rgba(22, 131, 90, 0.18);
}

@media (max-width: 1500px) {
  .sales-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1180px) {
  .sale-history-filters,
  .compact-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .sale-history-search,
  .sale-history-filters .btn {
    grid-column: 1 / -1;
  }

  .sales-history-card,
  .sales-history-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-history-actions {
    display: flex;
    flex-wrap: wrap;
    min-width: 0;
  }

  .sales-history-actions .btn {
    width: auto;
    flex: 1 1 150px;
  }
}

@media (max-width: 860px) {
  .sale-history-filters,
  .compact-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .sales-history-table {
    min-width: 0;
  }

  .sales-history-card {
    padding: 10px;
  }

  .sales-history-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-history-actions .btn {
    width: 100%;
    flex-basis: auto;
  }
}

/* Final visual authority for inventory premium mode. */
body {
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif !important;
  color: var(--ink) !important;
  background:
    linear-gradient(135deg, rgba(22, 131, 90, 0.075) 0 1px, transparent 1px 30px),
    linear-gradient(45deg, rgba(31, 102, 209, 0.055) 0 1px, transparent 1px 36px),
    linear-gradient(180deg, #ffffff 0%, #f7fafc 50%, #edf4f8 100%) !important;
}

h1,
h2,
h3,
.metric strong,
.module-card strong,
.brand-lockup small {
  font-family: Outfit, Inter, sans-serif !important;
}

.topbar,
.sidebar,
.panel,
.metric,
.login-panel,
.quick-search-card,
.confirm-modal {
  background: rgba(255, 255, 255, 0.76) !important;
  border-color: rgba(255, 255, 255, 0.44) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
}

/* Inventario visual polish: compact mobile chrome + safer sales workspace */
@media (min-width: 1181px) and (max-width: 1720px) {
  .sales-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 860px) {
  .topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 40 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
    min-height: 0 !important;
    padding: calc(7px + env(safe-area-inset-top)) 10px 8px !important;
    border-radius: 0 !important;
    background: rgba(255, 255, 255, 0.96) !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08) !important;
  }

  .topbar .brand-lockup {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-height: 34px !important;
  }

  .topbar .brand-logo.compact {
    width: 92px !important;
    max-height: 34px !important;
    object-fit: contain !important;
  }

  .topbar .brand-lockup small {
    font-size: 12px !important;
  }

  .topbar-actions {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 7px !important;
    align-items: center !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    padding-bottom: 2px !important;
    scrollbar-width: none !important;
  }

  .topbar-actions::-webkit-scrollbar,
  .sidebar::-webkit-scrollbar,
  .cash-tabs::-webkit-scrollbar {
    display: none !important;
  }

  .topbar-actions > *,
  .topbar-actions .btn {
    flex: 0 0 auto !important;
    width: auto !important;
    min-height: 36px !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
  }

  #sessionLabel {
    display: none !important;
  }

  .sidebar {
    position: sticky !important;
    top: 84px !important;
    z-index: 30 !important;
    padding: 8px 10px !important;
    gap: 7px !important;
    scroll-snap-type: x proximity !important;
    background: rgba(255, 255, 255, 0.96) !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06) !important;
  }

  .nav-item,
  .cash-tab {
    scroll-snap-align: center !important;
    min-height: 38px !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
  }

  .content {
    padding-top: 12px !important;
  }

  .view-title {
    margin-bottom: 12px !important;
  }

  .view-title h2 {
    font-size: 28px !important;
  }
}

/* Premium interaction layer: native dark mode, touch feedback, scanner guide and skeleton loaders. */
.card,
.product-card,
.metric,
.module-card,
.panel {
  transition:
    transform var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease),
    border-color var(--motion-fast) var(--motion-ease),
    background-color var(--motion-fast) var(--motion-ease);
}

.card:hover,
.product-card:hover,
.metric:hover,
.module-card:hover {
  transform: translate3d(0, -5px, 18px) rotateX(1deg);
  box-shadow: var(--shadow-elevated);
}

.btn,
button,
input,
select,
textarea {
  transition:
    transform var(--motion-fast) var(--motion-ease),
    border-color var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease),
    background-color var(--motion-fast) var(--motion-ease);
}

.btn:active,
button:active {
  transform: scale(0.96);
}

input:active,
select:active,
textarea:active {
  transform: scale(0.99);
}

input,
select,
textarea {
  background: var(--field);
  color: var(--ink);
  border-color: var(--line);
}

input:focus,
select:focus,
textarea:focus {
  background: var(--surface);
  border-color: var(--green);
  box-shadow: 0 0 0 4px hsl(var(--h-green) / 0.16);
}

@media (max-width: 900px), (pointer: coarse) {
  .topbar,
  .sidebar,
  .panel,
  .metric,
  .login-panel,
  .quick-search-card,
  .confirm-modal {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .card:hover,
  .product-card:hover,
  .metric:hover,
  .module-card:hover,
  .panel:hover {
    transform: none !important;
  }

  .btn,
  button,
  input,
  select,
  textarea,
  .panel,
  .metric,
  .nav-item,
  .product-subtab,
  .quotation-result-card,
  .quotation-basket-item {
    transition-duration: 120ms !important;
  }
}

.scanner-target-box,
.scanner-overlay-laser {
  pointer-events: none;
}

.scanner-target-box {
  position: absolute;
  z-index: 3;
  left: 9%;
  right: 9%;
  top: 25%;
  bottom: 25%;
  border: 2px solid hsl(var(--h-green) / 0.88);
  border-radius: 18px;
  box-shadow:
    0 0 0 999px rgba(2, 6, 23, 0.34),
    inset 0 0 28px hsl(var(--h-green) / 0.14),
    0 18px 44px rgba(0, 0, 0, 0.22);
}

.scanner-target-box::before,
.scanner-target-box::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  border-color: #fff;
  border-style: solid;
  filter: drop-shadow(0 0 8px hsl(var(--h-green) / 0.7));
}

.scanner-target-box::before {
  left: -2px;
  top: -2px;
  border-width: 4px 0 0 4px;
  border-radius: 16px 0 0 0;
}

.scanner-target-box::after {
  right: -2px;
  bottom: -2px;
  border-width: 0 4px 4px 0;
  border-radius: 0 0 16px 0;
}

.scanner-overlay-laser {
  position: absolute;
  z-index: 4;
  left: 13%;
  right: 13%;
  top: 50%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #ff3030 18%, #fff 50%, #ff3030 82%, transparent);
  box-shadow:
    0 0 12px rgba(255, 48, 48, 0.92),
    0 0 28px rgba(255, 48, 48, 0.52);
  animation: scannerLaserSweep 1.45s ease-in-out infinite alternate;
}

.scanner-status,
.scanner-actions,
.scan-confirm {
  z-index: 5;
}

.scanner-actions {
  position: relative;
}

.scan-line {
  opacity: 0;
}

@keyframes scannerLaserSweep {
  from { transform: translate3d(0, -72px, 0); }
  to { transform: translate3d(0, 72px, 0); }
}

.skeleton-table,
.skeleton-list {
  display: grid;
  gap: 12px;
}

.skeleton-row {
  display: grid;
  grid-template-columns: 72px minmax(120px, 1.5fr) minmax(90px, 1fr) minmax(80px, 0.8fr);
  gap: 14px;
  align-items: center;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: hsl(var(--h-surface) / 0.72);
}

.skeleton-list .skeleton-row {
  grid-template-columns: 52px 1fr 120px;
}

.skeleton-bar {
  display: block;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(var(--h-muted) / 0.12), hsl(var(--h-muted) / 0.24), hsl(var(--h-muted) / 0.12));
  background-size: 220% 100%;
  animation: shimmerEffect 1.2s linear infinite;
}

.skeleton-bar.thumb {
  width: 52px;
  height: 42px;
  border-radius: 10px;
}

.skeleton-bar.short { width: 58%; }
.skeleton-bar.tiny { width: 34%; }

/* Inventario restore: visual authority for the original light inventory palette. */
:root {
  color-scheme: light;
}

html {
  background: #f8fafc !important;
}

body {
  color: var(--ink) !important;
  background:
    linear-gradient(135deg, rgba(22, 131, 90, 0.08) 0 1px, transparent 1px 28px),
    linear-gradient(45deg, rgba(31, 102, 209, 0.055) 0 1px, transparent 1px 34px),
    linear-gradient(180deg, #ffffff 0%, var(--paper) 48%, #eef4f8 100%) !important;
}

body::before {
  background:
    radial-gradient(circle at 12% 8%, rgba(22, 131, 90, 0.14), transparent 28%),
    radial-gradient(circle at 88% 16%, rgba(31, 102, 209, 0.10), transparent 32%),
    linear-gradient(rgba(23, 32, 51, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 51, 0.025) 1px, transparent 1px) !important;
  background-size: auto, auto, 54px 54px, 54px 54px !important;
}

body::after {
  background: linear-gradient(90deg, var(--green), var(--blue-2), #f2b84b, var(--red)) !important;
  box-shadow: 0 0 18px rgba(22, 131, 90, 0.22) !important;
}

.topbar {
  background: rgba(255, 255, 255, 0.94) !important;
  border-color: var(--line) !important;
  box-shadow: 0 10px 30px rgba(19, 32, 53, 0.08) !important;
}

.sidebar {
  background: rgba(255, 255, 255, 0.74) !important;
  border-color: var(--line) !important;
  box-shadow: none !important;
}

.login-panel,
.panel,
.metric,
.module-card,
.quick-search-card,
.confirm-modal,
.table-wrap,
.bulk-table-wrap,
.sale-product-box,
.totals-box {
  color: var(--ink) !important;
  border-color: var(--line) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.98)),
    var(--surface) !important;
  box-shadow: var(--shadow) !important;
}

.login-panel {
  border-top-color: var(--green) !important;
}

.module-tab,
.btn.ghost,
.smart-result,
.quick-product,
.search-panel,
.empty-state,
.product-photo,
tr {
  color: var(--ink) !important;
  background: #ffffff !important;
  border-color: var(--line) !important;
}

.nav-item {
  color: var(--soft) !important;
  background: transparent !important;
}

/* Buscador global a pantalla completa, optimizado para comparar repuestos. */
.quick-search-panel {
  place-items: stretch !important;
  padding: 0 !important;
  background: #f3f6f8 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.quick-search-card {
  width: 100% !important;
  max-width: none !important;
  height: 100dvh !important;
  display: grid !important;
  grid-template-rows: auto auto minmax(0, 1fr) !important;
  gap: 12px !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(14px + env(safe-area-inset-bottom)) !important;
  background: #ffffff !important;
  box-shadow: none !important;
}

.quick-search-card .section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
}

.quick-search-card h3 {
  font-size: 18px;
  line-height: 1.1;
}

.quick-search-card input {
  min-height: 46px;
  font-size: 16px;
  font-weight: 700;
}

.quick-search-results {
  display: grid !important;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 8px !important;
  max-height: none !important;
  min-height: 0;
  overflow: auto !important;
  padding-right: 4px;
}

.quick-results-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.quick-product-header,
.quick-product {
  display: grid !important;
  grid-template-columns:
    minmax(96px, 0.78fr)
    minmax(96px, 0.78fr)
    minmax(260px, 2.35fr)
    minmax(104px, 0.82fr)
    minmax(88px, 0.64fr)
    minmax(112px, 0.78fr)
    minmax(124px, 0.86fr) !important;
  gap: 8px !important;
}

.quick-product-header {
  position: sticky;
  top: 0;
  z-index: 1;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.quick-product {
  align-items: stretch !important;
  min-height: 74px;
  padding: 10px !important;
  overflow: visible !important;
}

.quick-product > span {
  display: grid;
  align-content: start;
  gap: 3px;
  min-width: 0;
  color: var(--ink);
}

.quick-product small {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.quick-product strong {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.quick-description strong {
  font-size: 14px;
}

.quick-product em {
  min-width: 0;
  color: var(--soft) !important;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

.quick-price strong {
  color: var(--green);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.quick-price-bcv strong {
  color: #114bb0;
}

.quick-stock strong {
  font-size: 14px;
}

@media (max-width: 980px) {
  .quick-product-header {
    display: none !important;
  }

  .quick-product {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    min-height: 0;
  }

  .quick-description,
  .quick-brand {
    grid-column: 1 / -1;
  }
}

/* Consignacion: propiedad, liquidacion semanal y acceso del proveedor. */
.consignment-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #e6b94a;
  border-radius: 999px;
  color: #6a4700;
  background: #fff7d6;
  font-weight: 900;
}

.consignment-product-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
  border: 1px solid #e6b94a;
  border-radius: 8px;
  background: #fffaf0;
}

.consignment-product-fields label:last-child {
  grid-column: 1 / -1;
}

.product-filter-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.consignment-inline {
  display: block;
  width: fit-content;
  margin-top: 4px;
  padding: 2px 6px;
  border: 1px solid #f2b8b8;
  border-radius: 4px;
  color: #9b1c1c !important;
  background: #fff1f1;
  font-size: 10px !important;
  font-style: normal !important;
  font-weight: 800;
  line-height: 1.25;
}

.consignment-toolbar {
  align-items: end;
}

.consignment-period-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(145px, auto));
  gap: 8px;
  align-items: end;
  margin-left: auto;
}

.consignment-period-controls label {
  display: grid;
  gap: 4px;
  color: var(--soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.consignment-summary-sheet {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 0 !important;
  overflow: hidden;
}

.consignment-summary-sheet > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-right: 1px solid var(--line);
}

.consignment-summary-sheet > div:last-child {
  border-right: 0;
}

.consignment-summary-sheet span,
.consignment-supplier-summary small {
  color: var(--soft);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.consignment-summary-sheet strong {
  color: var(--red);
  font-size: 20px;
}

.consignment-supplier-list {
  display: grid;
  gap: 8px;
}

.consignment-supplier-panel {
  padding: 0 !important;
  overflow: hidden;
}

.consignment-supplier-summary {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) repeat(3, minmax(120px, 0.8fr)) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 0;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.consignment-supplier-summary > span:not(.consignment-status) {
  display: grid;
  gap: 3px;
}

.consignment-status {
  padding: 5px 8px;
  border-radius: 999px;
  color: #73510a;
  background: #fff4cf;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.consignment-status.pagada {
  color: #12623c;
  background: #e7f8ef;
}

.consignment-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.consignment-detail-grid h4 {
  margin: 0 0 7px;
}

.consignment-table-wrap {
  max-height: 320px;
}

.consignment-totals-line,
.consignment-payment-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.consignment-totals-line span {
  display: flex;
  justify-content: space-between;
}

.consignment-payment-form {
  grid-template-columns: repeat(4, minmax(130px, 1fr)) auto;
  align-items: end;
  background: #fffaf0;
}

.consignment-payment-form label {
  display: grid;
  gap: 4px;
}

@media (max-width: 900px) {
  .product-filter-strip,
  .consignment-period-controls,
  .consignment-summary-sheet,
  .consignment-detail-grid,
  .consignment-payment-form {
    grid-template-columns: 1fr 1fr;
  }

  .consignment-supplier-summary {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .consignment-product-fields,
  .product-filter-strip,
  .consignment-period-controls,
  .consignment-summary-sheet,
  .consignment-detail-grid,
  .consignment-totals-line,
  .consignment-payment-form,
  .consignment-supplier-summary {
    grid-template-columns: 1fr;
  }

  .consignment-summary-sheet > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

/* Cotizador WhatsApp: resultados amplios tipo tabla para elegir sin confundir SKU/referencia. */
.quotation-layout {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 10px !important;
  min-height: calc(100dvh - 134px) !important;
}

.quotation-search-panel,
.quotation-basket-panel {
  max-height: none !important;
  overflow: visible !important;
}

.quotation-basket-panel {
  position: static !important;
}

.quotation-results {
  display: grid !important;
  grid-auto-rows: max-content;
  gap: 6px !important;
  max-height: min(70dvh, 780px) !important;
  overflow: auto !important;
  padding-right: 4px;
}

.quotation-result-header,
.quotation-result-card {
  display: grid !important;
  grid-template-columns:
    minmax(74px, 0.58fr)
    minmax(86px, 0.62fr)
    minmax(220px, 1.82fr)
    minmax(88px, 0.62fr)
    minmax(126px, 0.9fr)
    minmax(76px, 0.52fr)
    minmax(96px, 0.62fr)
    minmax(108px, 0.68fr)
    68px
    40px !important;
  gap: 6px !important;
  min-width: 1050px;
}

.quotation-result-header {
  position: sticky;
  top: 0;
  z-index: 2;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.quotation-result-card {
  align-items: stretch !important;
  min-height: 68px;
  padding: 8px !important;
  overflow: visible !important;
}

.quotation-cell {
  display: grid;
  align-content: start;
  gap: 3px;
  min-width: 0;
}

.quotation-cell small {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.quotation-cell strong {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.quotation-description strong {
  font-size: 13px;
}

.quotation-cell em {
  min-width: 0;
  color: var(--soft) !important;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

.quotation-price strong {
  color: var(--green);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.quotation-price-bcv strong {
  color: #114bb0;
}

.quotation-result-card .quotation-add-btn {
  align-self: center;
  justify-self: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0 !important;
  border-radius: 999px !important;
  font-size: 17px;
}

.quotation-add-quantity {
  display: grid;
  align-self: center;
  justify-items: center;
  gap: 3px;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.quotation-add-quantity input {
  width: 68px;
  min-height: 34px;
  margin: 0;
  padding: 4px 6px !important;
  border-left-width: 1px !important;
  text-align: center;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.native-quantity-field input[type="number"] {
  appearance: auto;
  -moz-appearance: auto;
}

.native-quantity-field input[type="number"]::-webkit-outer-spin-button,
.native-quantity-field input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  opacity: 1;
}

.quotation-external-form {
  display: grid;
  gap: 9px;
  margin: 0 0 12px;
  padding: 11px;
  border: 1px solid rgba(17, 75, 176, 0.18);
  border-radius: 8px;
  background: rgba(17, 75, 176, 0.055);
}

.quotation-external-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.quotation-external-head strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.quotation-external-head small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-align: right;
}

.quotation-external-grid {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) minmax(110px, 0.9fr) 72px 104px minmax(136px, auto);
  gap: 8px;
  align-items: end;
}

.quotation-external-grid label {
  margin: 0;
  gap: 4px;
  color: var(--soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.quotation-external-grid input {
  width: 100%;
  min-height: 38px;
  margin: 0;
  border-left-width: 1px !important;
  font-size: 13px;
  font-weight: 800;
}

.quotation-external-add {
  min-height: 38px;
  padding: 8px 10px !important;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .quotation-result-header {
    display: none !important;
  }

  .quotation-result-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    min-width: 0;
    min-height: 0;
  }

  .quotation-description,
  .quotation-brand,
  .quotation-models {
    grid-column: 1 / -1;
  }

  .quotation-result-card .quotation-add-btn {
    grid-column: auto;
    width: 100%;
    border-radius: 8px !important;
  }

  .quotation-add-quantity {
    align-self: stretch;
    justify-items: stretch;
  }

  .quotation-add-quantity input {
    width: 100%;
    min-height: 42px;
  }

  .quotation-external-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .quotation-external-add {
    grid-column: 1 / -1;
    width: 100%;
  }
}

.module-tab.active,
.module-tab:hover,
.nav-item:hover,
.nav-item.active {
  color: var(--ink) !important;
  border-color: rgba(22, 131, 90, 0.28) !important;
  background: rgba(22, 131, 90, 0.10) !important;
}

.btn {
  color: var(--ink) !important;
  background: #eef2f6 !important;
  border-color: var(--line) !important;
}

.btn.primary,
.btn.success {
  color: #ffffff !important;
  background: var(--green) !important;
  border-color: var(--green) !important;
}

.btn.primary::after,
.btn.success::after {
  display: none !important;
}

input,
select,
textarea {
  color: var(--ink) !important;
  background: var(--field) !important;
  border-color: var(--line) !important;
  border-left-color: rgba(22, 131, 90, 0.62) !important;
}

input:focus,
select:focus,
textarea:focus {
  background: #ffffff !important;
  border-color: var(--green) !important;
  box-shadow: 0 0 0 3px rgba(22, 131, 90, 0.13) !important;
}

.scan-panel {
  color: #ffffff !important;
  background: #111827 !important;
}

.scanner-status {
  color: #ffffff !important;
  background: rgba(17, 24, 39, 0.72) !important;
}

.supplier-ledger-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.supplier-ledger-sidebar {
  display: grid;
  gap: 10px;
  position: sticky;
  top: 88px;
}

.supplier-ledger-button {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  color: var(--ink);
  display: grid;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.supplier-ledger-button:hover,
.supplier-ledger-button.active {
  border-color: rgba(22, 131, 90, 0.42);
  box-shadow: 0 12px 30px rgba(22, 131, 90, 0.12);
  transform: translateY(-2px);
}

.supplier-ledger-button span,
.supplier-ledger-button small {
  color: var(--soft);
}

.supplier-ledger-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.supplier-account-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.supplier-account-metrics span {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(246, 248, 251, 0.9);
  color: var(--soft);
}

.supplier-account-metrics strong {
  display: block;
  color: var(--green);
  font-size: 18px;
}

.supplier-payment-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}

.supplier-payment-form .btn {
  min-height: 44px;
}

.supplier-debt-cards {
  display: grid;
  gap: 12px;
}

.supplier-debt-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, 0.8fr) minmax(180px, 0.7fr);
  gap: 14px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.94);
}

.supplier-debt-card h4 {
  margin: 8px 0 4px;
  font-size: 18px;
}

.supplier-debt-card p {
  margin: 0 0 6px;
  color: var(--ink);
}

.supplier-debt-money {
  display: grid;
  gap: 6px;
}

.supplier-debt-money span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--soft);
}

.supplier-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: start;
}

.supplier-attachment-thumb {
  width: 76px;
  min-height: 82px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  padding: 5px;
  background: #fff;
  text-decoration: none;
  color: var(--ink);
  display: grid;
  gap: 4px;
  place-items: center;
}

.supplier-attachment-thumb img {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
}

.supplier-attachment-thumb span {
  display: grid;
  place-items: center;
  width: 64px;
  height: 48px;
  border-radius: 6px;
  background: rgba(22, 131, 90, 0.12);
  color: var(--green);
  font-weight: 900;
}

.supplier-attachment-thumb small {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.supplier-upload-button {
  position: relative;
  overflow: hidden;
  align-self: start;
}

.supplier-upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.supplier-register-layout {
  margin-top: 8px;
}

@media (max-width: 900px) {
  .quotation-search-panel {
    display: grid;
    max-height: none;
    overflow: visible;
  }

  .quotation-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .quotation-basket-panel {
    max-height: none;
    overflow: visible;
  }

  .quotation-results {
    max-height: none;
    min-height: 0;
    overflow: visible;
    touch-action: auto;
    padding-right: 3px;
  }

  .quotation-filter-row {
    grid-template-columns: 1fr;
  }

  .quotation-basket-panel {
    position: static;
  }

  .quotation-result-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    min-width: 0;
  }

  .quotation-price-box {
    grid-column: 2 / -1;
    justify-items: start;
    grid-template-columns: repeat(3, auto);
    gap: 8px;
  }

  .quotation-description,
  .quotation-brand,
  .quotation-models {
    grid-column: 1 / -1;
  }

  .quotation-add-quantity {
    align-self: stretch;
    justify-items: stretch;
  }

  .quotation-add-quantity input,
  .quotation-result-card .quotation-add-btn {
    width: 100%;
  }

  .quotation-result-card .quotation-add-btn {
    grid-column: auto;
    border-radius: 8px !important;
  }

  .quotation-basket-item {
    grid-template-columns: 1fr;
  }

  .quotation-basket-item-compact {
    grid-template-columns: minmax(0, 1fr) 72px 68px;
    align-items: center;
  }

  .quotation-edit-row {
    grid-template-columns: 1fr;
  }

  .supplier-ledger-layout {
    grid-template-columns: 1fr;
  }

  .supplier-ledger-sidebar {
    position: static;
    grid-auto-flow: column;
    grid-auto-columns: minmax(210px, 1fr);
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .supplier-payment-form,
  .supplier-debt-card,
  .supplier-account-metrics {
    grid-template-columns: 1fr;
  }
}

/* Reglas finales de impresion: etiquetas 60x30 sin papel extra. */
@media print {
  @page label {
    size: 60mm 30mm;
    margin: 0;
  }

  #printRoot[data-print-mode="label"],
  #printRoot[data-print-mode="label"] .label-print-sheet {
    display: block !important;
    width: 60mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  #printRoot[data-print-mode="label"] .print-label {
    page: label;
    width: 60mm !important;
    height: 30mm !important;
    margin: 0 !important;
    padding: 3mm 3.2mm 2.8mm !important;
    border: 0.35mm solid #111827 !important;
    box-shadow: none !important;
    overflow: hidden !important;
    break-after: page;
    page-break-after: always;
  }

  #printRoot[data-print-mode="label"] .print-label:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}

/* Final sales history guard: actions must never overlap status or totals. */
.sales-history-card {
  grid-template-columns: minmax(0, 1fr) !important;
  align-items: start !important;
  overflow: visible !important;
}

.sales-history-main {
  width: 100% !important;
  min-width: 0 !important;
}

.sales-history-actions {
  position: relative !important;
  z-index: 1 !important;
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)) !important;
  width: 100% !important;
  min-width: 0 !important;
  margin-top: 4px !important;
}

.sales-history-actions .btn {
  width: 100% !important;
  min-width: 0 !important;
}

.sales-history-state {
  min-width: 0 !important;
  padding-bottom: 2px !important;
}

/* Sales history price chips: compact, no nested price cards inside product lines. */
.sale-history-items > span {
  grid-template-columns: minmax(116px, max-content) minmax(0, 1fr) !important;
  align-items: start !important;
}

.sale-history-items > span > strong {
  grid-column: 1 !important;
  min-width: 0 !important;
  white-space: normal !important;
}

.sale-history-items > span > em {
  grid-column: 2 !important;
  min-width: 0 !important;
}

.sale-history-items > span > small {
  grid-column: 2 !important;
}

.sale-history-price {
  grid-column: 2 !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 100% !important;
  margin-top: 3px !important;
  color: var(--ink) !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
}

.sale-history-price > span {
  display: inline-flex !important;
  flex: 0 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 4px 7px !important;
  border: 1px solid rgba(22, 131, 90, 0.16) !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.82) !important;
  color: var(--ink) !important;
  box-shadow: none !important;
  white-space: normal !important;
}

.sale-history-price b {
  color: var(--muted) !important;
  font-size: 10px !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
}

@media (max-width: 980px) {
  .sale-history-items > span {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .sale-history-items > span > strong,
  .sale-history-items > span > em,
  .sale-history-items > span > small,
  .sale-history-price {
    grid-column: 1 !important;
  }
}

/* Plantilla virgen: marca generica sin logo real */
.generic-brand {
  display: inline-grid;
  place-items: center;
  width: 108px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(31, 102, 209, 0.14), rgba(18, 128, 84, 0.12));
  color: #0f172a;
  border: 1px solid rgba(31, 102, 209, 0.22);
  font-family: Outfit, Inter, Arial, sans-serif;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.generic-brand.compact {
  width: 74px;
  height: 34px;
  border-radius: 10px;
  font-size: 15px;
}

/* REPUESTOS CARS VE final theme */
:root {
  --h-paper: 220 14% 96%;
  --h-surface: 0 0% 100%;
  --h-surface-2: 0 0% 94%;
  --h-ink: 0 0% 9%;
  --h-muted: 220 6% 43%;
  --h-soft: 220 7% 25%;
  --h-line: 0 0% 10%;
  --h-field: 0 0% 99%;
  --h-blue: 0 0% 14%;
  --h-blue-2: 0 0% 42%;
  --h-green: 0 91% 50%;
  --h-red: 0 91% 50%;
  --h-gold: 0 0% 54%;
  --primary-gradient: linear-gradient(135deg, #f20d0d, #111111);
  --success-gradient: linear-gradient(135deg, #2f3338, #111111);
  --warning-gradient: linear-gradient(135deg, #8a8d91, #f20d0d);
}

body {
  background:
    linear-gradient(rgba(16, 16, 16, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 16, 16, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, #ffffff 0%, #f4f5f7 50%, #eceef1 100%);
  background-size: 48px 48px, 48px 48px, auto;
}

body::before {
  background:
    linear-gradient(135deg, rgba(242, 13, 13, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(17, 17, 17, 0.06), transparent 58%);
  background-size: auto;
}

body::after {
  background: linear-gradient(90deg, #f20d0d, #111111, #74777c, #f20d0d);
  box-shadow: 0 0 18px rgba(242, 13, 13, 0.24);
}

.login-panel {
  border-top-color: #f20d0d !important;
}

.brand-logo {
  width: min(330px, 74vw);
  max-height: 152px;
  object-fit: contain;
  border-radius: 6px;
  background: #050505;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.24);
}

.brand-logo.compact {
  width: min(190px, 38vw);
  max-height: 56px;
}

.login-minimal {
  width: min(460px, 100%);
  gap: 18px;
  padding: 34px 28px 30px;
}

.login-brand-only {
  justify-content: center;
  margin-bottom: 4px;
}

.login-brand-only .brand-logo {
  width: min(390px, 78vw);
  max-height: 180px;
}

.brand-lockup small {
  color: #2f3338;
}

.topbar {
  background: rgba(255, 255, 255, 0.94);
}

.nav-item:hover,
.nav-item.active,
.module-tab.active,
.module-tab:hover {
  border-color: rgba(242, 13, 13, 0.32) !important;
  background: rgba(242, 13, 13, 0.09) !important;
}

.btn.primary,
.btn.success {
  border-color: #f20d0d !important;
  background: #f20d0d !important;
  color: #ffffff !important;
}

input,
select,
textarea {
  border-left-color: rgba(242, 13, 13, 0.68) !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #f20d0d !important;
  box-shadow: 0 0 0 3px rgba(242, 13, 13, 0.14) !important;
}

.module-card strong,
.metric strong,
.scan-card span,
.label-brand {
  color: #f20d0d;
}

.bot-meta-grid,
.bot-lead-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.bot-meta-grid span,
.bot-lead-facts span {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  min-width: 0;
}

.bot-admin-layout {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.bot-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.bot-lead-list,
.bot-message-list {
  display: grid;
  gap: 10px;
}

.bot-lead-card {
  display: grid;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
}

.bot-lead-card.active,
.bot-lead-card:hover {
  border-color: rgba(242, 13, 13, 0.38);
  background: rgba(242, 13, 13, 0.07);
}

.bot-lead-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.bot-lead-top strong,
.bot-lead-card span,
.bot-lead-card small {
  overflow-wrap: anywhere;
}

.bot-lead-top em,
.bot-status-pill {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.08);
  color: var(--soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.bot-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.bot-detail-head h3,
.bot-detail-head p {
  margin: 0;
}

.bot-message-list {
  margin-top: 14px;
  max-height: min(58vh, 560px);
  overflow: auto;
  padding-right: 4px;
}

.bot-admin-message {
  max-width: min(720px, 94%);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.bot-admin-message.out {
  justify-self: end;
  background: rgba(242, 13, 13, 0.08);
  border-color: rgba(242, 13, 13, 0.24);
}

.bot-admin-message small {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-weight: 700;
}

.bot-admin-message p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bot-reply-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.bot-reply-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

@media (max-width: 880px) {
  .bot-admin-layout {
    grid-template-columns: 1fr;
  }

  .bot-filter-row,
  .bot-reply-actions {
    grid-template-columns: 1fr;
    display: grid;
  }
}

/* Inventario: buscador principal arriba y filtros debajo. */
.product-list-panel .product-list-head {
  align-items: center;
  margin-bottom: 12px;
}

.product-list-panel .product-list-head .btn {
  min-height: 44px;
}

.product-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.product-pricing-form {
  display: grid;
  grid-template-columns: minmax(150px, 190px) auto;
  gap: 8px;
  align-items: end;
  min-width: min(100%, 330px);
  padding: 8px;
  border: 1px solid rgba(242, 13, 13, 0.22);
  border-radius: 8px;
  background: rgba(255, 250, 250, 0.96);
}

.product-pricing-form label {
  display: grid;
  gap: 4px;
  margin: 0;
}

.product-pricing-form label span,
.product-pricing-form small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.product-pricing-form input {
  min-height: 42px;
  font-weight: 900;
}

.product-pricing-form small {
  grid-column: 1 / -1;
  color: var(--ink);
  text-transform: none;
}

.product-search-layout {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.product-main-search {
  width: 100% !important;
  max-width: none !important;
  min-height: 66px;
  font-size: 21px;
  font-weight: 900;
}

.product-filter-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.product-filter-strip select {
  width: 100%;
  max-width: none !important;
  min-height: 54px;
  font-size: 16px;
  font-weight: 800;
}

@media (max-width: 760px) {
  .product-list-actions,
  .product-pricing-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    justify-content: stretch;
  }

  .product-filter-strip {
    grid-template-columns: 1fr;
  }
}

.sale-product-results-wrap {
  max-height: min(62dvh, 650px);
  overflow: auto;
}

.sale-product-result-header,
.sale-product-result-row {
  display: grid;
  grid-template-columns:
    minmax(110px, 0.75fr)
    minmax(110px, 0.75fr)
    minmax(300px, 2.15fr)
    minmax(115px, 0.75fr)
    minmax(90px, 0.58fr)
    minmax(112px, 0.72fr)
    minmax(104px, 0.68fr)
    76px
    44px;
  gap: 8px;
  align-items: center;
  min-width: 1080px;
}

.sale-product-result-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--soft);
  background: #f8fafc;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.sale-product-result-list {
  display: grid;
}

.sale-product-result-row {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.sale-product-result-row:hover {
  background: rgba(22, 131, 90, 0.06);
}

.sale-product-result-row > span,
.sale-product-result-row label {
  min-width: 0;
}

.sale-product-result-row small {
  display: none;
  color: var(--soft);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.sale-product-result-row strong {
  display: block;
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.sale-product-description strong {
  font-size: 13px;
}

.sale-product-result-row em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.sale-product-price strong {
  color: var(--danger);
  white-space: nowrap;
}

.sale-product-price-bcv strong {
  color: #114bb0;
}

.sale-result-qty {
  display: grid;
  justify-items: stretch;
  gap: 3px;
  margin: 0;
  color: var(--soft);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.sale-result-qty > span:first-child {
  text-align: center;
}

.sale-result-qty input {
  width: 68px !important;
  min-height: 34px;
  padding: 4px 5px !important;
  border-left-width: 1px !important;
  text-align: center;
  font-size: 14px;
  font-weight: 900;
  -moz-appearance: auto;
}

.sale-result-qty input::-webkit-outer-spin-button,
.sale-result-qty input::-webkit-inner-spin-button {
  margin: 0;
  opacity: 1;
}

.sale-result-add {
  justify-self: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0 !important;
  border-radius: 999px !important;
  font-size: 18px;
}

.sale-external-box {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(22, 131, 90, 0.22);
  border-radius: 8px;
  background: rgba(22, 131, 90, 0.06);
}

.sale-external-box > div:first-child {
  display: grid;
  gap: 2px;
}

.sale-external-box strong {
  color: var(--ink);
}

.sale-external-box small,
.sale-item-note {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.sale-external-grid {
  align-items: end;
}

.sale-external-add {
  min-height: 48px;
}

.sale-external-pill {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 6px;
  border-radius: 999px;
  color: #0f5132;
  background: #d1fae5;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .sale-product-results-wrap {
    max-height: 70dvh;
  }

  .sale-product-result-header {
    display: none;
  }

  .sale-product-result-row {
    grid-template-columns: minmax(0, 1fr) 76px 44px;
    min-width: 0;
    gap: 6px;
    align-items: start;
  }

  .sale-product-code,
  .sale-product-reference,
  .sale-product-brand,
  .sale-product-stock,
  .sale-product-price {
    display: none;
  }

  .sale-product-description small,
  .sale-product-description strong,
  .sale-product-description em {
    display: block;
  }
}

/* Panel lateral plegable para ganar espacio en pantalla. */
.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  color: currentColor;
}

.nav-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 981px) {
  .app-shell .topbar {
    width: calc(100% - 60px) !important;
    max-width: none !important;
    margin: 0 0 0 60px !important;
    border-radius: 0 !important;
  }

  .workspace {
    grid-template-columns: 60px minmax(0, 1fr) !important;
    gap: 0 !important;
  }

  .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    z-index: 40;
    width: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 12px 8px !important;
    overflow: hidden !important;
    border-width: 0 1px 0 0 !important;
    border-style: solid !important;
    border-color: var(--line) !important;
    border-radius: 0 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    box-shadow: none !important;
    display: grid !important;
    align-content: start;
    gap: 8px;
    white-space: nowrap;
    transition: width 180ms ease, min-width 180ms ease, max-width 180ms ease, box-shadow 180ms ease;
  }

  .sidebar::before {
    display: none !important;
  }

  .sidebar:hover,
  .sidebar:focus-within {
    width: 248px !important;
    min-width: 248px !important;
    max-width: 248px !important;
    box-shadow: 18px 0 44px rgba(15, 23, 42, 0.14) !important;
  }

  .sidebar .nav-item {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    min-height: 48px !important;
    margin-bottom: 0 !important;
    padding: 0 10px !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: width 180ms ease, max-width 180ms ease, background-color 140ms ease, border-color 140ms ease, color 140ms ease;
  }

  .sidebar .nav-label {
    max-width: 0;
    opacity: 0;
    transition: max-width 160ms ease, opacity 120ms ease;
  }

  .sidebar:hover .nav-item,
  .sidebar:focus-within .nav-item {
    justify-content: flex-start;
    width: 224px !important;
    min-width: 224px !important;
    max-width: 224px !important;
    padding: 0 12px !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
  }

  .sidebar:hover .nav-label,
  .sidebar:focus-within .nav-label {
    max-width: 164px;
    opacity: 1;
  }

  .sidebar .nav-item.active .nav-icon,
  .sidebar .nav-item:hover .nav-icon {
    color: #f20d0d;
  }
}

/* Ajuste final: la barra lateral no debe aplastar ni tapar el inventario. */
@media (min-width: 981px) {
  .app-shell {
    --side-closed: 60px;
    --side-open: 292px;
    --side-current: var(--side-closed);
  }

  .app-shell:has(.sidebar:hover),
  .app-shell:has(.sidebar:focus-within) {
    --side-current: var(--side-open);
  }

  .app-shell .topbar {
    width: calc(100% - var(--side-current)) !important;
    max-width: none !important;
    margin: 0 0 0 var(--side-current) !important;
    border-radius: 0 !important;
    transition: margin-left 180ms ease, width 180ms ease;
  }

  .workspace {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-height: calc(100vh - 68px) !important;
    overflow: visible !important;
  }

  .content {
    width: calc(100% - var(--side-current)) !important;
    max-width: none !important;
    margin-left: var(--side-current) !important;
    padding: 22px !important;
    overflow-x: hidden !important;
    transition: margin-left 180ms ease, width 180ms ease;
  }

  .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    z-index: 60 !important;
    width: var(--side-current) !important;
    min-width: var(--side-current) !important;
    max-width: var(--side-current) !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 14px 8px !important;
    display: grid !important;
    align-content: start !important;
    gap: 8px !important;
    overflow: hidden !important;
    border-width: 0 1px 0 0 !important;
    border-style: solid !important;
    border-color: var(--line) !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    transition: width 180ms ease, min-width 180ms ease, max-width 180ms ease, box-shadow 180ms ease;
  }

  .sidebar:hover,
  .sidebar:focus-within {
    box-shadow: 10px 0 32px rgba(15, 23, 42, 0.12) !important;
  }

  .sidebar .nav-item {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    width: calc(var(--side-current) - 16px) !important;
    min-width: 44px !important;
    max-width: calc(var(--side-current) - 16px) !important;
    min-height: 48px !important;
    padding: 0 12px !important;
    margin: 0 !important;
  }

  .sidebar .nav-icon {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
  }

  .sidebar .nav-label {
    max-width: 0;
    opacity: 0;
    pointer-events: none;
  }

  .sidebar:hover .nav-label,
  .sidebar:focus-within .nav-label {
    max-width: 210px;
    opacity: 1;
  }
}

/* Entrada por foto inteligente. */
.receive-provider-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto minmax(180px, 260px);
  gap: 10px;
  align-items: end;
}

.receive-provider-bar label {
  margin: 0;
}

.receive-supplier-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(31, 102, 209, 0.18);
  border-radius: 8px;
  background: rgba(31, 102, 209, 0.05);
}

.receive-template-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(22, 131, 90, 0.22);
  border-radius: 8px;
  background: rgba(22, 131, 90, 0.08);
}

.receive-template-card strong,
.receive-template-card span,
.receive-template-card small {
  line-height: 1.25;
}

.receive-template-card small {
  color: var(--soft);
  font-weight: 800;
}

.receive-template-card.muted-card {
  border-color: rgba(17, 17, 17, 0.12);
  background: #f8f9fb;
}

.receive-read-mode-card {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(260px, 1fr);
  gap: 12px;
  align-items: end;
  padding: 12px 14px;
  border: 1px solid rgba(31, 102, 209, 0.18);
  border-radius: 8px;
  background: rgba(31, 102, 209, 0.06);
}

.receive-read-mode-card label {
  margin: 0;
}

.receive-read-mode-card p {
  margin: 0;
  color: var(--soft);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.25;
}

.receive-smart-panel .bulk-actions {
  grid-template-columns: minmax(240px, 340px) minmax(320px, 1fr) auto;
}

.receive-discount-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 240px));
  gap: 10px;
  align-items: end;
  width: fit-content;
  max-width: 100%;
  padding: 10px;
  border: 1px solid rgba(242, 13, 13, 0.18);
  border-radius: 8px;
  background: rgba(242, 13, 13, 0.05);
}

.receive-discount-box label {
  margin: 0;
}

.receive-status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.receive-status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 999px;
  background: #f5f6f8;
  color: var(--soft);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
}

.receive-status-pill.restock {
  border-color: rgba(22, 131, 90, 0.28);
  background: rgba(22, 131, 90, 0.1);
  color: #126342;
}

.receive-status-pill.new {
  border-color: rgba(31, 102, 209, 0.28);
  background: rgba(31, 102, 209, 0.1);
  color: #1f5fab;
}

.receive-status-pill.review,
.receive-status-pill.brand,
.receive-status-pill.error {
  border-color: rgba(242, 13, 13, 0.28);
  background: rgba(242, 13, 13, 0.1);
  color: #c90000;
}

.receive-status-pill.skipped {
  border-color: rgba(95, 101, 112, 0.25);
  background: #eef0f3;
  color: #555b65;
}

.receiving-row-skipped {
  background: #f4f5f7;
  opacity: 0.72;
}

.receiving-row-skipped input:disabled,
.receiving-row-skipped select:disabled,
.receiving-row-skipped button:disabled {
  cursor: not-allowed;
}

.receive-smart-panel .bulk-table {
  min-width: 1440px;
}

.bulk-table td[data-label="Estado"] {
  min-width: 132px;
}

.bulk-table td[data-label="SKU / Codigo Toyota"] {
  min-width: 205px;
}

.bulk-table td[data-label="Referencia prov."] {
  min-width: 140px;
}

.bulk-table td[data-label="Descripcion"] {
  width: 420px;
  min-width: 420px;
}

.bulk-table td[data-label="Marca"] {
  min-width: 130px;
}

.receive-smart-panel .bulk-table th:nth-child(6),
.bulk-table td[data-label="Cant."] {
  width: 92px;
  min-width: 92px;
  white-space: nowrap;
}

.bulk-table .receive-quantity-input {
  width: 80px;
  min-width: 80px;
  padding-left: 10px;
  padding-right: 28px;
  text-align: center;
  font-weight: 900;
  box-sizing: border-box;
}

.bulk-table td[data-label="Costo USD"],
.bulk-table td[data-label="Precio venta USD"] {
  width: 112px;
  min-width: 112px;
}

.bulk-table td[data-label="Costo USD"] {
  display: grid;
  gap: 6px;
}

.bulk-table [data-receive-price-option] {
  min-height: 34px;
  font-size: 12px;
  font-weight: 800;
}

.receive-description-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 4px;
  align-items: start;
}

.receive-description-editor textarea {
  width: 100%;
  min-width: 0;
  min-height: 62px;
  padding: 8px 10px;
  line-height: 1.3;
  resize: vertical;
  box-sizing: border-box;
}

.receive-description-editor .receive-description-search-btn {
  display: inline-grid;
  width: 32px;
  min-width: 32px;
  max-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  place-items: center;
  border-radius: 6px;
}

.receive-description-search-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.receive-row-search,
.receiving-row-actions .btn {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 12px;
  line-height: 1.1;
}

.bulk-table td[data-label="Acciones"] {
  width: 112px;
  min-width: 112px;
}

.receiving-row-actions {
  display: grid;
  gap: 6px;
}

.receive-row-include {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
}

.receive-row-include input {
  width: 17px;
  min-width: 17px;
  min-height: 17px;
  margin: 0;
  padding: 0;
  accent-color: var(--red);
}

.receiving-total-check {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(260px, 1fr) minmax(260px, 1.2fr);
  gap: 14px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid #8a919c;
  border-radius: 8px;
  background: #f7f8fa;
}

.receiving-total-check > div {
  display: grid;
  gap: 3px;
}

.receiving-total-check small,
.receiving-total-check label {
  color: var(--soft);
  font-size: 12px;
  font-weight: 900;
}

.receiving-total-check strong {
  color: var(--red);
  font-size: 24px;
  font-weight: 950;
}

.receiving-total-check label {
  margin: 0;
}

.receiving-total-check input {
  margin-top: 5px;
}

.receiving-total-check p {
  min-height: 42px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 7px;
  background: rgba(95, 101, 112, 0.08);
  color: var(--soft);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.3;
}

.receiving-total-check.match {
  border-left-color: #16835a;
  background: #f2faf6;
}

.receiving-total-check.match p {
  background: rgba(22, 131, 90, 0.1);
  color: #126342;
}

.receiving-total-check.mismatch {
  border-left-color: var(--red);
  background: rgba(242, 13, 13, 0.04);
}

.receiving-total-check.mismatch p {
  background: rgba(242, 13, 13, 0.09);
  color: #c90000;
}

@media (max-width: 820px) {
  .receiving-total-check {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

.receiving-product-picker-modal {
  width: min(1120px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  overflow: hidden;
}

.receiving-product-picker-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.receiving-product-picker-search input {
  min-height: 46px;
  font-size: 17px;
  font-weight: 800;
}

.receiving-product-picker-results {
  min-height: 180px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding: 0 18px 18px;
}

.receiving-product-picker-list {
  display: grid;
}

.receiving-product-picker-result {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(130px, 0.8fr) minmax(260px, 2fr) minmax(110px, 0.75fr) 90px 96px;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.receiving-product-picker-result:hover,
.receiving-product-picker-result:focus-visible {
  background: #f4fbf7;
  outline: none;
}

.receiving-product-picker-result span {
  min-width: 0;
}

.receiving-product-picker-result small,
.receiving-product-picker-result strong {
  display: block;
}

.receiving-product-picker-result small {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.receiving-product-picker-result strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.25;
}

.receiving-picker-select {
  color: var(--red);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.receiving-picker-loading {
  padding: 10px 0 0;
}

@media (max-width: 760px) {
  .receiving-product-picker-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .receiving-product-picker-search {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .receiving-product-picker-results {
    max-height: calc(100vh - 240px);
    padding: 0 12px 12px;
  }

  .receiving-product-picker-result {
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
  }

  .receiving-picker-description,
  .receiving-picker-select {
    grid-column: 1 / -1;
  }

  .receiving-picker-select {
    text-align: left;
  }
}

@media (max-width: 900px) {
  .receive-provider-bar {
    grid-template-columns: 1fr;
  }

  .receive-smart-panel .bulk-actions {
    grid-template-columns: 1fr;
  }

  .receive-read-mode-card {
    grid-template-columns: 1fr;
  }

  .receive-discount-box {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .receive-status-summary {
    justify-content: flex-start;
  }
}

.stocktake-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.stocktake-main,
.stocktake-report {
  min-width: 0;
}

.stocktake-topline,
.stocktake-start,
.stocktake-summary-grid,
.stocktake-actions,
.stocktake-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.stocktake-topline {
  justify-content: space-between;
  color: var(--soft);
  font-weight: 800;
}

.stocktake-progress {
  width: 100%;
  height: 10px;
  margin: 12px 0 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf3;
}

.stocktake-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.stocktake-jump {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(92px, auto);
  gap: 8px;
  align-items: end;
  margin: 0 0 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stocktake-jump label {
  display: grid;
  gap: 5px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.stocktake-jump input {
  width: 100%;
  min-height: 50px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

.stocktake-jump .btn {
  min-height: 50px;
  font-size: 17px;
  font-weight: 900;
}

.stocktake-product {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stocktake-product span,
.stocktake-product small {
  color: var(--soft);
  font-weight: 800;
}

.stocktake-product h3 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.08;
}

.stocktake-product > strong {
  font-size: 18px;
}

.stocktake-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.stocktake-counts > div,
.stocktake-summary-grid > span,
.stocktake-start > span {
  display: grid;
  gap: 4px;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stocktake-counts span,
.stocktake-summary-grid span,
.stocktake-start span {
  color: var(--soft);
  font-size: 13px;
  font-weight: 800;
}

.stocktake-counts strong,
.stocktake-summary-grid strong,
.stocktake-start strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.stocktake-counts .ok {
  border-color: rgba(22, 131, 90, 0.28);
  background: rgba(22, 131, 90, 0.08);
}

.stocktake-counts .warn {
  border-color: rgba(242, 13, 13, 0.28);
  background: rgba(242, 13, 13, 0.08);
}

.stocktake-actions {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
}

.stocktake-actions .btn,
.stocktake-keypad .btn,
.stocktake-footer-actions .btn {
  min-height: 58px;
  font-size: 18px;
  font-weight: 900;
}

.stocktake-ok {
  font-size: 24px !important;
}

.stocktake-keypad {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.stocktake-footer-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
}

.stocktake-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  margin: 12px 0;
}

.stocktake-summary-grid.compact {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.stocktake-table-wrap td:first-child span {
  display: block;
  margin-top: 4px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 980px) {
  .stocktake-layout,
  .stocktake-counts,
  .stocktake-summary-grid,
  .stocktake-summary-grid.compact,
  .stocktake-footer-actions {
    grid-template-columns: 1fr;
  }

  .stocktake-actions {
    grid-template-columns: 1fr 1fr;
  }

  .stocktake-keypad {
    grid-template-columns: repeat(3, minmax(76px, 1fr));
  }

  .stocktake-jump {
    grid-template-columns: minmax(0, 1fr) minmax(86px, auto);
  }
}

/* Responsive safety pass: prevents compressed text and broken panels at any zoom or viewport. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.topbar,
.workspace,
.content,
.view,
.panel,
.metric,
.module-card,
.stacked-form,
.form-grid,
.split-layout,
.scanner-grid,
.sales-layout,
.quotation-layout,
.stocktake-layout,
.supplier-ledger-layout,
.supplier-register-layout,
.table-wrap,
.bulk-table-wrap,
.sales-history-list,
.sales-history-card,
.sales-history-main,
.sales-history-client,
.sales-history-meta,
.sale-history-items,
.cash-list-grid,
.user-admin-panel,
.user-create-grid,
.user-list-row,
.receive-smart-panel,
.stocktake-report,
.stocktake-main {
  min-width: 0;
  max-width: 100%;
}

.panel,
.metric,
.module-card,
.sales-history-card,
.sale-product-box,
.totals-box,
.empty-state,
.sync-message,
.smart-result,
.quick-product,
.quotation-product-row,
.quotation-basket-row,
.bulk-summary,
.receive-status-summary,
.stocktake-product,
.stocktake-counts > div {
  overflow-wrap: anywhere;
}

input,
select,
textarea,
button,
.btn {
  max-width: 100%;
}

input,
select,
textarea {
  min-width: 0;
}

.btn,
.module-tab,
.nav-item {
  white-space: normal;
}

.section-head,
.section-actions,
.action-row,
.table-actions,
.topbar-actions,
.cash-tabs,
.stocktake-topline,
.stocktake-start,
.stocktake-summary-grid,
.stocktake-footer-actions,
.receive-status-summary {
  flex-wrap: wrap;
  min-width: 0;
}

.sales-layout {
  grid-template-columns: minmax(0, 1fr) !important;
}

@media (min-width: 1721px) {
  .sales-layout {
    grid-template-columns: minmax(520px, 0.92fr) minmax(620px, 1.08fr) !important;
  }
}

.sales-history-card {
  grid-template-columns: minmax(0, 1fr) minmax(160px, 188px);
}

.sales-history-main {
  grid-template-columns: 52px minmax(300px, 1.25fr) minmax(220px, 0.9fr) minmax(112px, auto);
}

.sales-history-client > strong,
.sales-history-meta span,
.sale-history-items em,
.sale-history-items .sale-history-price {
  word-break: normal;
  overflow-wrap: anywhere;
}

.sale-history-items {
  max-width: none;
}

.sale-history-items span {
  grid-template-columns: max-content minmax(220px, 1fr);
}

.sale-history-items em,
.sale-history-items .sale-history-price,
.sale-history-items span small {
  grid-column: 2;
}

.sale-history-items strong {
  white-space: normal;
}

.sales-history-actions {
  min-width: 0;
}

.sales-history-actions .btn {
  min-width: 0;
  white-space: normal;
}

.sale-history-filters {
  grid-template-columns: minmax(128px, 0.7fr) minmax(128px, 0.7fr) minmax(260px, 1.4fr) minmax(132px, auto);
}

@media (max-width: 1280px) {
  .metrics-grid,
  .module-grid,
  .dashboard-analytics-grid,
  .dashboard-day-summary-grid,
  .dashboard-sale-summary-grid,
  .cash-arqueo-sheet,
  .dashboard-sale-payment,
  .payment-method-grid,
  .cash-list-grid,
  .user-permissions-grid,
  .stocktake-counts,
  .stocktake-summary-grid,
  .stocktake-footer-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-layout,
  .scanner-grid,
  .quotation-layout,
  .stocktake-layout,
  .supplier-ledger-layout,
  .supplier-register-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-history-card,
  .sales-history-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-history-actions {
    display: flex;
    flex-wrap: wrap;
  }

  .sales-history-actions .btn {
    flex: 1 1 148px;
    width: auto;
  }

  .sale-history-items span {
    grid-template-columns: max-content minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .user-admin-card,
  .user-permissions-grid,
  .permission-picker-toolbar {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .topbar {
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .topbar-actions::-webkit-scrollbar {
    display: none;
  }

  .sale-history-filters,
  .form-grid,
  .compact-grid,
  .payment-method-grid,
  .delivery-charge-controls,
  .bulk-actions,
  .user-create-grid,
  .user-list-row,
  .stocktake-counts,
  .stocktake-actions,
  .stocktake-summary-grid,
  .stocktake-footer-actions,
  .cash-list-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .sale-history-search,
  .sale-history-filters .btn {
    grid-column: 1 / -1;
  }

  .sale-history-items span {
    grid-template-columns: minmax(0, 1fr);
  }

  .sale-history-items em,
  .sale-history-items .sale-history-price,
  .sale-history-items span small {
    grid-column: 1;
  }
}

@media (max-width: 680px) {
  .smart-product-table-wrap {
    max-height: min(70vh, 680px);
  }

  .smart-product-header {
    display: none !important;
  }

  .smart-product-row {
    grid-template-columns: 56px minmax(0, 1fr);
    min-width: 0;
    align-items: start;
  }

  .smart-product-row small {
    display: block;
  }

  .smart-product-photo {
    grid-row: span 7;
  }

  .smart-product-code,
  .smart-product-reference,
  .smart-product-description,
  .smart-product-brand,
  .smart-product-stock,
  .smart-product-price {
    grid-column: 2;
  }

  .smart-product-row strong,
  .smart-product-description strong {
    font-size: 13px;
  }

  .content {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .panel {
    padding: 12px;
  }

  .view-title h2 {
    font-size: clamp(28px, 11vw, 42px);
    line-height: 1;
  }

  .module-switch,
  .metrics-grid,
  .module-grid,
  .dashboard-analytics-grid,
  .dashboard-day-summary-grid,
  .dashboard-delivery-split {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .dashboard-sale-summary-grid,
  .dashboard-sale-payment {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .dashboard-insight-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-insight-row span {
    text-align: left;
  }

  .dashboard-documents-header {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-documents-header .btn {
    width: 100%;
  }

  .sales-history-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-history-actions .btn,
  .action-row .btn,
  .section-actions .btn {
    width: 100%;
  }
}

#sales .sales-layout,
#sales .sales-layout.sales-layout-form-only {
  width: 100%;
  grid-template-columns: minmax(0, 1fr) !important;
}

#sales .sales-layout > #saleForm,
#sales .sales-layout > .panel {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
}

/* Navegacion superior principal: reemplaza el panel lateral por botones con icono y texto. */
.app-shell {
  padding-top: 0 !important;
}

.app-shell .topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 80 !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 72px !important;
  margin: 0 !important;
  padding: calc(8px + env(safe-area-inset-top)) 18px 8px !important;
  border-width: 0 0 1px !important;
  border-style: solid !important;
  border-color: var(--line) !important;
  border-radius: 0 !important;
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.08) !important;
}

.topbar .brand-lockup {
  display: flex !important;
  align-items: center !important;
  min-width: 118px !important;
  gap: 0 !important;
}

.topbar .brand-lockup small {
  display: none !important;
}

.topbar .brand-logo.compact {
  width: 152px !important;
  height: 52px !important;
  max-height: 52px !important;
  object-fit: cover !important;
  object-position: center !important;
  border-radius: 6px !important;
  background: #050505 !important;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18) !important;
}

.top-module-nav {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  overscroll-behavior-x: contain !important;
  padding: 2px 2px 4px !important;
  scrollbar-width: none !important;
}

.top-module-nav::-webkit-scrollbar {
  display: none !important;
}

.top-nav-item {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-width: 94px !important;
  min-height: 48px !important;
  padding: 8px 12px !important;
  border: 1px solid var(--line) !important;
  border-radius: 7px !important;
  background: #ffffff !important;
  color: var(--ink) !important;
  font-family: Outfit, Inter, sans-serif !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  line-height: 1.05 !important;
  text-align: center !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05) !important;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease !important;
}

.top-nav-item:hover {
  transform: translateY(-1px) !important;
  border-color: rgba(242, 13, 13, 0.28) !important;
  background: rgba(242, 13, 13, 0.06) !important;
}

.top-nav-item.active {
  border-color: rgba(242, 13, 13, 0.42) !important;
  background: rgba(242, 13, 13, 0.11) !important;
  color: #f20d0d !important;
  box-shadow: 0 10px 24px rgba(242, 13, 13, 0.10) !important;
}

.top-nav-icon {
  width: 20px !important;
  height: 20px !important;
  flex: 0 0 20px !important;
  display: inline-grid !important;
  place-items: center !important;
}

.top-nav-icon svg {
  width: 20px !important;
  height: 20px !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

.top-nav-label {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.app-shell .topbar-actions {
  flex-wrap: nowrap !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  min-width: 0 !important;
}

.app-shell .topbar-actions .btn {
  min-height: 44px !important;
  padding: 8px 12px !important;
  white-space: nowrap !important;
}

.workspace {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  min-height: calc(100vh - 72px) !important;
}

.sidebar {
  display: none !important;
}

.content {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  padding: 22px !important;
}

@media (max-width: 1380px) {
  .app-shell .topbar {
    grid-template-columns: auto minmax(0, 1fr) !important;
    align-items: start !important;
  }

  .app-shell .topbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    padding-bottom: 2px !important;
    scrollbar-width: none !important;
  }

  .app-shell .topbar-actions::-webkit-scrollbar {
    display: none !important;
  }
}

@media (max-width: 760px) {
  .app-shell .topbar {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
    min-height: 0 !important;
    padding: calc(7px + env(safe-area-inset-top)) 10px 8px !important;
  }

  .topbar .brand-logo.compact {
    width: 126px !important;
    height: 44px !important;
    max-height: 44px !important;
  }

  .top-module-nav {
    width: 100% !important;
    padding-bottom: 3px !important;
  }

  .top-nav-item {
    min-width: 82px !important;
    min-height: 42px !important;
    gap: 6px !important;
    padding: 7px 9px !important;
    font-size: 13px !important;
  }

  .top-nav-icon,
  .top-nav-icon svg {
    width: 18px !important;
    height: 18px !important;
  }

  .app-shell .topbar-actions {
    width: 100% !important;
    overflow-x: auto !important;
  }

  .app-shell .topbar-actions > *,
  .app-shell .topbar-actions .btn {
    flex: 0 0 auto !important;
  }

  .content {
    padding: 14px 10px calc(24px + env(safe-area-inset-bottom)) !important;
  }
}

/* Navegacion fija y compatible con abrir modulos en nuevas pestanas. */
.app-shell .topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 1200 !important;
}

.top-nav-item,
.nav-item,
.product-subtab {
  text-decoration: none !important;
  -webkit-tap-highlight-color: transparent;
}

.top-nav-item:focus-visible,
.nav-item:focus-visible,
.product-subtab:focus-visible {
  outline: 3px solid rgba(242, 13, 13, 0.34) !important;
  outline-offset: 2px !important;
}

/* Ajustes moviles: menu superior al lado del logo y busquedas de venta completas. */
@media (max-width: 760px) {
  .app-shell .topbar {
    grid-template-columns: auto minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 7px !important;
    padding: calc(5px + env(safe-area-inset-top)) 7px 6px !important;
  }

  .topbar .brand-lockup {
    min-width: 0 !important;
    width: auto !important;
  }

  .topbar .brand-logo.compact {
    width: 104px !important;
    height: 38px !important;
    max-height: 38px !important;
  }

  .top-module-nav {
    width: auto !important;
    min-width: 0 !important;
    gap: 5px !important;
    padding: 1px 1px 2px !important;
  }

  .top-nav-item {
    min-width: 68px !important;
    min-height: 38px !important;
    gap: 4px !important;
    padding: 6px 7px !important;
    font-size: 11.5px !important;
  }

  .top-nav-icon,
  .top-nav-icon svg {
    width: 16px !important;
    height: 16px !important;
    flex-basis: 16px !important;
  }

  .top-nav-label {
    max-width: 54px !important;
  }

  .app-shell .topbar-actions {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    gap: 6px !important;
    padding-top: 0 !important;
  }

  .app-shell .topbar-actions .btn,
  .app-status-pill {
    min-height: 36px !important;
    padding: 6px 9px !important;
    font-size: 12.5px !important;
  }

  .products-toolbar,
  .receiving-toolbar {
    align-items: stretch !important;
    gap: 7px !important;
  }

  .products-toolbar .products-title,
  .receiving-toolbar .receiving-title,
  .products-toolbar .product-subtabs,
  .receiving-toolbar .inventory-mode-tabs {
    flex: 1 1 100% !important;
  }

  .product-subtabs,
  .inventory-mode-tabs {
    gap: 5px !important;
  }

  .product-subtab,
  .inventory-mode-tabs .module-tab {
    flex: 1 1 calc(50% - 5px) !important;
    min-height: 32px !important;
    padding: 6px 8px !important;
    font-size: 12px !important;
  }

  .content {
    padding-top: 12px !important;
  }
}

@media (max-width: 900px) {
  .sale-product-results-wrap {
    max-height: min(72dvh, 720px) !important;
    overflow-x: hidden !important;
  }

  .sale-product-result-list {
    gap: 0 !important;
  }

  .sale-product-result-row {
    grid-template-columns: minmax(0, 1fr) 76px 44px !important;
    grid-template-areas:
      "desc qty add"
      "code qty add"
      "ref qty add"
      "brand qty add"
      "stock qty add"
      "price qty add"
      "bcv qty add" !important;
    gap: 4px 12px !important;
    min-width: 0 !important;
    padding: 8px !important;
    align-items: start !important;
  }

  .sale-product-code,
  .sale-product-reference,
  .sale-product-brand,
  .sale-product-stock,
  .sale-product-price {
    display: block !important;
  }

  .sale-product-code {
    grid-area: code;
  }

  .sale-product-reference {
    grid-area: ref;
  }

  .sale-product-description {
    grid-area: desc;
  }

  .sale-product-brand {
    grid-area: brand;
  }

  .sale-product-stock {
    grid-area: stock;
  }

  .sale-product-price {
    grid-area: price;
  }

  .sale-product-price-bcv {
    grid-area: bcv;
  }

  .sale-result-qty {
    grid-area: qty;
    position: static !important;
    top: auto !important;
    align-self: start;
    justify-items: stretch;
    font-size: 9px !important;
  }

  .sale-result-add {
    grid-area: add;
    position: static !important;
    top: auto !important;
    align-self: start;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    font-size: 16px !important;
  }

  .sale-result-qty input {
    width: 68px !important;
    min-height: 34px !important;
    padding: 3px 4px !important;
    font-size: 13px !important;
  }

  .sale-result-qty input::-webkit-outer-spin-button,
  .sale-result-qty input::-webkit-inner-spin-button {
    margin: 0 !important;
  }

  .sale-product-result-row small {
    display: inline !important;
    margin-right: 4px;
    font-size: 8.8px !important;
    line-height: 1.1 !important;
  }

  .sale-product-result-row strong {
    display: inline !important;
    font-size: 11.2px !important;
    line-height: 1.15 !important;
    overflow-wrap: anywhere !important;
  }

  .sale-product-description strong {
    display: block !important;
    font-size: 12.4px !important;
    line-height: 1.12 !important;
  }

  .sale-product-result-row em {
    margin-top: 2px !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
  }

  .sale-product-price strong,
  .sale-product-price-bcv strong {
    font-size: 11px !important;
    white-space: normal !important;
  }

  .smart-results-meta {
    padding: 7px 8px !important;
    font-size: 11px !important;
    line-height: 1.18 !important;
  }
}

/* Densidad global de trabajo: menos cabecera y mas area util en todos los modulos. */
.app-shell .topbar {
  min-height: 64px !important;
  padding-top: calc(6px + env(safe-area-inset-top)) !important;
  padding-bottom: 6px !important;
}

.content {
  padding: 14px 18px 18px !important;
}

.view.active {
  gap: 10px !important;
}

.view-title {
  gap: 2px !important;
}

.view-title span {
  font-size: 10px !important;
  line-height: 1.1 !important;
}

.view-title h2 {
  font-size: clamp(28px, 2.8vw, 36px) !important;
  line-height: 0.98 !important;
}

.view-toolbar,
.products-toolbar,
.receiving-toolbar {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: flex-end !important;
  gap: 8px 10px !important;
  min-width: 0 !important;
}

.view-toolbar > .view-title,
.products-toolbar > .view-title,
.receiving-toolbar > .receiving-title {
  flex: 0 0 auto !important;
}

.view-toolbar .product-subtabs,
.products-toolbar .product-subtabs,
.receiving-toolbar .inventory-mode-tabs,
.cash-toolbar .cash-tabs {
  flex: 1 1 520px !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.cash-toolbar {
  align-items: center !important;
}

.cash-toolbar .cash-month-head {
  flex: 0 1 310px !important;
  margin: 0 !important;
}

.cash-toolbar .cash-month-head h3 {
  font-size: 16px !important;
  line-height: 1 !important;
}

.panel,
.module-card,
.metric {
  border-radius: 8px !important;
}

.panel {
  padding: 12px !important;
}

.section-head {
  gap: 8px !important;
  margin-bottom: 8px !important;
}

.section-head h3,
.embedded-section-head h3 {
  font-size: 20px !important;
  line-height: 1.05 !important;
}

.section-head p,
.muted {
  font-size: 12px !important;
  line-height: 1.2 !important;
}

.metrics-grid,
.module-grid,
.dashboard-day-summary-grid,
.dashboard-analytics-grid,
.cash-arqueo-grid,
.dashboard-sale-summary-grid,
.sales-history-grid {
  gap: 8px !important;
}

.metric {
  padding: 12px !important;
  min-height: 0 !important;
}

.metric span,
.module-card span {
  font-size: 11px !important;
  line-height: 1.1 !important;
}

.metric strong,
.module-card strong {
  margin-top: 4px !important;
  font-size: clamp(23px, 2.2vw, 32px) !important;
  line-height: 1 !important;
}

.metric small {
  margin-top: 5px !important;
  font-size: 11px !important;
  line-height: 1.18 !important;
}

.module-card {
  min-height: 78px !important;
  padding: 12px !important;
}

.dashboard-sales-metrics .metric {
  gap: 4px !important;
}

.dashboard-sales-metrics .metric strong {
  font-size: clamp(25px, 2.3vw, 36px) !important;
}

.dashboard-detail-panel,
.dashboard-day-summary-panel,
.dashboard-results-panel,
.critical-panel,
.sale-product-box,
.sale-form-section,
.sale-items,
.totals-box {
  gap: 10px !important;
}

.dashboard-day-summary-card,
.dashboard-sale-card,
.dashboard-insight-row {
  padding: 10px !important;
}

.product-subtabs,
.inventory-mode-tabs,
.cash-tabs {
  gap: 6px !important;
  padding: 0 !important;
}

.product-subtab,
.inventory-mode-tabs .module-tab,
.cash-tab {
  min-height: 34px !important;
  padding: 7px 11px !important;
  font-size: 13px !important;
  border-radius: 8px !important;
}

.cash-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.stacked-form {
  gap: 8px !important;
}

.split-layout,
.sales-layout,
.form-grid,
.bulk-actions,
.sale-external-grid,
.delivery-charge-controls {
  gap: 8px !important;
}

.stacked-form label,
.bulk-actions label,
.form-grid label {
  gap: 4px !important;
}

.app-shell input,
.app-shell select,
.app-shell textarea,
.app-shell .btn {
  border-radius: 7px !important;
}

.app-shell input,
.app-shell select {
  min-height: 42px !important;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

.app-shell textarea {
  min-height: 78px !important;
}

.app-shell .btn {
  min-height: 38px !important;
  padding: 8px 12px !important;
}

.sale-recovery-banner {
  margin-bottom: 8px !important;
  padding: 10px !important;
}

.sale-steps-indicator {
  margin-bottom: 10px !important;
  padding: 8px 12px !important;
  border-radius: 8px !important;
}

.step-indicator {
  gap: 7px !important;
}

.step-number {
  width: 24px !important;
  height: 24px !important;
  font-size: 12px !important;
}

.step-label {
  font-size: 12px !important;
}

.step-connector {
  margin: 0 8px !important;
}

.step-actions {
  margin-top: 12px !important;
  padding-top: 10px !important;
}

.form-step-title {
  margin-bottom: 8px !important;
}

.sale-product-box {
  padding: 10px !important;
}

.sale-product-results-wrap,
.quotation-results {
  max-height: min(74dvh, 820px) !important;
}

.quotation-layout {
  gap: 10px !important;
  min-height: calc(100dvh - 108px) !important;
}

.quotation-search-panel,
.quotation-basket-panel {
  max-height: calc(100dvh - 84px) !important;
}

.quotation-filter-row {
  gap: 6px !important;
  margin-bottom: 8px !important;
}

.quotation-filter-row select,
.quotation-filter-row input,
.quotation-clear-button,
.quotation-search-input {
  min-height: 44px !important;
}

.quotation-external-form {
  margin-bottom: 8px !important;
  padding: 9px !important;
}

.quotation-basket-panel .section-head,
.quotation-search-panel .section-head {
  margin-bottom: 6px !important;
}

.cash-daily-table th,
.cash-daily-table td,
.bulk-table th,
.bulk-table td {
  padding-top: 7px !important;
  padding-bottom: 7px !important;
}

.empty-state {
  padding: 12px !important;
}

.compact-state {
  padding: 10px !important;
}

@media (max-width: 980px) {
  .content {
    padding: 12px 10px calc(18px + env(safe-area-inset-bottom)) !important;
  }

  .view-toolbar,
  .products-toolbar,
  .receiving-toolbar,
  .cash-toolbar {
    align-items: stretch !important;
    gap: 7px !important;
  }

  .view-toolbar > .view-title,
  .products-toolbar > .view-title,
  .receiving-toolbar > .receiving-title,
  .view-toolbar .product-subtabs,
  .products-toolbar .product-subtabs,
  .receiving-toolbar .inventory-mode-tabs,
  .cash-toolbar .cash-month-head,
  .cash-toolbar .cash-tabs {
    flex: 1 1 100% !important;
  }

  .view-title h2 {
    font-size: clamp(26px, 9vw, 36px) !important;
  }

  .metric strong,
  .module-card strong {
    font-size: clamp(24px, 8vw, 34px) !important;
  }

  .cash-metrics,
  .dashboard-sales-metrics {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .sale-steps-indicator {
    padding: 8px !important;
  }
}

/* Cantidades con flechas propias: Safari iPhone no muestra los spinners nativos. */
.quantity-stepper-field {
  display: grid !important;
  align-self: center;
  gap: 3px;
  min-width: 0;
  margin: 0;
  color: var(--soft);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.quantity-stepper-field > span:first-child {
  display: block;
  color: var(--soft);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.quantity-stepper-box {
  position: relative;
  display: block;
  min-width: 0;
}

.quantity-stepper-box input[type="number"] {
  width: 100%;
  min-height: 38px;
  margin: 0;
  padding: 4px 30px 4px 8px !important;
  border-left-width: 1px !important;
  text-align: center;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  appearance: textfield !important;
  -moz-appearance: textfield !important;
  -webkit-appearance: none !important;
}

.quantity-stepper-box input[type="number"]::-webkit-outer-spin-button,
.quantity-stepper-box input[type="number"]::-webkit-inner-spin-button {
  margin: 0 !important;
  opacity: 0 !important;
  -webkit-appearance: none !important;
}

.quantity-stepper-buttons {
  position: absolute;
  top: 4px;
  right: 4px;
  bottom: 4px;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  width: 22px;
}

.quantity-stepper-button {
  display: grid;
  place-items: center;
  width: 22px;
  min-width: 0;
  min-height: 0;
  height: auto;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 4px;
  color: var(--ink);
  background: #f8fafc;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.quantity-stepper-button:active {
  color: #ffffff;
  border-color: var(--green);
  background: var(--green);
}

.quantity-stepper-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.quotation-add-controls {
  display: grid !important;
  grid-template-columns: 68px 42px;
  gap: 6px;
  align-items: end;
  justify-content: start;
  min-width: 0;
}

.quotation-result-card .quotation-add-controls {
  grid-column: span 2;
}

.quotation-add-controls .quotation-add-btn {
  align-self: end !important;
  justify-self: center !important;
  width: 42px !important;
  min-width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  border-radius: 999px !important;
}

.quotation-external-grid .quantity-stepper-field {
  align-self: end;
}

.quotation-qty-compact .quantity-stepper-box input,
.sale-result-qty .quantity-stepper-box input {
  width: 76px;
}

@media (max-width: 980px) {
  .quotation-search-panel {
    max-height: none !important;
    overflow: visible !important;
  }

  .quotation-results {
    max-height: min(68dvh, 660px) !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
    padding-bottom: max(260px, calc(34dvh + env(safe-area-inset-bottom))) !important;
    scroll-padding-bottom: max(260px, calc(34dvh + env(safe-area-inset-bottom))) !important;
  }

  .quotation-result-card .quotation-add-controls {
    grid-column: 1 / -1 !important;
    grid-template-columns: 118px 58px;
    gap: 10px;
    justify-content: center;
    align-items: end;
    padding-top: 2px;
  }

  .quotation-add-quantity .quantity-stepper-box input {
    min-height: 54px !important;
    padding-right: 36px !important;
    font-size: 16px !important;
  }

  .quotation-add-controls .quotation-add-btn {
    width: 58px !important;
    min-width: 58px !important;
    height: 58px !important;
    min-height: 58px !important;
    border-radius: 12px !important;
    font-size: 22px !important;
  }

  .quantity-stepper-buttons {
    width: 26px;
  }

  .quantity-stepper-button {
    width: 26px;
    font-size: 9px;
  }

  .sale-result-qty .quantity-stepper-box input {
    width: 76px !important;
    min-height: 38px !important;
  }
}

@media (max-width: 760px) {
  .quotation-results {
    max-height: min(62dvh, 600px) !important;
    padding-bottom: max(360px, calc(48dvh + env(safe-area-inset-bottom))) !important;
    scroll-padding-bottom: max(360px, calc(48dvh + env(safe-area-inset-bottom))) !important;
  }

  .quotation-basket-panel {
    margin-top: 8px !important;
  }
}

.product-filter-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 760px) {
  .product-filter-strip {
    grid-template-columns: 1fr;
  }
}

.mercadolibre-layout {
  display: grid;
  gap: 18px;
}

.mercadolibre-status-panel .section-head {
  align-items: flex-start;
}

.mercadolibre-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.mercadolibre-metrics div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.mercadolibre-metrics span,
.mercadolibre-meta span,
.mercadolibre-table small,
.mercadolibre-table td span {
  color: var(--muted);
}

.mercadolibre-metrics strong {
  color: var(--green);
  font-size: 1.32rem;
}

.mercadolibre-control-panel {
  display: grid;
  gap: 14px;
}

.mercadolibre-goal-grid,
.mercadolibre-control-grid,
.mercadolibre-control-bottom {
  display: grid;
  gap: 10px;
}

.mercadolibre-goal-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mercadolibre-control-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.mercadolibre-control-bottom {
  grid-template-columns: minmax(240px, 0.8fr) minmax(320px, 1.2fr);
  align-items: start;
}

.mercadolibre-goal-card,
.mercadolibre-stat-card,
.mercadolibre-goals-box,
.mercadolibre-history-box {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mercadolibre-goal-card {
  display: grid;
  gap: 8px;
  border-color: rgba(22, 131, 90, 0.22);
}

.mercadolibre-goal-card > div:first-child,
.mercadolibre-stat-card {
  display: grid;
  gap: 4px;
}

.mercadolibre-goal-card span,
.mercadolibre-stat-card span,
.mercadolibre-goal-card small,
.mercadolibre-stat-card small,
.mercadolibre-goals-form small,
.mercadolibre-readonly-note {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.mercadolibre-goal-card strong,
.mercadolibre-stat-card strong {
  color: var(--green);
  font-size: 1.25rem;
  line-height: 1.1;
}

.mercadolibre-progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf3;
}

.mercadolibre-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.mercadolibre-stat-warning {
  border-color: rgba(154, 91, 0, 0.28);
  background: #fffaf0;
}

.mercadolibre-stat-warning strong {
  color: #9a5b00;
}

.mercadolibre-stat-danger {
  border-color: rgba(200, 51, 46, 0.26);
  background: #fff5f5;
}

.mercadolibre-stat-danger strong {
  color: var(--red);
}

.mercadolibre-goals-box,
.mercadolibre-history-box {
  display: grid;
  gap: 10px;
}

.mercadolibre-goals-box h4,
.mercadolibre-history-box h4 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.mercadolibre-goals-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr)) minmax(126px, auto);
  gap: 10px;
  align-items: end;
}

.mercadolibre-goals-form label {
  display: grid;
  gap: 5px;
}

.mercadolibre-goals-form input {
  min-width: 0;
}

.mercadolibre-goals-form small {
  grid-column: 1 / -1;
}

.mercadolibre-readonly-note {
  align-self: center;
  justify-self: start;
}

.mercadolibre-responsible-box {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.mercadolibre-responsible-box h4 {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: 1rem;
}

.mercadolibre-responsible-box p {
  margin: 0;
}

.mercadolibre-unassigned-row {
  background: #fffaf0;
}

.mercadolibre-attention-row {
  background: #fff5f5;
}

.ml-review {
  display: inline-flex !important;
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.ml-review-ok {
  color: var(--green) !important;
  border-color: rgba(22, 131, 90, 0.22);
  background: #effaf5;
}

.ml-review-warning {
  color: #9a5b00 !important;
  border-color: rgba(154, 91, 0, 0.28);
  background: #fff7e8;
}

.ml-review-danger {
  color: var(--red) !important;
  border-color: rgba(200, 51, 46, 0.26);
  background: #fff0f0;
}

.mercadolibre-responsible-select {
  min-width: 150px;
  max-width: 220px;
}

.mercadolibre-target-date {
  width: 148px;
  min-width: 132px;
}

.mercadolibre-link-control {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) auto;
  gap: 6px;
  min-width: 235px;
  margin-top: 7px;
}

.mercadolibre-link-control input,
.mercadolibre-link-control .btn {
  min-height: 36px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.mercadolibre-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 0.86rem;
}

.mercadolibre-snapshot-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.mercadolibre-snapshot-box summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--ink);
  font-weight: 800;
}

.mercadolibre-snapshot-form {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.mercadolibre-snapshot-form textarea {
  min-height: 92px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.35;
}

.mercadolibre-table td strong,
.mercadolibre-table td span,
.mercadolibre-table td small,
.mercadolibre-table td a {
  display: block;
}

.mercadolibre-table td a {
  margin-top: 5px;
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.ml-status {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #eef2f6;
  color: var(--soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.ml-status-active,
.ml-linked {
  color: var(--green);
}

.ml-status-paused {
  color: #9a5b00;
  background: #fff7e8;
}

.ml-status-closed,
.ml-status-none,
.ml-unlinked {
  color: var(--red);
}

@media (max-width: 960px) {
  .mercadolibre-goal-grid,
  .mercadolibre-control-bottom {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .mercadolibre-goals-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .mercadolibre-control-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.pending-cash-panel,
.pending-cash-collect-panel {
  margin-top: 14px;
}

.pending-cash-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.pending-cash-row {
  display: grid;
  grid-template-columns: 76px minmax(220px, 0.8fr) minmax(360px, 1.45fr) minmax(245px, 0.75fr) minmax(290px, auto);
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.pending-cash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
  min-width: 0;
}

.pending-cash-edit-panel {
  margin-top: 14px;
}

.proforma-product-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.proforma-search-results,
.proforma-edit-items {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.proforma-search-results {
  max-height: 340px;
  margin-bottom: 14px;
}

.proforma-search-row,
.proforma-edit-row {
  display: grid;
  min-width: 900px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.proforma-search-row:last-child,
.proforma-edit-row:last-child {
  border-bottom: 0;
}

.proforma-search-row {
  grid-template-columns: minmax(280px, 1.5fr) 130px 95px 110px 74px auto;
}

.proforma-edit-row {
  grid-template-columns: minmax(320px, 1.7fr) 110px 130px 125px auto;
}

.proforma-search-row > div,
.proforma-edit-row > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.proforma-search-row span,
.proforma-edit-row span,
.proforma-edit-row small {
  overflow-wrap: anywhere;
}

.proforma-edit-head {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f6f8fa;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.proforma-edit-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 14px;
}

.proforma-edit-footer span {
  margin-right: auto;
  color: var(--muted);
  font-weight: 700;
}

.pending-cash-row:last-child {
  border-bottom: 0;
}

.pending-cash-row.selected {
  background: #f1faf7;
  box-shadow: inset 4px 0 0 var(--green);
}

.pending-cash-number,
.pending-cash-total,
.pending-cash-customer,
.pending-cash-items {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.pending-cash-number small,
.pending-cash-total small,
.pending-cash-customer small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.pending-cash-number strong,
.pending-cash-total strong {
  font-size: 1.05rem;
}

.pending-cash-total strong {
  color: var(--red);
}

.pending-cash-customer span,
.pending-cash-items span {
  overflow-wrap: anywhere;
}

.pending-cash-items span {
  display: block;
  font-size: 0.82rem;
  line-height: 1.25;
}

.pending-cash-items span:not(:first-child) {
  color: var(--muted);
}

.cash-collection-total {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.cash-collection-total span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  background: #fff;
}

.cash-collection-total strong {
  color: var(--red);
}

@media (max-width: 900px) {
  .pending-cash-row {
    grid-template-columns: 70px minmax(0, 1fr) auto;
  }

  .pending-cash-items {
    grid-column: 1 / -1;
  }

  .pending-cash-total {
    grid-column: 2;
  }

  .pending-cash-actions {
    grid-column: 3;
  }
}

@media (max-width: 560px) {
  .pending-cash-row {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .pending-cash-items,
  .pending-cash-total,
  .pending-cash-actions {
    grid-column: 1 / -1;
  }

  .pending-cash-actions,
  .pending-cash-actions .btn {
    width: 100%;
  }

  .proforma-product-search {
    grid-template-columns: 1fr;
  }

  .proforma-edit-footer {
    align-items: stretch;
  }

  .proforma-edit-footer > * {
    width: 100%;
  }

  .cash-collection-total {
    grid-template-columns: 1fr;
  }
}

.top-nav-item,
.nav-item,
.cash-tab {
  position: relative;
}

.proforma-count-badge,
.nav-count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #ef1117;
  box-shadow: 0 4px 12px rgba(133, 15, 20, 0.28);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.proforma-count-badge[hidden],
.nav-count-badge[hidden] {
  display: none !important;
}

.proforma-count-badge {
  position: absolute;
  top: -9px;
  right: -8px;
}

.nav-count-badge {
  position: absolute;
  top: 4px;
  right: 4px;
}

.proforma-arrival-notice {
  position: fixed;
  right: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 10050;
  display: grid;
  width: min(390px, calc(100vw - 28px));
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid #b80e14;
  border-radius: 8px;
  color: #fff;
  background: #ef1117;
  box-shadow: 0 18px 48px rgba(62, 8, 11, 0.3);
  text-align: left;
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.proforma-arrival-notice.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.proforma-arrival-notice strong {
  font-size: 1rem;
}

.proforma-arrival-notice span {
  line-height: 1.35;
}

.proforma-arrival-notice small {
  margin-top: 4px;
  color: #fff;
  font-weight: 900;
  text-decoration: underline;
}

@media (max-width: 640px) {
  .proforma-arrival-notice {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .nav-count-badge {
    top: 2px;
    right: 2px;
  }
}

/* Compact administration workspace: users stay collapsed until they are needed. */
.compact-user-admin {
  margin-top: 0;
  padding: 14px;
}

.compact-user-admin > .section-head {
  align-items: center;
  margin-bottom: 6px;
}

.compact-user-admin > .section-head h3 {
  margin-bottom: 0;
}

.compact-user-admin .user-permission-help {
  max-width: none;
  margin-top: 2px;
  font-size: 12px;
}

.user-admin-summary.user-admin-summary-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 10px;
}

.user-admin-summary.user-admin-summary-compact > div {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  padding: 5px 9px;
  border-radius: 6px;
}

.user-admin-summary.user-admin-summary-compact strong,
.user-admin-summary.user-admin-summary-compact span {
  display: inline;
  line-height: 1.1;
}

.user-admin-summary.user-admin-summary-compact strong {
  font-size: 16px;
}

.user-admin-summary.user-admin-summary-compact span {
  font-size: 10px;
}

.user-create-disclosure,
.user-admin-card {
  display: block !important;
  overflow: hidden;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 !important;
  background: #fff;
}

.user-create-disclosure {
  margin-bottom: 8px;
  border-color: rgba(239, 17, 23, 0.24);
}

.user-create-disclosure > summary,
.user-admin-card > summary {
  position: relative;
  cursor: pointer;
  list-style: none;
}

.user-create-disclosure > summary::-webkit-details-marker,
.user-admin-card > summary::-webkit-details-marker {
  display: none;
}

.user-create-disclosure > summary::after,
.user-admin-card > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--soft);
  border-bottom: 2px solid var(--soft);
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.user-create-disclosure[open] > summary::after,
.user-admin-card[open] > summary::after {
  transform: rotate(225deg);
}

.user-create-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  gap: 12px;
  padding: 8px 12px;
  color: var(--ink);
  background: #fff8f8;
}

.user-create-summary > span,
.user-admin-identity {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.user-create-summary strong,
.user-admin-identity strong {
  color: var(--ink);
  font-size: 14px;
}

.user-create-summary small,
.user-admin-identity small {
  color: var(--soft);
  font-size: 11px;
  font-weight: 800;
}

.user-create-grid.user-create-grid-compact,
.user-admin-card-body {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: 9px;
  margin: 0;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.user-admin-list {
  gap: 6px;
}

.user-admin-card-summary {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(220px, 1.25fr) minmax(220px, 1.7fr) auto;
  align-items: center;
  min-height: 48px;
  gap: 12px;
  padding: 7px 12px;
  background: #f8fbff;
}

.user-admin-email,
.user-admin-permission-summary {
  min-width: 0;
  overflow: hidden;
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-admin-metadata {
  display: grid;
  align-content: center;
  min-width: 0;
  gap: 2px;
  color: var(--soft);
  font-weight: 800;
}

.user-admin-metadata small {
  overflow-wrap: anywhere;
}

.user-create-grid.user-create-grid-compact .user-actions-picker,
.user-admin-card-body .user-actions-picker,
.user-admin-card-actions {
  grid-column: 1 / -1;
}

.user-create-grid.user-create-grid-compact .user-actions-picker,
.user-admin-card-body .user-actions-picker {
  padding: 10px 12px;
  border-radius: 7px;
}

.user-create-grid.user-create-grid-compact .user-actions-picker > summary,
.user-admin-card-body .user-actions-picker > summary {
  font-size: 14px;
}

.user-admin-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.user-admin-card-actions .btn {
  min-height: 38px;
}

@media (max-width: 1100px) {
  .user-create-grid.user-create-grid-compact,
  .user-admin-card-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-admin-card-summary {
    grid-template-columns: minmax(170px, 1fr) minmax(220px, 1.3fr) auto;
  }

  .user-admin-permission-summary {
    display: none;
  }
}

@media (max-width: 680px) {
  .compact-user-admin {
    padding: 10px;
  }

  .compact-user-admin .section-head {
    align-items: flex-start;
  }

  .user-admin-summary.user-admin-summary-compact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-admin-summary.user-admin-summary-compact > div {
    justify-content: center;
  }

  .user-create-grid.user-create-grid-compact,
  .user-admin-card-body {
    grid-template-columns: minmax(0, 1fr);
    padding: 10px;
  }

  .user-admin-card-summary {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px 10px;
  }

  .user-admin-email,
  .user-admin-permission-summary {
    display: none;
  }

  .user-admin-card-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .user-admin-card-actions .btn {
    width: 100%;
  }
}

/* Passive data refreshes must not replay entrance effects or flash the workspace. */
html.app-passive-refresh .view.active,
html.app-passive-refresh .view.active > *,
html.app-passive-refresh .view.active *,
html.app-passive-refresh .panel,
html.app-passive-refresh .metric,
html.app-passive-refresh .module-card,
html.app-passive-refresh .pending-cash-row {
  animation: none !important;
  transition: none !important;
}

/* Operational views update in place; entrance animations made live data look like a page reload. */
.view.active,
.view.active > * {
  animation: none !important;
}

.proforma-price-triplet {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 660px);
}

.proforma-price-triplet > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.proforma-price-triplet small {
  color: var(--soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.proforma-price-triplet strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 16px;
}

.proforma-price-triplet > span:nth-child(1) strong {
  color: var(--red);
}

.proforma-price-triplet > span:nth-child(2) strong {
  color: #245fba;
}

.proforma-price-triplet.compact {
  grid-template-columns: 1fr;
  gap: 5px;
}

.proforma-price-triplet.compact > span {
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
}

.proforma-price-triplet.compact strong {
  font-size: 14px;
}

.pending-cash-total {
  min-width: 0;
}

.proforma-edit-items-priced .proforma-edit-row {
  grid-template-columns: minmax(260px, 2fr) minmax(90px, .55fr) minmax(110px, .7fr) minmax(250px, 1.45fr) auto;
}

.proforma-edit-footer .proforma-price-triplet {
  margin-left: auto;
}

.pending-cash-collect-panel .section-head > div {
  display: grid;
  width: min(100%, 900px);
  gap: 8px;
}

@media (min-width: 901px) and (max-width: 1350px) {
  .pending-cash-row {
    grid-template-columns: 76px minmax(210px, 0.8fr) minmax(300px, 1.35fr) minmax(245px, 0.75fr);
  }

  .pending-cash-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 900px) {
  .proforma-price-triplet,
  .proforma-price-triplet.compact {
    grid-template-columns: 1fr;
  }

  .proforma-edit-items-priced .proforma-edit-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .proforma-edit-items-priced .proforma-edit-head {
    display: none;
  }

  .pending-cash-total {
    min-width: 0;
  }

  .proforma-edit-footer .proforma-price-triplet {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Final invoice-action layout overrides older responsive rules. */
.sales-history-actions > .sale-action-menu {
  width: 100%;
  min-width: 0;
}

.sales-history-actions > .sale-management-menu {
  grid-column: 1 / -1;
}

.sales-history-actions .sale-action-menu > summary {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: center;
}

.sales-history-actions .sale-action-menu-body {
  min-width: 0;
}

@media (max-width: 760px) {
  .dashboard-period-total strong {
    font-size: 1.65rem;
  }

  .dashboard-period-products .dashboard-product-line {
    grid-template-columns: minmax(0, 1fr);
  }

  .receive-smart-panel .bulk-table td[data-label="Descripcion"] {
    width: 100%;
    min-width: 0;
  }

  .receive-description-editor {
    grid-template-columns: minmax(0, 1fr) 32px;
  }

  .receive-description-editor textarea {
    min-height: 72px;
  }
}

/* Cashea: cobro inicial y conciliacion */
.cashea-payment-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #b9d9cf;
  border-left: 5px solid #15946f;
  border-radius: 8px;
  background: #f5fbf9;
}

.payment-methods-form {
  display: grid;
  gap: 16px;
}

.vehicle-data-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 760px) {
  .vehicle-data-grid {
    grid-template-columns: 1fr;
  }
}

.payment-method-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.payment-method-setting {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.payment-method-setting > span {
  display: grid;
  gap: 4px;
}

.payment-method-setting small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.payment-method-setting input {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

.cashea-payment-heading,
.cashea-payment-heading > div,
.cashea-charge-callout,
.cashea-payment-summary > span,
.cashea-sales-table td,
.cashea-bottom-grid {
  min-width: 0;
}

.cashea-payment-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cashea-payment-heading strong,
.cashea-payment-heading span {
  display: block;
}

.cashea-payment-heading strong { font-size: 18px; }
.cashea-payment-heading span { color: var(--soft); }

.cashea-payment-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.cashea-charge-callout {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid #ffb0b0;
  border-radius: 7px;
  background: #fff;
}

.cashea-charge-callout span,
.cashea-charge-callout b,
.cashea-charge-callout small { display: block; }
.cashea-charge-callout span { color: var(--soft); font-size: 12px; font-weight: 800; }
.cashea-charge-callout b { color: var(--ink); font-size: 14px; }
.cashea-charge-callout > strong { color: var(--red); font-size: 24px; white-space: nowrap; }
.cashea-charge-callout > small { color: var(--soft); font-size: 15px; font-weight: 800; white-space: nowrap; }

.cashea-payment-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.cashea-payment-summary > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  border: 1px solid #d9e3e8;
  border-radius: 6px;
  background: #fff;
}

.cashea-payment-summary small,
.cashea-payment-summary em { color: var(--soft); font-size: 11px; font-style: normal; }
.cashea-payment-summary b { font-size: 15px; overflow-wrap: anywhere; }
.cashea-negative { color: #b42318 !important; }
.cashea-confirm-summary { margin-top: 10px; }
.cashea-confirm-summary > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin-top: 7px; }

.cashea-toolbar { align-items: end; }
.cashea-period-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(145px, 1fr)) auto;
  gap: 8px;
  align-items: end;
}

.cashea-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.cashea-kpis article {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 13px;
  border: 1px solid #d8e1e6;
  border-radius: 8px;
  background: #fff;
}

.cashea-kpis small,
.cashea-kpis span { color: var(--soft); }
.cashea-kpis small { font-size: 11px; font-weight: 800; text-transform: uppercase; }
.cashea-kpis strong { color: var(--red); font-size: 22px; overflow-wrap: anywhere; }
.cashea-kpis span { font-size: 12px; }

.cashea-settlement-form,
.cashea-sales-panel { margin-bottom: 12px; }

.cashea-settlement-fields {
  display: grid;
  grid-template-columns: minmax(160px, .65fr) minmax(210px, 1fr) minmax(210px, 1.25fr) auto;
  gap: 10px;
  align-items: end;
}

.cashea-selection-total { color: var(--red); }
.cashea-sales-table { min-width: 1180px; }
.cashea-sales-table td { vertical-align: top; }
.cashea-sales-table td strong,
.cashea-sales-table td small { display: block; }
.cashea-sales-table td small { margin-top: 3px; color: var(--soft); max-width: 340px; }
.cashea-sales-table tr.selected { background: #eef9f5; }
.cashea-sales-table input[type="number"] { min-width: 110px; }

.cashea-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, .65fr);
  gap: 12px;
}

@media (max-width: 1100px) {
  .cashea-payment-controls,
  .cashea-payment-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cashea-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cashea-period-controls,
  .cashea-settlement-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cashea-bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .cashea-payment-controls,
  .cashea-payment-summary,
  .cashea-kpis,
  .cashea-period-controls,
  .cashea-settlement-fields { grid-template-columns: 1fr; }
  .cashea-charge-callout { grid-template-columns: 1fr; gap: 5px; }
  .cashea-payment-heading { align-items: flex-start; }
  .cashea-charge-callout > strong { font-size: 27px; }
  .cashea-confirm-summary > div { grid-template-columns: 1fr; }
}
