/* ═══════════════════════════════════════════════════════════════════
   COSMÉTICOS PRO — COMPONENTS STYLESHEET
   All reusable UI components
═══════════════════════════════════════════════════════════════════ */

/* ── CARDS ─────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg-glass-light);
  opacity: 0;
  transition: var(--transition);
  pointer-events: none;
}

.card:hover {
  border-color: rgba(139,92,246,0.2);
  box-shadow: var(--shadow-md);
}

.card:hover::before {
  opacity: 1;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ── KPI CARDS ─────────────────────────────────────────────────── */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: var(--gradient-glow);
  transform: translate(30px, -30px);
  opacity: 0.5;
  filter: blur(20px);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: rgba(139,92,246,0.25);
}

.kpi-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
}

.kpi-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  position: relative;
  z-index: 1;
}

.kpi-icon-purple { background: rgba(139,92,246,0.15); }
.kpi-icon-pink   { background: rgba(236,72,153,0.15); }
.kpi-icon-green  { background: rgba(16,185,129,0.15); }
.kpi-icon-orange { background: rgba(245,158,11,0.15); }
.kpi-icon-red    { background: rgba(239,68,68,0.15); }
.kpi-icon-blue   { background: rgba(59,130,246,0.15); }

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.kpi-trend-up   { background: var(--success-bg); color: var(--success); }
.kpi-trend-down { background: var(--danger-bg);  color: var(--danger); }
.kpi-trend-neutral { background: var(--bg-glass-light); color: var(--text-muted); }

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  position: relative;
  z-index: 1;
}

.kpi-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

/* ── BUTTONS ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(139,92,246,0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(139,92,246,0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-glass-light);
  color: var(--text-primary);
  border-color: var(--border-card);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(139,92,246,0.3);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239,68,68,0.3);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(16,185,129,0.3);
}

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

.btn-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(245,158,11,0.3);
}

.btn-warning:hover {
  background: var(--warning);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-xs {
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── BADGES ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-purple  { background: rgba(139,92,246,0.12); color: var(--purple-light); }
.badge-pink    { background: rgba(236,72,153,0.12); color: var(--pink-light); }
.badge-muted   { background: var(--bg-glass-light); color: var(--text-muted); }
.badge-sku     { 
  background: rgba(139, 92, 246, 0.16); 
  color: #a78bfa; 
  border: 1px solid rgba(139, 92, 246, 0.4); 
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; 
  font-size: 0.8rem; 
  font-weight: 700; 
  letter-spacing: 0.03em; 
  padding: 3px 9px; 
  border-radius: var(--radius-sm); 
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.12); 
  white-space: nowrap; 
}

.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* ── FORM ELEMENTS ─────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 14px;
  transition: var(--transition);
  width: 100%;
  outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.12);
}

.form-select {
  cursor: pointer;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%239090b0' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-error {
  font-size: 0.75rem;
  color: var(--danger);
}

/* ── TABLE ─────────────────────────────────────────────────────── */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-card);
  background: var(--bg-card);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead th {
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition-fast);
}

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

.table tbody tr:hover {
  background: var(--bg-glass-light);
}

.table tbody td {
  padding: 13px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

.table-strikethrough td {
  text-decoration: line-through;
  opacity: 0.5;
}

.table-clickable tbody tr {
  cursor: pointer;
}

/* ── MODAL ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  animation: overlayIn 0.2s ease forwards;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
}

.modal-lg {
  max-width: 720px;
}

.modal-sm {
  max-width: 380px;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-lg) var(--spacing-lg) 0;
  margin-bottom: var(--spacing-lg);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-glass-light);
  color: var(--text-primary);
}

.modal-body {
  padding: 0 var(--spacing-lg);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-sm);
  padding: var(--spacing-lg);
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--spacing-lg);
}

/* ── ALERTS ────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding: 12px var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(16,185,129,0.2);
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239,68,68,0.2);
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(245,158,11,0.2);
}

.alert-info {
  background: var(--info-bg);
  color: var(--info);
  border-color: rgba(59,130,246,0.2);
}

/* ── SEARCH BAR ────────────────────────────────────────────────── */
.search-bar {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.search-bar-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-bar input {
  padding-left: 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  width: 100%;
  outline: none;
  transition: var(--transition);
  height: 40px;
}

.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.1);
  background: var(--bg-input-focus);
}

