/**
 * Estúdio de Posts · Imperius — mesmo sistema visual do Prospect Imperius ("Mesa clara").
 * Neutros puxados pro violeta da marca; o berinjela só aparece em ação ou estado.
 * Profundidade por linha e superfície, quase nunca por sombra.
 * Tema: `data-tema="claro|escuro"` na raiz vence; sem atributo, segue o sistema.
 */

:root {
  --fundo: #f6f5f9;
  --sup: #ffffff;
  --sup-2: #fbfafd;
  --campo: #f6f5f9;
  --tinta: #1c1824;
  --suave: #6d6778;
  --fraco: #6f6979;
  --linha: #e7e4ed;
  --linha-forte: #dedae5;
  --divisor: #efedf3;
  --acento: #5a2d8c;
  --selecao: #f5f0fb;
  --botao: #5a2d8c;
  --botao-hover: #4b2475;
  --botao-texto: #ffffff;
  --realce-fundo: #eee6f8;
  --realce: #5a2d8c;
  --espera: #8a5a00;
  --espera-fundo: #fdf3e0;
  --ok: #16703a;
  --ok-fundo: #e5f3ea;
  --erro: #b3261e;
  --erro-fundo: #fcebea;
  --erro-solido: #b3261e;
  --erro-solido-texto: #ffffff;
  --nav-ativo: #ffffff;
  --nav-ativo-anel: #e4e1ea;
  --trilho-tema: #ece9f1;
  --dica-fundo: #1c1824;
  --dica-texto: #ffffff;
  --medidor-fundo: #e9e2f3;
  --medidor: #5a2d8c;
  --sombra-pop: 0 10px 30px -8px rgba(28, 24, 36, 0.22), 0 0 0 1px rgba(28, 24, 36, 0.06);
  /* Movimento: uma curva e três tempos para o Estúdio inteiro. */
  --curva: cubic-bezier(0.2, 0.72, 0.28, 1);
  --rapido: 0.13s;
  --medio: 0.22s;
  --calmo: 0.34s;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --fundo: #141218;
    --sup: #1b1921;
    --sup-2: #17151c;
    --campo: #141218;
    --tinta: #ece9f2;
    --suave: #a39daf;
    --fraco: #8e879d;
    --linha: #2a2732;
    --linha-forte: #36323f;
    --divisor: #221f28;
    --acento: #bba0ec;
    --selecao: #221d2c;
    --botao: #7a4bc0;
    --botao-hover: #8a5bd0;
    --botao-texto: #ffffff;
    --realce-fundo: #2a2238;
    --realce: #bba0ec;
    --espera: #e0b356;
    --espera-fundo: #2e2415;
    --ok: #72cd97;
    --ok-fundo: #1b2c22;
    --erro: #f2a29b;
    --erro-fundo: #3a1f22;
    --erro-solido: #f2a29b;
    --erro-solido-texto: #2a1215;
    --nav-ativo: #221f29;
    --nav-ativo-anel: #2e2a36;
    --trilho-tema: #221f28;
    --dica-fundo: #ece9f2;
    --dica-texto: #141218;
    --medidor-fundo: #2e2640;
    --medidor: #9d78da;
    --sombra-pop: 0 12px 32px -8px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
    color-scheme: dark;
  }
}

:root[data-tema="escuro"] {
  --fundo: #141218;
  --sup: #1b1921;
  --sup-2: #17151c;
  --campo: #141218;
  --tinta: #ece9f2;
  --suave: #a39daf;
  --fraco: #8e879d;
  --linha: #2a2732;
  --linha-forte: #36323f;
  --divisor: #221f28;
  --acento: #bba0ec;
  --selecao: #221d2c;
  --botao: #7a4bc0;
  --botao-hover: #8a5bd0;
  --botao-texto: #ffffff;
  --realce-fundo: #2a2238;
  --realce: #bba0ec;
  --espera: #e0b356;
  --espera-fundo: #2e2415;
  --ok: #72cd97;
  --ok-fundo: #1b2c22;
  --erro: #f2a29b;
  --erro-fundo: #3a1f22;
  --erro-solido: #f2a29b;
  --erro-solido-texto: #2a1215;
  --nav-ativo: #221f29;
  --nav-ativo-anel: #2e2a36;
  --trilho-tema: #221f28;
  --dica-fundo: #ece9f2;
  --dica-texto: #141218;
  --medidor-fundo: #2e2640;
  --medidor: #9d78da;
  --sombra-pop: 0 12px 32px -8px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--fundo);
  color: var(--tinta);
  font: 14px/1.45 "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.5; }
