/* #/proyectos (lista agrupada por día, diseño portado de RRSS) + #/proyecto/:id (detalle). */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
}

.project-card {
  position: relative;
  display: flex; flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  cursor: pointer;
  transition: box-shadow var(--t), border-color var(--t), transform var(--t-fast);
  min-height: 160px;
}
.project-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.project-card-client {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-xs);
  color: var(--text-soft);
  padding: 2px var(--sp-2);
  background: var(--bg-soft);
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  align-self: flex-start;
}
.project-card-name {
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.project-card-desc {
  font-size: var(--fs-sm);
  color: var(--text-soft);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.project-card-status { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px var(--sp-2);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.status-badge.st-lc-dev  { background: var(--state-draft-bg);    color: var(--state-draft-fg); }
.status-badge.st-lc-done { background: var(--state-complete-bg); color: var(--state-complete-fg); }

/* Eje "cliente" (revisión por enlace, 0013): badges de estado_cliente. */
.status-badge.st-ec-none     { background: var(--state-draft-bg);      color: var(--state-draft-fg); }
.status-badge.st-ec-shared   { background: var(--state-shared-bg);     color: var(--state-shared-fg); }
.status-badge.st-ec-accepted { background: var(--state-complete-bg);   color: var(--state-complete-fg); }
.status-badge.st-ec-silent   { background: var(--state-draft-bg);      color: var(--state-complete-fg); }
.status-badge.st-ec-changes  { background: var(--state-incomplete-bg); color: var(--state-incomplete-fg); }

/* ---------- Modal "Compartir con el cliente" (reviewLinkModal) ---------- */
.rvm-list {
  display: flex; flex-direction: column;
  max-height: 300px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--r-md);
}
.rvm-row {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  cursor: pointer; font-size: var(--fs-sm);
}
.rvm-row:last-child { border-bottom: none; }
.rvm-row:hover { background: var(--bg-hover); }
.rvm-thumb {
  flex: 0 0 auto; width: 30px; height: 30px;
  border-radius: var(--r-sm); object-fit: cover; border: 1px solid var(--border);
}
.rvm-thumb-empty {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); background: var(--bg-soft);
}
.rvm-radio {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  font-size: var(--fs-sm); cursor: pointer;
}
.rvm-radio input { margin-top: 3px; }
.rvm-hist-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) 0 var(--sp-1) var(--sp-3);
  font-size: var(--fs-sm);
}
.rvm-hist-nota {
  flex-basis: 100%;
  color: var(--text-soft); font-style: italic; font-size: var(--fs-sm);
  padding-left: var(--sp-2);
}
.rvm-chip-ok      { background: var(--state-complete-bg);   color: var(--state-complete-fg);   border-color: transparent; }
.rvm-chip-cambios { background: var(--state-incomplete-bg); color: var(--state-incomplete-fg); border-color: transparent; }

/* Envío del informe por correo (panel del enlace activo). */
.rvm-mail {
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.rvm-mail .card-title { display: flex; align-items: center; gap: var(--sp-2); }
/* El cuerpo del correo se edita entero aquí: alto para ver la plantilla de un
   vistazo (~18 líneas) sin tener que redimensionar. Sobre `.textarea`, que ya
   trae height:auto — con `.input` (height:36px) el campo queda aplastado. */
.rvm-mail-ta {
  min-height: 400px;
  resize: vertical;
  line-height: 1.55;
}
.rvm-mail-check {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); color: var(--text-soft); cursor: pointer;
}
.rvm-mail-warn {
  padding: var(--sp-2) var(--sp-3);
  background: var(--state-incomplete-bg); color: var(--state-incomplete-fg);
  border-radius: var(--r-sm); font-size: var(--fs-sm); line-height: 1.5;
}
/* Previsualización del correo: se pinta el HTML real en un iframe aislado. */
.rvm-mail-frame {
  width: 100%; height: 70vh;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--bg-hover);
}

.project-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: auto;
  align-items: center;
}
.project-card-meta .pill {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-soft);
  color: var(--text-soft);
  padding: 2px var(--sp-2);
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
}
/* Pills de asignación a usuario: "por X" (asignado) o "Sin asignar". */
.project-card-meta .pill-assigned {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-strong);
}
.project-card-meta .pill-unassigned {
  font-family: var(--font-ui);
  background: var(--state-incomplete-bg);
  color: var(--state-incomplete-fg);
  border-color: var(--state-incomplete-bg);
}

