/* Paleta neutra (preto/branco/cinza) — pedido do Gabriel depois de ver o
   verde/terracota do painel real da Nayara aplicado aqui: "ficou estranho".
   Mantém os MESMOS nomes de variável (sage/blush/cream) só pra não precisar
   tocar em cada referência espalhada pelo HTML/CSS — só o valor mudou pra
   escala de cinza pura. Único lugar que ainda usa cor de verdade são os
   status semânticos (ok/warn/danger), que precisam continuar distinguíveis. */
:root {
  --sage-100: #F1F1EF;
  --sage-200: #E2E2DF;
  --sage-500: #8D8D8A;
  --sage-700: #55554F;
  --sage-800: #2E2E2B;
  --sage-900: #171716;
  --blush-100: #E9E9E6;
  --blush-300: #C7C7C3;
  --blush-500: #57574F;
  --blush-600: #171716;
  --cream-100: #FAFAF9;
  --cream-200: #F1F1EF;
  --ok-600: #4C7A54;
  --warn-600: #B9843A;
  --danger-600: #B0503F;
  --shadow-soft: 0 10px 28px rgba(20,20,18,0.10), 0 2px 6px rgba(20,20,18,0.06);
  --shadow-lift: 0 20px 44px rgba(20,20,18,0.16), 0 4px 12px rgba(20,20,18,0.08);
  --shadow-glow: 0 0 0 1px rgba(23,23,22,0.18), 0 8px 28px rgba(23,23,22,0.20), 0 2px 8px rgba(23,23,22,0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream-200);
  color: var(--sage-900);
  font-family: 'Manrope', system-ui, sans-serif;
}

h1, h2, h3, .font-display {
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ---------- faixa de demonstração + seletor de especialidade ---------- */
.demo-badge {
  background: var(--blush-100);
  color: var(--blush-600);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 999px;
}

.seletor-especialidade {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  background: var(--sage-900);
  color: var(--cream-100);
}

.seletor-especialidade .rotulo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--sage-200);
}

.seletor-btns {
  display: inline-flex;
  gap: 4px;
  background: rgba(255,255,255,0.08);
  padding: 4px;
  border-radius: 12px;
}

.seletor-btns button {
  border: none;
  background: transparent;
  color: var(--sage-200);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}

.seletor-btns button.ativo {
  background: var(--cream-100);
  color: var(--sage-900);
}

.seletor-btns button:not(.ativo):hover {
  color: #fff;
}

.links-demo {
  display: flex;
  gap: 8px;
}

.links-demo a {
  color: var(--sage-200);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  padding: 8px 12px;
}

.links-demo a:hover { color: #fff; border-color: rgba(255,255,255,0.4); }
.links-demo a.ativo { background: var(--blush-600); border-color: var(--blush-600); color: #fff; }

@media (max-width: 640px) {
  .seletor-especialidade { padding: 12px 16px; justify-content: center; }
  .seletor-especialidade .rotulo { width: 100%; justify-content: center; flex-wrap: wrap; text-align: center; }
  .seletor-btns { width: 100%; justify-content: center; }
  .seletor-btns button { flex: 1; }
  .links-demo { width: 100%; justify-content: center; }
  .links-demo a { flex: 1; text-align: center; }
}

/* ---------- layout geral ---------- */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 56px);
}

/* ---------- topbar + menu hamburguer (mobile) ----------
   Antes disso, o sidebar simplesmente sumia (display:none) abaixo de 860px
   sem nenhuma navegação alternativa — impossível trocar de seção no
   celular. Agora vira um drawer que desliza da esquerda, mesmo padrão do
   painel real (Agente Clinicas/painel/src/components/Layout.tsx). */
