/* Nellia — Painel. Fontes: Fraunces (display) + Karla (corpo), self-hosted. */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/fraunces-variable-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Karla";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/karla-variable-latin.woff2") format("woff2");
}

:root {
  /* Achado real (2026-09-09): o toggle manual de tema já troca as cores da
     página via os tokens abaixo, mas nunca dizia isso ao NAVEGADOR — quem
     desenha o ícone do seletor nativo de data (input[type=date]), a seta do
     <select>, a barra de rolagem etc. é o color-scheme do navegador, que sem
     isso continuava seguindo só a preferência do SISTEMA. Resultado: alguém
     com o sistema em claro mas a Nellia trocada pra escuro via o botão via o
     ícone do calendário praticamente invisível (ícone escuro sobre fundo que
     agora também está escuro). Mesmo padrão de 3 blocos já usado pros outros
     tokens de cor — aqui é só essa propriedade nativa do CSS, não uma cor. */
  color-scheme: light;
  --brand-green-dark: #163f2c;
  --brand-green: #1b5e3a;
  --brand-green-bright: #6bcb4d;

  --surface-1: #fbfaf7;
  --surface-2: #ffffff;
  --page-plane: #f4f2ec;
  --text-primary: #17211b;
  --text-secondary: #5a5f57;
  --text-muted: #6b706a; /* darkened from #8b8f85 — that failed WCAG AA (3.3:1 on white, needs 4.5:1) */
  --border-hairline: rgba(23, 33, 27, 0.1);
  --gridline: #e6e3da;

  /* categorical (validada — ordem fixa, não trocar) */
  --cat-1: #6b4e9e; /* pergunta */
  --cat-2: #1f7a4d; /* atividade */
  --cat-3: #2678a6; /* comunicacao */
  --cat-4: #d98f1e; /* anotacao */
  --cat-5: #1a8f7b; /* cotacao_soja */
  --cat-6: #b85c2e; /* agronomia */
  --cat-7: #4a6fa5; /* noticias */

  /* status (fixo, nunca reusar em categórico) */
  --status-good: #0ca30c;
  --status-warning: #d98f1e;
  --status-critical: #d03b3b;

  /* Tensionado em 2026-09-06 (era 10/16/22) — o raio generoso e uniforme
     em todo card/tile lia como "fofo"/datado, não "atual". Pill (999px,
     botão/chip/badge) não muda — é um vocabulário visual diferente,
     reservado pra elementos clicáveis, não pra contêiner de conteúdo. */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 1px 2px rgba(23, 33, 27, 0.04), 0 8px 24px -12px rgba(23, 33, 27, 0.12);
}

/* Tema: automático por padrão (prefers-color-scheme), com seletor manual por
   cima (achado 2026-09-06 — usuário pediu controle manual, não só automático).
   `data-theme` no <html> é fixado por JS (ver script no fim do body) e lido
   ANTES do primeiro paint por um script inline no <head>, pra não piscar o
   tema errado (flash of wrong theme) — sem esse script, o navegador pintaria
   com o tema automático e só trocaria depois que o resto do <body> carregasse.
   Os valores abaixo (mesmo bloco, escrito 2x de propósito: media query pra
   automático, seletor de atributo pra manual) DEVEM ficar em sincronia — se
   um mudar, o outro muda junto. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-1: #16211c;
    --surface-2: #1c2a22;
    --page-plane: #0f1712;
    --text-primary: #f3f5f1;
    --text-secondary: #b9c0b4;
    --text-muted: #8a9589; /* lightened from #7f8a7a — that failed WCAG AA against --surface-2 (4.14:1, needs 4.5:1) */
    --border-hairline: rgba(255, 255, 255, 0.08);
    --gridline: #2a352c;

    --cat-1: #a58fd8;
    --cat-2: #4caf6d;
    --cat-3: #5fa8c9;
    --cat-4: #e0a83a;
    --cat-5: #4fbfa8;
    --cat-6: #d98456;
    --cat-7: #7fa3d6;

    --status-good: #4caf50;
    --status-warning: #e0a83a;
    --status-critical: #e0685f;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #16211c;
  --surface-2: #1c2a22;
  --page-plane: #0f1712;
  --text-primary: #f3f5f1;
  --text-secondary: #b9c0b4;
  --text-muted: #8a9589;
  --border-hairline: rgba(255, 255, 255, 0.08);
  --gridline: #2a352c;

  --cat-1: #a58fd8;
  --cat-2: #4caf6d;
  --cat-3: #5fa8c9;
  --cat-4: #e0a83a;
  --cat-5: #4fbfa8;
  --cat-6: #d98456;
  --cat-7: #7fa3d6;

  --status-good: #4caf50;
  --status-warning: #e0a83a;
  --status-critical: #e0685f;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

