/* Tribe Media Analytics — estilos base (login/denegado).
   Réplica editorial 18-ago: los tokens antiguos apuntan a la paleta
   editorial; los nombres se conservan por las reglas que los usan. */
:root {
  --tribe-purple: #B3261E;
  --tribe-purple-dark: #7A1A14;
  --tribe-purple-soft: #EADFC8;
  --ink: #1C1814;
  --ink-muted: #6B6156;
  --line: #CFC5AF;
  --surface: #FBF7ED;
  --bg: #F5F0E6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Pantallas centradas (login / denegado) ---------- */
.centro {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(179, 38, 30, 0.06), transparent 70%),
    var(--bg);
}

.tarjeta {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(23, 20, 31, 0.04),
              0 12px 32px rgba(23, 20, 31, 0.06);
}

.marca {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.marca__punto {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--tribe-purple), var(--tribe-purple-dark));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.marca__texto {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.tarjeta h1 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.tarjeta p {
  margin: 0 0 28px;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.55;
}

.boton-google {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.pie {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 12px;
}

.pie a { color: var(--tribe-purple); text-decoration: none; }
.pie a:hover { text-decoration: underline; }

/* ---------- Estado de error / acceso denegado ---------- */
.escudo {
  width: 46px;
  height: 46px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--tribe-purple-soft);
  color: var(--tribe-purple);
  font-size: 22px;
}

.aviso {
  display: none;
  margin-top: 18px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--tribe-purple-soft);
  color: var(--tribe-purple-dark);
  font-size: 13px;
  line-height: 1.45;
}

.aviso.visible { display: block; }

