/* =============================================
   AquaTrack — Sistema de Logística con QR
   CSS Design System
   ============================================= */

/* === RESET === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* === VARIABLES === */
:root {
  /* Primary - Water Blue */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  /* Accent - Ice Teal */
  --accent-50: #f0fdfa;
  --accent-100: #ccfbf1;
  --accent-200: #99f6e4;
  --accent-300: #5eead4;
  --accent-400: #2dd4bf;
  --accent-500: #14b8a6;
  --accent-600: #0d9488;
  --accent-700: #0f766e;

  /* Success */
  --success-50: #f0fdf4;
  --success-100: #dcfce7;
  --success-500: #22c55e;
  --success-600: #16a34a;
  --success-700: #15803d;

  /* Warning */
  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --warning-600: #d97706;

  /* Error */
  --error-50: #fef2f2;
  --error-500: #ef4444;
  --error-600: #dc2626;

  /* Neutrals */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Surfaces */
  --surface: #ffffff;
  --surface-secondary: #f8fafc;
  --surface-elevated: #ffffff;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  /* Radii */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index */
  --z-dropdown: 100;
  --z-modal: 200;
  --z-toast: 300;
}

/* === BASE === */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--primary-600); text-decoration: none; }
a:hover { color: var(--primary-700); }

img { max-width: 100%; height: auto; }

/* === UTILITIES === */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success-600); }
.text-error { color: var(--error-600); }
.text-warning { color: var(--warning-600); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.w-full { width: 100%; }

/* === LOGIN PAGE === */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 30%, #1e40af 60%, #0d9488 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(20, 184, 166, 0.1) 0%, transparent 40%);
  animation: loginBgPulse 8s ease-in-out infinite alternate;
}

@keyframes loginBgPulse {
  0% { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1.05) rotate(2deg); }
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-2xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 1;
  animation: slideUp 0.6s ease-out;
  margin: 1rem;
}

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

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo .logo-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 4px 8px rgba(59, 130, 246, 0.3));
}

.login-logo h1 {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-700), var(--accent-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.025em;
}

.login-logo p {
  color: var(--gray-500);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* === FORMS === */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-family: inherit;
  color: var(--gray-900);
  background: var(--surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input::placeholder {
  color: var(--gray-400);
}

.form-input-icon {
  position: relative;
}

.form-input-icon .icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.125rem;
  pointer-events: none;
}

.form-input-icon .form-input {
  padding-left: 2.75rem;
}

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

select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 48px;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: white;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-700), var(--primary-800));
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-500), var(--success-600));
  color: white;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35);
}
.btn-success:hover {
  background: linear-gradient(135deg, var(--success-600), var(--success-700));
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--error-500), var(--error-600));
  color: white;
}
.btn-danger:hover {
  background: linear-gradient(135deg, var(--error-600), #b91c1c);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--gray-700);
  border: 2px solid var(--gray-200);
}
.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  padding: 0.5rem 0.75rem;
  min-height: auto;
}
.btn-ghost:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.0625rem;
  min-height: 56px;
  border-radius: var(--radius-xl);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  min-height: 36px;
}

.btn-full { width: 100%; }

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-lg);
  min-height: auto;
  font-size: 1.25rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* === HEADER / NAVBAR === */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 1.25rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--primary-700);
}

.header-brand .brand-icon {
  font-size: 1.5rem;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-user .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-100), var(--accent-100));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-700);
}

.header-user .user-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--gray-700);
}

.header-user .user-role {
  font-size: 0.75rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* === MAIN CONTENT === */
.main-content {
  padding: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease-out;
}

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

/* === CARDS === */
.card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--gray-800);
}

.card-body {
  padding: 1.5rem;
}

/* === SCAN BUTTON (BIG CTA) === */
.scan-cta {
  background: linear-gradient(135deg, var(--primary-600), var(--accent-600));
  border-radius: var(--radius-2xl);
  padding: 2.5rem 2rem;
  text-align: center;
  color: white;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
  position: relative;
  overflow: hidden;
}

.scan-cta::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: scanPulse 3s ease-in-out infinite;
}

@keyframes scanPulse {
  0%, 100% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0; }
}

.scan-cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.4);
}

.scan-cta:active {
  transform: translateY(-1px);
}

