*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens ────────────────────────────────────────────────────────────── */
:root {
  --azul:        #1a1a2e;
  --rojo:        #b91c1c;
  --verde:       #16a34a;
  --amber:       #d97706;
  --gris:        #6b7280;
  --borde:       #e5e7eb;
  --fondo:       #f1f5f9;
  --superficie:  #ffffff;
  --texto:       #111827;
  --muted:       #6b7280;
  --radio:       10px;
  --radio-pill:  999px;
  --radio-card:  12px;
  --gap-card:    24px;
  --pad-card:    24px;
  --max-content: 860px;

  /* aliases de compatibilidad */
  --surface: var(--superficie);
  --border:  var(--borde);
  --error:   var(--rojo);
}

/* ── Base ──────────────────────────────────────────────────────────────── */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--fondo);
  color: var(--texto);
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: 40px;
}

body.app-body {
  padding-bottom: 0;
  display: flex;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-width: 220px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--azul);
  color: white;
  display: flex;
  flex-direction: column;
  z-index: 20;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo-link {
  color: white;
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.3px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 8px 0;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .12s, color .12s;
}
.sidebar-item:hover  { background: rgba(255,255,255,0.08); color: white; }
.sidebar-item.active { background: rgba(255,255,255,0.14); color: white; }

.sidebar-icon  { font-size: 16px; flex-shrink: 0; }
.sidebar-label { flex: 1; }

.sidebar-badge {
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  line-height: 16px;
}
.sidebar-badge:empty { display: none; }
.sidebar-badge-live  { background: var(--verde); }

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 10px 16px;
}

.sidebar-spacer { flex: 1; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  text-decoration: none;
  color: rgba(255,255,255,0.75);
  font-size: 13px;
  font-weight: 500;
  transition: background .12s;
}
.sidebar-user:hover  { background: rgba(255,255,255,0.08); color: white; }
.sidebar-user.active { background: rgba(255,255,255,0.14); color: white; }

.sidebar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.sidebar-user-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.sidebar-user-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-logout {
  display: block;
  width: calc(100% - 32px);
  margin: 8px 16px 12px;
  padding: 8px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radio-pill);
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  transition: background .12s, color .12s;
  text-decoration: none;
}
.sidebar-logout:hover {
  background: rgba(255,80,80,0.15);
  border-color: rgba(255,80,80,0.4);
  color: #ff8080;
}

/* ── Layout principal ──────────────────────────────────────────────────── */
.main-content {
  margin-left: 220px;
  min-height: 100vh;
  width: calc(100% - 220px);
}

.page-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: calc(var(--max-content) + 48px);
}

.page-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--texto);
}

.page-body {
  padding: 20px 24px;
  max-width: calc(var(--max-content) + 48px);
  display: flex;
  flex-direction: column;
  gap: var(--gap-card);
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--superficie);
  border-radius: var(--radio-card);
  border: 1px solid var(--borde);
  padding: var(--pad-card);
}

/* Header de sección dentro de card: LABEL + CTA */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* Label uppercase — versión simple */
.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Label uppercase — versión con nombre dinámico (más prominente) */
.section-label-bold {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--texto);
}

/* ── Botones ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radio-pill);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, background .12s;
  white-space: nowrap;
  line-height: 1;
}
.btn:active { opacity: .8; }
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.btn-primary   { background: var(--azul);      color: white; }
.btn-secondary { background: var(--superficie); color: var(--texto); border: 1px solid var(--borde); }
.btn-danger    { background: var(--rojo);       color: white; }
.btn-danger-outline { background: var(--superficie); color: var(--rojo); border: 1px solid var(--rojo); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-md { padding: 10px 18px; font-size: 14px; }
.btn-lg { padding: 14px 24px; font-size: 16px; width: 100%; }

/* Botón ghost (icon-only, copy, toggle) */
.btn-ghost {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .5;
  transition: opacity .15s;
}
.btn-ghost:hover { opacity: 1; }

/* ── Inputs y formularios ───────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  font-size: 16px;
  font-family: inherit;
  background: var(--superficie);
  color: var(--texto);
  -webkit-appearance: none;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--azul);
}
textarea { resize: vertical; min-height: 180px; line-height: 1.6; }

/* Textarea Tipo 1 — editable directo (estándar, hereda estilos arriba) */

/* Textarea Tipo 2 — modo lectura (requiere click en Editar) */
.textarea-display {
  background: #f8fafc;
  color: var(--texto);
  cursor: default;
  border-color: var(--borde);
  resize: none;
}
.textarea-display:focus { border-color: var(--borde); }

/* Textarea Tipo 2 — modo edición (tras click en Editar) */
.textarea-display.editable {
  background: var(--superficie);
  cursor: text;
  resize: vertical;
}
.textarea-display.editable:focus { border-color: var(--azul); }

/* Ángulos de imagen (Paso 3) — textarea editable con afordancia visible */
.p3-angulo-prompt {
  width: 100%;
  border: 1px solid var(--borde);
  border-radius: 6px;
  background: #f8fafc;
  resize: vertical;
  font-family: inherit;
  font-size: .875rem;
  color: var(--texto);
  line-height: 1.5;
  padding: .55rem .7rem;
  transition: border-color .15s, background .15s;
}
.p3-angulo-prompt:focus {
  outline: none;
  border-color: var(--azul);
  background: var(--superficie);
}
.p3-angulo-prompt--nolabel { padding-right: 44px; }

/* Ángulos de imagen (#288) — replegable de solo lectura en el editor del artículo publicado */
.angulos-details { margin-top: .75rem; border: 1px solid var(--borde); border-radius: 8px; overflow: hidden; }
.angulos-summary {
  cursor: pointer;
  min-height: 44px;            /* táctil (regla UX móvil) */
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .7rem .9rem;
  font-size: .95rem;
  font-weight: 600;
  color: var(--texto);
  user-select: none;
  list-style: none;            /* quita el marcador nativo; usamos ▸/▾ propio */
}
.angulos-summary::-webkit-details-marker { display: none; }
.angulos-summary::before { content: '▸'; color: var(--gris); font-weight: 400; }
.angulos-details[open] .angulos-summary::before { content: '▾'; }
.angulos-details[open] .angulos-summary { border-bottom: 1px solid var(--borde); }
.angulos-count { color: var(--gris); font-weight: 600; }
.angulos-summary-hint { color: var(--gris); font-weight: 400; font-size: .8rem; }
.angulos-zona { display: flex; flex-direction: column; gap: .6rem; padding: .7rem .9rem; }
.angulo-card {
  position: relative;
  border: 1px solid var(--borde);
  border-radius: 8px;
  background: #f8fafc;
  padding: .6rem 48px .6rem .8rem;  /* hueco a la derecha para el icono copiar */
}
.angulo-label {
  margin: 0 0 .3rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--gris);
}
.angulo-prompt {
  margin: 0;
  font-size: .875rem;
  line-height: 1.5;
  color: var(--texto);
  word-break: break-word;
}

/* Contenedor para textarea Tipo 2 con copy button */
.textarea-wrapper {
  position: relative;
}
.textarea-wrapper .btn-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .45;
  transition: opacity .15s;
  color: var(--gris);
}
.textarea-wrapper .btn-copy:hover { opacity: 1; }

.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label { font-size: 13px; font-weight: 600; color: var(--gris); }
.campo small  { font-weight: 400; }
.contador { font-size: 12px; color: var(--gris); text-align: right; }

.form { display: flex; flex-direction: column; gap: 16px; }

.slug-preview { display: flex; align-items: center; }
.slug-base {
  background: #f3f4f6;
  border: 1px solid var(--borde);
  border-right: none;
  border-radius: var(--radio) 0 0 var(--radio);
  padding: 10px;
  font-size: 13px;
  color: var(--gris);
  white-space: nowrap;
}
.slug-preview input { border-radius: 0 var(--radio) var(--radio) 0; }

/* ── Tabs de filtro (estilo pill) ───────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-tab {
  background: none;
  border: 1px solid var(--borde);
  border-radius: var(--radio-pill);
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.filter-tab:hover  { border-color: var(--azul); color: var(--texto); }
.filter-tab.active {
  background: var(--azul);
  border-color: var(--azul);
  color: white;
  font-weight: 600;
}

/* Tabs de navegación (línea inferior — usado en cola de revisión) */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--borde);
  background: white;
  padding: 0 16px;
  gap: 4px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab.active { color: var(--texto); border-bottom-color: var(--azul); }
.tab-badge {
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}
.tab-badge:empty { display: none; }