/* ---------- Dashboard ---------- */
.encabezado {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 28px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.encabezado .marca { margin-bottom: 0; }

.encabezado__derecha {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.cliente {
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--tribe-purple-soft);
  color: var(--tribe-purple-dark);
}

.salir {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 13px;
}

.salir:hover { color: var(--tribe-purple); }

.contenido {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 28px;
}

.contenido h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.contenido > p {
  margin: 0 0 32px;
  color: var(--ink-muted);
  font-size: 14px;
}

.rejilla {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.dato {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}

.dato__etiqueta {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.dato__valor {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.nota-fase {
  margin-top: 32px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 560px) {
  .encabezado { padding: 0 16px; }
  .contenido { padding: 28px 16px; }
  .encabezado__derecha .cliente { display: none; }
}

/* ---------- Fase 2: navegación de páginas ---------- */
.paginas {
  display: flex;
  gap: 4px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.paginas__item {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 14px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink-muted);
  cursor: pointer;
  white-space: nowrap;
}

.paginas__item:hover:not(:disabled) { color: var(--tribe-purple); }
.paginas__item:disabled { opacity: 0.4; cursor: not-allowed; }

.paginas__item--activo {
  color: var(--tribe-purple);
  border-bottom-color: var(--tribe-purple);
  font-weight: 600;
}

.contenido--ancho { max-width: 1180px; }

/* ---------- Barra de filtros ---------- */
.barra-filtros {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.campo { display: flex; flex-direction: column; gap: 5px; }
.campo--crece { min-width: 170px; }

.campo label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.campo input, .campo select {
  font: inherit;
  font-size: 13.5px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.campo input:focus, .campo select:focus {
  outline: 2px solid rgba(179, 38, 30, 0.25);
  border-color: var(--tribe-purple);
}

.boton {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  background: var(--tribe-purple);
  color: #fff;
  cursor: pointer;
}

.boton:hover { background: var(--tribe-purple-dark); }

.estado-rango { margin-left: auto; font-size: 13px; color: var(--ink-muted); }

.aviso-recorte {
  display: none;
  margin-bottom: 20px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--tribe-purple-soft);
  color: var(--tribe-purple-dark);
  font-size: 13px;
}

.aviso-recorte.visible { display: block; }

/* ---------- Paneles y gráficos ---------- */
.rejilla--kpis { margin-bottom: 24px; }
.rejilla--kpis .dato__valor { font-size: 22px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 20px;
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.panel__nota {
  margin: 0 0 18px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.panel__nota code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

.lienzo { position: relative; height: 300px; }

/* ---------- Heatmap ---------- */
.heatmap {
  display: grid;
  grid-template-columns: 36px repeat(24, 1fr);
  gap: 2px;
  min-width: 660px;
}

.heatmap__hora, .heatmap__dia {
  font-size: 10px;
  color: var(--ink-muted);
  display: grid;
  place-items: center;
}

.heatmap__dia { justify-content: start; font-size: 11px; }

.heatmap__celda {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--bg);
  cursor: default;
}

.heatmap__celda:hover { outline: 2px solid var(--tribe-purple); }

.leyenda {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 11px;
  color: var(--ink-muted);
}

.leyenda__barra {
  flex: 1;
  max-width: 180px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(28,24,20,0.05), var(--tribe-purple));
}

@media (max-width: 720px) {
  .panel { padding: 16px; overflow-x: auto; }
  .paginas { padding: 0 16px; }
}

/* ---------- Fase 2 · página 2: tabla y utilidades ---------- */
/* ---------- Logos de canal (los 49) ----------
   Salen de raw.i11_t004_channels.avatar_url con sufijo =s88; ver app/logos.py.
   El chip del Deep Dive vive FUERA del <select> porque un <option> no renderiza
   imagenes. `flex-shrink: 0` evita que el avatar se aplaste con nombres largos. */
.selector-con-logo { display: flex; align-items: center; gap: 8px; }
.selector-con-logo select { flex: 1; min-width: 0; }

.logo-canal {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface);
}

/* En tablas y chips el logo va en linea con el nombre. `vertical-align` en vez
   de flex en la celda: la celda del ranking ya mete el numeral de puesto y el
   indicador de movimiento, y un flex le rompia el ajuste de linea. */
.celda-canal .logo-canal,
.chip .logo-canal {
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: -5px;
  margin-right: 6px;
}

/* El chip del selector de series (p.5) es mas apretado que una fila de tabla. */
.chip .logo-canal--chip { width: 18px; height: 18px; vertical-align: -4px; margin-right: 5px; }

/* El nombre no se parte entre el logo y su primera palabra. */
.celda-canal .canal-nombre, .chip .canal-nombre { white-space: normal; }

.barra-filtros--secundaria {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  align-items: center;
}

.nota-inline {
  font-size: 12px;
  color: var(--ink-muted);
  max-width: 460px;
  line-height: 1.45;
}

.panel__scroll { overflow-x: auto; }

.tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 680px;
}

.tabla th, .tabla td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.tabla th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--surface);
}

.tabla tbody tr:hover { background: var(--tribe-purple-soft); }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }

.marca-null {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--tribe-purple-soft);
  color: var(--tribe-purple-dark);
  font-size: 11px;
  font-weight: 600;
  cursor: help;
}

/* ---------- Fase 2 · página 3: ranking ---------- */
.tabla th.orden { cursor: pointer; user-select: none; }
.tabla th.orden:hover { color: var(--tribe-purple); }

