:root {
  --color-primary: #00533f;
  --color-primary-dark: #003b2d;
  --color-primary-light: #e6f0ec;
  --color-accent: #ffb500;
  --color-secondary: #004185;

  --bg-page: #f4f6f5;
  --bg-surface: #ffffff;
  --bg-surface-muted: #f7f9f8;
  --border-subtle: #e2e8e5;

  --text-primary: #0f2a20;
  --text-secondary: #4b665c;
  --text-muted: #8ba299;

  --success: #1a8f4c;
  --danger: #d64545;

  --font-family: "Segoe UI", Arial, "Helvetica Neue", Helvetica, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-soft: 0 2px 14px rgba(15, 42, 32, 0.06);
  --shadow-hover: 0 8px 24px rgba(0, 83, 63, 0.12);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* Layout com barra lateral */
.app { display: flex; min-height: 100vh; }
.content { flex: 1; min-width: 0; }
.brand-logo { height: 30px; display: block; }

.sidebar {
  flex: 0 0 260px;
  width: 260px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
}
.sidebar-brand { display: block; padding: 26px 24px 22px; }
.sidebar-brand img { display: block; width: 100%; max-width: 190px; height: auto; }

.sidebar-nav { flex: 1; padding: 4px 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.side-section {
  margin: 20px 12px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: rgba(255, 255, 255, 0.5);
}
.side-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.86);
  transition: background 0.15s, color 0.15s;
}
a.side-link:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.side-link.active { background: rgba(255, 255, 255, 0.14); color: #fff; font-weight: 700; }
.side-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--color-accent);
}
.side-link.soon { color: rgba(255, 255, 255, 0.4); cursor: default; }
.soon-icon { flex: 0 0 auto; opacity: 0.8; }

.sidebar-user {
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.user-block { line-height: 1.25; min-width: 0; }
.user-name { display: block; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.user-role { display: block; font-size: 11px; color: rgba(255, 255, 255, 0.6); text-transform: uppercase; letter-spacing: 0.4px; }
.btn-sair {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-sair:hover { background: rgba(255, 255, 255, 0.14); border-color: #fff; }

/* Barra do topo: só em tela estreita (menu vira gaveta) */
.topbar { display: none; }
.sidebar-overlay { display: none; }

.soon-pill {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--border-subtle);
  color: var(--text-muted);
  vertical-align: middle;
}

/* Layout */
.main { max-width: 1400px; margin: 0 auto; padding: 32px 24px; }

.messages { list-style: none; margin-bottom: 20px; display: grid; gap: 8px; }
.message {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-surface-muted);
  border: 1px solid var(--border-subtle);
}
.message.error { background: #fdecec; color: var(--danger); border-color: #f5c6c6; }
.message.success { background: #e9f7ef; color: var(--success); border-color: #bfe6cf; }
.message.warning { background: #fff4d6; color: #8a6100; border-color: #f2dc9c; }

.page-title { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; margin-bottom: 4px; }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; }

/* Cards / módulos */
.modulo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.modulo-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: block;
}
a.modulo-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--color-primary); }
.modulo-card h3 { font-size: 16px; font-weight: 800; color: var(--color-primary); margin-bottom: 6px; }
.modulo-card p { font-size: 13px; color: var(--text-secondary); }
.modulo-card.soon { background: var(--bg-surface-muted); box-shadow: none; }
.modulo-card.soon h3 { color: var(--text-muted); }

/* KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 28px; }
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-soft);
}
.kpi-card.negativo { border-left-color: var(--danger); }
.kpi-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 8px; }
.kpi-value { font-size: 24px; font-weight: 800; letter-spacing: -0.4px; }
.kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.kpi-sub.positivo { color: var(--success); }
.kpi-sub.negativo { color: var(--danger); }

/* Painéis / gráficos */
.card-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 28px;
}
.panel-title { font-size: 15px; font-weight: 800; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chart-wrap { position: relative; width: 100%; min-height: 300px; }

/* Filtros */
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 24px; }
.filter-field { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  min-width: 140px;
}
.btn-clear {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-muted);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-clear:hover { border-color: var(--danger); color: var(--danger); }