/* ── TOOLBAR ────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
}

/* ── PAGINATION ─────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-lg);
}

.page-btn {
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.page-btn:hover {
  background: var(--bg-glass-light);
  border-color: rgba(139,92,246,0.3);
  color: var(--text-primary);
}

.page-btn.active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
}

/* ── SPINNER ────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-purple {
  border-color: rgba(139,92,246,0.2);
  border-top-color: var(--purple);
}

.spinner-lg {
  width: 40px; height: 40px;
  border-width: 3px;
}

.spinner-sm {
  width: 14px; height: 14px;
  border-width: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── EMPTY STATE ────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-2xl) var(--spacing-lg);
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3.5rem;
  margin-bottom: var(--spacing-md);
  filter: grayscale(0.3);
}

.empty-state-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state-desc {
  font-size: 0.85rem;
  max-width: 280px;
  line-height: 1.5;
}

/* ── TOAST NOTIFICATIONS ────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  pointer-events: none;
}

.toast {
  min-width: 280px;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards;
  pointer-events: all;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}

.toast-success::before { background: var(--success); }
.toast-error::before   { background: var(--danger); }
.toast-warning::before { background: var(--warning); }
.toast-info::before    { background: var(--info); }

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.toast-msg {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.toast-close:hover { color: var(--text-primary); }

.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: var(--gradient-primary);
  animation: toastProgress linear forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(60px) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(60px) scale(0.9); }
}

@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ── TABS / PERIOD SELECTOR ─────────────────────────────────────── */
.tab-group {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 4px;
}

.tab-btn {
  flex: 1;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(139,92,246,0.3);
}

.tab-btn:hover:not(.active) {
  background: var(--bg-glass-light);
  color: var(--text-primary);
}

/* ── CHART CARD ─────────────────────────────────────────────────── */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
}

.chart-wrapper {
  position: relative;
  height: 260px;
}

/* ── COLOR SWATCHES ─────────────────────────────────────────────── */
.color-picker-group {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.color-swatch {
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: var(--transition-fast);
}

.color-swatch.selected,
.color-swatch:hover {
  border-color: #fff;
  transform: scale(1.15);
}

/* ── QUANTITY CONTROL ───────────────────────────────────────────── */
.qty-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass-light);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  line-height: 1;
}

.qty-btn:hover {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
}

.qty-value {
  min-width: 32px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
}

/* ── POS PRODUCT CARD ───────────────────────────────────────────── */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.product-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary-soft);
  opacity: 0;
  transition: var(--transition);
}

.product-card:hover {
  border-color: rgba(139,92,246,0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.product-card:hover::before { opacity: 1; }

.product-card-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}

.product-card-sku {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: var(--spacing-sm);
  position: relative;
  z-index: 1;
}

.product-card-price {
  font-size: 1.1rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  z-index: 1;
}

.product-card-stock {
  font-size: 0.72rem;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

/* ── CART ───────────────────────────────────────────────────────── */
.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--spacing-sm);
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.cart-item-price {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.cart-item-subtotal {
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  font-size: 0.9rem;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.cart-total-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.cart-total-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.cart-grand-total-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cart-grand-total-value {
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── RECEIPT ────────────────────────────────────────────────────── */
.receipt-content {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  font-family: 'Courier New', monospace;
}

.receipt-header {
  text-align: center;
  padding-bottom: var(--spacing-md);
  border-bottom: 1px dashed var(--border-card);
  margin-bottom: var(--spacing-md);
}

.receipt-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.receipt-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 3px 0;
  color: var(--text-primary);
}

.receipt-divider {
  border: none;
  border-top: 1px dashed var(--border-card);
  margin: var(--spacing-sm) 0;
}

.receipt-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  font-weight: 700;
  padding-top: var(--spacing-sm);
  color: var(--text-primary);
}

/* ── LOW STOCK ALERT PANEL ─────────────────────────────────────── */
.stock-alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.stock-alert-item:last-child { border-bottom: none; }

.stock-alert-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.stock-alert-sku {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── CONFIRM DIALOG ─────────────────────────────────────────────── */
.confirm-dialog {
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-lg);
}

.confirm-icon {
  font-size: 2.5rem;
  margin-bottom: var(--spacing-md);
}

.confirm-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.confirm-message {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-lg);
  line-height: 1.5;
}

.confirm-buttons {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
}

/* ── SALE ROW EXPAND ────────────────────────────────────────────── */
.sale-expand-row td {
  padding: 0 !important;
  border-bottom: 1px solid var(--border-subtle) !important;
}

.sale-expand-content {
  background: rgba(0,0,0,0.2);
  padding: var(--spacing-md) var(--spacing-lg);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s ease;
}

.sale-expand-content.open {
  max-height: 400px;
}

/* ── STATUS DOT ─────────────────────────────────────────────────── */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
}