.pos {
  display: inline-block;
  min-width: 20px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.tabla .sube { color: #1F7A4D; }
.tabla .baja { color: #B23A48; }

.tabla .titulo {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel__nota--aviso {
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--tribe-purple-soft);
  color: var(--tribe-purple-dark);
}

.pie-tabla {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}

.boton--suave {
  background: var(--surface);
  color: var(--tribe-purple);
  border: 1px solid var(--line);
}

.boton--suave:hover { background: var(--tribe-purple-soft); }
.boton--suave:disabled { opacity: 0.6; cursor: default; }

/* ---------- Fase 2 · página 4 ---------- */
.dato--aviso {
  border-color: var(--tribe-purple);
  background: var(--tribe-purple-soft);
}

.sin-dato {
  color: var(--ink-muted);
  cursor: help;
  border-bottom: 1px dotted var(--line);
}

/* ---------- Fase 2 · página 5: Rating Deep Dive ---------- */
.horas {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}

.hora {
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  padding: 6px 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-muted);
  cursor: pointer;
}

.hora:hover { border-color: var(--tribe-purple); color: var(--tribe-purple); }

.hora--on {
  background: var(--tribe-purple);
  border-color: var(--tribe-purple);
  color: #fff;
  font-weight: 600;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.chip {
  font-size: 12.5px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-muted);
  cursor: pointer;
  user-select: none;
}

.chip:hover { border-color: var(--tribe-purple); }

.chip--on {
  background: var(--tribe-purple-soft);
  border-color: var(--tribe-purple);
  color: var(--tribe-purple-dark);
  font-weight: 600;
}

.lienzo--alto { height: 420px; }

.presupuesto {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 11.5px;
  overflow-x: auto;
}

/* ==========================================================================
   TEMA EDITORIAL v2 — referencia «Top Semanal Edición Perú» aplicada
   (9 ítems del contraste, decisión de Rafo 18-ago). Solo dashboard
   (body.editorial); login/denegado entran en la réplica.
   Paleta A: sin morado. El rojo NUNCA decora: señala el máximo real y
   rotula la edición. Tipos: Playfair Display para el héroe, la fecha de
   edición, títulos y cifras; IBM Plex Mono para todo lo demás.
   ========================================================================== */
body.editorial {
  --papel: #F5F0E6;
  --papel-2: #EADFC8;                 /* ítem 5: tostado ámbar de la referencia */
  --tinta: #1C1814;
  --tinta-media: #6B6156;
  --rojo: #B3261E;                    /* ítem 6: ladrillo, no carmesí */
  --regla: #CFC5AF;
  background: var(--papel);
  color: var(--tinta);
  font-family: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;
}

body.editorial :focus-visible {
  outline: 2px solid var(--rojo);
  outline-offset: 2px;
}

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

/* ---------- Masthead (ítems 1, 2, 9): marca pequeña, contenido héroe ------ */
body.editorial .cabecera-editorial { padding: 12px 28px 0; }

body.editorial .folio__marca {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

body.editorial .cabecera-editorial__folio {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--tinta);
  border-bottom: 1px solid var(--tinta);
  padding-bottom: 8px;
}

body.editorial .folio__diamante { color: var(--rojo); }

body.editorial .cabecera-editorial__meta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-weight: 500;
}

body.editorial .folio__edicion-peru {
  color: var(--rojo);
  font-weight: 700;
}

body.editorial .cliente {
  background: transparent;
  border: 1px solid var(--tinta);
  color: var(--tinta);
  border-radius: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 4px 9px;
}

body.editorial .salir {
  font-size: 10px;
  color: var(--tinta-media);
  text-decoration: none;
  letter-spacing: 0.08em;
}

body.editorial .salir:hover { color: var(--rojo); }

/* Héroe: título de página grande + edición en serif a la derecha */
body.editorial .cabecera-editorial__heroe {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding-top: 16px;
  border-bottom: 4px solid var(--tinta);
}

body.editorial .heroe__titulo {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(38px, 6vw, 62px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 0.95;
  margin: 0;
  color: var(--tinta);
}

body.editorial .heroe__kicker {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--rojo);
  margin: 8px 0 14px;
}

body.editorial .heroe__edicion {
  text-align: right;
  padding-bottom: 14px;
  margin-left: auto;
}

body.editorial .heroe__edicion-rotulo {
  display: block;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--tinta-media);
  margin-bottom: 3px;
}

body.editorial .heroe__edicion-rango {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(19px, 2.4vw, 27px);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--tinta);
  white-space: nowrap;
}

/* ---------- Navegación de secciones ---------- */
body.editorial .paginas {
  background: transparent;
  border-bottom: 1px solid var(--tinta);
  padding: 0 28px;
  gap: 0;
}

body.editorial .paginas__item {
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--tinta-media);
  padding: 12px 15px 10px;
  border-bottom: 3px solid transparent;
}