svg { flex: 0 0 auto; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; border-radius: inherit; }

.mono { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; }
.pequeno { font-size: 12px; }
.suave { color: var(--suave); }
.dica { font-size: 12px; color: var(--fraco); }
.lbl { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--suave); }
.opcional { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--fraco); opacity: 0.8; margin-left: 4px; }
.espaco { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* --------------------------------------------------------------- casca */

.casca { display: flex; height: 100vh; min-height: 560px; overflow: hidden; }

.menu {
  width: 232px; flex: 0 0 232px;
  display: flex; flex-direction: column; gap: 22px;
  padding: 20px 14px; overflow-y: auto;
}
.marca { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.marca img { width: 32px; height: 32px; }
.marca b { display: block; font-weight: 700; font-size: 15px; line-height: 1.1; letter-spacing: 0.2px; }
.marca span { display: block; font-size: 12px; color: var(--suave); line-height: 1.2; }

.nav-lista { display: flex; flex-direction: column; gap: 2px; }
.nav {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 36px; padding: 0 10px; border-radius: 8px;
  color: var(--suave); font-weight: 500; text-align: left;
}
.nav:hover { color: var(--tinta); background: var(--selecao); }
.nav.on { background: var(--nav-ativo); color: var(--tinta); box-shadow: 0 0 0 1px var(--nav-ativo-anel); }
.nav.on svg { color: var(--acento); }
.cnt { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--fraco); }

.menu-pe { margin-top: auto; display: flex; flex-direction: column; gap: 14px; padding: 0 6px; }
.conexoes { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.conexao { display: flex; align-items: center; gap: 8px; color: var(--suave); }
.conexao i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.conexao.falta i { background: var(--erro); }
.conexao b { font-weight: 500; color: var(--tinta); }
.conexao.demo { color: var(--realce); }
.conexao.demo i { background: var(--realce); }
.separa { padding-top: 14px; border-top: 1px solid var(--linha); }
.tema { display: flex; align-items: center; justify-content: space-between; }
.tema > span { font-size: 12px; color: var(--suave); }
.tema-opcoes { display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--trilho-tema); }
.tema-opcoes button { width: 30px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--fraco); }
.tema-opcoes button.on { background: var(--sup); color: var(--tinta); box-shadow: 0 0 0 1px var(--linha-forte); }
.tema-opcoes svg { width: 14px; height: 14px; }

.principal {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background: var(--sup-2); border-left: 1px solid var(--linha); overflow: hidden;
}
.vista { flex: 1; min-height: 0; }
.rolavel { overflow-y: auto; padding: 28px 32px 48px; }