* { box-sizing: border-box; }

:focus-visible {
  outline: 3px solid var(--brand-green-bright);
  outline-offset: 2px;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: "Karla", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

/* Fraunces fica reservada só pra marca ("Nellia" no header) — usar serifa
   em rótulos pequenos e headings de card foi o que deu a cara "desalinhada".
   O resto do produto usa uma única família (Karla) em pesos diferentes. */
h1, .display {
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  letter-spacing: -0.01em;
}

h2, h3 {
  font-family: "Karla", system-ui, sans-serif;
  letter-spacing: -0.01em;
}

/* ---------- Skip link ---------- */

.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 1000;
  padding: 12px 18px;
  background: var(--brand-green);
  color: #fff;
  font-family: "Karla", sans-serif;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 10px 0;
}
.skip-link:focus {
  top: 0;
}

/* ---------- Header ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px calc(14px + env(safe-area-inset-top)) 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: linear-gradient(160deg, var(--brand-green-dark), var(--brand-green) 70%);
  color: #fff;
  box-shadow: 0 4px 18px -8px rgba(0, 0, 0, 0.35);
}

/* Achado 2026-09-06: a caixa branca com sombra em volta do logo lia como
   "sticker colado" datado. nellia-logo-reverso.png (gerado recolorindo o
   "Nell" pra branco e mantendo o "iA" no verde-claro da marca) vai direto
   no gradiente do header — mais confiante, sem chapa por baixo. Só serve
   pra fundo escuro; nas telas claras (login, landing) continua o
   nellia-logo.png original.*/
.topbar .brand-logo-header { height: 26px; width: auto; display: block; flex-shrink: 0; }

.topbar .titles { min-width: 0; }
.topbar h1 { font-size: 19px; margin: 0; font-weight: 600; color: #fff; }
.topbar p { margin: 1px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, 0.78); }
.topbar .status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-green-bright);
  display: inline-block;
  margin-right: 6px;
  box-shadow: 0 0 0 3px rgba(107, 203, 77, 0.25);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- Layout ---------- */

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 14px 8px;
}

.section-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 30px 4px 12px;
}
.section-title:first-child { margin-top: 6px; }

/* ---------- Stat tiles ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-row.stat-row-single { grid-template-columns: 1fr; }

.stat-tile {
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}
.stat-tile .k {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}
.stat-tile .v {
  font-family: "Karla", system-ui, sans-serif;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
/* Selo com ícone (achado 2026-09-06) foi removido de novo pouco depois —
   pedido do dono do produto pra um tom mais profissional, só rótulo +
   número. c-1..c-4 continuam existindo na tag (marcam a cor semântica de
   cada tile), só não há mais nada visual usando essas classes aqui — sem
   custo manter, evita reescrever o HTML de novo se um selo/indicador
   voltar a fazer sentido no futuro. */

/* ---------- Cards / charts ---------- */

.card {
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}
.card h3 {
  font-size: 16px;
  margin: 0 0 4px;
  font-weight: 600;
}
.card .sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.card-full { grid-column: 1 / -1; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.legend .dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block; margin-right: 6px;
}

