/* Cores e tipografia da AW Fibra no painel do Chatwoot.
 *
 * O Chatwoot compila o tema dentro da imagem e nao tem campo de CSS proprio.
 * Este arquivo e servido como estatico em /brand/aw.css e entra pelo layout
 * montado em infra/chatwoot/vueapp.html.erb, depois das folhas do Vite.
 *
 * ---------------------------------------------------------------------------
 * O tema do Chatwoot 4 tem TRES camadas. Trocar as duas primeiras nao muda
 * nada visivel — foi o erro das versoes anteriores deste arquivo:
 *
 *   1. Rampas Radix em variavel (--blue-*, --slate-*, --solid-*), em
 *      "R G B" separado por espaco, que e como o Tailwind aplica opacidade.
 *   2. Paleta "woot" (.bg-woot-500 e #3b9eff fixo). E o sistema ANTIGO;
 *      as telas de hoje quase nao usam.
 *   3. Paleta "n-" — o sistema de design ATUAL, e o que realmente pinta a
 *      tela. `.bg-n-brand` traz `background-color:#2781f6` escrito direto na
 *      regra, sem variavel no meio: sao dezenas de seletores com o mesmo hex.
 *
 * O bloco "n-brand gerado" e um ESPELHO: para cada regra do Chatwoot com
 * `n-brand` e o azul escrito direto, o gerador (infra/gerar-n-brand.py) copia o
 * MESMO SELETOR com o verde. Mesmo seletor quer dizer mesmo estado (hover,
 * focus, checked, ::after) e mesma especificidade; como este arquivo carrega
 * depois, ganha sem !important. E isso cobre tambem as variantes com
 * transparencia (`bg-n-brand/5`), que o Chatwoot compila com o alpha dentro do
 * hex (`#2781f60d`).
 *
 * Casar por trecho do nome de classe (`[class*='bg-n-brand']`) foi a versao
 * anterior e estava errada: pintava o elemento INTEIRO em qualquer estado.
 * A aba ativa do painel tem `after:bg-n-brand` (so o tracinho de baixo) e
 * ficou toda verde, com o texto sumindo.
 *
 * Trocou a versao do Chatwoot? Rodar `python3 gerar-n-brand.py` em infra/.
 * ---------------------------------------------------------------------------
 *
 * Regra da marca: texto sobre o verde da marca e sempre o verde profundo,
 * nunca branco. Branco sobre #a3cb38 da 1,8:1 de contraste.
 *
 * Valores: design-system/tokens/colors.css
 *   verde-500 #a3cb38 = 163 203 56    verde-700 #6d8a21 = 109 138 33
 *   verde-100 #e9f4cf = 233 244 207   ink-900   #0a2a22 = 10 42 34
 */

