/* Vista: ficha de un reel y «Revisar» (prefijo pc-). Solo variables de tokens.css. */

/* ── Diálogo de la ficha ── */
.pc-dlg .dlg-head { flex-wrap: wrap; row-gap: var(--s2); }
.pc-dlg .dlg-head > .stack-sm { flex: 1 1 240px; }
.pc-dlg .dlg-title { font-size: var(--fs-xl); }
.pc-head-extra { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.pc-dlg .dlg-body { padding: 0; background: var(--bg); }
.pc-dlg .dlg-foot { padding: var(--s3) var(--s5); }

/* Conmutador ES / EN */
.pc-langsw { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r); background: var(--bg-sunken); border: 1px solid var(--border); }
.pc-langsw-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-3); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; }
.pc-langsw-btn:hover { color: var(--text); background: var(--surface-2); }
.pc-langsw-btn[aria-pressed="true"].is-es { background: var(--lang-es-soft); color: var(--lang-es); }
.pc-langsw-btn[aria-pressed="true"].is-en { background: var(--lang-en-soft); color: var(--lang-en); }
.pc-langsw-btn[aria-pressed="true"] { cursor: default; }
.pc-langsw-btn .dot { width: 6px; height: 6px; box-shadow: none; }

/* Cuerpo */
.pc-body { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s4); }
.pc-callouts { display: flex; flex-direction: column; gap: var(--s2); }
.pc-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: var(--s6); align-items: start; }
.pc-left { display: flex; flex-direction: column; gap: var(--s3); align-items: center; min-width: 0; }
.pc-right { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
@media (min-width: 901px) and (min-height: 760px) { .pc-left { position: sticky; top: 0; } }

/* ── Móvil de vista previa (9:16) ── */
.pc-phone { position: relative; height: clamp(340px, calc(100dvh - 400px), 560px); aspect-ratio: 9 / 16; max-width: 100%;
  border-radius: calc(var(--r-lg) * 2); border: var(--s2) solid var(--surface-3); background: var(--bg-sunken);
  box-shadow: var(--shadow); overflow: hidden; flex: none; }
.pc-video { width: 100%; height: 100%; object-fit: contain; background: var(--bg-sunken); }
.pc-novideo { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s3);
  padding: var(--s5); text-align: center; color: var(--text-2); font-size: var(--fs-sm); }
.pc-novideo strong { color: var(--text); font-size: var(--fs-md); }
.pc-novideo p { max-width: 26ch; }
.pc-novideo-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r-full); background: var(--surface-2); color: var(--text-3); }
.pc-novideo.is-ai { background: radial-gradient(circle at 50% 38%, var(--ai-soft), transparent 70%); }
.pc-novideo.is-ai .pc-novideo-icon { background: var(--ai-soft); color: var(--ai); }
.pc-novideo.is-working .pc-novideo-icon { animation: pc-breathe 2.4s ease-in-out infinite; }
.pc-novideo.is-working::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, var(--ai-soft) 50%, transparent 65%); background-size: 260% 100%; animation: pc-sweep 3s linear infinite; }
@keyframes pc-breathe { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: 0.7; } }
@keyframes pc-sweep { from { background-position: 130% 0; } to { background-position: -130% 0; } }

/* Post de Instagram */
.pc-post { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3) var(--s4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); font-size: var(--fs-sm); }
.pc-post-head { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.pc-post-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-full); flex: none;
  background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 700; text-transform: uppercase;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); margin: 2px; }
.pc-post-name { font-weight: 650; flex: 1; }
.pc-post-icons { display: flex; align-items: center; gap: var(--s3); color: var(--text); }
.pc-post-icons .icon { width: 20px; height: 20px; }
.pc-cap { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; color: var(--text); }
.pc-cap > strong { font-weight: 650; }
.pc-more { border: 0; background: none; padding: 0; color: var(--text-3); font: inherit; cursor: pointer; }
.pc-more:hover { color: var(--text); }
.pc-post-kw { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-radius: var(--r); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-xs); }
mark.pc-kw { background: var(--accent-soft); color: var(--accent-text); border-radius: 4px; padding: 0 3px; font-weight: 650; }