.project-card-delete {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--t), color var(--t), border-color var(--t);
}
.project-card:hover .project-card-delete { opacity: 1; }
.project-card-delete:hover { color: var(--red); border-color: var(--red); }

/* Contenedor de secciones por día */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

/* Cabecera de sección de día: etiqueta + contador + línea divisoria */
.projects-day-group {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.projects-day-group::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.projects-day-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}
.projects-day-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-soft);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 2px var(--sp-2);
}
/* Acerca el grid a su cabecera (el gap grande de .projects-list separa días) */
.projects-day-group + .projects-grid { margin-top: var(--sp-3); }

/* Bar de cliente en el detalle */
.client-bar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-4);
}
.client-bar-name { font-weight: 600; }
.client-bar-name:hover { text-decoration: underline; }

/* Stats */
.project-stats {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-4);
}
.state-complete { color: var(--state-complete-fg); }
.state-incomplete { color: var(--state-incomplete-fg); }

/* Lista de noticias del proyecto */
.noticia-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.noticia-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t);
}
.noticia-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.noticia-row-thumb { flex: 0 0 auto; width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; border: 1px solid var(--border); background: var(--bg-hover); }
.noticia-row-thumb-empty { display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); background: var(--bg-soft); }
.noticia-row-main { flex: 1; min-width: 0; }
.noticia-row-title { font-weight: 500; }
.noticia-row-sub { font-size: var(--fs-xs); }
.noticia-row-actions { display: flex; gap: var(--sp-1); }
.noticia-row-actions .btn-icon { border: 1px solid transparent; color: var(--text-muted); }
.noticia-row-actions .btn-icon:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }

/* Fila draggable (origen del drop al calendario) */
.noticia-row[draggable="true"] { cursor: grab; }
.noticia-row[draggable="true"]:active { cursor: grabbing; }
.noticia-row.dragging { opacity: 0.5; }

/* ---------- Cabecera editable en línea (título + descripción) ---------- */
.input-bare {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font-family: inherit;
  color: var(--text);
  line-height: 1.2;
}
.input-bare:focus { outline: none; }
.input-bare::placeholder { color: var(--text-muted); }