@import url('https://fonts.googleapis.com/css2?family=Urbanist:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

/* ------------------------------------------------------------- tipografia */

body, button, input, textarea, select {
  font-family: Urbanist, ui-sans-serif, system-ui, -apple-system, sans-serif;
}

h1, h2, h3 {
  font-family: 'Space Grotesk', Urbanist, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -0.01em;
}

/* ------------------------------------- camada 3: a paleta que pinta a tela */

/* >>> n-brand gerado por infra/gerar-n-brand.py — nao editar a mao */
/* Espelho verde de 49 seletores da chatwoot/chatwoot:v4.18.0. */

.\!outline-n-brand {
  outline-color: #a3cb38!important;
}

.after\:bg-n-brand:after {
  background-color: #a3cb38;
  background-color: rgb(163 203 56 / var(--tw-bg-opacity, 1));
}

.before\:\!border-t-n-brand:before {
  border-top-color: #a3cb38!important;
  border-top-color: rgb(163 203 56 / var(--tw-border-opacity, 1))!important;
}

.before\:bg-n-brand:before {
  background-color: #a3cb38;
  background-color: rgb(163 203 56 / var(--tw-bg-opacity, 1));
}

.bg-n-brand {
  background-color: #a3cb38;
  background-color: rgb(163 203 56 / var(--tw-bg-opacity, 1));
}

.bg-n-brand\/10 {
  background-color: #a3cb381a;
}

.bg-n-brand\/20 {
  background-color: #a3cb3833;
}

.bg-n-brand\/5 {
  background-color: #a3cb380d;
}

.border-n-brand {
  border-color: #a3cb38;
  border-color: rgb(163 203 56 / var(--tw-border-opacity, 1));
}

.border-n-brand\/50 {
  border-color: #a3cb3880;
}

.border-t-n-brand {
  border-top-color: #a3cb38;
  border-top-color: rgb(163 203 56 / var(--tw-border-opacity, 1));
}

.checked\:bg-n-brand:checked {
  background-color: #a3cb38;
  background-color: rgb(163 203 56 / var(--tw-bg-opacity, 1));
}

.checked\:border-n-brand:checked {
  border-color: #a3cb38;
  border-color: rgb(163 203 56 / var(--tw-border-opacity, 1));
}

.dark\:\!outline-n-brand:is(.dark *) {
  outline-color: #a3cb38!important;
}

.dark\:bg-n-brand\/10:is(.dark *) {
  background-color: #a3cb381a;
}

.dark\:border-n-brand:is(.dark *) {
  border-color: #a3cb38;
  border-color: rgb(163 203 56 / var(--tw-border-opacity, 1));
}

.dark\:checked\:bg-n-brand:checked:is(.dark *) {
  background-color: #a3cb38;
  background-color: rgb(163 203 56 / var(--tw-bg-opacity, 1));
}

.dark\:checked\:border-n-brand:checked:is(.dark *) {
  border-color: #a3cb38;
  border-color: rgb(163 203 56 / var(--tw-border-opacity, 1));
}

.dark\:focus-within\:outline-n-brand:focus-within:is(.dark *) {
  outline-color: #a3cb38;
}

.dark\:focus\:outline-n-brand:focus:is(.dark *) {
  outline-color: #a3cb38;
}

.dark\:has-\[\:focus\]\:outline-n-brand:has(:focus):is(.dark *) {
  outline-color: #a3cb38;
}

.dark\:hover\:text-n-brand:hover:is(.dark *) {
  color: #c0de75;
  color: rgb(192 222 117 / var(--tw-text-opacity, 1));
}

.dark\:ring-n-brand:is(.dark *) {
  --tw-ring-color: rgb(163 203 56 / var(--tw-ring-opacity, 1));
}

.focus-visible\:bg-n-brand\/20:focus-visible {
  background-color: #a3cb3833;
}

.focus-visible\:border-n-brand:focus-visible {
  border-color: #a3cb38;
  border-color: rgb(163 203 56 / var(--tw-border-opacity, 1));
}

.focus-visible\:outline-n-brand:focus-visible {
  outline-color: #a3cb38;
}

.focus-visible\:ring-n-brand:focus-visible {
  --tw-ring-color: rgb(163 203 56 / var(--tw-ring-opacity, 1));
}

.focus-within\:outline-n-brand:focus-within {
  outline-color: #a3cb38;
}

.focus-within\:ring-n-brand:focus-within {
  --tw-ring-color: rgb(163 203 56 / var(--tw-ring-opacity, 1));
}

.focus\:border-n-brand:focus {
  border-color: #a3cb38;
  border-color: rgb(163 203 56 / var(--tw-border-opacity, 1));
}

.focus\:outline-n-brand:focus {
  outline-color: #a3cb38;
}

.focus\:ring-n-brand:focus {
  --tw-ring-color: rgb(163 203 56 / var(--tw-ring-opacity, 1));
}

.from-n-brand\/15 {
  --tw-gradient-from: rgb(163 203 56 / .15) var(--tw-gradient-from-position);
  --tw-gradient-to: rgb(163 203 56 / 0) var(--tw-gradient-to-position);
}

.group:focus-within .group-focus-within\:text-n-brand {
  color: #6d8a21;
  color: rgb(109 138 33 / var(--tw-text-opacity, 1));
}

.group:hover .group-hover\:bg-n-brand {
  background-color: #a3cb38;
  background-color: rgb(163 203 56 / var(--tw-bg-opacity, 1));
}

.group:hover .group-hover\:text-n-brand {
  color: #6d8a21;
  color: rgb(109 138 33 / var(--tw-text-opacity, 1));
}

.has-\[\:focus\]\:outline-n-brand:has(:focus) {
  outline-color: #a3cb38;
}

.hover\:bg-n-brand\/10:hover {
  background-color: #a3cb381a;
}

.hover\:bg-n-brand\/80:hover {
  background-color: #a3cb38cc;
}

.hover\:border-n-brand:hover {
  border-color: #a3cb38;
  border-color: rgb(163 203 56 / var(--tw-border-opacity, 1));
}

.hover\:enabled\:bg-n-brand\/20:enabled:hover {
  background-color: #a3cb3833;
}

.hover\:text-n-brand:hover {
  color: #6d8a21;
  color: rgb(109 138 33 / var(--tw-text-opacity, 1));
}

.indeterminate\:bg-n-brand:indeterminate {
  background-color: #a3cb38;
  background-color: rgb(163 203 56 / var(--tw-bg-opacity, 1));
}

.indeterminate\:border-n-brand:indeterminate {
  border-color: #a3cb38;
  border-color: rgb(163 203 56 / var(--tw-border-opacity, 1));
}

.outline-n-brand {
  outline-color: #a3cb38;
}

.prose-a\:text-n-brand :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))) {
  color: #6d8a21;
  color: rgb(109 138 33 / var(--tw-text-opacity, 1));
}

