/* ═══════════════════════════════════════════════════════════════
   Investigador de Importación — hoja propia del mini-site /dropship

   Hereda TODOS los tokens de /static/css/app.css (que se carga antes).
   Aquí no se define ni un color literal: solo var(--…). Si necesitas un
   tono nuevo, añádelo a app.css en los DOS temas, no aquí.
   ═══════════════════════════════════════════════════════════════ */

.ds-body {
  background: var(--bg-0);
  color: var(--text);
  min-height: 100vh;
}

/* ── Cabecera ────────────────────────────────────────────────── */
.ds-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  position: sticky; top: 0; z-index: 20;
}
.ds-brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ds-logo { font-size: 20px; }
.ds-brand-name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.ds-brand-name b { color: var(--cyan); font-weight: 800; }
.ds-brand-sub {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 1px 7px;
}
.ds-top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ds-fx {
  font-family: var(--mono); font-size: 11px; color: var(--text-soft);
  margin: 0;
}
.ds-fx .stale { color: var(--yellow); }

/* ── Botones ─────────────────────────────────────────────────── */
.ds-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 8px 16px;
  font-size: 13px; font-weight: 600; line-height: 1;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--bg-2); color: var(--text);
  cursor: pointer; text-decoration: none;
  transition: background .12s ease, border-color .12s ease;
}
.ds-btn:hover:not(:disabled) { background: var(--bg-3); border-color: var(--cyan); }
.ds-btn:disabled { opacity: .5; cursor: not-allowed; }
.ds-btn.primary {
  background: var(--cyan); border-color: var(--cyan);
  color: var(--bg-0); font-weight: 700;
}
.ds-btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--cyan); }
.ds-btn.ghost { background: transparent; border-color: var(--border); }
.ds-btn.danger { border-color: var(--red); color: var(--red); background: transparent; }
.ds-btn.danger:hover:not(:disabled) { background: var(--red-soft); border-color: var(--red); }
.ds-btn.sm { min-height: 32px; padding: 5px 11px; font-size: 12px; }

/* ── Pestañas ────────────────────────────────────────────────── */
.ds-tabs {
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  padding: 0 var(--gutter);
  position: sticky; top: 61px; z-index: 19;
}
.ds-tabs [role="tablist"] { display: flex; gap: 2px; overflow-x: auto; }
.ds-tab {
  border: 0; background: none; color: var(--text-soft);
  font-size: 13px; font-weight: 600; white-space: nowrap;
  padding: 13px 16px; cursor: pointer;
  border-bottom: 2px solid transparent;
}
.ds-tab:hover { color: var(--text); }
.ds-tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }

/* ── Estructura ──────────────────────────────────────────────── */
.ds-main { padding: var(--gutter); max-width: 1560px; margin: 0 auto; }
.ds-panel { animation: dsIn .16s ease; }
@keyframes dsIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.ds-h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.ds-lead { color: var(--text-soft); max-width: 74ch; margin-bottom: 22px; font-size: 14px; }
.ds-h2 { font-size: 13px; font-weight: 700; text-transform: uppercase;
         letter-spacing: .07em; color: var(--text-soft); margin-bottom: 12px; }

.ds-split { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 1100px) { .ds-split { grid-template-columns: 1fr; } }

/* ── Formulario ──────────────────────────────────────────────── */
.ds-fs {
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px 18px 18px; margin-bottom: 16px; background: var(--bg-1);
}
.ds-fs > legend {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .09em; color: var(--cyan); padding: 0 8px;
}
.ds-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ds-col-2 { grid-column: span 2; }
.ds-col-3 { grid-column: span 2; }
@media (max-width: 520px) { .ds-grid { grid-template-columns: 1fr; } .ds-col-2, .ds-col-3 { grid-column: span 1; } }

