/* Vista «Mensajes automáticos» (prefijo au-). Solo variables de tokens.css. */

.au-label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.au-detail { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); overflow-wrap: anywhere; }

/* ── Explicación en 3 pasos ── */
.au-hero { padding: var(--s8) var(--s6); display: flex; flex-direction: column; gap: var(--s8); align-items: center; text-align: center; }
.au-hero-head { display: flex; flex-direction: column; align-items: center; gap: var(--s3); max-width: 60ch; }
.au-hero-head h2 { font-size: var(--fs-xl); }
.au-hero-head p { color: var(--text-2); }
.au-hero-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r-lg); background: var(--accent-soft); color: var(--accent-text); }
.au-hero-icon .icon { width: 26px; height: 26px; }
.au-hero-foot { display: flex; flex-direction: column; align-items: center; gap: var(--s3); }

.au-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s6); width: 100%; max-width: 980px; text-align: left; counter-reset: none; }
.au-step { position: relative; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s5); border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.au-step:not(:last-child)::after {
  content: ""; position: absolute; top: 34px; right: calc(-1 * var(--s6) + 6px); width: calc(var(--s6) - 12px); height: 2px;
  background: linear-gradient(90deg, var(--border-strong), var(--accent)); border-radius: var(--r-full);
}
.au-step h3 { font-size: var(--fs-md); }
.au-step p { font-size: var(--fs-sm); color: var(--text-2); }
.au-step-top { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s1); }
.au-step-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--text-on-accent); font-size: var(--fs-xs); font-weight: 700; }
.au-step-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r); background: var(--surface); color: var(--accent-text); border: 1px solid var(--border); }
.au-step-mock { margin-top: auto; padding-top: var(--s3); }
.au-mock-comment { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); padding: var(--s2) var(--s3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-full); }
.au-mock-comment .avatar { width: 24px; height: 24px; font-size: 10px; }
.au-mock-bubble { display: inline-block; font-size: var(--fs-sm); padding: var(--s2) var(--s3); background: var(--surface-3); border-radius: 18px 18px 18px 6px; color: var(--text); }
.au-mock-link { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; padding: 6px var(--s3); border-radius: var(--r-full); background: var(--info-soft); color: var(--info); }

.au-steps-compact { gap: var(--s4); max-width: none; }
.au-steps-compact .au-step { padding: var(--s4); background: transparent; }
.au-steps-compact .au-step:not(:last-child)::after { top: 28px; right: calc(-1 * var(--s4) + 3px); width: calc(var(--s4) - 6px); }
.au-intro { padding: var(--s4) var(--s5) var(--s5); display: flex; flex-direction: column; gap: var(--s3); }
.au-intro-title { font-size: var(--fs-md); }

/* ── Resumen y barra ── */
.au-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1180px) { .au-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .au-stats .stat { padding: var(--s3); } .au-stats .stat-value { font-size: var(--fs-xl); } }
.au-toolbar { margin-bottom: 0; }

/* ── Tarjetas ── */
.au-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: var(--s4); align-items: start; }
.au-grid-empty { grid-column: 1 / -1; }
.au-card { display: flex; flex-direction: column; transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.au-card:hover { border-color: var(--border-strong); }
.au-card-head { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s3) var(--s2) var(--s4); }
.au-card-title { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; padding: 4px 2px; font-size: var(--fs-md); font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: var(--r-sm); }
.au-card-title:hover { color: var(--accent-text); }
.au-card-body { display: flex; flex-direction: column; gap: var(--s3); padding: 0 var(--s4) var(--s4); flex: 1; min-width: 0; }
.au-card.is-paused .au-card-body, .au-card.is-paused .au-card-title, .au-card.is-paused .au-metrics { opacity: 0.6; }

.au-where { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.au-where-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.au-where-title { font-size: var(--fs-sm); font-weight: 550; color: var(--text); }
.au-thumb { flex: none; width: 40px; height: 52px; border-radius: var(--r-sm); overflow: hidden; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); }
.au-thumb img { width: 100%; height: 100%; object-fit: cover; }

.au-kws { display: flex; flex-wrap: wrap; gap: 6px; }
.au-kw { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--r-full); background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.02em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-kw-more { background: var(--surface-3); color: var(--text-2); }