.scan-cta .scan-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.scan-cta .scan-text {
  font-size: 1.25rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.scan-cta .scan-subtext {
  font-size: 0.875rem;
  opacity: 0.85;
  margin-top: 0.25rem;
  position: relative;
  z-index: 1;
}

/* === STATS GRID === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* === RECENT ACTIVITY LIST === */
.activity-list {
  margin-top: 1.5rem;
}

.activity-list .section-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem;
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--gray-100);
}

.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--gray-50); }

.activity-item .activity-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.activity-icon.venta { background: var(--success-50); }
.activity-icon.sin-venta { background: var(--warning-50); }

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

.activity-item .activity-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-item .activity-detail {
  font-size: 0.8125rem;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.activity-item .activity-time {
  font-size: 0.8125rem;
  color: var(--gray-400);
  font-weight: 500;
  white-space: nowrap;
}

/* === PRODUCT COUNTER === */
.product-counter {
  background: var(--surface-secondary);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  border: 2px solid var(--gray-100);
  transition: border-color var(--transition-fast);
}

.product-counter.active {
  border-color: var(--primary-200);
  background: var(--primary-50);
}

.product-counter .counter-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.product-counter .counter-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.counter-btn {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  border: 2px solid var(--gray-200);
  background: var(--surface);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-700);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.counter-btn:hover {
  background: var(--primary-50);
  border-color: var(--primary-300);
  color: var(--primary-700);
}

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

.counter-btn.minus:hover {
  background: var(--error-50);
  border-color: var(--error-500);
  color: var(--error-600);
}

.counter-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
}

.counter-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gray-900);
  min-width: 80px;
  text-align: center;
  line-height: 1;
}

/* === CLIENT INFO HEADER === */
.client-header {
  background: linear-gradient(135deg, var(--primary-50), var(--accent-50));
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--primary-100);
}

.client-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-800);
}

.client-header .client-address {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* === CHECKBOX CUSTOM === */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background var(--transition-fast);
  user-select: none;
}

.checkbox-group:hover { background: var(--gray-50); }

.checkbox-group input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--warning-500);
  cursor: pointer;
}

.checkbox-group label {
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
}

/* === SUCCESS SCREEN === */
.success-screen {
  text-align: center;
  padding: 3rem 1.5rem;
  animation: successPop 0.5s ease-out;
}

@keyframes successPop {
  0% { opacity: 0; transform: scale(0.8); }
  50% { transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

.success-icon {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--success-500), var(--accent-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  margin: 0 auto 1.5rem;
  box-shadow: 0 8px 24px rgba(22, 197, 94, 0.3);
  animation: successBounce 0.6s ease-out 0.2s both;
}

@keyframes successBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.success-screen h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.success-screen .success-details {
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  text-align: left;
}

.success-screen .detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.375rem 0;
  font-size: 0.9375rem;
}

.success-screen .detail-label {
  color: var(--gray-500);
}

.success-screen .detail-value {
  font-weight: 600;
  color: var(--gray-800);
}

/* === ADMIN TABS === */
.admin-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--gray-100);
  padding: 0.25rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.admin-tab {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  font-family: inherit;
}

.admin-tab:hover { color: var(--gray-700); }

.admin-tab.active {
  background: var(--surface);
  color: var(--primary-700);
  box-shadow: var(--shadow-sm);
}

/* === TABLE === */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}

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

.data-table th {
  background: var(--gray-50);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

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

.data-table tr:hover td { background: var(--gray-50); }

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-success {
  background: var(--success-50);
  color: var(--success-700);
}

.badge-warning {
  background: var(--warning-50);
  color: var(--warning-600);
}

.badge-error {
  background: var(--error-50);
  color: var(--error-600);
}

.badge-info {
  background: var(--primary-50);
  color: var(--primary-700);
}

.badge-neutral {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  transition: opacity var(--transition-base);
}

.modal-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  z-index: calc(var(--z-modal) + 1);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  color: var(--gray-500);
}

.modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* === QR DISPLAY === */
.qr-display {
  text-align: center;
  padding: 1.5rem;
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 2px dashed var(--gray-200);
}

.qr-display canvas,
.qr-display img {
  margin: 0 auto;
  border-radius: var(--radius-md);
}