/* Busca dentro das tabelas (ranking / comparativo) */
.busca-tabela { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.busca-input { flex: 1; min-width: 220px; max-width: 420px; }
.filters .busca-tabela { margin-bottom: 0; }
.card-panel[id] { scroll-margin-top: 16px; }

/* Tabela */
.table-responsive { width: 100%; overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); max-height: 520px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th {
  background: var(--bg-surface-muted);
  padding: 12px 16px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
}
td { padding: 11px 16px; border-bottom: 1px solid var(--border-subtle); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--bg-surface-muted); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.ok { background: #e9f7ef; color: var(--success); }
.badge.abaixo { background: #fdecec; color: var(--danger); }
.badge.classe-a { background: #e9f7ef; color: var(--success); }
.badge.classe-b { background: #fff4d6; color: #8a6100; }
.badge.classe-c { background: #eef1f0; color: var(--text-muted); }
tbody tr.sel td { background: var(--color-primary-light); font-weight: 700; }
tfoot td { font-weight: 800; background: var(--bg-surface-muted); border-top: 2px solid var(--border-subtle); position: sticky; bottom: 0; }
.cel-sub { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 14px; }

/* Login */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% -10%, var(--color-primary-light), var(--bg-page) 60%); }
.login-panel { width: min(380px, 100%); background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-hover); text-align: center; }
.login-panel .brand-logo { height: 34px; margin: 0 auto 20px; }
.login-panel h1 { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.login-panel p { font-size: 13px; color: var(--text-secondary); margin-bottom: 22px; }
.login-form { display: grid; gap: 14px; text-align: left; }
.login-form label { display: grid; gap: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); }
.login-form input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  background: var(--bg-surface-muted); font-family: inherit; font-size: 14px; outline: none;
}
.login-form input:focus { border-color: var(--color-primary); }
.login-submit {
  margin-top: 4px; padding: 11px 16px; border: none; border-radius: var(--radius-sm);
  background: var(--color-primary); color: #fff; font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: opacity 0.15s;
}
.login-submit:hover { opacity: 0.9; }

/* Até 900px: o menu lateral vira uma gaveta, aberta pelo botão da barra do topo */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: none;
  }
  body.sidebar-aberta .sidebar { transform: translateX(0); box-shadow: 8px 0 30px rgba(0, 0, 0, 0.3); }
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(15, 42, 32, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }
  body.sidebar-aberta .sidebar-overlay { opacity: 1; pointer-events: auto; }
  body.sidebar-aberta { overflow: hidden; }

  .topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
    padding: 0 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
  }
  .topbar-menu {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-surface-muted);
    color: var(--color-primary);
    cursor: pointer;
  }
  .card-panel[id] { scroll-margin-top: 72px; }
}

@media (max-width: 720px) {
  .main { padding: 20px 16px; }
}

/* Matriz setor/vendedor x mês */
table.matriz td, table.matriz th { white-space: nowrap; }
table.matriz th:first-child, table.matriz td:first-child { position: sticky; left: 0; background: var(--bg-surface); z-index: 2; }
table.matriz thead th:first-child { background: var(--bg-surface-muted); z-index: 3; }
table.matriz tr.grupo td { background: var(--color-primary-light); font-weight: 800; }
table.matriz tr.membro td:first-child { padding-left: 30px; }
table.matriz tbody tr.membro:hover td { background: var(--bg-surface-muted); }
table.matriz tfoot td:first-child { z-index: 3; }
td.neg { color: var(--danger); }
.vazio { color: var(--text-muted); }