.topbar-mobile { display: none; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }

  /* Só o topbar-mobile (com o hamburguer) fica fixo no topo — dois "sticky
     top:0" empilhados (esse + .seletor-especialidade) se sobrepõem em vez
     de ficar um abaixo do outro, então o seletor de especialidade passa a
     rolar com o conteúdo no celular; o essencial (abrir o menu) continua
     sempre visível. */
  .seletor-especialidade { position: static; }

  .topbar-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: var(--sage-900);
    color: var(--cream-100);
    position: sticky;
    top: 0;
    z-index: 45;
  }
  .topbar-mobile .clinica { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .topbar-mobile .nome { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .botao-hamburguer {
    flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; border: none;
    background: rgba(255,255,255,0.08); color: var(--cream-100);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
  }
  .botao-hamburguer:active { background: rgba(255,255,255,0.16); }

  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 60;
    width: 82%; max-width: 300px; height: 100vh;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(0.16,1,0.3,1);
    box-shadow: var(--shadow-lift);
    overflow-y: auto;
  }
  .sidebar.aberta { transform: translateX(0); }

  .overlay-mobile {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(0,0,0,0.5);
    opacity: 0; pointer-events: none;
    transition: opacity .2s;
  }
  .overlay-mobile.visivel { opacity: 1; pointer-events: auto; }

  .botao-fechar-sidebar { display: flex !important; }
}

.sidebar {
  background: linear-gradient(180deg, var(--sage-900), #0D0D0C);
  color: var(--cream-100);
  padding: 24px 18px;
}

.botao-fechar-sidebar {
  display: none;
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: rgba(255,255,255,0.08); color: var(--cream-100);
  align-items: center; justify-content: center; cursor: pointer;
  margin-left: auto; flex-shrink: 0;
}

.sidebar .clinica {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.sidebar .avatar-clinica {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--blush-600);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; flex-shrink: 0;
}

.sidebar .clinica p { margin: 0; line-height: 1.2; }
.sidebar .clinica .nome { font-weight: 800; font-size: 15px; }
.sidebar .clinica .sub { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--sage-500); margin-top: 3px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 700;
  color: var(--sage-200);
  cursor: pointer;
  margin-bottom: 4px;
  transition: background-color .15s, color .15s;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--cream-100); }
.nav-item.ativo { background: var(--blush-600); color: var(--cream-100); }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

main { padding: 32px 36px; min-width: 0; }
@media (max-width: 640px) { main { padding: 20px; } }

.topo-pagina {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 28px;
}

.topo-pagina h1 { font-size: 28px; margin: 0; color: var(--sage-900); }

.card {
  min-width: 0;
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.grid-kpi {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 26px;
}
@media (max-width: 860px) { .grid-kpi { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .grid-kpi { grid-template-columns: 1fr; } }

.kpi .label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--sage-700); margin: 0 0 8px; }
.kpi .valor { font-size: 26px; font-weight: 800; color: var(--sage-900); margin: 0; }
.kpi .hint { font-size: 11px; font-weight: 700; color: var(--ok-600); margin: 8px 0 0; }

.secao { display: none; }
.secao.ativa { display: block; }

