/* Base do Orkestra CRM — design V2b: tema claro padrão, escuro opcional.
   Os tokens abaixo alimentam todas as telas; o modo escuro apenas os redefine. */

:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --card: #ffffff;
  --raia: #eef1f6;
  --border: #dde3ec;
  --text: #1c2536;
  --muted: #64748b;
  /* Marca Orkestra: teal #2ab3bd + preto. Texto de botão escuro porque
     branco sobre o teal reprova em contraste (WCAG); preto passa. */
  --accent: #2ab3bd;
  --accent-suave: #dcf2f4;
  --info: #2563eb;
  --ok: #16a34a;
  --danger: #dc2626;
  --texto-botao: #05262b;
  --cabecalho-tabela: #fafbfd;
  --linha-hover: #fafbfd;
  --sombra-menu: 0 8px 24px rgba(28, 37, 54, 0.12);
  /* Selos de status — par fundo/texto por cor, ajustado por tema */
  --selo-azul-bg: #e5edff;    --selo-azul-tx: #2563eb;
  --selo-ouro-bg: #d3eef1;    --selo-ouro-tx: #0f7783;
  --selo-verde-bg: #e3f5e9;   --selo-verde-tx: #16a34a;
  --selo-roxo-bg: #ece9ff;    --selo-roxo-tx: #6d5bd0;
  --selo-cinza-bg: #e8eaf0;   --selo-cinza-tx: #64748b;
  --selo-vermelho-bg: #fdeaea; --selo-vermelho-tx: #dc2626;
  /* Avisos de formulário */
  --erro-bg: #fdeaea; --erro-tx: #b91c1c; --erro-borda: #f3c1c1;
  --mensagem-bg: #e3f5e9; --mensagem-tx: #15803d; --mensagem-borda: #bfe8cd;
  /* Cores de gráfico — validadas para contraste e daltonismo por tema */
  --g-ouro: #1f9aa5; --g-azul: #2563eb; --g-grade: #eef1f6;
  --g-tinta: #1c2536; --g-suave: #64748b;
}
:root[data-theme="dark"] {
  --bg: #0f1522;
  --panel: #18202f;
  --card: #1e2a3d;
  --raia: #1e2a3d;
  --border: #2c3a52;
  --text: #e8edf5;
  --muted: #8fa0b8;
  /* Teal levemente clareado para legibilidade sobre o fundo escuro */
  --accent: #45c3cd;
  --accent-suave: rgba(42, 179, 189, 0.18);
  --info: #7fb0f9;
  --ok: #5fd68a;
  --danger: #f0a1a1;
  --texto-botao: #04222a;
  --cabecalho-tabela: #141b29;
  --linha-hover: #1a2333;
  --sombra-menu: 0 8px 24px rgba(0, 0, 0, 0.45);
  --selo-azul-bg: rgba(59, 130, 246, 0.18);   --selo-azul-tx: #7fb0f9;
  --selo-ouro-bg: rgba(42, 179, 189, 0.18);   --selo-ouro-tx: #5fd3dc;
  --selo-verde-bg: rgba(34, 197, 94, 0.16);   --selo-verde-tx: #5fd68a;
  --selo-roxo-bg: rgba(99, 102, 241, 0.22);   --selo-roxo-tx: #a5a8f7;
  --selo-cinza-bg: rgba(143, 160, 184, 0.16); --selo-cinza-tx: #8fa0b8;
  --selo-vermelho-bg: rgba(239, 68, 68, 0.16); --selo-vermelho-tx: #f0a1a1;
  --erro-bg: rgba(239, 68, 68, 0.12); --erro-tx: #f0a1a1; --erro-borda: rgba(239, 68, 68, 0.35);
  --mensagem-bg: rgba(34, 197, 94, 0.12); --mensagem-tx: #5fd68a; --mensagem-borda: rgba(34, 197, 94, 0.35);
  --g-ouro: #45c3cd; --g-azul: #4f8df0; --g-grade: #232f44;
  --g-tinta: #e8edf5; --g-suave: #8fa0b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

/* ---------- Menu lateral (pedido do Julio, 02/10/2026) ---------- */
:root { --menu-largura: 232px; --menu-recolhido: 68px; }
.abrir-menu { display: none; }
.menu-lateral {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--menu-largura);
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0.4rem; padding: 1rem 0.8rem;
  z-index: 20; overflow-y: auto; overflow-x: hidden; transition: width 0.15s ease;
}
.menu-lateral .marca {
  display: flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--text);
  font-weight: 700; font-size: 1.02rem; letter-spacing: 0.3px; padding: 0.2rem 0.4rem; min-height: 36px;
}
.menu-lateral .marca-logo { width: 28px; height: 28px; flex: none; }
.menu-lateral .marca-texto span { color: var(--accent); }
.recolher-menu {
  position: absolute; right: 0.5rem; top: 1.1rem; width: 24px; height: 24px; border-radius: 50%;
  background: var(--raia); color: var(--muted); border: 1px solid var(--border); cursor: pointer; font-size: 0.9rem; line-height: 1;
}
.recolher-menu:hover { color: var(--text); border-color: var(--accent); }
.menu-lateral .novo-lead { display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin: 0.6rem 0.2rem 0.4rem; }
.menu-lateral nav { display: flex; flex-direction: column; gap: 0.15rem; }
.menu-lateral nav .grupo {
  color: var(--muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.7rem 0.6rem 0.25rem; white-space: nowrap;
}
.menu-lateral nav a, .menu-lateral .perfil, .menu-lateral .sair {
  display: flex; align-items: center; gap: 0.6rem; color: var(--muted); text-decoration: none;
  font-size: 0.88rem; font-weight: 500; padding: 0.5rem 0.6rem; border-radius: 8px; white-space: nowrap;
}
.menu-lateral nav a:hover, .menu-lateral .perfil:hover { color: var(--text); background: var(--raia); }
.menu-lateral nav a.ativo { color: var(--accent); background: var(--accent-suave); font-weight: 600; }
.menu-lateral .icone { width: 22px; text-align: center; font-size: 0.95rem; flex: none; }
.menu-lateral .rodape-menu { margin-top: auto; display: flex; flex-direction: column; gap: 0.3rem; padding-top: 0.6rem; border-top: 1px solid var(--border); }
.menu-lateral .rodape-menu form { display: block; }
.menu-lateral .sair { width: 100%; background: transparent; border: none; cursor: pointer; font-family: inherit; }
.menu-lateral .sair:hover { color: var(--text); background: var(--raia); }
.menu-lateral .acoes { display: flex; flex-direction: column; }
.menu-lateral .alternar-tema { width: 100%; text-align: left; display: flex; gap: 0.6rem; align-items: center; padding: 0.5rem 0.6rem; background: transparent; }
.menu-lateral .alternar-tema:hover { background: var(--raia); }
.fundo-menu { display: none; }

/* Recolhido: só ícones */
.menu-recolhido .menu-lateral { width: var(--menu-recolhido); padding-left: 0.5rem; padding-right: 0.5rem; }
.menu-recolhido .menu-lateral .rotulo, .menu-recolhido .menu-lateral .marca-texto, .menu-recolhido .menu-lateral nav .grupo { display: none; }
.menu-recolhido .menu-lateral nav a, .menu-recolhido .menu-lateral .perfil, .menu-recolhido .menu-lateral .sair, .menu-recolhido .menu-lateral .novo-lead { justify-content: center; padding-left: 0; padding-right: 0; }
.menu-recolhido .menu-lateral .novo-lead .icone { width: auto; }
.menu-recolhido .recolher-menu { right: 50%; transform: translateX(50%) rotate(180deg); top: 3.2rem; }
.menu-recolhido .menu-lateral .marca { justify-content: center; padding: 0; }
.menu-recolhido .menu-lateral .alternar-tema { justify-content: center; }
.menu-recolhido .menu-lateral .alternar-tema .rotulo-tema { display: none; }
.menu-recolhido main { margin-left: var(--menu-recolhido); }

/* Celular: menu vira gaveta */
@media (max-width: 860px) {
  .abrir-menu {
    display: inline-flex; position: fixed; left: 0.8rem; top: 0.7rem; z-index: 30;
    width: 40px; height: 40px; align-items: center; justify-content: center;
    background: var(--panel); border: 1px solid var(--border); border-radius: 8px; color: var(--text); cursor: pointer; font-size: 1.1rem;
  }
  .menu-lateral { transform: translateX(-100%); transition: transform 0.15s ease; width: var(--menu-largura) !important; }
  .menu-aberto .menu-lateral { transform: none; }
  .menu-aberto .fundo-menu { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 15; }
  .menu-recolhido .menu-lateral .rotulo, .menu-recolhido .menu-lateral .marca-texto, .menu-recolhido .menu-lateral nav .grupo { display: inline; }
  .menu-recolhido .menu-lateral nav a, .menu-recolhido .menu-lateral .perfil, .menu-recolhido .menu-lateral .sair, .menu-recolhido .menu-lateral .alternar-tema { justify-content: flex-start; padding: 0.5rem 0.6rem; }
  .menu-recolhido .menu-lateral .alternar-tema .rotulo-tema { display: inline; }
  .menu-recolhido .menu-lateral .marca { justify-content: flex-start; padding: 0.2rem 0.4rem; }
  .menu-aberto .abrir-menu { left: calc(var(--menu-largura) + 0.8rem); }
  .recolher-menu { display: none; }
  body.com-menu main { margin-left: 0 !important; padding-top: 3.8rem; }
}

.botao-acento {
  background: var(--accent);
  color: var(--texto-botao);
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1.1rem;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.botao-suave {
  background: var(--raia);
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.botao-suave:hover { color: var(--text); border-color: var(--border); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-suave);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
}

main { padding: 1.5rem; }
body.com-menu main { margin-left: var(--menu-largura); transition: margin-left 0.15s ease; }
