@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap");

:root {
  /* —— Identidad ——————————————————————————————————————————————————————
     Era el aspecto de cualquier plantilla: blanco sobre gris, azul de
     LinkedIn, esquinas de 12px y sombras difusas. Esto es otra cosa: papel
     cálido, una barra de tinta que ancla la pantalla, verde pino como color
     de acción y bordes de un pelo en vez de sombras. Menos burbuja, más
     instrumento de trabajo. */

  /* Superficies: papel, no gris de interfaz. */
  --bg: #f8f6f1;
  --bg-subtle: #efece4;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --border: #e3ded2;
  --border-strong: #cbc4b4;

  /* Tinta con una pizca de verde, para que no compita con el acento. */
  --text: #161a19;
  --muted: #57605c;
  /* El más claro que llega a 4,5:1 sobre los tres fondos. */
  --muted-light: #6b736f;

  /* La barra superior: oscura. Es el cambio que más se nota y el que ordena
     la pantalla, porque separa el mando del contenido. */
  --nav-bg: #16201d;
  --nav-text: #eae7de;
  --nav-muted: #97a29d;
  --nav-border: #2b3733;
  --nav-activo: #23312d;

  /* Color de acción: verde pino profundo. Uno solo en toda la app.
     Deliberadamente no es el azul de LinkedIn: ese queda para el botón de
     conectar, que es donde la marca ajena tiene sentido. */
  --accent: #14564c;
  --accent-hover: #0d3c35;
  --accent-soft: #e3efeb;
  --accent-tint: #f2f7f5;
  --accent-border: #9dc2b8;
  --accent-ring: rgba(20, 86, 76, 0.16);

  /* La marca de LinkedIn, solo donde se habla de LinkedIn. */
  --linkedin: #0a66c2;
  --linkedin-hover: #004182;
  --linkedin-soft: #e8f4fc;

  /* Estado, no acción. */
  --ok: #2f6b3f;
  --ok-soft: #e6efe4;
  --ok-border: #a9c5a6;
  --ok-strong: #1d4429;
  --danger: #9c3626;
  --danger-soft: #f8e9e5;
  --danger-border: #ddb0a4;
  --danger-strong: #6b241a;
  --warn: #7a5214;
  --warn-soft: #f7efd9;
  --warn-border: #e0c894;

  /* Identidad de cada módulo, solo como sello. Bajadas al mismo registro
     apagado que el resto para que no griten sobre el papel. */
  --mod-radar: #a8265c;
  --mod-radar-soft: #f7e8ee;
  --mod-crm: #5b4396;
  --mod-crm-soft: #eeebf7;

  /* Escala tipográfica. */
  --fs-xs: 0.72rem;
  --fs-sm: 0.8rem;
  --fs-base: 0.9rem;
  --fs-md: 1rem;
  --fs-lg: 1.2rem;
  --fs-xl: 1.55rem;
  --lh-tight: 1.25;
  --lh-base: 1.5;

  /* Forma: radios chicos. Los de 12 y 16 redondeaban todo hasta volverlo
     blando; a 4 y 8 la pantalla se lee como una herramienta. */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;

  /* Casi sin sombra: la separación la da el borde de un pelo. Las sombras
     difusas de antes hacían flotar cada caja sin jerarquía ninguna. */
  --shadow-sm: 0 1px 0 rgba(22, 26, 25, 0.03);
  --shadow: 0 1px 2px rgba(22, 26, 25, 0.05);
  --shadow-lg: 0 8px 28px rgba(22, 26, 25, 0.12);

  --transition: 0.16s ease;

  /* Dos familias con trabajos distintos: Archivo tiene carácter y tracking
     cerrado para los títulos; DM Sans es neutra y se lee bien en párrafo. */
  --font: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-titulo: "Archivo", "DM Sans", "Segoe UI", system-ui, sans-serif;

  --topbar-h: 60px;
}

* {
  box-sizing: border-box;
}

/* El atributo hidden no alcanza por sí solo: cualquier `display` declarado en
   una hoja de la app le gana a la regla del navegador, porque la hoja del
   navegador tiene la prioridad más baja de todas. Así quedó visible el cajón
   de búsqueda del Radar -encima de los resultados- y así podían quedar la
   píldora de usuario y los pies de las listas, que también se ocultan con
   hidden y también declaran display. */
[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

button {
  appearance: none;
  -webkit-appearance: none;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* —— Topbar —— */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  /* min-height y no height: al envolverse en pantallas angostas la barra
     crecía por dentro de una caja fija de 64px y se salía por encima del
     contenido siguiente. */
  min-height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

/* Marca + módulos en el mismo bloque izquierdo */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
  padding-right: 1.25rem;
  border-right: 1px solid var(--border);
  margin-right: 0.75rem;
}

.brand h1 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-xs);
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--fs-md);
  box-shadow: 0 2px 8px rgba(10,102,194,0.3);
  flex-shrink: 0;
}

/* Navegación de módulos */
.module-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.module-nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--muted);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.module-nav-link:hover {
  background: var(--bg);
  color: var(--text);
}

.module-nav-link.is-active {
  background: var(--linkedin-soft);
  color: var(--linkedin);
}

.module-nav-link.radar-link.is-active {
  background: var(--mod-radar-soft);
  color: var(--mod-radar);
}