/* ---------- Fila de estado (FASE) ---------- */
.detail-status-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--sp-2) var(--sp-5);
  margin-top: var(--sp-1);
}
.detail-status-group { display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.detail-status-label {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 600; color: var(--text-muted);
}

/* ---------- Lista compacta estilo RRSS (pub-list-item) ---------- */
.pub-list-compact {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: calc(100vh - var(--header-h, 56px) - 240px);
  overflow-y: auto;
}
.pub-list-item {
  display: flex; gap: var(--sp-3); align-items: center;
  padding: var(--sp-3);
  cursor: grab;
  border-bottom: 1px solid var(--border);
  transition: background var(--t), opacity var(--t);
}
.pub-list-item:last-child { border-bottom: none; }
.pub-list-item:hover { background: var(--bg-soft); }
.pub-list-item:active { cursor: grabbing; }
.pub-list-item.dragging { opacity: 0.4; background: var(--bg-hover); }
.pub-list-handle {
  flex-shrink: 0; color: var(--text-muted);
  font-size: 16px; letter-spacing: -3px; user-select: none; cursor: grab; padding: 0 2px;
}
.pub-list-thumb {
  width: 56px; height: 56px; flex-shrink: 0;
  border-radius: var(--r-sm);
  background-color: var(--bg-soft);
  background-size: cover; background-position: center;
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); cursor: zoom-in;
  transition: transform var(--t), box-shadow var(--t);
}
.pub-list-thumb:hover { transform: scale(1.04); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
.pub-list-thumb.empty { color: var(--text-muted); }
.pub-list-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.pub-list-type {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-xs); color: var(--text); font-weight: 500;
}
.pub-list-state {
  margin-left: var(--sp-2); padding: 1px 6px; border-radius: var(--r-sm);
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.pub-list-state.complete { background: var(--state-complete-bg); color: var(--state-complete-fg); }
.pub-list-state.incomplete { background: var(--state-incomplete-bg); color: var(--state-incomplete-fg); }
.pub-list-when { font-size: 11px; color: var(--text-soft); font-family: var(--font-mono); }
.pub-list-when.missing { color: var(--text-muted); font-style: italic; font-family: inherit; }
.pub-list-caption {
  font-size: var(--fs-sm); color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pub-list-caption.missing { color: var(--text-muted); font-style: italic; }
.pub-list-actions { display: flex; gap: 2px; flex-shrink: 0; align-items: center; }
/* Selector rápido de categoría en la fila (compacto, no compite con el título). */
.pub-list-cat-select {
  max-width: 170px;
  font-family: inherit;
  font-size: var(--fs-xs);
  color: var(--text-soft);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px 6px;
  margin-right: var(--sp-2);
  cursor: pointer;
}
.pub-list-cat-select:hover { color: var(--text); border-color: var(--border-strong); }
.pub-list-actions .btn-icon {
  border-color: transparent; color: var(--text-muted); width: 28px; height: 28px;
}
.pub-list-actions .btn-icon:hover { color: var(--text); background: var(--bg-hover); }
.pub-list-actions .btn-icon.danger:hover { color: var(--red); background: #fff0ef; }

/* ---------- Modal de previsualización del artículo de blog ---------- */
.noticia-preview-modal-body { padding: 0; }
.noticia-preview { display: flex; flex-direction: column; }
.noticia-preview-eyebrow {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); font-weight: 600; margin-bottom: var(--sp-2);
}
.noticia-preview-h1 {
  font-family: var(--font-serif);
  font-size: var(--fs-3xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 var(--sp-4);
}
.noticia-preview-img {
  width: 100%; height: auto; display: block;
  border-radius: var(--r-md);
  margin-bottom: var(--sp-5);
  cursor: zoom-in;
}
.noticia-preview-empty { font-style: italic; }
.noticia-preview-error { color: var(--red); font-size: var(--fs-sm); }

/* Meta del preview de publicadas: categoría + fechas (subida/actualizada/freshness). */
.noticia-preview-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-sm); color: var(--text-soft);
}
.noticia-preview-date-label { font-weight: 600; color: var(--text-muted); }

/* Cuerpo del artículo: misma tipografía que el editor (ver css/tiptap.css). */
.noticia-preview-body { font-size: var(--fs-md); line-height: 1.7; color: var(--text); }
.noticia-preview-body > * + * { margin-top: 0.75em; }
.noticia-preview-body h2 { font-family: var(--font-serif); font-size: var(--fs-xl); font-weight: 600; }
.noticia-preview-body h3 { font-family: var(--font-serif); font-size: var(--fs-lg); font-weight: 600; }
.noticia-preview-body p { margin: 0; }
.noticia-preview-body ul, .noticia-preview-body ol { padding-left: var(--sp-6); }
.noticia-preview-body li > p { margin: 0; }
.noticia-preview-body blockquote {
  border-left: 3px solid var(--border-strong);
  padding-left: var(--sp-4);
  color: var(--text-soft);
  font-style: italic;
}
.noticia-preview-body a { color: var(--state-shared-fg); text-decoration: underline; }
.noticia-preview-body img { max-width: 100%; height: auto; border-radius: var(--r-sm); }

/* ---------- Asignación de usuario (línea bajo la cabecera) ---------- */
.user-link-row { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-soft); margin-bottom: var(--sp-3); }
.change-link {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: inherit; font-size: var(--fs-xs); color: var(--text-muted);
  text-decoration: underline;
}
.change-link:hover { color: var(--text); }