body.editorial .paginas__item:hover:not(:disabled) { color: var(--tinta); }

body.editorial .paginas__item--activo {
  color: var(--tinta);
  font-weight: 600;
  border-bottom-color: var(--rojo);
}

/* ---------- Filtros ---------- */
body.editorial .campo label {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--tinta-media);
}

body.editorial .campo input,
body.editorial .campo select {
  background: var(--papel);
  border: 1px solid var(--tinta);
  border-radius: 0;
  font-family: inherit;
  font-size: 12px;
  color: var(--tinta);
}

body.editorial .campo input:focus,
body.editorial .campo select:focus {
  outline: 2px solid var(--rojo);
  outline-offset: 1px;
  border-color: var(--tinta);
}

body.editorial .boton {
  background: var(--tinta);
  color: var(--papel);
  border-radius: 0;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 10px 18px;
}

body.editorial .boton:hover { background: var(--rojo); }

body.editorial .boton--suave {
  background: transparent;
  color: var(--tinta);
  border: 1px solid var(--tinta);
}

body.editorial .boton--suave:hover { background: var(--papel-2); }

body.editorial .estado-rango { font-size: 11px; color: var(--tinta-media); }

body.editorial .aviso-recorte {
  background: var(--papel-2);
  border: 1px solid var(--tinta);
  border-left: 4px solid var(--rojo);
  border-radius: 0;
  color: var(--tinta);
  font-size: 11px;
}

/* ---------- Cifras KPI (ítems 3 y 4): protagonistas, completas ---------- */
body.editorial .rejilla--kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;                               /* el fondo asoma como regla fina */
  background: var(--regla);
  border-top: 1px solid var(--tinta);
  border-bottom: 1px solid var(--tinta);
}

body.editorial .rejilla--kpis .dato {
  background: var(--papel);
  border: 0;
  border-radius: 0;
  padding: 16px 18px 18px;
}

body.editorial .dato__etiqueta {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--tinta-media);              /* ítem 3: el rojo es del dato, no del rótulo */
  margin-bottom: 12px;
}

body.editorial .dato__valor {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(36px, 4.2vw, 54px);
  white-space: nowrap;              /* punto 1: el fit por medicion exige 1 linea */
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--tinta);
}

body.editorial .dato__contexto {
  font-size: 10px;
  color: var(--tinta-media);
  margin-top: 10px;
  line-height: 1.5;
}

body.editorial .dato--aviso {
  background: var(--papel-2);
  border-left: 3px solid var(--rojo);
}

/* ---------- Secciones (ítem 7): regla simple, aire; el peso se reserva ---- */
body.editorial .panel {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--tinta);
  border-radius: 0;
  padding: 26px 0 36px;
  margin-bottom: 6px;
  box-shadow: none;
}

body.editorial .panel h2 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}

body.editorial .panel__nota {
  font-size: 10.5px;
  color: var(--tinta-media);
  line-height: 1.65;
  margin: 0 0 20px;
}

body.editorial .panel__nota code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: 10.5px;
  color: var(--tinta);
}

body.editorial .panel__nota--aviso {
  background: var(--papel-2);
  border-left: 3px solid var(--rojo);
  color: var(--tinta);
  border-radius: 0;
  padding: 9px 12px;
}

body.editorial .nota-inline { font-size: 10.5px; color: var(--tinta-media); }

/* ---------- Pie de metodología (ítem 8): la regla gruesa cierra la página -- */
body.editorial .pie-metodologia {
  border-top: 3px solid var(--tinta);
  position: relative;
  margin-top: 26px;
  padding: 16px 0 30px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

body.editorial .pie-metodologia::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 0;
  right: 0;
  border-top: 1px solid var(--tinta);
}

body.editorial .pie-metodologia__texto {
  font-size: 10px;
  color: var(--tinta-media);
  line-height: 1.7;
  max-width: 72ch;
  margin: 0;
}

body.editorial .pie-metodologia__texto strong { color: var(--tinta); }