.module-icon {
  font-size: var(--fs-md);
  line-height: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
}

.topbar-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding-left: 0.5rem;
  margin-left: 0.15rem;
  border-left: 1px solid var(--border);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 32px;
  padding: 0 0.65rem 0 0.2rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  max-width: 160px;
}

.app-version {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  user-select: all;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--linkedin);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.user-label {
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-chips {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.35rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.status-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 28px;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 0 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}

.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-light);
  flex-shrink: 0;
}

.chip.ok {
  border-color: var(--ok-border);
  background: var(--ok-soft);
  color: var(--ok-strong);
}

.chip.ok::before {
  background: var(--ok);
}

.chip.warn {
  border-color: var(--warn-border);
  background: var(--warn-soft);
  color: var(--warn);
}

.chip.warn::before {
  background: var(--warn);
}

.chip.err {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger-strong);
}

.chip.err::before {
  background: var(--danger);
}

/* —— Layout —— */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 1.25rem;
  padding: 1.25rem 1.5rem 2.5rem;
  max-width: 1700px;
  margin: 0 auto;
  align-items: start;
}

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

  /* Ver el comentario de .prospects-layout: una columna 1fr no baja de su
     contenido mínimo, y el panel se sale de la pantalla. */
  .layout > * {
    min-width: 0;
  }

  .preview-panel {
    order: -1;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.35rem;
}

.panel.composer {
  padding: 0;
  overflow: hidden;
}

.composer > .autopilot-panel {
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.composer-manual {
  padding: 1.35rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel-head-sub {
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: 400;
  margin-top: 0.15rem;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.section-label-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--linkedin-soft);
  color: var(--linkedin);
  display: grid;
  place-items: center;
  font-size: var(--fs-base);
}

.composer-manual {
  margin-top: 0;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border);
}

.composer-manual .panel-head h2 {
  font-size: var(--fs-md);
  color: var(--text);
  font-weight: 700;
}

/* —— Dropzone —— */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--accent-tint) 0%, var(--accent-tint) 100%);
  margin-bottom: 1.1rem;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.dropzone:hover {
  border-color: var(--accent-border);
}

.dropzone.dragover {
  border-color: var(--linkedin);
  background: var(--linkedin-soft);
  transform: scale(1.005);
}

.dropzone-inner {
  padding: 1.1rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.drop-icon {
  width: 36px;
  height: 36px;
  margin: 0 0 0.15rem;
  border-radius: 10px;
  background: var(--linkedin-soft);
  color: var(--linkedin);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.drop-icon svg,
.dropzone svg {
  display: block;
  width: 20px !important;
  height: 20px !important;
  max-width: 20px;
  max-height: 20px;
  flex-shrink: 0;
}

.drop-title {
  margin: 0;
  font-weight: 600;
  font-size: var(--fs-base);
}

.drop-hint {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.dropzone-inner .btn {
  margin-top: 0.35rem;
}

.drop-preview {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.drop-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  box-shadow: var(--shadow-sm);
}

.hidden {
  display: none !important;
}

/* —— Forms —— */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}

.form-grid input,
.form-grid textarea,
.form-grid select {
  font: inherit;
  font-weight: 400;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-grid input::placeholder,
.form-grid textarea::placeholder {
  color: var(--muted-light);
}

.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus {
  outline: none;
  border-color: var(--linkedin);
  box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.15);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

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

.char-count {
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: 400;
  text-align: right;
}

.char-count.warn {
  color: var(--warn);
}

.char-count.over {
  color: var(--danger);
  font-weight: 600;
}

/* Pie de lista: recuento y botón para traer más. */
.paginador {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.9rem 0 0.2rem;
}

.paginador-info {
  font-size: var(--fs-sm);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Botones de página ─────────────────────────────────────────────────────
   Antes era un «Cargar más» que acumulaba: a los tres clics no se sabía
   dónde estaba uno ni cómo volver. */

.pag-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.pag-btn {
  min-width: 30px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  cursor: pointer;
}

.pag-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

/* La página actual se distingue por fondo y peso, no solo por estar
   deshabilitada: un botón gris se lee como «no se puede», no como «acá
   estás». */
.pag-btn.is-activa,
.pag-btn[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: default;
}

/* Las flechas en los extremos se apagan pero no desaparecen: si cambiaran
   de ancho, los números se moverían de lugar al cambiar de página. */
.pag-btn.is-off {
  opacity: 0.3;
  cursor: default;
}

.pag-btn:disabled:not(.is-activa):not(.is-off) { opacity: 0.5; cursor: default; }

.pag-puntos {
  padding: 0 2px;
  color: var(--muted);
  user-select: none;
}

@media (max-width: 640px) {
  .paginador { flex-wrap: wrap; gap: 0.4rem; }
  .pag-btn { min-width: 34px; height: 32px; }
}

/* Aviso de por qué no se puede publicar todavía: va justo encima de las
   acciones, no en la esquina opuesta de la pantalla. */
.publish-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.15rem 0 0;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.publish-hint-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--warn);
  color: var(--surface);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.link-inline {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.link-inline:hover { text-decoration: none; }

/* Los chips que llevan a un arreglo son enlaces o botones: deben verse
   pulsables sin romper la forma del chip. */
a.chip,
button.chip {
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}

a.chip:hover,
button.chip:hover {
  filter: brightness(0.96);
  text-decoration: underline;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.15rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
}

.actions .btn-primary {
  margin-left: auto;
}

@media (max-width: 520px) {
  .actions .btn-primary {
    margin-left: 0;
    width: 100%;
  }
}

/* —— Buttons —— */
.btn {
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.05rem;
  font: inherit;
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform 0.12s, box-shadow var(--transition), opacity var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--linkedin);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.btn:not(:disabled):active {
  transform: scale(0.98);
}

.btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--linkedin);
  color: #fff;
  box-shadow: 0 2px 8px rgba(10, 102, 194, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--linkedin-hover);
  box-shadow: 0 4px 12px rgba(10, 102, 194, 0.3);
}

.btn-secondary {
  background: var(--linkedin-soft);
  color: var(--linkedin-hover);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--accent-soft);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--linkedin);
  color: var(--linkedin);
}