.ds-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ds-field > label { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.ds-field .opt { font-weight: 400; color: var(--muted); }
.ds-field small { font-size: 11px; color: var(--muted); line-height: 1.45; }
.ds-field input, .ds-field select {
  background: var(--bg-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); color: var(--text);
  padding: 9px 11px; font-size: 13px; min-height: 40px; width: 100%;
}
.ds-field input[type="number"] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ds-field input:hover, .ds-field select:hover { border-color: var(--muted); }

.ds-check { flex-direction: row; align-items: start; flex-wrap: wrap; gap: 8px; }
.ds-check input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; margin-top: 2px; accent-color: var(--cyan); }
.ds-check > label { flex: 1; min-width: 200px; }
.ds-check small { flex-basis: 100%; }

.ds-dims { border: 1px dashed var(--border-strong); border-radius: var(--r-sm); padding: 10px 12px 12px; }
.ds-dims > legend { font-size: 11px; font-weight: 600; color: var(--text-soft); padding: 0 6px; }
.ds-dims-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 6px; }
.ds-dim { display: flex; flex-direction: column; gap: 4px; }
.ds-dim label { font-size: 11px; color: var(--muted); }
.ds-dim input {
  background: var(--bg-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); color: var(--text); padding: 7px 9px;
  font-family: var(--mono); font-size: 13px; min-height: 36px; width: 100%;
}

.ds-risks { border: 1px dashed var(--border-strong); border-radius: var(--r-sm); padding: 10px 12px 12px; }
.ds-risks > legend { font-size: 11px; font-weight: 600; color: var(--text-soft); padding: 0 6px; }
.ds-risk-grid { display: grid; gap: 7px; }
.ds-risk {
  display: flex; align-items: start; gap: 8px;
  font-size: 12px; color: var(--text-soft); cursor: pointer;
  padding: 5px 7px; border-radius: var(--r-sm);
}
.ds-risk:hover { background: var(--bg-2); }
.ds-risk input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--red); flex: none; }
.ds-risk .sev {
  font-family: var(--mono); font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .06em; border: 1px solid currentColor; border-radius: 999px;
  padding: 0 6px; margin-left: auto; flex: none; align-self: center;
}
.ds-risk .sev.alto { color: var(--red); }
.ds-risk .sev.medio { color: var(--yellow); }
.ds-risk .sev.bajo { color: var(--muted); }

.ds-adv { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.ds-adv > summary {
  cursor: pointer; font-size: 12px; font-weight: 600; color: var(--cyan);
  padding: 5px 0; list-style: revert;
}
.ds-adv[open] > summary { margin-bottom: 12px; }

.ds-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ds-form-msg { margin-top: 10px; font-size: 12.5px; min-height: 1em; }
.ds-form-msg.err { color: var(--red); }
.ds-form-msg.ok { color: var(--green); }

/* ── Barra de acción de panel ────────────────────────────────── */
.ds-bar {
  display: flex; align-items: end; gap: 12px; flex-wrap: wrap;
  margin-bottom: 20px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-1);
}
.ds-bar-note { font-size: 12px; color: var(--muted); }
.ds-field-inline { flex: 1; min-width: 220px; }

/* ── Tarjetas KPI ────────────────────────────────────────────── */
.ds-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 20px; }
.ds-kpi {
  border: 1px solid var(--border); border-left: 3px solid var(--border-strong);
  border-radius: var(--r); background: var(--bg-1); padding: 13px 15px;
}
.ds-kpi.green { border-left-color: var(--green); }
.ds-kpi.red { border-left-color: var(--red); }
.ds-kpi.yellow { border-left-color: var(--yellow); }
.ds-kpi.cyan { border-left-color: var(--cyan); }
.ds-kpi .k {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); margin-bottom: 6px;
}
.ds-kpi .v {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 21px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15;
}
.ds-kpi .v.green { color: var(--green); }
.ds-kpi .v.red { color: var(--red); }
.ds-kpi .s { font-size: 11.5px; color: var(--text-soft); margin-top: 5px; line-height: 1.4; }

/* ── Bloques de resultado ────────────────────────────────────── */
.ds-card {
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg-1); padding: 16px 18px; margin-bottom: 18px;
}
.ds-card > h2 {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-soft); margin-bottom: 14px;
}
.ds-card-note { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.5; }