/* ── Secciones ── */
.pc-sec { display: flex; flex-direction: column; gap: var(--s4); padding: var(--s5); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); min-width: 0; scroll-margin-top: var(--s4); }
.pc-sec-head { display: flex; align-items: flex-start; gap: var(--s3); }
.pc-sec-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r); background: var(--surface-2); color: var(--text-2); flex: none; }
.pc-sec-icon.is-publish { background: var(--accent-soft); color: var(--accent-text); }
.pc-sec-icon.is-dm { background: var(--info-soft); color: var(--info); }
.pc-sec-icon.is-script { background: var(--ai-soft); color: var(--ai); }
.pc-sec-titles { min-width: 0; padding-top: 5px; }
.pc-sec-titles h3 { font-size: var(--fs-lg); }
.pc-sec-desc { color: var(--text-2); font-size: var(--fs-sm); margin-top: 2px; }
.pc-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.pc-subblock { display: flex; flex-direction: column; gap: var(--s3); padding-top: var(--s4); border-top: 1px solid var(--border); }
.pc-subhead h4 { font-size: var(--fs-md); }
.pc-subhead .hint { margin-top: 2px; }

/* Datos clave (fecha, publicado…) */
.pc-fact { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.pc-fact > .icon { color: var(--text-2); }
.pc-fact.is-info > .icon { color: var(--info); }
.pc-fact.is-warning > .icon { color: var(--warning); }
.pc-fact.is-success > .icon { color: var(--success); }
.pc-fact-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pc-fact-text span { font-size: var(--fs-xs); color: var(--text-3); }

/* Respuesta automática */
.pc-dm-explain { display: flex; align-items: flex-start; gap: var(--s2); padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--info-soft); color: var(--text); font-size: var(--fs-sm); }
.pc-dm-explain > .icon { color: var(--info); margin-top: 2px; }
.pc-dm-explain.is-off { background: var(--surface-2); color: var(--text-2); }
.pc-dm-explain.is-off > .icon { color: var(--text-3); }
.pc-bubble-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s1); }
.pc-bubble-label { font-size: var(--fs-xs); color: var(--text-3); }
.pc-bubble { display: flex; flex-direction: column; gap: var(--s1); max-width: 340px; padding: var(--s3) var(--s4);
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) var(--r-sm); background: var(--surface-3); color: var(--text); font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.pc-bubble-link { color: var(--info); text-decoration: underline; }
.pc-dm-stats { display: flex; gap: var(--s2); flex-wrap: wrap; }
.pc-test-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: var(--s3); align-items: end; }
.pc-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pc-log-item { padding: var(--s2) 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pc-log-item:first-child { border-top: 0; }
.pc-log-head { display: flex; align-items: center; gap: var(--s2); min-width: 0; font-size: var(--fs-sm); }
.pc-log-head time { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.pc-log-text { font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }
.pc-log-err { font-size: var(--fs-xs); color: var(--danger); }

/* Guion */
.pc-script { font-size: var(--fs-lg); line-height: 1.7; min-height: 300px; }

/* Plegables */
.pc-fold { border-radius: var(--r-lg); scroll-margin-top: var(--s4); }
.pc-fold > summary { padding: var(--s4) var(--s5); }
.pc-fold > summary .icon { color: var(--text-2); }
.pc-fold > .fold-body { padding: 0 var(--s5) var(--s5); display: flex; flex-direction: column; gap: var(--s4); }
.pc-fold > .fold-body > .pc-subblock:first-child { border-top: 0; padding-top: 0; }
.pc-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full); display: inline-grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 700; }

/* Subida */
.pc-upload { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4); border: 1px dashed var(--border-strong); border-radius: var(--r); background: var(--surface-2); scroll-margin-top: var(--s4); }

/* Zona peligrosa */
.pc-danger { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; padding: var(--s4);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); border-radius: var(--r); }
.pc-danger h4 { color: var(--danger); }