.status-bar {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--gridline);
  gap: 2px;
}
.status-bar .seg { height: 100%; min-width: 3px; }

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 16px;
}
.status-legend .item {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 13px;
  color: var(--text-secondary);
}
.status-legend .dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  transform: translateY(-1px);
}
.status-legend .num {
  font-family: "Karla", sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-row .label { width: 92px; flex-shrink: 0; font-size: 12.5px; color: var(--text-secondary); }
.bar-row .track { flex: 1; height: 10px; background: var(--gridline); border-radius: 6px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 6px; }
.bar-row .count { width: 28px; text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-secondary); }

.sparkline-wrap { width: 100%; overflow-x: auto; }

/* ---------- Empty state ---------- */

.empty {
  color: var(--text-muted);
  font-size: 13.5px;
  padding: 18px 4px;
  text-align: center;
}

/* ---------- Filtro de atividades ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 4px 12px;
}
.filter-chip {
  font-family: "Karla", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.filter-chip.active {
  background: var(--brand-green);
  border-color: var(--brand-green);
  color: #fff;
}
.filter-selects {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}
.filter-select {
  font-family: "Karla", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  cursor: pointer;
}

/* ---------- Alerta forçado ---------- */

.alert-btn {
  margin-top: 10px;
  width: 100%;
  font-family: "Karla", sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--status-critical);
  background: color-mix(in srgb, var(--status-critical) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--status-critical) 30%, transparent);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.alert-btn:active { background: color-mix(in srgb, var(--status-critical) 18%, transparent); }
.alert-btn:disabled { opacity: 0.6; cursor: default; }
.alert-btn-sm {
  width: auto;
  margin-top: 0;
  padding: 5px 10px;
  font-size: 11.5px;
  white-space: nowrap;
}

/* flex-wrap (2026-09-09, achou 3 botão no card com o "Editar" novo) — com
   alert-btn condicional (só aparece com responsável + não concluída), o
   número de botões varia entre 2 e 3; basis fixo com wrap deixa os dois
   casos ok, sem depender de proporção calculada pra um número certo de
   itens. */
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.card-actions .alert-btn { margin-top: 0; flex: 1 1 140px; }
.card-actions .edit-btn,
.card-actions .delete-btn { flex: 1 1 90px; }

.row-actions { display: flex; gap: 6px; align-items: center; }

