/* ==========================================================================
   SISTEMA DE DISEÑO & VARIABLES (Premium Dark Theme)
   ========================================================================== */
:root {
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Paleta de Colores HSL Tailored */
  --bg-app: hsl(225, 25%, 9%);
  --bg-sidebar: hsl(225, 24%, 12%);
  --bg-card: hsla(225, 20%, 15%, 0.7);
  --bg-card-hover: hsla(225, 20%, 18%, 0.85);
  --border-color: hsla(225, 15%, 25%, 0.4);
  --border-color-glow: hsla(250, 80%, 65%, 0.3);
  
  --color-primary: hsl(250, 80%, 65%);
  --color-primary-glow: hsla(250, 80%, 65%, 0.4);
  --color-secondary: hsl(190, 90%, 50%);
  --color-secondary-glow: hsla(190, 90%, 50%, 0.3);
  
  --text-main: hsl(220, 20%, 95%);
  --text-muted: hsl(220, 10%, 65%);
  --text-inverse: hsl(225, 25%, 9%);
  
  /* Estados */
  --status-success: hsl(145, 80%, 45%);
  --status-warning: hsl(35, 90%, 50%);
  --status-danger: hsl(0, 85%, 60%);
  --status-info: hsl(200, 85%, 55%);
  
  /* Sombras y Efectos */
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px 0 var(--color-primary-glow);
  
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset General */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

button, input, textarea {
  font-family: inherit;
  color: inherit;
  outline: none;
}

/* ==========================================================================
   ESTRUCTURA Y LAYOUT PRINCIPAL
   ========================================================================== */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* Animación de fondo decorativo */
.app-container::before {
  content: '';
  position: absolute;
  top: -10%;
  right: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, var(--color-primary-glow) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
  filter: blur(80px);
}

/* ==========================================================================
   SIDEBAR (Menú Lateral)
   ========================================================================== */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.logo-icon i {
  color: var(--text-main);
  width: 22px;
  height: 22px;
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(to right, #fff, #b3b3b3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: transparent;
  border: none;
  padding: 14px 18px;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: var(--transition-normal);
  position: relative;
}

.nav-item i {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.nav-item span {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.nav-item:hover {
  background-color: var(--bg-card-hover);
}

.nav-item:hover i, .nav-item:hover span {
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(90deg, hsla(250, 80%, 65%, 0.15) 0%, transparent 100%);
  border-left: 3px solid var(--color-primary);
  border-radius: 0 12px 12px 0;
  padding-left: 15px;
}

.nav-item.active i {
  color: var(--color-primary);
}

.nav-item.active span {
  color: var(--text-main);
  font-weight: 600;
}

.badge {
  background-color: var(--color-primary);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: auto;
}

.sidebar-footer {
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.status-dot.online {
  background-color: var(--status-success);
  box-shadow: 0 0 8px var(--status-success);
}

/* Pulsación para la luz verde */
@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

.status-dot.online::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: var(--status-success);
  animation: pulse 2s infinite ease-in-out;
}

/* ==========================================================================
   MAIN CONTENT & HEADER
   ========================================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 32px;
  overflow-y: auto;
  z-index: 1;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-shrink: 0;
}

.welcome h2 {
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 30%, #a3a3a3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.welcome p {
  color: var(--text-muted);
  font-size: 14px;
}

.api-status-container {
  display: flex;
  gap: 12px;
}

.api-badge {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.api-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--status-warning);
}

.api-badge.connected .dot {
  background-color: var(--status-success);
  box-shadow: 0 0 6px var(--status-success);
}

.api-badge.mock .dot {
  background-color: var(--status-info);
  box-shadow: 0 0 6px var(--status-info);
}

.api-badge strong.val {
  color: var(--text-main);
  font-weight: 600;
}

/* ==========================================================================
   ELEMENTOS DE INTERFAZ COMUNES (Cards, Botones)
   ========================================================================== */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
  border-color: var(--border-color-glow);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), hsl(250, 70%, 55%));
  border: none;
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-fast);
}

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

.btn-danger {
  background-color: transparent;
  border: 1px solid hsla(0, 85%, 60%, 0.3);
  color: var(--status-danger);
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.btn-danger:hover {
  background-color: hsla(0, 85%, 60%, 0.1);
  border-color: var(--status-danger);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--color-primary);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.btn-text:hover {
  text-decoration: underline;
  color: var(--color-secondary);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-title h3 {
  font-size: 18px;
  font-weight: 600;
}

.section-title span {
  font-size: 13px;
  color: var(--text-muted);
}

/* ==========================================================================
   PAGINA DE BUSQUEDA / MONITOREO
   ========================================================================== */
.search-section {
  margin-bottom: 32px;
}

.search-box {
  display: flex;
  gap: 12px;
  position: relative;
}

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

.search-box input {
  flex: 1;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  padding: 14px 18px 14px 48px;
  border-radius: 12px;
  font-size: 15px;
  transition: var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(138, 92, 246, 0.15);
}

.search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition-fast);
  color: var(--text-muted);
}