/* Historial */
.pc-evs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pc-ev { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s3); padding-bottom: var(--s3); }
.pc-ev:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: var(--border); }
.pc-ev-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-full); background: var(--surface-3); color: var(--text-2); }
.pc-tone-success .pc-ev-icon { background: var(--success-soft); color: var(--success); }
.pc-tone-danger .pc-ev-icon { background: var(--danger-soft); color: var(--danger); }
.pc-tone-warning .pc-ev-icon { background: var(--warning-soft); color: var(--warning); }
.pc-tone-info .pc-ev-icon { background: var(--info-soft); color: var(--info); }
.pc-tone-ai .pc-ev-icon { background: var(--ai-soft); color: var(--ai); }
.pc-ev-body { min-width: 0; padding-top: 3px; }
.pc-ev-head { display: flex; align-items: baseline; gap: var(--s2); font-size: var(--fs-sm); }
.pc-ev-head time { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.pc-ev-body p { font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }

/* Resalte al saltar a una sección */
.pc-flash { animation: pc-flash 1.4s var(--ease); }
@keyframes pc-flash { 0%, 60% { box-shadow: var(--focus); } 100% { box-shadow: none; } }

/* Pie fijo */
.pc-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); width: 100%; flex-wrap: wrap; }
.pc-foot-left { display: flex; align-items: center; gap: var(--s3); min-width: 0; flex: 1 1 220px; font-size: var(--fs-sm); color: var(--text-2); }
.pc-foot-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-dirty { display: inline-flex; align-items: center; gap: var(--s2); color: var(--warning); font-weight: 600; white-space: nowrap; }
.pc-foot-right { display: flex; align-items: center; justify-content: flex-end; gap: var(--s2); flex-wrap: wrap; margin-left: auto; }

@media (max-width: 1100px) { .pc-test-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .pc-test-go { grid-column: 1 / -1; } }
@media (max-width: 900px) {
  .pc-layout { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .pc-phone { height: clamp(320px, 62dvh, 520px); }
  .pc-post { max-width: 100%; }
}
@media (max-width: 720px) {
  .pc-dlg .dlg-head > .stack-sm { flex-basis: calc(100% - 50px); }
  .pc-head-extra { order: 3; flex-basis: 100%; }
  .pc-dlg .dlg-title { font-size: var(--fs-lg); }
  .pc-body { padding: var(--s4); }
  .pc-sec { padding: var(--s4); }
  .pc-fold > summary { padding: var(--s3) var(--s4); }
  .pc-fold > .fold-body { padding: 0 var(--s4) var(--s4); }
  .pc-grid-2, .pc-test-form { grid-template-columns: minmax(0, 1fr); }
  .pc-dlg .dlg-foot { padding: var(--s3) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom)); }
  .pc-foot-left { flex-basis: 100%; }
  .pc-foot-left.is-dirty .pc-foot-note { display: none; }
  .pc-foot-right { width: 100%; }
  .pc-foot-right > .btn { flex: 1 1 auto; }
}

/* ── Revisar ── */
.pc-rv-slots { display: flex; gap: var(--s2); flex-wrap: wrap; }
.pc-rv-slot { display: inline-flex; align-items: center; gap: var(--s2); padding: var(--s1) var(--s3); border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: var(--fs-sm); }
.pc-rv-slot strong { color: var(--text); font-weight: 600; }
.pc-rv-page > div > .callout { margin-bottom: var(--s4); }
.pc-rv { display: grid; grid-template-columns: minmax(250px, 330px) minmax(0, 1fr); gap: var(--s6); align-items: start; }
.pc-rv-list { list-style: none; margin: 0; padding: var(--s1); display: flex; flex-direction: column; gap: var(--s2);
  position: sticky; top: var(--s4); max-height: calc(100vh - 160px); overflow-y: auto; }
.pc-rv-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; width: 100%;
  padding: var(--s2) var(--s3); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: inherit; text-align: left;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease); }
