:root {
  --primary: #f59e0b;
  --primary-hover: #d97706;
  --primary-glow: rgba(245, 158, 11, 0.25);
  --bg: #090d16;
  --bg-sidebar: #0f172a;
  --card-bg: #131b2e;
  --card-hover: #1e293b;
  --card-border: #1e293b;
  --card-border-light: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-green: #10b981;
  --accent-blue: #38bdf8;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;
  --accent-orange: #f97316;
  --sidebar-w: 250px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-scale: 1;
}

html[data-font-size="large"] {
  --font-scale: 1.20;
  font-size: 17px;
}

html[data-font-size="xlarge"] {
  --font-scale: 1.38;
  font-size: 19.5px;
}

html[data-font-size="large"] body {
  font-size: 15.5px;
}
html[data-font-size="xlarge"] body {
  font-size: 17.5px;
}

html[data-font-size="large"] table td,
html[data-font-size="large"] table th,
html[data-font-size="large"] input,
html[data-font-size="large"] select,
html[data-font-size="large"] textarea,
html[data-font-size="large"] .btn,
html[data-font-size="large"] .badge,
html[data-font-size="large"] .nav-item,
html[data-font-size="large"] .cart-dock,
html[data-font-size="large"] .cart-item-row,
html[data-font-size="large"] .panel-title {
  font-size: 118% !important;
}

html[data-font-size="xlarge"] table td,
html[data-font-size="xlarge"] table th,
html[data-font-size="xlarge"] input,
html[data-font-size="xlarge"] select,
html[data-font-size="xlarge"] textarea,
html[data-font-size="xlarge"] .btn,
html[data-font-size="xlarge"] .badge,
html[data-font-size="xlarge"] .nav-item,
html[data-font-size="xlarge"] .cart-dock,
html[data-font-size="xlarge"] .cart-item-row,
html[data-font-size="xlarge"] .panel-title {
  font-size: 136% !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  max-width: 100vw;
  padding-bottom: 70px; /* Espacio para bottom bar en móvil */
}

@media (min-width: 901px) {
  body {
    padding-bottom: 0;
  }
}

/* Sidebar Desktop */
.sidebar {
  width: var(--sidebar-w);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--card-border);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 12px var(--primary-glow);
}

.brand-text h1 {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}

.brand-text span {
  font-size: 10.5px;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
}

.nav-menu {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  padding: 10px 8px 3px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05));
  color: var(--primary);
  border-color: rgba(245, 158, 11, 0.3);
  font-weight: 700;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-shortcut {
  font-size: 10px;
  background: #1e293b;
  color: #94a3b8;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 600;
  border: 1px solid #334155;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--card-border);
  background: rgba(15, 23, 42, 0.6);
  font-size: 11.5px;
}

/* Barra de Navegación Inferior en Móviles */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: #0f172a;
  border-top: 1px solid var(--card-border);
  z-index: 90;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  gap: 3px;
  transition: color 0.15s;
  user-select: none;
}

.bottom-nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.bottom-nav-icon {
  font-size: 19px;
}