.btn-outline:hover:not(:disabled) {
  background: var(--linkedin-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--linkedin);
  border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--border);
}

.btn-connect {
  background: #fff;
  border: 1.5px solid var(--linkedin);
  color: var(--linkedin);
}

.btn-connect.connected {
  background: var(--ok-soft);
  border-color: var(--ok-border);
  color: var(--ok);
  cursor: default;
}

.topbar .btn-sm {
  height: 32px;
  padding: 0 0.75rem;
  font-size: var(--fs-sm);
  line-height: 1;
  white-space: nowrap;
}

.topbar .btn-connect {
  font-weight: 600;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: var(--fs-sm);
}

.btn.is-loading {
  pointer-events: none;
  opacity: 0.75;
}

.btn.is-loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 0.25rem;
}

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

/* —— Toast (fixed) —— */
.toast-host {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  font-size: var(--fs-base);
  font-weight: 400;
  box-shadow: var(--shadow-lg);
  border: 1px solid transparent;
  animation: toast-in 0.3s ease;
  pointer-events: auto;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast.ok {
  background: var(--ok-soft);
  color: var(--ok-strong);
  border-color: var(--ok-border);
}

.toast.err {
  background: var(--danger-soft);
  color: var(--danger-strong);
  border-color: var(--danger-border);
}

/* —— Preview panel —— */
.preview-panel {
  position: sticky;
  top: calc(var(--topbar-h) + 1rem);
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.preview-panel > h2 {
  display: none;
}

.preview-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.preview-tab {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  border: none !important;
  outline: none;
  box-shadow: none;
  background: transparent;
  font-family: var(--font);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.2;
  color: var(--muted);
  padding: 0.5rem 0.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition), box-shadow var(--transition);
  text-align: center;
}

.preview-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
}

.preview-tab:focus-visible {
  outline: 2px solid var(--linkedin);
  outline-offset: 1px;
}

.preview-tab.is-active {
  color: var(--linkedin);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.preview-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.3rem;
  margin-left: 0.25rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  /* Sobre --border daba 4,34:1; sobre --bg-subtle, 5,31. */
  background: var(--bg-subtle);
  color: var(--muted);
  border-radius: 999px;
}

.preview-tab.is-active .preview-tab-badge {
  background: var(--linkedin-soft);
  color: var(--linkedin);
}

.preview-tab-panel {
  display: none;
  padding: 1.15rem;
  animation: fade-in 0.2s ease;
}

.preview-tab-panel.is-active {
  display: block;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.linkedin-card {
  border: 1px solid var(--bg-subtle);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
  font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.card-header {
  display: flex;
  gap: 0.65rem;
  padding: 0.85rem 1rem 0.5rem;
  align-items: flex-start;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--fs-lg);
  flex-shrink: 0;
}

.card-header-meta {
  flex: 1;
  min-width: 0;
}

.card-header strong {
  display: block;
  font-size: var(--fs-base);
  font-weight: 600;
  color: rgba(0,0,0,.9);
  line-height: 1.3;
}

.card-header .card-headline {
  display: block;
  font-size: var(--fs-sm);
  color: rgba(0,0,0,.6);
  line-height: 1.3;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-header .card-meta-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--fs-xs);
  color: rgba(0,0,0,.6);
  margin-top: 3px;
}

.card-globe-icon {
  opacity: .7;
}

.card-follow-btn {
  margin-left: auto;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: default;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
}

.card-text {
  padding: 0.3rem 1rem 0.75rem;
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: var(--fs-base);
  word-break: break-word;
  color: rgba(0,0,0,.9);
}

/* El marcador de posición de la vista previa quedaba en 2,85:1, el peor
   par de toda la aplicación. Es texto que se lee, no decoración. */
.card-text.is-empty {
  color: var(--muted);
  font-style: italic;
}

.card-image-wrap {
  background: var(--bg-subtle);
  border-top: 1px solid var(--bg-subtle);
}

.card-image-wrap img {
  width: 100%;
  display: block;
}

/* Barra de reacciones simulada */
.card-reactions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 1rem;
  border-top: 1px solid var(--bg-subtle);
  font-size: var(--fs-sm);
  color: rgba(0,0,0,.6);
}

.card-reaction-icons {
  display: flex;
  gap: 2px;
}

.card-actions {
  display: flex;
  border-top: 1px solid var(--bg-subtle);
}