.au-msg { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s2) var(--s3); background: var(--surface-2); border-radius: var(--r); color: var(--text-2); font-size: var(--fs-sm); min-width: 0; }
.au-msg > .icon { margin-top: 2px; color: var(--text-3); }
.au-msg p { min-width: 0; overflow-wrap: anywhere; white-space: pre-line; }
.au-var { display: inline-block; padding: 0 5px; border-radius: 4px; background: var(--ai-soft); color: var(--ai); font-weight: 600; font-size: 0.92em; }
.au-url { color: var(--info); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.au-flags { display: flex; flex-wrap: wrap; gap: 6px; }

.au-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; padding: var(--s3) var(--s4); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.au-switch { justify-content: flex-start; align-items: center; gap: var(--s2); min-height: 36px; }
.au-switch .switch-track { margin-top: 0; }
.au-switch-text { font-size: var(--fs-sm); font-weight: 600; color: var(--text); min-width: 64px; }
.au-switch input:not(:checked) ~ .au-switch-text { color: var(--text-3); }
.au-metrics { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-2); }
.au-metric { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.au-metric strong { color: var(--text); font-weight: 650; }
.au-metric .icon { color: var(--text-3); }
.au-metric-bad { border: 0; background: var(--danger-soft); color: var(--danger); padding: 2px 8px; border-radius: var(--r-full); font-size: var(--fs-sm); }
.au-metric-bad strong, .au-metric-bad .icon { color: var(--danger); }
.au-metric-bad:hover { text-decoration: underline; }

/* ── Registro ── */
.au-logs { display: flex; flex-direction: column; gap: var(--s4); }
.au-log-skel { height: 64px; border-radius: var(--r); }
.au-logs > .segmented { align-self: flex-start; }
.au-logstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--s2); }
.au-ministat { display: flex; flex-direction: column; gap: 2px; padding: var(--s2) var(--s3); border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.au-ministat strong { font-size: var(--fs-xl); line-height: 1.2; }
.au-ministat span { font-size: var(--fs-xs); color: var(--text-3); }
.au-ministat.is-danger strong { color: var(--danger); }
.au-loglist { list-style: none; margin: 0; padding: 0; }
.au-log { align-items: flex-start; }
.au-log.is-failed { background: color-mix(in srgb, var(--danger-soft) 50%, transparent); }
.au-log-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.au-log-head { display: flex; align-items: baseline; gap: var(--s2); min-width: 0; }
.au-log-text { font-size: var(--fs-sm); color: var(--text); overflow-wrap: anywhere; }
.au-log-err { display: flex; gap: 6px; align-items: flex-start; font-size: var(--fs-xs); color: var(--danger); overflow-wrap: anywhere; }
.au-log-err .icon { margin-top: 1px; }
.au-misses { display: flex; gap: 6px; align-items: flex-start; }

/* ── Editor ── */
.au-dlg .dlg-body { padding: 0; }
.au-editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: 100%; }
.au-form { display: flex; flex-direction: column; gap: var(--s5); padding: var(--s5); counter-reset: au-sec; min-width: 0; }
.au-form-err:empty { display: none; }
.au-side { border-left: 1px solid var(--border); background: var(--bg-sunken); padding: var(--s5); }
.au-side > * { position: sticky; }
.au-side-head { top: 0; display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--s3); }
.au-preview { top: 56px; display: flex; flex-direction: column; gap: var(--s3); }

.au-sec { display: flex; flex-direction: column; gap: var(--s3); padding-top: var(--s5); border-top: 1px solid var(--border); counter-increment: au-sec; }
.au-sec-head { display: flex; gap: var(--s3); align-items: flex-start; }
.au-sec-num { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-sm); font-weight: 700; }
.au-sec-num::before { content: counter(au-sec); }
.au-sec-titles { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.au-sec-titles h3 { font-size: var(--fs-md); }
.au-sec-titles p { font-size: var(--fs-sm); color: var(--text-2); }
.au-sec-body { padding-left: calc(26px + var(--s3)); }
.au-sec > .au-err, .au-err { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-sm); color: var(--danger); margin: 0; }
.au-sec > .au-err { padding-left: calc(26px + var(--s3)); }
.au-err .icon { margin-top: 2px; }
.au-err[hidden] { display: none; }

.au-account-fixed { display: flex; align-items: center; gap: var(--s2); min-height: 38px; flex-wrap: wrap; }
.au-form .segmented { flex-wrap: wrap; max-width: 100%; }

/* Ámbito: tarjetas de opción */
.au-scope { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.au-scope-opt { display: flex; align-items: flex-start; gap: var(--s3); text-align: left; padding: var(--s3); border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); transition: border-color 0.15s, background 0.15s; }
.au-scope-opt:hover { background: var(--surface-2); }
.au-scope-opt[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.au-scope-icon { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-2); }
.au-scope-opt[aria-checked="true"] .au-scope-icon { background: var(--accent); color: var(--text-on-accent); }
.au-scope-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.au-scope-text strong { font-size: var(--fs-sm); font-weight: 650; }
.au-scope-text span { font-size: var(--fs-xs); color: var(--text-2); }

/* Selector de publicaciones */
.au-posts { display: flex; flex-direction: column; gap: var(--s2); align-items: flex-start; }
.au-posts > * { width: 100%; }
.au-posts > .btn { width: auto; }
.au-posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: var(--s2); }
.au-post-skel { aspect-ratio: 3 / 4; border-radius: var(--r); }
.au-post { display: flex; flex-direction: column; gap: 0; padding: 0; text-align: left; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--text); overflow: hidden; min-width: 0; transition: border-color 0.15s, box-shadow 0.15s; }
.au-post:hover { border-color: var(--border-strong); }
.au-post[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.au-post:focus-visible { box-shadow: var(--focus); }
.au-post-media { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 5; background: var(--surface-2); color: var(--text-3); overflow: hidden; }
.au-post-media img { width: 100%; height: 100%; object-fit: cover; }
.au-post-check { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--text-on-accent); box-shadow: var(--shadow-sm); }
.au-post-check .icon { stroke-width: 2.6; }
.au-post-meta { display: flex; flex-direction: column; gap: 4px; padding: var(--s2); min-width: 0; }
.au-post-cap { font-size: var(--fs-xs); line-height: 1.35; overflow-wrap: anywhere; }
.au-post-sub { display: flex; justify-content: space-between; gap: var(--s1); font-size: 11px; color: var(--text-3); }
.au-post-comments { display: inline-flex; align-items: center; gap: 3px; }
.au-post-comments .icon { width: 12px; height: 12px; }

