/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-700); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) { background: var(--gray-bg); color: var(--text); }

.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
}

.card-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 20px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.tile:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--primary-100);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}

.tile-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}

.tile-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* FORM ELEMENTS */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.form-section {
  margin-bottom: 28px;
}

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-100);
}

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

.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.field-help {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 2px;
}

.field-input,
.field-select {
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-input:focus,
.field-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.field-suffix {
  display: flex;
  align-items: center;
}

.field-suffix .field-input {
  flex: 1;
  border-radius: 6px 0 0 6px;
  border-right: none;
}

.field-suffix .suffix {
  padding: 8px 12px;
  background: var(--gray-bg);
  border: 1px solid var(--border-strong);
  border-radius: 0 6px 6px 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* TABLES */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  background: var(--surface-2);
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }

.table-num { text-align: right; font-variant-numeric: tabular-nums; }

/* SCORE BANDS */
.band {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.band-VERDE { background: var(--green-bg); color: var(--green); }
.band-ÁMBAR { background: var(--amber-bg); color: var(--amber); }
.band-ROJO  { background: var(--red-bg);  color: var(--red); }
.band-GRIS  { background: var(--gray-bg); color: var(--gray); }

/* RESULT BLOCKS */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.metric-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.metric.highlight {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-700) 100%);
  color: white;
  border-color: var(--primary);
}
.metric.highlight .metric-label { color: rgba(255,255,255,0.7); }
.metric.highlight .metric-value { color: white; }
.metric.highlight .metric-sub { color: rgba(255,255,255,0.7); }

/* TOP 3 */
.top3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 16px 0 24px;
}

.top3-item {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
}

.top3-item.rank-1 { border-color: var(--green); }
.top3-item.rank-2 { border-color: var(--amber); }

.rank-badge {
  position: absolute;
  top: -10px;
  left: 16px;
  background: var(--primary);
  color: white;
  padding: 2px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
}

.top3-item .rank-badge { background: var(--gray); }
.top3-item.rank-1 .rank-badge { background: var(--green); }
.top3-item.rank-2 .rank-badge { background: var(--amber); }

.top3-name {
  font-size: 18px;
  font-weight: 700;
  margin: 8px 0 4px;
}

.top3-score {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.top3-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ACTIONS BAR */
.actions-bar {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

/* ALERTS */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
}

.alert-info  { background: #e0f2fe; color: #075985; border-left: 3px solid #0284c7; }
.alert-warn  { background: var(--amber-bg); color: var(--amber); border-left: 3px solid var(--amber); }
.alert-error { background: var(--red-bg); color: var(--red); border-left: 3px solid var(--red); }
.alert-ok    { background: var(--green-bg); color: var(--green); border-left: 3px solid var(--green); }

/* DOC LIST */
.doc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
}

.doc-item:hover {
  border-color: var(--primary);
  background: var(--surface-2);
}

.doc-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.doc-icon.xlsx { background: #1e7245; }
.doc-icon.docx { background: #2b5797; }
.doc-icon.pptx { background: #b7472a; }
.doc-icon.pdf  { background: #d22f2f; }
.doc-icon.png, .doc-icon.jpg, .doc-icon.jpeg, .doc-icon.kml { background: #6b7280; }

.doc-info { flex: 1; min-width: 0; }
.doc-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-cat {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* TABS */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 16px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* CHIPS */
.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.chip {
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--gray-bg);
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* COMPLETENESS METER */
.meter {
  height: 8px;
  background: var(--gray-bg);
  border-radius: 100px;
  overflow: hidden;
  margin: 8px 0;
}

.meter-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
}

.meter-fill.low    { background: var(--red); }
.meter-fill.medium { background: var(--amber); }
.meter-fill.high   { background: var(--green); }

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 29, 54, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.15s ease-out;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 540px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease-out;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-lg {
  max-width: 760px;
}

/* Drop zone PDF */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-2);
  transition: all 0.15s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-100);
}
.drop-zone-icon {
  font-size: 36px;
  color: var(--primary);
  margin-bottom: 8px;
}
.drop-zone-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.drop-zone-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin: 6px 0;
}
.drop-zone-hint {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 12px;
  font-style: italic;
}

/* Preview de datos extraídos */
.preview-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.preview-section {
  margin-bottom: 18px;
}
.preview-section:last-child { margin-bottom: 0; }
.preview-section h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--primary);
}

.modal-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

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

/* CAMPOS PENDIENTES — tono ligero amarillo para indicar "completar manualmente" */
.field.field-pendiente .field-input,
.field.field-pendiente .field-select {
  background: #fefce8;
  border-color: #fde68a;
}
.field.field-pendiente .field-suffix .field-input {
  border-color: #fde68a;
}
.field.field-pendiente .field-suffix .suffix {
  background: #fef9c3;
  border-color: #fde68a;
  color: #854d0e;
}
.field.field-pendiente .field-input:focus,
.field.field-pendiente .field-select:focus {
  background: white;
  border-color: var(--primary);
}
.field-pendiente .field-label {
  color: #92400e;
}

/* Banner de pendientes (estado del análisis) */
.pendientes-banner {
  background: linear-gradient(90deg, var(--amber-bg) 0%, #fff7ed 100%);
  border: 1px solid #fbbf24;
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.pendientes-banner-titulo {
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pendientes-banner-titulo::before { content: "⚠"; }
.pendientes-banner-lista {
  margin: 0;
  padding-left: 24px;
  color: #92400e;
  font-size: 12px;
  columns: 2;
  column-gap: 24px;
}
.pendientes-banner-lista li {
  margin-bottom: 2px;
  break-inside: avoid;
}
.pendientes-banner.completo {
  background: linear-gradient(90deg, var(--green-bg) 0%, #ecfdf5 100%);
  border-color: #34d399;
  border-left-color: var(--green);
}
.pendientes-banner.completo .pendientes-banner-titulo {
  color: var(--green);
}
.pendientes-banner.completo .pendientes-banner-titulo::before { content: "✓"; }

@media (max-width: 700px) {
  .pendientes-banner-lista { columns: 1; }
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 100px);
  background: var(--primary);
  color: white;
  padding: 12px 20px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s ease-out;
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* CLIENTE ACTIVO BANNER */
.cliente-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, var(--primary-100) 0%, rgba(220, 38, 38, 0.05) 100%);
  border: 1px solid var(--primary-100);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 16px;
}
.cliente-banner-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 14px;
}
.cliente-banner-info { flex: 1; min-width: 0; }
.cliente-banner-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cliente-banner-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.cliente-banner-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* MODULE TOGGLE */
.module-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
}
.module-row:hover { background: var(--surface-2); }
.module-row.on { border-color: var(--primary); background: var(--primary-100); }

.toggle {
  width: 36px;
  height: 20px;
  border-radius: 100px;
  background: var(--border-strong);
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: left 0.15s;
}
.module-row.on .toggle { background: var(--primary); }
.module-row.on .toggle::after { left: 18px; }