.qr-code-text {
  font-family: 'Courier New', monospace;
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 0.75rem;
  background: var(--gray-50);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  display: inline-block;
}

/* === TOAST === */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1.25rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 280px;
  max-width: 400px;
  pointer-events: auto;
  animation: toastIn 0.3s ease-out;
  border-left: 4px solid;
}

.toast.toast-success { border-left-color: var(--success-500); }
.toast.toast-error { border-left-color: var(--error-500); }
.toast.toast-warning { border-left-color: var(--warning-500); }
.toast.toast-info { border-left-color: var(--primary-500); }

.toast.leaving {
  animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

.toast-icon { font-size: 1.25rem; flex-shrink: 0; }
.toast-message { font-size: 0.875rem; font-weight: 500; color: var(--gray-800); }

/* === SEARCH BAR === */
.search-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.search-bar .form-input {
  flex: 1;
}

/* === FILTERS === */
.filters-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.filters-row .form-input,
.filters-row select.form-input {
  flex: 1;
  min-width: 150px;
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-400);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state h4 {
  font-size: 1.125rem;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}

/* === QR SCAN SIMULATION === */
.scan-simulation {
  background: var(--gray-900);
  border-radius: var(--radius-xl);
  padding: 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.scan-viewfinder {
  width: 200px;
  height: 200px;
  border: 3px solid rgba(59, 130, 246, 0.6);
  border-radius: var(--radius-lg);
  margin: 0 auto 1.5rem;
  position: relative;
  animation: viewfinderPulse 2s ease-in-out infinite;
}

@keyframes viewfinderPulse {
  0%, 100% { border-color: rgba(59, 130, 246, 0.4); box-shadow: 0 0 20px rgba(59, 130, 246, 0.1); }
  50% { border-color: rgba(59, 130, 246, 0.8); box-shadow: 0 0 30px rgba(59, 130, 246, 0.3); }
}

.scan-viewfinder::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--primary-400), transparent);
  animation: scanLine 2s linear infinite;
}

@keyframes scanLine {
  0% { top: 0; }
  100% { top: 100%; }
}

.scan-viewfinder .camera-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  opacity: 0.3;
}

.scan-simulation .scan-label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
}

.scan-client-select {
  margin-top: 1.5rem;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
}

.scan-client-select h4 {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-bottom: 0.75rem;
}

/* === CORRECTION LOG === */
.correction-log {
  background: var(--warning-50);
  border: 1px solid var(--warning-500);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  margin-top: 0.5rem;
}

.correction-log .log-header {
  font-weight: 600;
  color: var(--warning-600);
  margin-bottom: 0.25rem;
}

/* === RESPONSIVE === */

/* Tablet and up */
@media (min-width: 768px) {
  .main-content {
    padding: 2rem;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .login-card {
    padding: 3rem;
  }

  .admin-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .filters-row {
    flex-wrap: nowrap;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .header {
    padding: 0 2rem;
  }

  .main-content {
    padding: 2rem 3rem;
  }
}

/* Mobile only */
@media (max-width: 767px) {
  .header-user .user-name,
  .header-user .user-role {
    display: none;
  }

  .data-table { font-size: 0.8125rem; }
  .data-table th, .data-table td { padding: 0.625rem 0.75rem; }

  .admin-tabs { overflow-x: auto; }

  .modal-container {
    width: 95%;
    max-height: 85vh;
  }

  .filters-row .form-input,
  .filters-row select.form-input {
    min-width: 100%;
  }

  .scan-viewfinder {
    width: 160px;
    height: 160px;
  }
}

/* === PAGE TRANSITION === */
.page-enter {
  animation: pageEnter 0.35s ease-out;
}

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

/* === BACK BUTTON === */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
  font-family: inherit;
  transition: color var(--transition-fast);
}

.back-btn:hover { color: var(--primary-600); }

/* === PAGINATION === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 1.25rem;
}

.pagination button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: all var(--transition-fast);
  font-family: inherit;
}

.pagination button:hover { border-color: var(--primary-300); color: var(--primary-600); }
.pagination button.active {
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: white;
}

/* === DIVIDER === */
.divider {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 1.25rem 0;
}

/* === No compró state === */
.counter-disabled {
  opacity: 0.35;
  pointer-events: none;
}