.cab { margin-bottom: 22px; }
.cab h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.2px; }
.cab p { color: var(--suave); margin-top: 4px; }
.cab-linha { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.aviso {
  margin: 16px 24px 0; padding: 10px 14px; border-radius: 9px; font-size: 13px;
  background: var(--erro-fundo); color: var(--tinta); border: 1px solid var(--linha);
}
.aviso code { font-family: "IBM Plex Mono", monospace; font-size: 12px; }

.offline {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 10px 24px; font-size: 13px;
  background: var(--erro-fundo); color: var(--tinta); border-bottom: 1px solid var(--linha);
}
.offline b { color: var(--erro); font-weight: 600; }
.offline i { width: 8px; height: 8px; border-radius: 50%; background: var(--erro); flex: none; animation: pulsar 1.4s ease-in-out infinite; }
@keyframes pulsar { 50% { opacity: 0.3; } }
.erro-form { margin: 0 22px 12px; padding: 9px 12px; border-radius: 8px; font-size: 13px; background: var(--erro-fundo); color: var(--erro); }

/* ------------------------------------------------------------ controles */

input, select, textarea {
  font: inherit; color: var(--tinta); width: 100%;
  background: var(--campo); border: 1px solid var(--linha); border-radius: 8px;
  padding: 8px 10px; transition: border-color 0.12s;
}
select { height: 36px; padding: 0 8px; }
/* A lista aberta do select usa estas cores (senão, no tema escuro, pode vir texto claro em fundo branco). */
option, optgroup { background: var(--sup); color: var(--tinta); }
input { height: 36px; }
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--fraco); }
input:hover, select:hover, textarea:hover { border-color: var(--linha-forte); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acento); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 8px; white-space: nowrap;
  font-weight: 600; font-size: 13px; color: var(--tinta);
  background: var(--sup); box-shadow: 0 0 0 1px var(--linha-forte) inset;
  transition: background 0.12s;
}
.btn:hover:not(:disabled) { background: var(--selecao); }
a.btn { text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
.btn.primario { background: var(--botao); color: var(--botao-texto); box-shadow: none; }
.btn.primario:hover:not(:disabled) { background: var(--botao-hover); }
.btn.fantasma { background: transparent; box-shadow: none; color: var(--suave); }
.btn.fantasma:hover:not(:disabled) { color: var(--tinta); background: var(--selecao); }
.btn.perigo { color: var(--erro); }
.btn.pequeno { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.grande { height: 42px; width: 100%; font-size: 14px; }
.btn:disabled { background: var(--campo); box-shadow: 0 0 0 1px var(--linha) inset; color: var(--fraco); cursor: not-allowed; opacity: 1; }
.btn[aria-busy="true"] { cursor: progress; opacity: 0.7; }
.link { color: var(--acento); font-size: 12.5px; font-weight: 500; }
.link:hover { text-decoration: underline; }
.icone-btn { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--fraco); }
.icone-btn:hover { color: var(--tinta); background: var(--selecao); }
.icone-btn svg { width: 16px; height: 16px; }

.chave { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; user-select: none; }
.chave input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chave span { width: 30px; height: 18px; border-radius: 9px; background: var(--linha-forte); position: relative; transition: background 0.15s; flex: none; }
.chave span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgb(0 0 0 / 0.2); }
.chave input:checked + span { background: var(--botao); }
.chave input:checked + span::after { transform: translateX(12px); }
.chave input:focus-visible + span { outline: 2px solid var(--acento); outline-offset: 2px; }

/* ------------------------------------------------------------ criar post */

#vista-criar { display: flex; overflow: hidden; }
.form-col {
  width: 400px; flex: 0 0 400px; overflow-y: auto;
  padding: 28px 24px 32px; border-right: 1px solid var(--linha);
  display: flex; flex-direction: column;
}
.bloco { padding: 16px 0; border-top: 1px solid var(--divisor); display: flex; flex-direction: column; gap: 8px; }
.cab + .bloco { border-top: 0; padding-top: 0; }
.bloco-topo { display: flex; align-items: center; justify-content: space-between; }
.grade2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.chaves { flex-direction: row; gap: 22px; flex-wrap: wrap; }

.zona-refs { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; border: 1px dashed var(--linha-forte); border-radius: 9px; background: var(--sup-2); }
.zona-refs.arrastando { border-color: var(--acento); background: var(--selecao); }
.lista-refs { display: flex; gap: 8px; flex-wrap: wrap; }
.lista-refs:empty { display: none; }
.ref { position: relative; width: 56px; height: 56px; }
.ref img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; box-shadow: 0 0 0 1px var(--linha); }
.ref span { position: absolute; left: 4px; bottom: 3px; font: 600 10px "IBM Plex Mono", monospace; color: #fff; text-shadow: 0 1px 2px #000; }
.ref button { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--tinta); color: var(--sup); display: flex; align-items: center; justify-content: center; }
.ref button svg { width: 11px; height: 11px; }

.avancado summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
.avancado summary::-webkit-details-marker { display: none; }
.avancado summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; margin-right: 2px; }
.avancado[open] summary::before { transform: rotate(45deg); }
.avancado[open] summary { margin-bottom: 6px; }