/* ── Badges de estado ───────────────────────────────────────────────────── */
.badge-estado {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radio-pill);
}
.badge-borrador  { color: var(--amber);  background: #fffbeb; }
.badge-publicado { color: var(--verde);  background: #f0fdf4; }
.badge-alerta    { color: var(--amber);  background: #fffbeb; }
.badge-evergreen { color: #1d4ed8;       background: #eff6ff; }

/* Badge genérico (score, fuente) */
.badge {
  display: inline-block;
  border-radius: var(--radio-pill);
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}
.badge-alta  { background: #fef2f2; color: var(--rojo); }
.badge-media { background: #fffbeb; color: var(--amber); }

/* ── Estado vacío (dashed) ──────────────────────────────────────────────── */
.empty-state {
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radio-card);
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: #f8fafc;
}

/* ── Estados globales ───────────────────────────────────────────────────── */
.loading, .vacio, .error-msg { padding: 40px 16px; text-align: center; color: var(--gris); }
.error-msg { color: var(--rojo); }

.mensaje {
  /* Toast flotante (mismo patrón que .toast-global): visible sin scroll
     aunque se guarde desde el pie de un form largo. Antes era inline al final
     del markup → aparecía bajo el fold y había que hacer scroll para verlo. */
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: min(90vw, 480px);
  padding: 12px 16px;
  border-radius: var(--radio);
  font-weight: 600;
  text-align: center;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
}
.mensaje.exito { background: #f0fdf4; color: var(--verde); }
.mensaje.error  { background: #fef2f2; color: var(--rojo); }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal.visible { display: flex; }
.modal-box {
  background: white;
  border-radius: var(--radio-card);
  padding: 24px 20px;
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-pregunta { font-size: 17px; font-weight: 700; line-height: 1.4; }
.modal-aviso    { font-size: 14px; color: var(--gris); }
.modal-acciones { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

/* ── Nota desde enlace manual (#68) ─────────────────────────────────────── */
.manual-url-input {
  width: 100%;
  font-size: 16px;              /* ≥16px: previene el zoom de iOS Safari */
  padding: 12px 14px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  color: var(--texto);
  background: var(--superficie);
}
.manual-url-input:focus { outline: none; border-color: var(--azul); }
.manual-error { font-size: 13px; color: var(--rojo); line-height: 1.45; }
.manual-link  { color: var(--azul); font-weight: 600; text-decoration: underline; white-space: nowrap; }
/* `:not([hidden])` para que el atributo `hidden` gane: si no, `display:flex`
   sobreescribe al `[hidden]{display:none}` del UA y el spinner sale siempre. */
.manual-progreso:not([hidden]) { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gris); }
.manual-spinner {
  width: 16px; height: 16px; flex-shrink: 0;
  border: 2px solid var(--borde);
  border-top-color: var(--azul);
  border-radius: 50%;
  animation: manual-spin .7s linear infinite;
}
@keyframes manual-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .manual-spinner { animation: none; } }

/* Badge interno "Manual" en la tarjeta de la cola (alerta sin feed) */
.alerta-meta-left { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.badge-manual {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--amber); background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 4px; padding: 1px 6px; white-space: nowrap; flex-shrink: 0;
}

/* ── Tabla genérica (secciones, etiquetas, etc.) ────────────────────────── */
.tabla {
  width: 100%;
  border-collapse: collapse;
}
.tabla th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 1px solid var(--borde);
}
.tabla td {
  padding: 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--borde);
  vertical-align: middle;
}
.tabla tr:last-child td { border-bottom: none; }
.tabla-acciones { display: flex; gap: 6px; justify-content: flex-end; }

/* ── Tabla fuentes (scraper) ────────────────────────────────────────────── */
.tabla-fuentes { width: 100%; border-collapse: collapse; }
.tabla-fuentes th { text-align: left; padding: 12px 14px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--borde); }
.tabla-fuentes td { padding: 12px 14px; font-size: 14px; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.tabla-fuentes tr:last-child td { border-bottom: none; }
.fila-inactiva   { opacity: .55; }
.fuente-nombre   { font-weight: 600; }
.fuente-url      { font-size: 12px; color: var(--gris); margin-top: 2px; word-break: break-all; }
.tag-tipo        { background: #f3f4f6; color: var(--gris); font-size: 12px; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.toggle-activa   { border: none; background: none; cursor: pointer; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: var(--radio-pill); }
.toggle-activa.activa   { color: var(--verde);  background: #f0fdf4; }
.toggle-activa.inactiva { color: var(--gris);   background: #f3f4f6; }
.acciones-fuente { display: flex; gap: 6px; }

/* ── Lista de artículos ─────────────────────────────────────────────────── */
.article-list { display: flex; flex-direction: column; }
.article-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--borde);
  text-decoration: none;
  color: var(--texto);
}
.article-row:last-child { border-bottom: none; }
.article-row:hover .article-title { text-decoration: underline; }
.article-title { flex: 1; font-size: 14px; font-weight: 500; line-height: 1.4; }
.article-fecha { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ── Lista de editores (equipo) ─────────────────────────────────────────── */
.editor-list { display: flex; flex-direction: column; }
.editor-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--borde);
}
.editor-row:last-child { border-bottom: none; }
.editor-avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--azul);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.editor-info { flex: 1; min-width: 0; }
.editor-nombre { font-size: 14px; font-weight: 600; }
.editor-email  { font-size: 12px; color: var(--muted); }
.badge-rol {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radio-pill);
  border: 1px solid var(--borde);
  color: var(--texto);
  background: transparent;
}
.badge-rol-jefe { border-color: var(--azul); color: var(--azul); }

/* ── Fuente bloque (paso 2 scraper / editorial) ─────────────────────────── */
.fc-bloque { border: 1px solid var(--borde); border-radius: 8px; overflow: hidden; margin-bottom: .75rem; }
.fc-bloque:last-child { margin-bottom: 0; }
.fc-header { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; background: #f9fafb; border-bottom: 1px solid var(--borde); }
.fc-header-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--texto); flex: 1; min-width: 0; }
.fc-toggle { background: none; border: none; cursor: pointer; font-size: .75rem; color: var(--gris); padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.fc-toggle:hover { background: var(--borde); }
.fc-body { position: relative; }
.fc-textarea { width: 100%; border: none; resize: vertical; font-size: .85rem; line-height: 1.6; color: var(--texto); padding: .85rem 2.5rem .85rem 1rem; font-family: inherit; background: #fff; min-height: 80px; max-height: 220px; overflow-y: auto; display: block; }
.fc-textarea:focus { outline: none; }
.fc-copy { position: absolute; top: .6rem; right: .6rem; background: none; border: 1px solid var(--borde); border-radius: 5px; cursor: pointer; padding: 3px 6px; color: var(--gris); display: flex; align-items: center; justify-content: center; }
.fc-copy:hover { background: var(--borde); }

/* ── Fuentes (alerta paso 1) ────────────────────────────────────────────── */
.fuentes { display: flex; flex-direction: column; gap: 2px; margin-bottom: 28px; }
.fuentes h3 { font-size: 11px; font-weight: 700; color: var(--gris); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.fuentes-secundarias-label { font-size: 11px; font-weight: 700; color: var(--gris); text-transform: uppercase; letter-spacing: .08em; margin-top: 12px; margin-bottom: 4px; }
.fuente-no-encontrada { font-size: 13px; color: var(--gris); font-style: italic; padding: 4px 0; }
.fuente-link { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--texto); font-size: 13.5px; line-height: 1.4; padding: 7px 0; }
.fuente-link:hover { color: var(--azul); }
.fuente-link:hover .fuente-titulo { text-decoration: underline; }
.fuente-ext { font-size: 11px; color: var(--gris); flex-shrink: 0; }
.fuente-label { font-size: 11px; font-weight: 700; color: var(--gris); background: var(--fondo); border: 1px solid var(--borde); border-radius: 4px; padding: 1px 6px; white-space: nowrap; flex-shrink: 0; }
.fuente-label-primaria { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.fuente-label-original { color: #92400e; background: #fffbeb; border-color: #fde68a; }
.fuente-titulo { color: var(--texto); }

.fuente-grupo { padding: .75rem 0; border-bottom: 1px solid var(--borde); }
.fuente-grupo:last-child { border-bottom: none; }
.fuente-grupo-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gris); margin-bottom: .75rem; }
.fuente-item { display: flex; align-items: flex-start; gap: .75rem; padding: .6rem .75rem; border-radius: 6px; background: #fff; border: 1px solid var(--borde); margin-bottom: .5rem; }
.fuente-item:last-child { margin-bottom: 0; }
.fuente-item input[type=checkbox] { margin-top: 3px; flex-shrink: 0; accent-color: var(--azul); width: 16px; height: 16px; cursor: pointer; }
.fuente-item-body { flex: 1; min-width: 0; }
.fuente-item-url { font-size: .8rem; color: var(--azul); text-decoration: none; display: block; margin-bottom: .3rem; word-break: break-all; font-weight: 600; }
.fuente-item-url:hover { text-decoration: underline; }
.fuente-item-snippet { font-size: 1rem; color: var(--gris); line-height: 1.55; margin: 0; }
.fuente-item-tipo { font-size: .75rem; color: var(--gris); margin-bottom: .2rem; }
.fuente-seccion-wrapper { border: 1px solid var(--borde); border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1.25rem; }

/* ── Alerta header ──────────────────────────────────────────────────────── */
.alerta-card { background: white; border-radius: var(--radio-card); padding: 16px; border: 1px solid var(--borde); display: flex; gap: 12px; align-items: flex-start; }
.alerta-card-body { flex: 1; min-width: 0; }
.alerta-meta { display: flex; justify-content: space-between; align-items: center; }
.status-chip { display: inline-block; font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 20px; white-space: nowrap; line-height: 1.4; }
.alerta-header { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; background: #fff; border: 1px solid var(--borde); border-radius: 8px; margin-bottom: 1.5rem; flex-wrap: wrap; }
.alerta-header-fuente { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--azul); }
.alerta-header-score  { font-size: .75rem; font-weight: 600; padding: .2rem .6rem; background: #f0fdf4; color: #15803d; border-radius: 20px; }
.alerta-header-fecha  { font-size: .75rem; color: var(--gris); margin-left: auto; }
.alerta-titular       { font-size: 1.3rem; font-weight: 700; line-height: 1.35; margin-bottom: 1.5rem; color: var(--texto); }
.alerta-extracto { font-size: .85rem; color: var(--muted); margin: .35rem 0 .6rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.alerta-error-motivo { font-size: .82rem; color: #991b1b; background: #fef2f2; border-left: 3px solid #ef4444; border-radius: 4px; padding: .4rem .6rem; margin: .35rem 0 .6rem; line-height: 1.4; }
.alerta-check-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  flex-shrink: 0;
}
.alerta-check { accent-color: var(--azul); width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }

/* Mensaje global (notificación flash) */
.mensaje-global { background: #7e22ce; color: #fff; padding: .6rem 1rem; border-radius: 6px; font-size: .85rem; margin: 0 0 12px; }

/* Tabs sin sticky (override para páginas con layout propio) */
.tabs-static { position: static; padding: 0; margin-bottom: 16px; }

/* Lista sin padding (override cuando el contenedor ya tiene padding) */
.lista-flush { padding: 0; }

/* ── Stepper ────────────────────────────────────────────────────────────── */
.step         { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.step-circle  { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; border: 2px solid var(--borde); background: #fff; color: var(--gris); }
.step-circle.activo     { border-color: var(--azul);  background: var(--azul);  color: #fff; }
.step-circle.completado { border-color: var(--verde); background: var(--verde); color: #fff; }
.step-label   { font-size: .75rem; color: var(--gris); white-space: nowrap; }
.step-label.activo { color: var(--azul); font-weight: 600; }
.step-line    { flex: 1; height: 2px; background: var(--borde); margin: 0 4px; margin-bottom: 16px; }
.step-line.completado { background: var(--verde); }

/* ── Titulares (radio) ──────────────────────────────────────────────────── */
.titular-radio-item { display: flex; align-items: flex-start; gap: .6rem; padding: .55rem .75rem; border-radius: 6px; border: 1px solid var(--borde); background: #fff; cursor: pointer; transition: border-color .15s, background .15s; }
.titular-radio-item:hover       { border-color: #93c5fd; background: #f8faff; }
.titular-radio-item.seleccionado { border-color: var(--azul); background: #f0f4ff; }
.titular-radio-texto { font-size: .9rem; line-height: 1.45; color: var(--texto); }

/* ── Acordeones ─────────────────────────────────────────────────────────── */
.acc-panel  { border: 1px solid var(--borde); border-radius: 8px; overflow: hidden; }
.acc-header { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: .85rem 1rem; background: var(--azul); color: white; border: none; cursor: pointer; font-size: .9rem; gap: .5rem; }
.acc-header:hover { background: #16213e; }
.acc-arrow  { color: rgba(255,255,255,0.65); font-size: .8rem; margin-left: auto; }
.acc-check  { color: #4ade80; display: none; }
.acc-body   { padding: 1rem; }

/* ── Perfil editor (dropdown header) ───────────────────────────────────── */
.editor-perfil { position: relative; }
.editor-perfil-btn { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); color: white; font-size: 13px; padding: 4px 10px 4px 6px; border-radius: var(--radio-pill); cursor: pointer; }
.editor-perfil-btn:hover { background: rgba(255,255,255,0.2); }
.editor-avatar    { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.editor-avatar-inicial { display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.3); font-weight: 600; font-size: 13px; }
.editor-dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: white; border: 1px solid var(--borde); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); min-width: 160px; overflow: hidden; z-index: 100; }
.editor-dropdown-item { display: block; width: 100%; padding: 10px 14px; text-align: left; font-size: 14px; color: var(--texto); text-decoration: none; background: none; border: none; cursor: pointer; }
.editor-dropdown-item:hover { background: var(--fondo); }
.editor-dropdown-salir { color: var(--rojo); }

/* ── Chips ──────────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radio-pill);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
/* palabras clave scraper */
.chip-include { background: #eff6ff; color: #1d4ed8; }
.chip-exclude { background: #fef2f2; color: var(--rojo); }
/* estado artículo */
.chip-draft     { background: #fefce8; color: #a16207; }
.chip-published { background: #f0fdf4; color: #15803d; }
.chip-scheduled { background: #fffbeb; color: #b45309; }
.chip-evergreen { background: #eff6ff; color: #1d4ed8; }
.chip-short     { background: #fdf4ff; color: #7e22ce; }
.chip-alerta    { background: #fff7ed; color: #c2410c; }

/* Banner de gestión de un artículo programado (#programar) */
.programado-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 8px 0 16px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-size: 14px;
  font-weight: 600;
}
.programado-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

/* Separador vertical entre grupos de filtros */
.filter-divider {
  width: 1px;
  background: var(--borde);
  margin: 0 4px;
  align-self: stretch;
}

/* Paginación */
.paginacion {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 1.5rem;
}
.paginacion-info { font-size: .85rem; color: var(--muted); }

/* Lista de artículos (articulos.astro) */
.art-lista { display: block; }
.art-fila {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 8px;
  border-bottom: 1px solid var(--borde);
  text-decoration: none;
  color: inherit;
  transition: background .1s;
  border-radius: 6px;
  margin: 0 -8px;
}
.art-fila:hover  { background: #f8fafc; }
.art-titulo {
  flex: 1;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.art-chips { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.art-fecha { font-size: 12px; color: var(--muted); flex-shrink: 0; min-width: 80px; text-align: right; }

/* ── Page subtitle (bajo el page-title) ────────────────────────────────── */
.page-subtitle { color: var(--muted); font-size: .88rem; margin-top: .25rem; }

/* ── Texto secundario de encabezado de sección ──────────────────────────── */
.section-title-note { font-size: .75rem; font-weight: 400; color: var(--muted); }

/* ── Inteligencia editorial (.ia-*) ─────────────────────────────────────── */
.ia-section { margin-bottom: 2.5rem; }
.ia-section-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--borde); }
.ia-grid-modelos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.ia-modelo-campo { display: flex; flex-direction: column; gap: .3rem; }
.ia-label { font-size: .75rem; font-weight: 600; color: var(--muted); }
.ia-select { padding: .4rem .6rem; border: 1px solid var(--borde); border-radius: 6px; font-size: .85rem; background: #fff; width: auto; }
.ia-prompt-bloque { border: 1px solid var(--borde); border-radius: 8px; margin-bottom: .75rem; overflow: hidden; }
.ia-prompt-header { display: flex; justify-content: space-between; align-items: flex-start; padding: .6rem .75rem; background: #f8f9fa; border-bottom: 1px solid var(--borde); gap: .5rem; }
.ia-prompt-header-info { flex: 1; min-width: 0; }
.ia-prompt-header-actions { display: flex; gap: .4rem; align-items: center; flex-shrink: 0; }
.ia-prompt-label { font-size: .8rem; font-weight: 700; color: var(--texto); }
.ia-prompt-cuando { display: block; font-size: .72rem; color: var(--muted); margin-top: 2px; }
.ia-badge-readonly { display: inline-block; font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; background: #f1f5f9; color: var(--muted); border-radius: 4px; padding: 1px 6px; margin-left: .4rem; vertical-align: middle; }
.ia-textarea { display: block; width: 100%; padding: .75rem; font-size: .82rem; line-height: 1.55; font-family: 'SF Mono', 'Fira Mono', monospace; border: none; resize: none; background: #fff; min-height: 80px; max-height: 400px; box-sizing: border-box; color: var(--texto); }
.ia-textarea[readonly] { background: #fafafa; color: var(--muted); }
/* Botón de copiar — icono reutilizable (ángulos, prompts de inteligencia). Área táctil 44x44. */
.btn-copy-icon { width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--gris); cursor: pointer; border-radius: 8px; }
.btn-copy-icon:hover { background: #f1f5f9; }
/* Estado "copiado" — verde, compartido por el icono y el botón de texto del modal */
.copiado { color: var(--verde) !important; }
/* Modificador para tarjetas: icono flotante arriba a la derecha */
.btn-copy-icon--corner { position: absolute; top: .25rem; right: .25rem; }
.ia-btn-save { padding: .3rem .65rem; border: 1px solid var(--azul); border-radius: 5px; background: var(--azul); color: #fff; font-size: .75rem; font-weight: 600; cursor: pointer; }
.ia-btn-save:disabled { opacity: .6; cursor: default; }
.ia-btn-save:hover:not(:disabled) { opacity: .88; }
.ia-msg { min-height: 1.4rem; font-size: .82rem; margin-top: .5rem; }

/* ── /inteligencia — "¿Cómo generarlo?" (botón secundario + modal de meta-prompt) ── */
.ia-btn-comogenerar { padding: .3rem .6rem; border: 1px solid var(--borde); border-radius: 5px; background: #fff; color: var(--gris); font-size: .75rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ia-btn-comogenerar:hover { background: var(--fondo); color: var(--texto); }
.cg-box { position: relative; max-width: 560px; }
.cg-cerrar { position: absolute; top: 14px; right: 14px; background: none; border: none; font-size: 1.2rem; line-height: 1; color: var(--gris); cursor: pointer; padding: 4px; }
.cg-codebox { position: relative; background: var(--fondo); border: 1px solid var(--borde); border-radius: var(--radio); padding: .85rem 2.6rem .85rem .85rem; font-family: 'SF Mono', 'Fira Mono', monospace; font-size: .8rem; line-height: 1.6; color: var(--texto); white-space: pre-line; max-height: 60vh; overflow-y: auto; }
@media (max-width: 768px) {
  #modal-como-generar { align-items: flex-end; padding: 0; }
  #modal-como-generar .modal-box { border-radius: 12px 12px 0 0; max-width: none; max-height: 85vh; overflow-y: auto; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
}

/* ── Timelines lista ────────────────────────────────────────────────────── */
.tl-lista { display: block; }
.tl-fila {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 8px;
  border-bottom: 1px solid var(--borde);
  text-decoration: none;
  color: inherit;
  border-radius: 6px;
  margin: 0 -8px;
  transition: background .1s;
  text-align: left;
  width: calc(100% + 16px);
  box-sizing: border-box;
}
.tl-fila:hover { background: #f8fafc; }
.tl-titulo {
  flex: 1;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  color: var(--texto);
}
.tl-fila:hover .tl-titulo { color: var(--azul); }
.tl-meta { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.tl-chip-activo   { background: #f0fdf4; color: #15803d; }
.tl-chip-inactivo { background: #f1f5f9; color: #64748b; }
.tl-entradas { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Modal ancho extendido */
.modal-box-md { max-width: 480px; }

/* Error inline en formularios */
.form-error { color: var(--rojo); font-size: .85rem; min-height: 1.2rem; }
.form-warning { color: #92400e; background: #fef3c7; border: 1px solid #fcd34d; border-radius: 6px; font-size: .82rem; padding: .4rem .75rem; margin-top: .35rem; }

/* Texto muted pequeño (estados de carga/vacío en línea) */
.text-muted-sm { color: var(--muted); font-size: .9rem; }

/* ── Utilidades ─────────────────────────────────────────────────────────── */
.fuente-label-scraper { font-size: 11px; color: var(--gris); }
.fecha { font-size: 11px; color: #9ca3af; margin-left: auto; }
.razon { font-size: 13px; color: var(--gris); }
.titular { font-size: 16px; font-weight: 600; line-height: 1.4; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.lista { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
#editor { padding: 16px; display: flex; flex-direction: column; gap: 20px; }

/* Header legacy (páginas sin sidebar) */
.header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--azul); color: white; position: sticky; top: 0; z-index: 10; }
.logo { font-weight: 700; font-size: 18px; }
.back { color: white; text-decoration: none; font-size: 15px; }
.btn-salir { background: transparent; border: 1px solid rgba(255,255,255,0.35); color: white; font-size: 13px; padding: 4px 10px; border-radius: var(--radio-pill); cursor: pointer; }
.scraper-toggle { background: rgba(255,255,255,0.15); border: none; color: white; font-size: 18px; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.scraper-toggle.scraper-pausado { background: rgba(255,80,80,0.4); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Back link (nav retorno en page-header) ─────────────────────────────── */
.back-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.back-link:hover { color: var(--texto); }

/* ── page-body variantes de ancho ───────────────────────────────────────── */
/* 720px — nuevo short / nuevo evergreen */
.page-body-narrow { max-width: calc(720px + 48px); }
/* 480px — perfil */
.page-body-sm     { max-width: calc(480px + 48px); }
/* 680px — equipo */
.page-body-md     { max-width: calc(680px + 48px); }

/* ── Nuevo tipo (short / evergreen) intro card ──────────────────────────── */
.nuevo-tipo-intro { display: flex; flex-direction: column; gap: 12px; }
.nuevo-tipo-row   { display: flex; gap: 12px; }
.nuevo-tipo-row input { flex: 1; }

/* ── Alerta card body ───────────────────────────────────────────────────── */
.alerta-card-topic      { font-size: .95rem; display: block; margin-bottom: .35rem; }
.alerta-card-status-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }

/* ── Toast global (feedback de acciones JS) ─────────────────────────────── */
.toast-global {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--azul);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radio-pill);
  font-size: .9rem;
  z-index: 9999;
  pointer-events: none;
}

/* ── Perfil ─────────────────────────────────────────────────────────────── */
.perfil-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}
.perfil-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--azul);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 600;
  flex-shrink: 0;
}
.perfil-avatar-img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
}
.perfil-info { display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.perfil-nombre { font-size: 1.4rem; font-weight: 600; }
.perfil-email  { color: var(--muted); font-size: .9rem; }
.btn-full { width: 100%; }
.perfil-guardar-row { align-items: center; margin-top: .25rem; }

/* ── Equipo ─────────────────────────────────────────────────────────────── */
.modal-form-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.modal-campo-top  { margin-top: 16px; }

.editor-avatar-inactivo { background: #cbd5e1; }
.editor-nombre-inactivo { color: var(--muted); }
.editor-self-tag   { color: var(--muted); font-weight: 400; font-size: .75rem; }
.editor-inactivo-badge { font-size: .7rem; color: #94a3b8; font-weight: 500; }
.editor-ctx-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1.1rem;
  flex-shrink: 0;
}
.editor-ctx-btn:hover { background: var(--fondo); }

/* Badge variante CTO */
.badge-rol-cto { border-color: #92400e; color: #92400e; background: #fef3c7; }

/* Menú contextual (equipo) */
.ctx-menu {
  position: fixed;
  background: white;
  border: 1px solid var(--borde);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  z-index: 1000;
  min-width: 160px;
  padding: 4px 0;
}
.ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  font-size: .85rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--texto);
  transition: background .1s;
}
.ctx-item:hover { background: #f8fafc; }
.ctx-item.danger { color: var(--rojo); }
.ctx-divider { height: 1px; background: var(--borde); margin: 4px 0; }

/* Audit log */
.audit-lista { display: flex; flex-direction: column; }
.audit-fila  { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--borde); font-size: .83rem; }
.audit-fila:last-child { border-bottom: none; }
.audit-quien  { font-weight: 600; min-width: 110px; flex-shrink: 0; color: var(--texto); }
.audit-accion { color: var(--muted); flex: 1; }
.audit-fecha  { color: var(--muted); font-size: .75rem; flex-shrink: 0; }

/* ── Breaking News ──────────────────────────────────────────────────────── */
.bn-lista { display: flex; flex-direction: column; gap: 8px; }
.bn-card {
  background: white;
  border: 1px solid var(--borde);
  border-radius: var(--radio-card);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.bn-card.en_vivo    { border-left: 3px solid var(--verde); }
.bn-card.programada { border-left: 3px solid #2563eb; }
.bn-card.expirada   { opacity: .5; }
.bn-card.desactivada{ opacity: .5; }
.bn-info { flex: 1; min-width: 0; }
.bn-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.bn-body-text { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.bn-meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.bn-status { font-weight: 700; }
.bn-status.en_vivo    { color: var(--verde); }
.bn-status.programada { color: #2563eb; }
.bn-status.expirada   { color: var(--muted); }
.bn-status.desactivada{ color: var(--muted); }
.bn-acciones { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.bn-fechas-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bn-checkbox-row { display: flex; align-items: center; gap: 8px; }
.bn-checkbox-row input[type=checkbox] { width: auto; }
.bn-checkbox-label { font-size: 14px; color: var(--texto); font-weight: 500; }
.label-required { color: var(--rojo); }

/* ── Vista previa ───────────────────────────────────────────────────────── */
.page-header-compact { padding-bottom: 12px; }

.preview-main {
  padding: 0 24px 60px;
  max-width: 760px;
  margin: 0 auto;
}

.preview-draft-bar {
  background: var(--amber);
  color: white;
  font-size: .82rem;
  font-weight: 600;
  text-align: center;
  padding: 6px;
  letter-spacing: .04em;
}

/* ── Editor principal (articulo/timeline) ───────────────────────────────── */
.editor-main {
  padding: 0 24px 40px;
  max-width: calc(var(--max-content) + 48px);
  display: flex;
  flex-direction: column;
  gap: var(--gap-card);
}

/* Subtítulo de campo de sección dentro del form */
.campo-section-title {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: .75rem;
  color: var(--texto);
}

/* Estado de correcciones (editor de alertas V2) */
.corr-estado { font-size: .82rem; color: var(--muted); margin-top: .5rem; min-height: 1.2rem; }

/* Tiptap toolbar */
.tiptap-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--borde);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: #f8f8f8;
}
/* Grupo de copiar (Texto / HTML) a la derecha del toolbar Tiptap, separado por un
   divisor sutil. Los botones son .tiptap-btn (misma familia que B/I/H2…). */
.tiptap-toolbar-copy { margin-left: auto; display: flex; align-items: center; gap: 4px; padding-left: 8px; border-left: 1px solid var(--borde); }
.tiptap-btn-icon { display: inline-flex; align-items: center; justify-content: center; color: var(--gris); }
.tiptap-btn {
  padding: 3px 8px;
  border: 1px solid var(--borde);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: .82rem;
}
.tiptap-btn:hover { background: var(--fondo); }
.tiptap-bold   { font-weight: 700; }
.tiptap-italic { font-style: italic; }

/* Tiptap editor area */
/*
 * Estilos del editor Tiptap — sincronizados con ArticleBody.astro (bodyClass)
 * en apps/web. Si cambia el diseño del artículo publicado, actualizar aquí también.
 * Fuente Lora cargada en EditorLayout.astro vía Google Fonts.
 */
.tiptap-editor {
  min-height: 220px;
  border: 1px solid var(--borde);
  border-radius: 0 0 6px 6px;
  padding: 12px 14px;
  outline: none;
  background: var(--superficie);
  /* --- tipografía igual al web publicado --- */
  font-family: 'Lora', Georgia, serif;
  font-size: 1rem;
  line-height: 1.75;
}
/* p: my-4 (web móvil) — igual que [&_p]:my-4 en ArticleBody */
.tiptap-editor p { margin: 1rem 0; }
.tiptap-editor p:last-child { margin-bottom: 0; }
/* h2: mt-8 mb-4 — igual que [&_h2]:mt-8 [&_h2]:mb-4 en ArticleBody */
.tiptap-editor h2 { margin: 2rem 0 1rem; font-size: 1.25rem; font-weight: 700; font-family: inherit; }
/* listas: my-4 — igual que [&_ul]:my-4 [&_ol]:my-4 en ArticleBody */
.tiptap-editor ul,
.tiptap-editor ol { margin: 1rem 0; padding-left: 1.5rem; }
.tiptap-editor ul li,
.tiptap-editor ol li { margin-top: 0.75rem; }
/* blockquote: pl-8 border-l italic — igual que [&_blockquote]:pl-8 en ArticleBody */
.tiptap-editor blockquote {
  margin: 1.5rem 0;
  padding-left: 2rem;
  border-left: 2px solid #bfdbfe;
  font-style: italic;
}
.tiptap-editor strong { font-weight: 700; }

/* Imagen destacada */
.img-zona {
  border: 1px solid var(--borde);
  border-radius: 8px;
  overflow: hidden;
}
.img-preview {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  display: block;
  background: #000;
}
.img-sin-imagen {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 8px;
  padding: 2.5rem 1rem;
  text-align: center;
  gap: 1rem;
}
.img-acciones { display: flex; gap: .5rem; margin-top: .5rem; }
.img-estado { font-size: .82rem; color: var(--muted); margin-top: .25rem; min-height: 1rem; }

/* Loading inline */
.loading-inline { padding: 1rem 0; }

/* ── Timeline editor ────────────────────────────────────────────────────── */
.tl-meta-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}
.tl-meta-info  { flex: 1; min-width: 0; }
.tl-meta-title-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.tl-meta-titulo { font-size: 1.15rem; font-weight: 700; margin: 0; }
.tl-form-meta {
  border-top: 1px solid var(--borde);
  padding-top: 1rem;
  margin-top: .75rem;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.tl-campo-checkbox { flex-direction: row; align-items: center; }
.tl-checkbox-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .88rem;
  cursor: pointer;
}
.tl-checkbox { width: 16px; height: 16px; }

/* Timeline entry list */
.tl-lista { position: relative; padding-left: 24px; border-left: 2px solid var(--borde); margin-left: 8px; }
.tl-entry { position: relative; margin-bottom: 2rem; }
.tl-dot   { position: absolute; left: -33px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--azul); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--azul); }
.tl-content { padding-left: 8px; }
.tl-fecha   { font-size: .78rem; color: var(--muted); margin-bottom: .25rem; }
.tl-titular { font-size: 1rem; font-weight: 700; margin-bottom: .35rem; line-height: 1.3; }
.tl-desc    { font-size: .88rem; color: var(--texto); line-height: 1.5; margin-bottom: .4rem; }
.tl-url     { font-size: .82rem; color: var(--azul); text-decoration: none; display: inline-block; margin-bottom: .4rem; }
.tl-url:hover { text-decoration: underline; }
.tl-acciones { display: flex; gap: .4rem; margin-top: .5rem; }

/* ── Editorial page ─────────────────────────────────────────────────────── */
.editorial-cat-form {
  background: var(--fondo);
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.editorial-cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

/* ── Acciones del editor (short / evergreen / alerta) ───────────────────── */
.acciones-editor {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 1.5rem 0 .75rem;
}
.btn-grande { padding: 12px 22px; font-size: .95rem; }

/* Nota de tema sobre el form del editor */
.tema-nota { font-size: .85rem; color: var(--muted); margin-bottom: 1.5rem; }

/* Separador IA dentro de campo */
.campo-ia-sep { border-top: 1px solid var(--borde); padding-top: 1rem; margin-top: .5rem; }
.campo-ia-header { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: .75rem; display: block; }

/* Fila bajo img-zona */
.img-info-row { display: flex; justify-content: space-between; align-items: center; min-height: 1.6rem; }
/* Botones de acción de imagen (JS pone display:flex) */
.img-acciones { gap: .5rem; align-items: center; }

/* Links de imágenes generadas */
.gen-links-col { display: flex; flex-direction: column; gap: .4rem; margin-top: .75rem; }
.gen-info-row  { display: flex; align-items: center; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-bottom: .25rem; }
.gen-link-row  { display: flex; align-items: center; gap: .75rem; }
.gen-link      { font-size: .85rem; font-weight: 500; color: var(--muted); pointer-events: none; }
.gen-link.activo { color: var(--azul); pointer-events: auto; }

/* Aviso cambio de slug publicado */
.slug-aviso { display: none; margin-top: .4rem; padding: .5rem .75rem; background: #fffbeb; border: 1px solid #f59e0b; border-radius: 6px; font-size: .82rem; color: #92400e; }

/* ── Scraper page ───────────────────────────────────────────────────────── */
.sc-card { background: white; border: 1px solid var(--borde); border-radius: var(--radio); padding: 20px 24px; }
.sc-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 16px; }
.sc-toggle-row   { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sc-toggle-info  { flex: 1; }
.sc-toggle-label { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.sc-dot          { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.sc-dot-activo   { background: #22c55e; box-shadow: 0 0 0 3px #bbf7d0; }
.sc-dot-pausado  { background: #94a3b8; }
.sc-toggle-sub   { font-size: 13px; color: var(--muted); }
.sc-btn-toggle   { padding: 10px 24px; border-radius: var(--radio-pill); border: none; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; flex-shrink: 0; }
.sc-btn-pausar   { background: #fee2e2; color: #dc2626; }
.sc-btn-pausar:hover  { background: #fecaca; }
.sc-btn-reanudar { background: #dcfce7; color: #16a34a; }
.sc-btn-reanudar:hover { background: #bbf7d0; }
.sc-metricas-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.sc-metrica       { display: flex; flex-direction: column; align-items: center; padding: 14px 8px; background: #f8fafc; border-radius: 8px; }
.sc-metrica-num   { font-size: 28px; font-weight: 800; line-height: 1; margin-bottom: 4px; color: var(--texto); }
.sc-metrica-label { font-size: 11px; color: var(--muted); font-weight: 500; }
.sc-verde    { color: #16a34a; }
.sc-rojo     { color: #dc2626; }
.sc-amarillo { color: #d97706; }
.sc-fuente-fila { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--borde); }
.sc-fuente-fila:last-child { border-bottom: none; }
.sc-fuente-fila.inactiva .sc-fuente-nombre { opacity: .45; }
.sc-fuente-info   { flex: 1; min-width: 0; }
.sc-fuente-nombre { font-size: 14px; font-weight: 500; }
.sc-fuente-url    { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-fuente-tipo   { font-size: 11px; color: var(--muted); background: #f1f5f9; padding: 2px 8px; border-radius: 20px; flex-shrink: 0; }
.sc-fuente-acciones { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.sc-fuente-toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.sc-fuente-toggle input { opacity: 0; width: 0; height: 0; }
.sc-slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 22px; cursor: pointer; transition: background .2s; }
.sc-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: transform .2s; }
.sc-fuente-toggle input:checked + .sc-slider { background: var(--azul); }
.sc-fuente-toggle input:checked + .sc-slider::before { transform: translateX(18px); }
.kw-lista { display: flex; flex-wrap: wrap; gap: 6px; min-height: 32px; }
.kw-chip  { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radio-pill); font-size: 13px; font-weight: 500; line-height: 1; }
.kw-chip-negativa { background: #fee2e2; color: #b91c1c; }
.kw-chip button { background: none; border: none; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; opacity: .6; color: inherit; }
.kw-chip button:hover { opacity: 1; }
.kw-col-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }
.kw-add-row { display: flex; gap: 8px; margin-top: 10px; }
.sc-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sc-card-header .sc-section-title { margin: 0; }
.prompt-textarea-ro { width: 100%; font-size: 13px; font-family: monospace; line-height: 1.5; resize: vertical; padding: 12px; border: 1px solid var(--borde); border-radius: 6px; box-sizing: border-box; background: #f8fafc; color: var(--muted); cursor: default; }
.prompt-textarea-ro.editable { background: var(--superficie); color: var(--texto); cursor: text; }

/* ── Alerta — layouts ───────────────────────────────────────────────────── */
.paso-main { padding: 0 24px 40px; }
.stepper-wrapper { padding: 0 24px 24px; }
.spinner-inline { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--borde); border-top-color: var(--azul); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; margin-right: 6px; }
.spinner-lg { display: block; width: 36px; height: 36px; border: 3px solid var(--borde); border-top-color: var(--azul); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 1rem; }
.paso-acciones { border-top: 1px solid var(--borde); padding-top: 1.25rem; display: flex; gap: .75rem; flex-wrap: wrap; }
.borrador-acciones { display: flex; gap: .75rem; margin-top: .75rem; align-items: center; flex-wrap: wrap; }

.btn-link {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
  font-size: .82rem;
  color: var(--azul);
  text-decoration: underline;
  text-underline-offset: 2px;
  display: inline-block;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.kw-text-input {
  width: 100%;
  border: 1px solid var(--borde);
  border-radius: 6px;
  padding: .45rem .7rem;
  font-family: inherit;
  font-size: 16px;
  color: var(--texto);
  background: #fff;
  line-height: 1.5;
  word-break: break-word;
  cursor: text;
  outline: none;
  transition: border-color .15s, color .15s, background .15s;
}
.kw-text-input.kw-dim {
  color: var(--gris);
  background: var(--fondo-alt, #f9f9f9);
}
.kw-text-input:focus {
  border-color: var(--azul);
}

input.p2-tag-input {
  border: 1px solid var(--borde);
  border-radius: 20px;
  padding: .3rem .75rem;
  font-size: .82rem;
  font-family: inherit;
  color: var(--texto);
  background: #fff;
  min-width: 80px;
  max-width: 200px;
  width: auto;
}
.paso-mensaje { padding: .6rem 1rem; border-radius: 6px; font-size: .85rem; margin-bottom: 1rem; }
.paso-mensaje.exito { background: #f0fdf4; color: var(--verde); }
.paso-mensaje.error { background: #fef2f2; color: var(--rojo); }
.fuente-extra-row { display: flex; gap: .5rem; }
.p3-section-label { font-size: .875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--texto); margin-bottom: .75rem; }

.texto-completo-section {
  margin-bottom: 1.5rem;
}
.texto-completo-wrap {
  position: relative;
  max-height: 7rem;
  overflow: hidden;
}
.texto-completo-wrap.expanded {
  max-height: none;
}
.texto-completo-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3.5rem;
  background: linear-gradient(to bottom, transparent, var(--fondo));
  pointer-events: none;
}
.texto-completo-wrap.expanded .texto-completo-fade {
  display: none;
}
.texto-completo-body {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--muted);
}
.texto-completo-body p { margin-bottom: .75rem; }
.texto-completo-body p:last-child { margin-bottom: 0; }
.texto-completo-ver-mas {
  background: none;
  border: none;
  padding: .25rem 0;
  margin-top: .25rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--azul);
  cursor: pointer;
  font-family: inherit;
}
.texto-completo-ver-mas:hover { opacity: .7; }
.btn-gen-alt { margin-bottom: 1rem; padding: .4rem .9rem; font-size: .8rem; border: 1px solid var(--borde); border-radius: var(--radio-pill); background: var(--superficie); cursor: pointer; }
.btn-gen-alt:hover { background: var(--fondo); }

/* Vista previa — Timeline */
.preview-tl-header { margin-bottom: 2rem; }
.preview-tl-titulo { font-size: 1.6rem; font-weight: 800; line-height: 1.25; margin-bottom: .5rem; color: var(--texto); }
.preview-tl-descripcion { font-size: 1rem; color: #4b5563; line-height: 1.6; }
.preview-tl-count  { font-size: .8rem; color: var(--muted); margin-top: .5rem; }
.preview-tl-lista  { position: relative; padding-left: 28px; border-left: 2px solid var(--borde); margin-left: 6px; }
.preview-tl-entry  { position: relative; margin-bottom: 2.5rem; }
.preview-tl-dot {
  position: absolute;
  left: -37px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1d4ed8;
  border: 2px solid white;
  box-shadow: 0 0 0 2px #1d4ed8;
}
.preview-tl-fecha   { font-size: .75rem; color: var(--muted); margin-bottom: .3rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.preview-tl-titular { font-size: 1.05rem; font-weight: 700; line-height: 1.3; margin-bottom: .4rem; color: var(--texto); }
.preview-tl-desc    { font-size: .92rem; color: #374151; line-height: 1.6; }
.preview-tl-link    { display: inline-block; margin-top: .4rem; font-size: .82rem; color: #1d4ed8; text-decoration: none; font-weight: 500; }
.preview-tl-link:hover { text-decoration: underline; }

/* ── Scraper — clases adicionales ───────────────────────────────────────── */
.campo-inline { flex-direction: row; align-items: center; gap: 10px; }
.campo-inline label { margin: 0; }
.campo-inline input[type="checkbox"] { width: auto; flex-shrink: 0; }
.modal-error { color: var(--rojo); font-size: 13px; margin-top: 8px; min-height: 1rem; }
.kw-col-label-negative { color: var(--rojo); }
.input-flex { flex: 1; }
.feedback-msg { margin-top: 8px; min-height: 18px; }
.text-sm-mb { font-size: 12px; margin-bottom: 8px; }
.input-number-lg { width: 80px; font-size: 18px; font-weight: 700; text-align: center; }
.dominios-lista { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.dominio-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; background: var(--fondo); border: 1px solid var(--borde); border-radius: 6px; font-size: 13px; }
.btn-eliminar-icon { background: none; border: none; cursor: pointer; color: var(--gris); font-size: 16px; line-height: 1; padding: 0 2px; }
.btn-eliminar-icon:hover { color: var(--rojo); }
.select-sm { padding: 4px 10px; border: 1px solid var(--borde); border-radius: 6px; font-size: .82rem; background: var(--fondo); color: var(--texto); cursor: pointer; width: auto; }
.kw-chip-sufijo { background: #f1f5f9; color: #334155; }
.text-empty-italic { font-size: 13px; color: var(--muted); font-style: italic; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.prompt-header-actions { display: flex; gap: 8px; align-items: center; }
.opacity-half { opacity: .5; }



/* ── Contador de caracteres ─────────────────────────────────────────────── */
.contador-num { font-size: 11px; color: var(--muted); text-align: right; display: block; margin-top: 3px; }
.contador-num.warn { color: var(--amber); }
.contador-num.over { color: var(--rojo); font-weight: 600; }

/* ── Hamburger + mobile sidebar ─────────────────────────────────────────── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 30;
  width: 44px;
  height: 44px;
  background: var(--azul);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 19;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

#modal-style-guide {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
}
#modal-style-guide > div {
  width: 100%;
}

@media (max-width: 768px) {
  .sidebar-toggle {
    display: flex;
  }

  .sidebar {
    transform: translateX(-220px);
    transition: transform 0.25s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    padding-top: 60px;
  }

  body.menu-open {
    overflow: hidden;
  }

  /* Patrón 1 — Tabs scrollables (Cola de revisión) */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 12px 10px;
    font-size: 13px;
  }

  /* Patrón 1b — Stepper con etiquetas abreviadas en móvil */
  .step-label { font-size: 0; }
  .step-label::after { content: attr(data-short); font-size: .7rem; }

  /* Patrón 1c — Slug apilado verticalmente (articulo/[id]) */
  .slug-preview { flex-direction: column; }
  .slug-base {
    border-right: 1px solid var(--borde);
    border-bottom: none;
    border-radius: var(--radio) var(--radio) 0 0;
    white-space: normal;
  }
  .slug-preview input { border-radius: 0 0 var(--radio) var(--radio); }

  /* Patrón 2 — Botones de acción apilados */
  .paso-acciones { flex-direction: column; }
  .paso-acciones .btn-grande { width: 100%; }

  .editor-main .acciones,
  .alerta-card .acciones { flex-direction: column; }
  .editor-main .acciones .btn,
  .editor-main .acciones a.btn,
  .alerta-card .acciones .btn,
  .alerta-card .acciones a.btn { width: 100%; }

  /* Patrón 3 — Padding reducido */
  .page-body { padding: 12px 16px; }
  .page-header { padding: 12px 16px 0; flex-wrap: wrap; }
  .page-header,
  .page-header-compact { padding-right: 56px; }
  .tabs { padding-right: 56px; }
  .editor-main { padding: 0 16px 32px; }
  .paso-main { padding: 0 16px 32px; }
  .stepper-wrapper { padding: 0 16px 20px; }

  /* Patrón 4 — Filter divider irrelevante en flex-wrap */
  .filter-divider { display: none; }

  /* Patrón 5 — Botones del header: alcanzar mínimo táctil de 44px */
  .page-header .btn-sm { padding: 12px 16px; }

  /* Alerta meta — fuente + chip + fecha sin apretarse */
  .alerta-meta { flex-wrap: wrap; gap: 4px; }
  .alerta-meta .fecha { margin-left: auto; }

  /* Tags editables más fáciles de tocar */
  input.p2-tag-input { min-width: 100px; max-width: 100%; padding: .5rem .9rem; font-size: 16px; width: auto; }

  /* Toast por debajo del hamburger en móvil */
  .toast-global, .mensaje { top: 64px; }

  /* Botones del borrador apilados en móvil */
  .borrador-acciones { flex-direction: column; align-items: stretch; }
  .borrador-acciones .btn { width: 100%; }

  /* Tiptap toolbar — sticky bajo el hamburger, visible cuando sube el teclado virtual */
  .tiptap-toolbar { position: sticky; top: 60px; z-index: 10; border-bottom: 1px solid var(--borde); }
  /* Tiptap toolbar — touch targets */
  .tiptap-btn { min-height: 36px; padding: 6px 10px; }

  /* Tiptap editor — reducir altura en portrait */
  .tiptap-editor { min-height: 160px; }

  /* Scraper: métricas — 2 columnas en mobile */
  .sc-metricas-grid { grid-template-columns: repeat(2, 1fr); }

  /* Inteligencia: categorías — columna única en mobile */
  .editorial-cat-grid { grid-template-columns: 1fr; }

  /* Touch targets — mínimo 44px */
  .btn { min-height: 44px; }
  .texto-completo-ver-mas { min-height: 44px; display: flex; align-items: center; }
  .tiptap-btn { min-height: 44px; padding: 8px 12px; }
  #btn-close-style-guide { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }

  /* Prevenir zoom iOS — 16px mínimo en todos los campos */
  .paso-main input,
  .paso-main textarea,
  .paso-main select { font-size: 1rem; }

  /* Links externos/internos — touch target mínimo en las labels */
  #p2-links-externos label,
  #p2-links-internos label { min-height: 44px; }

  /* Style guide modal — bottom sheet */
  #modal-style-guide { align-items: flex-end; overflow-y: hidden; }
  #modal-style-guide > div { margin: 0; border-radius: 12px 12px 0 0; max-height: 85vh; overflow-y: auto; width: 100%; max-width: none; padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px)); }

  /* Safe area — home indicator iPhone */
  .paso-main { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }

  /* Botones pequeños — touch target mínimo */
  .btn-sm { min-height: 44px; }
  .btn-lg { min-height: 44px; }

  /* Filter tabs — /articulos */
  .filter-tab { min-height: 44px; padding: 10px 14px; }

  /* Context menu — /equipo */
  .editor-ctx-btn { width: 44px; height: 44px; }

  /* Keyword chip remove — /scraper */
  .kw-chip button { min-width: 28px; min-height: 28px; padding: 0 4px; }

  /* IA select — /inteligencia */
  .ia-select { font-size: 1rem; min-height: 44px; }

  /* Prompt header — label + acciones en dos líneas */
  .ia-prompt-header { flex-wrap: wrap; }
  .ia-prompt-header-actions { flex-wrap: wrap; }

  /* Paginación — apila en columna en pantallas estrechas */
  .paginacion { flex-wrap: wrap; }

  /* Lista de artículos — fecha flexible */
  .art-fecha { min-width: 0; font-size: 11px; }

  /* Scraper — toggle button y fila de fuentes */
  .sc-btn-toggle { min-height: 44px; }
  .sc-fuente-fila { flex-wrap: wrap; row-gap: 8px; }
  .sc-fuente-info { width: 100%; }
  .sc-fuente-url { white-space: normal; }
}

/* Patrón 5 — Tiptap no consume toda la pantalla en landscape */
@media (max-height: 500px) {
  .tiptap-editor { min-height: 120px; }
  #p2-tiptap-editor { min-height: 120px !important; }
}

/* Paso 3 — Acordeón */
.p3-acord-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.25rem;
  background: var(--fondo-alt, #f9f9f9);
  border: none;
  border-bottom: 1px solid var(--borde);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  color: var(--texto);
  cursor: pointer;
  text-align: left;
}
.p3-acord-header--open { background: #fff; }
.p3-acord-chevron { font-size: .75rem; color: var(--gris); }
.p3-acord-item:last-child .p3-acord-header { border-bottom: none; }
.p3-acord-item:last-child .p3-acord-body { border-bottom: none; }

/* #53 — chips de categorías y topics en el Paso 2 (selección por toggle).
   Estado por color, no por posición: blanco = fuera, azul claro = dentro,
   azul sólido + ★ = categoría principal. Táctiles (min-height 40px). */
.p2-chip-zona { display: flex; flex-wrap: wrap; gap: .5rem; }
.p2-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  border: 1px solid var(--borde); background: #fff; color: var(--texto);
  border-radius: 999px; padding: .5rem .9rem; min-height: 40px;
  font-family: inherit; font-size: .9rem; font-weight: 500; cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.p2-chip:hover { border-color: #93c5fd; }
.p2-chip--on { background: #dbeafe; border-color: #bfdbfe; color: #1e40af; }
.p2-chip--principal { background: #1e40af; border-color: #1e40af; color: #fff; }

/* ═══════════════════════════════════════════════════════════════════════
   Portada — hero curado (issue #48). Global (no scoped): las tarjetas se
   inyectan por innerHTML, así que el estilo DEBE vivir aquí, no en <style>.
   ═══════════════════════════════════════════════════════════════════════ */
.portada-hint {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 18px;
}
.slots { display: flex; flex-direction: column; gap: 10px; }

.slot-card {
  display: flex;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--borde);
  border-radius: var(--radio-card);
  padding: 12px;
  background: var(--superficie);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.slot-card:hover { border-color: #d1d5db; }

/* #1 — destacado grande (el lede de la home) */
.slot-card.is-lede {
  align-items: flex-start;
  padding: 16px;
  border-color: var(--azul);
  box-shadow: inset 3px 0 0 0 var(--azul);
}
.slot-eyebrow {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--azul);
  margin-bottom: 6px;
}

.slot-thumb-wrap { position: relative; flex-shrink: 0; }
.slot-thumb,
.slot-thumb-vacio {
  width: 76px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--fondo);
  display: block;
}
.slot-thumb-vacio {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  font-size: 20px;
}
.is-lede .slot-thumb,
.is-lede .slot-thumb-vacio { width: 132px; height: 84px; }
.slot-pos-badge {
  position: absolute;
  top: -7px;
  left: -7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--azul);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

.slot-main { flex: 1; min-width: 0; }
.slot-titulo {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.35;
  color: var(--texto);
}
.is-lede .slot-titulo { font-size: 17px; line-height: 1.3; }
.slot-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
}
.slot-warn {
  font-size: 11px;
  font-weight: 600;
  color: var(--rojo);
  background: #fef2f2;
  padding: 2px 8px;
  border-radius: 999px;
}

.slot-acciones {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.slot-acciones button {
  width: 44px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--borde);
  border-radius: 8px;
  background: var(--superficie);
  color: var(--gris);
  font-size: 15px;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.slot-acciones button:hover:not(:disabled) { background: var(--fondo); border-color: #d1d5db; }
.slot-acciones button:disabled { opacity: .3; cursor: default; }
.slot-quitar:hover:not(:disabled) { color: var(--rojo); border-color: #fca5a5; background: #fef2f2; }

/* Estado "sin guardar" en el botón Guardar */
.js-guardar .save-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0;
}
.js-guardar.sucio .save-dot { opacity: 1; }

/* "+ Agregar" deshabilitado al llegar al máximo */
.btn-agregar-slot { margin-top: 12px; }
.btn-agregar-slot:disabled { opacity: .5; cursor: default; }

/* Barra de guardar fija — solo móvil */
.portada-savebar { display: none; }

/* Picker — items con miniatura + meta */
.picker-lista {
  max-height: 55vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}
.picker-item {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: var(--superficie);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.picker-item:hover:not(:disabled) { background: var(--fondo); border-color: #d1d5db; }
.picker-item:disabled { opacity: .45; cursor: default; }
.picker-thumb {
  width: 48px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 6px;
  background: var(--fondo);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  font-size: 16px;
}
.picker-item-body { flex: 1; min-width: 0; }
.picker-item-title { font-size: 14px; font-weight: 500; color: var(--texto); line-height: 1.3; }
.picker-item-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Portada — móvil ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* #1 destacado: imagen full-width arriba, acciones en fila */
  .slot-card.is-lede { flex-direction: column; align-items: stretch; }
  .is-lede .slot-thumb-wrap { width: 100%; }
  .is-lede .slot-thumb,
  .is-lede .slot-thumb-vacio { width: 100%; height: 170px; }
  .is-lede .slot-acciones { flex-direction: row; }
  .is-lede .slot-acciones button { flex: 1; }

  /* Touch targets */
  .slot-acciones button { height: 44px; }

  /* Guardar: ocultar el del header, mostrar barra fija abajo */
  #btn-guardar { display: none; }
  .portada-savebar {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--superficie);
    border-top: 1px solid var(--borde);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -2px 10px rgba(0,0,0,.06);
  }
  .portada-savebar .btn { width: 100%; }
  /* Espacio para que la barra fija no tape el último contenido */
  .page-body { padding-bottom: 84px; }

  /* Picker — bottom sheet */
  #modal-picker { align-items: flex-end; padding: 0; }
  #modal-picker .modal-box {
    max-width: none;
    width: 100%;
    border-radius: 14px 14px 0 0;
    max-height: 88vh;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
  #modal-picker .picker-lista { max-height: 60vh; }
}

/* ════════════════════════════════════════════════════════════════════════════
   /taxonomia — acordeón categoría→topics con edición inline (issue #61)
   Todo global: las filas se inyectan por innerHTML y Astro no aplica <style>
   scoped a contenido inyectado.
   ════════════════════════════════════════════════════════════════════════════ */

.tx-toolbar { margin-bottom: 12px; }
.tx-search { width: 100%; font-size: 16px; }

/* Fila de crear sección (estática, arriba) */
.tx-newcat {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio-card);
  padding: 16px;
  margin-bottom: 16px;
}
.tx-field--order { max-width: 140px; }

/* Sección (categoría) */
.tx-section {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio-card);
  margin-bottom: 10px;
  overflow: hidden;
}
.tx-section--transversal { border-style: dashed; }

.tx-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  min-height: 56px;
}
.tx-head:hover { background: #f8fafc; }
.tx-chevron {
  color: var(--muted);
  font-size: 13px;
  transition: transform .15s;
  flex-shrink: 0;
}
.tx-chevron--open { transform: rotate(90deg); }
.tx-head-name { font-weight: 600; font-size: 15px; color: var(--texto); }
.tx-head-slug { font-size: 12px; color: var(--gris); }
.tx-head-count { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }

.tx-topics { border-top: 1px solid var(--borde); }

/* Fila de topic */
.tx-topic {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--borde);
}
.tx-topic:last-child { border-bottom: none; }
.tx-topic-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tx-topic-name { font-size: 14px; color: var(--texto); font-weight: 500; }
.tx-topic-url {
  font-size: 12px;
  color: var(--gris);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tx-topic-url--none { font-style: italic; font-family: inherit; }
.tx-topic-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--texto);
  min-width: 28px;
  text-align: right;
}
.tx-topic-count--zero { color: var(--muted); font-weight: 400; }
.tx-topic-actions { display: flex; gap: 4px; flex-shrink: 0; }

.tx-iconbtn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radio);
  cursor: pointer;
  font-size: 15px;
  transition: background .12s, border-color .12s;
}
.tx-iconbtn:hover { background: #f1f5f9; border-color: var(--borde); }

.tx-flash { animation: tx-flash-anim 1.2s ease-out; }
@keyframes tx-flash-anim {
  0% { background: #fef9c3; }
  100% { background: transparent; }
}

/* Botón "+ Nuevo topic en X" */
.tx-addtopic {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  border-top: 1px dashed var(--borde);
  color: var(--azul);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  min-height: 44px;
}
.tx-addtopic:hover { background: #f8fafc; }

/* Fila de edición / creación inline */
.tx-editrow {
  padding: 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--borde);
}
.tx-editrow:last-child { border-bottom: none; }
.tx-editrow--create { border-top: 1px dashed var(--borde); }
.tx-field { margin-bottom: 12px; }
.tx-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 4px;
}
.tx-url-preview {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--gris);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tx-rowactions { display: flex; gap: 8px; }
.tx-rowactions .btn { min-height: 44px; }

.tx-mark { background: #fde68a; color: inherit; border-radius: 2px; padding: 0 1px; }
.tx-empty { padding: 14px 16px; color: var(--muted); font-size: 13px; }

/* Móvil: el topic apila nombre / url / acciones */
@media (max-width: 600px) {
  .tx-topic { flex-wrap: wrap; }
  .tx-topic-main { flex-basis: 100%; }
  .tx-topic-count { margin-left: 0; }
  .tx-topic-actions { margin-left: auto; }
  .tx-rowactions { flex-direction: column; }
  .tx-rowactions .btn { width: 100%; }
  .tx-field--order { max-width: none; }
}

/* ── Corrector ortográfico client-side (#308) ────────────────────────────────
   Subrayado rojo ondulado bajo palabras que el diccionario no reconoce.
   skip-ink:none mantiene la onda continua. El popup lo posiciona spellcheck-extension.ts. */
.tiptap-editor .sp-error {
  text-decoration: underline wavy #e11d48;
  text-decoration-skip-ink: none;
  text-underline-offset: 2px;
  cursor: pointer;
}

.sp-popup {
  position: fixed;
  z-index: 1000;
  max-width: 260px;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 10px;
}
.sp-popup-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-popup-chip {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--accent-blue, #2563eb);
  border-radius: 8px;
  background: var(--accent-blue, #2563eb);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.sp-popup-chip:hover { opacity: 0.9; }
.sp-popup-empty { margin: 0; font-size: 13px; color: var(--muted, #6b7280); }

@media (max-width: 600px) {
  .sp-popup-chip { min-height: 44px; } /* touch 44px (regla del editorial) */
  .sp-popup { max-width: calc(100vw - 24px); }
}

/* ── Publicidad (/publicidad) — anuncios del rail ─────────────────────────── */
.pub-intro { margin: 0 0 20px; font-size: 14px; line-height: 1.55; color: var(--muted); max-width: 64ch; }

.pub-slot { border: 1px solid var(--borde); border-radius: var(--radio-card); margin-bottom: 20px; overflow: hidden; background: var(--superficie); }
.pub-slot-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--borde); }
.pub-slot-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--texto); }
.pub-slot-key { font-size: 12px; color: var(--gris); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pub-slot-mode { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: 4px 10px; border-radius: var(--radio-pill); background: var(--fondo); border: 1px solid var(--borde); color: var(--muted); white-space: nowrap; }

.pub-creatives { padding: 4px 18px; }
.pub-empty { color: var(--muted); font-size: 14px; padding: 18px 0; text-align: center; }

.pub-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--borde); }
.pub-row:last-child { border-bottom: 0; }
.pub-thumb { width: 84px; height: 70px; object-fit: cover; border-radius: 8px; border: 1px solid var(--borde); background: var(--fondo); flex-shrink: 0; }
.pub-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pub-row-title { font-weight: 600; font-size: 14px; color: var(--texto); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pub-row-url { font-size: 12.5px; color: var(--gris); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pub-row-url:hover { color: var(--azul); text-decoration: underline; }
.pub-window { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.pub-row-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pub-state { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: 4px 10px; border-radius: var(--radio-pill); white-space: nowrap; }
.pub-state--live { background: color-mix(in srgb, var(--verde) 13%, transparent); color: var(--verde); }
.pub-state--pending { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }
.pub-state--off { background: var(--fondo); color: var(--muted); }

/* Toggle activo (reemplaza el checkbox crudo) */
.pub-switch { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; cursor: pointer; margin: 0; }
.pub-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.pub-switch-track { width: 38px; height: 22px; border-radius: 999px; background: var(--borde); transition: background .15s; flex-shrink: 0; }
.pub-switch-track::after { content: ''; display: block; width: 18px; height: 18px; margin: 2px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.pub-switch input:checked + .pub-switch-track { background: var(--verde); }
.pub-switch input:checked + .pub-switch-track::after { transform: translateX(16px); }
.pub-switch input:focus-visible + .pub-switch-track { outline: 2px solid var(--azul); outline-offset: 2px; }

.pub-editrow { padding: 16px 0; border-bottom: 1px solid var(--borde); display: flex; flex-direction: column; gap: 12px; }
.pub-editrow:last-child { border-bottom: 0; }
.pub-editrow-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pub-dates { display: flex; gap: 12px; flex-wrap: wrap; }
.pub-dates .tx-field { flex: 1; min-width: 170px; }
.pub-editrow input[type="datetime-local"] { width: 100%; padding: 10px 12px; border: 1px solid var(--borde); border-radius: var(--radio); font-size: 16px; font-family: inherit; background: var(--superficie); color: var(--texto); }

/* Zona de subida */
.pub-upload { padding: 16px 18px 18px; border-top: 1px dashed var(--borde); background: var(--fondo); }
.pub-upload-title { margin: 0 0 12px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pub-upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-bottom: 14px; }
.pub-field-full { grid-column: 1 / -1; }

/* Picker de imagen propio (input file nativo oculto → botón + nombre en español) */
.tx-field .pub-file { display: flex; align-items: center; gap: 12px; border: 1px dashed var(--borde); border-radius: var(--radio); padding: 8px 10px; background: var(--superficie); cursor: pointer; text-transform: none; letter-spacing: normal; font-weight: 400; margin: 0; }
.pub-file input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.pub-file-btn { padding: 7px 14px; border-radius: var(--radio-pill); border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); font-size: 13px; font-weight: 600; white-space: nowrap; flex-shrink: 0; transition: background .12s; }
.pub-file:hover .pub-file-btn { background: #e9eef5; }
.pub-file-name { font-size: 13px; color: var(--gris); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 640px) {
  .pub-upload-grid { grid-template-columns: 1fr; }
  .pub-row { flex-wrap: wrap; gap: 10px 12px; }
  .pub-thumb { width: 64px; height: 53px; }
  .pub-row-controls { width: 100%; justify-content: space-between; }
}
