/* ------------------------------------------------------------------ */
/* Axis shell — layout e componentes alinhados ao design system Axis    */
/* (/root/projects/axis-site/design.md), espelhando lilaliz/report-kit  */
/* e culturaolinda-report: sidebar navy, topbar, source pills, KPI mono */
/* e bordas finas. Carregado DEPOIS de style.css — só sobrescreve;      */
/* remover este arquivo + o shell do template volta ao layout anterior. */
/* Usa tokens semânticos (--surface-2, --border, --text-*).             */
/* ------------------------------------------------------------------ */
.viz-root {
  --border-default: 0.5px solid var(--border);
  --focus-ring: 0 0 0 3px rgba(240, 72, 1, .12);
  --sidebar-w: 240px;
}

body { padding: 0; min-width: 320px; font-size: 15px; line-height: 1.6; }
[hidden] { display: none !important; }
button:active { transform: scale(.97); }

/* ------------------------------------------------------------------ */
/* Shell — sidebar navy + conteúdo                                     */
/* ------------------------------------------------------------------ */
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); padding: 28px 16px 22px;
  background: var(--ax-navy); color: var(--ax-cream); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 30;
}
.brand { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 12px; padding: 0 8px 36px; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: var(--radius-md);
  background: var(--ax-orange); color: #fff; font-family: var(--font-display); font-size: 18px; font-weight: 700;
}
.brand strong, .brand small { display: block; }
.brand strong { font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.brand small {
  margin-top: 3px; color: rgba(239, 236, 240, .55); font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase;
}

.nav-list { display: grid; gap: 4px; }
/* .nav-item.view-tab: vence o estilo pill antigo de .view-tab em style.css */
.nav-item.view-tab {
  position: relative; border: 0; border-radius: var(--radius-md); padding: 11px 12px; text-align: left;
  color: rgba(239, 236, 240, .7); background: transparent; display: flex; gap: 12px; align-items: center;
  font-family: var(--font-body); font-size: 13px; font-weight: 500; transition: background .15s, color .15s;
}
.nav-item span { width: 16px; color: rgba(239, 236, 240, .45); text-align: center; }
.nav-item.view-tab:hover { color: #fff; background: rgba(239, 236, 240, .06); }
.nav-item.view-tab.is-active { color: #fff; background: rgba(239, 236, 240, .08); }
.nav-item.is-active::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 2px 2px 0; background: var(--ax-orange);
}
.nav-item.is-active span { color: var(--ax-orange); }
.nav-item:focus-visible { outline: 2px solid var(--ax-orange); outline-offset: 2px; }

.sidebar-note {
  margin-top: auto; color: rgba(239, 236, 240, .6); display: flex; align-items: flex-start; gap: 8px; padding: 10px 8px;
  border-top: 0.5px solid rgba(239, 236, 240, .12); font-size: 11px; line-height: 1.45;
}
.status-dot { width: 7px; height: 7px; flex: 0 0 7px; margin-top: 4px; border-radius: 50%; background: #1fb88a; animation: ax-pulse 2s ease-in-out infinite; }

.main-content { width: 100%; min-width: 0; padding: 36px clamp(20px, 4vw, 48px) 60px; max-width: 1280px; }
.main { max-width: none; margin: 0; }

/* ------------------------------------------------------------------ */
/* Topbar                                                              */
/* ------------------------------------------------------------------ */
.topbar.page-header {
  max-width: none; margin: 0 0 24px; display: flex; justify-content: space-between; gap: 28px;
  align-items: flex-start; flex-wrap: nowrap;
}
.eyebrow { margin: 0 0 10px; color: var(--ax-orange); font-size: 11px; }
.page-header h1 { font-size: clamp(28px, 3vw, 36px); line-height: 1.1; }
.subtitle { margin: 8px 0 0; font-size: 13px; }

.filters.filter-row {
  max-width: 680px; margin: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px;
}
.filters .export-pdf-btn { order: 0; margin-left: 0; }
.filters .export-pdf-btn:hover { border-color: var(--ax-navy); }
.filters .date-picker__panel { left: auto; right: 0; }

/* Status do período (as-of / comparação / atualização) como source pills */
.source-status.page-header__meta {
  display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 22px;
}
.source-pill {
  display: inline-flex; align-items: center; gap: 7px; border: var(--border-default); border-radius: var(--radius-pill);
  background: var(--surface-2); padding: 4px 12px; color: var(--text-secondary); font-size: 11px; font-weight: 500;
}
.source-pill:empty { display: none; }
.source-pill.ok { padding-left: 10px; background: var(--ax-success-tint); border-color: transparent; color: var(--ax-success); }
.source-pill .refresh-dot { width: 7px; height: 7px; background: var(--ax-success); animation: ax-pulse 2s ease-in-out infinite; }

/* Filtros da aba Comercial — linha própria abaixo das pills */
.main-content > .filters-panel { display: flex; align-items: center; margin: -6px 0 22px; }
.main-content > .filters-panel[data-hidden="true"] { display: none; }

/* ------------------------------------------------------------------ */
/* KPI tiles — mesmo visual do kpi-card do Lilaliz                     */
/* ------------------------------------------------------------------ */
.stat-row { gap: 16px; margin-bottom: 16px; }
.stat-row--compact { gap: 10px; margin: 0 0 12px; }
.stat-row--compact .stat-tile { padding: 14px 16px; }
.stat-row--compact .stat-tile__value { font-size: 20px; }

.stat-tile {
  overflow: hidden; align-items: flex-start; gap: 0; padding: 20px;
  background: var(--surface-2); border: var(--border-default); border-radius: var(--radius-lg);
  transition: border-color .15s;
}
.stat-tile::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ax-orange);
  opacity: 0; transition: opacity .15s;
}
.stat-tile:hover { border-color: var(--baseline); transform: none; }
.stat-tile:hover::before, .stat-tile--total::before { opacity: 1; }
/* Total deixa de ser tile navy: destaque vem da barra laranja (padrão Lilaliz/Olinda) */
.stat-tile--total { background: var(--surface-2); color: var(--text-primary); border: var(--border-default); }
.stat-tile--total:hover { border-color: var(--baseline); }
.stat-tile--total .stat-tile__label { color: var(--text-muted); }

.stat-tile__swatch { width: 8px; height: 8px; border-radius: 2px; top: 24px; right: 20px; }
.stat-tile__label {
  max-width: calc(100% - 14px); overflow-wrap: anywhere; font-family: var(--font-body);
  font-size: 11px; font-weight: 500; letter-spacing: .08em;
}
.stat-tile__value {
  margin-top: 10px; font-size: clamp(20px, 1.2rem + 0.6vw, 28px); line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-tile__sub { margin-top: 8px; color: var(--text-muted); font-size: 11px; }
.stat-tile__delta {
  display: inline-flex; margin-top: 10px; border-radius: var(--radius-pill); padding: 2px 8px;
  font-size: 11px; font-weight: 500; color: var(--text-secondary); background: #f1eff3;
}
.stat-tile__delta.is-up,
.stat-tile--total .stat-tile__delta.is-up { color: var(--ax-success); background: var(--ax-success-tint); }
.stat-tile__delta.is-down,
.stat-tile--total .stat-tile__delta.is-down { color: var(--ax-orange-dark); background: var(--ax-orange-tint); }

/* ------------------------------------------------------------------ */
/* Cards                                                               */
/* ------------------------------------------------------------------ */
.chart-card, .table-card, .channel-card, .rec-card, .ga4-card {
  border: var(--border-default); padding: 24px; margin-bottom: 16px; transition: border-color .15s;
}
.chart-card__header, .table-card__header, .section-header { align-items: baseline; gap: 4px 12px; margin-bottom: 16px; }
.chart-card__header h2, .table-card__header h2, .section-header h2, .channel-card h3, .ga4-card h3 {
  font-size: 17px; letter-spacing: -.02em;
}
.section-note {
  margin: 0; color: var(--text-muted); font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase;
}
.channel-grid { gap: 16px; }
.channel-grid > .chart-card, .channel-grid > .table-card { margin-bottom: 16px; }

/* Subguias Comercial — pills navy (mesmo idioma dos presets do date picker) */
.comercial-subtab:hover { border-color: var(--ax-navy); }
.comercial-subtab.is-active { border-color: var(--ax-navy); background: var(--ax-navy); color: var(--ax-cream); }

.chart-card__subtitle { font-size: 11px; font-weight: 500; color: var(--text-muted); }
.legend { gap: 16px; color: var(--text-muted); font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.chart { height: 285px; }

/* ------------------------------------------------------------------ */
/* Barras (top palavras-chave / ranking) — trilho fino em pill         */
/* ------------------------------------------------------------------ */
.funnel-bars { gap: 10px; margin-bottom: 16px; }
.funnel-bar { grid-template-columns: minmax(120px, 1fr) 2fr auto; gap: 12px; font-size: 12px; }
.funnel-bar__label { font-size: 12px; font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel-bar__track { height: 8px; border-radius: var(--radius-pill); background: var(--gridline); }
.funnel-bar__fill,
.rank-bar__fill { border-radius: inherit; background: linear-gradient(90deg, var(--ax-orange), var(--ax-orange-light)); }
.funnel-bar__meta { font-size: 12px; font-weight: 500; }
.rank-bar__track { border-radius: var(--radius-pill); }
.rank-bar__label { font-weight: 500; }
.rank-bar__value { font-weight: 600; }

/* ------------------------------------------------------------------ */
/* Tabelas — thead cinza, números em mono, linhas compactas            */
/* ------------------------------------------------------------------ */
.data-table { font-size: 13px; }
.data-table th {
  padding: 11px 10px; background: var(--page-plane); border-bottom: 0.5px solid var(--border);
  font-size: 10px; letter-spacing: .08em; color: var(--text-muted);
}
.data-table th:has(.table-sort-button) { padding: 0 4px; }
.data-table th .table-sort-button { min-height: 38px; padding: 0 6px; }
.data-table td { padding: 11px 10px; border-bottom: 0.5px solid var(--border); color: var(--text-primary); }
.data-table td.num { font-size: 12px; }
.data-table tbody tr:hover { background: var(--page-plane); }
.table-scroll--matched thead th { background: var(--page-plane); }
.data-table td .cell-delta { font-family: var(--font-mono); font-weight: 500; }
.table-view-toggle, .tabs button { border-radius: var(--radius-pill); }
.table-view-toggle:hover, .tabs button:hover { background: transparent; border-color: var(--ax-navy); }
.table-search { min-height: 38px; background: var(--surface-2); font-size: 13px; }
.table-search:focus { outline: none; border-color: var(--ax-orange); box-shadow: var(--focus-ring); }

/* Métricas em linha / mini cards */
.metric-row { padding: 12px 0; border-bottom: 0.5px solid var(--border); font-size: 13px; }
.metric-row strong { font-family: var(--font-body); font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.metric-row .num { font-weight: 600; font-size: 13px; letter-spacing: -.02em; }
.mini { background: transparent; border: var(--border-default); padding: 10px 12px; }
.mini span { font-family: var(--font-body); font-size: 10px; font-weight: 500; letter-spacing: .08em; }
.mini strong { font-family: var(--font-mono); font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.channel-card__note { font-size: 11px; font-style: italic; }

/* Formulários (calculadora da Projeção + modal de metas) — label 11px uppercase, input 38px */
.meta-form__field { gap: 5px; color: var(--text-muted); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.meta-form__field input, .meta-form__field select {
  min-height: 38px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2);
  color: var(--text-primary); padding: 0 12px; font-family: var(--font-mono); font-size: 13px;
  text-transform: none; letter-spacing: normal; transition: border-color .15s, box-shadow .15s;
}
.meta-form__field select { font-family: var(--font-body); }
.meta-form__field input:hover, .meta-form__field select:hover { border-color: var(--baseline); }
.meta-form__field input:focus-visible, .meta-form__field select:focus-visible { outline: none; border-color: var(--ax-orange); box-shadow: var(--focus-ring); }
.calc-body { padding: 0; }
.calc-grid--premissas { background: var(--page-plane); border: var(--border-default); }

/* ------------------------------------------------------------------ */
/* Notas — itálico 11px alinhado à esquerda                            */
/* ------------------------------------------------------------------ */
.data-note { max-width: 80ch; margin: 8px 0 0; font-size: 11px; font-style: italic; line-height: 1.55; }
.data-note--tight { max-width: none; margin: 12px 0 0; }
.data-note code { font-style: normal; font-family: var(--font-mono); }
.staleness-banner {
  border: 0.5px solid rgba(186, 117, 23, .35); border-left: 3px solid var(--ax-warning);
  background: #fdf6ea; color: #7a4c0e; font-size: 13px; font-weight: 500; margin-bottom: 18px;
}

/* ------------------------------------------------------------------ */
/* Funil de vendas — resumo executivo, no design system Axis:          */
/* card claro, faixas com respiro (degradê laranja do CRM, navy só em  */
/* Cliques — cores em FUNIL_TRAPEZOID_STAGE_COLORS no JS), métricas    */
/* em mono sem sombra, taxa como badge cream e deltas/atingimento com  */
/* os tokens semânticos (--ax-success / danger = --ax-orange-dark).                  */
/* ------------------------------------------------------------------ */
.funil-trapezoid-card { background: var(--surface-2); border: var(--border-default); }
.funil-trapezoid-card:hover { border-color: var(--baseline); }
.funil-trapezoid-card .chart-card__header h2 { color: var(--text-primary); }
.funil-trapezoid-card .chart-card__subtitle {
  color: var(--ax-orange); font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}
.funil-trapezoid { gap: 0 20px; }
.funil-trapezoid__col-header { border-bottom: 0.5px solid var(--border); padding-bottom: 14px; margin-bottom: 14px; }
.funil-trapezoid__col-header h3 { color: var(--text-primary); font-size: 15px; letter-spacing: -.01em; }
.funil-trapezoid__col-header p { color: var(--text-muted); font-size: 10px; font-weight: 500; letter-spacing: .08em; }
.funil-trapezoid__col-header p.is-selected { color: var(--ax-orange-dark); font-weight: 600; }
.funil-trapezoid__label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--text-secondary);
}
/* respiro de 4px entre faixas, como no funil do Olinda */
.funil-trapezoid__stage { padding: 2px 0; }
.funil-trapezoid__band { gap: 6px; transition: opacity .15s; }
.funil-trapezoid__band:hover { filter: none; opacity: .92; }
.funil-trapezoid__band.is-empty {
  background: var(--page-plane) !important; border: 0.5px dashed var(--baseline); border-radius: var(--radius-md);
}
.funil-trapezoid__band.is-empty .funil-trapezoid__value { color: var(--text-muted); }
.funil-trapezoid__value { font-size: 26px; font-weight: 600; letter-spacing: -.03em; text-shadow: none; }
.funil-trapezoid__growth {
  font-size: 10px; font-weight: 600; padding: 2px 8px; border: 0; background: rgba(255, 255, 255, .94);
}
.funil-trapezoid__growth.is-up { color: var(--ax-success); }
.funil-trapezoid__growth.is-down { color: var(--ax-orange-dark); }
.funil-trapezoid__rate {
  font-size: 10px; font-weight: 600; letter-spacing: .06em; padding: 3px 10px;
  background: var(--surface-1); color: var(--text-secondary); border: 0.5px solid var(--border);
  box-shadow: 0 2px 6px -2px rgba(2, 0, 53, .18);
}
.funil-trapezoid__goal { gap: 4px; }
.funil-trapezoid__goal-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border: 0; letter-spacing: -.01em; }
.funil-trapezoid__goal-badge.is-up { background: var(--ax-success-tint); color: var(--ax-success); }
.funil-trapezoid__goal-badge.is-down { background: var(--ax-orange-tint); color: var(--ax-orange-dark); }
.funil-trapezoid__goal-caption {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
}
.funil-trapezoid__goal-empty { color: var(--text-muted); }

@keyframes ax-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .5; transform: scale(.85); } }
@media (prefers-reduced-motion: reduce) { .status-dot, .source-pill .refresh-dot { animation: none; } }

/* Tema: só claro, como o design system Axis (Lilaliz/Olinda). O template fixa
   <html data-theme="light">, o que desliga os blocos dark de style.css. */

/* ------------------------------------------------------------------ */
/* Responsivo — mesmos breakpoints do Lilaliz/Olinda                   */
/* ------------------------------------------------------------------ */
@media (max-width: 1050px) {
  .topbar.page-header { flex-direction: column; }
  .filters.filter-row { justify-content: flex-start; max-width: none; }
  .filters .date-picker__panel { left: 0; right: auto; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; width: 100%; padding: 16px; }
  .brand { padding: 0 2px 16px; }
  .nav-list { grid-template-columns: repeat(6, 1fr); }
  .nav-item.view-tab { justify-content: center; padding: 10px 4px; font-size: 0; }
  .nav-item span { font-size: 15px; }
  .nav-item.is-active::before { left: 25%; right: 25%; top: auto; bottom: 0; width: auto; height: 2px; }
  .sidebar-note { display: none; }
  .main-content { padding: 24px 20px 40px; }
}
@media (max-width: 450px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-tile { padding: 14px; }
  .stat-tile__value { font-size: 20px; }
  .stat-tile__delta { white-space: normal; }
  .chart-card, .table-card { padding: 16px; }
}
