/* CRM33 Comercial — tokens. Material visual do CRM atual (Fusion, vazado,
 * cantos 12px) com primária terracota e seleção pêssego. Toda cor de tela sai
 * daqui; estados (oficial, pendente, falha, rascunho) nunca usam a cor de tema. */
@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font: "Geist", "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;

  /* Fundo da unidade (foto ou mesh) aparece entre os painéis */
  --fundo-img: url("../fundos/sakura-1.webp");
  --fundo-cor: #e9e2dc;

  /* Superfícies */
  --surface: #ffffff;
  --surface-soft: #faf7f5;
  --surface-muted: #f1ece8;
  --ink: #1d1a18;
  --ink-soft: #5f5853;
  --ink-faint: #8d8580;
  --line: #e6dfda;
  --line-strong: #cfc5be;

  /* Tema (personalizável por unidade e por usuário) */
  --accent: #c2562c;
  --accent-hover: #a94820;
  --accent-ink: #ffffff;
  --accent-soft: #fbe6da; /* seleção pêssego */
  --accent-softer: #fdf3ed;

  /* Estados — independentes do tema */
  --ok: #2f8a5e;      --ok-soft: #e2f5eb;      /* oficial HubMed */
  --warn: #b07514;    --warn-soft: #fbf0dc;    /* pendente */
  --danger: #b4403f;  --danger-soft: #fae8e7;  /* falha */
  --draft: #6d6a67;   --draft-soft: #efedeb;   /* rascunho local */
  --info: #2f6f8c;    --info-soft: #e1eff5;

  /* Chat (bolhas no padrão WhatsApp do CRM atual) */
  --bubble-in: #ffffff;
  --bubble-out: #fde9dc;
  --bubble-note: #fff6cf;
  --thread-bg: #f6f1ed;
  --ack-read: #2f8ac2;

  /* Geometria */
  --gap: 8px;
  --edge: 8px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --radius-pill: 999px;
  --rail-w: 64px;
  --topbar-h: 52px;
  --row-h: 64px;
  --table-row-h: 40px;
  --control-h: 34px;
  --control-h-sm: 28px;

  /* Tipografia: quatro tamanhos, dois pesos */
  --fs-1: 12px;
  --fs-2: 13px;
  --fs-3: 14px;
  --fs-4: 16px;
  --fw-1: 400;
  --fw-2: 560;

  --shadow-sm: 0 1px 2px rgba(40, 24, 14, 0.06);
  --shadow: 0 12px 32px rgba(40, 24, 14, 0.14);
  --dur: 150ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --fundo-cor: #15110f;
  --surface: #1c1816;
  --surface-soft: #231e1b;
  --surface-muted: #2c2522;
  --ink: #f3ece7;
  --ink-soft: #b9aea7;
  --ink-faint: #8a7f78;
  --line: #3a312c;
  --line-strong: #4e433d;
  --accent: #e9875c;
  --accent-hover: #f39d77;
  --accent-ink: #1c1311;
  --accent-soft: #4a2b1e;
  --accent-softer: #33221a;
  --ok: #7fd8a9;    --ok-soft: #1b3326;
  --warn: #e7bb6a;  --warn-soft: #3a2d14;
  --danger: #ee9a96; --danger-soft: #3f2322;
  --draft: #b2aca7; --draft-soft: #2e2a27;
  --info: #8cc6df;  --info-soft: #1a2f39;
  --bubble-in: #262019;
  --bubble-out: #4a2b1e;
  --bubble-note: #3d3516;
  --thread-bg: #181412;
  --ack-read: #6fc0f0;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* Paleta HubMed (Aparência > Tema > Paleta): mesmo layout e componentes, cores da marca.
 * Fonte: extensao/hubmed-agent/popup.html:8-16 (accent #0f766e, texto #0f172a, muted #64748b,
 * linha #e2e8f0, fundo #f8fafc) e popup.html:23 (#ecfeff). Tons derivados da mesma escala slate,
 * ajustados para AA: ink-soft #475569, ink-faint #5b6676, accent-hover #115e59, accent-soft #ccfbf1.
 * Estados (--ok, --warn, --danger, --draft, --info, --ack-read, --bubble-note) não mudam.
 * O bloco escuro repete todas as chaves do claro com seletor mais específico (sem vazar cascata). */
:root[data-tema="hubmed"] {
  /* Foto padrão fria (Serra) no lugar da Sakura rosa. O fundo padrão da unidade não cobre esta paleta (aplicarFundo); a escolha pessoal continua valendo (estilo inline) */
  --fundo-img: url("../fundos/serra-1.webp");
  --fundo-cor: #e2e8f0;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #f1f5f9;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-faint: #5b6676;
  --line: #e2e8f0;
  --line-strong: #8793a5;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-ink: #ffffff;
  --accent-soft: #ccfbf1;
  --accent-softer: #ecfeff;
  --bubble-in: #ffffff;
  --bubble-out: #ccfbf1;
  --thread-bg: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
}
:root[data-tema="hubmed"][data-theme="dark"] {
  --fundo-cor: #0f172a;
  --surface: #1e293b;
  --surface-soft: #182235;
  --surface-muted: #334155;
  --ink: #f1f5f9;
  --ink-soft: #cbd5e1;
  --ink-faint: #a5b1c2;
  --line: #334155;
  --line-strong: #64748b;
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-ink: #0f172a;
  --accent-soft: #134e4a;
  --accent-softer: #132c2b;
  --bubble-in: #263244;
  --bubble-out: #134e4a;
  --thread-bg: #111827;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur: 0ms; }
}
:root[data-motion="off"] { --dur: 0ms; }
