/* Check-ins Wellhub — CSS próprio, sem build. Tokens em :root; modo escuro pelo sistema ou pelo botão. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #111827;
  --text-2: #3d4655;
  --muted: #6b7280;
  --primary: #0d9488;
  --primary-strong: #0f766e;
  --primary-soft: #e6f6f4;
  --primary-text: #ffffff;
  --success: #16a34a; --success-soft: #e8f6ee;
  --warning: #c2770a; --warning-soft: #fdf3e2;
  --danger: #dc2626;  --danger-soft: #fdecec;
  --neutral-soft: #eef0f3;
  --sidebar: #0c1322;
  --sidebar-2: #131c2f;
  --sidebar-text: #b7c0d0;
  --sidebar-strong: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --fonte: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
/* Escuro: pelo sistema (sem JS) ou pela escolha salva (tema.js põe data-tema no <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --bg: #0a0f1a; --surface: #111827; --surface-2: #172033; --border: #232d3f; --border-strong: #334155;
    --text: #e8ecf2; --text-2: #c3cad6; --muted: #8b95a7;
    --primary: #2dd4bf; --primary-strong: #5eead4; --primary-soft: #0f2e2c; --primary-text: #062421;
    --success: #4ade80; --success-soft: #0f2a1b; --warning: #fbbf24; --warning-soft: #2d230d;
    --danger: #f87171; --danger-soft: #331517; --neutral-soft: #1c2536;
    --sidebar: #070b13; --sidebar-2: #0f1524;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-tema="escuro"] {
  --bg: #0a0f1a; --surface: #111827; --surface-2: #172033; --border: #232d3f; --border-strong: #334155;
  --text: #e8ecf2; --text-2: #c3cad6; --muted: #8b95a7;
  --primary: #2dd4bf; --primary-strong: #5eead4; --primary-soft: #0f2e2c; --primary-text: #062421;
  --success: #4ade80; --success-soft: #0f2a1b; --warning: #fbbf24; --warning-soft: #2d230d;
  --danger: #f87171; --danger-soft: #331517; --neutral-soft: #1c2536;
  --sidebar: #070b13; --sidebar-2: #0f1524;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--fonte); }
a { color: var(--primary-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); }
h1 { font-size: 1.6rem; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.num, .tabular { font-variant-numeric: tabular-nums; }
code { font-size: .85em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
.icone { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icone-sm { width: 15px; height: 15px; }
.icone-lg { width: 22px; height: 22px; }
[hidden] { display: none !important; }

/* ---------------- Layout ---------------- */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: 1.1rem .8rem; gap: 1rem; }
.marca { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem; color: var(--sidebar-strong); font-weight: 700;
  font-size: 1.02rem; letter-spacing: -.01em; }
