:root {
  --bg: #000;
  --surface: #0a0a0a;
  --surface-2: #111;
  --surface-3: #181818;
  --line: #1e1e1e;
  --line-2: #2a2a2a;
  --text: #f4f1ec;
  --muted: #a39e96;
  --faint: #6f6a63;
  --sand: #cdb894;
  --sand-2: #dccaa8;
  --sand-ink: #17130e;
  --sand-soft: rgba(205, 184, 148, 0.12);
  --ok: #6fcf8f;
  --warn: #e2c47c;
  --bad: #ff8a80;
  --sand-text: #cdb894;          /* areia usada como TEXTO (no claro fica mais escura para contraste) */
  --ok-fill: #2f9e5b;            /* círculo de etapa concluída (verde) */
  --ok-ink: #ffffff;
  --shadow: rgba(0, 0, 0, 0.7);
  --shadow-soft: rgba(0, 0, 0, 0.5);
  --hover-border: #3a3a3a;
  --danger-border: #3a2321;
  --track: #333;
  --track-on: #3f9d5e;
  --scrim: rgba(0, 0, 0, 0.65);
  --backdrop: rgba(0, 0, 0, 0.75);
  --toast-bg: #f4f1ec;
  --toast-text: #000;
  --sand-a14: rgba(205, 184, 148, 0.14);
  --sand-a25: rgba(205, 184, 148, 0.25);
  --sand-a40: var(--sand-a40);
  --sand-a70: rgba(205, 184, 148, 0.7);
  --entry-avatar-bg: #121212;
  --shimmer-base: #66615a;
  --shimmer-glow: #e9dcc4;
  --shimmer-peak: #fbf6ec;
  --radius: 16px;
  --hdr-h: 76px;
  --pilot-h: 0px;
  --side-w: 88px;
  --side-open: 248px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
body.with-pilot { --pilot-h: 30px; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
body.app-on { overflow: hidden; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--sand); outline-offset: 2px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 200; background: var(--sand); color: var(--sand-ink); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
h1 { font-size: 30px; line-height: 1.15; margin: 0; font-weight: 700; letter-spacing: -0.015em; }
h2 { font-size: 18px; margin: 0; font-weight: 650; }
.sub { color: var(--muted); margin: 4px 0 0; font-size: 16px; }

/* ---------- marca (arquivo oficial: brand/conalvo-logo*.png) ---------- */
.wordmark { display: inline-flex; align-items: center; text-decoration: none; line-height: 1; }
.brand-logo { display: block; height: 34px; width: auto; }

/* ---------- cabeçalho ---------- */
.hdr { position: fixed; inset: 0 0 auto 0; z-index: 50; background: var(--bg); border-bottom: 1px solid var(--line); }
.hdr-row { height: var(--hdr-h); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; padding: 0 28px; }
.hdr .hamburger { display: none; }
.product-center { justify-self: center; display: flex; align-items: center; gap: 18px; font-size: 13px; letter-spacing: 0.42em; color: var(--text); }
.product-center .rule { width: 44px; height: 1px; background: var(--line-2); }
.pilot { height: var(--pilot-h); display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; letter-spacing: 0.02em; color: var(--sand-text); background: var(--sand-soft); border-top: 1px solid var(--sand-a25); }
.pilot.demo { color: var(--warn); }
.pilot svg { width: 15px; height: 15px; }
.pilot-short { display: none; }
.pilot span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher { position: relative; justify-self: end; }
.switch-btn { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; max-width: 280px; }
.switch-btn:hover { border-color: var(--hover-border); }
.switch-btn .uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.switch-btn .chev svg { width: 16px; height: 16px; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 260px; max-width: 320px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 6px; box-shadow: 0 18px 50px var(--shadow-soft); z-index: 60; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; background: none; border: 0; cursor: pointer; text-align: left; text-decoration: none; color: var(--text); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); }
.menu-item[aria-checked="true"] { color: var(--sand-text); }
.menu-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item small { color: var(--faint); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-item.danger { color: var(--bad); }

/* ---------- avatares ---------- */
.avatar { width: 52px; height: 52px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--surface-3); border: 1px solid var(--line-2); color: var(--muted); font-weight: 650; font-size: 16px; letter-spacing: 0.02em; }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; border-radius: 50%; }
.avatar.xs { width: 30px; height: 30px; font-size: 11px; }
.avatar.sm { width: 40px; height: 40px; font-size: 13px; }
.avatar.md { width: 60px; height: 60px; font-size: 19px; }
.avatar.lg { width: 96px; height: 96px; font-size: 28px; }
.avatar.xl { width: 120px; height: 120px; font-size: 34px; }