/* Palabras clave en chips */
.au-kwbox { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 42px; padding: 5px 8px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--bg-sunken); cursor: text; transition: border-color 0.15s, box-shadow 0.15s; }
.au-kwbox:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.au-kwbox:has(input[aria-invalid="true"]) { border-color: var(--danger); }
.au-kw-chips { display: contents; list-style: none; margin: 0; padding: 0; }
.au-kwchip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 10px; border-radius: var(--r-full); background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-sm); font-weight: 650; max-width: 100%; }
.au-kwchip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-kwchip .chip-x { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: inherit; opacity: 0.8; }
.au-kwchip .chip-x:hover { opacity: 1; background: color-mix(in srgb, var(--accent) 22%, transparent); }
.au-kwchip.is-flash { animation: au-flash 0.6s var(--ease); }
input.au-kw-input, input.au-kw-input:hover, input.au-kw-input:focus { flex: 1 1 120px; width: auto; min-width: 100px; min-height: 30px; padding: 2px 4px; border: 0; background: transparent; box-shadow: none; }
@keyframes au-flash { 0%, 100% { transform: none; } 30% { transform: scale(1.08); box-shadow: 0 0 0 3px var(--accent-soft); } }

.au-msg-tools { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.au-adv > .fold-body { padding-top: var(--s2); }
.au-adv > summary .icon { color: var(--text-3); }

/* Vista previa tipo Instagram */
.au-phone { border-radius: 22px; border: 1px solid var(--border-strong); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.au-phone-top { display: flex; align-items: center; gap: var(--s2); padding: var(--s3); border-bottom: 1px solid var(--border); }
.au-phone-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.au-phone-who strong { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-phone-who span { font-size: var(--fs-xs); color: var(--text-3); }
.au-phone-chat { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4) var(--s3) var(--s5); min-height: 220px; }
.au-ctx { align-self: center; text-align: center; font-size: 11px; color: var(--text-3); max-width: 90%; overflow-wrap: anywhere; margin-bottom: var(--s2); }
.au-gate { display: flex; gap: 6px; align-items: center; align-self: flex-start; font-size: var(--fs-xs); color: var(--text-2); padding: 6px 10px; border: 1px dashed var(--border-strong); border-radius: var(--r); }
.au-bubble-wrap { align-self: flex-start; max-width: 88%; display: flex; flex-direction: column; }
.au-bubble { padding: 9px 13px; border-radius: 20px 20px 20px 6px; background: var(--surface-3); color: var(--text); font-size: var(--fs-sm); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.au-bubble.is-placeholder { color: var(--text-3); font-style: italic; }
.au-bubble-wrap.has-button .au-bubble { border-radius: 20px 20px 0 0; }
.au-bubble-btn { padding: 9px 13px; text-align: center; font-size: var(--fs-sm); font-weight: 650; color: var(--info); background: var(--surface-2); border: 1px solid var(--surface-3); border-top: 1px solid var(--border-strong); border-radius: 0 0 20px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-var-sample { font-weight: 650; }
.au-pubreply { display: flex; flex-direction: column; gap: 4px; padding: var(--s3); border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* ── Móvil y pantallas medianas ── */
@media (max-width: 960px) {
  .au-editor { grid-template-columns: 1fr; }
  .au-side { border-left: 0; border-top: 1px solid var(--border); }
  .au-side > * { position: static; }
}
@media (max-width: 860px) {
  .au-steps { grid-template-columns: 1fr; gap: var(--s4); }
  .au-step:not(:last-child)::after { top: auto; bottom: calc(-1 * var(--s4) + 3px); left: 34px; right: auto; width: 2px; height: calc(var(--s4) - 6px); background: linear-gradient(180deg, var(--border-strong), var(--accent)); }
  .au-steps-compact .au-step:not(:last-child)::after { left: 28px; }
  .au-step-mock { display: none; }
}
@media (max-width: 720px) {
  .au-hero { padding: var(--s6) var(--s4); gap: var(--s6); }
  .au-form, .au-side { padding: var(--s4); }
  .au-sec-body, .au-sec > .au-err { padding-left: 0; }
  .au-scope { grid-template-columns: 1fr; }
  .au-posts-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .au-toolbar .search { flex-basis: 100%; max-width: none; }
  .au-card-head { padding-left: var(--s3); }
  .au-card-body { padding: 0 var(--s3) var(--s3); }
  .au-card-foot { padding: var(--s2) var(--s3); }
}