.pc-rv-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.pc-rv-item[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.pc-rv-item:focus-visible { box-shadow: var(--focus); border-radius: var(--r); }
.pc-rv-thumb { width: 40px; aspect-ratio: 9 / 16; border-radius: var(--r-sm); overflow: hidden; background: var(--bg-sunken); display: grid; place-items: center; color: var(--text-3); }
.pc-rv-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pc-rv-meta { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.pc-rv-title { font-weight: 600; font-size: var(--fs-sm); line-height: 1.35; }
.pc-rv-sub { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-xs); min-width: 0; }
.pc-rv-chev { color: var(--text-3); display: none; }

.pc-rv-detail { display: flex; flex-direction: column; gap: var(--s4); padding: var(--s5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.pc-rv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.pc-rv-headtext { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.pc-rv-headtext h2 { font-size: var(--fs-xl); }
.pc-rv-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s6); align-items: start; }
.pc-rv-media { display: flex; justify-content: center; }
.pc-phone.pc-phone-lg { height: clamp(380px, calc(100vh - 290px), 640px); }
.pc-rv-info { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.pc-rv-block { display: flex; flex-direction: column; gap: var(--s2); padding-bottom: var(--s4); border-bottom: 1px solid var(--border); }
.pc-rv-block h3 { font-size: var(--fs-md); }
.pc-rv-caption { font-size: var(--fs-md); color: var(--text); max-height: 240px; overflow-y: auto; }
.pc-rv-when { flex-direction: row; align-items: center; color: var(--text-2); font-size: var(--fs-sm); border-bottom: 0; padding-bottom: 0; }
.pc-rv-when .icon { color: var(--warning); }
.pc-rv-actions { display: flex; gap: var(--s3); flex-wrap: wrap; }
.pc-rv-actions .btn-primary { flex: 1 1 220px; }
.pc-link { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 2px 4px; color: var(--accent-text); font-size: var(--fs-sm); font-weight: 600; border-radius: var(--r-sm); }
.pc-link:hover { text-decoration: underline; }
.pc-kbd-help { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); align-items: center; font-size: var(--fs-xs); color: var(--text-3); }
.pc-kbd-help > span { display: inline-flex; align-items: center; gap: 4px; }
.pc-kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  border-bottom-width: 2px; background: var(--surface-2); color: var(--text); font-family: var(--font-mono); font-size: 11px; line-height: 1; }

/* Todo revisado */
.pc-rv-done { position: relative; margin: var(--s6) auto 0; max-width: 560px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.pc-rv-done::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.9;
  background:
    radial-gradient(circle at 18% 22%, var(--accent) 0 3px, transparent 4px),
    radial-gradient(circle at 82% 18%, var(--ai) 0 3px, transparent 4px),
    radial-gradient(circle at 70% 78%, var(--success) 0 3px, transparent 4px),
    radial-gradient(circle at 26% 74%, var(--info) 0 2px, transparent 3px),
    radial-gradient(circle at 50% 10%, var(--lang-es) 0 2px, transparent 3px),
    radial-gradient(circle at 90% 55%, var(--accent) 0 2px, transparent 3px),
    radial-gradient(circle at 8% 50%, var(--ai) 0 2px, transparent 3px),
    radial-gradient(600px 220px at 50% 0%, var(--success-soft), transparent 70%); }
.pc-rv-done .empty { position: relative; padding: var(--s12) var(--s6); }
.pc-rv-done .empty-icon { width: 64px; height: 64px; border-radius: var(--r-full); background: var(--success-soft); color: var(--success); animation: pc-pop 0.5s var(--ease); }
.pc-rv-done .empty-icon .icon { width: 32px; height: 32px; }
.pc-rv-done .empty h3 { font-size: var(--fs-xl); }
@keyframes pc-pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }

@media (max-width: 1280px) {
  .pc-rv-grid { grid-template-columns: minmax(0, 1fr); }
  .pc-phone.pc-phone-lg { height: clamp(340px, 60vh, 560px); }
}
@media (max-width: 900px) {
  .pc-rv { grid-template-columns: minmax(0, 1fr); }
  .pc-rv-detail-host { display: none; }
  .pc-rv-list { position: static; max-height: none; overflow: visible; padding: 0; }
  .pc-rv-item { grid-template-columns: 48px minmax(0, 1fr) auto; min-height: 64px; }
  .pc-rv-thumb { width: 48px; }
  .pc-rv-chev { display: block; }
  .pc-rv-slots { width: 100%; }
}
