/* ============================================================
   Sistema de Comercialización Veterinaria y Agropecuaria
   Diseño Profesional v2.0
   ============================================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-darker: #1e40af;
  --primary-light: #dbeafe;
  --primary-50: #eff6ff;

  --success: #059669;
  --success-light: #d1fae5;
  --success-dark: #047857;

  --warning: #d97706;
  --warning-light: #fef3c7;
  --warning-dark: #b45309;

  --danger: #dc2626;
  --danger-light: #fee2e2;
  --danger-dark: #b91c1c;

  --info: #0284c7;
  --info-light: #e0f2fe;

  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-hover: #f8fafc;
  --bg-muted: #f1f5f9;

  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ============================================================
   LAYOUT
   ============================================================ */

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   HEADER
   ============================================================ */

#header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.header-inner {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-darker));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

#header h1 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.header-user .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.header-user .name {
  font-weight: 500;
  color: var(--text);
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none !important;
}
.btn-logout:hover {
  color: var(--danger);
  border-color: var(--danger-light);
  background: var(--danger-light);
  text-decoration: none !important;
}

/* ============================================================
   NAVBAR
   ============================================================ */

#navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 0;
  flex-shrink: 0;
  overflow-x: auto;
}

#navbar a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 16px;
  height: 42px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  position: relative;
}

#navbar a:hover {
  color: var(--primary);
  background: var(--primary-50);
  text-decoration: none;
}

#navbar a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
  background: transparent;
}

#navbar a .nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  line-height: 1;
  margin-left: 2px;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

#main {
  flex: 1;
  padding: 24px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
}

/* ============================================================
   FOOTER
   ============================================================ */

#footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
  transition: box-shadow 0.2s;
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.card-header:only-child {
  margin-bottom: 0;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.card-body {
  /* for content inside cards */
}

/* ============================================================
   PAGE TITLE
   ============================================================ */

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.4;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none !important;
  white-space: nowrap;
  user-select: none;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
  color: #fff;
}

.btn-secondary {
  background: #fff;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  color: var(--text);
}

.btn-success {
  background: #fff;
  color: var(--success);
  border-color: var(--success);
}
.btn-success:hover {
  background: var(--success);
  color: #fff;
  box-shadow: 0 4px 12px rgba(5,150,105,0.3);
}

.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 12px rgba(220,38,38,0.3);
}

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

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

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

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

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9999px;
  line-height: 1.4;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-success {
  background: var(--success-light);
  color: var(--success-dark);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger-dark);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning-dark);
}

.badge-muted {
  background: var(--bg-muted);
  color: var(--text-muted);
}

.badge-info {
  background: var(--info-light);
  color: var(--info);
}

/* ============================================================
   ALERTS / MESSAGES
   ============================================================ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success {
  background: var(--success-light);
  color: var(--success-dark);
  border: 1px solid #a7f3d0;
}

.alert-danger {
  background: var(--danger-light);
  color: var(--danger-dark);
  border: 1px solid #fecaca;
}

.alert-warning {
  background: var(--warning-light);
  color: var(--warning-dark);
  border: 1px solid #fde68a;
}

.alert-info {
  background: var(--info-light);
  color: var(--info);
  border: 1px solid #bae6fd;
}

.alert-icon {
  font-size: 16px;
  line-height: 1.4;
  flex-shrink: 0;
}

/* ============================================================
   TABLES
   ============================================================ */

.table-wrap {
  overflow-x: auto;
  margin-bottom: 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th {
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text);
}

.table tbody tr {
  transition: background 0.1s;
}

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

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

.table .cell-id { width: 40px; }
.table .cell-muted {
  color: var(--text-muted);
  font-size: 12px;
}

.table .cell-strong {
  font-weight: 600;
}

/* ============================================================
   FORMS
   ============================================================ */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-grid.three {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}