/* ── Veredicto y score ───────────────────────────────────────── */
.ds-verdict { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.ds-score-num {
  font-family: var(--mono); font-size: 42px; font-weight: 700;
  line-height: 1; letter-spacing: -0.03em;
}
.ds-score-num .max { font-size: 15px; color: var(--muted); font-weight: 500; }
.ds-score-num.green { color: var(--green); }
.ds-score-num.yellow { color: var(--yellow); }
.ds-score-num.orange { color: var(--orange); }
.ds-score-num.red { color: var(--red); }
.ds-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; padding: 5px 13px;
  border-radius: 999px; border: 1px solid currentColor;
}
.ds-pill.green { color: var(--green); background: var(--green-soft); }
.ds-pill.yellow { color: var(--yellow); background: var(--yellow-soft); }
.ds-pill.orange { color: var(--orange); }
.ds-pill.red { color: var(--red); background: var(--red-soft); }
.ds-pill.gray { color: var(--muted); }

.ds-score-track {
  flex: 1; min-width: 180px; height: 8px; background: var(--bg-3);
  border-radius: 999px; overflow: hidden;
}
.ds-score-fill { height: 100%; border-radius: 999px; }
.ds-score-fill.green { background: var(--green); }
.ds-score-fill.yellow { background: var(--yellow); }
.ds-score-fill.orange { background: var(--orange); }
.ds-score-fill.red { background: var(--red); }

/* ── Barra apilada del coste ─────────────────────────────────── */
.ds-stack { display: flex; height: 30px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--border); }
.ds-stack-seg { min-width: 2px; }
.ds-stack-seg.c1 { background: var(--cyan); }
.ds-stack-seg.c2 { background: var(--blue); }
.ds-stack-seg.c3 { background: var(--purple); }
.ds-stack-seg.c4 { background: var(--orange); }
.ds-stack-seg.c5 { background: var(--muted); }
.ds-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; }
.ds-legend-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-soft); }
.ds-swatch { width: 11px; height: 11px; border-radius: 2px; flex: none; }
.ds-swatch.c1 { background: var(--cyan); } .ds-swatch.c2 { background: var(--blue); }
.ds-swatch.c3 { background: var(--purple); } .ds-swatch.c4 { background: var(--orange); }
.ds-swatch.c5 { background: var(--muted); }
.ds-legend-item .n { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--text); }