.sidebar {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

/* App Container: En desktop ocupa exactamente el ancho disponible descontando el sidebar */
.app-container {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  max-width: calc(100% - var(--sidebar-w));
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow-x: hidden;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .app-container {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

.btn-sidebar-toggle {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-sidebar-toggle:hover {
  background: #334155;
  color: #38bdf8;
  border-color: #38bdf8;
}

@media (max-width: 900px) {
  .app-container {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
  }
}

/* Top Bar */
.top-bar {
  height: 60px;
  background: rgba(19, 27, 46, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  gap: 10px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.store-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.rates-pill-group {
  display: flex;
  align-items: center;
  background: #090d16;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.rate-item {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
}

.rate-item.official {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34d399;
  font-weight: 700;
}

.rate-item.parallel {
  color: #94a3b8;
}

.cashier-status-pill {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.cashier-status-pill.closed {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  flex-shrink: 0;
}

/* Cabecera Responsive: Se ven TODOS los elementos sin esconder nada */
@media (max-width: 768px) {
  .top-bar {
    height: 52px;
    padding: 0 10px;
    gap: 6px;
  }
  .store-badge {
    font-size: 12px;
    max-width: 130px;
  }
  .rates-pill-group {
    padding: 2px;
    gap: 3px;
  }
  .rate-item {
    padding: 3px 6px;
    font-size: 11px;
    gap: 3px;
  }
  .cashier-status-pill {
    padding: 3px 8px;
    font-size: 11px;
    gap: 5px;
    max-width: 130px;
  }
}

@media (max-width: 480px) {
  .top-bar {
    height: 48px;
    padding: 0 6px;
    gap: 4px;
  }
  .top-bar-left {
    flex: 0 0 auto;
  }
  .store-badge span:last-child {
    display: none; /* En pantallas diminutas ocultar texto largo del nombre y dejar icono */
  }
  .top-bar-right {
    flex: 1;
    justify-content: flex-end;
    gap: 4px;
  }
  .rates-pill-group {
    padding: 2px;
    gap: 2px;
  }
  .rate-item {
    padding: 2px 5px;
    font-size: 10px;
  }
  .cashier-status-pill {
    padding: 2px 6px;
    font-size: 10px;
    max-width: 95px;
  }
  .cashier-status-pill #shift-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Vista Principal */
.main-view {
  padding: 16px;
  flex: 1;
  max-width: 100%;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .main-view {
    padding: 12px 10px;
  }
}

/* Métricas */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.metric-val {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.metric-sub {
  font-size: 11px;
  font-weight: 600;
}

/* Botones & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-weight: 700;
}

.btn-secondary {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.28);
  transition: all 0.15s ease;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.35);
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}

.btn-delete-subtle {
  background: #182234;
  color: #94a3b8;
  border: 1px solid #283548;
  transition: all 0.15s ease;
}

.btn-delete-subtle:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11.5px;
  border-radius: var(--radius-sm);
}

input, select, textarea {
  background: #090d16;
  border: 1px solid #334155;
  color: #fff;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Tarjetas y Contenedores */
.panel-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  width: 100%;
}

.panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.5px;
  min-width: 580px; /* Para permitir scroll suave en móvil */
}

th {
  background: #0d1322;
  padding: 10px 12px;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  vertical-align: middle;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-dept {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.badge-heavy {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.badge-counter {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

.badge-stock {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.badge-low {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Modales: Nivel superior garantizado para que ningún formulario quede oculto o 'fantasma' */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000; /* Siempre encima de toda la interfaz */
  padding: 14px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  isolation: isolate;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}

.modal-overlay.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #0f172a !important;
  color: #f8fafc !important;
  border: 1.5px solid #334155;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95);
  position: relative;
  z-index: 1002;
  isolation: isolate;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 10px;
}

/* Layout del POS y Carrito (Mostrador) - Perfectamente encuadrado sin desborde a la derecha */
.pos-container {
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1200px) {
  .pos-container {
    grid-template-columns: 1fr 350px;
    gap: 12px;
  }
}

@media (max-width: 960px) {
  .pos-container {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .cart-dock {
    display: none !important; /* Ocultar dock desktop en móvil */
  }
}

.cart-dock {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  height: fit-content;
  position: sticky;
  top: 76px;
  box-sizing: border-box;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

/* Control de Accesibilidad / Tamaño de Letra */
.font-size-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 3px 8px;
}

.btn-font-scale {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1.2;
  transition: all 0.2s;
}

.btn-font-scale:hover,
.btn-font-scale.active {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
}

/* Miniaturas de Fotos de Productos */
.prod-thumb-mini {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #334155;
  background: #1e293b;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.prod-thumb-mini:hover {
  transform: scale(1.1);
  border-color: var(--primary);
}

/* Botón flotante de carrito en Móvil */
.mobile-cart-float-bar {
  display: none;
}

@media (max-width: 960px) {
  .mobile-cart-float-bar {
    display: flex;
    position: fixed;
    bottom: 70px;
    left: 12px;
    right: 12px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #000;
    font-weight: 900;
    padding: 12px 16px;
    border-radius: 14px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px var(--primary-glow);
    z-index: 85;
    cursor: pointer;
    border: 1px solid #fbbf24;
    transition: transform 0.2s ease;
  }
  .mobile-cart-float-bar:active {
    transform: scale(0.98);
  }
}

/* Contenedor de Inventario con Scrollbar Integrado y Encabezados Fijos */
.inv-table-wrap {
  width: 100%;
  max-height: calc(100vh - 280px);
  min-height: 380px;
  overflow: auto;
  position: relative;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  -webkit-overflow-scrolling: touch;
}

.inv-table-wrap table {
  margin: 0;
  width: 100%;
  min-width: 720px;
}

.inv-table-wrap table th {
  position: sticky;
  top: 0;
  z-index: 15;
  background: #0d1527;
  box-shadow: 0 1px 0 var(--card-border);
}

/* Cierre Z: Grilla de Billetes Compacta y Elegante */
.bills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.bill-card-row {
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: border-color 0.15s ease;
}

.bill-card-row:focus-within {
  border-color: var(--primary);
}

.bill-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-weight: 900;
  font-size: 13.5px;
  padding: 4px 8px;
  border-radius: 6px;
  min-width: 48px;
  text-align: center;
}

.bill-stepper-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bill-step-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.bill-step-btn:hover {
  background: var(--primary);
  color: #000;
}

.bill-input-field {
  width: 52px !important;
  height: 28px !important;
  text-align: center !important;
  padding: 2px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  background: #030712 !important;
  border: 1px solid #334155 !important;
  border-radius: 5px !important;
}

.bill-subtotal-text {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  min-width: 60px;
  text-align: right;
  font-family: var(--font-mono);
}

/* Ficha Técnica de Producto Compacta */
.prod-form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

@media (max-width: 768px) {
  .prod-form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
}

.prod-form-grid .col-span-full {
  grid-column: 1 / -1;
}

.prod-form-grid .col-span-2 {
  grid-column: span 2;
}

.prod-form-grid label {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prod-form-grid input, .prod-form-grid select {
  height: 34px !important;
  padding: 4px 8px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
}

/* Botón Flotante del Carrito en Móviles */
.mobile-cart-bar {
  display: none;
  position: fixed;
  bottom: 68px; /* Arriba del bottom-nav */
  left: 10px;
  right: 10px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  z-index: 85;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  animation: slideUp 0.25s ease;
}

@media (max-width: 960px) {
  .mobile-cart-bar.active {
    display: flex;
  }
}

/* Modal del Carrito Móvil (Drawer) */
.cart-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 105;
  display: none;
  align-items: flex-end;
}

.cart-drawer-overlay.open {
  display: flex;
}

.cart-drawer-content {
  background: #111827;
  border-top: 2px solid var(--primary);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 18px;
  overflow-y: auto;
}

/* Input de Cantidad en Carrito */
.cart-qty-input {
  width: 58px !important;
  text-align: center;
  padding: 4px !important;
  font-weight: 800;
  font-size: 13.5px;
  border-color: #475569 !important;
  background: #090d16 !important;
}

/* Patio y Despacho Responsive */
.dispatch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
}

@media (max-width: 768px) {
  .dispatch-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
}

/* Ítems de Despacho con Unidades Alineadas en Columna Fija */
.dispatch-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  margin-bottom: 6px;
  box-sizing: border-box;
  width: 100%;
  transition: background 0.15s ease;
}

.dispatch-item-row:hover {
  background: rgba(30, 41, 59, 0.75);
}

.dispatch-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.dispatch-check {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.dispatch-unit-chip {
  width: 62px;
  min-width: 62px;
  max-width: 62px;
  padding: 4px 2px;
  border-radius: 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
}

.dispatch-unit-chip.counter {
  background: rgba(192, 132, 252, 0.12);
  border: 1px solid rgba(192, 132, 252, 0.3);
  color: #c084fc;
}

.dispatch-unit-chip.yard {
  background: rgba(251, 146, 60, 0.12);
  border: 1px solid rgba(251, 146, 60, 0.35);
  color: #fb923c;
}

.dispatch-unit-chip .d-qty {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.1;
  color: #fff;
  font-family: var(--font-mono);
}

.dispatch-unit-chip .d-unit {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  opacity: 0.9;
  line-height: 1;
  margin-top: 2px;
}

.dispatch-item-info {
  flex: 1;
  min-width: 0;
}

.dispatch-item-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
}

.dispatch-item-sku {
  font-size: 10px;
  color: #94a3b8;
  font-family: var(--font-mono);
  margin-top: 2px;
}

.dispatch-loc-btn {
  background: #1e293b;
  border: 1px solid #334155;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.dispatch-loc-btn.counter {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.dispatch-loc-btn.yard {
  color: #fb923c;
  border-color: rgba(251, 146, 60, 0.35);
}

.dispatch-loc-btn:hover {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
}

/* Selector Rápido de Cantidad Masiva */
.quick-qty-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.qty-pill-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
}

.qty-pill-btn:hover, .qty-pill-btn:active {
  background: var(--primary);
  color: #000;
}

/* Escáner Móvil Viewport con Láser en Vivo (Diseño Slim Compacto) */
.scanner-viewport-box {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  border-radius: 12px;
  border: 2px solid var(--primary);
  background: #000;
  overflow: hidden;
  position: relative;
  height: 140px;
  min-height: 140px;
  max-height: 145px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

.scanner-viewport-box.captured {
  border-color: #10b981 !important;
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.6) !important;
}

.scanner-laser-line {
  position: absolute;
  top: 0;
  left: 5%;
  width: 90%;
  height: 3px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0) 0%, #f59e0b 50%, rgba(245, 158, 11, 0) 100%);
  box-shadow: 0 0 12px #f59e0b;
  animation: laserSweep 2s infinite ease-in-out;
  z-index: 20;
  pointer-events: none;
  display: none;
}

.scanner-viewport-box.active-scan .scanner-laser-line {
  display: block;
}

.scanner-viewport-box.captured .scanner-laser-line {
  background: #10b981 !important;
  box-shadow: 0 0 18px #10b981 !important;
  animation: none;
  top: 50%;
}

@keyframes laserSweep {
  0% { top: 12%; opacity: 0.7; }
  50% { top: 88%; opacity: 1; }
  100% { top: 12%; opacity: 0.7; }
}

#reader {
  width: 100% !important;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 80px;
  right: 16px;
  background: #1e293b;
  border: 1px solid var(--primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  font-weight: 700;
  font-size: 13px;
  display: none;
  z-index: 2000;
  pointer-events: none;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Autocompletado de Catálogo Maestro */
.catalog-search-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s ease;
}
.catalog-search-item:hover {
  background: rgba(245, 158, 11, 0.15);
}

/* ==========================================================================
   IMPRESIÓN UNIVERSAL (A4 FORMAL, ETIQUETAS Y MANUAL DE PROCEDIMIENTOS)
   ========================================================================== */
@page {
  size: A4 portrait;
  margin: 6mm 10mm;
}

@media print {
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* 1. Impresión de Cotización Formal A4: Ocultar todo el árbol excepto modal-quote-pro */
  body.printing-pro-quote > *:not(#modal-quote-pro),
  body:has(#modal-quote-pro.open) > *:not(#modal-quote-pro) {
    display: none !important;
  }

  body.printing-pro-quote #modal-quote-pro,
  body:has(#modal-quote-pro.open) #modal-quote-pro {
    display: block !important;
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    z-index: 99999 !important;
  }

  body.printing-pro-quote #modal-quote-pro .modal-content,
  body:has(#modal-quote-pro.open) #modal-quote-pro .modal-content {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  body.printing-pro-quote #modal-quote-pro .modal-header,
  body:has(#modal-quote-pro.open) #modal-quote-pro .modal-header,
  body.printing-pro-quote #modal-quote-pro .modal-quote-actions-bar,
  body:has(#modal-quote-pro.open) #modal-quote-pro .modal-quote-actions-bar,
  body.printing-pro-quote #modal-quote-pro .modal-quote-close-footer,
  body:has(#modal-quote-pro.open) #modal-quote-pro .modal-quote-close-footer {
    display: none !important;
  }

  body.printing-pro-quote #printable-quote-a4,
  body:has(#modal-quote-pro.open) #printable-quote-a4 {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    background: #ffffff !important;
    color: #0f172a !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* 2. Impresión de Etiqueta Código de Barras */
  body.printing-barcode > *:not(#modal-view-barcode),
  body:has(#modal-view-barcode.open) > *:not(#modal-view-barcode) {
    display: none !important;
  }
  body.printing-barcode #modal-view-barcode,
  body:has(#modal-view-barcode.open) #modal-view-barcode {
    display: block !important;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
  }
  body.printing-barcode #modal-view-barcode .modal-header,
  body:has(#modal-view-barcode.open) #modal-view-barcode .modal-header,
  body.printing-barcode #modal-view-barcode .barcode-modal-actions,
  body:has(#modal-view-barcode.open) #modal-view-barcode .barcode-modal-actions {
    display: none !important;
  }
  body.printing-barcode #printable-barcode-card,
  body:has(#modal-view-barcode.open) #printable-barcode-card {
    display: block !important;
    position: static !important;
    margin: 0 auto !important;
    padding: 10px !important;
    box-shadow: none !important;
    border: 1px dashed #000 !important;
    width: 320px !important;
    color: #000000 !important;
    background: #ffffff !important;
  }

  /* 3. Impresión del Manual de Organización de Almacén */
  body.printing-manual > *:not(#app) {
    display: none !important;
  }
  body.printing-manual .sidebar,
  body.printing-manual .topbar,
  body.printing-manual .bottom-nav,
  body.printing-manual .despacho-subnav-row,
  body.printing-manual #dsub-panel-picking,
  body.printing-manual #dsub-panel-shelves,
  body.printing-manual #dsub-panel-yard,
  body.printing-manual .manual-print-btn-bar {
    display: none !important;
  }
  body.printing-manual .main-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  body.printing-manual #view-despacho,
  body.printing-manual #dsub-panel-manual {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.printing-manual .manual-doc-sheet {
    background: #ffffff !important;
    color: #000000 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
}

/* ==========================================================================
   OPTIMIZACIONES MÓVILES - MOSTRADOR & POS TOUCH
   ========================================================================== */
.pos-search-bar-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.pos-search-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.pos-search-input-wrap input {
  padding-left: 36px !important;
  padding-right: 44px !important;
  font-size: 13.5px !important;
  height: 42px;
}

.pos-search-input-wrap .search-icon {
  position: absolute;
  left: 11px;
  font-size: 15px;
  pointer-events: none;
  opacity: 0.7;
}

.pos-search-input-wrap .search-camera-btn {
  position: absolute;
  right: 6px;
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 30px;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.pos-search-input-wrap .search-camera-btn:active {
  transform: scale(0.92);
}

.pos-client-select-wrap {
  min-width: 140px;
  max-width: 200px;
}

.pos-client-select-wrap select {
  height: 42px;
  font-size: 12.5px !important;
}

/* Lista Touch de Productos para Móviles */
.m-products-container {
  display: none;
  flex-direction: column;
  gap: 7px;
}

.m-product-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 9px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.1s ease, border-color 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  width: 100%;
}

.m-product-card:active {
  transform: scale(0.985);
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--primary);
}

.m-card-row-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.m-card-title-wrap {
  flex: 1;
  min-width: 0;
}

.m-prod-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.m-card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.m-dept-tag {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-blue);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

.m-stock-tag {
  font-size: 10.5px;
  font-weight: 700;
  color: #10b981;
}

.m-stock-tag.low {
  color: #f87171;
}

.m-loc-tag {
  font-size: 10px;
  color: #94a3b8;
}

.m-card-price-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
  text-align: right;
}

.m-prod-price-usd {
  font-size: 14.5px;
  font-weight: 900;
  color: #fff;
}

.m-prod-price-bs {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-green);
}

.m-card-row-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 5px;
  width: 100%;
}

.m-sku-tag {
  background: #1e293b;
  color: #94a3b8;
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
}

.m-prod-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.m-qty-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.1s ease;
  line-height: 1.2;
}

.m-qty-btn:active {
  background: var(--primary);
  color: #000;
}

#dept-pills-container {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#dept-pills-container::-webkit-scrollbar {
  display: none;
}
#dept-pills-container button {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Ocultar tabla desktop en móvil y mostrar cards táctiles */
@media (max-width: 768px) {
  #counter-desktop-table-card {
    display: none !important;
  }
  .m-products-container {
    display: flex;
  }
  .pos-search-bar-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .pos-client-select-wrap {
    max-width: 100%;
    width: 100%;
  }
}

/* ==========================================================================
   CROQUIS 2D INTERACTIVO DE PATIO & ALMACÉN
   ========================================================================== */
.yard-map-container {
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.yard-map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 10px;
}

.yard-svg-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 10px;
  background: #06090f;
  border: 1px solid #151d2f;
  text-align: center;
}

.yard-svg-wrap svg {
  max-width: 100%;
  height: auto;
  min-width: 580px;
  display: block;
  margin: 0 auto;
}

.yard-zone {
  cursor: pointer;
  transition: all 0.2s ease;
}

.yard-zone:hover rect {
  stroke: var(--primary) !important;
  stroke-width: 2.5px !important;
}

.yard-zone.active-zone rect {
  fill: rgba(245, 158, 11, 0.35) !important;
  stroke: #f59e0b !important;
  stroke-width: 3.5px !important;
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.7));
  animation: zonePulse 1.8s infinite ease-in-out;
}

@keyframes zonePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

.yard-zone text {
  font-family: system-ui, -apple-system, sans-serif;
  user-select: none;
}

.yard-callout-box {
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid var(--primary);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.yard-pills-selector {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 0;
  -webkit-overflow-scrolling: touch;
}

.yard-pill-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  cursor: pointer;
}

.yard-pill-btn:hover, .yard-pill-btn.active {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
}

/* ==========================================================================
   PANEL DE DUEÑO & CONTABILIDAD INTEGRAL
   ========================================================================== */
.owner-grid-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 2 filas exactas de 3 tarjetas cuadradas y equilibradas */
  gap: 14px;
  margin-bottom: 16px;
}

@media (min-width: 1400px) {
  .owner-grid-summary {
    grid-template-columns: repeat(6, 1fr); /* 1 sola fila con las 6 tarjetas en monitores anchos */
  }
}

@media (max-width: 960px) {
  .owner-grid-summary {
    grid-template-columns: repeat(2, 1fr); /* 3 filas exactas de 2 tarjetas en tablet */
  }
}

@media (max-width: 540px) {
  .owner-grid-summary {
    grid-template-columns: 1fr; /* 1 columna en móvil vertical */
  }
}

.owner-kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.owner-kpi-card:hover {
  border-color: rgba(245, 158, 11, 0.4);
}

.owner-kpi-card .kpi-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.owner-kpi-card .kpi-number {
  font-size: 23px;
  font-weight: 900;
  color: #fff;
  margin: 6px 0 2px 0;
}

.owner-kpi-card .kpi-sub {
  font-size: 12px;
  font-weight: 700;
}

/* Pastillas de Selección de Período Contable */
.period-pills-wrap {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.period-pill {
  background: #0f172a;
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.period-pill:hover {
  background: #1e293b;
  color: #fff;
  border-color: #64748b;
}

.period-pill.active {
  background: var(--primary) !important;
  color: #0f172a !important;
  border-color: var(--primary) !important;
  font-weight: 900 !important;
  box-shadow: 0 0 12px var(--primary-glow);
}

/* Hoja Formal de Presupuesto A4 */
.printable-quote-sheet {
  color: #0f172a !important;
  background: #ffffff !important;
  font-size: 12.5px;
  line-height: 1.45;
}

.printable-quote-sheet table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.printable-quote-sheet th {
  background: #0f172a !important;
  color: #ffffff !important;
  font-size: 11px;
  font-weight: 800;
  padding: 8px 10px;
  text-align: left;
  text-transform: uppercase;
  border: 1px solid #0f172a;
}

.printable-quote-sheet td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
  font-size: 12px;
}

.printable-quote-sheet tr:nth-child(even) td {
  background: #f8fafc;
}

.printable-quote-sheet .total-row td {
  background: #f1f5f9;
  font-weight: 800;
  border-top: 2px solid #0f172a;
}

/* ==========================================================================
   CLIENT PICKER (BOTÓN DE PERSONITA & MODAL INTELIGENTE)
   ========================================================================== */
.pos-client-pill-container {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 150px;
  max-width: 260px;
  flex-shrink: 0;
}

.pos-client-pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  height: 42px;
  padding: 0 10px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
  width: 100%;
  overflow: hidden;
  text-align: left;
}

.pos-client-pill-btn:hover {
  background: rgba(51, 65, 85, 0.85);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.18);
}

.pos-client-pill-btn.is-custom-client {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.5);
}

.client-pill-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.client-pill-name {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.client-pill-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: #0f172a;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  text-transform: uppercase;
  flex-shrink: 0;
}

.pos-client-pill-btn.is-custom-client .client-pill-badge {
  background: #f59e0b;
  color: #0f172a;
  border-color: #f59e0b;
}

.pos-client-pill-clear {
  width: 32px;
  height: 42px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.pos-client-pill-clear:hover {
  background: #ef4444;
  color: #fff;
}

/* Modal de Clientes Items */
.client-picker-casual-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px dashed #38bdf8;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.client-picker-casual-card:hover {
  background: rgba(56, 189, 248, 0.12);
  transform: translateY(-1px);
}

.client-picker-card-item {
  background: #0d1527;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.client-picker-card-item:hover {
  background: #172554;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.client-picker-card-item.selected {
  border-color: var(--primary);
  background: rgba(245, 158, 11, 0.12);
}

/* ==========================================================================
   DESPACHO SUB-TABS & NAVEGACIÓN INTERIOR
   ========================================================================== */
.despacho-subnav-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.despacho-subnav-btn {
  white-space: nowrap;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  padding: 7px 14px !important;
  border-radius: 8px !important;
  transition: all 0.18s ease;
}

.despacho-subnav-btn.active {
  background: var(--primary) !important;
  color: #0f172a !important;
  font-weight: 900 !important;
  box-shadow: 0 0 12px var(--primary-glow);
}

/* ==========================================================================
   ESTANTERÍAS & GAVETEROS INTERIORES (FERRETERÍA & MOTO REPUESTOS)
   ========================================================================== */
.gavetero-mueble-container {
  background: #090e1a;
  border: 2px solid #1e293b;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.gaveteros-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .gaveteros-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 600px) {
  .gaveteros-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gaveta-cell {
  background: #131d33;
  border: 1px solid #273553;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 72px;
}

.gaveta-cell:hover {
  background: #1e2c4f;
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.2);
}

.gaveta-cell.active-highlight {
  background: rgba(245, 158, 11, 0.25) !important;
  border: 2px solid #f59e0b !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.5) !important;
}

.gaveta-cell-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 900;
  color: #38bdf8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gaveta-cell-title {
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
  margin-top: 4px;
}