.card-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.55rem 0.25rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: rgba(0,0,0,.6);
  background: none;
  border: none;
  cursor: default;
}

.card-action-btn:hover {
  background: rgba(0,0,0,.04);
  border-radius: 4px;
}

/* —— Queue —— */
.queue-section .panel-head {
  margin-bottom: 0.75rem;
}

.queue-section .panel-head h3 {
  font-size: var(--fs-md);
}

.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Los borradores tienen tarjetas más ricas — necesitan más espacio */
#panel-drafts .queue-list {
  max-height: none;
  overflow-y: visible;
  gap: 0.75rem;
}

.queue-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  font-size: var(--fs-sm);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.queue-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.queue-item-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.status-pill {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.status-pill.status-draft {
  background: var(--linkedin-soft);
  color: var(--linkedin);
}

.status-pill.status-pending {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-pill.status-published {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-pill.status-failed {
  background: var(--danger-soft);
  color: var(--danger);
}

.queue-item-type {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.queue-item .meta {
  color: var(--muted);
  margin-top: 0.3rem;
  font-size: var(--fs-sm);
}

.queue-item-body {
  line-height: 1.4;
  color: var(--text);
}

.empty-queue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: var(--fs-base);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  list-style: none;
}

.empty-queue-icon {
  font-size: var(--fs-xl);
  opacity: 0.5;
}

/* ── Panel expandible ───────────────────────────────────────────────── */

.preview-panel-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 0.3rem 0.5rem 0;
}

.btn-expand-panel {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-base);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  transition: background var(--transition), color var(--transition);
}

.btn-expand-panel:hover {
  background: var(--bg);
  color: var(--text);
}

/* Modo expandido: el panel ocupa toda la pantalla */
.preview-panel.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 200;
  border-radius: 0;
  overflow-y: auto;
  max-width: none;
  width: 100%;
  padding: 1.5rem clamp(1rem, 8vw, 6rem);
}

.preview-panel.is-expanded .linkedin-card {
  max-width: 680px;
  margin: 0 auto;
}

.preview-panel.is-expanded #panel-drafts .queue-list,
.preview-panel.is-expanded #panel-history .queue-list {
  max-height: none;
}

.preview-panel.is-expanded .btn-expand-panel {
  position: sticky;
  top: 0.5rem;
  float: right;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  z-index: 1;
}

/* ── Draft cards ────────────────────────────────────────────────────── */

.draft-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--linkedin);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.draft-card:hover {
  box-shadow: var(--shadow);
}

.draft-card.is-editing {
  border-left-color: var(--ok);
  box-shadow: 0 0 0 3px rgba(5,118,66,0.08);
}