/* ---------- sidebar ----------
   Geometria fixa: o painel tem SEMPRE a largura aberta; recolhido, só a faixa dos ícones fica visível (clip-path).
   Ícones, foto e alturas nunca mudam de lugar; abrir só revela os nomes à direita. A animação recorta (sem
   recalcular layout) e o conteúdo principal não se desloca. */
.side {
  position: fixed; top: calc(var(--hdr-h) + var(--pilot-h) + 1px); bottom: 0; left: 0; width: var(--side-open); z-index: 40;
  background: var(--bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px 16px;
  overflow: hidden; contain: layout paint;
  clip-path: inset(0 calc(var(--side-open) - var(--side-w)) 0 0);
  transition: clip-path 0.16s ease-out, box-shadow 0.16s ease-out;
}
.side.open { clip-path: inset(0 -80px 0 0); box-shadow: 16px 0 50px var(--shadow); }
.side-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.side-item, .side-profile {
  position: relative; isolation: isolate; display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 16px;
  height: 48px; padding: 0 0 0 21px; border-radius: 12px; color: var(--muted); text-decoration: none; background: none; border: 0;
  cursor: pointer; width: 100%; white-space: nowrap; font: inherit; text-align: left;
}
/* Fundo do item: recolhido cobre só a área do ícone; aberto, a linha toda. Recorte, sem mudar o tamanho do item. */
.side-item::after, .side-profile::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 12px; background: transparent;
  clip-path: inset(0 calc(100% - (var(--side-w) - 20px)) 0 0 round 12px); transition: clip-path 0.16s ease-out;
}
.side.open .side-item::after, .side.open .side-profile::after { clip-path: inset(0 0 0 0 round 12px); }
.side-item:hover, .side-profile:hover { color: var(--text); }
.side-item:hover::after, .side-profile:hover::after { background: var(--surface-2); }
.side-item[aria-current="page"], .side-profile[aria-current="page"] { color: var(--sand-text); }
.side-item[aria-current="page"]::after, .side-profile[aria-current="page"]::after { background: var(--sand-soft); }
.side-item[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--sand); }
.side-item:focus-visible, .side-profile:focus-visible { outline: none; }
.side-item:focus-visible::after, .side-profile:focus-visible::after { box-shadow: inset 0 0 0 2px var(--sand); }
.side-ico { display: inline-grid; place-items: center; width: 26px; height: 26px; flex: none; }
.lbl-l { display: inline-flex; flex-direction: column; font-size: 15px; line-height: 1.2; color: inherit; min-width: 0; opacity: 0; transition: opacity 0.12s ease-out; }
.side.open .lbl-l { opacity: 1; }
.side-profile { height: 56px; margin-top: 8px; padding-left: 14px; }
.side-profile .lbl-l small { color: var(--faint); font-size: 12px; }
.side-profile .lbl-l strong { font-weight: 600; color: var(--text); max-width: 150px; overflow: hidden; text-overflow: ellipsis; }

.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 45; }