.delete-btn {
  width: 100%;
  font-family: "Karla", sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.delete-btn:hover { color: var(--status-critical); border-color: color-mix(in srgb, var(--status-critical) 40%, transparent); }
.delete-btn:active { background: color-mix(in srgb, var(--status-critical) 10%, transparent); }
.delete-btn:disabled { opacity: 0.6; cursor: default; }
.delete-btn.confirming {
  color: #fff;
  background: var(--status-critical);
  border-color: var(--status-critical);
}
.delete-btn-sm {
  width: auto;
  padding: 5px 8px;
  font-size: 11.5px;
  white-space: nowrap;
}

/* Mesma base visual de .delete-btn (botão neutro em contorno), só troca a
   cor de hover pro verde da marca em vez de vermelho — "Editar" não é uma
   ação destrutiva (2026-09-09, CRUD de atividade pelo painel). */
.edit-btn {
  width: 100%;
  font-family: "Karla", sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.edit-btn:hover { color: var(--brand-green); border-color: color-mix(in srgb, var(--brand-green) 40%, transparent); }
.edit-btn:active { background: color-mix(in srgb, var(--brand-green) 10%, transparent); }
.edit-btn-sm {
  width: auto;
  padding: 5px 8px;
  font-size: 11.5px;
  white-space: nowrap;
}

/* ---------- Activity list (mobile: cards) ---------- */

.activity-list { display: flex; flex-direction: column; gap: 10px; }

.activity-card {
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  background: var(--surface-1);
}
.activity-card .row-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.activity-card .titulo { font-weight: 600; font-size: 14.5px; }
.activity-card .descricao { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.activity-card .meta {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 9px; font-size: 12px; color: var(--text-muted);
}
.activity-card .meta span strong { color: var(--text-secondary); font-weight: 600; }

.pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.pendente { background: color-mix(in srgb, var(--status-warning) 16%, transparent); color: var(--status-warning); }
.pill.concluida { background: color-mix(in srgb, var(--status-good) 16%, transparent); color: var(--status-good); }
.pill.atrasada { background: color-mix(in srgb, var(--status-critical) 16%, transparent); color: var(--status-critical); }

/* Urgência por atividade (2026-09-09) — só aparece quando "alta"/"baixa"
   (normal é o caso comum, não precisa de rótulo nenhum, mesmo raciocínio de
   de-ênfase de .pill/.tag já documentado nesta seção). Texto plano (não
   .pill com bolinha) pra não competir visualmente com o status. */
.urgencia-tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
  vertical-align: middle;
}
.urgencia-tag.alta { background: color-mix(in srgb, var(--status-critical) 14%, transparent); color: var(--status-critical); }
.urgencia-tag.baixa { background: color-mix(in srgb, var(--text-muted) 14%, transparent); color: var(--text-muted); }

/* Classificação da mensagem (achado 2026-09-06): 6-7 badges com fundo
   saturado cada um lado a lado num feed compacto lia como "confete", não
   como ferramenta séria — mesma cor categórica que funciona bem num
   gráfico (barras_classificacao) fica pesada demais como selo de texto.
   Mantém a MESMA paleta --cat-N (não pode trocar, é validada) mas troca o
   tratamento: só uma bolinha de cor (mesmo padrão de .pill::before) +
   texto neutro, em vez de fundo colorido cheio. */
.tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-1);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: var(--text-muted); }
.tag.atividade::before { background: var(--cat-2); }
.tag.anotacao::before { background: var(--cat-4); }
.tag.comunicacao::before { background: var(--cat-3); }
.tag.pergunta::before { background: var(--cat-1); }
.tag.audio::before { background: var(--cat-1); }
.tag.texto::before { background: var(--text-muted); }

.evidence-thumbs { display: flex; gap: 6px; margin-top: 9px; }
.evidence-thumbs img {
  width: 42px; height: 42px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border-hairline);
}

/* ---------- Resumo por pessoa ("Time de relance") ---------- */

.pessoa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.pessoa-card {
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  background: var(--surface-1);
}
.pessoa-card.pessoa-inativa { opacity: 0.55; }
.pessoa-nome { font-weight: 600; font-size: 14.5px; }
.pessoa-nivel { font-weight: 400; font-size: 12px; color: var(--text-muted); }
.pessoa-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.pessoa-stats > div { min-width: 0; text-align: center; }
.pessoa-stats strong {
  display: block;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pessoa-stats span {
  display: block;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-top: 2px;
  overflow-wrap: break-word;
}
.pessoa-stats .pessoa-alerta strong { color: var(--status-critical); }

/* ---------- Messages feed ---------- */

.feed-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-hairline);
  font-size: 13px;
}
.feed-item:last-child { border-bottom: none; }
.feed-item .text { margin-top: 5px; color: var(--text-secondary); }
.feed-item time { color: var(--text-muted); font-size: 11.5px; }

.load-more-link {
  display: block;
  text-align: center;
  margin-top: 12px;
  padding: 9px 14px;
  font-family: "Karla", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface-1, transparent);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.load-more-link:hover, .load-more-link:focus-visible { border-color: var(--brand-green); color: var(--brand-green); }

/* ---------- Table (desktop only) ---------- */

