/* ==========================================================================
   Canal4D — front do USUÁRIO FINAL (mobile-first, jeitão de app).
   Reusa os TOKENS de cor/identidade do esqueleto (app.css), com layout PRÓPRIO.
   Nada aqui herda o layout de painel do esqueleto.
   ========================================================================== */

.c4d-app {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

.c4d-shell {
  display: flex;
  flex-direction: column;
  width: min(100%, 460px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 22px calc(20px + env(safe-area-inset-bottom));
}

/* ---- Topo: marca + selo de autenticidade ---- */
.c4d-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0 4px;
}
.c4d-top .wordmark { font-size: 22px; }
.c4d-verified {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--accent-strong);
  background: var(--accent-soft); padding: 6px 11px; border-radius: 999px;
}

/* ---- Hero ---- */
.c4d-hero { text-align: center; padding: 22px 6px 6px; }
.c4d-hero img { width: 92px; height: 92px; margin-bottom: 18px; }
.c4d-hero h1 { font-size: 25px; line-height: 1.22; margin: 0 0 8px; }
.c4d-hero p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }

/* ---- Corpo (passo ativo, centralizado) ---- */
.c4d-body { flex: 1; display: flex; flex-direction: column; }
.c4d-step { display: none; }
.c4d-step.is-active { display: flex; flex-direction: column; flex: 1; animation: c4dfade .25s ease; }
@keyframes c4dfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.c4d-back-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 3px;
  margin: 4px 0 0; padding: 6px 4px; color: var(--muted); font-size: 14px; font-weight: 700;
  background: none; border: 0; cursor: pointer; }