/* ---------- Layout 2 columnas (lista + calendario) ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-5);
  align-items: start;
}
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-cal-col { position: sticky; top: calc(var(--header-h, 56px) + var(--sp-4)); }

/* ---------- Calendario ---------- */
.calendar {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  padding: var(--sp-3);
  display: flex; flex-direction: column;
  gap: var(--sp-2);
}
.calendar-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
}
.calendar-nav { display: flex; align-items: center; gap: var(--sp-2); }
.calendar-nav .btn-icon { border: 1px solid var(--border); background: var(--bg); }
.calendar-month-label {
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: -0.01em;
  min-width: 130px;
  text-align: center;
}
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.calendar-weekday {
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 4px 0;
  font-weight: 600;
}
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.calendar-day {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  min-height: 80px;
  padding: 4px;
  display: flex; flex-direction: column;
  gap: 3px;
  overflow: hidden;
}
.calendar-day.adjacent { background: var(--bg-soft); opacity: 0.55; }
.calendar-day.today { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.calendar-day.drop-hover {
  background: #e8f5ff;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px #2563eb33;
}
.calendar-day.drop-hover .calendar-day-num { color: #2563eb; font-weight: 700; }
.calendar-day.past { background: var(--bg-soft); opacity: 0.6; }
.calendar-day.past .calendar-day-num { color: var(--text-muted); }
.calendar-day.drop-blocked {
  background: #fff3f0;
  border-color: #ffb3a8;
  cursor: not-allowed;
}
.calendar-day-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-soft);
}
.calendar-day.today .calendar-day-num { color: var(--text); font-weight: 700; }
.calendar-day-more {
  background: none; border: none; text-align: left;
  font-size: 10px; color: var(--text-soft); cursor: pointer;
  padding: 0 4px; font-weight: 500;
}
.calendar-day-more:hover { color: var(--text); }

/* Chip de noticia: verde si está completa (H1 + cuerpo); violeta si es de
   destino PEG (perfil de empresa de Google); ámbar si incompleta (manda sobre
   el violeta: va declarado después). */
.calendar-chip {
  display: flex; align-items: center; gap: 4px;
  width: 100%;
  padding: 2px 4px;
  border: 1px solid #86efac;
  border-radius: var(--r-sm);
  background: #dcfce7;
  cursor: grab;
  font-size: 10px;
  text-align: left;
  transition: background var(--t), border-color var(--t), opacity var(--t);
  overflow: hidden;
}
.calendar-chip:hover { background: #bbf7d0; border-color: #16a34a; }
.calendar-chip:active { cursor: grabbing; }
.calendar-chip.dragging { opacity: 0.5; }
.calendar-chip .calendar-chip-time { color: #166534; }
.calendar-chip::before {
  content: '●';
  color: #16a34a;
  font-size: 8px;
  margin-right: -2px;
  flex-shrink: 0;
}
/* Variante PEG (perfil de empresa de Google): violeta suave, coherente con
   .chip-destino-peg de la lista/ficha de cliente. */
.calendar-chip.peg { background: #f1ebfb; border-color: #c9b6ea; }
.calendar-chip.peg:hover { background: #e6dcf7; border-color: #5b2ca0; }
.calendar-chip.peg .calendar-chip-time { color: #5b2ca0; }
.calendar-chip.peg::before { color: #5b2ca0; }
/* Variante incompleta (sin H1 o sin cuerpo): ámbar */
.calendar-chip.incomplete { background: #fff7ed; border-color: #fdba74; }
.calendar-chip.incomplete:hover { background: #ffedd5; border-color: #ea580c; }
.calendar-chip.incomplete .calendar-chip-time { color: #9a3412; }
.calendar-chip.incomplete::before { color: #ea580c; }

.calendar-chip-thumb {
  width: 18px; height: 18px;
  border-radius: 3px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-hover);
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.calendar-chip-thumb.empty { color: var(--text-muted); }
.calendar-chip-time {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}
.calendar-chip-label {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text-soft);
}

/* Drag-to-navigate: pulso azul mientras el timer de 500 ms está armado. */
.calendar-header .btn-icon.drag-nav-armed,
.calendar-header .btn-sm.drag-nav-armed {
  border-color: #93c5fd;
  background: #e8f5ff;
  color: #1d4ed8;
  animation: cal-nav-pulse 0.5s ease-in-out;
}
@keyframes cal-nav-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
  100% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
}

/* Generación IA en curso: spinner superpuesto a la miniatura de la fila. */
.pub-list-thumb { position: relative; }
.pub-list-thumb-gen {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.65);
}
.pub-list-thumb-gen .spinner { width: 18px; height: 18px; border-width: 2px; }