/* ── Tablas ──────────────────────────────────────────────────── */
.ds-tw { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); }
table.ds-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.ds-table caption { text-align: left; padding: 10px 13px; color: var(--muted); font-size: 11.5px; }
table.ds-table th, table.ds-table td { padding: 8px 13px; text-align: left; border-bottom: 1px solid var(--border); }
table.ds-table thead th {
  position: sticky; top: 0; background: var(--bg-2); z-index: 1;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-soft); white-space: nowrap;
}
table.ds-table tbody tr:last-child td, table.ds-table tbody tr:last-child th { border-bottom: 0; }
table.ds-table tbody tr:hover { background: var(--bg-2); }
table.ds-table tbody th { font-weight: 600; }
.ds-table .num {
  text-align: right; font-family: var(--mono);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ds-table tfoot td, .ds-table tfoot th {
  border-top: 1px solid var(--border-strong); font-weight: 700; background: var(--bg-2);
}
.ds-table .win { color: var(--green); }
.ds-table .lose { color: var(--red); }
.ds-table .best { outline: 2px solid var(--cyan); outline-offset: -2px; }
.ds-table .row-sub { font-size: 11px; color: var(--muted); font-weight: 400; }
.ds-table .th-btn {
  background: none; border: 0; color: inherit; font: inherit;
  cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 4px;
}
.ds-table .th-arrow { color: var(--cyan); }

/* ── Listas de aviso ─────────────────────────────────────────── */
.ds-flags { list-style: none; display: grid; gap: 8px; }
.ds-flags li {
  display: flex; gap: 9px; align-items: start;
  font-size: 12.5px; line-height: 1.5;
  border-left: 2px solid var(--red); background: var(--red-soft);
  padding: 8px 12px; border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.ds-flags li .ico { flex: none; }
.ds-flags.warn li { border-left-color: var(--yellow); background: var(--yellow-soft); }
.ds-flags.info li { border-left-color: var(--cyan); background: var(--cyan-soft); }

/* ── Enlaces de investigación ────────────────────────────────── */
.ds-link-group { margin-bottom: 22px; }
.ds-link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ds-link {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg-1); padding: 13px 15px;
  transition: border-color .12s ease, background .12s ease;
}
.ds-link:hover { border-color: var(--cyan); background: var(--bg-2); }
.ds-link .t { font-size: 13.5px; font-weight: 700; margin-bottom: 4px; }
.ds-link .t .ext { color: var(--cyan); font-size: 11px; margin-left: 4px; }
.ds-link .w { font-size: 12px; color: var(--text-soft); line-height: 1.5; }

/* ── Sugerencias de producto ─────────────────────────────────── */
.ds-sg-count { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.ds-sg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ds-sg-card {
  display: flex; flex-direction: column; gap: 9px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg-1); padding: 15px 16px;
}
.ds-sg-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.ds-sg-head h3 { font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.ds-sg-cat {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-top: -4px;
}
.ds-sg-nums {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px;
  font-size: 12px; color: var(--text-soft);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 9px 0;
}
.ds-sg-nums b { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--text); }
.ds-sg-nums .green b, .ds-sg-nums.green b { color: var(--green); }
.ds-sg-nums .red b, .ds-sg-nums.red b { color: var(--red); }
.ds-sg-why { font-size: 12px; color: var(--text-soft); line-height: 1.55; }
.ds-sg-risks { display: flex; flex-wrap: wrap; gap: 6px; }
.ds-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 2px 8px; border-radius: 999px;
  border: 1px solid currentColor;
}
.ds-tag.alto { color: var(--red); background: var(--red-soft); }
.ds-tag.medio { color: var(--yellow); background: var(--yellow-soft); }
.ds-tag.bajo { color: var(--muted); }
.ds-sg-source { font-size: 10.5px; color: var(--muted); line-height: 1.5; margin-top: -3px; }
.ds-sg-card > .ds-btn { align-self: flex-start; margin-top: 2px; }

/* ── Estados ─────────────────────────────────────────────────── */
.ds-empty, .ds-error, .ds-loading {
  border: 1px dashed var(--border-strong); border-radius: var(--r);
  padding: 40px 24px; text-align: center; color: var(--text-soft);
}
.ds-empty-ico { font-size: 30px; margin-bottom: 10px; }
.ds-empty h2, .ds-error h2 { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 7px; }
.ds-empty p, .ds-error p { font-size: 13px; max-width: 56ch; margin: 0 auto; line-height: 1.6; }
.ds-error { border-color: var(--red); border-style: solid; background: var(--red-soft); }
.ds-error h2 { color: var(--red); }
.ds-loading { border-style: solid; }
.ds-spin {
  width: 22px; height: 22px; margin: 0 auto 12px;
  border: 2px solid var(--border-strong); border-top-color: var(--cyan);
  border-radius: 50%; animation: dsSpin .8s linear infinite;
}
@keyframes dsSpin { to { transform: rotate(360deg); } }
[aria-busy="true"] { opacity: .6; }

.ds-disclaimer {
  margin-top: 30px; padding: 14px 16px; font-size: 11.5px; line-height: 1.6;
  color: var(--muted); border: 1px solid var(--border);
  border-radius: var(--r); background: var(--bg-1);
}

/* ── Foco visible: nunca lo quitamos ─────────────────────────── */
.ds-body a:focus-visible, .ds-body button:focus-visible,
.ds-body input:focus-visible, .ds-body select:focus-visible,
.ds-body summary:focus-visible, .ds-body [tabindex]:focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: var(--r-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--cyan); color: var(--bg-0); padding: 10px 16px;
  font-weight: 700; border-radius: 0 0 var(--r-sm) 0; text-decoration: none;
}
.skip-link:focus { left: 0; }

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