.status-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-active .status-dot::before  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-voided .status-dot::before  { background: var(--danger); }
.status-pending .status-dot::before { background: var(--warning); }

/* ── SECTION SEPARATOR ───────────────────────────────────────────── */
.section-sep {
  margin: var(--spacing-xl) 0;
  border: none;
  border-top: 1px solid var(--border-subtle);
}

/* ── SETTINGS SECTION ───────────────────────────────────────────── */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.settings-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

/* ── ANALYTICS TABLE ─────────────────────────────────────────────── */
.analytics-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  text-align: center;
}

.analytics-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-sm);
}

.analytics-stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── PROGRESS BAR ───────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

/* ── MOBILE RESPONSIVE COMPONENTS OVERRIDES ──────────────────────── */
@media (max-width: 768px) {
  /* 1. KPI Cards en 2 columnas compactas en móvil */
  .grid-4.kpis-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--spacing-sm) !important;
    margin-bottom: var(--spacing-md) !important;
  }
  
  .kpi-card {
    padding: var(--spacing-md) !important;
  }
  
  .kpi-card-header {
    margin-bottom: var(--spacing-sm) !important;
  }
  
  .kpi-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 1rem !important;
    border-radius: var(--radius-sm) !important;
  }
  
  .kpi-value {
    font-size: 1.35rem !important;
  }
  
  .kpi-label {
    font-size: 0.72rem !important;
    margin-top: 2px !important;
  }
  
  .kpi-trend {
    font-size: 0.65rem !important;
    padding: 2px 6px !important;
  }

  /* 2. Modales adaptados para móviles (evitando que se oculten o desborden con el teclado) */
  .modal-overlay {
    align-items: flex-start !important;
    overflow-y: auto !important;
    padding: var(--spacing-sm) !important;
    -webkit-overflow-scrolling: touch;
  }

  .modal {
    width: 100% !important;
    max-width: 100% !important;
    margin: 12px 0 32px 0 !important;
    border-radius: var(--radius-lg) !important;
    max-height: none !important;
    overflow-y: visible !important;
    transform: none !important;
    transition: none !important;
  }

  .modal-header {
    padding: var(--spacing-md) var(--spacing-md) 0 !important;
    margin-bottom: var(--spacing-md) !important;
  }

  .modal-body {
    padding: 0 var(--spacing-md) !important;
  }

  .modal-footer {
    padding: var(--spacing-md) !important;
    margin-top: var(--spacing-md) !important;
    flex-direction: column-reverse !important;
    gap: 8px !important;
  }

  .modal-footer .btn {
    width: 100% !important;
    margin: 0 !important;
  }

  /* 4. CARGA DE PRODUCTOS / INVENTARIO / COMPRAS RESPONSIVE EN MÓVILES */
  
  /* Pestañas de navegación superiores */
  .purchases-tabs-nav {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px !important;
    margin-bottom: 16px !important;
    border-bottom: 1px solid var(--border-subtle);
  }

  .purchases-tabs-nav .purchases-tab {
    flex: 1 0 auto !important;
    font-size: 0.82rem !important;
    padding: 10px 14px !important;
    white-space: nowrap !important;
    text-align: center !important;
  }

  /* POS de Compras: conversión de 2 columnas a 1 columna en móvil */
  .purchase-pos-layout {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: auto !important;
    gap: var(--spacing-md) !important;
  }

  .purchase-catalog-panel,
  .purchase-invoice-panel {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .purchase-catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)) !important;
    max-height: 280px !important;
  }

  /* Formulario de cabecera (Proveedor, Tipo de movimiento, N° Factura, Pago) */
  .purchases-form-grid {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-sm) !important;
  }

  .purchases-form-grid-actions {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-sm) !important;
  }

  .purchases-form-grid-actions .btn {
    width: 100% !important;
  }

  /* Filas de items de factura en Carga Manual (POS) para móviles */
  .invoice-items-header {
    display: none !important;
  }

  .invoice-item-row-mobile {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 10px 12px !important;
    background: var(--bg-input) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 8px !important;
  }

  .invoice-item-row-mobile .item-top-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .invoice-item-row-mobile .item-name {
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    word-break: break-word !important;
  }

  .invoice-item-row-mobile .item-inputs-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .invoice-item-row-mobile .input-field-group {
    display: flex !direction: column !important;
    gap: 2px !important;
  }

  .invoice-item-row-mobile .input-field-group label {
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    text-transform: uppercase !important;
  }

  /* Carga con IA (Pantalla dividida en 1 columna en móvil) */
  .purchases-split-grid {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-md) !important;
  }

  #invoice-upload-screen {
    padding: var(--spacing-md) !important;
  }

  #invoice-upload-area {
    padding: var(--spacing-lg) var(--spacing-sm) !important;
  }

  /* Toolbar y Header de Inventario Responsive */
  .inventory-page-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .btn-new-product-header {
    width: 100% !important;
    justify-content: center !important;
  }

  .toolbar,
  .inventory-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .toolbar .search-bar,
  .toolbar .form-select,
  .toolbar .btn-group-filter,
  .toolbar .btn,
  .inventory-toolbar .search-bar,
  .inventory-toolbar .form-select,
  .inventory-toolbar .btn-group-filter,
  .inventory-toolbar .btn {
    width: 100% !important;
    max-width: 100% !important;
  }

  .btn-group-filter {
    display: flex !important;
    width: 100% !important;
  }

  .btn-group-filter .btn-filter {
    flex: 1 !important;
    text-align: center !important;
    justify-content: center !important;
    padding: 8px 4px !important;
    font-size: 0.76rem !important;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .modal {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 10px !important;
    padding: 14px !important;
  }
}