/* ---------- área principal ---------- */
main { position: fixed; top: calc(var(--hdr-h) + var(--pilot-h) + 1px); bottom: 0; left: var(--side-w); right: 0; overflow: hidden; display: flex; flex-direction: column; border-left: 1px solid var(--line); }
main:focus { outline: none; }
.page { flex: 1; min-height: 0; overflow-y: auto; padding: 32px 36px 40px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card + .card { margin-top: 16px; }
.card h2 + .sub { font-size: 14px; margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }

/* ---------- botões e campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; padding: 10px 16px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); white-space: nowrap; font-weight: 550; text-decoration: none; }
.btn:hover { border-color: var(--hover-border); background: var(--surface-3); }
.btn.sand { background: var(--sand); border-color: var(--sand); color: var(--sand-ink); font-weight: 650; }
.btn.sand:hover { background: var(--sand-2); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.danger { color: var(--bad); border-color: var(--danger-border); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-ico { display: inline-grid; place-items: center; }
.icon-btn { background: none; border: 0; color: var(--text); padding: 9px; border-radius: 10px; cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--surface-3); }
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.field > span { font-size: 13px; color: var(--muted); }
.field input, .field textarea, .field select, .search input {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding: 11px 14px; width: 100%;
}
.field textarea { resize: vertical; min-height: 110px; }
.form-error { color: var(--bad); font-size: 13px; margin: 4px 0; }
.form-error:empty { display: none; }
.note { font-size: 13px; color: var(--faint); margin: 8px 0 0; }

/* ---------- boas-vindas: cadastro, entrada, convite, conexão e carregamento (tela inteira) ---------- */
.welcome, .onboard, .entry { position: fixed; inset: 0; z-index: 100; background: var(--bg); overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; padding: 44px 16px 40px; }
.top-logo { display: block; width: min(190px, 46vw); height: auto; flex: none; }
.welcome-inner { width: 100%; max-width: 400px; margin: auto 0; padding-top: 28px; display: flex; flex-direction: column; }
.welcome h1, .onboard h1 { font-size: clamp(34px, 6vw, 46px); font-weight: 400; letter-spacing: -0.02em; line-height: 1.1; text-align: center; margin: 0; }
.lead { text-align: center; color: var(--muted); margin: 12px 0 30px; font-size: 17px; font-weight: 400; }
.welcome .field { margin: 0 0 18px; }
.welcome .field > span, .onboard .field > span { color: var(--text); font-size: 14px; }
.welcome input { background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; padding: 13px 16px; font-size: 15px; }
.welcome input::placeholder { color: var(--faint); }
.welcome input:focus { outline: none; border-color: var(--sand); box-shadow: 0 0 0 3px var(--sand-a14); }
.welcome input[readonly] { color: var(--muted); }
.hint { font-size: 12.5px; color: var(--faint); margin: -8px 0 14px; }
.pw { position: relative; display: block; }
.pw input { padding-right: 52px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); padding: 8px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.pw-toggle svg { width: 20px; height: 20px; }
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--text); }
.welcome .btn.block, .onboard .btn.block { margin-top: 10px; padding: 14px 16px; font-size: 16px; border-radius: 8px; font-weight: 600; }
.btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }
.alt { text-align: center; margin: 22px 0 0; color: var(--text); font-size: 14.5px; }
.demo-alt { margin-top: 8px; }
.link-btn { background: none; border: 0; padding: 2px 2px; color: var(--sand-text); cursor: pointer; font: inherit; font-weight: 600; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-btn.quiet { color: var(--muted); font-weight: 400; font-size: 14px; }
.step-label { text-align: center; color: var(--sand-text); font-size: 11.5px; letter-spacing: 0.24em; text-transform: uppercase; margin: 0 0 14px; }
.onboard-points { margin: 0 0 22px; padding-left: 18px; color: var(--muted); font-size: 14.5px; }
.onboard-points li { margin: 8px 0; }
.onboard-msg { background: var(--sand-soft); border: 1px solid var(--sand-a25); color: var(--text); border-radius: 10px; padding: 12px 14px; font-size: 14px; margin: 0 0 12px; }

/* entrada personalizada */
.entry { transition: opacity 0.28s ease-out; }
.entry.leaving { opacity: 0; pointer-events: none; }
.entry-inner { margin: auto 0; display: flex; flex-direction: column; align-items: center; text-align: center; padding-bottom: 6vh; }
.entry-id { min-height: 200px; display: grid; place-items: center; }
.entry-id .avatar { width: 190px; height: 190px; font-size: 54px; border: 2px solid var(--sand-a70); background: var(--entry-avatar-bg); color: var(--muted); }
.entry-id .entry-mark { width: min(300px, 72vw); height: auto; display: block; }
.entry-user { margin: 22px 0 0; font-size: 22px; font-weight: 400; color: var(--text); min-height: 1.3em; }
.entry-user:empty { display: none; }
.entry-text { margin: 30px 0 0; font-size: 30px; font-weight: 500; letter-spacing: 0.04em; }
/* Brilho sequencial: uma faixa estreita de luz atravessa a palavra da esquerda para a direita, recortada nas letras.
   Fundo com 3× a largura do texto; a faixa ocupa 8% dele (≈ 0,24 da palavra, ~2 letras). Posição 84% → faixa
   inteira antes do "E" (com folga); 16% → inteira depois do último "o". 1,5 s de passagem + 0,5 s de pausa (palavra cinza). */
.shimmer {
  display: inline-block;
  color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image: linear-gradient(90deg, var(--shimmer-base) 0%, var(--shimmer-base) 46%, var(--shimmer-glow) 49%, var(--shimmer-peak) 50%, var(--shimmer-glow) 51%, var(--shimmer-base) 54%, var(--shimmer-base) 100%);
  background-size: 300% 100%; background-repeat: no-repeat; background-position: 84% 0;
  animation: shimmer 2s linear infinite;
}
@keyframes shimmer { 0% { background-position: 84% 0; } 75% { background-position: 16% 0; } 100% { background-position: 16% 0; } }
.entry-fail { margin-top: 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--muted); }
.entry-fail p { margin: 0; }
@media (max-width: 480px) { .entry-id .avatar { width: 150px; height: 150px; font-size: 44px; } .entry-text { font-size: 24px; } }
@media (prefers-reduced-motion: reduce) {
  /* sem brilho: texto estático e discreto, com um traço em areia */
  .shimmer { background: none; color: var(--muted); }
  .entry-text::after { content: ""; display: block; width: 28px; height: 2px; background: var(--sand); margin: 12px auto 0; opacity: 0.7; }
}