.form-control {
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: all 0.15s;
  width: 100%;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.form-control:disabled,
.form-control[readonly] {
  background: var(--bg-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-control::placeholder {
  color: var(--text-muted);
}

textarea.form-control {
  resize: vertical;
  min-height: 70px;
}

select.form-control {
  cursor: pointer;
  appearance: auto;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.radio-group {
  display: flex;
  gap: 20px;
  padding: 6px 0;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  user-select: none;
}

.radio-group input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

/* ============================================================
   ACTION BAR
   ============================================================ */

.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-form input[type="text"] {
  padding: 9px 14px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  outline: none;
  transition: all 0.15s;
  width: 220px;
  font-family: inherit;
}

.search-form input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state .empty-text {
  font-size: 14px;
}

/* ============================================================
   STATS GRID (Reportes)
   ============================================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card .stat-icon {
  font-size: 22px;
  margin-bottom: 8px;
  line-height: 1;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card .stat-change {
  font-size: 11px;
  margin-top: 6px;
  font-weight: 600;
}

/* ============================================================
   CHARTS (Reportes)
   ============================================================ */

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.chart-box h3 {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.chart-box canvas {
  max-height: 250px;
  max-width: 100%;
}

@media (max-width: 768px) {
  .chart-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.three { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .search-form input[type="text"] { width: 160px; }
  .header-inner { padding: 0 16px; }
  #main { padding: 16px; }
  .card { padding: 16px; }
  #navbar { padding: 0 12px; }
  #navbar a { padding: 0 10px; font-size: 12px; }
  #header h1 { font-size: 12px; }
}

/* ============================================================
   TOAST (legacy compatibility for productos)
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  animation: slideInRight 0.35s ease-out;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px 18px;
  min-width: 300px;
  max-width: 420px;
  border-left: 4px solid;
}

.toast-success {
  border-left-color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast .toast-icon {
  font-size: 20px;
  line-height: 1;
}

.toast .toast-msg {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  flex: 1;
}

.toast .toast-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}
.toast .toast-close:hover {
  color: var(--text-secondary);
}

.toast.fade-out {
  animation: fadeOutRight 0.3s ease-in forwards;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOutRight {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(50px); opacity: 0; }
}

/* ============================================================
   TOGGLE SWITCH (config checkbox style)
   ============================================================ */

.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle .slider {
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 9999px;
  transition: 0.2s;
  position: relative;
  flex-shrink: 0;
}

.toggle .slider::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: 0.2s;
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .slider {
  background: var(--primary);
}

.toggle input:checked + .slider::after {
  transform: translateX(16px);
}

/* Card narrow/wide variants */
.card-narrow {
  max-width: 700px;
  margin: 0 auto;
}
.card-wide {
  max-width: 1000px;
  margin: 0 auto;
}

/* Section titles in detail views */
.section-title {
  margin: 24px 0 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Font weight */
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* Text strong color */
.text-strong {
  color: var(--text);
  font-weight: 600;
}

/* White-space nowrap */
.text-nowrap {
  white-space: nowrap;
}

/* Total bar for compra form */
.total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.total-bar .total-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

/* Config table inputs */
.config-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}
.config-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}
.config-input-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}
.config-input[readonly] {
  background: var(--bg-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Alert pending row highlight */
tr.alerta-pendiente td {
  background: #FFFBEB !important;
}

/* Table footer totals */
.table tfoot th {
  padding: 12px 16px;
  border-top: 2px solid var(--border);
  background: var(--bg-hover);
}
.table tfoot .total-value {
  font-size: 16px;
  color: var(--success);
  font-weight: 700;
}

/* Filter inline group */
.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-group label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Form grid compact variant */
.form-grid-compact {
  margin-bottom: 20px;
}

/* Inline block helper */
.inline-block { display: inline-block; }

/* Config description input */
.config-desc {
  font-size: 12px;
  color: #666;
}

/* Badge wrapper padding */
.badge-wrapper {
  padding: 10px 0;
}

/* ============================================================
   DASHBOARD HERO
   ============================================================ */

.dash-hero {
  background: linear-gradient(135deg, #059669 0%, #047857 40%, #065F46 100%);
  border-radius: 20px; padding: 36px 40px; margin-bottom: 32px;
  position: relative; overflow: hidden;
  box-shadow: 0 12px 48px rgba(5,150,105,0.18);
}
.dash-hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(900px 450px at 85% 10%, rgba(255,255,255,0.10) 0%, transparent 70%),
    radial-gradient(500px 300px at 15% 95%, rgba(255,255,255,0.05) 0%, transparent 70%);
  pointer-events: none;
}
.dash-hero::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 30% 50%, rgba(255,255,255,0.03) 0%, transparent 50%),
    radial-gradient(circle at 70% 30%, rgba(255,255,255,0.02) 0%, transparent 40%);
  background-size: 100% 100%;
  pointer-events: none;
  animation: hero-shimmer 8s ease-in-out infinite alternate;
}
@keyframes hero-shimmer {
  0% { opacity: 0.4; }
  100% { opacity: 0.8; }
}
.dash-hero-content {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px;
}
.dash-hero-left .dash-greeting {
  font-size: 12px; font-weight: 600;
  color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px;
}
.dash-hero-left h2 {
  font-size: 28px; font-weight: 700; color: #fff; margin: 0; letter-spacing: -0.03em; line-height: 1.2;
}
.dash-hero-left .dash-date {
  font-size: 13px; color: rgba(255,255,255,0.55); margin-top: 8px; display: flex; align-items: center; gap: 8px;
}
.dash-hero-right { display: flex; align-items: center; gap: 16px; }
.dash-hero-badge {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 20px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  transition: background 0.2s;
}
.dash-hero-badge:hover { background: rgba(255,255,255,0.12); }
.dash-hero-badge span { font-size: 13px; color: rgba(255,255,255,0.8); font-weight: 500; }
.dash-hero-badge strong { color: #fff; font-weight: 700; }
.dash-hero-badge .badge-dot {
  width: 10px; height: 10px; border-radius: 50%; animation: pulse-dot 2s infinite;
  box-shadow: 0 0 12px currentColor;
}
.badge-dot.online { background: #34D399; color: rgba(52,211,153,0.5); }
.badge-dot.warning { background: #FBBF24; color: rgba(251,191,36,0.5); animation: pulse-dot-warning 2s infinite; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.15); }
}
@keyframes pulse-dot-warning {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ============================================================
   DASHBOARD STATS
   ============================================================ */

.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.dash-stat {
  background: #fff;
  border-radius: 16px;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  cursor: default;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.dash-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 16px 16px 0 0;
}
.dash-stat.accent-green::before { background: linear-gradient(90deg, #059669, #34D399); }
.dash-stat.accent-blue::before { background: linear-gradient(90deg, #3B82F6, #60A5FA); }
.dash-stat.accent-amber::before { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.dash-stat.accent-purple::before { background: linear-gradient(90deg, #8B5CF6, #A78BFA); }
.dash-stat.accent-pink::before { background: linear-gradient(90deg, #EC4899, #F472B6); }
.dash-stat.accent-red::before { background: linear-gradient(90deg, #EF4444, #F87171); }
.dash-stat.accent-emerald::before { background: linear-gradient(90deg, #10B981, #34D399); }
.dash-stat:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.03);
  transform: translateY(-4px);
}
.dash-stat .stat-accent { display: none; }
.dash-stat .stat-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; min-height: 20px; }
.dash-stat .stat-value { font-size: 30px; font-weight: 700; color: var(--text); line-height: 1.1; margin-bottom: 2px; letter-spacing: -0.03em; }
.dash-stat .stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.dash-stat .stat-sub { font-size: 11px; color: #D1D5DB; margin-top: 4px; }
.dash-stat .stat-trend {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: #F3F4F6; color: #6B7280;
}
.dash-stat .stat-trend.up { background: #D1FAE5; color: #047857; }
.dash-stat .stat-trend.down { background: #FEE2E2; color: #B91C1C; }

/* ============================================================
   DASHBOARD GRID / CARDS
   ============================================================ */

.dash-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.dash-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.dash-card:hover { box-shadow: 0 8px 32px rgba(0,0,0,0.05); }
.dash-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #F3F4F6;
}
.dash-card-header .dash-card-title {
  font-size: 14px; font-weight: 600; color: #111827;
  display: flex; align-items: center; gap: 10px;
}
.dash-card-header .dash-card-title .title-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}
.dash-card-header .dash-card-action a {
  font-size: 12px; font-weight: 500; color: #059669; text-decoration: none;
  padding: 6px 12px; border-radius: 8px; transition: all 0.15s;
}
.dash-card-header .dash-card-action a:hover { background: #ECFDF5; color: #047857; text-decoration: none; }
.dash-card-body { padding: 6px 0; }

.dash-card-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 36px 20px;
}
.dash-card-empty .empty-text-sm { font-size: 13px; color: #9CA3AF; }

/* ============================================================
   QUICK ACTIONS
   ============================================================ */

.dash-actions {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 32px;
}
.dash-actions a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  font-size: 13px; font-weight: 500; color: #374151;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.dash-actions a:hover {
  border-color: #059669; color: #059669;
  box-shadow: 0 8px 24px rgba(5,150,105,0.10);
  text-decoration: none; transform: translateY(-3px);
}
.dash-actions a .action-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px;
  background: #ECFDF5; color: #059669;
  font-size: 14px; font-weight: 700;
  transition: all 0.2s;
}
.dash-actions a:hover .action-icon {
  background: #059669; color: #fff;
}

/* ============================================================
   ALERT ITEMS (inside dash-cards)
   ============================================================ */

.alert-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px; border-bottom: 1px solid #F3F4F6; transition: background 0.2s;
}
.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: #F9FAFB; }
.alert-item .alert-icon-box {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; flex-shrink: 0;
}
.alert-icon-box.critico { background: #FEE2E2; color: #B91C1C; }
.alert-icon-box.alerta { background: #FEF3C7; color: #92400E; }
.alert-icon-box.info { background: #DBEAFE; color: #1E40AF; }
.alert-item .alert-info { flex: 1; min-width: 0; }
.alert-item .alert-info .alert-title { font-size: 13px; font-weight: 600; color: #111827; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-item .alert-info .alert-desc { font-size: 12px; color: #6B7280; margin-top: 1px; }
.alert-item .alert-right { text-align: right; flex-shrink: 0; }
.alert-item .alert-right .alert-badge { font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 999px; display: inline-block; }
.alert-item .alert-right .alert-badge.critico { background: #FEE2E2; color: #B91C1C; }
.alert-item .alert-right .alert-badge.medio { background: #FEF3C7; color: #92400E; }
.alert-item .alert-right .alert-badge.bajo { background: #DBEAFE; color: #1E40AF; }
.alert-item .alert-right .alert-meta { font-size: 11px; color: #9CA3AF; margin-top: 2px; }

/* ============================================================
   ACTIVITY ITEM (dash-card)
   ============================================================ */

.activity-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px; border-bottom: 1px solid #F3F4F6; transition: background 0.2s;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: #F9FAFB; }
.activity-item .activity-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0; color: #fff;
}
.activity-item .activity-info { flex: 1; min-width: 0; }
.activity-item .activity-info .activity-title { font-size: 13px; font-weight: 500; color: #111827; }
.activity-item .activity-info .activity-title strong { font-weight: 600; }
.activity-item .activity-info .activity-meta { font-size: 11px; color: #9CA3AF; margin-top: 1px; }
.activity-item .activity-amount { font-size: 14px; font-weight: 700; color: #059669; flex-shrink: 0; }

/* ============================================================
   HERO BLUE (Clientes)
   ============================================================ */

.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 40%, var(--primary-darker) 100%);
  border-radius: 16px; padding: 28px 32px; margin-bottom: 24px;
  position: relative; overflow: hidden;
  box-shadow: 0 8px 32px rgba(37,99,235,0.2);
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 500px 250px at 90% 20%, rgba(255,255,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }
.hero-title { font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.02em; color: #fff; }
.hero-sub { font-size: 13px; margin-bottom: 16px; color: rgba(255,255,255,0.65); }
.hero-stats { display: flex; gap: 24px; flex-wrap: wrap; }
.hero-stat {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 10px 18px; border-radius: 10px;
}
.hero-stat-value { font-size: 22px; font-weight: 700; color: #fff; line-height: 1; }
.hero-stat-label { font-size: 12px; color: rgba(255,255,255,0.6); }

/* ============================================================
   FILTER PILLS
   ============================================================ */

.filter-pills { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-pill {
  padding: 6px 14px; font-size: 12px; font-weight: 500; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; color: var(--text-muted);
  cursor: pointer; transition: all 0.15s; text-decoration: none !important;
}
.filter-pill:hover { border-color: var(--primary); color: var(--primary); }
.filter-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============================================================
   AVATAR INITIALS
   ============================================================ */

.avatar-initial {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}

/* ============================================================
   IMAGE THUMBNAILS & DETAIL
   ============================================================ */

.img-thumb {
  width: 36px; height: 36px; border-radius: 8px;
  object-fit: cover; border: 1px solid var(--border);
}
.img-placeholder {
  display: inline-flex; width: 36px; height: 36px; border-radius: 8px;
  background: var(--bg-muted); align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.img-detail { max-width: 200px; border-radius: 10px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.detail-stock { font-weight: 700; }

/* Stat accent colors */
.accent-green { background: #059669; }
.accent-blue { background: #3B82F6; }
.accent-amber { background: #F59E0B; }
.accent-purple { background: #8B5CF6; }
.accent-pink { background: #EC4899; }
.accent-red { background: #EF4444; }
.accent-emerald { background: #10B981; }

/* Title dot colors */
.title-dot-red { background: #EF4444; }
.title-dot-green { background: #059669; }
.title-dot-purple { background: #8B5CF6; }

/* Activity avatar state colors */
.avatar-green { background: #059669; }
.avatar-red { background: #EF4444; }
.avatar-amber { background: #F59E0B; }

/* Badge inline helper */
.badge-sm { font-size: 10px; margin-left: 6px; }

/* Stat value state colors */
.stat-value-danger { color: #DC2626; }
.stat-value-success { color: #059669; }

/* Muted separator */
.sep-muted { margin: 0 4px; opacity: 0.3; }

/* Card with bottom margin */
.card-mb { margin-bottom: 28px; }

/* ============================================================
   CARD BAR (header bar inside cards)
   ============================================================ */

.card-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-light);
}
.card-bar-label { font-size: 13px; color: var(--text-muted); }

/* ============================================================
   PROFILE HEADER (clientes/ver, etc.)
   ============================================================ */

.profile-header {
  display: flex; align-items: center; gap: 24px;
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 32px; margin-bottom: 24px;
}
.profile-avatar {
  width: 72px; height: 72px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.profile-info { flex: 1; }
.profile-info h2 { margin: 0; font-size: 22px; font-weight: 700; color: var(--text); }
.profile-info .profile-meta { margin-top: 4px; font-size: 13px; color: var(--text-secondary); }
.profile-info .profile-meta span { margin-right: 16px; }
.profile-actions { display: flex; gap: 8px; flex-shrink: 0; }

.profile-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.profile-stat {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 20px; text-align: center;
}
.profile-stat .ps-val { font-size: 24px; font-weight: 700; color: var(--text); }
.profile-stat .ps-lbl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.contact-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-bottom: 24px;
}
.contact-item {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 18px;
}
.contact-item .ci-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.contact-item .ci-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.contact-item .ci-value { font-size: 14px; color: var(--text); font-weight: 500; }

/* ============================================================
   RESPONSIVE: dashboard
   ============================================================ */

@media (max-width: 768px) {
  .dash-hero { padding: 28px 24px; }
  .dash-hero-left h2 { font-size: 22px; }
  .dash-hero-content { flex-direction: column; align-items: flex-start; }
  .dash-hero-right { width: 100%; justify-content: flex-start; }
  .dash-stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .dash-grid-2col { grid-template-columns: 1fr; gap: 16px; }
  .dash-actions a { flex: 1; justify-content: center; }
  .alert-item { padding: 12px 16px; }
  .activity-item { padding: 12px 16px; }
  .dash-card-header { padding: 14px 16px; }
}

@media (max-width: 480px) {
  .dash-stats { grid-template-columns: 1fr; }
  .dash-hero { padding: 24px 18px; border-radius: 16px; }
  .dash-hero-left h2 { font-size: 18px; }
  .dash-hero-left .dash-greeting { font-size: 11px; }
  .dash-hero-right { flex-wrap: wrap; gap: 10px; }
  .dash-hero-badge { width: 100%; justify-content: center; }
  .dash-stat { padding: 16px; }
  .dash-stat .stat-value { font-size: 24px; }
}

/* ============================================================
   RESPONSIVE: small screens
   ============================================================ */

@media (max-width: 640px) {
  .header-right .name { display: none; }
  .header-right .btn-logout span { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .action-bar { flex-direction: column; align-items: stretch; }
  .search-form { width: 100%; }
  .search-form input[type="text"] { flex: 1; width: auto; }
  .card-header { flex-direction: column; align-items: stretch; }
  .card-header .btn { width: 100%; justify-content: center; }
  .profile-header { flex-direction: column; text-align: center; padding: 20px; }
  .profile-actions { width: 100%; justify-content: center; }
  .contact-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 0;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.15s;
}
.pagination a:hover {
  border-color: var(--primary);
  color: var(--primary);
  z-index: 1;
}
.pagination a.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  z-index: 1;
}
.pagination a.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.pagination .page-info {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 8px;
  border: none;
}