.prose-strong\:text-n-brand :is(:where(strong):not(:where([class~=not-prose],[class~=not-prose] *))) {
  color: #6d8a21;
  color: rgb(109 138 33 / var(--tw-text-opacity, 1));
}

.ring-n-brand {
  --tw-ring-color: rgb(163 203 56 / var(--tw-ring-opacity, 1));
}

.text-n-brand {
  color: #6d8a21;
  color: rgb(109 138 33 / var(--tw-text-opacity, 1));
}

/* <<< fim do bloco gerado */

/* Texto sobre o verde: verde profundo, nunca branco.
 *
 * Aqui e classe exata, nao [class*=]. Seletor de classe casa o nome inteiro,
 * entao `.bg-n-brand` pega so o fundo SOLIDO e ignora `bg-n-brand/10`, que e
 * um tom de 10% — ali o fundo continua claro e o texto tem que continuar
 * normal. Forcar verde profundo naquele caso sumiria com o texto no modo
 * escuro.
 *
 * Vai com !important porque o Chatwoot escreve `bg-n-brand text-white` no
 * mesmo elemento (aba ativa do relatorio, por exemplo). Sem o !important eu
 * ganharia so por vir depois na folha — e ficaria refem da ordem de carga. */
.bg-n-brand,
.bg-n-brand *,
.checked\:bg-n-brand:checked,
.before\:bg-n-brand:before {
  color: rgb(10 42 34) !important;
}

/* Icone da marca sobre fundo claro: verde-700, que e legivel. */
[class*='fill-n-blue-9'] {
  color: rgb(109 138 33 / var(--tw-text-opacity, 1)) !important;
  fill: rgb(109 138 33) !important;
}

/* O azul solto que escapou do sistema de nomes. */
.bg-\[\#2781F6\] {
  background-color: rgb(163 203 56) !important;
}

/* ------------------------------------------- camada 1: rampas em variavel */

:root {
  /* Estas tres NAO fazem parte da rampa --blue-*. Sao semanticas, com valor
   * proprio, e por isso sobreviveram a primeira rodada de sobrescrita:
   *   --text-blue    (11 usos)  .text-n-blue-text — link e texto de acao
   *   --border-blue   (6 usos)  .border-n-blue-border — borda de campo ativo
   *   --solid-blue    (7 usos)  .bg-n-solid-blue — balao de mensagem enviada
   */
  --text-blue: 109 138 33 !important;     /* verde-700, legivel no claro */
  --border-blue: 163 203 56 !important;   /* verde-500 */
  --solid-blue: 233 244 207 !important;   /* verde-100 */

  --blue-1: 251 253 245 !important;
  --blue-2: 245 250 234 !important;
  --blue-3: 233 244 207 !important;
  --blue-4: 221 238 184 !important;
  --blue-5: 213 234 165 !important;
  --blue-6: 192 222 117 !important;
  --blue-7: 177 214 86 !important;
  --blue-8: 163 203 56 !important;
  --blue-9: 163 203 56 !important;
  --blue-10: 138 173 43 !important;
  --blue-11: 109 138 33 !important;
  --blue-12: 10 42 34 !important;

  --ninja-accent-color: rgb(109 138 33);
}

.dark {
  --text-blue: 192 222 117 !important;    /* verde-300, legivel no escuro */
  --border-blue: 163 203 56 !important;   /* verde-500 */
  --solid-blue: 23 73 59 !important;      /* ink-700 */

  --blue-1: 6 27 22 !important;
  --blue-2: 10 42 34 !important;
  --blue-3: 15 58 46 !important;
  --blue-4: 23 73 59 !important;
  --blue-5: 53 68 15 !important;
  --blue-6: 79 101 24 !important;
  --blue-7: 109 138 33 !important;
  --blue-8: 138 173 43 !important;
  --blue-9: 163 203 56 !important;
  --blue-10: 177 214 86 !important;
  --blue-11: 192 222 117 !important;
  --blue-12: 245 250 234 !important;

  --ninja-accent-color: rgb(163 203 56);
}

/* No escuro o texto do balao precisa clarear junto com o fundo. */
.dark [class*='bg-n-solid-blue'] {
  color: rgb(245 250 234);
}