/* ---------- conversas ---------- */
.page-conversas { padding: 20px 24px 24px; display: flex; overflow: hidden; }
.inbox { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: 16px; }
.pane { min-height: 0; min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-head { padding: 20px 20px 12px; }
.search { position: relative; margin-top: 14px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); }
.search input { padding-left: 40px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding-top: 11px; padding-bottom: 11px; width: 100%; }
.chips { display: inline-flex; gap: 4px; margin-top: 12px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding: 4px; }
.chip { border: 0; background: none; padding: 7px 18px; border-radius: 9px; cursor: pointer; color: var(--muted); font-size: 13.5px; font-weight: 550; }
.chip[aria-pressed="true"] { background: var(--sand); color: var(--sand-ink); }
.conv-list { list-style: none; margin: 0; padding: 4px 10px 14px; overflow-y: auto; flex: 1; }
.conv { width: 100%; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border-radius: 14px;
  background: none; border: 1px solid transparent; cursor: pointer; text-align: left; position: relative; }
.conv:hover { background: var(--surface-2); }
.conv[aria-current="true"] { background: var(--surface-3); border-color: var(--line-2); }
.conv[aria-current="true"]::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 2px; background: var(--sand); }
.conv-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.conv-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-user { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-last { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.conv.unread .conv-last { color: var(--text); font-weight: 600; }
.conv-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; align-self: start; padding-top: 2px; }
.conv-time { font-size: 12px; color: var(--faint); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sand); }
.list-empty { padding: 28px 16px; text-align: center; color: var(--faint); }