.draft-card-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.draft-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.draft-topic-badge {
  font-size: var(--fs-sm);
  font-weight: 600;
  background: var(--linkedin-soft);
  color: var(--linkedin);
  border-radius: 20px;
  padding: 0.2rem 0.65rem;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-type-badge {
  font-size: var(--fs-xs);
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.15rem 0.55rem;
  white-space: nowrap;
}

.draft-date {
  font-size: var(--fs-xs);
  color: var(--muted-light);
  white-space: nowrap;
  flex-shrink: 0;
}

.draft-preview-text {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.draft-body-text {
  margin: 0;
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.draft-expand-btn {
  background: none;
  border: none;
  color: var(--linkedin);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  width: fit-content;
}

.draft-expand-btn:hover {
  color: var(--linkedin-hover);
}

.draft-edit-meta {
  display: flex;
  justify-content: flex-end;
}

.draft-edit-charcount {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.draft-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.2rem;
  border-top: 1px solid var(--bg-subtle);
}

.draft-btn-publish {
  flex-shrink: 0;
}

.draft-actions-secondary {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.draft-btn-discard {
  color: var(--danger) !important;
}

.draft-btn-discard:hover {
  background: var(--danger-soft) !important;
}

/* —— Autopiloto —— */
.autopilot-panel {
  border-radius: 0;
  border: none;
  background: linear-gradient(165deg, var(--accent-soft) 0%, var(--accent-tint) 40%, #fff 100%);
  overflow: hidden;
}

.autopilot-panel.is-active {
  background: linear-gradient(165deg, var(--accent-soft) 0%, var(--accent-tint) 50%, #fff 100%);
}

.ap-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  background: rgba(255, 255, 255, 0.65);
  border-bottom: 1px solid rgba(10, 102, 194, 0.12);
}

.ap-header-intro {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  min-width: 0;
}

.ap-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-lg);
  line-height: 1;
  box-shadow: 0 3px 10px rgba(10, 102, 194, 0.35);
}

.ap-header h2 {
  margin: 0 0 0.15rem;
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ap-header p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.4;
  max-width: 26rem;
}

.ap-header-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  flex-shrink: 0;
}

.autopilot-badge {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--muted);
}

.autopilot-badge.on {
  background: var(--linkedin);
  color: #fff;
}

.ap-switch {
  position: relative;
  cursor: pointer;
}

.ap-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ap-switch input:focus-visible + .ap-switch-track {
  outline: 2px solid var(--linkedin);
  outline-offset: 2px;
}

.ap-switch-track {
  position: relative;
  display: block;
  width: 50px;
  height: 28px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background var(--transition);
}

.ap-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.ap-switch input:checked + .ap-switch-track {
  background: var(--linkedin);
}

.ap-switch input:checked + .ap-switch-track .ap-switch-thumb {
  transform: translateX(22px);
}

.ap-body {
  padding: 1.1rem 1.35rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: opacity 0.25s;
}

.ap-body.is-disabled {
  opacity: 0.85;
}

/* El autopiloto se configura una vez y se olvida; el compositor se usa todos
   los días. Por eso ahora va debajo y arranca plegado cuando está inactivo. */
.ap-body.is-collapsed {
  display: none;
}

.ap-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.ap-collapse-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.ap-collapse-icon {
  display: block;
  line-height: 1;
  transition: transform var(--transition);
}

.ap-collapse-btn[aria-expanded="false"] .ap-collapse-icon {
  transform: rotate(-90deg);
}

/* Resumen de una línea cuando el panel está plegado. */
.ap-resumen {
  padding: 0 1.35rem 1.1rem;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.ap-resumen[hidden] { display: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


.ap-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

@media (max-width: 520px) {
  .ap-options {
    grid-template-columns: 1fr;
  }
}

.ap-option {
  cursor: pointer;
}

.ap-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ap-option-box {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  height: 100%;
}

.ap-option input:focus-visible + .ap-option-box {
  outline: 2px solid var(--linkedin);
  outline-offset: 2px;
}

.ap-option input:checked + .ap-option-box {
  border-color: var(--linkedin);
  box-shadow: 0 0 0 1px var(--linkedin);
  background: var(--accent-tint);
}

.ap-option--highlight input:checked + .ap-option-box {
  border-color: var(--ok);
  box-shadow: 0 0 0 1px var(--ok);
  background: var(--ok-soft);
}

.ap-option-title {
  font-size: var(--fs-base);
  font-weight: 700;
}

.ap-option-desc {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.35;
}

.ap-hint {
  margin: -0.25rem 0 0;
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.4;
  padding: 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--linkedin);
}

.ap-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.6rem;
}

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

.ap-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ap-card-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.ap-interval {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.ap-interval-prefix {
  font-size: var(--fs-base);
  color: var(--muted);
}

.ap-input-num {
  width: 3.2rem;
  font: inherit;
  font-weight: 600;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}

.ap-select {
  font: inherit;
  font-size: var(--fs-base);
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  flex: 1;
  min-width: 0;
}

.ap-select--full {
  width: 100%;
}

.ap-input {
  width: 100%;
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.ap-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ap-details summary {
  padding: 0.7rem 0.9rem;
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background var(--transition);
}

.ap-details summary:hover {
  background: var(--bg);
}

.ap-details summary::-webkit-details-marker {
  display: none;
}

.ap-details summary::after {
  content: "▾";
  float: right;
  color: var(--muted);
  font-size: var(--fs-sm);
  transition: transform var(--transition);
}

.ap-details[open] summary::after {
  transform: rotate(180deg);
}

.ap-details-body {
  padding: 0 0.9rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
}

.ap-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ap-field span {
  font-size: var(--fs-sm);
  font-weight: 600;
}

.ap-field em {
  font-weight: 400;
  color: var(--muted);
  font-style: normal;
}

.ap-field textarea,
.ap-field input.ap-input {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  min-height: 4.5rem;
}

.ap-field input.ap-input {
  min-height: auto;
  resize: none;
}

.ap-field-hint {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.35;
}

/* —— Etiquetas de temas —— */
.topic-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 0.45rem;
}

.topic-tags-empty {
  font-size: var(--fs-sm);
  color: var(--muted-light);
  font-style: italic;
}

.topic-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  max-width: 100%;
  padding: 0.28rem 0.35rem 0.28rem 0.65rem;
  background: var(--linkedin-soft);
  color: var(--linkedin-hover);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.3;
  animation: tag-in 0.2s ease;
}

@keyframes tag-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.topic-tag-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-tag-remove {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--linkedin);
  font-size: var(--fs-md);
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}

.topic-tag-remove:hover {
  background: rgba(10, 102, 194, 0.15);
  color: var(--linkedin-hover);
}

.topic-tags-row {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
}

.topic-tags-input {
  flex: 1;
  min-width: 0;
  min-height: auto !important;
  margin: 0;
}

.topic-tags-add {
  flex-shrink: 0;
  width: 2.5rem;
  padding: 0;
  font-size: var(--fs-md);
  line-height: 1;
  border-radius: var(--radius-sm) !important;
}

.ap-media-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px dashed var(--accent-border);
  border-radius: var(--radius-sm);
}

.ap-btn-icon {
  font-weight: 700;
}

.ap-images-count {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.ap-images-gallery {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 180px;
  overflow-y: auto;
}

.ap-image-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
}

.ap-image-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  flex: 1;
}

.ap-image-delete {
  flex-shrink: 0;
  color: var(--danger);
  padding: 0 0.3rem;
}

.ap-status {
  font-size: var(--fs-sm);
  line-height: 1.45;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--linkedin);
}

.ap-status--error {
  border-left-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger-strong);
}

.ap-footer {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.15rem;
}

.ap-footer .btn-primary {
  flex: 1;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-base);
  font-weight: 400;
  cursor: pointer;
}

.toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--linkedin);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  padding: 0.75rem 0 0.25rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-value {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--linkedin);
  line-height: 1;
}

.stat-label {
  font-size: var(--fs-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-item .queue-item-header {
  flex-wrap: wrap;
  gap: 0.4rem;
}

.history-actions {
  margin-top: 0.35rem;
}

.history-link {
  font-size: var(--fs-sm);
  color: var(--linkedin);
  font-weight: 400;
  text-decoration: none;
}

.history-link:hover {
  text-decoration: underline;
}

.draft-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.4rem 0;
}

.draft-edit-textarea {
  width: 100%;
  font: inherit;
  font-size: var(--fs-base);
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--linkedin);
  border-radius: var(--radius-sm);
  resize: vertical;
  line-height: 1.5;
  box-shadow: 0 0 0 3px rgba(10,102,194,0.1);
}

.draft-edit-textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(10,102,194,0.2);
}

.draft-edit-actions {
  display: flex;
  gap: 0.4rem;
}

@media (max-width: 900px) {
  .brand p {
    display: none;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    padding: 0.65rem 1rem;
    gap: 0.65rem;
    /* Envuelta ocupa ~137px: pegada se comería un sexto de la pantalla de un
       teléfono en todo momento. Y al dejar de ser sticky, los paneles de
       abajo ya no necesitan compensar su altura. */
    position: static;
    height: auto;
  }

  /* Los paneles pegajosos no aportan nada cuando todo va en una columna, y
     su desplazamiento estaba calculado contra la altura fija de la barra. */
  .preview-panel {
    position: static;
  }

  /* Marca y tres módulos miden 448px y no entran en un teléfono. En vez de
     dejar la fila a medio ver, se recorta lo prescindible: el logo solo ya
     identifica el producto, y los módulos aprietan hasta entrar los tres. */
  .topbar-left {
    min-width: 0;
    /* Fila propia: compartiendo línea con las acciones, la navegación
       quedaba en 94px mostrando "Publicado…" y nada más. */
    flex: 1 1 100%;
  }

  .brand-texto {
    display: none;
  }

  .module-nav {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .module-nav::-webkit-scrollbar {
    display: none;
  }

  .module-nav-link {
    padding: 0.4rem 0.55rem;
    font-size: var(--fs-sm);
  }

  .topbar-right {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .status-chips {
    order: 2;
    width: 100%;
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .topbar-toolbar {
    order: 1;
    width: 100%;
    /* Justificado al final, lo que no entra se desborda por la izquierda y
       queda fuera de pantalla (los contadores del CRM caían en left:-109px).
       Envolviendo desde el inicio, baja de línea en vez de desaparecer. */
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .user-pill {
    max-width: 120px;
  }

  .user-label {
    display: none;
  }
}

/* —— Aviso de token de LinkedIn ——
   Vivía en app.js como estilos inline, con dos tokens inexistentes. */
.token-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1.125rem;
  font-size: var(--fs-sm);
}

.token-banner.is-expired {
  background: var(--danger);
  color: #fff;
}

.token-banner.is-warning {
  background: var(--warn-soft);
  color: var(--warn);
}

.token-banner-btn {
  margin-left: 0.5rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
}

.token-banner-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* —— Diálogo simple ——
   Tres diálogos (importar CSV, resultado de importación, llevar al CRM) se
   construían con style inline dentro del JavaScript, cada uno con su propio
   blanco, su propio radio y su propia sombra. */
.modal-simple {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.5);
}

.modal-simple-box {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow: auto;
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.modal-simple-box.is-md { max-width: 480px; }
.modal-simple-box.is-lg { max-width: 680px; }

.modal-simple-box h3 {
  margin: 0 0 0.25rem;
  font-size: var(--fs-md);
}

.modal-simple-sub {
  margin: 0 0 1.25rem;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.modal-simple-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.modal-simple-close {
  background: none;
  border: none;
  font-size: var(--fs-lg);
  line-height: 1;
  color: var(--muted-light);
  cursor: pointer;
}

.modal-simple-close:hover { color: var(--text); }

.modal-simple-acciones {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* —— Importar: opciones y resultado —— */
.imp-opcion {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
}

.imp-opcion.is-disabled { opacity: 0.4; cursor: default; }
.imp-opcion-titulo { font-weight: 600; font-size: var(--fs-base); }
.imp-opcion-sub { font-size: var(--fs-xs); color: var(--muted); }

.imp-resumen-ok {
  margin-bottom: 1rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--ok-border);
  border-radius: var(--radius-sm);
  background: var(--ok-soft);
  color: var(--ok-strong);
  font-size: var(--fs-base);
  font-weight: 600;
}

.imp-grupo { margin-bottom: 0.75rem; }

.imp-grupo-titulo {
  margin-bottom: 0.35rem;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.imp-grupo-titulo.is-warn { color: var(--warn); }
.imp-grupo-titulo.is-danger { color: var(--danger); }

.imp-lista {
  margin: 0;
  padding-left: 1.2rem;
  max-height: 120px;
  overflow-y: auto;
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* —— El compositor como flujo ——
   Era un formulario de siete campos con los botones al fondo: «Generar texto
   con IA», que es el primer paso real, quedaba último. Ahora los dos pasos
   que siempre se hacen están arriba y numerados, y lo que se usa de vez en
   cuando se pliega sin desaparecer. */

.pasos {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.paso {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: 0 0.9rem;
  align-items: start;
}

.paso-num {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: var(--fs-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 0.1rem;
}

.paso-cuerpo {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.paso-label {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
}

.paso-cuerpo textarea {
  width: 100%;
  font: inherit;
  font-size: var(--fs-base);
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}

.paso-cuerpo textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* El botón de generar pegado al tema, no al final de la página. */
.paso-accion {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.paso-nota {
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* —— Lo opcional —— */

.opcionales {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.opcional {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.opcional[open] {
  border-color: var(--border-strong);
}

.opcional > summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.85rem;
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius-sm);
}

.opcional > summary::-webkit-details-marker { display: none; }

.opcional > summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--muted);
  font-size: var(--fs-sm);
  transition: transform var(--transition);
}

.opcional[open] > summary::after { transform: rotate(180deg); }

.opcional > summary:hover { background: var(--bg); }

.opcional > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.opcional-icono { font-size: var(--fs-base); line-height: 1; }

/* Qué hay puesto sin necesidad de abrirlo. */
.opcional-estado {
  margin-left: auto;
  margin-right: 0.4rem;
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--muted);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
}

.opcional-estado.is-puesto { color: var(--accent); font-weight: 600; }

.opcional-cuerpo {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0.25rem 0.85rem 0.9rem;
  border-top: 1px solid var(--line, var(--border));
}

.campo-suelto {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
}

.campo-suelto input,
.campo-suelto select {
  font: inherit;
  font-size: var(--fs-base);
  font-weight: 400;
  color: var(--text);
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.campo-suelto input:focus,
.campo-suelto select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

@media (max-width: 520px) {
  .paso { grid-template-columns: 1fr; gap: 0.4rem; }
  .paso-num { display: none; }
  .opcional-estado { max-width: 8rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   REDISEÑO — la capa que cambia el aspecto

   Va al final a propósito: sobrescribe por cascada lo que había sin tener que
   reescribir cada regla original, y se puede leer de un tirón para entender
   qué define la cara de la app.
   ═══════════════════════════════════════════════════════════════════════════ */

/* —— La barra de mando ——
   Oscura. Es el cambio que más se nota, y no es decorativo: separa el mando
   del contenido, que antes eran la misma superficie blanca. */
.topbar {
  background: var(--nav-bg);
  border-bottom: none;
  color: var(--nav-text);
  backdrop-filter: none;
  padding: 0 1.5rem;
  box-shadow: inset 0 -1px 0 var(--nav-border);
}

.brand {
  border-right: 1px solid var(--nav-border);
}

.brand h1 {
  font-family: var(--font-titulo);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--nav-text);
}

.brand p { color: var(--nav-muted); }

.brand-logo {
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  padding: 2px;
}

.module-nav-link {
  color: var(--nav-muted);
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.module-nav-link:hover {
  background: var(--nav-activo);
  color: var(--nav-text);
}

.module-nav-link.is-active,
.module-nav-link.radar-link.is-active,
.module-nav-link.crm-link.is-active {
  background: var(--nav-activo);
  color: var(--nav-text);
  box-shadow: inset 0 0 0 1px var(--nav-border);
}

/* Cada módulo se firma con una línea de color arriba, no pintando la pastilla
   entera: el sello se ve y no compite con el texto. */
.module-nav-link.is-active { box-shadow: inset 0 2px 0 var(--accent-border), inset 0 0 0 1px var(--nav-border); }
.module-nav-link.radar-link.is-active { box-shadow: inset 0 2px 0 var(--mod-radar), inset 0 0 0 1px var(--nav-border); }
.module-nav-link.crm-link.is-active { box-shadow: inset 0 2px 0 var(--mod-crm), inset 0 0 0 1px var(--nav-border); }

/* Los controles de la derecha, sobre tinta. */
.topbar .btn-ghost,
.topbar-nav .btn-ghost {
  color: var(--nav-muted);
}

.topbar .btn-ghost:hover,
.topbar-nav .btn-ghost:hover {
  background: var(--nav-activo);
  color: var(--nav-text);
}

.topbar .btn-outline {
  border-color: var(--nav-border);
  color: var(--nav-text);
  background: transparent;
}

.topbar .btn-outline:hover {
  background: var(--nav-activo);
  border-color: var(--nav-muted);
}

/* —— Títulos ——
   Archivo, tracking cerrado. Antes todo era la misma familia y los títulos se
   distinguían solo por ser un poco más gordos. */
h1, h2, h3,
.panel-head h2,
.panel-head h3,
.paso-label,
.crm-card-title,
.prospect-company,
.radar-panel-header h2,
.settings-module-header h2 {
  font-family: var(--font-titulo);
  letter-spacing: -0.018em;
}

.panel-head h2,
.radar-panel-header h2,
.settings-module-header h2 {
  font-size: var(--fs-lg);
  font-weight: 600;
}

/* —— Superficies ——
   Borde de un pelo en vez de sombra. Las sombras difusas hacían flotar cada
   caja por igual, que es lo mismo que no tener jerarquía. */
.panel,
.composer-manual,
.autopilot-panel,
.crm-card,
.prospect-card,
.settings-card,
.crm-panel,
.radar-search-panel,
.preview-panel {
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.crm-card:hover,
.prospect-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: none;
}

/* —— Controles ——
   Menos redondeo y un relleno más apretado: se leen como controles, no como
   burbujas. */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: -0.005em;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* El botón de LinkedIn conserva el azul de la marca: es el único lugar donde
   se está hablando de LinkedIn y no de esta app. */
.btn-connect,
#btn-linkedin {
  background: var(--linkedin);
  border-color: var(--linkedin);
  color: #fff;
}

.btn-connect:hover,
#btn-linkedin:hover {
  background: var(--linkedin-hover);
  border-color: var(--linkedin-hover);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
  border-radius: var(--radius-sm);
}

/* —— Píldoras y pastillas ——
   Cuadradas, con el color en el texto y el borde en vez de un fondo saturado. */
.crm-status-badge,
.prospect-status-pill,
.embudo-etapa,
.chip {
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

/* —— Los chips de estado, sobre tinta ——
   Eran pastillas claras heredadas del diseño anterior: sobre la barra oscura
   se leían como parches pegados. Ahora el color va en el punto y en el texto,
   y el fondo apenas se insinúa. */
.topbar .chip,
.status-chips .chip {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--nav-border);
  color: var(--nav-muted);
  height: 26px;
}

.topbar .chip.ok,
.status-chips .chip.ok { color: #8fcfa4; }

.topbar .chip.warn,
.status-chips .chip.warn { color: #e2bd72; }

.topbar .chip.err,
.status-chips .chip.err { color: #e79a89; }

.topbar .chip::before,
.status-chips .chip::before {
  background: currentColor;
}

/* El avatar de usuario deja de ser un círculo de color sobre la tinta. */
.topbar .user-pill,
.user-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--nav-border);
  color: var(--nav-text);
  border-radius: var(--radius-sm);
}

.user-avatar {
  background: var(--nav-activo);
  color: var(--nav-text);
  border-radius: var(--radius-sm);
}

.user-label { color: var(--nav-muted); }

/* —— El contenido respira ——
   Los paneles ocupaban el ancho completo pegados al borde: el papel de fondo
   no se veía nunca y todo era una sola superficie blanca. */
.layout,
.crm-layout,
.prospects-layout,
.settings-main {
  padding-top: 1.5rem;
}

/* ═══ El Publicador: cada cosa con el ancho que necesita ═══════════════════
   La columna derecha era una caja de pestañas que mezclaba la vista previa
   —un post de LinkedIn, que tiene que ser angosto— con la cola de 60 posts y
   el historial de 30, que son listas y necesitan ancho. Las listas veían
   371px por fila y el compositor de al lado, un formulario, se quedaba con
   935px. */

/* La columna derecha: solo la previa. */
.preview-titulo {
  font-family: var(--font-titulo);
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted-light);
  margin: 0 0 0.15rem;
}

/* Las listas, a ancho completo debajo del compositor. */
.listas {
  max-width: 1440px;
  margin: 1.25rem auto 2rem;
  padding: 0.25rem 1.25rem 1.25rem;
}

.listas .preview-tabs {
  margin-bottom: 0.9rem;
}

.listas .queue-section > .panel-head {
  margin-bottom: 0.5rem;
}

/* —— La fila de la cola, en columnas ——
   Apilaba estado, tipo, texto y fecha en cuatro líneas: 96px de alto por post
   para mostrar medio renglón. En columnas mide 38px y el texto entra entero. */
.listas .queue-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.listas .queue-item {
  display: grid;
  grid-template-columns:
    96px                  /* estado */
    minmax(220px, 1fr)    /* texto */
    64px                  /* tipo */
    minmax(140px, auto)   /* cuándo */
    minmax(0, 0.6fr);     /* error */
  align-items: center;
  gap: 0 1rem;
  min-height: 38px;
  padding: 0.35rem 0.75rem;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.listas .queue-item:hover {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: none;
}

.qcol {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.qcol-texto { color: var(--text); }

.qcol-tipo {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-light);
}

.qcol-cuando { font-variant-numeric: tabular-nums; }

.qcol-error { color: var(--danger); font-size: var(--fs-xs); }

.qcol-estado { overflow: visible; }

/* El historial lleva su enlace a LinkedIn, así que necesita una columna más. */
.listas #history-list .queue-item {
  grid-template-columns: 96px minmax(220px, 1fr) 64px minmax(140px, auto) minmax(0, 0.6fr);
}

@media (max-width: 900px) {
  .listas .queue-item {
    grid-template-columns: 1fr auto;
    gap: 0.15rem 0.6rem;
    padding: 0.6rem 0.75rem;
  }
  .qcol-texto  { grid-column: 1; grid-row: 1; white-space: normal; }
  .qcol-estado { grid-column: 2; grid-row: 1; justify-self: end; }
  .qcol-cuando { grid-column: 1 / -1; grid-row: 2; font-size: var(--fs-xs); }
  .qcol-tipo,
  .qcol-error  { display: none; }
}

/* El atajo a las listas, en la cabecera del compositor. */
.atajo-listas {
  margin-left: auto;
  align-self: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.7rem;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--transition), color var(--transition);
}

.atajo-listas::after {
  content: " ↓";
  color: var(--muted-light);
}

.atajo-listas:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.atajo-listas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