.marca:hover { text-decoration: none; }
.marca-logo { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #14b8a6, #0f766e); color: #fff; box-shadow: 0 4px 12px rgba(20, 184, 166, .35); }
.marca small { display: block; font-weight: 500; color: var(--sidebar-text); font-size: .74rem; }
.estudio-chip { margin: 0 .25rem; padding: .6rem .7rem; border-radius: 10px; background: var(--sidebar-2);
  border: 1px solid rgba(255, 255, 255, .06); }
.estudio-chip .rotulo { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #7c879b; }
.estudio-chip strong { display: block; color: var(--sidebar-strong); font-size: .9rem; line-height: 1.3; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-titulo { padding: .9rem .75rem .35rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: #6c778b; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 8px; color: var(--sidebar-text);
  font-weight: 500; font-size: .92rem; position: relative; }
.nav a:hover { background: rgba(255, 255, 255, .05); color: var(--sidebar-strong); text-decoration: none; }
.nav a.ativo { background: rgba(45, 212, 191, .12); color: var(--sidebar-strong); }
.nav a.ativo::before { content: ""; position: absolute; left: -.8rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: #2dd4bf; }
.nav a.ativo .icone { color: #2dd4bf; }
.sidebar-rodape { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .07); padding: .9rem .5rem 0;
  display: flex; align-items: center; gap: .65rem; }
.sidebar-rodape .quem { flex: 1; min-width: 0; }
.sidebar-rodape .quem strong { display: block; color: var(--sidebar-strong); font-size: .86rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.sidebar-rodape .quem span { display: block; font-size: .74rem; color: #7c879b; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.btn-icone-escuro { background: transparent; border: 0; color: var(--sidebar-text); padding: .45rem; border-radius: 8px; cursor: pointer; }
.btn-icone-escuro:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.principal { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.conteudo { width: 100%; max-width: 1180px; margin: 0 auto; padding: 1.75rem 2rem 3rem; }
.faixa-suporte { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .6rem 2rem; background: #92400e; color: #fff; font-size: .88rem; }
.faixa-suporte form { margin: 0; }
.faixa-suporte .btn { background: rgba(255, 255, 255, .15); color: #fff; border-color: rgba(255, 255, 255, .35); }
.faixa-suporte .btn:hover { background: rgba(255, 255, 255, .25); }

.cabecalho { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.cabecalho .titulo { min-width: 0; }
.cabecalho .sub { margin: .3rem 0 0; color: var(--muted); }
.voltar { display: inline-flex; align-items: center; gap: .3rem; font-size: .86rem; color: var(--muted); margin-bottom: .6rem; }
.acoes { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------------- Cartões ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-corpo { padding: 1.2rem 1.25rem; }
.card-topo { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border); }
.card-topo h2 { display: flex; align-items: center; gap: .5rem; }
.card-topo h2 .icone { color: var(--muted); }
.pilha > * + * { margin-top: 1rem; }
.grade { display: grid; gap: 1rem; }
.grade-3-1 { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; }
.grade-1-1 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.espaco { margin-top: 1rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .2rem; }
.kpi-topo { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .82rem; font-weight: 500; }
.kpi-icone { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.kpi-icone.tom-primario { background: var(--primary-soft); color: var(--primary-strong); }
.kpi-icone.tom-sucesso { background: var(--success-soft); color: var(--success); }
.kpi-icone.tom-alerta { background: var(--warning-soft); color: var(--warning); }
.kpi-valor { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: .25rem; }
.kpi-sub { color: var(--muted); font-size: .8rem; }
.kpi .barra { margin-top: .55rem; }

/* status do robô */
.status { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.status-ponto { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.status-ponto.verde { background: var(--success-soft); color: var(--success); }
.status-ponto.amarelo { background: var(--warning-soft); color: var(--warning); }
.status-ponto.vermelho { background: var(--danger-soft); color: var(--danger); }
.status-ponto.cinza { background: var(--neutral-soft); color: var(--muted); }
.status .texto { flex: 1; min-width: 200px; }
.status .texto strong { font-size: 1.02rem; }
.status .texto p { margin: .1rem 0 0; color: var(--muted); font-size: .88rem; }

/* ---------------- Selos e etiquetas ---------------- */
.selo { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .6rem; border-radius: 999px; font-size: .78rem;
  font-weight: 600; white-space: nowrap; }
.selo::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.selo.verde { background: var(--success-soft); color: var(--success); }
.selo.amarelo { background: var(--warning-soft); color: var(--warning); }
.selo.vermelho { background: var(--danger-soft); color: var(--danger); }
.selo.cinza { background: var(--neutral-soft); color: var(--muted); }
.etiqueta { display: inline-block; padding: .05rem .45rem; border-radius: 6px; font-size: .72rem; font-weight: 600;
  background: var(--neutral-soft); color: var(--text-2); white-space: nowrap; vertical-align: 1px; }
.etiqueta.alerta { background: var(--warning-soft); color: var(--warning); }
.etiqueta.primaria { background: var(--primary-soft); color: var(--primary-strong); }
.etiqueta.perigo { background: var(--danger-soft); color: var(--danger); }

/* ---------------- Barra de progresso ---------------- */
.barra { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.barra > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.barra.completa > span { background: var(--success); }
.barra.baixa > span { background: var(--warning); }
.progresso { display: flex; align-items: center; gap: .6rem; min-width: 120px; }
.progresso .barra { flex: 1; }
.progresso .num { font-size: .85rem; color: var(--text-2); min-width: 2.6rem; text-align: right; }

/* ---------------- Tabelas ---------------- */
.tabela-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  padding: .65rem 1.25rem; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: .7rem 1.25rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.apagado td { color: var(--muted); }
tr.apagado td a { color: var(--muted); }
.celula-nome { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.celula-nome a { font-weight: 500; color: var(--text); }
.celula-nome .etiqueta { margin-left: .25rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: .74rem;
  font-weight: 700; background: var(--primary-soft); color: var(--primary-strong); }
.avatar.lg { width: 52px; height: 52px; font-size: 1.05rem; }
.avatar.apagado { background: var(--neutral-soft); color: var(--muted); }
.vazio { padding: 2.5rem 1.25rem; text-align: center; color: var(--muted); }
.vazio .icone { width: 30px; height: 30px; margin-bottom: .5rem; opacity: .6; display: block; margin-inline: auto; }
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { display: flex; align-items: center; gap: .75rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--border); }
.lista li:last-child { border-bottom: 0; }
.lista .grow { flex: 1; min-width: 0; }
.lista .grow a { color: var(--text); font-weight: 500; }
.hora { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-2); min-width: 3.2rem; }
.card-rodape { padding: .8rem 1.25rem; border-top: 1px solid var(--border); }

/* ---------------- Formulários e botões ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem .95rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 .88rem/1.2 var(--fonte);
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); outline-offset: 1px; }
.btn-primario { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primario:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn-perigo { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-perigo:hover { background: var(--danger-soft); }
.btn-fantasma { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-fantasma:hover { background: var(--surface-2); }
.btn-sm { padding: .35rem .65rem; font-size: .8rem; }
.btn.desabilitado { opacity: .45; pointer-events: none; }
.paginacao { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap;
  padding: .7rem 1.25rem; border-top: 1px solid var(--border); }
.btn-bloco { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; margin: 0; }
.campo { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
.campo > span { font-size: .84rem; font-weight: 600; color: var(--text-2); }
.campo small { color: var(--muted); font-size: .78rem; }
input, select, textarea { width: 100%; font: inherit; font-size: .92rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .55rem .7rem; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
textarea { resize: vertical; min-height: 6rem; }
textarea.texto-copiar { font: .86rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; min-height: 14rem; background: var(--surface-2); }
.linha-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 .85rem; }
.ajuda { color: var(--muted); font-size: .84rem; }
.form-acoes { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* barra de filtros */
.filtros { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.filtros .busca { position: relative; flex: 1 1 240px; }
.filtros .busca .icone { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filtros .busca input { padding-left: 2.2rem; }
.filtros select, .filtros input[type=date], .filtros input[type=month] { width: auto; }
.segmentado { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; flex-wrap: wrap; }
.segmentado a { padding: .38rem .8rem; border-radius: 7px; font-size: .85rem; font-weight: 600; color: var(--text-2); }
.segmentado a:hover { text-decoration: none; background: var(--surface); }
.segmentado a.ativo { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.navegador { display: inline-flex; align-items: center; gap: .35rem; }
.navegador input { width: auto; }

/* avisos */
.aviso { display: flex; align-items: flex-start; gap: .6rem; padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1.25rem;
  border: 1px solid; font-size: .92rem; }
.aviso .icone { margin-top: 1px; }
.aviso > div { overflow-wrap: anywhere; }
.aviso.ok { background: var(--success-soft); color: var(--text); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.aviso.ok .icone { color: var(--success); }
.aviso.erro { background: var(--danger-soft); color: var(--text); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.aviso.erro .icone { color: var(--danger); }
.aviso.info { background: var(--primary-soft); color: var(--text); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.aviso.info .icone { color: var(--primary-strong); }

details.recolhe > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem; padding: 1rem 1.25rem;
  font-weight: 600; }
details.recolhe > summary::-webkit-details-marker { display: none; }
details.recolhe > summary::after { content: "›"; margin-left: auto; font-size: 1.3rem; line-height: 1; color: var(--muted); transition: transform .15s; }
details.recolhe[open] > summary::after { transform: rotate(90deg); }
details.recolhe > summary .icone { color: var(--muted); }
details.recolhe > .card-corpo { border-top: 1px solid var(--border); }
details.excluir summary { list-style: none; cursor: pointer; color: var(--muted); font-size: .8rem; display: inline-flex; gap: .25rem; align-items: center; }
details.excluir summary::-webkit-details-marker { display: none; }
details.excluir summary:hover { color: var(--danger); }
details.excluir[open] { min-width: 230px; }
details.excluir form { display: flex; gap: .35rem; margin-top: .4rem; }
details.excluir input { padding: .3rem .5rem; font-size: .82rem; }

/* ---------------- Autenticação ---------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-lado { background: radial-gradient(1200px 600px at 10% 10%, #134e4a 0%, transparent 60%), linear-gradient(160deg, #0c1322, #0b2a2a);
  color: #d5dde8; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-lado .marca { padding: 0; font-size: 1.1rem; }
.auth-lado h1 { color: #fff; font-size: 2.1rem; margin: 0 0 1rem; max-width: 26rem; }
.auth-lado ul { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .8rem; max-width: 26rem; }
.auth-lado li { display: flex; gap: .65rem; align-items: flex-start; }
.auth-lado li .icone { color: #2dd4bf; margin-top: 2px; }
.auth-form { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-caixa { width: 100%; max-width: 380px; }
.auth-caixa .marca { color: var(--text); padding: 0; margin-bottom: 2rem; display: none; }
.auth-caixa h2 { font-size: 1.45rem; margin-bottom: .35rem; letter-spacing: -.01em; }
.auth-caixa .sub { color: var(--muted); margin-bottom: 1.5rem; }
.auth-caixa .rodape { margin-top: 1.25rem; font-size: .88rem; text-align: center; }

/* Páginas públicas de texto (política de privacidade) */
.documento { max-width: 760px; margin: 0 auto; padding: 2rem 16px 3rem; }
.documento .marca { color: var(--text); padding: 0; margin-bottom: 1.5rem; }
.documento h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
.documento h2 { font-size: 1.1rem; margin: 1.6rem 0 .5rem; }
.documento p, .documento li { line-height: 1.6; }
.documento ul { padding-left: 1.2rem; }

/* Conversas do WhatsApp */
.conversa-linha { display: flex; gap: .75rem; align-items: center; min-width: 0; color: inherit; text-decoration: none; }
.conversa-linha:hover strong { text-decoration: underline; }
.conversa-linha .grow { min-width: 0; }
.conversa-linha .quando { text-align: right; flex-shrink: 0; }
.conversa-previa { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- Celular ---------------- */
.scrim { display: none; }
@media (max-width: 960px) {
  .grade-3-1, .grade-1-1 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { display: block; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: 272px; height: auto; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .menu-toggle:checked ~ .sidebar { transform: none; }
  .menu-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(5, 10, 20, .5); }
  .topbar { display: flex; align-items: center; gap: .5rem; position: sticky; top: 0; z-index: 20; padding: .6rem .9rem;
    background: var(--surface); border-bottom: 1px solid var(--border); }
  .topbar label { padding: .4rem; border-radius: 8px; cursor: pointer; color: var(--text); display: grid; }
  .topbar .titulo-topo { font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .titulo-topo small { display: block; font-weight: 500; color: var(--muted); font-size: .74rem; }
  .conteudo { padding: 1.1rem 1rem 2.5rem; }
  .faixa-suporte { padding: .55rem 1rem; }
  h1 { font-size: 1.35rem; }
  .cabecalho { margin-bottom: 1.1rem; }
  .kpis { grid-template-columns: 1fr 1fr; gap: .65rem; }
  .kpi { padding: .85rem .9rem; }
  .kpi-valor { font-size: 1.2rem; }
  .kpi-icone { display: none; }
  th, td { padding: .6rem .75rem; }
  .lista li { padding: .65rem .9rem; }
  .card-topo, .card-corpo, .card-rodape, details.recolhe > summary { padding-left: 1rem; padding-right: 1rem; }
  .esconder-celular { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-lado { display: none; }
  .auth-caixa .marca { display: flex; }
  .progresso { min-width: 84px; }
}
@media (max-width: 380px) { .kpis { grid-template-columns: 1fr; } }

/* Tela ao vivo do robô (login do Wellhub) */
.tela-moldura { background: #0b1020; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); margin: .75rem 0; }
.tela-moldura img { display: block; width: 100%; height: auto; aspect-ratio: 1366 / 900; cursor: crosshair; outline: none; }
.tela-moldura img:focus { box-shadow: inset 0 0 0 3px var(--primary); }
.tela-digitar { display: flex; gap: .5rem; margin-bottom: .75rem; }
.tela-digitar input { flex: 1; min-width: 0; }
.tela-teclas { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.tela-teclas .empurrar { margin-left: auto; }
@media (max-width: 860px) {
  /* no celular a tela do Wellhub (1366 px) fica minúscula: mostra maior e rola para os lados */
  .tela-moldura { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tela-moldura img { width: 1000px; max-width: none; }
}

.aviso.alerta { background: var(--warning-soft); color: var(--text); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.aviso.alerta .icone { color: var(--warning); }
.caixa { display: flex; align-items: center; gap: .5rem; font-size: .92rem; margin: .45rem 0; cursor: pointer; }
.caixa input { width: auto; margin: 0; }
form.card-rodape > .btn { margin-top: .5rem; }

/* Ações por linha (mensalidades): o formulário abre logo abaixo do botão */
td.acoes-linha { text-align: right; white-space: nowrap; }
details.menu-acao { display: inline-block; position: relative; text-align: left; white-space: normal; }
details.menu-acao > summary { list-style: none; }
details.menu-acao > summary::-webkit-details-marker { display: none; }
details.menu-acao[open] > .menu-acao-corpo { position: absolute; right: 0; z-index: 20; width: 260px; }
.menu-acao-corpo { background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 10px; padding: .75rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12); margin-top: .35rem; }
details.menu-acao[open] { z-index: 20; }
.menu-acao-corpo .espaco-topo { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--border); }
form.linha-inline { display: flex; gap: .5rem; align-items: center; margin: 0; }
form.linha-inline input { margin: 0; min-width: 0; }
ul.lista-simples { margin: .9rem 0 0; padding-left: 1.1rem; }
ul.lista-simples li { margin: .25rem 0; }

/* Botão de tema: mostra a lua no claro e o sol no escuro */
.trocar-tema .icone-sol { display: none; }
:root[data-tema="escuro"] .trocar-tema .icone-sol { display: inline; }
:root[data-tema="escuro"] .trocar-tema .icone-lua { display: none; }
.topbar .trocar-tema { margin-left: auto; background: transparent; border: 0; color: var(--text); padding: .45rem; border-radius: 8px;
  cursor: pointer; display: grid; }
.auth-tema { position: fixed; top: .9rem; right: .9rem; z-index: 5; }
.auth-tema .trocar-tema { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: .5rem;
  border-radius: 10px; cursor: pointer; display: grid; box-shadow: var(--shadow); }
/* Dinheiro com "R$" na frente; horário estreito */
.com-prefixo { position: relative; display: block; }
.com-prefixo > span { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .88rem;
  pointer-events: none; }
.com-prefixo > input { padding-left: 2.2rem; text-align: right; font-variant-numeric: tabular-nums; }
input.campo-hora { max-width: 8rem; font-variant-numeric: tabular-nums; }
form.linha-inline .com-prefixo { max-width: 9rem; flex: none; }

/* ---------------- Ajustes de layout (telas médias e celular) ---------------- */
@media (min-width: 861px) {
  /* a coluna do menu continua escura até o fim da página */
  .app { background: linear-gradient(90deg, var(--sidebar) 252px, var(--bg) 252px); }
}
.card-topo { flex-wrap: wrap; }
.card { container-type: inline-size; }
.kpi.card { container-type: normal; }
/* indicadores: todos na mesma linha quando cabe; em 2 colunas quando não (nunca "3 + 1") */
.kpis { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
@media (max-width: 1180px) {
  .kpis { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 380px) { .kpis { grid-template-columns: 1fr; } }
@media (max-width: 960px) {
  .grade-3-1, .grade-1-1 { grid-template-columns: minmax(0, 1fr); }
}
.grade > * { min-width: 0; }
form.card-rodape .ajuda, form .form-acoes + .ajuda { margin-top: .6rem; margin-bottom: 0; }

/* Histórico (robô): data e etiqueta na 1ª linha, o texto embaixo, ocupando a largura toda */
.lista.historico li { flex-wrap: wrap; row-gap: .2rem; }
.lista.historico li .grow { flex: 1 1 14rem; }
@container (max-width: 460px) {
  .lista.historico li .grow { flex-basis: 100%; }
}

/* Tabelas largas viram cartões quando o quadro fica estreito (celular ou coluna lateral) */
@container (max-width: 620px) {
  table.cartoes thead { display: none; }
  table.cartoes, table.cartoes tbody, table.cartoes tfoot { display: block; }
  table.cartoes tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem 1rem; padding: .85rem 1rem;
    border-bottom: 1px solid var(--border); }
  table.cartoes tbody tr:last-child { border-bottom: 0; }
  table.cartoes td { display: block; padding: 0; border: 0; text-align: left; white-space: normal; background: none !important; }
  table.cartoes td[data-rotulo]::before { content: attr(data-rotulo); display: block; font-size: .68rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .1rem; }
  table.cartoes td.titulo-cartao { grid-column: 1 / -1; font-weight: 600; }
  table.cartoes td.acoes-linha { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem; }
  table.cartoes td.acoes-linha:empty { display: none; }
  table.cartoes td.esconder-celular { display: none; }
  table.cartoes tfoot tr { background: var(--surface-2); }
  table.cartoes details.menu-acao[open] { flex-basis: 100%; }
  table.cartoes details.menu-acao[open] > .menu-acao-corpo { position: static; width: auto; box-shadow: none; }
  form.linha-inline { flex-wrap: wrap; }
  form.linha-inline > input { flex: 1 1 100%; }
}
@media (max-width: 860px) {
  .filtros input[type=date], .filtros input[type=month] { flex: 1 1 8rem; min-width: 0; width: auto; }
  .navegador input { min-width: 0; flex: 1; }
  .navegador { max-width: 100%; }
}
/* Serviços contratados (painel geral) */
.servicos-escolha { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.servico-opcao { border: 1px solid var(--border); border-radius: 10px; padding: .75rem .9rem; background: var(--surface-2); }
.servico-opcao .campo { margin: .5rem 0 .25rem; }
.lista.categorias li { align-items: flex-start; }
.lista.categorias form.grow .campo { margin-bottom: .5rem; }
.chips { display: inline-flex; gap: .25rem; flex-wrap: wrap; }

/* ---------------- Simulador do atendimento (estilo WhatsApp) ---------------- */
.chat { display: flex; flex-direction: column; gap: .5rem; max-height: 60vh; overflow-y: auto; padding: .9rem; margin: .5rem 0 1rem;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.chat-msg { max-width: 82%; padding: .5rem .75rem; border-radius: 12px; box-shadow: var(--shadow); }
.chat-msg.entrada { align-self: flex-start; background: var(--surface); border-top-left-radius: 4px; }
.chat-msg.saida { align-self: flex-end; background: var(--primary-soft); border-top-right-radius: 4px; }
.chat-msg.humano { background: var(--warning-soft); }
.chat-quem { font-size: .72rem; font-weight: 600; color: var(--muted); margin-bottom: .15rem; }
.chat-texto { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-meta { font-size: .7rem; color: var(--muted); margin-top: .25rem; }
.chat-sistema { align-self: center; font-size: .78rem; color: var(--muted); background: var(--neutral-soft); padding: .25rem .65rem;
  border-radius: 999px; text-align: center; max-width: 95%; }
.chat-digitando { display: none; align-self: flex-start; font-size: .8rem; color: var(--muted); font-style: italic; }
.chat.htmx-request .chat-digitando { display: block; }
.chat-faq { margin-top: .4rem; font-size: .82rem; }
.chat-faq summary { cursor: pointer; color: var(--primary-strong); }
.chat-faq form { margin-top: .5rem; }
.chat-form textarea { min-height: 3.2rem; margin-bottom: .5rem; }
.chat-form select { width: auto; }