.c4d-field { margin-top: 8px; }
.c4d-field > label { display: block; font-size: 14px; font-weight: 700; margin: 0 0 8px; }
.c4d-input {
  width: 100%; height: 54px; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 0 16px; font-size: 16px; color: var(--ink); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.c4d-input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.c4d-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.c4d-code { text-align: center; letter-spacing: .55em; font-size: 24px; font-weight: 800; padding-right: calc(16px - .55em); }
.c4d-help { margin: 12px 2px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.c4d-help a { color: var(--accent-strong); font-weight: 700; }

/* ---- Sucesso (provisório) ---- */
.c4d-success { text-align: center; padding: 24px 0; }
.c4d-check {
  width: 78px; height: 78px; border-radius: 50%; margin: 0 auto 18px;
  display: grid; place-items: center; font-size: 38px;
  color: var(--accent-strong); background: var(--accent-soft);
}
.c4d-success h1 { font-size: 24px; margin: 0 0 6px; }

/* ---- Ação ancorada no rodapé do passo ---- */
.c4d-actions { margin-top: auto; padding-top: 16px; display: grid; gap: 10px; }
.c4d-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  height: 54px; border: 0; border-radius: 14px; font-size: 16px; font-weight: 800; cursor: pointer;
  transition: background .15s, transform .05s;
}
.c4d-btn:active { transform: translateY(1px); }
.c4d-btn-primary { background: var(--accent); color: #fff; }
.c4d-btn-primary:active { background: var(--accent-strong); }
/* Google: fundo claro, borda, logo colorido (guia de marca do Google) */
.c4d-btn-google { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }
.c4d-btn-google:active { background: var(--surface-soft); }
.c4d-g { width: 20px; height: 20px; flex: 0 0 auto; }
/* Apple: preto no tema claro, branco no escuro (guia de marca da Apple) */
.c4d-btn-apple { background: #000; color: #fff; }
.c4d-btn-apple:active { background: #1a1a1a; }
:root[data-theme="dark"] .c4d-btn-apple { background: #fff; color: #000; }
:root[data-theme="dark"] .c4d-btn-apple:active { background: #e9e9e9; }
/* Botão que só aparece na plataforma certa (o JS decide) */
.c4d-btn.is-hidden { display: none; }
/* Ação destrutiva (excluir conta) */
.c4d-btn-perigo { width: 100%; margin-top: 16px; background: var(--red); color: #fff; }
.c4d-btn-perigo:disabled { opacity: .6; }
/* Alternativa discreta */
.c4d-btn-ghost { height: 48px; background: transparent; color: var(--accent-strong); font-weight: 700; }
.c4d-legal { text-align: center; color: var(--muted); font-size: 12px; line-height: 1.5; margin: 8px 4px 0; }
.c4d-legal a { color: var(--muted); text-decoration: underline; }
/* Aviso (ex.: falha no login) */
.c4d-note { margin: 10px 2px 0; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.4;
  color: var(--red); background: color-mix(in srgb, var(--red) 10%, var(--surface)); display: none; }
.c4d-note.is-on { display: block; }

/* ==========================================================================
   Feed (lista de canais) — a "home" do usuário
   ========================================================================== */
.c4d-feedwrap { width: min(100%, 560px); margin: 0 auto; min-height: 100dvh; }
.c4d-appbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  /* área segura EM CIMA (barra do relógio/notch do iPhone) — antes estava no
     padding de baixo por engano */
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.c4d-appbar .wordmark { font-size: 22px; }
.c4d-appbar-actions { display: inline-flex; gap: 8px; }
.c4d-iconbtn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); cursor: pointer; font-size: 20px;
}
.c4d-list { display: flex; flex-direction: column; padding: 0 6px; }
.c4d-chan {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer;
  padding: 14px 10px; color: inherit; background: none;
  border: 0; border-bottom: 1px solid var(--line);
}
.c4d-chan:active { background: var(--surface-soft); }
.c4d-ava { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 19px; color: #fff; }
.c4d-chan-main { flex: 1; min-width: 0; }
.c4d-chan-top { display: flex; align-items: center; gap: 5px; min-width: 0; }
.c4d-chan-name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.c4d-chan-top .ti { color: var(--accent); font-size: 17px; flex: 0 0 auto; }
/* display:block é obrigatório: num <span> (inline) o text-overflow não corta,
   e a prévia longa esticava a página inteira (1.746px numa tela de 390px no
   iPhone → tela "maior que o aparelho", arrastando para os lados). */
.c4d-chan-msg { display: block; color: var(--muted); font-size: 14px; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c4d-chan-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.c4d-chan-time { color: var(--muted); font-size: 12px; }
.c4d-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.c4d-total { min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 800; display: grid; place-items: center; }
.c4d-demo { margin: 12px 16px 0; padding: 8px 12px; border-radius: 10px; font-size: 12.5px;
  color: var(--amber); background: color-mix(in srgb, var(--amber) 10%, var(--surface));
  border: 1px dashed color-mix(in srgb, var(--amber) 40%, var(--line)); }
/* Toast */
.c4d-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.c4d-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ==========================================================================
   Conversa (thread de mensagens de um canal)
   ========================================================================== */
.c4d-chat { display: flex; flex-direction: column; min-height: 100dvh; width: min(100%, 640px); margin: 0 auto; }
.c4d-chatbar { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.c4d-chatbar .c4d-ava { width: 42px; height: 42px; font-size: 15px; }
.c4d-chatback { border: 0; background: none; color: var(--ink); font-size: 24px; padding: 4px; cursor: pointer; display: grid; place-items: center; }
.c4d-chat-id { flex: 1; min-width: 0; }
.c4d-chat-name { display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: 16px; }
.c4d-chat-name .ti { color: var(--accent); font-size: 16px; }
.c4d-chat-sub { color: var(--muted); font-size: 12px; }
.c4d-thread { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 16px 12px 18px; }
.c4d-msg { display: flex; }
.c4d-msg.out { justify-content: flex-end; }
.c4d-bubble { max-width: 84%; padding: 9px 12px; border-radius: 16px; font-size: 15px; line-height: 1.42;
  background: var(--surface); border: 1px solid var(--line); }
.c4d-msg.in .c4d-bubble { border-top-left-radius: 5px; }
.c4d-msg.out .c4d-bubble { background: var(--accent-soft); border-color: transparent; border-top-right-radius: 5px; }
.c4d-sender { font-size: 12px; font-weight: 700; color: var(--accent-strong); margin-bottom: 3px; }
.c4d-bubble.pad { padding: 5px; }
.c4d-time { display: block; margin-top: 4px; text-align: right; color: var(--muted); font-size: 11px; }
/* imagem / vídeo */
.c4d-photo { width: min(74vw, 280px); height: 180px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(135deg, #1466b8, #5aa9ec); }
.c4d-photo .ti { font-size: 42px; opacity: .92; }
.c4d-cap { padding: 6px 6px 2px; color: var(--muted); font-size: 13px; }
.c4d-video { position: relative; width: min(74vw, 280px); height: 160px; border-radius: 12px;
  display: grid; place-items: center; background: linear-gradient(135deg, #2a3443, #12161d); }
.c4d-video .c4d-play { position: absolute; width: 54px; height: 54px; font-size: 24px; background: rgba(0,0,0,.5); }
/* documento */
.c4d-row { display: flex; align-items: center; gap: 12px; }
.c4d-doc { min-width: 200px; }
.c4d-fileicon { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  color: #fff; font-size: 20px; background: var(--red); }
.c4d-doc-main { min-width: 0; }
.c4d-doc-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c4d-doc-sub { color: var(--muted); font-size: 12px; }
/* áudio */
.c4d-play { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center;
  color: #fff; background: var(--accent); font-size: 18px; cursor: pointer; }
.c4d-wave { flex: 1; height: 4px; border-radius: 2px; background: var(--line); position: relative; min-width: 130px; }
.c4d-wave::after { content: ''; position: absolute; left: 0; top: 0; height: 100%; width: 32%; border-radius: 2px; background: var(--accent); }
.c4d-dur { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
/* botões interativos (resposta rápida) */
.c4d-inline { display: grid; gap: 8px; margin-top: 8px; }
.c4d-qr { padding: 11px; border-radius: 12px; border: 1.5px solid var(--accent); color: var(--accent-strong);
  background: var(--surface); font-weight: 700; font-size: 15px; cursor: pointer; }
.c4d-qr:active { background: var(--accent-soft); }
.c4d-qr[disabled] { opacity: .55; border-color: var(--line); color: var(--muted); cursor: default; }
/* micro-app */
.c4d-microapp { min-width: 240px; }
.c4d-ma-icon { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; background: var(--accent); font-size: 22px; }
.c4d-ma-main { flex: 1; min-width: 0; }
.c4d-ma-title { font-weight: 700; }
.c4d-ma-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.c4d-ma-open { flex: 0 0 auto; border: 0; border-radius: 10px; background: var(--accent); color: #fff;
  font-weight: 700; padding: 9px 15px; cursor: pointer; }
/* compositor */
.c4d-composer { position: sticky; bottom: 0; display: flex; align-items: flex-end; gap: 6px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.c4d-comp-btn { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; }
.c4d-comp-input { flex: 1; min-height: 44px; max-height: 120px; border: 1px solid var(--line); border-radius: 22px;
  padding: 11px 16px; font-size: 15px; color: var(--ink); background: var(--bg); resize: none; }
.c4d-comp-send { background: var(--accent); color: #fff; }

/* ==========================================================================
   Micro-app (runtime declarativo — telas de formulário)
   ========================================================================== */
.c4d-ma-wrap { width: min(100%, 560px); margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column;
  padding: 0 20px calc(18px + env(safe-area-inset-bottom)); }
.c4d-ma-head { display: flex; align-items: center; gap: 8px; padding: 12px 0 4px; }
.c4d-ma-head .c4d-chatback { font-size: 24px; }
.c4d-ma-head strong { font-size: 16px; }
.c4d-ma-head .ti-rosette-discount-check { color: var(--accent); font-size: 15px; }
.c4d-progress { display: flex; gap: 6px; padding: 8px 0 8px; }
.c4d-progress i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); transition: background .2s; }
.c4d-progress i.on { background: var(--accent); }
.c4d-ma-body { flex: 1; display: flex; flex-direction: column; }
.c4d-ma-body h1 { font-size: 23px; line-height: 1.25; margin: 10px 0 14px; }
.c4d-info { color: var(--ink); font-size: 15px; line-height: 1.55; margin: 0 0 12px; }
.c4d-flabel { display: block; font-size: 15px; font-weight: 700; margin: 14px 0 4px; }
.c4d-opt { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--line);
  border-radius: 14px; margin-top: 10px; cursor: pointer; font-size: 15px; }
.c4d-opt.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.c4d-opt .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: 0 0 auto; }
.c4d-opt.sel .dot { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.c4d-chk { display: flex; align-items: flex-start; gap: 12px; padding: 8px 2px; cursor: pointer; font-size: 14px; color: var(--muted); margin-top: 8px; }
.c4d-chk .box { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line); flex: 0 0 auto;
  display: grid; place-items: center; color: #fff; font-size: 15px; }
.c4d-chk.on .box { background: var(--accent); border-color: var(--accent); }
.c4d-ma-done { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.c4d-ma-done .c4d-check { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
  font-size: 42px; color: var(--accent-strong); background: var(--accent-soft); margin-bottom: 18px; }
.c4d-ferr { color: var(--red); font-size: 13px; margin-top: 6px; display: none; }
.c4d-ferr.on { display: block; }

/* Adicionar canal (assinar) */
.c4d-search { margin: 6px 16px 4px; }
.c4d-follow { flex: 0 0 auto; border: 1.5px solid var(--accent); color: var(--accent-strong); background: var(--surface);
  border-radius: 999px; padding: 8px 18px; font-weight: 700; font-size: 14px; cursor: pointer; }
.c4d-follow:active { background: var(--accent-soft); }
.c4d-follow.pend { border-color: var(--line); color: var(--muted); cursor: default; }
.c4d-section { margin: 16px 16px 4px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }

/* ==========================================================================
   Conta / perfil (linhas de configuração + switch)
   ========================================================================== */
.c4d-usercard { display: flex; align-items: center; gap: 14px; padding: 16px 8px; }
.c4d-usercard .c4d-ava { width: 58px; height: 58px; font-size: 20px; }
.c4d-usercard .nome { font-weight: 700; font-size: 18px; }
.c4d-usercard .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.c4d-set { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 15px 8px;
  border: 0; border-top: 1px solid var(--line); background: none; color: inherit; }
.c4d-set:last-of-type { border-bottom: 1px solid var(--line); }
.c4d-set > i.lead { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  color: var(--accent-strong); background: var(--accent-soft); font-size: 20px; }
.c4d-set-main { flex: 1; min-width: 0; }
.c4d-set-title { font-weight: 600; font-size: 15px; }
.c4d-set-sub { color: var(--muted); font-size: 13px; margin-top: 1px; }
.c4d-set > i.chev { flex: 0 0 auto; color: var(--muted); font-size: 20px; }
.c4d-set.danger .c4d-set-title, .c4d-set.danger > i.lead { color: var(--red); }
.c4d-set.danger > i.lead { background: color-mix(in srgb, var(--red) 12%, var(--surface)); }
.c4d-switch { position: relative; flex: 0 0 auto; width: 48px; height: 28px; border-radius: 999px;
  background: var(--line); transition: background .2s; cursor: pointer; }
.c4d-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.c4d-switch.on { background: var(--accent); }
.c4d-switch.on::after { transform: translateX(20px); }

/* Filtro por assunto (chips) na conversa */
.c4d-chips { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--line); }
.c4d-chip { flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--bg); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.c4d-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.c4d-msg[hidden] { display: none; }

/* ==========================================================================
   Documentos legais (privacidade, termos, excluir conta) — leitura confortável
   ========================================================================== */
.c4d-doc { padding: 10px 18px 34px; font-size: 15px; line-height: 1.65; color: var(--ink); }
.c4d-doc h1 { font-size: 23px; line-height: 1.3; margin: 8px 0 4px; }
.c4d-doc h2 { font-size: 17px; margin: 26px 0 6px; }
.c4d-doc p, .c4d-doc ul { margin: 10px 0; }
.c4d-doc ul { padding-left: 20px; }
.c4d-doc li { margin: 5px 0; }
.c4d-doc a { color: var(--accent-strong); }
.c4d-doc-data { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.c4d-doc-note { color: var(--muted); font-size: 13.5px; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.c4d-doc-erro { color: var(--red); background: color-mix(in srgb, var(--red) 10%, var(--surface));
  border-radius: 10px; padding: 10px 12px; font-size: 14px; }

/* Links http(s) dentro de mensagens de texto — tocáveis, abrem no navegador do
   sistema (ver abrirLinkExterno/linkify em conversa.php). */
.c4d-link { color: var(--accent-strong); text-decoration: underline; font-weight: 600; word-break: break-word; }
.c4d-link:active { opacity: .7; }

/* iPhone: o Safari/WKWebView dá ZOOM sozinho ao tocar num campo com letra
   menor que 16px — e não volta, deixando a tela "maior" que o aparelho, com
   pedaços cortados dos lados. 16px em todo campo editável evita o zoom.
   (@supports com -webkit-touch-callout só vale no iOS; Android fica igual.) */
@supports (-webkit-touch-callout: none) {
  input, textarea, select, .c4d-comp-input { font-size: 16px !important; }
}

/* Trava geral: nenhum conteúdo (texto sem quebra, link longo, tabela) pode
   alargar a página além da tela do aparelho. */
/* hidden no html (vai para a janela) e clip no body: overflow-x:hidden no BODY
   transformava o body num contêiner de rolagem e o cabeçalho "sticky" da
   conversa sumia por baixo do relógio do iPhone ao rolar. */
html { max-width: 100%; overflow-x: hidden; }
body { max-width: 100%; overflow-x: clip; }
.c4d-bubble { overflow-wrap: anywhere; }

/* ==========================================================================
   Interativos criados pelo "+" (12/11/2026): enquete, lista, evento, local
   ========================================================================== */
.c4d-qr.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.c4d-inline:has(> .c4d-qr:nth-child(3)) { grid-template-columns: repeat(3, 1fr); }
.c4d-linkbtn { display: inline-block; justify-self: start; text-align: left; margin-top: 8px; padding: 4px 0; background: none; border: 0; color: var(--accent-strong);
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; }
/* lista de tarefas */
.c4d-tarefa { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0;
  border-bottom: 1px solid var(--line); padding: 9px 2px; font: inherit; color: inherit; cursor: pointer; }
.c4d-tarefa-box { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--accent);
  display: grid; place-items: center; color: #fff; font-size: 14px; margin-top: 1px; }
.c4d-tarefa.feito .c4d-tarefa-box { background: var(--accent); }
.c4d-tarefa-txt { min-width: 0; }
.c4d-tarefa-txt .t { display: block; }
.c4d-tarefa.feito .c4d-tarefa-txt .t { text-decoration: line-through; color: var(--muted); }
.c4d-tarefa-txt .s { display: block; font-size: 12px; color: var(--muted); }
.c4d-tarefa-txt .s:empty { display: none; }
.c4d-tarefa-add { display: flex; gap: 6px; margin-top: 8px; }
.c4d-tarefa-add input { flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 11px;
  font: inherit; background: var(--bg); color: var(--ink); }
.c4d-tarefa-add button { flex: 0 0 auto; width: 40px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; font-size: 18px; cursor: pointer; }
/* evento */
.c4d-evento { min-width: min(64vw, 240px); }
.c4d-evento-data { color: var(--accent-strong); font-weight: 700; font-size: 13.5px; }
.c4d-evento-tit { font-weight: 800; font-size: 17px; margin-top: 2px; }
/* local */
.c4d-local { display: flex; gap: 11px; align-items: center; text-decoration: none; color: inherit; min-width: min(64vw, 240px); }
.c4d-local-ico { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--accent); font-size: 22px; }
.c4d-local .n { display: block; font-weight: 700; }
.c4d-local .e { display: block; font-size: 13px; color: var(--muted); }
.c4d-local .e:empty { display: none; }
.c4d-local .v { display: block; font-size: 13px; font-weight: 700; color: var(--accent-strong); margin-top: 2px; }
/* folha inferior + formulários do "+" */
.c4d-sheet-fundo { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.38); z-index: 40; }
.c4d-sheet { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--surface);
  border-radius: 18px 18px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.2); max-height: 86dvh; overflow: auto;
  padding: 22px 16px calc(16px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.c4d-sheet-alca { width: 38px; height: 4px; border-radius: 2px; background: var(--line); position: absolute; left: 50%; transform: translateX(-50%); top: 8px; }
.c4d-sheet-tit { display: block; font-size: 17px; margin-bottom: 10px; }
.c4d-sheet-op { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: transparent; border: 0;
  border-radius: 12px; padding: 11px 8px; cursor: pointer; font: inherit; color: inherit; }
.c4d-sheet-op:active { background: var(--accent-soft); }
.c4d-sheet-op .ic { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-strong); font-size: 22px; }
.c4d-sheet-op b { display: block; }
.c4d-sheet-op small { display: block; color: var(--muted); font-size: 13px; }
.c4d-form { display: grid; gap: 12px; }
.c4d-campo { display: grid; gap: 5px; min-width: 0; }
.c4d-campo > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.c4d-campo input, .c4d-campo textarea, .c4d-ops input { width: 100%; box-sizing: border-box; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font: inherit; background: var(--bg); color: var(--ink); }
.c4d-campo textarea { resize: vertical; }
.c4d-campo-par { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.c4d-ops { display: grid; gap: 7px; }
.c4d-opcao { display: flex; gap: 9px; align-items: center; font-size: 14.5px; }
.c4d-opcao input { flex: 0 0 auto; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.c4d-dica { color: var(--muted); font-size: 13px; }
.c4d-form-acoes { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 4px; }
.c4d-btn-pri, .c4d-btn-sec { padding: 13px; border-radius: 12px; font: inherit; font-weight: 700; cursor: pointer; }
.c4d-btn-pri { border: 0; background: var(--accent); color: #fff; }
.c4d-btn-pri[disabled] { opacity: .6; }
.c4d-btn-sec { border: 1.5px solid var(--line); background: transparent; color: var(--ink); }

/* ==========================================================================
   Fase 1 (12/11/2026): reações, citação, fixadas, apagar, gravar áudio
   ========================================================================== */
/* Segurar o dedo abre o menu do Canal4D; texto não entra em seleção nativa.
   Foto/vídeo continuam com o menu NATIVO (Copiar/Salvar). */
.c4d-thread .c4d-bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.c4d-thread .c4d-bubble img, .c4d-thread .c4d-bubble video { -webkit-touch-callout: default; }
.c4d-thread .c4d-bubble input, .c4d-thread .c4d-bubble textarea { -webkit-user-select: text; user-select: text; }
.c4d-citacao { display: block; width: 100%; text-align: left; margin: 2px 0 6px; padding: 6px 9px; border: 0; border-left: 3px solid var(--accent);
  border-radius: 8px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: inherit; font: inherit; cursor: pointer; }
.c4d-citacao .q { display: block; font-size: 12.5px; font-weight: 700; color: var(--accent-strong); }
.c4d-citacao .t { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.c4d-reacoes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.c4d-reacao { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 2px 8px; font-size: 14px; cursor: pointer; }
.c4d-reacao.minha { border-color: var(--accent); background: var(--accent-soft); }
.c4d-apagada { color: var(--muted); font-style: italic; font-size: 14px; }
.c4d-msg.c4d-destaque .c4d-bubble { outline: 2px solid var(--accent); outline-offset: 2px; transition: outline-color .3s; }
.c4d-fixadas { box-sizing: border-box; position: sticky; top: calc(64px + env(safe-area-inset-top)); z-index: 5; display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 14px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.c4d-fixadas i { color: var(--accent-strong); }
.c4d-fixadas .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c4d-fixadas .n { font-size: 12px; color: var(--muted); }
.c4d-emojis { display: flex; justify-content: space-between; gap: 4px; padding: 4px 2px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.c4d-emojis button { font-size: 28px; background: none; border: 0; border-radius: 12px; padding: 6px; cursor: pointer; }
.c4d-emojis button:active { background: var(--accent-soft); }
.c4d-sheet-op.perigo b { color: var(--red, #e11d2a); }
.c4d-sheet-op.perigo .ic { background: color-mix(in srgb, var(--red, #e11d2a) 14%, transparent); color: var(--red, #e11d2a); }
.c4d-respondendo { box-sizing: border-box; display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface); border-top: 1px solid var(--line); }
.c4d-respondendo .b { flex: 1; min-width: 0; border-left: 3px solid var(--accent); padding-left: 8px; }
.c4d-respondendo .q { display: block; font-size: 12.5px; font-weight: 700; color: var(--accent-strong); }
.c4d-respondendo .t { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c4d-respondendo button { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.c4d-gravando { box-sizing: border-box; position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line); }
.c4d-gravando button { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 20px; cursor: pointer; }
.c4d-gravando .x { background: transparent; color: var(--red, #e11d2a); }
.c4d-gravando .ok { background: var(--accent); color: #fff; margin-left: auto; }
.c4d-gravando .ponto { width: 10px; height: 10px; border-radius: 50%; background: var(--red, #e11d2a); animation: c4d-pisca 1s infinite; }
.c4d-gravando .tempo { font-variant-numeric: tabular-nums; font-weight: 700; }
.c4d-gravando .dica { color: var(--muted); font-size: 13px; }
@keyframes c4d-pisca { 50% { opacity: .25; } }

/* Micro-app: campos ricos (12/11/2026) */
.c4d-fdica { color: var(--muted); font-size: 13px; margin: -2px 0 6px; }
.c4d-opt.multi .dot { border-radius: 6px; }
select.c4d-input, textarea.c4d-input { width: 100%; box-sizing: border-box; }
textarea.c4d-input { resize: vertical; font: inherit; }
.c4d-nota { display: flex; gap: 6px; margin: 4px 0 2px; }
.c4d-nota button { font-size: 34px; line-height: 1; background: none; border: 0; color: var(--line); cursor: pointer; padding: 2px; }
.c4d-nota button.on { color: #f5b301; }
.c4d-foto { display: grid; gap: 8px; justify-items: start; margin: 4px 0; }
.c4d-foto .prev img { max-width: min(100%, 320px); max-height: 240px; border-radius: 12px; display: block; }
.c4d-foto .st, .c4d-assin .st { color: var(--muted); font-size: 13px; }
.c4d-assin { margin: 4px 0; }
.c4d-assin canvas { width: 100%; max-width: 560px; aspect-ratio: 600 / 220; background: #fff; border: 1.5px dashed var(--line); border-radius: 12px; touch-action: none; display: block; }
.c4d-assin-bar { display: flex; gap: 12px; align-items: center; }

/* Fase 2/4: cartão de status, cobrança, horários (12/11/2026) */
.c4d-status { min-width: min(64vw, 250px); }
.c4d-status .tit { font-weight: 800; font-size: 16px; }
.c4d-status .sub { color: var(--muted); font-size: 13px; }
.c4d-status .etapas { list-style: none; margin: 10px 0 2px; padding: 0; }
.c4d-status .etapas li { display: flex; gap: 10px; align-items: center; position: relative; padding: 0 0 12px; color: var(--muted); }
.c4d-status .etapas li:not(:last-child)::after { content: ''; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.c4d-status .etapas li.feita:not(:last-child)::after { background: var(--accent); }
.c4d-status .pt { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; color: #fff; background: var(--surface); position: relative; z-index: 1; }
.c4d-status li.feita .pt { background: var(--accent); border-color: var(--accent); }
.c4d-status li.atual .pt { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.c4d-status li.feita .lb, .c4d-status li.atual .lb { color: var(--ink); }
.c4d-status li.atual .lb { font-weight: 800; }
.c4d-status .det { font-size: 13.5px; margin-top: 2px; }
.c4d-cobranca { min-width: min(64vw, 250px); }
.c4d-cobranca .topo { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.c4d-cobranca .desc { font-weight: 700; min-width: 0; }
.c4d-cobranca .sit { flex: 0 0 auto; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 3px 9px; background: var(--accent-soft); color: var(--accent-strong); }
.c4d-cobranca.sit-pago .sit { background: color-mix(in srgb, #1f9d55 18%, transparent); color: #1f9d55; }
.c4d-cobranca.sit-vencido .sit { background: color-mix(in srgb, var(--red, #e11d2a) 15%, transparent); color: var(--red, #e11d2a); }
.c4d-cobranca.sit-cancelado .sit { background: var(--bg); color: var(--muted); }
.c4d-cobranca .valor { font-size: 26px; font-weight: 800; margin: 6px 0 0; }
.c4d-cobranca .venc { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.c4d-cobranca .c4d-qr { width: 100%; box-sizing: border-box; margin-top: 6px; }
.c4d-horario { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; margin-top: 7px; padding: 10px 12px; border-radius: 10px;
  border: 1.5px solid var(--accent); background: var(--surface); color: inherit; font: inherit; cursor: pointer; text-align: left; }
.c4d-horario .v { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.c4d-horario.meu { background: var(--accent); color: #fff; }
.c4d-horario.meu .v { color: #fff; }
.c4d-horario.cheio { border-color: var(--line); opacity: .6; cursor: default; }

/* IA na conversa (12/11/2026) */
.c4d-transcricao { margin-top: 6px; font-size: 14px; font-style: italic; color: var(--ink); border-left: 3px solid var(--accent); padding-left: 8px; }
.c4d-ia-resp { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); line-height: 1.5; font-size: 15px; }
.c4d-ia-carregando { color: var(--muted); animation: c4d-pisca 1.2s infinite; }
.c4d-so-avisos { position: sticky; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; text-align: center; }
.c4d-traducao { margin-top: 6px; font-size: 14px; color: var(--ink); border-left: 3px solid var(--accent); padding-left: 8px; }
/* Visto (✓✓) nas minhas mensagens */
.c4d-visto { background: none; border: 0; padding: 0 0 0 5px; margin: 0; font: inherit; font-size: 12px; font-weight: 800; letter-spacing: -2px; color: var(--muted); cursor: pointer; }
.c4d-visto.todos { color: #34b7f1; }

/* ==========================================================================
   Localização (13/11/2026): ponto atual, tempo real, pedido e mapa em tela cheia
   ========================================================================== */
.c4d-geo { display: grid; gap: 8px; width: min(72vw, 300px); max-width: 100%; }
.c4d-geo-mapa { position: relative; height: 150px; border-radius: 12px; overflow: hidden; background: #e8eef3; isolation: isolate; }
.c4d-geo-tiles { position: absolute; width: 768px; height: 768px; }
.c4d-geo-tiles img { position: absolute; width: 256px; height: 256px; max-width: none; user-select: none; }
.c4d-geo-pin { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.35); z-index: 2; }
.c4d-geo-pin.vivo::after { content: ''; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid var(--accent); animation: c4d-pulso 1.8s ease-out infinite; }
@keyframes c4d-pulso { from { transform: scale(.5); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }
.c4d-geo-osm { position: absolute; right: 4px; bottom: 3px; font-size: 9.5px; color: #333; background: rgba(255,255,255,.75); padding: 0 4px; border-radius: 4px; z-index: 2; }
.c4d-geo-inf b { display: flex; align-items: center; gap: 7px; font-size: 15px; }
.c4d-geo-inf small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.c4d-geo-inf small:empty { display: none; }
.c4d-geo-acts { display: grid; gap: 7px; }
.c4d-geo-acts .c4d-qr { display: block; text-align: center; text-decoration: none; padding: 9px; font-size: 14.5px; }
.c4d-qr-perigo { border-color: var(--red); color: var(--red); }
.c4d-vivo-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.c4d-vivo-dot.on { background: #16a34a; box-shadow: 0 0 0 3px color-mix(in srgb, #16a34a 25%, transparent); }
.c4d-geo-pedido { display: flex; gap: 11px; align-items: center; min-width: min(64vw, 240px); }
.c4d-geo-pedido .tx b { display: block; }
.c4d-geo-pedido .tx small { display: block; font-size: 13px; color: var(--muted); }
.c4d-geo-pedido + .c4d-geo-acts { margin-top: 10px; }
.c4d-mapa-tela { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--surface); }
.c4d-mapa-top { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; border-bottom: 1px solid var(--line); background: var(--surface); }
.c4d-mapa-tit { flex: 1; min-width: 0; }
.c4d-mapa-tit b { display: block; font-size: 16px; }
.c4d-mapa-tit small { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c4d-mapa-rota { padding: 8px 12px; font-size: 14px; text-decoration: none; white-space: nowrap; }
.c4d-mapa-area { flex: 1; min-height: 0; }
.c4d-mapa-centro { position: absolute; right: 16px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 500; width: 48px; height: 48px; border-radius: 50%;
  border: 0; background: var(--surface); color: var(--accent-strong); font-size: 24px; display: grid; place-items: center; box-shadow: 0 3px 12px rgba(0,0,0,.25); cursor: pointer; }