.thread-empty { flex: 1; display: grid; place-items: center; color: var(--faint); }
.thread-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: relative; }
.thread-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.thread-title .names { min-width: 0; display: flex; flex-direction: column; }
.thread-title h2 { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-title .uname { color: var(--muted); font-size: 14px; }
.pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; white-space: nowrap; color: var(--text); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.pill[data-k="active"]::before { background: var(--ok); }
.pill[data-k="paused"]::before, .pill[data-k="uncertain"]::before { background: var(--warn); }
.pill[data-k="refused"]::before { background: var(--bad); }
.pill[data-k="presented"]::before, .pill[data-k="interval"]::before, .pill[data-k="simulated"]::before { background: var(--sand); }
.back { display: none; }
.messages { list-style: none; margin: 0; padding: 22px 24px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.day { align-self: center; font-size: 12px; color: var(--faint); margin: 12px 0 6px; }
.msg { display: flex; gap: 10px; max-width: min(620px, 82%); margin-top: 6px; }
.msg.in { align-self: flex-start; align-items: flex-end; }
.msg.out { align-self: flex-end; flex-direction: column; align-items: flex-end; }
.msg-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.msg.in .msg-col { align-items: flex-start; }
.bubble { padding: 11px 16px; border-radius: 20px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.msg.in .bubble { background: var(--surface-3); border: 1px solid var(--line-2); border-bottom-left-radius: 6px; }
.msg.out .bubble { background: var(--sand); color: var(--sand-ink); border-bottom-right-radius: 6px; }
.msg.out.pending .bubble { opacity: 0.7; }
.msg.failed .bubble { box-shadow: inset 0 0 0 1px var(--bad); }
.meta { font-size: 11.5px; color: var(--faint); display: flex; gap: 10px; flex-wrap: wrap; }
.meta .bad { color: var(--bad); }
.meta .warn { color: var(--warn); }
.sysnote { align-self: center; font-size: 12px; color: var(--faint); border: 1px dashed var(--line-2); border-radius: 10px; padding: 6px 12px; margin: 10px 0; text-align: center; max-width: 90%; }

/* player de áudio */
.player { display: flex; align-items: center; gap: 12px; min-width: 230px; }
.player .pbtn { width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--sand-ink); color: var(--sand-text); flex: none; }
.msg.in .player .pbtn, .card .player .pbtn { background: var(--sand); color: var(--sand-ink); }
.player .pbtn svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.player input[type="range"] { flex: 1; min-width: 90px; accent-color: currentColor; }
.player .ptime { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }
.player-error { color: var(--muted); font-size: 13px; }

.composer-box { border-top: 1px solid var(--line); }
.composer-box .note { margin: 10px 18px 0; }
.composer { padding: 14px 18px; display: flex; align-items: flex-end; gap: 12px; }
.composer textarea { flex: 1; resize: none; max-height: 140px; min-height: 46px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 23px; padding: 12px 18px; }
.send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--sand); color: var(--sand-ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- automações ---------- */
.switch { display: inline-flex; align-items: center; gap: 12px; padding: 10px 16px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); cursor: pointer; font-weight: 550; }
.switch .track { width: 46px; height: 26px; border-radius: 999px; background: var(--track); position: relative; transition: background 0.15s ease; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.15s ease; }
.switch[aria-checked="true"] .track { background: var(--track-on); }
.switch[aria-checked="true"] .track::after { transform: translateX(20px); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding: 4px; margin: 16px 0; }
.seg button { border: 0; background: none; padding: 10px; border-radius: 9px; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 550; }
.seg button[aria-pressed="true"] { background: var(--sand); color: var(--sand-ink); }
.audio-row { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line-2); border-radius: 14px; padding: 14px; background: var(--bg); flex-wrap: wrap; }
.audio-row .fname { font-size: 13px; color: var(--muted); width: 100%; }
.audio-row .player { flex: 1; }
.rules { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rules li { display: flex; gap: 12px; align-items: flex-start; }
.rules .ck { width: 22px; height: 22px; border-radius: 6px; background: var(--sand); color: var(--sand-ink); display: grid; place-items: center; flex: none; margin-top: 1px; }
.rules .ck svg { width: 15px; height: 15px; stroke-width: 2.5; }
.rules small { display: block; color: var(--faint); font-size: 12.5px; }
.preview-badge { display: inline-block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--sand-text); border: 1px solid var(--sand-a40); border-radius: 999px; padding: 2px 10px; margin-left: 8px; vertical-align: middle; }
.preview { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-top: 16px; display: flex; flex-direction: column; gap: 4px; }
.preview .msg { max-width: 92%; }
.auto-tag { font-size: 10.5px; letter-spacing: 0.04em; color: var(--sand-text); }