body.editorial .pie-metodologia__marca {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--tinta);
  white-space: nowrap;
}

/* ---------- Heatmap: rampa de tinta; la celda máxima en rojo ---------- */
body.editorial .heatmap__celda { border-radius: 0; background: var(--papel-2); }
body.editorial .heatmap__celda:hover { outline: 2px solid var(--rojo); }
body.editorial .heatmap__hora,
body.editorial .heatmap__dia { color: var(--tinta-media); }

body.editorial .leyenda { color: var(--tinta-media); font-size: 10.5px; }
body.editorial .leyenda__barra {
  border-radius: 0;
  background: linear-gradient(90deg, rgba(28, 24, 20, 0.04), var(--tinta));
}
body.editorial .leyenda__max { color: var(--rojo); margin-left: 14px; }

/* ---------- Tablas ---------- */
body.editorial .tabla { font-size: 12px; }

body.editorial .tabla th {
  background: var(--papel);
  color: var(--tinta);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  border-bottom: 2px solid var(--tinta);
}

body.editorial .tabla td { border-bottom: 1px solid var(--regla); }
body.editorial .tabla tbody tr:hover { background: var(--papel-2); }

body.editorial .marca-null {
  background: var(--papel-2);
  color: var(--tinta);
  border: 1px solid var(--regla);
  border-radius: 0;
}

@media (max-width: 720px) {
  body.editorial .cabecera-editorial { padding: 10px 16px 0; }
  body.editorial .paginas { padding: 0 16px; }
  body.editorial .heroe__edicion { text-align: left; margin-left: 0; }
  body.editorial .heroe__edicion-rango { white-space: normal; }
}

/* ==========================================================================
   REPLICA (paso B, 18-ago): ranking editorial (R-1/R-2/R-3), controles de la
   pagina 5 y login/denegado. El morado murio en toda la app.
   ========================================================================== */
/* R-1: numerales de ranking en serif; el lider lleva los acentos rojos */
body.editorial .pos {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 17px;
  font-weight: 800;
  color: var(--tinta-media);
  min-width: 26px;
}

body.editorial .fila-lider .pos { color: var(--rojo); }
body.editorial .cifra-lider { color: var(--rojo); font-weight: 700; }

/* R-2: entrada nueva (sin actividad en la ventana previa) — tinta bold */
/* «N/D» en la columna Crec. %: el canal no estaba en la ventana previa, asi que
   no hay variacion que calcular. Distinto del «—», que es la columna entera
   deshabilitada por depth_weeks.
   Sin `letter-spacing` (era para el rotulo «ENTRA», una palabra en versalitas):
   sobre una abreviatura de 3 caracteres el espaciado final la desplazaba de la
   alineacion a la derecha del resto de cifras de la columna. */
body.editorial .sin-previa {
  font-weight: 700;
  font-size: 11px;
  color: var(--tinta-media);
  cursor: help;
}

/* R-1: deltas con flecha; el verde se mantiene, la caida usa el rojo editorial */
body.editorial .tabla .sube { color: #1F6B3A; font-weight: 600; }
body.editorial .tabla .baja { color: var(--rojo); font-weight: 600; }

/* R-3: barra tostada proporcional a la Audiencia (variable --barra por fila).
   Va en CSS y no inline para que el hover pueda seguir ganando. */
body.editorial #panel-ranking tbody tr {
  background: linear-gradient(90deg,
    var(--papel-2) var(--barra, 0%), transparent var(--barra, 0%));
}

body.editorial #panel-ranking tbody tr:hover { background: var(--papel-2); }

/* ---------- Pagina 5: filtro horario y chips de seleccion ---------- */
body.editorial .hora {
  border-radius: 0;
  background: var(--papel);
  border: 1px solid var(--regla);
  color: var(--tinta-media);
}

body.editorial .hora:hover { border-color: var(--tinta); color: var(--tinta); }

body.editorial .hora--on {
  background: var(--tinta);
  border-color: var(--tinta);
  color: var(--papel);
  font-weight: 600;
}