.table-wrap { display: none; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border-hairline); vertical-align: middle; }
th { color: var(--text-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Responsive: tablet/desktop ---------- */

@media (min-width: 720px) {
  .stat-row { grid-template-columns: repeat(4, 1fr); }
  .charts-grid { grid-template-columns: 1.2fr 1fr; }
  .two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }
  .activity-list { display: none; }
  .table-wrap { display: block; }
}

/* ---------- Install hint ---------- */

.install-hint {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  box-shadow: var(--shadow-card);
}
.install-hint.visible { display: flex; }
.install-hint button {
  background: var(--brand-green);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
}

/* ---------- Header install button ---------- */

.topbar .header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: "Karla", sans-serif;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:active { background: rgba(255, 255, 255, 0.24); }
.icon-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* .icon-btn nasceu pro topbar escuro (fundo translúcido branco) — variante
   pra usar no corpo da página (fundo claro/escuro do tema, não o verde do
   header), mesmo botão sólido já usado em .export-btn/.periodo-aplicar
   (2026-09-09, botão "Nova atividade"). */
.icon-btn-brand {
  background: var(--brand-green);
  border-color: var(--brand-green);
  color: #fff;
}
.icon-btn-brand:active { background: var(--brand-green-dark); }

/* Campo de formulário genérico (2026-09-09, modal de criar/editar
   atividade) — mesmo padrão visual já usado em login.html (.login-field),
   promovido pra cá porque agora um form de verdade existe no registro
   "product" também, não só no login. */
.form-field { text-align: left; margin-bottom: 14px; }
.form-field label {
  display: block; font-size: 12.5px; font-weight: 700;
  color: var(--text-secondary); margin-bottom: 5px;
}
.form-field input, .form-field select, .form-field textarea {
  width: 100%; font-family: "Karla", sans-serif; font-size: 15px;
  padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline); background: var(--surface-1);
  color: var(--text-primary); box-sizing: border-box;
}
.form-field textarea { resize: vertical; min-height: 44px; }
.form-field input:focus-visible, .form-field select:focus-visible, .form-field textarea:focus-visible {
  outline: 2px solid var(--brand-green-bright); outline-offset: 1px;
}
.form-erro {
  color: var(--status-critical);
  font-size: 13px;
  margin: -4px 0 12px;
}
.form-submit-btn {
  width: 100%;
  font-family: "Karla", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  background: var(--brand-green);
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  margin-top: 4px;
}
.form-submit-btn:active { background: var(--brand-green-dark); }
.form-submit-btn:disabled { opacity: 0.6; cursor: default; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 30px 4px 12px;
}
.section-head .section-title { margin: 0; }

.theme-toggle { padding: 8px; }
/* Ícone certo (sol/lua) decidido só por CSS, nunca por classe adicionada via
   JS — achado de revisão (2026-09-06): depender de JS pra trocar o ícone
   reabre exatamente o tipo de "flash" que o script anti-FOUC do <head> foi
   feito pra evitar (o <html data-theme> já está certo antes do primeiro
   paint; o ícone tem que acompanhar isso, não esperar o <script> do fim do
   body rodar). */
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* Ícones inline (sprite <symbol>/<use> no topo do body) — substituem emoji
   como ícone funcional em botões e metadados (achado 2026-09-06: emoji ao
   lado de dado sério lia como pouco profissional). Emoji continua existindo
   só no registro conversacional da Nellia (chat, mensagens dela), não aqui. */
.icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  vertical-align: -2px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.meta .icon { color: var(--text-muted); margin-right: 1px; }
.alert-btn .icon, .delete-btn .icon { width: 13px; height: 13px; }

/* ---------- Modal overlay (compartilhado: instalação + chat) ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 18, 0.5);
  backdrop-filter: blur(2px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
}
.modal-overlay.open { display: flex; }

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--surface-2);
  border-radius: 16px 16px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
  animation: sheet-up 0.28s cubic-bezier(.2,.8,.2,1);
  max-height: 88vh;
  overflow-y: auto;
}
@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
  .modal-sheet { border-radius: 16px; }
}

.modal-sheet .modal-head {
  text-align: center;
  padding: 0 34px;
  margin-bottom: 14px;
}
.modal-sheet .modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
.modal-sheet .modal-head p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--gridline);
  border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

.install-steps {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

/* ---------- Chat FAB ---------- */