.gaveta-cell-desc {
  font-size: 9.5px;
  color: #94a3b8;
  margin-top: 2px;
  line-height: 1.2;
}

/* Detalle de Gaveta Inspeccionada */
.gaveta-detail-card {
  background: #111a2e;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 14px 18px;
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* Mapa de Estanterías Metálicas E1-E5 */
.shelves-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.shelf-rack-card {
  background: #0d1527;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shelf-rack-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 6px;
}

.shelf-level-row {
  background: #141f38;
  border: 1px solid #23314f;
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.shelf-level-row:hover {
  border-color: #38bdf8;
  background: #1a284a;
}

/* ==========================================================================
   MANUAL OPERATIVO DE ALMACÉN (HOJA Y DOCUMENTO FORMAL)
   ========================================================================== */
.manual-doc-sheet {
  background: #ffffff;
  color: #0f172a;
  border-radius: 10px;
  padding: 28px 36px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  font-family: var(--font-sans);
  line-height: 1.5;
  max-width: 900px;
  margin: 0 auto 20px auto;
}

.manual-doc-sheet h1, 
.manual-doc-sheet h2, 
.manual-doc-sheet h3 {
  color: #0f172a;
}

.manual-section {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 16px;
  margin-bottom: 18px;
}

.manual-callout-box {
  background: #f8fafc;
  border-left: 4px solid #f59e0b;
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  margin: 10px 0;
  font-size: 12px;
  color: #334155;
}

/* ==========================================================================
   VENTA A CRÉDITO / FIADO EN CAJA CHECKOUT
   ========================================================================== */
.checkout-credit-box {
  background: rgba(19, 29, 51, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.checkout-credit-box.over-limit {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

/* ==========================================================================
   DOCUMENTO OFICIAL: LIBRO DE VENTAS SENIAT
   ========================================================================== */
.printable-seniat-sheet {
  background: #ffffff;
  color: #0f172a;
  padding: 24px 28px;
  border-radius: 8px;
  font-family: var(--font-sans);
  line-height: 1.4;
  overflow-x: auto;
}

.printable-seniat-sheet table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
  margin-top: 10px;
}

.printable-seniat-sheet th {
  background: #0f172a;
  color: #ffffff;
  padding: 5px 6px;
  font-weight: 800;
  text-align: left;
  border: 1px solid #334155;
}

.printable-seniat-sheet td {
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  color: #1e293b;
}

.printable-seniat-sheet tr:nth-child(even) td {
  background: #f8fafc;
}

.printable-seniat-sheet .totals-row td {
  background: #e2e8f0;
  font-weight: 900;
  border-top: 2px solid #0f172a;
}

@media print {
  body.printing-seniat-doc > *:not(#modal-sales-book-doc),
  body:has(#modal-sales-book-doc.open) > *:not(#modal-sales-book-doc) {
    display: none !important;
  }

  body.printing-seniat-doc #modal-sales-book-doc,
  body:has(#modal-sales-book-doc.open) #modal-sales-book-doc {
    display: block !important;
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
  }

  body.printing-seniat-doc #modal-sales-book-doc .modal-header,
  body:has(#modal-sales-book-doc.open) #modal-sales-book-doc .modal-header,
  body.printing-seniat-doc #modal-sales-book-doc .sales-doc-actions,
  body:has(#modal-sales-book-doc.open) #modal-sales-book-doc .sales-doc-actions {
    display: none !important;
  }

  body.printing-seniat-doc .printable-seniat-sheet,
  body:has(#modal-sales-book-doc.open) .printable-seniat-sheet {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    background: #ffffff !important;
    color: #000000 !important;
  }
}

/* ==========================================================================
   SEMÁFORO DE CRÉDITO Y RIESGO EN MOSTRADOR
   ========================================================================== */
.credit-badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
}

.credit-badge-yellow {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
}

.credit-badge-red {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  animation: pulse-red-border 2s infinite ease-in-out;
}

@keyframes pulse-red-border {
  0%, 100% { border-color: rgba(239, 68, 68, 0.45); }
  50% { border-color: rgba(239, 68, 68, 0.9); }
}

.btn-active-client-chip.is-debt-alert {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.12) !important;
}

.btn-active-client-chip.is-debt-warning {
  border-color: #f59e0b !important;
  background: rgba(245, 158, 11, 0.12) !important;
}

/* Botón estilizado WhatsApp */
.btn-whatsapp {
  background: #25d366;
  color: #ffffff;
  border: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-whatsapp:hover {
  background: #1ebc59;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(37, 211, 102, 0.35);
}

/* ---------------------------------------------------- Checkout Multi-Moneda Profesional */
.checkout-segmented-bar {
  display: flex;
  background: #090d16;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  gap: 4px;
  margin-bottom: 14px;
  overflow-x: auto;
}

.checkout-tab-btn {
  flex: 1;
  min-width: 90px;
  padding: 8px 10px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.checkout-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.checkout-tab-btn.active {
  background: var(--card-bg, #131b2e);
  color: #fff;
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.checkout-tab-btn.active.tab-bs {
  border-color: #10b981;
  color: #34d399;
}

.checkout-tab-btn.active.tab-usd {
  border-color: #38bdf8;
  color: #38bdf8;
}

.checkout-tab-btn.active.tab-eur {
  border-color: #fbbf24;
  color: #fbbf24;
}

.payment-method-tile {
  background: #0b1120;
  border: 1px solid #1e293b;
  border-radius: 9px;
  padding: 12px;
  margin-bottom: 10px;
  transition: all 0.15s ease;
}

.payment-method-tile:hover {
  border-color: #334155;
}

.quick-denom-chip {
  padding: 5px 10px;
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}

.quick-denom-chip:hover {
  background: #334155;
  color: #fff;
  border-color: #64748b;
}

.checkout-total-card {
  background: linear-gradient(135deg, #090d16 0%, #111827 100%);
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

/* ---------------------------------------------------------------- Centro de Alertas & Auditoría Contable */
.btn-top-alerts {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #f1f5f9;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.btn-top-alerts:hover {
  background: #1e293b;
  border-color: #64748b;
  transform: translateY(-1px);
}

.btn-top-alerts.has-critical {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.1);
}

.alerts-badge-counter {
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  border-radius: 10px;
  padding: 1px 6px;
  line-height: 1.4;
  display: inline-block;
  min-width: 16px;
  text-align: center;
  animation: pulse-alert 2s infinite ease-in-out;
}

@keyframes pulse-alert {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); box-shadow: 0 0 10px rgba(239,68,68,0.7); }
}

.audit-modal-content {
  max-width: 780px;
  width: 95%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.audit-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.audit-stat-card {
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.audit-stat-num {
  font-size: 18px;
  font-weight: 900;
  font-family: var(--font-mono);
}

.audit-stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.audit-tabs-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 12px;
  border-bottom: 1px solid #1e293b;
}

.audit-tab-pill {
  padding: 5px 12px;
  background: #090d16;
  color: #94a3b8;
  border: 1px solid #1e293b;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.audit-tab-pill:hover {
  color: #fff;
  border-color: #334155;
}

.audit-tab-pill.active {
  background: #1e293b;
  color: #fff;
  border-color: var(--primary);
}

.audit-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 55vh;
  padding-right: 4px;
}

.audit-alert-card {
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.15s ease;
}

.audit-alert-card:hover {
  border-color: #334155;
  background: #0d1322;
}

.audit-alert-card.crit {
  border-left: 4px solid #ef4444;
}

.audit-alert-card.warn {
  border-left: 4px solid #f59e0b;
}

.audit-alert-card.info {
  border-left: 4px solid #38bdf8;
}

.audit-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.audit-card-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #fff;
}

.audit-badge {
  font-size: 10px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.audit-badge.crit {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.audit-badge.warn {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.audit-badge.info {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.audit-card-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.4;
}

.audit-card-impact {
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 8px;
  border-radius: 4px;
}

.audit-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}







