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

:root {
  --primary: #3c7878;
  --primary-dark: #2a5a5a;
  --primary-light: #5a9a9a;
  --secondary: #f0a0a0;
  --secondary-dark: #d07878;
  --white: #ffffff;
  --bg: #f5f7f7;
  --text: #2c3e3e;
  --text-light: #6b8a8a;
  --border: #dde8e8;
  --shadow: 0 2px 12px rgba(60,120,120,0.10);
  --shadow-lg: 0 8px 32px rgba(60,120,120,0.15);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* NAVBAR */
.navbar {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 40%, var(--primary-dark) 100%);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 16px rgba(60,120,120,0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand img {
  height: 36px;
  object-fit: contain;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--white);
  font-size: 0.9rem;
}

.navbar-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--white);
  border: 2px solid rgba(255,255,255,0.4);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.navbar-user .avatar:hover {
  background: rgba(255,255,255,0.4);
  transform: scale(1.08);
}

/* MAIN CONTAINER */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem 2.5rem;
}

/* PAGE HEADER */
.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 0.25rem;
}

.page-header p {
  color: var(--text-light);
  font-size: 0.95rem;
}

/* CARDS */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  border: 1px solid var(--border);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title svg {
  color: var(--primary);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(60,120,120,0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  box-shadow: 0 4px 16px rgba(60,120,120,0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary) 0%, #f8c0c0 100%);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(240,160,160,0.3);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--secondary) 100%);
  box-shadow: 0 4px 16px rgba(240,160,160,0.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--bg);
  color: var(--text-light);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--border);
  color: var(--text);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

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

/* FORM ELEMENTS */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  font-family: inherit;
}

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

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

/* TABLE */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

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

thead {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: var(--white);
}

thead th {
  padding: 0.95rem 1.25rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

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

tbody tr:hover {
  background: #f0f7f7;
}

tbody td {
  padding: 0.95rem 1.25rem;
  color: var(--text);
  vertical-align: middle;
}

/* BADGE */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: #e6f4f1;
  color: #2a7a5a;
}

.badge-warning {
  background: #fff4e0;
  color: #b07800;
}

.badge-danger {
  background: #fdeaea;
  color: #c0392b;
}

/* UPLOAD ZONE */
.upload-zone {
  border: 2px dashed var(--primary-light);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #f0f7f7;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: #e6f2f2;
}

.upload-zone svg {
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.upload-zone p {
  color: var(--text-light);
  font-size: 0.9rem;
}

.upload-zone strong {
  color: var(--primary);
}

/* STATS ROW */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.stat-card .stat-sub {
  font-size: 0.78rem;
  color: var(--text-light);
}

/* CHECKBOX */
.checkbox-custom {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
}

.checkbox-custom input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* EMAIL TAGS */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 44px;
  background: var(--white);
  cursor: text;
}

.tag-list:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(60,120,120,0.12);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.tag button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
}

.tag button:hover {
  color: var(--white);
}

/* TOOLBAR */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

/* ALERT */
.alert {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.alert-info {
  background: #e8f4f4;
  color: var(--primary-dark);
  border-left: 4px solid var(--primary);
}

.alert-success {
  background: #e6f4f1;
  color: #2a7a5a;
  border-left: 4px solid #2a7a5a;
}

/* DIVIDER */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

/* BOTÓN VOLVER FLOTANTE */
.btn-volver-flotante {
  position: fixed;
  top: 80px;
  left: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #edb5ae;
  border: 2px solid var(--border);
  box-shadow: 0 4px 16px rgba(60,120,120,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--primary-dark);
  text-decoration: none;
  transition: all 0.2s;
  z-index: 99;
}

.btn-volver-flotante:hover {
  background: #d9958c;
  color: white;
  border-color: #d9958c;
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(60,120,120,0.3);
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .navbar {
    padding: 0 1rem;
  }

  .container {
    padding: 1.25rem 1rem;
  }

  .page-header h1 {
    font-size: 1.4rem;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar .btn {
    justify-content: center;
  }

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

  table {
    min-width: 700px;
  }

  thead th, tbody td {
    font-size: 0.78rem;
    padding: 0.65rem 0.6rem;
  }
}

@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .card {
    padding: 1rem;
  }
}