/* Árvore vendedor > cliente > produto (Resumo Vendas) */
.arvore-topo { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.arvore-topo .busca-tabela { margin-bottom: 0; flex: 1 1 320px; }
.arvore-acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.arvore { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; }
.arvore > .no + .no { border-top: 1px solid var(--border-subtle); }
.no-filhos { border-top: 1px solid var(--border-subtle); }
.no-filhos > .no + .no { border-top: 1px solid var(--border-subtle); }
.no > summary, .no-folha { display: flex; align-items: center; gap: 12px; padding: 10px 14px; font-size: 13px; }
.no > summary { cursor: pointer; list-style: none; }
.no > summary::-webkit-details-marker { display: none; }
.no > summary::before {
  content: "";
  flex: 0 0 7px;
  height: 7px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s;
}
.no[open] > summary::before { transform: rotate(45deg); }
.no > summary:hover { background: var(--bg-surface-muted); }
.no-nome { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.no-fat { white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.no-fat.neg { color: var(--danger); }
.no-vendedor > summary { background: var(--color-primary-light); font-weight: 800; }
.no-vendedor > summary:hover { background: var(--color-primary-light); filter: brightness(0.97); }
.no-cliente > summary { padding-left: 32px; font-weight: 700; }
.no-folha { padding-left: 58px; font-weight: 500; }
.no-folha + .no-folha { border-top: 1px solid var(--border-subtle); }
.no-vendedor .no-cliente > summary { padding-left: 32px; }
.arvore > .no-cliente > summary { padding-left: 14px; }
.arvore > .no-cliente .no-folha { padding-left: 40px; }

/* Barra de participação (tabela de setores) */
.link-setor { font-weight: 700; color: var(--color-primary); }
.link-setor:hover { text-decoration: underline; }
.barra-pct { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.barra { flex: 1; height: 8px; border-radius: 999px; background: var(--bg-surface-muted); border: 1px solid var(--border-subtle); overflow: hidden; }
.barra > i { display: block; height: 100%; background: var(--color-primary); }
.barra-num { flex: 0 0 48px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

/* Gráfico de barras horizontais (muitos rótulos longos) */
.chart-wrap.alto { height: 480px; }
/* KPI com texto no lugar de número (ex.: nome do produto mais vendido) */
.kpi-value.kpi-texto { font-size: 16px; line-height: 1.3; letter-spacing: 0; overflow-wrap: anywhere; }

/* Texto de apoio ao lado do título do painel (antes sem estilo: herdava o negrito do título) */
.panel-subtitle { font-size: 12px; font-weight: 500; color: var(--text-muted); }

/* Insights */
.btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.6; cursor: progress; }

.insight-resumo p { font-size: 15px; line-height: 1.6; }
.insight-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; margin-bottom: 16px; }
.insight-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--text-muted);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}
.insight-card.alta { border-left-color: var(--success); }
.insight-card.queda { border-left-color: var(--danger); }
.insight-card.atencao { border-left-color: var(--color-accent); }
.insight-card.info { border-left-color: var(--color-secondary); }
.insight-card h3 { font-size: 15px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.insight-card p { font-size: 13px; line-height: 1.6; color: var(--text-secondary); overflow-wrap: anywhere; }
.insight-tag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); }
.insight-tag.alta { color: var(--success); }
.insight-tag.queda { color: var(--danger); }
.insight-tag.atencao { color: #8a6100; }
.insight-tag.info { color: var(--color-secondary); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.chip { padding: 3px 9px; border: 1px solid var(--border-subtle); border-radius: 999px; background: var(--bg-surface-muted); font-size: 11px; color: var(--text-secondary); }
.chip b { color: var(--text-primary); font-weight: 700; }
.insight-rodape { font-size: 12px; color: var(--text-muted); }

/* Select com opção comprida (ex.: "Setor 652 — NOME COMPLETO") não pode estourar a tela */
.filter-field { min-width: 0; max-width: 100%; }
.filter-select { max-width: 100%; }

/* Cartão de insight que leva ao dashboard: o link "estica" por cima do cartão todo */
.insight-card.clicavel { position: relative; transition: box-shadow 0.15s, transform 0.15s; }
.insight-card.clicavel:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.insight-link { font-size: 12px; font-weight: 700; color: var(--color-primary); }
.insight-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-md); }
.insight-card.clicavel:hover .insight-link { text-decoration: underline; }
.insight-link:focus-visible { outline: none; }
.insight-link:focus-visible::after { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Cota Mensal */
.envio > summary { cursor: pointer; margin-bottom: 0; list-style: none; }
.envio > summary::-webkit-details-marker { display: none; }
.envio > summary::after { content: "+"; font-size: 18px; color: var(--text-muted); }
.envio[open] > summary::after { content: "–"; }
.envio[open] > summary { margin-bottom: 16px; }
.envio-form { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.envio-form input[type="file"] { padding: 6px 10px; }
.tabela-cota td, .tabela-cota th { white-space: nowrap; padding-left: 10px; padding-right: 10px; }
.tabela-cota td:first-child, .tabela-cota th:first-child { padding-left: 16px; }
.tabela-cota .col-ating { min-width: 150px; }
.tabela-cota .ating { display: inline-block; min-width: 52px; font-weight: 700; font-variant-numeric: tabular-nums; }
.barra-cota {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  width: 80px;
  height: 10px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--bg-surface-muted);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}
.barra-cota i, .legenda-cota i { display: block; height: 100%; }
.barra-cota .fat, .legenda-cota .fat { background: var(--color-primary); }
.barra-cota .exp, .legenda-cota .exp { background: var(--color-secondary); }
.barra-cota .ped, .legenda-cota .ped { background: var(--color-accent); }
.barra-cota .marca { position: absolute; top: -1px; bottom: -1px; width: 2px; margin-left: -1px; background: var(--danger); }
.legenda-cota { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 11px; font-weight: 500; color: var(--text-muted); }
.legenda-cota i { width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; }
.legenda-cota .marca { display: inline-block; width: 2px; height: 12px; margin-left: 8px; background: var(--danger); }

/* Insights: abas Destaques / Perguntar */
.abas-insights { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border-subtle); }
.abas-insights a {
  padding: 10px 16px;
  margin-bottom: -1px;
  border-bottom: 3px solid transparent;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
}
.abas-insights a:hover { color: var(--color-primary); }
.abas-insights a.ativa { color: var(--color-primary); border-bottom-color: var(--color-accent); }

