/* Estilo simples, mobile-first, pensado para clientes leigos usarem no celular
   enquanto configuram a TV. Fontes grandes, botões grandes, pouco texto. */

:root {
  --bg: #0f1220;
  --card: #1a1f35;
  --card-2: #232a48;
  --text: #f2f3f7;
  --muted: #a6acc4;
  --accent: #22c55e;
  --accent-dark: #16a34a;
  --warn: #f59e0b;
  --danger: #ef4444;
  --whats: #25d366;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 100px;
}

a { color: var(--accent); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }

.top-header {
  text-align: center;
  padding: 24px 16px;
}

.top-header .logo {
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.top-header h1 {
  font-size: 26px;
  margin-bottom: 4px;
}

.badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 10px;
}
.badge.ok { background: rgba(34,197,94,.15); color: #4ade80; }
.badge.warn { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge.danger { background: rgba(239,68,68,.15); color: #f87171; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.device-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
@media (min-width: 560px) {
  .device-tabs { grid-template-columns: repeat(4, 1fr); }
}

.device-tab {
  background: var(--card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.device-tab .emoji { font-size: 28px; display: block; margin-bottom: 6px; }
.device-tab.active { border-color: var(--accent); background: var(--card-2); }
.device-tab small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; margin-top: 2px; }

.device-panel { display: none; }
.device-panel.active { display: block; }

.step {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.step:last-child { border-bottom: none; }

.step-num {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #06210f;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.step.final .step-num { background: #fff; }

.step-body { flex: 1; min-width: 0; }
.step-body h3 { font-size: 17px; margin-bottom: 4px; }
.step-body p { margin: 0 0 10px; color: var(--muted); font-size: 15px; }

.copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-2);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.copy-row .label { font-size: 12px; color: var(--muted); flex: 0 0 100%; }
.copy-row .value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
  font-weight: 700;
  word-break: break-all;
  flex: 1;
}
.copy-btn {
  background: var(--accent);
  color: #06210f;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.copy-btn:active { background: var(--accent-dark); }
.copy-btn.copied { background: #fff; }

.btn-link {
  display: inline-block;
  margin-top: 8px;
  background: var(--accent);
  color: #06210f;
  text-decoration: none;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 15px;
}

.obs-box {
  background: rgba(245,158,11,.1);
  border: 1px solid rgba(245,158,11,.3);
  color: #fde68a;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  margin-top: 10px;
}

.qr-box {
  text-align: center;
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  display: inline-block;
}
.qr-box img { display: block; width: 140px; height: 140px; }
.qr-caption { color: var(--muted); font-size: 13px; margin-top: 8px; text-align: center; }

.whats-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: var(--whats);
  color: #06210f;
  text-decoration: none;
  font-weight: 700;
  padding: 14px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  z-index: 50;
}

.other-apps summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  padding: 10px 0;
}
.other-apps .partner {
  padding: 10px;
  background: var(--card-2);
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 14px;
}
.other-apps .partner strong { display: block; margin-bottom: 4px; }

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 30px;
}

/* --- Admin --- */
.admin-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.admin-nav a { color: var(--text); text-decoration: none; }

table.clients {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.clients th, table.clients td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
table.clients th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.input, textarea.input {
  width: 100%;
  background: var(--card-2);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-family: inherit;
}
textarea.input { min-height: 260px; font-family: ui-monospace, monospace; font-size: 13px; }

.btn {
  background: var(--accent);
  color: #06210f;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn.secondary { background: var(--card-2); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; }

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }

.flash {
  background: rgba(34,197,94,.15);
  color: #4ade80;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}
.flash.error { background: rgba(239,68,68,.15); color: #f87171; }

/* ============================================================
   PAINEL (dashboard, conversas, whatsapp, ajustes)
   ============================================================ */

.painel-topo {
  background: var(--card);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  position: sticky;
  top: 0;
  z-index: 40;
}
.painel-topo-inner {
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.marca {
  font-weight: 800;
  letter-spacing: .5px;
  font-size: 15px;
  color: var(--accent);
  white-space: nowrap;
}

.abas { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.aba {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.aba:hover { background: var(--card-2); color: var(--text); }
.aba.ativa { background: var(--card-2); color: var(--text); }

.selo {
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  margin-left: 4px;
}

.topo-direita { display: flex; align-items: center; gap: 14px; }
.status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  background: var(--card-2);
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.sair { color: var(--muted); font-size: 13px; text-decoration: none; }

.titulo-linha {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 22px 0 18px;
  flex-wrap: wrap;
}
.titulo-linha h1 { font-size: 22px; margin: 0; }
.voltar { color: var(--muted); text-decoration: none; font-size: 14px; }

.sub { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
.erro-txt { color: #f87171; }

/* --- Cartões de números --- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  border-top: 3px solid transparent;
}
.stat.ok { border-top-color: var(--accent); }
.stat.warn { border-top-color: var(--warn); }
.stat.danger { border-top-color: var(--danger); }
.stat-num { font-size: 26px; font-weight: 800; }
.stat-lbl { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* --- Tabela de clientes --- */
table.clients td a { text-decoration: none; }
table.clients.pequena { font-size: 13px; }
table.clients th:first-child, table.clients td:first-child { padding-left: 18px; }
table.clients th:last-child, table.clients td:last-child { padding-right: 18px; }

.tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255,255,255,.08);
  color: var(--muted);
  vertical-align: middle;
}
.tag.ok { background: rgba(34,197,94,.15); color: #4ade80; }
.tag.warn { background: rgba(245,158,11,.15); color: #fbbf24; }

.acoes { white-space: nowrap; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mini {
  background: var(--card-2);
  color: var(--text);
  border: none;
  border-radius: 7px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-family: inherit;
}
.mini:hover { background: rgba(255,255,255,.14); }
.mini.verde { background: var(--accent); color: #06210f; }
.btn.verde { background: var(--whats); color: #06210f; }

.flash.aviso { background: rgba(245,158,11,.13); color: #fbbf24; }
.flash a { color: inherit; font-weight: 700; }

/* --- Ficha do cliente --- */
.colunas { display: grid; grid-template-columns: 1fr; gap: 0 20px; }
@media (min-width: 900px) { .colunas { grid-template-columns: 1fr 1fr; } }

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 14px;
  margin: 16px 0 0;
  cursor: pointer;
}
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

.previa {
  background: var(--card-2);
  border-radius: 10px;
  padding: 12px;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
  margin: 0 0 14px;
  font-family: inherit;
  color: var(--muted);
}
.card.perigo { border: 1px solid rgba(239,68,68,.25); }
.card h2 { font-size: 15px; margin-bottom: 10px; }

.etiquetas { margin: 8px 0; line-height: 2; }
.etiquetas code, .lista-explicacao code {
  background: var(--card-2);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 12px;
}
textarea.input.alto { min-height: 200px; }

.lista-explicacao { color: var(--muted); font-size: 13.5px; padding-left: 20px; margin: 0; }
.lista-explicacao li { margin-bottom: 8px; }

/* --- Aba WhatsApp --- */
.wa-estado { text-align: center; padding: 10px 0 18px; }
.wa-icone { font-size: 40px; }
.wa-estado h2 { font-size: 19px; margin: 8px 0 4px; }
.wa-estado .qr {
  width: 260px;
  max-width: 100%;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  margin: 16px auto 8px;
  display: block;
}
.wa-botoes { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* --- Aba Conversas --- */
.chat-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  height: calc(100vh - 190px);
  min-height: 460px;
}
@media (min-width: 800px) { .chat-layout { grid-template-columns: 300px 1fr; } }

.chat-lista {
  background: var(--card);
  border-radius: var(--radius);
  overflow-y: auto;
  max-height: 100%;
}
.conversa {
  display: block;
  padding: 13px 15px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-decoration: none;
  color: var(--text);
  position: relative;
}
.conversa:hover { background: var(--card-2); }
.conversa.selecionada { background: var(--card-2); border-left: 3px solid var(--accent); }
.conversa-nome { font-weight: 700; font-size: 14px; }
.conversa-previa {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.conversa-hora { color: var(--muted); font-size: 11px; margin-top: 3px; }
.vazio-lista { padding: 24px 16px; color: var(--text); font-size: 14px; text-align: center; }

.chat-painel {
  background: var(--card);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 100%;
}
.chat-cabecalho {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.chat-mensagens {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-vazio {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 14px;
  padding: 30px;
  text-align: center;
}

.bolha { max-width: 78%; border-radius: 12px; padding: 9px 13px; }
.bolha.dele { background: var(--card-2); align-self: flex-start; border-bottom-left-radius: 3px; }
.bolha.minha { background: #14532d; align-self: flex-end; border-bottom-right-radius: 3px; }
.bolha.minha.auto { background: #1e3a5f; }
.bolha-texto { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.bolha-hora { font-size: 10.5px; color: var(--muted); margin-top: 3px; text-align: right; }

.chat-envio {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  align-items: flex-end;
}
.chat-envio textarea {
  flex: 1;
  background: var(--card-2);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 130px;
  min-height: 44px;
}
.chat-envio textarea:disabled { opacity: .5; }

.tag.plano { background: rgba(99,102,241,.18); color: #a5b4fc; }

/* --- Anexos no chat (fotos, audios, videos, documentos) --- */
.anexo-foto { display: block; margin-bottom: 6px; }
.anexo-foto img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 9px;
  display: block;
  cursor: zoom-in;
}
.anexo-audio { width: 240px; max-width: 100%; margin-bottom: 6px; display: block; height: 38px; }
.anexo-video { max-width: 100%; max-height: 260px; border-radius: 9px; margin-bottom: 6px; display: block; }
.anexo-arquivo {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.07);
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 6px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
}
.anexo-icone { font-size: 22px; }