.chat-fab {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--brand-green), var(--brand-green-dark));
  border: none;
  box-shadow: 0 10px 24px -6px rgba(22, 63, 44, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 90;
  -webkit-tap-highlight-color: transparent;
}
.chat-fab svg { width: 26px; height: 26px; }
.chat-fab:active { transform: scale(0.94); }

/* ---------- Chat modal (pergunta / resposta em voz, sem histórico) ---------- */

.chat-avatar-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 6px 0 20px;
}
.chat-avatar-row img {
  width: 84px; height: 84px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: var(--shadow-card);
}

.chat-state {
  font-size: 13.5px;
  color: var(--text-secondary);
  text-align: center;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.voice-orb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--brand-green-bright);
  display: none;
}
.voice-orb.active {
  display: inline-block;
  animation: orb-pulse 1s ease-in-out infinite;
}
@keyframes orb-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
}

.record-wrap {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}
.record-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(160deg, var(--brand-green), var(--brand-green-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 10px 24px -6px rgba(22, 63, 44, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.record-btn svg { width: 32px; height: 32px; }
.record-btn:disabled { opacity: 0.5; cursor: default; }
.record-btn.recording {
  background: linear-gradient(160deg, var(--status-critical), #a52a2a);
  transform: scale(1.08);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--status-critical) 18%, transparent);
  animation: record-pulse 1.4s ease-in-out infinite;
}
@keyframes record-pulse {
  0%, 100% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--status-critical) 18%, transparent); }
  50% { box-shadow: 0 0 0 16px color-mix(in srgb, var(--status-critical) 10%, transparent); }
}

.chat-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 12px;
}

/* ---------- Calendário de atividades (2026-09-09) ---------- */

.section-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.view-toggle {
  display: flex;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.view-toggle-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: "Karla", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: none;
  padding: 7px 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.view-toggle-btn .icon { width: 13px; height: 13px; }
.view-toggle-btn.active { background: var(--brand-green); color: #fff; }

.calendario-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
/* .icon-btn foi desenhado pro topbar verde-escuro (fundo translúcido branco,
   texto branco) — usado aqui dentro do .card claro/escuro normal, o botão
   ficava branco-sobre-branco no tema claro, praticamente invisível (achado
   real de revisão, 2026-09-09). Mesmo tratamento neutro de .filter-chip. */
.calendario-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.calendario-nav-btn:hover { border-color: var(--brand-green); color: var(--brand-green); }
.calendario-mes-label {
  font-family: "Fraunces", serif;
  font-weight: 560;
  font-size: 1.05rem;
  color: var(--text-primary);
  text-transform: capitalize;
}
.calendario-semana {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 4px;
}
.calendario-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.calendario-cel {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  font-family: "Karla", sans-serif;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: default;
  padding: 0;
}
.calendario-cel.vazia { background: transparent; border-color: transparent; }
.calendario-cel.tem-atividade { cursor: pointer; font-weight: 700; color: var(--text-primary); }
.calendario-cel.tem-atividade:hover { border-color: var(--brand-green); }
.calendario-cel.selecionado { border-color: var(--brand-green); background: color-mix(in srgb, var(--brand-green) 10%, var(--surface-2)); }
.calendario-dots { display: flex; gap: 2px; min-height: 6px; }
.calendario-dot { width: 5px; height: 5px; border-radius: 50%; }
.calendario-dot.pendente { background: var(--status-warning); }
.calendario-dot.concluida { background: var(--status-good); }
.calendario-dot.atrasada { background: var(--status-critical); }

.calendario-dia-detalhe { margin-top: 14px; }
.calendario-dia-lista { display: flex; flex-direction: column; gap: 6px; }
.calendario-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  cursor: pointer;
  font-family: "Karla", sans-serif;
}
.calendario-item:hover { border-color: var(--brand-green); }
.calendario-item-titulo { flex: 1; font-size: 13.5px; color: var(--text-primary); font-weight: 700; }
.calendario-item-resp { font-size: 12px; color: var(--text-muted); }