.acao { margin-top: auto; padding: 14px 0 4px; position: sticky; bottom: -32px; background: var(--sup); border-top: 1px solid var(--divisor); }

.etapas { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; max-height: 128px; overflow-y: auto; }
.etapas li { display: flex; gap: 9px; align-items: flex-start; color: var(--suave); }
.etapas li::before { content: ""; width: 14px; height: 14px; margin-top: 2px; border-radius: 50%; border: 1.5px solid var(--linha-forte); flex: none; box-sizing: border-box; }
.etapas li.ativa { color: var(--tinta); }
.etapas li.ativa::before { border-color: var(--acento); border-right-color: transparent; animation: girar 0.8s linear infinite; }
.etapas li.feita::before { border: 0; background: var(--acento) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 9px no-repeat; }
.etapas li.falhou { color: var(--erro); }
.etapas li.falhou::before { border-color: var(--erro); }
@keyframes girar { to { transform: rotate(360deg); } }

.resultado-col { flex: 1; min-width: 0; overflow-y: auto; padding: 28px 32px 48px; background: var(--sup-2); }

.vazio { min-height: 360px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; text-align: left; gap: 8px; padding-top: 8px; color: var(--suave); }
.vazio .esqueleto { width: 180px; aspect-ratio: 4 / 5; border: 1px dashed var(--linha-forte); border-radius: 10px; margin-bottom: 14px; }
.vazio b { color: var(--tinta); font-weight: 600; font-size: 15px; }
.vazio p { max-width: 380px; }

.post-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.post-titulo { flex: 1; min-width: 240px; }
.post-titulo h2 { font-size: 19px; font-weight: 600; letter-spacing: -0.2px; }
.post-titulo p { margin-top: 3px; }
.post-acoes { display: flex; gap: 8px; }
.pauta { margin-top: 14px; padding: 10px 14px; border-radius: 0 9px 9px 0; background: var(--sup-2); border-left: 3px solid var(--linha-forte); color: var(--tinta); font-size: 13px; max-width: 760px; }
.pauta:empty { display: none; }
.pauta b { color: var(--realce); font-weight: 600; }

