:root {
  --bg: #0b1220;
  --panel: #121a2b;
  --panel-2: #182235;
  --border: #2d3b52;
  --text: #e8edf5;
  --muted: #9fb0ca;
  --accent: #22c55e;
  --accent-2: #16a34a;
  --danger: #ef4444;
  --ghost: #243247;
  --link: #93c5fd;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}
.container {
  padding: 16px;
  display: grid;
  gap: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}
.header h1 { margin: 0 0 6px; font-size: 22px; }
.header p { margin: 0; color: var(--muted); line-height: 1.4; }
.form-card { display: grid; gap: 12px; }
.section-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #cfe0ff;
}
label { display: grid; gap: 6px; font-size: 13px; }
input, select, textarea {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
textarea { resize: vertical; min-height: 76px; }
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.actions.compact button { flex: 1; }
button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}
button.primary { background: var(--accent); color: #052e16; }
button.primary:hover { background: var(--accent-2); }
button.secondary { background: #e5e7eb; color: #111827; }
button.ghost { background: var(--ghost); color: var(--text); border: 1px solid var(--border); }
.helper, .status { margin: 0; font-size: 13px; line-height: 1.45; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.success { color: var(--accent); }
.results-section { display: grid; gap: 10px; }
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.results-header h2 { margin: 0; font-size: 18px; }
.badge {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}
.results { display: grid; gap: 12px; }
.result-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 10px;
}
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: #1d4ed8;
  color: white;
  font-size: 11px;
  font-weight: 700;
}
.muted-pill {
  background: #334155;
  color: #e2e8f0;
}
.result-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
}
.meta {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.link {
  color: var(--link);
  text-decoration: none;
  font-weight: 700;
}
.empty {
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 18px;
  line-height: 1.45;
}

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


.favorites-section{margin-top:18px}.card-top-row{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}.mini-btn{border:none;border-radius:999px;padding:8px 12px;font-weight:700;cursor:pointer;background:#1d4ed8;color:white}.mini-btn.saved{background:#0f766e}.mini-btn.danger{background:#7f1d1d}.results-section,.favorites-section{display:block}

button:disabled { opacity: 0.65; cursor: wait; }
.loading-status { display: inline-flex; align-items: baseline; gap: 2px; }
.loading-dots span { animation: secopDots 1.2s infinite ease-in-out; font-weight: 900; font-size: 18px; line-height: 0; }
.loading-dots span:nth-child(2) { animation-delay: 0.18s; }
.loading-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes secopDots {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
.amount-value { color: #86efac; font-weight: 800; }
.meta strong { color: #dbeafe; }

.pagination {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.pagination button {
  min-width: 110px;
}
.pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.page-info {
  color: var(--muted);
  font-size: 13px;
  min-width: 120px;
  text-align: center;
}


.legal-footer {
  margin-top: 18px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.legal-footer summary {
  cursor: pointer;
  color: #dbeafe;
  font-weight: 800;
  user-select: none;
}
.legal-content {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}
.legal-content p { margin: 0; }
.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-top: 4px;
}
.legal-links span { color: var(--muted); }
.disabled-link { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.data-source-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border-color: rgba(34, 197, 94, 0.35);
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.08), rgba(18, 26, 43, 1));
}
.source-copy {
  display: grid;
  gap: 5px;
  line-height: 1.45;
}
.source-copy strong {
  color: #dcfce7;
  font-size: 13px;
}
.source-copy span {
  color: #bbf7d0;
  font-size: 12px;
  font-weight: 700;
}
.source-copy small {
  color: var(--muted);
  font-size: 11px;
}
.checkbox-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.45);
}
.checkbox-row input {
  width: auto;
  margin-top: 3px;
}
.checkbox-row span {
  display: grid;
  gap: 3px;
  font-weight: 700;
}
.checkbox-row small {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.35;
}
.secop-open-inline {
  margin-top: 10px;
  display: inline-block;
  width: fit-content;
}
@media (max-width: 720px) {
  .data-source-card {
    grid-template-columns: 1fr;
  }
}

/* v7.4.0 — Periodo de publicación */
.period-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.45);
}
.period-title {
  font-size: 13px;
  font-weight: 700;
}
.preset-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.preset-btn {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 12px;
  background: var(--ghost);
  color: var(--text);
  border: 1px solid var(--border);
}
.preset-btn:hover { border-color: var(--muted); }
.preset-btn.active,
.preset-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #052e16;
}
.date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.date-grid input[type="date"] {
  padding: 9px 10px;
  color-scheme: dark;
  min-width: 0;
}
.period-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}
.period-hint.error { color: #fca5a5; }
.period-hint.wide {
  color: #fde68a;
  border: 1px solid #b45309;
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(180, 83, 9, 0.14);
}
.period-checkbox {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 13px;
}
.results-period {
  margin: 0 0 10px;
  font-size: 12px;
}
.results-subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}
.results-subheader h3 {
  margin: 0;
  font-size: 15px;
}
.results-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.results-note.error { color: #fca5a5; }
.undated-value { color: #fde68a; }
.no-link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.live-state-note {
  color: var(--muted);
  font-weight: 400;
}

/* v7.5.0 — Entidad compradora y Contáctanos */
[hidden] { display: none !important; }
.entity-box {
  display: grid;
  gap: 6px;
}
.entity-selected {
  display: grid;
  gap: 6px;
}
.entity-chip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.08);
}
.entity-chip-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.entity-chip-text strong {
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.entity-chip-text span {
  font-size: 12px;
  color: var(--muted);
}
.entity-chip-remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--ghost);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
}
.entity-suggestions {
  display: flex;
  flex-direction: column;
  max-height: 480px;
  overflow-y: auto;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.entity-group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(34, 197, 94, 0.08);
  font-size: 12px;
  font-weight: 700;
  color: #dcfce7;
}
.entity-group-btn {
  flex-shrink: 0;
  padding: 7px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: #86efac;
  font-size: 12px;
}
.entity-option {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-family: inherit;
}
.entity-option:hover,
.entity-option.active { background: var(--ghost); }
.entity-option-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.entity-option-meta {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.entity-suggestions mark {
  background: transparent;
  color: #86efac;
}
.entity-suggestions-foot {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
}
.entity-saved {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.entity-saved-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--ghost);
  overflow: hidden;
}
.entity-saved-use {
  max-width: 220px;
  padding: 6px 4px 6px 10px;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entity-saved-remove {
  padding: 6px 9px 6px 5px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}
.entity-saved-remove:hover { color: var(--text); }
.entity-save-btn {
  padding: 6px 10px;
  border: 1px dashed var(--border);
  border-radius: 999px;
  background: transparent;
  color: #86efac;
  font-size: 12px;
}
.contact-card {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}
.contact-card h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}
.contact-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.contact-card small {
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}
.btn-link {
  display: inline-block;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.btn-link.primary { background: var(--accent); color: #052e16; }
.btn-link.primary:hover { background: var(--accent-2); }
.btn-link.ghost { background: var(--ghost); color: var(--text); border: 1px solid var(--border); padding: 9px 14px; }

/* v7.6.0 — Descarga a Excel */
.export-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}
.export-btn {
  padding: 8px 12px;
  font-size: 12px;
}
.export-status {
  font-size: 12px;
  line-height: 1.4;
}
.export-status.success { color: var(--accent); }
.export-status.warning { color: #fde68a; }
.export-status.error { color: #fca5a5; }

/* v7.6.2 — Enlace a VerifiID */
.partner-card { display: grid; gap: 10px; margin-top: 18px; }
.partner-head { display: flex; align-items: center; gap: 12px; }
.partner-head img { width: 40px; height: 40px; border-radius: 10px; background: #fffdf7; flex-shrink: 0; }
.partner-card h2 { margin: 0; font-size: 16px; line-height: 1.3; }
.partner-card p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.partner-card p strong { color: var(--text); }
.partner-card small { font-size: 11px; line-height: 1.45; color: var(--muted); }

/* v7.6.2 — Contáctanos compacto */
.contact-card.compact { gap: 8px; padding-top: 12px; padding-bottom: 12px; }
.contact-card.compact h2 { font-size: 13px; font-weight: 700; color: var(--muted); }
.contact-card.compact .actions { gap: 8px; margin: 0; }
.btn-link.small { padding: 6px 10px; font-size: 12px; font-weight: 600; border-radius: 8px; }

/* v7.6.4 · Descarga de resultados también al final */
.export-row-bottom { justify-content: center; margin-top: 10px; }

/* v7.6.5 · Seguimiento */
.flow-hint { margin: 0; font-size: 12px; line-height: 1.45; color: #cfe0ff; background: rgba(147, 197, 253, .08); border: 1px solid rgba(147, 197, 253, .3); border-radius: 10px; padding: 8px 10px; }
.follow-btn { white-space: nowrap; }
.card-note { margin-top: -4px; padding: 8px 12px; border-radius: 10px; font-size: 12px; line-height: 1.4; }
.card-note.added { background: rgba(34, 197, 94, .12); border: 1px solid rgba(34, 197, 94, .45); color: #86efac; }
.card-note.removed { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--ghost); border: 1px solid var(--border); color: var(--text); }
.card-note a { color: var(--link); font-weight: 700; text-decoration: none; }
.undo-slot:empty { display: none; }
.undo-slot { margin-bottom: 12px; }
.undo-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--ghost); border: 1px solid var(--border); font-size: 12px; color: var(--text); }
.undo-btn { flex-shrink: 0; background: transparent; border: 1px solid var(--link); color: var(--link); border-radius: 8px; padding: 5px 10px; font-weight: 700; font-size: 12px; cursor: pointer; }