/* ---------- contas e perfil ---------- */
.acc-card { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 20px; align-items: center; }
.acc-card .names { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acc-card .names .pill { margin-left: 10px; }
.acc-card .names strong { font-size: 19px; display: block; overflow: hidden; text-overflow: ellipsis; }
.status-line { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; }
.status-line::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.status-line[data-s="reconnect_needed"]::before { background: var(--warn); }
.status-line[data-s="disconnected"]::before { background: var(--faint); }
.acc-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.acc-actions .menu { top: auto; bottom: calc(100% + 6px); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; position: relative; }
.step { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; color: var(--faint); }
.step strong { color: var(--text); font-size: 14px; }
.step .circle { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; background: var(--bg); }
.step .circle svg { width: 18px; height: 18px; stroke-width: 2.4; }
.step[data-s="done"] .circle { background: var(--ok-fill); border-color: var(--ok-fill); color: var(--ok-ink); }
.step[data-s="running"] .circle { border-color: var(--sand); border-top-color: transparent; animation: spin 0.9s linear infinite; }
.step[data-s="error"] .circle { border-color: var(--bad); color: var(--bad); }
@keyframes spin { to { transform: rotate(360deg); } }
.connect { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 28px; align-items: center; }
.pending-list { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.pending-list li { margin: 4px 0; }
.support { margin-top: 12px; font-size: 13px; color: var(--faint); }
.support summary { cursor: pointer; color: var(--muted); }
.profile-top { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.ig-badge { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-top: 8px; }
.ig-badge svg { width: 18px; height: 18px; }
.sec-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.sec-row .grow { flex: 1; min-width: 200px; }

/* ---------- diálogos e avisos ---------- */
.dialog { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 24px; max-width: 480px; width: calc(100% - 32px); }
.dialog::backdrop { background: var(--backdrop); }
.dialog-body { color: var(--muted); margin-top: 8px; }
.dialog-body ul { padding-left: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 120; background: var(--toast-bg); color: var(--toast-text); padding: 11px 18px; border-radius: 12px; max-width: calc(100% - 32px); font-size: 14px; box-shadow: 0 10px 30px var(--shadow-soft); }


/* ---------- tema claro (escolhido em Meu perfil → Aparência; o escuro é o padrão) ----------
   Mesma organização e comportamento; só as cores mudam. Fotos, vídeos e anexos NÃO são filtrados nem invertidos. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f5f2;
  --surface-3: #efece6;
  --line: #e8e5df;
  --line-2: #d9d4cb;
  --text: #121212;
  --muted: #55504a;
  --faint: #7c766d;
  --sand: #d4bf98;               /* preenchimentos (botões, balões) com texto escuro por cima */
  --sand-2: #c9b086;
  --sand-ink: #17130e;
  --sand-soft: rgba(176, 140, 82, 0.12);
  --sand-text: #8a6630;          /* areia como texto: contraste ≥ 4,5:1 sobre branco */
  --ok: #1e7d45;
  --warn: #8a5d00;
  --bad: #b3261e;
  --ok-fill: #23914f;
  --ok-ink: #ffffff;
  --shadow: rgba(30, 24, 15, 0.16);
  --shadow-soft: rgba(30, 24, 15, 0.12);
  --hover-border: #c4beb3;
  --danger-border: #efc9c5;
  --track: #cfc9bf;
  --track-on: #23914f;
  --scrim: rgba(18, 18, 18, 0.35);
  --backdrop: rgba(18, 18, 18, 0.4);
  --toast-bg: #121212;
  --toast-text: #ffffff;
  --sand-a14: rgba(176, 140, 82, 0.18);
  --sand-a25: rgba(176, 140, 82, 0.3);
  --sand-a40: rgba(176, 140, 82, 0.45);
  --sand-a70: rgba(176, 140, 82, 0.75);
  --entry-avatar-bg: #f1eee8;
  --shimmer-base: #a39d94;
  --shimmer-glow: #c9a86a;
  --shimmer-peak: #8a6630;
}
/* logo oficial: versão branca no escuro, versão escura no claro (mesmo desenho) */
.logo-for-light { display: none !important; }
:root[data-theme="light"] .logo-for-dark { display: none !important; }
:root[data-theme="light"] .logo-for-light { display: block !important; }

/* ---------- Contas: etapas por conta ---------- */
.steps { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 18px; }
.step .circle { color: var(--faint); }
.step[data-s="todo"] strong { color: var(--muted); font-weight: 500; }
.step[data-s="running"] strong { color: var(--text); }
.step[data-s="partial"] .circle { border-color: var(--warn); color: var(--warn); }
.step[data-s="error"] .circle { border-color: var(--bad); color: var(--bad); }
.step[data-s="error"] strong { color: var(--bad); }
.step small { display: block; color: var(--faint); font-size: 12px; line-height: 1.35; }
.sync-result { margin-top: 14px; font-size: 13.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.sync-result .warn { color: var(--warn); }
.sync-result .bad { color: var(--bad); }
.sync-result .test-note { color: var(--sand-text); }
.live-line { margin-top: 10px; font-size: 12.5px; color: var(--faint); border-top: 1px solid var(--line); padding-top: 10px; }
.pill.primary-pill { margin-left: 10px; }

/* ---------- Meu perfil → Configurações → Aparência ---------- */
.settings-h { font-size: 15px; font-weight: 600; margin: 16px 0 0; }
.theme-options { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 14px; margin-top: 14px; }
.theme-opt { border: 1px solid var(--line-2); border-radius: 14px; padding: 10px; background: var(--surface); cursor: pointer; text-align: left; color: var(--text); display: flex; flex-direction: column; gap: 10px; }
.theme-opt:hover { border-color: var(--hover-border); }
.theme-opt[aria-checked="true"] { border-color: var(--sand-text); box-shadow: 0 0 0 2px var(--sand-a40); }
.theme-opt .mini { height: 96px; border-radius: 9px; border: 1px solid; display: grid; grid-template-columns: 22px 1fr; overflow: hidden; }
.theme-opt .mini .mside { border-right: 1px solid; }
.theme-opt .mini .mbody { padding: 10px; display: flex; flex-direction: column; gap: 7px; }
.theme-opt .mini .bar { height: 7px; border-radius: 4px; }
.theme-opt .mini .bub { height: 12px; width: 55%; border-radius: 6px; align-self: flex-end; background: #cdb894; }
.mini.dark { background: #000; border-color: #2a2a2a; }
.mini.dark .mside { border-color: #1e1e1e; background: #000; }
.mini.dark .bar { background: #1e1e1e; }
.mini.light { background: #fff; border-color: #d9d4cb; }
.mini.light .mside { border-color: #e8e5df; background: #f6f5f2; }
.mini.light .bar { background: #ece8e1; }
.theme-opt .lbl { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.theme-opt .radio { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; }
.theme-opt[aria-checked="true"] .radio { border-color: var(--sand-text); background: radial-gradient(circle, var(--sand-text) 45%, transparent 50%); }
@media (max-width: 480px) { .theme-options { grid-template-columns: 1fr 1fr; } .theme-opt .mini { height: 72px; } }

/* ---------- notebook ---------- */
@media (max-width: 1280px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .page { padding: 26px 24px 32px; }
  .inbox { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
}
/* ---------- celular, tablet e telas de toque ---------- */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  :root { --hdr-h: 60px; --side-w: 0px; }
  body.with-pilot { --pilot-h: 28px; }
  .hdr-row { grid-template-columns: auto auto 1fr auto; padding: 0 10px; gap: 8px; }
  .hdr .hamburger { display: inline-grid; }
  .pilot-long { display: none; }
  .pilot-short { display: inline; }
  .product-center { display: none; }
  .brand-logo { height: 24px; }
  .switch-btn { padding: 4px; border-radius: 999px; grid-column: 4; }
  .switch-btn .uname, .switch-btn .chev { display: none; }
  main { border-left: 0; }
  .side { width: min(300px, 84vw); clip-path: none; transform: translateX(-102%); transition: transform 0.2s ease-out, box-shadow 0.2s ease-out; box-shadow: none; padding: 14px 12px; z-index: 46; contain: none; }
  .side.open { transform: none; overflow: hidden; box-shadow: 16px 0 50px var(--shadow); }
  .side .side-item, .side .side-profile { height: 52px; }
  .side .side-item::after, .side .side-profile::after { clip-path: none; }
  .side .side-item[aria-current="page"]::before { left: -12px; }
  .side .lbl-l { opacity: 1; font-size: 16px; }
  main { left: 0; }
  .page { padding: 20px 14px 28px; }
  h1 { font-size: 24px; }
  .page-conversas { padding: 0; }
  .inbox { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pane { border-radius: 0; border: 0; }
  .inbox .pane-thread { display: none; }
  .inbox.show-thread .pane-list { display: none; }
  .inbox.show-thread .pane-thread { display: flex; }
  .back { display: inline-grid; }
  .thread-head { padding: 10px 12px; gap: 10px; }
  .thread-title { gap: 6px; }
  .thread-title h2 { font-size: 16px; }
  .thread-head .btn .btn-label { display: none; }
  .thread-head .avatar.md { width: 44px; height: 44px; }
  .messages { padding: 16px 12px; }
  .msg { max-width: 88%; }
  .composer { padding: 10px 12px; }
  .composer-box .note { margin: 8px 12px 0; }
  .grid-cards { grid-template-columns: minmax(0, 1fr); }
  .acc-card { grid-template-columns: 72px minmax(0, 1fr); }
  .acc-card .avatar.lg { width: 72px; height: 72px; }
  .connect { grid-template-columns: minmax(0, 1fr); }
  .steps { gap: 6px; }
  .card { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
.entry.no-ig > .top-logo { visibility: hidden; }
