:root {
  --bg-dark: #0b0f19;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 34, 53, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --accent-primary: #6366f1;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --font-sans: "Outfit", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: radial-gradient(
    circle at top,
    rgba(99, 102, 241, 0.18),
    transparent 45%
  );
}

.auth-card {
  width: min(430px, 100%);
  padding: 2rem;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: #121826;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.auth-brand {
  margin-bottom: 1.5rem;
}
.auth-card h1 {
  margin-bottom: 0.4rem;
}
.auth-card .panel-desc {
  margin-bottom: 1.5rem;
}
.auth-card .btn {
  width: 100%;
  justify-content: center;
}
.form-error {
  color: var(--accent-rose);
  min-height: 1.4rem;
  margin-bottom: 0.7rem;
  font-size: 0.85rem;
}

.session-widget {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.profile-select {
  accent-color: var(--accent-primary);
  width: 18px;
  height: 18px;
}
.batches-list {
  display: grid;
  gap: 0.75rem;
}
.batch-row {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.9rem;
}
.batch-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 0.65rem 0;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan));
  transition: width 0.25s ease;
}
.batch-meta {
  color: var(--text-muted);
  font-size: 0.82rem;
}
.log-filters {
  display: grid;
  grid-template-columns: 180px minmax(180px, 1fr);
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
}
.toast-region {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 300;
  display: grid;
  gap: 0.6rem;
  width: min(380px, calc(100% - 2rem));
}
.toast {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-cyan);
  border-radius: 9px;
  background: #182033;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.toast.error {
  border-left-color: var(--accent-rose);
}
.toast.success {
  border-left-color: var(--accent-emerald);
}
.confirm-card {
  max-width: 440px;
}
.btn:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

@media (max-width: 760px) {
  .app-layout {
    display: block;
  }
  .sidebar {
    width: 100%;
    min-height: auto;
    position: static;
  }
  .nav-menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .main-content {
    padding: 1rem;
  }
  .top-header,
  .section-header,
  .batch-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .grid-2col,
  .ops-controls-grid,
  .log-filters {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* LAYOUT PRINCIPAL */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 270px;
  background: rgba(13, 17, 28, 0.95);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(
    135deg,
    var(--accent-primary),
    var(--accent-cyan)
  );
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.brand h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.version-badge {
  font-size: 0.7rem;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.nav-item.active {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
}

.system-status-widget {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-indicator.online {
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
}

.status-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* MAIN CONTENT */
.main-content {
  flex-grow: 1;
  padding: 2rem;
  max-width: 1300px;
  margin: 0 auto;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.top-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* BANNER DE ALERTA DE COOKIES */
.alert-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  animation: pulseAlert 2s infinite ease-in-out;
}

.alert-banner.hidden {
  display: none;
}

@keyframes pulseAlert {
  0%,
  100% {
    border-color: rgba(245, 158, 11, 0.4);
  }
  50% {
    border-color: rgba(245, 158, 11, 0.8);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
  }
}

.alert-icon {
  font-size: 1.8rem;
}

.alert-content h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-amber);
}

.alert-content p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* TAB NAVIGATION CONTENT */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

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

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

.stat-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
}

.stat-badge {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
}

.stat-badge.ready {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

/* BOTONES */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: var(--text-muted);
  color: var(--text-main);
}

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

/* CARDS & PANELS */
.card-section,
.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  margin-bottom: 1.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.panel-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  margin-bottom: 1.25rem;
}

/* FORMULARIOS Y CONTROLES */
.form-group {
  margin-bottom: 1.25rem;
}

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

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(11, 15, 25, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.code-font {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.search-box input {
  width: 250px;
  padding: 0.5rem 0.85rem;
}

/* GRID DE PERFILES */
.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.profile-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
}

.profile-card.expiring-warning {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.1);
}

.profile-card.expired-danger {
  border-color: rgba(244, 63, 94, 0.5);
}

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.profile-title-area h4 {
  font-size: 1.1rem;
  font-weight: 600;
}

.badge-status {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.badge-status.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.badge-status.paused {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.cookie-expiration-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  margin-top: 0.4rem;
  display: inline-block;
}

.cookie-expiration-tag.VALID {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
}

.cookie-expiration-tag.EXPIRING_SOON {
  background: rgba(245, 158, 11, 0.18);
  color: var(--accent-amber);
}

.cookie-expiration-tag.EXPIRED {
  background: rgba(244, 63, 94, 0.18);
  color: var(--accent-rose);
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-item span.val {
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.profile-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.tag {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.profile-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 0.85rem;
}

/* LAYOUT 2 COLUMNAS */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .grid-2col {
    grid-template-columns: 1fr;
  }
}

/* RESULTADOS DE IA */
.result-box {
  margin-top: 1rem;
  background: rgba(11, 15, 25, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  min-height: 100px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.placeholder-text {
  color: var(--text-dim);
  font-style: italic;
}

/* CONSOLA DE LOGS */
.console-card {
  padding: 0;
  overflow: hidden;
}

.console-header {
  background: rgba(13, 17, 28, 0.9);
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.console-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot.red {
  background: #ef4444;
}
.dot.yellow {
  background: #f59e0b;
}
.dot.green {
  background: #10b981;
}

.console-title .title {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 0.5rem;
}

.console-body {
  background: #070a11;
  padding: 1rem;
  height: 350px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.log-entry {
  display: flex;
  gap: 0.75rem;
  line-height: 1.4;
}

.log-time {
  color: var(--text-dim);
}

.log-level {
  font-weight: 600;
  padding: 0 4px;
  border-radius: 3px;
}
.log-level.INFO {
  color: var(--accent-cyan);
}
.log-level.SUCCESS {
  color: var(--accent-emerald);
}
.log-level.WARN {
  color: var(--accent-amber);
}
.log-level.ERROR {
  color: var(--accent-rose);
}

.log-msg {
  color: var(--text-main);
}

/* MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #121826;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.text-cyan {
  color: var(--accent-cyan);
}
.text-emerald {
  color: var(--accent-emerald);
}
.text-amber {
  color: var(--accent-amber);
}

/* VISTA DE TABLA COMPACTA Y CONTROLES DE VISTA */
.header-actions-group {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.view-toggle-group {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}

.btn-view-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-view-toggle:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.btn-view-toggle.active {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.selection-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  color: var(--text-main);
  font-size: 0.9rem;
  backdrop-filter: blur(8px);
}

.profiles-table-wrapper {
  width: 100%;
  overflow-x: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.profiles-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.profiles-table th {
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.profiles-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  vertical-align: middle;
  white-space: nowrap;
}

.profiles-table tbody tr {
  transition: background 0.15s ease;
}

.profiles-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.05);
}

.profiles-table tbody tr.selected-row {
  background: rgba(99, 102, 241, 0.12);
}

.profiles-table tbody tr.row-danger {
  background: rgba(244, 63, 94, 0.08);
}

.profiles-table tbody tr.row-warning {
  background: rgba(245, 158, 11, 0.08);
}

.profile-avatar-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-avatar-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 0.85rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.action-buttons-group {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.btn-icon-sm {
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