.tag:hover {
  border-color: var(--color-secondary);
  color: var(--text-main);
  background-color: var(--bg-card-hover);
}

/* Grid de resultados */
.grid-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.result-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  /* Sin backdrop-filter: con decenas de tarjetas, el blur por tarjeta hace
     que el render sea muy lento. Usamos un fondo sólido equivalente. */
  backdrop-filter: none;
  background-color: hsl(225, 20%, 15%);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.organismo {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-secondary);
  max-width: 70%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lic-code {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.result-card h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
  height: 44px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.result-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
  flex-grow: 1;
  height: 58px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.result-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lic-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.meta-item i {
  width: 14px;
  height: 14px;
}

.meta-item strong {
  color: var(--text-main);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s infinite linear;
  margin: 20px auto;
}

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

.loading-state {
  text-align: center;
  padding: 40px 0;
}

.loading-state p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 10px;
}

/* ==========================================================================
   VISTA PIPELINE (Kanban/Detalle)
   ========================================================================== */
.pipeline-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 24px;
  flex: 1;
  height: calc(100vh - 160px);
  overflow: hidden;
}

.pipeline-list-section {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-right: 8px;
}

.pipeline-list-section::-webkit-scrollbar {
  width: 6px;
}

.pipeline-list-section::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 3px;
}

.licitaciones-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pipeline-card {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.pipeline-card:hover {
  border-color: var(--color-primary-glow);
  transform: translateX(4px);
}

.pipeline-card.selected {
  border-color: var(--color-primary);
  background: linear-gradient(135deg, var(--bg-sidebar) 50%, rgba(138, 92, 246, 0.08) 100%);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.pipeline-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pipeline-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 12px;
}

.status-tag {
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 11px;
}

.status-tag.pendiente {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.status-tag.en_preparacion {
  background-color: rgba(255, 165, 0, 0.15);
  color: var(--status-warning);
}

.status-tag.postulado {
  background-color: rgba(0, 200, 83, 0.15);
  color: var(--status-success);
}

/* Detalle Panel */
.pipeline-detail-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.detail-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.detail-empty-state i {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  stroke-width: 1.5;
}

.detail-empty-state h4 {
  color: var(--text-main);
  margin-bottom: 8px;
  font-size: 18px;
}

/* Contenido de Detalle Activo */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.detail-header h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.detail-header-actions {
  display: flex;
  gap: 10px;
}

.ai-alert-box {
  background: linear-gradient(135deg, rgba(138, 92, 246, 0.15) 0%, rgba(30, 200, 240, 0.05) 100%);
  border: 1px solid rgba(138, 92, 246, 0.25);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
}

.ai-alert-box i {
  color: var(--color-secondary);
  flex-shrink: 0;
}

.ai-alert-box h5 {
  font-weight: 600;
  margin-bottom: 4px;
}

.ai-alert-box p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.detail-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-section-card {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px;
}

.detail-section-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.detail-section-card h4 i {
  width: 18px;
  height: 18px;
  color: var(--color-primary);
}

/* Checklist de Documentos */
.checklist-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}

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

.checklist-item.checked span {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Fechas y puntajes */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}

.info-list-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border-color);
}

.info-list-item span:first-child {
  color: var(--text-muted);
}

.info-list-item span:last-child {
  font-weight: 600;
}

/* Formulario de preparación */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

.form-group select { cursor: pointer; }
.form-group select option { background-color: var(--bg-sidebar); color: var(--text-main); }

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--color-primary);
}

.input-with-addon {
  display: flex;
  align-items: center;
}

.addon {
  background-color: var(--border-color);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px 0 0 8px;
  border: 1px solid var(--border-color);
  border-right: none;
}

.input-with-addon input {
  border-radius: 0 8px 8px 0;
}

/* AI Trigger state */
.ai-trigger-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  background-color: rgba(138, 92, 246, 0.03);
  border: 1px dashed var(--color-primary-glow);
  border-radius: 12px;
}

.ai-trigger-state i {
  width: 32px;
  height: 32px;
  color: var(--color-primary);
  margin-bottom: 12px;
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px var(--color-primary-glow)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 8px var(--color-primary)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 2px var(--color-primary-glow)); }
}

/* ==========================================================================
   TABLA DE CONFIGURACION & LOGS
   ========================================================================== */
.config-grid {
  display: grid;
  grid-template-columns: 450px 1fr;
  gap: 24px;
  height: calc(100vh - 180px);
}