/* --------------------------------- camada 2: paleta antiga, por seguranca */

.bg-woot-25  { background-color: #f5faea !important; }
.bg-woot-100 { background-color: #e9f4cf !important; }
.bg-woot-500 { background-color: #a3cb38 !important; }
.bg-woot-600 { background-color: #8aad2b !important; }
.bg-woot-700 { background-color: #6d8a21 !important; }

.text-woot-500, .text-woot-600 { color: #6d8a21 !important; }
.text-woot-700 { color: #4f6518 !important; }
.border-woot-500 { border-color: #a3cb38 !important; }

.bg-woot-500, .bg-woot-500 *,
.bg-woot-600, .bg-woot-600 * { color: #0a2a22; }

/* ------------------------------------------ azuis soltos, sem variavel atras
 *
 * Estes tem o hex escrito na regra e nenhuma variavel no meio, entao trocar
 * a rampa nao os alcanca. Tudo aqui vai com !important porque as regras
 * originais sao de componente Vue com [data-v-...], que pesa mais que a
 * minha classe. Nao uso o data-v: ele muda a cada build do Chatwoot.
 */

/* Link dentro de mensagem e de nota. */
p a,
p a:is(.dark *) {
  color: rgb(109 138 33) !important;
}

/* Contorno do campo em foco. */
input[type]:not([type=file]):not([type=checkbox]):not([type=radio]):focus,
select:focus,
textarea:focus,
select:focus:is(.dark *),
textarea:focus:is(.dark *) {
  outline-color: rgb(163 203 56) !important;
}

.search-input:focus {
  border-color: rgb(163 203 56) !important;
}

/* Faixa de aviso no topo e item de menu sob o cursor. */
.banner.primary,
.menu:hover,
.notification--unread-indicator,
.ProseMirror-prompt .ProseMirror-prompt-buttons button[type='submit'] {
  background-color: rgb(163 203 56) !important;
}

.banner.primary,
.banner.primary *,
.menu:hover,
.ProseMirror-prompt .ProseMirror-prompt-buttons button[type='submit'] {
  color: rgb(10 42 34) !important;
}

/* Caixa de selecao (multiselect): opcao sob o cursor e opcao escolhida. */
.multiselect .multiselect__content .multiselect__option--highlight {
  background-color: rgb(163 203 56 / 0.1) !important;
}

.multiselect .multiselect__content .multiselect__option--selected {
  background-color: rgb(163 203 56 / 0.2) !important;
}

.multiselect .multiselect__tag-icon:after {
  color: rgb(163 203 56) !important;
}

/* Calendario (vue2-datepicker) — usa um azul proprio, #1284e7. */
.mx-btn:hover {
  border-color: rgb(163 203 56) !important;
  color: rgb(109 138 33) !important;
}

.mx-calendar-content .cell.active {
  background-color: rgb(163 203 56) !important;
  color: rgb(10 42 34) !important;
}

.mx-time-column .mx-time-item.active,
.mx-time-option.active {
  color: rgb(109 138 33) !important;
}

/* ------------------------------------- graficos novos dos relatorios (4.18+)
 *
 * Os componentes cw-viz-* trazem o azul como valor padrao de variavel
 * (`var(--cw-viz-heatmap-level-4-color, #1c73dc)`) e ninguem define a variavel,
 * entao basta defini-la aqui. Nome de variavel nao muda a cada build, ao
 * contrario do data-v. Mapa de calor: do verde-100 ao verde-700, claro para
 * escuro conforme a intensidade. Foco: verde-500.
 */
:root {
  --cw-viz-heatmap-level-1-color: #e9f4cf !important;
  --cw-viz-heatmap-level-2-color: #c0de75 !important;
  --cw-viz-heatmap-level-3-color: #a3cb38 !important;
  --cw-viz-heatmap-level-4-color: #6d8a21 !important;
  --cw-viz-heatmap-cell-border-color: #a3cb3814 !important;

  --cw-viz-bar-focus-color: #a3cb3873 !important;
  --cw-viz-line-focus-color: #a3cb3873 !important;
  --cw-viz-sankey-focus-color: #a3cb3873 !important;
  --cw-viz-donut-focus-color: #a3cb38 !important;
  --cw-viz-percentage-focus-color: #a3cb38 !important;
}

/* ------------------------------------------------------------- acabamento */

/* Botao da marca e pilula. So botao de verdade — aplicar em tudo deforma
 * campo de busca e caixa de selecao. */
button[class*='bg-n-brand'],
button.bg-woot-500,
button[type='submit'] {
  border-radius: 9999px;
}