/* ---------- badges / status ---------- */
.badge { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.badge.ok { background: #E4EEE3; color: var(--ok-600); }
.badge.neutro { background: var(--sage-100); color: var(--sage-800); }
.badge.warn { background: #F7EAD6; color: var(--warn-600); }

/* ---------- botões ---------- */
.btn { font-family: inherit; font-weight: 700; border: none; cursor: pointer; border-radius: 12px; padding: 10px 18px; font-size: 14px; transition: transform .15s; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--sage-900); color: var(--cream-100); }
.btn-primary:hover { background: var(--sage-800); }
.btn-link { background: #fff; color: var(--sage-700); border: 1px solid var(--cream-200); border-radius: 8px; padding: 6px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }
.btn-link:hover { background: var(--sage-100); }

/* ---------- tabela ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--sage-700); padding: 10px 12px; border-bottom: 1px solid var(--cream-200); }
td { padding: 12px; border-bottom: 1px solid var(--cream-200); vertical-align: top; }
tr:last-child td { border-bottom: none; }

/* ---------- clientes: lista + ficha ---------- */
.clientes-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
@media (max-width: 760px) { .clientes-grid { grid-template-columns: 1fr; } }

.lista-clientes { list-style: none; margin: 0; padding: 0; }
.lista-clientes li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 10px; cursor: pointer; margin-bottom: 2px;
}
.lista-clientes li:hover { background: var(--cream-100); }
.lista-clientes li.selecionado { background: var(--sage-100); }
.avatar-cliente { width: 34px; height: 34px; border-radius: 999px; background: var(--sage-200); color: var(--sage-900); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }

/* ---------- agenda ---------- */
.grid-agenda { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
@media (max-width: 860px) { .grid-agenda { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 480px) { .grid-agenda { grid-template-columns: 1fr; } }
.dia-agenda .dia-titulo { font-weight: 800; font-size: 13px; margin-bottom: 8px; text-align: center; }
.card-agendamento { background: var(--sage-100); border-radius: 10px; padding: 10px; font-size: 12px; font-weight: 700; }
.card-agendamento p { margin: 0; }
.card-agendamento .sub { font-weight: 600; color: var(--sage-700); margin-top: 3px; }
.sem-agendamento { text-align: center; font-size: 12px; color: var(--sage-500); padding-top: 10px; }

/* ---------- procedimentos ---------- */
.grid-procedimentos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 700px) { .grid-procedimentos { grid-template-columns: 1fr; } }

/* ---------- financeiro ---------- */
.grid-financeiro { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .grid-financeiro { grid-template-columns: 1fr; } }
.barras-mes { display: flex; align-items: flex-end; gap: 14px; height: 200px; overflow-x: auto; padding-bottom: 4px; }
.barra-col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 46px; }
.barra-par { display: flex; align-items: flex-end; gap: 3px; height: 160px; }
.barra { width: 14px; border-radius: 4px 4px 0 0; }
.barra.entrada { background: var(--ok-600); }
.barra.saida { background: var(--danger-600); }
.barra-col .rotulo-mes { font-size: 11px; font-weight: 700; color: var(--sage-700); }
.legenda-financeiro { display: flex; gap: 16px; font-size: 12px; font-weight: 700; color: var(--sage-700); margin-top: 10px; }
.legenda-financeiro span { display: inline-flex; align-items: center; gap: 6px; }
.ponto { width: 9px; height: 9px; border-radius: 999px; display: inline-block; }
.ponto.entrada { background: var(--ok-600); }
.ponto.saida { background: var(--danger-600); }
.linha-transacao { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--cream-200); font-size: 13px; }
.linha-transacao:last-child { border-bottom: none; }
.linha-transacao .valor.entrada { color: var(--ok-600); font-weight: 800; }
.linha-transacao .valor.saida { color: var(--danger-600); font-weight: 800; }

/* ---------- automações ---------- */
.linha-automacao { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--cream-200); }
.linha-automacao:last-child { border-bottom: none; }
.linha-automacao .info p { margin: 0; }
.linha-automacao .info .titulo { font-weight: 800; font-size: 14px; }
.linha-automacao .info .desc { font-size: 12px; color: var(--sage-700); margin-top: 3px; }
.toggle { width: 42px; height: 24px; border-radius: 999px; background: var(--sage-200); position: relative; flex-shrink: 0; margin-left: auto; }
.toggle.on { background: var(--ok-600); }
.toggle .knob { width: 18px; height: 18px; border-radius: 999px; background: #fff; position: absolute; top: 3px; left: 3px; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.toggle.on .knob { left: 21px; }

/* ---------- prontuário ---------- */
.grid-prontuario { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 760px) { .grid-prontuario { grid-template-columns: 1fr; } }
.par-fotos { display: flex; gap: 8px; }
.par-fotos figure { margin: 0; flex: 1; min-width: 0; }
.par-fotos img { width: 100%; border-radius: 10px; display: block; }
.par-fotos figcaption { text-align: center; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--sage-700); margin-top: 6px; }
.tabela-evolucao { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 10px; }
.tabela-evolucao th, .tabela-evolucao td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--cream-200); }
.tabela-evolucao th { color: var(--sage-700); font-weight: 800; text-transform: uppercase; font-size: 10px; }