/* ── INVENTORY GENERAL COMPONENT STYLES ── */
.inventory-investment-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--purple-light);
  background: rgba(139, 92, 246, 0.12);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.inventory-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-sm);
}

.inventory-select {
  min-width: 170px;
  height: 40px;
}

.btn-group-filter {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

.btn-group-filter .btn-filter {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.btn-group-filter .btn-filter.active {
  background: var(--purple) !important;
  color: #fff !important;
}

/* Reglas de Escritorio para .invoice-item-row-mobile (Pantalla grande > 768px) */
@media (min-width: 769px) {
  .invoice-item-row-mobile {
    display: grid !important;
    grid-template-columns: 2fr 1.2fr 1.2fr 70px 80px 32px !important;
    gap: 6px !important;
    align-items: center !important;
    background: var(--bg-input) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-sm) !important;
    padding: 6px 8px !important;
    margin-bottom: 8px !important;
  }

  .invoice-item-row-mobile .item-top-row {
    display: contents !important;
  }

  .invoice-item-row-mobile .item-top-row .item-name {
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .invoice-item-row-mobile .item-inputs-grid {
    display: contents !important;
  }

  .invoice-item-row-mobile .input-field-group {
    display: contents !important;
  }

  .invoice-item-row-mobile .input-field-group label {
    display: none !important;
  }
}

/* ── 3. POS MOBILE FLOATING CART COMPONENTS ─────────────────────── */
.pos-mobile-cart-btn {
  position: fixed;
  bottom: 80px; /* Sobre la barra móvil de navegación */
  left: var(--spacing-md);
  right: var(--spacing-md);
  height: 52px;
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  display: none; /* Se activa dinámicamente con JS */
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--spacing-lg);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
  z-index: 980;
  border: none;
  transition: var(--transition-fast);
}

.pos-mobile-cart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(139, 92, 246, 0.55);
}

.pos-mobile-cart-btn:active {
  transform: scale(0.97);
}

.pmc-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.pmc-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
}

.pmc-right {
  font-size: 1rem;
}

/* POS Cart Drawer (Mobile) */
.pos-cart-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  animation: fadeIn 0.25s ease;
}

.pos-cart-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 82vh;
  background: var(--bg-card);
  z-index: 1001;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border: 1px solid var(--border-card);
  border-bottom: none;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.1, 0.76, 0.55, 0.94);
  display: flex;
  flex-direction: column;
  padding: var(--spacing-md);
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.5);
}

.pos-cart-drawer.open {
  transform: translateY(0);
}

.pos-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--spacing-sm);
  flex-shrink: 0;
}

.pos-drawer-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.pos-drawer-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
}

.pos-drawer-close:hover {
  background: var(--bg-glass-light);
  color: var(--text-primary);
}

.pos-drawer-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