.config-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.config-card h3 {
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-card h3 i {
  color: var(--color-primary);
}

.description {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.logs-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.logs-console {
  flex: 1;
  background-color: hsl(225, 30%, 6%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  font-family: monospace;
  font-size: 12px;
  overflow-y: auto;
  line-height: 1.6;
}

.log-entry {
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  padding-bottom: 4px;
}

.log-time {
  color: var(--text-muted);
  margin-right: 8px;
}

.log-type {
  font-weight: 700;
  margin-right: 8px;
  text-transform: uppercase;
}

.log-type.busqueda { color: var(--color-secondary); }
.log-type.guardado { color: var(--color-primary); }
.log-type.analisis_ia { color: var(--status-success); }
.log-type.postulacion_estado { color: var(--status-warning); }
.log-type.config { color: var(--text-main); }
.log-type.eliminar { color: var(--status-danger); }

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity var(--transition-normal);
}

.modal-content {
  width: 600px;
  max-width: 90%;
  animation: modalSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-secondary);
}

.btn-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-close:hover {
  color: var(--text-main);
}

.step-list {
  padding-left: 20px;
  margin: 14px 0;
  font-size: 14px;
  line-height: 1.6;
}

.step-list li {
  margin-bottom: 8px;
}

.modal-data-preview {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  margin-top: 14px;
}

.modal-data-preview h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.modal-data-preview pre {
  font-family: monospace;
  font-size: 11px;
  color: var(--color-secondary);
  max-height: 150px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  margin-top: 16px;
}

/* ==========================================================================
   MEJORAS: STATS, TOOLBAR, FILTROS, BADGES, URGENCIA
   ========================================================================== */
.stats-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.stat-chip {
  flex: 1;
  min-width: 130px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-chip .stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}

.stat-chip .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-chip.danger .stat-num { color: var(--status-danger); }
.stat-chip.success .stat-num { color: var(--status-success); }
.stat-chip.warning .stat-num { color: var(--status-warning); }

.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.result-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip.active {
  background: linear-gradient(135deg, var(--color-primary), hsl(250, 70%, 55%));
  color: var(--text-main);
  border-color: transparent;
  font-weight: 600;
}

.results-search-mini {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 240px;
  flex: 1;
  max-width: 360px;
}

.results-search-mini i {
  position: absolute;
  left: 12px;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.results-search-mini input {
  width: 100%;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 9px 12px 9px 34px;
  font-size: 13px;
  transition: var(--transition-fast);
}

.results-search-mini input:focus {
  border-color: var(--color-primary);
}

/* Urgencia: borde rojo si cierra pronto */
.result-card.urgente {
  border-color: hsla(0, 85%, 60%, 0.5);
  box-shadow: 0 0 0 1px hsla(0, 85%, 60%, 0.2);
}

.urgency-flag {
  font-size: 11px;
  font-weight: 700;
  color: var(--status-danger);
}

/* Skeleton de carga para enriquecimiento */
.skeleton {
  display: inline-block;
  height: 11px;
  width: 90px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--border-color) 25%, var(--bg-card-hover) 50%, var(--border-color) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  vertical-align: middle;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Estados de postulación extra */
.status-tag.descartado {
  background-color: hsla(0, 85%, 60%, 0.12);
  color: var(--status-danger);
}

/* Botones rápidos de estado en el detalle */
.estado-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.estado-btn {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.estado-btn:hover { border-color: var(--color-primary); color: var(--text-main); }
.estado-btn.active {
  background: linear-gradient(135deg, var(--color-primary), hsl(250, 70%, 55%));
  color: var(--text-main);
  border-color: transparent;
}

/* Badges genéricos (tipo/garantía) ya usan estilo inline; refuerzo accesible */
.result-badges span { line-height: 1.6; }

/* ==========================================================================
   TOASTS / NOTIFICACIONES
   ========================================================================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  max-width: 360px;
}

.toast {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--color-primary);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-main);
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.ok { border-left-color: var(--status-success); }
.toast.error { border-left-color: var(--status-danger); }
.toast.info { border-left-color: var(--status-info); }
.toast.warn { border-left-color: var(--status-warning); }

.toast i { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast.ok i { color: var(--status-success); }
.toast.error i { color: var(--status-danger); }
.toast.info i { color: var(--status-info); }
.toast.warn i { color: var(--status-warning); }

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

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

/* ==========================================================================
   LOGIN (acceso administradores)
   ========================================================================== */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 30% 20%, var(--color-primary-glow) 0%, transparent 45%),
    radial-gradient(circle at 80% 80%, var(--color-secondary-glow) 0%, transparent 45%),
    var(--bg-app);
  z-index: 300;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 36px 30px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 4px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}
.login-logo i { color: #fff; width: 28px; height: 28px; }

.login-card h1 { font-size: 20px; font-weight: 700; }
.login-card > p { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.login-card input {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  text-transform: none;
  letter-spacing: normal;
}
.login-card input:focus { border-color: var(--color-primary); }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 6px; padding: 13px; }
.login-error { color: var(--status-danger); font-size: 13px; min-height: 18px; margin: 0; }

/* ==========================================================================
   UTILIDADES
   ========================================================================== */
.hidden {
  display: none !important;
}