/* ---------- recurso exclusivo por nicho ---------- */
.aviso-exclusivo {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blush-100); color: var(--blush-600);
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em;
  padding: 6px 12px; border-radius: 999px; margin-bottom: 18px;
}
.linha-pacote, .linha-urgencia, .linha-peso { padding: 16px 0; border-bottom: 1px solid var(--cream-200); }
.linha-pacote:last-child, .linha-urgencia:last-child, .linha-peso:last-child { border-bottom: none; }
.linha-urgencia .cabecalho { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.progresso { height: 8px; border-radius: 999px; background: var(--sage-100); overflow: hidden; margin-top: 10px; }
.progresso .fill { height: 100%; background: var(--ok-600); border-radius: 999px; }
.progresso .fill.completo { background: var(--sage-500); }
.badge.danger { background: #F3E0DB; color: var(--danger-600); }

/* ---------- conversas ---------- */
.conversas-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
@media (max-width: 760px) { .conversas-grid { grid-template-columns: 1fr; } }
.lista-conversas { list-style: none; margin: 0; padding: 0; }
.lista-conversas li { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; cursor: pointer; margin-bottom: 2px; }
.lista-conversas li:hover { background: var(--cream-100); }
.lista-conversas li.selecionado { background: var(--sage-100); }
.thread-msg { max-width: 75%; padding: 9px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 8px; }
.thread-msg.in { background: var(--cream-100); }
.thread-msg.out { background: var(--sage-100); margin-left: auto; }

/* ==================== fone WhatsApp (funcionaria-digital.html) ==================== */
.wa-wrap { max-width: 420px; margin: 40px auto; padding: 0 16px 60px; }
.phone { width: 100%; background: #000; border-radius: 34px; padding: 10px; box-shadow: var(--shadow-lift); }
.phone-screen { background: #E9DFD3; border-radius: 24px; overflow: hidden; height: 600px; display: flex; flex-direction: column; position: relative; }
.wa-header { background: linear-gradient(180deg, var(--sage-800), var(--sage-900)); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.wa-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--blush-600); display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.wa-name { font-weight: 800; font-size: 14px; }
.wa-status { font-size: 11px; opacity: .8; }
.wa-body { flex: 1; overflow-y: auto; padding: 14px 10px; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 78%; padding: 8px 11px 9px; border-radius: 10px; font-size: 13px; line-height: 1.45; box-shadow: 0 1px 1px rgba(0,0,0,0.08); opacity: 0; transform: translateY(6px); animation: bubbleIn .25s ease forwards; white-space: pre-line; }
@keyframes bubbleIn { to { opacity: 1; transform: translateY(0); } }
.bubble.in { align-self: flex-start; background: #fff; border-top-left-radius: 2px; }
.bubble.out { align-self: flex-end; background: #DCF8C6; border-top-right-radius: 2px; }
.typing { align-self: flex-start; background: #fff; border-radius: 10px; border-top-left-radius: 2px; padding: 9px 12px; display: flex; gap: 4px; opacity: 0; animation: bubbleIn .2s ease forwards; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: #9aa; display: inline-block; animation: typingBounce 1s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.wa-footer { background: #f0f0f0; padding: 10px 12px; flex-shrink: 0; }
.wa-input { background: #fff; border-radius: 20px; padding: 9px 14px; font-size: 13px; color: #999; }
.play-btn { display: block; margin: 18px auto 0; }