body.editorial .chip {
  border-radius: 0;
  background: var(--papel);
  border: 1px solid var(--regla);
  color: var(--tinta-media);
}

body.editorial .chip:hover { border-color: var(--tinta); }

body.editorial .chip--on {
  background: var(--papel-2);
  border-color: var(--tinta);
  color: var(--tinta);
  font-weight: 600;
}

body.editorial .presupuesto {
  background: var(--papel-2);
  border: 1px solid var(--regla);
  border-radius: 0;
}

/* ---------- Login / denegado (replica): papel, serif, sin morado ---------- */
body.editorial .tarjeta {
  border-radius: 0;
  border: 1px solid var(--tinta);
  box-shadow: none;
  background: var(--surface, #FBF7ED);
}

body.editorial .tarjeta h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.01em;
}

body.editorial .tarjeta p { font-size: 12px; }

body.editorial .marca__punto { background: var(--tinta); border-radius: 0; }

body.editorial .marca__texto {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 600;
}

body.editorial .pie { font-size: 10.5px; }
body.editorial .pie a { color: var(--rojo); }

body.editorial .escudo {
  border-radius: 0;
  background: var(--papel-2);
  color: var(--rojo);
}

body.editorial .aviso { border-radius: 0; font-size: 11px; }

/* ---------- Logo oficial de Tribe (punto 5, iteracion 19-ago) ----------
   El PNG (logotribewhite) trae fondo blanco OPACO y una columna oscura de 1px
   en x=0 (artefacto de export). El recorte por background usa el bbox medido
   del lockup (414x434 en canvas 1103x1206), que excluye el artefacto, y
   mix-blend-mode:multiply funde el blanco con el papel. El cobre/terracota de
   la marca NO se recolorea: convive con el rojo editorial. */
body.editorial .logo-tribe {
  display: inline-block;
  height: var(--logo-h, 30px);
  aspect-ratio: 414 / 434;
  background: url("/static/logo-tribe.png?v=ed8") no-repeat;
  background-size: 266.43% auto;
  background-position: 50.36% 52.98%;
  mix-blend-mode: multiply;
  flex: none;
}

/* ---------- Movimiento de puesto en el ranking (feature 19-ago) ---------- */
body.editorial .mov {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 6px 0 2px;
  vertical-align: 2px;
  cursor: help;
  white-space: nowrap;
}

body.editorial .mov--sube { color: #1F6B3A; }
body.editorial .mov--baja { color: var(--rojo); }
body.editorial .mov--igual { color: var(--tinta-media); }

/* «∗» = el canal no estaba en la ventana previa, asi que no hay puesto con que
   comparar. Tiene que leerse DISTINTO del «–» de mov--igual, que significa lo
   contrario (se mantuvo). Se usa el asterisco de nota al pie, que en un sistema
   editorial ya significa "esto tiene una salvedad, mira la nota"; tenue, para
   que no compita con los ▲▼ que si son informacion de movimiento.
   Va mas grande y mas bajo que el resto de .mov porque el glifo del asterisco
   se dibuja pequeno y colgado de la altura de mayuscula: con el `vertical-align`
   heredado quedaba flotando sobre la linea. */
body.editorial .mov--nuevo {
  color: var(--tinta-media);
  opacity: 0.75;
  font-size: 15px;
  vertical-align: -1px;
  line-height: 0;
  font-weight: 400;
}

/* ---------- Cifras en lining figures (ajuste 19-ago, cierre del restyling) --
   Playfair rendia oldstyle (alturas disparejas: 3/4/5/7/9 con descendentes).
   lining-nums iguala todas las cifras a altura de mayuscula; tabular-nums las
   hace de ancho fijo. font-feature-settings queda como refuerzo por si el
   navegador ignora la propiedad de alto nivel. Aplica a TODO elemento numerico
   en serif: cifras KPI, fecha de edicion y numerales del ranking. */
body.editorial .dato__valor,
body.editorial .heroe__edicion-rango,
body.editorial .pos {
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
}