.slides { display: flex; gap: 16px; overflow-x: auto; padding: 20px 0 12px; scroll-snap-type: x mandatory; }
.slide { flex: 0 0 auto; width: 300px; scroll-snap-align: start; background: var(--sup); border-radius: 10px; border: 1px solid var(--linha); overflow: hidden; display: flex; flex-direction: column; }
.slides.um .slide { width: min(420px, 100%); }
.arte { position: relative; background: var(--divisor); }
.arte canvas { width: 100%; height: 100%; display: block; }
.arte .estado { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; font-size: 12.5px; color: var(--suave); padding: 24px; }
.arte .estado.erro { color: var(--erro); background: var(--erro-fundo); }
.barra { width: 60%; max-width: 160px; height: 3px; border-radius: 3px; background: var(--medidor-fundo); overflow: hidden; }
.barra i { display: block; width: 35%; height: 100%; background: var(--medidor); border-radius: 3px; animation: correr 1.3s ease-in-out infinite; }
@keyframes correr { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.slide-corpo { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--linha); }
.slide-info { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.texto-arte { font-weight: 600; font-size: 13.5px; }
.versoes { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; color: var(--suave); }
.versoes .icone-btn { width: 22px; height: 22px; }
.versoes .icone-btn svg { width: 13px; height: 13px; }
.slide textarea { font: 12px/1.5 "IBM Plex Mono", monospace; }
.slide-acoes { display: flex; gap: 4px; flex-wrap: wrap; margin-left: -6px; }

.copy-grade { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; margin-top: 8px; }
.painel { background: var(--sup); border-radius: 10px; border: 1px solid var(--linha); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.painel-topo { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#salvo.erro { color: var(--erro); }
.painel-topo:not(:first-child) { margin-top: 8px; }
.painel.info { gap: 16px; }
.painel.info > div { display: flex; flex-direction: column; gap: 4px; }
.painel.info summary { cursor: pointer; }
.painel.info details p { margin-top: 6px; white-space: pre-wrap; }

/* ------------------------------------------------------------ posts */

.grade-posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
.card-post { position: relative; min-width: 0; }
.card-post .abrir { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.card-post .capa { aspect-ratio: 4 / 5; width: 100%; border-radius: 9px; object-fit: cover; background: var(--divisor); border: 1px solid var(--linha); display: block; }
.card-post .abrir:hover .capa { border-color: var(--tinta); }
.card-post b { font-weight: 600; font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-post .dica { display: block; }
.card-post .icone-btn { position: absolute; top: 8px; right: 8px; background: var(--sup); box-shadow: 0 0 0 1px var(--linha); opacity: 0; transition: opacity 0.12s; }
.card-post:hover .icone-btn, .card-post:focus-within .icone-btn { opacity: 1; }
.card-post .icone-btn:hover { color: var(--erro); }

/* ------------------------------------------------------------ templates */

.template-escolha { display: flex; gap: 10px; align-items: center; }
.previa-template { width: 30px; height: 38px; object-fit: cover; border-radius: 5px; box-shadow: 0 0 0 1px var(--linha); flex: none; }

.upload-templates {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  padding: 16px; margin-bottom: 20px; border-radius: 10px;
  border: 1px dashed var(--linha-forte); background: var(--sup-2);
}
.upload-templates.arrastando { border-color: var(--acento); background: var(--selecao); }
.upload-templates .campo { width: 240px; }
.upload-templates .dica { align-self: center; }
.filtro-templates { max-width: 260px; margin-bottom: 16px; }

.grade-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.card-template { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.card-template img { width: 100%; object-fit: cover; border-radius: 9px; background: var(--divisor); border: 1px solid var(--linha); display: block; }
.card-template:hover img { border-color: var(--tinta); }
.card-template b { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-template .linha-info { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.etiqueta { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--realce-fundo); color: var(--realce); white-space: nowrap; }
.etiqueta.neutra { background: var(--divisor); color: var(--suave); }

.template-editar { flex-direction: row; gap: 18px; }
.tpl-previa { width: 170px; flex: none; align-self: flex-start; border-radius: 8px; object-fit: contain; background: var(--divisor); box-shadow: 0 0 0 1px var(--linha); }
.template-campos { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

/* ------------------------------------------------------------ entrar / convite */

.tela-acesso { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: var(--fundo); }
.cartao-acesso { width: min(420px, 100%); background: var(--sup); border-radius: 14px; border: 1px solid var(--linha); padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.cartao-acesso.largo { width: min(600px, 100%); }
.cartao-acesso form, .cartao-acesso .passo { display: flex; flex-direction: column; gap: 14px; }
.cartao-acesso h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.2px; }
.marca-acesso { padding: 0; }
.marca-acesso img { width: 36px; height: 36px; }
.passos { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; counter-reset: passo; }
.passos li { flex: 1; font-size: 12px; font-weight: 500; color: var(--fraco); padding-top: 8px; border-top: 3px solid var(--linha); counter-increment: passo; }
.passos li::before { content: counter(passo) ". "; }
.passos li.feito { border-top-color: var(--medidor); color: var(--suave); }
.passos li.atual { border-top-color: var(--botao); color: var(--tinta); }
.cores-linha { display: flex; gap: 8px; align-items: center; }
.cores-linha input { flex: 1; }
.lista-fotos { display: flex; gap: 8px; flex-wrap: wrap; }
.lista-fotos:empty { display: none; }
.zona-fotos .ref { width: 72px; height: 72px; }
.caixa-instagram { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.ig-conta { display: flex; align-items: center; gap: 12px; }
.ig-conta img, .ig-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--linha); display: grid; place-items: center; color: var(--acento); background: var(--realce-fundo); flex: none; }
.ig-conta div { display: flex; flex-direction: column; }

/* ------------------------------------------------------------ portal do cliente */

.painel-form { max-width: 720px; display: flex; flex-direction: column; gap: 14px; }
h2.sub { font-size: 14px; font-weight: 600; margin: 26px 0 12px; }
.cab + #listaPortal h2.sub:first-child { margin-top: 0; }
.grade-portal { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card-post-cliente { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 12px; border-radius: 10px; background: var(--sup); border: 1px solid var(--linha); }
.card-post-cliente:hover { border-color: var(--linha-forte); background: var(--sup-2); }
.card-post-cliente.destaque { border-color: var(--botao); box-shadow: inset 0 0 0 1px var(--botao); }
.card-post-cliente img, .card-post-cliente .sem-capa { width: 72px; height: 90px; object-fit: cover; border-radius: 7px; background: var(--divisor); flex: none; }
.card-post-cliente div { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; min-width: 0; }
.card-post-cliente b { font-weight: 600; }

.modal-post { width: min(980px, calc(100vw - 32px)); }
.post-cliente { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.carrossel { position: relative; background: var(--divisor); border-radius: 10px; overflow: hidden; }
.carrossel img { width: 100%; display: block; }
.carrossel .anterior, .carrossel .proxima { position: absolute; top: 50%; transform: translateY(-50%); background: var(--sup); box-shadow: var(--sombra-pop); color: var(--tinta); }
.carrossel .anterior { left: 10px; }
.carrossel .proxima { right: 10px; }
.carrossel .icone-btn:disabled { opacity: 0.35; }
.pontos { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; }
.pontos i { width: 6px; height: 6px; border-radius: 50%; background: rgb(255 255 255 / 0.55); }
.pontos i.on { background: #fff; }
.post-texto { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.legenda-cliente { white-space: pre-wrap; line-height: 1.55; }
.acoes-cliente { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.acoes-cliente textarea { width: 100%; }
.historico ol { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--suave); }
.historico q { display: block; margin-top: 3px; color: var(--tinta); font-style: italic; }
.historico summary { cursor: pointer; }

.pagina-legal { max-width: 760px; margin: 0 auto; line-height: 1.6; }
.pagina-legal h1 { font-size: 22px; margin-bottom: 16px; }
.pagina-legal h2 { font-size: 15px; margin: 22px 0 6px; }
.pagina-legal p { margin-bottom: 10px; }

/* ------------------------------------------------------------ status do post (agência) */

.status-post { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--sup); border: 1px solid var(--linha); }
.status-post .texto { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.status-post q { font-style: italic; color: var(--tinta); }
.status-post .acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.status-post input[type="datetime-local"] { width: auto; height: 34px; }
.etiqueta.st-aguardando_cliente, .etiqueta.st-agendado { background: var(--espera-fundo); color: var(--espera); }
.etiqueta.st-ajustes_pedidos, .etiqueta.st-erro_publicacao { background: var(--erro-fundo); color: var(--erro); }
.etiqueta.st-aprovado_cliente, .etiqueta.st-publicado { background: var(--ok-fundo); color: var(--ok); }
.etiqueta.st-rascunho, .etiqueta.st-publicando { background: var(--divisor); color: var(--suave); }
.card-post .etiqueta { align-self: flex-start; }
.acesso-cliente { font-size: 12px; color: var(--suave); }
.card-cliente-acoes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.usuario-menu { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.usuario-menu .dica { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.linha-botoes { display: flex; gap: 6px; flex-wrap: wrap; }
.fotos-cliente .ref { cursor: pointer; }
.fotos-cliente .ref:hover img { box-shadow: 0 0 0 2px var(--acento); }
.aviso-local { font-size: 12.5px; padding: 9px 12px; border-radius: 8px; background: var(--realce-fundo); color: var(--tinta); }

/* ------------------------------------------------------------ acessos (superadmin) */

.lista-acessos { display: flex; flex-direction: column; border-radius: 10px; border: 1px solid var(--linha); background: var(--sup); overflow: hidden; }
.linha-acesso { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--divisor); flex-wrap: wrap; }
.linha-acesso:first-child { border-top: 0; }
.linha-acesso.desativado { opacity: 0.55; }
.linha-acesso .quem { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 2px; }
.linha-acesso .quem b { font-weight: 600; }
.linha-acesso .quem span { font-size: 12.5px; color: var(--suave); }
.linha-acesso .acoes { display: flex; gap: 6px; flex-wrap: wrap; }
.lista-acessos .lista-vazia { padding: 16px; }

/* ------------------------------------------------------------ clientes */

.grade-clientes { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card-cliente { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 10px; border: 1px solid var(--linha); background: var(--sup); }
.card-cliente-abrir { display: flex; gap: 14px; align-items: flex-start; text-align: left; width: 100%; }
.card-cliente-abrir:hover b { color: var(--acento); }
.card-cliente-rodape { display: flex; flex-direction: column; gap: 3px; padding-top: 10px; border-top: 1px solid var(--divisor); }
.card-cliente .av { width: 44px; height: 44px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: var(--botao); overflow: hidden; }
.card-cliente .av img { width: 100%; height: 100%; object-fit: contain; background: var(--divisor); }
.card-cliente div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.card-cliente b { font-weight: 600; }
.card-cliente p { font-size: 12.5px; color: var(--suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-vazia { color: var(--suave); padding: 40px 0; }

/* ------------------------------------------------------------ modal */

dialog { border: 0; background: var(--sup); color: var(--tinta); border-radius: 14px; box-shadow: var(--sombra-pop); padding: 0; }
dialog::backdrop { background: rgb(20 18 24 / 0.45); }
.modal { width: min(600px, calc(100vw - 32px)); }
.modal-cab { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 0 22px; }
.modal-cab h2 { font-size: 16px; font-weight: 600; }
.modal { max-height: calc(100vh - 32px); }
#formMarca { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal-corpo { padding: 16px 22px; display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; overflow-y: auto; }
.modal-rodape { display: flex; gap: 8px; align-items: center; padding: 14px 22px; border-top: 1px solid var(--linha); }
.logo-campo { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.previa-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 7px; box-shadow: 0 0 0 1px var(--linha); background: repeating-conic-gradient(var(--divisor) 0 25%, var(--sup) 0 50%) 0 0 / 10px 10px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--dica-fundo); color: var(--dica-texto); padding: 10px 16px; border-radius: 9px; font-size: 13px; font-weight: 500; z-index: 50; box-shadow: var(--sombra-pop); max-width: calc(100vw - 32px); }
.toast.erro { background: var(--erro-solido); color: var(--erro-solido-texto); }

/* ------------------------------------------------------------ responsivo */

@media (max-width: 1080px) {
  .form-col { width: 360px; flex-basis: 360px; }
  .copy-grade { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .casca { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }
  .menu { width: auto; flex: none; flex-direction: row; align-items: center; gap: 8px; padding: 10px 16px; position: sticky; top: 0; z-index: 5; background: var(--fundo); border-bottom: 1px solid var(--linha); overflow: visible; }
  .marca span, .menu-pe .conexoes, .tema > span, .usuario-menu .dica { display: none; }
  .menu-pe { flex-direction: row; align-items: center; gap: 8px; }
  .usuario-menu.separa { padding: 0; border: 0; }
  .marca { padding: 0; }
  .marca img { width: 28px; height: 28px; }
  .nav-lista { flex-direction: row; margin-left: auto; }
  .nav { width: auto; height: 34px; padding: 0 9px; font-size: 13px; }
  .nav .cnt { display: none; }
  .menu-pe { margin: 0; padding: 0; }
  .separa { padding: 0; border: 0; }
  .principal { border-left: 0; overflow: visible; }
  #vista-criar { flex-direction: column; overflow: visible; }
  .form-col { width: auto; flex: none; border-right: 0; border-bottom: 1px solid var(--linha); padding: 20px 16px; overflow: visible; }
  .acao { position: static; }
  .resultado-col { overflow: visible; padding: 20px 16px 40px; }
  .vazio { min-height: 220px; }
  .rolavel { overflow: visible; padding: 20px 16px 40px; }
  .slide { width: 78vw; }
}

/* Com 4 itens no menu, a barra de cima vira só ícones antes de estourar a largura. */
@media (max-width: 640px) {
  .marca b { display: none; }
  .nav { font-size: 0; gap: 0; width: 36px; justify-content: center; padding: 0; }
  .nav svg { width: 18px; height: 18px; }
}

@media (max-width: 760px) {
  .post-cliente { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .cartao-acesso { padding: 20px; }
  .grade2 { grid-template-columns: 1fr; }
  .post-acoes { width: 100%; }
  .post-acoes .btn { flex: 1; }
  .grade-posts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .grade-templates { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .template-editar { flex-direction: column; }
  .tpl-previa { width: 120px; }
  .upload-templates .campo { width: 100%; }
}

/* ------------------------------------------------- movimento e fluidez */

/* Troca de tema e de superfície sem estalo. */
body { transition: background-color var(--medio) var(--curva), color var(--medio) var(--curva); }

/* Cada tela entra subindo 4px em vez de aparecer de uma vez. */
.vista:not([hidden]) { animation: vista-entra var(--medio) var(--curva) both; }
@keyframes vista-entra { from { opacity: 0; transform: translateY(4px); } }

/* Onde o usuário salta de um ponto a outro, a rolagem acompanha. */
.rolavel, .slides, .resultado-col, .modal-corpo { scroll-behavior: smooth; }

/* Tudo que se clica responde ao toque. */
.btn, .nav, .icone-btn, .card-cliente, .card-post-cliente, .tema-opcoes button, .link {
  transition: background-color var(--rapido) var(--curva), box-shadow var(--rapido) var(--curva),
    color var(--rapido) var(--curva), transform var(--rapido) var(--curva), opacity var(--rapido) var(--curva);
}
.btn:active:not(:disabled), .icone-btn:active:not(:disabled) { transform: translateY(1px); }

/* Cartões das galerias sobem de leve; a capa ganha o anel da marca. */
.card-post .abrir, .card-template { transition: transform var(--medio) var(--curva); }
.card-post .abrir:hover, .card-template:hover { transform: translateY(-2px); }
.card-post-cliente:hover { transform: translateY(-1px); }
.card-post .capa, .card-template img, .card-post-cliente img, .previa-template, .ref img {
  transition: border-color var(--rapido) var(--curva), box-shadow var(--rapido) var(--curva);
}

/* Imagem que chega aparece, em vez de estourar na tela. */
.card-post .capa, .card-template img, .grade-portal img, .tpl-previa { animation: imagem-entra var(--calmo) var(--curva) both; }
@keyframes imagem-entra { from { opacity: 0; } }

/* Janelas crescem do centro e o fundo escurece junto. */
dialog[open] { animation: modal-entra var(--medio) var(--curva) both; }
dialog[open]::backdrop { animation: fundo-entra var(--medio) var(--curva) both; }
@keyframes modal-entra { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
@keyframes fundo-entra { from { opacity: 0; } }

/* Aviso do rodapé sobe ao aparecer. */
.toast { animation: toast-entra var(--medio) var(--curva) both; }
@keyframes toast-entra { from { opacity: 0; transform: translate(-50%, 10px); } }

/* A barra de status do post muda de estado com um realce curto. */
.status-post { transition: box-shadow var(--medio) var(--curva), background-color var(--medio) var(--curva); }
.status-post.mudou { animation: realce var(--calmo) var(--curva); }
@keyframes realce {
  0% { box-shadow: 0 0 0 1px var(--acento), 0 0 0 5px var(--selecao); }
  100% { box-shadow: 0 0 0 1px var(--linha); }
}

/* Medidas que acompanham a largura da janela: nada "pula" ao redimensionar. */
.rolavel { padding: clamp(18px, 2.2vw, 28px) clamp(16px, 2.6vw, 32px) 48px; }
.grade-posts { grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 15vw, 190px), 1fr)); gap: clamp(12px, 1.4vw, 18px); }
.grade-templates { grid-template-columns: repeat(auto-fill, minmax(clamp(140px, 14vw, 170px), 1fr)); gap: clamp(12px, 1.4vw, 18px); }
.grade-clientes, .grade-portal { gap: clamp(10px, 1.2vw, 14px); }