/* Chat */
.chat-conversa { display: flex; flex-direction: column; gap: 22px; }
.chat-conversa:not(:empty) { margin-bottom: 22px; }
.chat-turno { display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 16px; }
.chat-pergunta {
  align-self: flex-end;
  max-width: min(640px, 90%);
  padding: 10px 14px;
  border-radius: 14px 14px 4px 14px;
  background: var(--color-primary);
  color: #fff;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-resposta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--bg-surface-muted);
  font-size: 14px;
  line-height: 1.6;
}
.chat-resposta header h3 { font-size: 15px; font-weight: 800; }
.chat-resposta.nao_atendida { border-left-color: var(--color-accent); }
.chat-resposta.erro { border-left-color: var(--danger); color: var(--danger); }
.chat-resposta.pensando { color: var(--text-muted); font-style: italic; }
.chat-resposta.pensando::after { content: ""; display: inline-block; width: 1.2em; animation: pontos 1.2s steps(4, end) infinite; }
@keyframes pontos { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.chat-aviso { font-size: 12px; color: #8a6100; }
.chat-grafico { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 10px; min-height: 280px; height: 300px; }
.chat-acoes { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.chat-link { font-size: 13px; font-weight: 700; color: var(--color-primary); }
.chat-link:hover { text-decoration: underline; }
.chat-sugestoes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.chat-sugestao { cursor: pointer; font-family: inherit; }
.chat-sugestao:hover { border-color: var(--color-primary); color: var(--color-primary); }
.chat-form { display: flex; flex-direction: column; gap: 10px; }
.chat-form textarea { width: 100%; resize: vertical; min-height: 56px; font-size: 14px; }
.chat-form-acoes { display: flex; gap: 8px; flex-wrap: wrap; }

/* Meta x Real Clientes */
.duas-colunas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 0 20px; }
.filtros-tabela { margin-bottom: 14px; }
.barra > i.abaixo { background: var(--color-accent); }
.duas-colunas .tabela-cota td, .duas-colunas .tabela-cota th { padding-left: 6px; padding-right: 6px; }
.duas-colunas .tabela-cota td:first-child, .duas-colunas .tabela-cota th:first-child { padding-left: 12px; }

/* Cliente agrupado por raiz de CNPJ (Curva ABC / rankings) */
.grupo-codigos { display: inline-block; margin-left: 6px; font-size: 11px; }
.grupo-codigos > summary { display: inline-block; cursor: pointer; list-style: none; padding: 1px 8px; border-radius: 999px; background: var(--color-primary-light); color: var(--color-primary); font-weight: 700; }
.grupo-codigos > summary::-webkit-details-marker { display: none; }
.grupo-codigos ul { margin: 6px 0 2px; padding-left: 16px; color: var(--text-secondary); font-weight: 500; white-space: normal; }

/* Filtro de período (core/_periodo.html) */
.periodo { position: relative; }
.periodo-botao { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; text-align: left; }
.periodo-botao svg { color: var(--color-primary); flex: 0 0 auto; }
.periodo-pop {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0;
  display: grid; grid-template-columns: 170px minmax(0, 1fr);
  width: 480px; max-width: calc(100vw - 32px);
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); box-shadow: var(--shadow-hover); overflow: hidden;
}
.periodo-pop[hidden] { display: none; }
.periodo-atalhos { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-right: 1px solid var(--border-subtle); background: var(--bg-surface-muted); }
.periodo-atalhos .btn-clear { justify-content: flex-start; padding: 7px 10px; font-size: 12px; }
.periodo-atalhos .btn-clear.ativo { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.periodo-cal { padding: 12px; }
.periodo-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.periodo-nav .btn-clear { padding: 4px 12px; font-size: 16px; }
.periodo-grade { display: grid; gap: 2px; }
.periodo-grade.por-dia { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.periodo-grade.por-mes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.periodo-semana { text-align: center; font-size: 10px; font-weight: 700; color: var(--text-muted); padding: 4px 0; }
.periodo-dia { border: none; background: none; border-radius: 6px; padding: 7px 0; font: inherit; font-size: 12px; color: var(--text-primary); cursor: pointer; }
.por-mes .periodo-dia { padding: 12px 0; }
.periodo-dia:hover:not(:disabled) { background: var(--bg-surface-muted); }
.periodo-dia.fora { color: var(--text-muted); }
.periodo-dia:disabled { color: var(--border-subtle); cursor: not-allowed; }
.periodo-dia.dentro { background: var(--color-primary-light); color: var(--color-primary); border-radius: 0; }
.periodo-dia.ponta { background: var(--color-primary); color: #fff; border-radius: 6px; }
.periodo-rodape { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.periodo-escolha { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.periodo-nota { margin-top: 8px; font-size: 11px; color: var(--text-muted); }
@media (max-width: 560px) {
  .periodo-pop { grid-template-columns: minmax(0, 1fr); width: calc(100vw - 32px); }
  .periodo-atalhos { flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--border-subtle); }
}
