/* DF Artist Research — estilo "achromatic ledger" (tasteskill, semilla 1046590737).
   Cromado sin color; el único tono (#1d5fbf) va en el dato principal: la demanda base.
   Fondo "piedra" (#f4f3f1) en vez del gris genérico.
   Grilla: columna centrada de 1088px. Stats: 4 x 263 + 3 x 12 = 1088.
   Cuerpo: índice 220 + 12 + 856 = 1088. */

:root {
  --ground: #f4f3f1;
  --surface: #ffffff;
  --raised: #eeeeee;
  --border: #e3e2df;
  --rule: #efeeec;
  --control: #d2d1ce;
  --text: #0a0a0a;
  --muted: #646462;
  --accent: #141414;
  --hue: #1d5fbf;
  --hue-pale: #dbe6f6;
  --grey-band: #c9c8c4;
  --positive: #2e7d32;
  --negative: #c4242a;
  --warning: #92400e;
  --notice-bg: #fffbeb; --notice-line: #fde68a;
  --radius-card: 8px;
  --radius-control: 6px;
  --gap: 12px;
  --pad: 24px;
  --col: 1088px;
  --font: "Geist", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--hue); outline-offset: 2px; }

/* ---------- marca ---------- */
.marca { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; text-decoration: none; color: var(--text); }
.marca-icono { width: 24px; height: 24px; flex: none; }
.marca-icono rect { fill: var(--accent); }
.marca-icono path { fill: none; stroke: #fff; stroke-width: 2.4; }
.marca-icono circle { fill: #fff; }
.marca-grande { font-size: 16px; }
.marca-grande .marca-icono { width: 32px; height: 32px; }

/* ---------- barra ---------- */
.barra { position: sticky; top: 0; z-index: 10; background: var(--ground); border-bottom: 1px solid var(--border); }
.barra-in { max-width: calc(var(--col) + 2 * var(--pad)); margin: 0 auto; height: 48px; padding: 0 var(--pad); display: flex; align-items: center; gap: 16px; }
.barra-in > .marca { margin-right: auto; }
.barra-busqueda { width: 280px; }

/* ---------- columna ---------- */
.columna { max-width: calc(var(--col) + 2 * var(--pad)); margin: 0 auto; padding: 33px var(--pad) 96px; }
.fila-titulo { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.titulo { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
.sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); max-width: 70ch; }
.acciones, .acciones-fila { display: flex; gap: 8px; flex: none; }

/* ---------- controles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 14px; border-radius: var(--radius-control); border: 1px solid transparent; font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background-color .12s, border-color .12s, transform .06s; }
.btn:active { transform: translateY(1px); }
.btn-primario { background: var(--accent); color: #fff; }
.btn-primario:hover { background: #333; }
.btn-primario:disabled { background: #9a9a98; cursor: default; transform: none; }
.btn-secundario { background: var(--surface); border-color: var(--control); }
.btn-secundario:hover { background: var(--raised); }
.btn-texto { background: transparent; color: var(--muted); padding: 0 8px; }
.btn-texto:hover { color: var(--text); background: var(--raised); }
.btn-grande { height: 52px; padding: 0 28px; font-size: 16px; }
.btn-ancho { width: 100%; height: 44px; }

.campo { width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); }
.campo::placeholder { color: #8b8a87; }
.campo:hover { border-color: #b4b3af; }
.campo:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.campo-grande { height: 52px; font-size: 18px; padding: 0 16px; }
.campo-chico { height: 32px; font-size: 13px; }
textarea.campo { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.campo-label { display: block; font-size: 13px; font-weight: 500; margin: 20px 0 6px; }
.campo-error { color: var(--negative); font-size: 13px; margin: 8px 0 0; }

/* ---------- ingreso ---------- */
.ingreso { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.ingreso-caja { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 32px; }
.ingreso-titulo { font-size: 22px; line-height: 1.3; font-weight: 600; margin: 28px 0 6px; letter-spacing: -0.01em; }
.ingreso-sub { margin: 0; color: var(--muted); font-size: 13px; }
.ingreso-caja .btn { margin-top: 20px; }

/* ---------- inicio ---------- */
.busqueda { display: flex; gap: var(--gap); }
.nota-busqueda { margin: 8px 0 32px; font-size: 12px; color: var(--muted); }

/* ---------- tarjetas ---------- */
.tarjeta { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); margin-bottom: var(--gap); }
.tarjeta-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 16px 20px 12px; }
.tarjeta-titulo { margin: 0; font-size: 16px; font-weight: 600; }
.tarjeta-meta { font-size: 12px; color: var(--muted); }
.tarjeta-pie { margin: 0; padding: 0 20px 16px; font-size: 12px; color: var(--muted); }
.tarjeta-pie:empty { display: none; }

/* tabla de recientes */
.tabla { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tabla th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 8px 20px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tabla td { padding: 10px 20px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla .der { text-align: right; }
.tabla tbody tr { cursor: pointer; }
.tabla tbody tr:hover td { background: #faf9f8; }
.tabla .artista-celda a { font-weight: 500; text-decoration: none; }
.tabla .artista-celda a:hover { text-decoration: underline; }
.tabla .gris { color: var(--muted); }
.vacio { padding: 8px 20px 20px; color: var(--muted); }
.vacio p { margin: 0 0 8px; }
.vacio-ejemplos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- cargando ---------- */
.cargando-tarjeta { padding: 0 0 4px; overflow: hidden; }
.progreso { height: 3px; background: var(--rule); position: relative; overflow: hidden; }
.progreso span { position: absolute; inset: 0 auto 0 0; width: 30%; background: var(--hue); animation: barrido 1.6s ease-in-out infinite; }
@keyframes barrido { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.cargando-datos { display: grid; grid-template-columns: 180px 1fr 1fr; gap: 24px; margin: 0; padding: 24px; }
.cargando-datos dt { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.cargando-datos dd { margin: 0; }
#cargando-reloj { font-size: 30px; font-weight: 600; line-height: 1.1; }

/* ---------- informe ---------- */
.aviso { margin: 0 0 var(--gap); padding: 8px 14px; background: var(--notice-bg); border: 1px solid var(--notice-line); border-radius: var(--radius-control); color: var(--warning); font-size: 12px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px 16px 16px; min-width: 0; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-valor { margin-top: 4px; font-size: 18px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-valor.dato { color: var(--hue); }
.stat-detalle { margin-top: 2px; font-size: 12px; color: var(--muted); }
.stat-valor.vacio-valor { color: var(--muted); font-weight: 400; }

/* escala de venues */
#inf-escala { padding: 4px 20px 8px; overflow-x: auto; }
#inf-escala svg { display: block; width: 100%; height: auto; overflow: visible; }
#inf-escala text { font-family: var(--font); }
.leyenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i { display: inline-block; width: 14px; height: 8px; border-radius: 2px; }

/* cuerpo + índice */
.cuerpo { display: grid; grid-template-columns: 220px 1fr; gap: var(--gap); align-items: start; }
.indice { position: sticky; top: 64px; padding: 12px 8px 12px 0; }
.indice-titulo { margin: 0 0 8px 12px; font-size: 12px; color: var(--muted); }
.indice ol { list-style: none; margin: 0; padding: 0; }
.indice a { display: block; padding: 6px 12px; border-radius: var(--radius-control); text-decoration: none; color: var(--muted); font-size: 13px; line-height: 1.35; }
.indice a:hover { color: var(--text); background: var(--raised); }
.indice a.activo { color: var(--text); background: #e9e8e5; }
.cuerpo-principal { min-width: 0; }

.informe { padding: 8px 32px 28px; }
.seccion { padding-top: 24px; scroll-margin-top: 64px; }
.seccion + .seccion { border-top: 1px solid var(--rule); margin-top: 8px; }
.seccion h2 { margin: 0 0 10px; font-size: 18px; line-height: 1.35; font-weight: 600; letter-spacing: -0.005em; }
.seccion h2 .n { color: var(--muted); font-weight: 500; margin-right: 6px; }
.prosa { font-size: 15px; line-height: 1.62; max-width: 72ch; }
.prosa p { margin: 0 0 12px; }
.prosa ul, .prosa ol { margin: 0 0 12px; padding-left: 20px; }
.prosa li { margin-bottom: 6px; }
.prosa strong { font-weight: 600; }
.prosa h3 { font-size: 15px; font-weight: 600; margin: 18px 0 6px; }
.prosa a { color: var(--hue); text-underline-offset: 2px; }
.prosa table { border-collapse: collapse; margin: 0 0 14px; font-size: 13px; font-variant-numeric: tabular-nums; }
.prosa th, .prosa td { border-bottom: 1px solid var(--rule); padding: 6px 12px 6px 0; text-align: left; }
.prosa th { color: var(--muted); font-weight: 600; border-bottom-color: var(--border); }
.prosa blockquote { margin: 0 0 12px; padding-left: 14px; border-left: 2px solid var(--border); color: var(--muted); }
sup.ref { font-size: 11px; line-height: 0; margin-left: 1px; }
sup.ref a { color: var(--muted); text-decoration: none; padding: 0 1px; }
sup.ref a:hover { color: var(--hue); text-decoration: underline; }
.seccion-lead .prosa { font-size: 16px; }

/* preguntas */
#inf-preguntas:empty { display: none; }
.qa { padding: 4px 20px 16px; border-bottom: 1px solid var(--rule); margin-bottom: 12px; }
.qa-pregunta { font-weight: 600; margin: 0 0 8px; }
.qa-pregunta::before { content: "Pregunta · "; color: var(--muted); font-weight: 400; }
.qa-esperando { color: var(--muted); }
.pregunta { display: flex; gap: var(--gap); align-items: flex-end; padding: 0 20px 16px; }

/* fuentes */
.fuentes { margin: 0; padding: 0 20px 16px 44px; font-size: 13px; }
.fuentes li { padding: 4px 0; scroll-margin-top: 64px; }
.fuentes li:target { background: var(--hue-pale); }
.fuentes a { color: var(--text); text-underline-offset: 2px; overflow-wrap: anywhere; }
.fuentes .tipo { color: var(--muted); }
.fuentes .tipo-df { color: var(--text); font-weight: 500; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--accent); color: #fff; padding: 10px 16px; border-radius: var(--radius-control); font-size: 13px; z-index: 50; }

/* ---------- tablet ---------- */
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cuerpo { grid-template-columns: 1fr; }
  .indice { position: static; padding: 0; margin-bottom: var(--gap); }
  .indice ol { display: flex; flex-wrap: wrap; gap: 4px; }
  .indice-titulo { margin-left: 0; }
  .indice a { background: var(--surface); border: 1px solid var(--border); }
  .cargando-datos { grid-template-columns: 1fr; gap: 16px; }
}

/* ---------- teléfono ---------- */
@media (max-width: 600px) {
  :root { --pad: 16px; }
  .barra-busqueda { display: none; }
  .columna { padding-top: 20px; }
  .fila-titulo { flex-direction: column; gap: 12px; }
  .acciones { width: 100%; }
  .acciones .btn { flex: 1; }
  .busqueda { flex-direction: column; }
  .btn-grande { width: 100%; }
  .informe { padding: 4px 18px 20px; }
  .prosa { font-size: 15px; }
  .pregunta { flex-direction: column; align-items: stretch; }
  .tabla .col-opc { display: none; }
  .tabla th, .tabla td { padding-left: 16px; padding-right: 16px; }
  .ingreso-caja { padding: 24px; }
  .indice { display: none; }
  #inf-escala svg { min-width: 640px; }
  .tarjeta-cab { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .progreso span { animation: none; width: 100%; opacity: .35; }
  .btn { transition: none; }
}

/* ---------- impresión / PDF ---------- */
@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff; font-size: 11pt; }
  .barra, .acciones, .indice, #inf-preguntas-tarjeta form, #pregunta-nota, .toast { display: none !important; }
  #inf-preguntas-tarjeta:has(#inf-preguntas:empty) { display: none; }
  .columna { padding: 0; max-width: none; }
  .cuerpo { display: block; }
  .tarjeta, .stat { border-color: #ccc; break-inside: avoid-page; }
  .informe { padding: 0 0 8px; border: 0; }
  .seccion { break-inside: auto; }
  .seccion h2 { break-after: avoid; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .prosa { max-width: none; font-size: 10.5pt; }
  .fuentes a::after { content: " — " attr(href); color: #666; font-size: 9pt; }
}
