/* ═══════════════════════════════════════════════════════════════════════════
   LeadsCentral — Mundo Sam Yamaha · tema Yamaha Racing Blue · v2 (2026)
   Linguagem visual: superfícies translúcidas ("liquid glass"), profundidade em
   camadas, movimento com molas suaves. Paleta de dados validada (dataviz:
   CVD ≥12 · contraste ≥3:1) — NÃO alterar os tokens de série/status/sequencial.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Marca */
  --racing:        #1a44c2;   /* Yamaha Racing Blue */
  --racing-deep:   #0a1b4d;
  --racing-bright: #2b54de;
  --racing-glow:   rgba(26, 68, 194, .32);

  /* Superfícies (light) */
  --page:      #eef1fa;
  --surface:   #ffffff;
  --surface-2: #f4f6fd;
  --elevated:  #ffffff;
  --glass:       rgba(255, 255, 255, .68);
  --glass-hard:  rgba(255, 255, 255, .86);
  --glass-line:  rgba(255, 255, 255, .55);

  /* Tinta */
  --ink:      #0d1330;
  --ink-2:    #4a516b;
  --muted:    #626a86;   /* AA: 5.35:1 sobre branco */
  --hair:     #e3e7f3;
  --hair-2:   #eef1f9;
  --baseline: #cbd2e6;

  /* Status (validado) */
  --st-vendida:    #1b9e57;
  --st-andamento:  #e0921f;
  --st-perdida:    #dd5245;
  --st-vendida-ink:#0f7a41;

  /* Categórica (light) — ordem fixa validada */
  --c1:#1a44c2; --c2:#0e9b8e; --c3:#e59a1f; --c4:#2f8f3e;
  --c5:#7a52e0; --c6:#dd5245; --c7:#d1638f; --c8:#e0722f;

  /* Sequencial azul (magnitude) */
  --seq-050:#eef4fe; --seq-100:#cde2fb; --seq-200:#9ec5f4; --seq-300:#6da7ec;
  --seq-400:#3987e5; --seq-500:#256abf; --seq-600:#184f95; --seq-700:#0d366b;

  /* Profundidade */
  --shadow-sm: 0 1px 2px rgba(10,27,77,.05), 0 2px 8px rgba(10,27,77,.05);
  --shadow-md: 0 2px 6px rgba(10,27,77,.06), 0 10px 28px rgba(10,27,77,.10);
  --shadow-lg: 0 24px 64px rgba(10,27,77,.22), 0 6px 18px rgba(10,27,77,.10);
  --shadow-glow: 0 4px 20px var(--racing-glow);

  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --gap: 14px;
  --appbar-h: 62px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;

  /* Movimento */
  --spring: cubic-bezier(.32, .72, .25, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

:root[data-theme="dark"] {
  --page:      #070b20;
  --surface:   #141a3d;
  --surface-2: #101534;
  --elevated:  #1a224b;
  --glass:       rgba(16, 21, 52, .66);
  --glass-hard:  rgba(16, 21, 52, .88);
  --glass-line:  rgba(255, 255, 255, .08);

  --ink:      #f2f5ff;
  --ink-2:    #b9c1e0;
  --muted:    #8590b5;
  --hair:     #262e56;
  --hair-2:   #1d2547;
  --baseline: #313a63;

  --racing:        #3f68e8;
  --racing-bright: #5479f0;
  --racing-glow:   rgba(63, 104, 232, .4);

  --st-vendida:    #3fca86;
  --st-andamento:  #f0b64a;
  --st-perdida:    #f0796d;
  --st-vendida-ink:#3fca86;

  --c1:#3f68e8; --c2:#0fa08d; --c3:#bd8410; --c4:#2f9a43;
  --c5:#8c72e8; --c6:#e0574a; --c7:#d56b98; --c8:#d56d31;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.45);
  --shadow-md: 0 8px 24px rgba(0,0,0,.5);
  --shadow-lg: 0 28px 72px rgba(0,0,0,.65);
}

/* ░░ Base ░░ */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--racing); outline-offset: 2px; border-radius: 6px; }
[role="button"] { cursor: pointer; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: 44px;
  transition: background .35s, color .35s;
}
/* Fundo "mesh" sutil — profundidade sem ruído */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(52rem 32rem at 8% -6%, color-mix(in srgb, var(--racing) 9%, transparent), transparent 62%),
    radial-gradient(40rem 30rem at 104% 12%, color-mix(in srgb, var(--c5) 7%, transparent), transparent 60%),
    radial-gradient(44rem 36rem at 50% 118%, color-mix(in srgb, var(--c2) 6%, transparent), transparent 62%);
}
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
select, input, textarea { font-family: inherit; }

/* ░░ App bar ░░ */
.appbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--appbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 max(14px, env(safe-area-inset-left));
  background: linear-gradient(100deg, var(--racing-deep), var(--racing) 62%, var(--racing-bright));
  color: #fff;
  box-shadow: var(--shadow-md);
}
.appbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
}
.appbar__brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo { display: grid; place-items: center; filter: drop-shadow(0 3px 6px rgba(0,0,0,.35)); }
.appbar__titles h1 { font-size: 1.14rem; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.appbar__titles p { font-size: .66rem; opacity: .85; font-weight: 600; margin-top: 3px; letter-spacing: .09em; text-transform: uppercase; white-space: nowrap; }
.appbar__actions { display: flex; align-items: center; gap: 8px; }

.freshness {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  color: #fff; padding: 7px 12px; border-radius: 999px; font-size: .74rem; font-weight: 650;
  backdrop-filter: blur(8px) saturate(160%); -webkit-backdrop-filter: blur(8px) saturate(160%);
  transition: background .2s;
}
.freshness:hover { background: rgba(255,255,255,.22); }
.freshness__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--st-andamento); box-shadow: 0 0 0 3px rgba(255,255,255,.16); }
.freshness__dot.is-fresh { background: #37e29b; box-shadow: 0 0 0 3px rgba(55,226,155,.25), 0 0 10px rgba(55,226,155,.8); }
.freshness__dot.is-stale { background: #ffcf4a; }
.freshness__dot.is-error { background: #ff6b6b; }
.freshness__dot.is-syncing { background: #9ec5f4; animation: pulse 1.1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.freshness__txt { white-space: nowrap; }

.iconbtn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 12px; border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.12); color: #fff;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background .2s, transform .15s var(--spring);
}
.iconbtn:hover { background: rgba(255,255,255,.25); }
.iconbtn:active { transform: scale(.92); }
.iconbtn svg path { stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
#syncBtn svg path { fill: currentColor; stroke: none; }
.iconbtn.is-spinning svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Botão IA — destaque premium */
.aibtn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.35);
  background: linear-gradient(120deg, rgba(255,255,255,.28), rgba(255,255,255,.12));
  color: #fff; font-weight: 750; font-size: .78rem; letter-spacing: .01em;
  backdrop-filter: blur(10px) saturate(170%); -webkit-backdrop-filter: blur(10px) saturate(170%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 3px 12px rgba(0,0,0,.18);
  transition: transform .18s var(--spring), box-shadow .2s, background .2s;
}
.aibtn:hover { transform: translateY(-1px); background: linear-gradient(120deg, rgba(255,255,255,.36), rgba(255,255,255,.18)); }
.aibtn:active { transform: scale(.96); }
.aibtn .spark { font-size: .9rem; }
@media (max-width: 560px) {
  .aibtn span.label { display: none; }
  .aibtn { padding: 8px 11px; }
  .freshness__txt { display: none; }          /* só o ponto de status no mobile */
  .freshness { padding: 7px 9px; }
  .appbar__titles p { display: none; }
  .appbar__titles h1 { font-size: 1rem; white-space: nowrap; }
  /* Cards de métricas: ícone menor e texto que quebra em vez de estourar
     (especificidade extra para vencer as regras-base declaradas depois) */
  .ministats .ministat { padding: 11px 12px; gap: 9px; align-items: flex-start; }
  .ministats .ministat__ico { width: 30px; height: 30px; border-radius: 9px; font-size: .9rem; }
  .ministats .ministat__txt { flex: 1; min-width: 0; }
  .ministats .ministat__label { white-space: normal; line-height: 1.25; overflow: visible; text-overflow: clip; }
  .ministats .ministat__value { font-size: .95rem; white-space: normal; line-height: 1.2; overflow-wrap: break-word; }
  .ministats .ministat__sub { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; }
}

/* ░░ Barra de filtros (glass sticky) ░░ */
.filters {
  position: sticky; top: var(--appbar-h); z-index: 30;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(180%); -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--hair);
  padding: 10px 14px 8px;
}
.filters__row { display: flex; gap: 8px; }
.filters__periods { overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.filters__periods::-webkit-scrollbar { display: none; }
.preset {
  flex: 0 0 auto; padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--hair); background: var(--surface); color: var(--ink-2);
  font-size: .8rem; font-weight: 650; white-space: nowrap;
  transition: all .2s var(--spring);
}
.preset:hover { border-color: var(--racing); color: var(--racing); transform: translateY(-1px); }
.preset:active { transform: scale(.95); }
.preset.is-active {
  background: var(--racing); color: #fff; border-color: var(--racing);
  box-shadow: var(--shadow-glow);
}
.preset .cloud { opacity: .7; margin-left: 4px; }

.filters__dims { flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 2px; }
.field { display: flex; flex-direction: column; gap: 3px; flex: 1 1 132px; min-width: 0; }
.field > span { font-size: .62rem; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding-left: 3px; }
.field select, .field input {
  padding: 8px 11px; border-radius: var(--radius-xs); border: 1px solid var(--hair);
  background: var(--surface); color: var(--ink); font-size: .82rem; font-weight: 500;
  min-width: 0; width: 100%; transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.field input { background-image: none; }
.field select:focus, .field input:focus { outline: none; border-color: var(--racing); box-shadow: 0 0 0 3px color-mix(in srgb, var(--racing) 18%, transparent); }
.filters__range { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.crumb { font-size: .73rem; color: var(--muted); margin-top: 7px; font-weight: 600; }
.crumb b { color: var(--racing); }

.btn {
  padding: 8px 15px; border-radius: var(--radius-xs); border: 1px solid var(--racing);
  background: var(--racing); color: #fff; font-weight: 700; font-size: .8rem;
  transition: filter .15s, transform .15s var(--spring);
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(.96); }
.btn--ghost { background: transparent; color: var(--ink-2); border-color: var(--hair); }
.btn--ghost:hover { border-color: var(--racing); color: var(--racing); filter: none; }

/* ░░ Abas (segmented glass) ░░ */
.tabs {
  display: flex; gap: 5px; overflow-x: auto; padding: 12px 14px 2px;
  scrollbar-width: none; max-width: 1360px; margin: 0 auto;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 15px; border: 1px solid transparent; background: none;
  color: var(--ink-2); font-weight: 700; font-size: .84rem; border-radius: 999px;
  white-space: nowrap; transition: all .22s var(--spring);
}
.tab .tab__ico { font-size: .92rem; line-height: 1; }
.tab:hover { color: var(--racing); background: color-mix(in srgb, var(--racing) 7%, transparent); }
.tab:active { transform: scale(.95); }
.tab.is-active {
  color: var(--racing); background: var(--surface); border-color: var(--hair);
  box-shadow: var(--shadow-sm);
}

/* ░░ Banner ░░ */
.banner {
  margin: 12px auto 0; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--glass-hard); border: 1px solid var(--hair);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 9px;
  max-width: calc(1360px - 28px); margin-left: 14px; margin-right: 14px;
}
@media (min-width: 1388px) { .banner { margin-left: auto; margin-right: auto; } }
.banner.is-error { border-color: var(--st-perdida); background: color-mix(in srgb, var(--st-perdida) 8%, var(--surface)); }
.banner__body { display: flex; align-items: center; gap: 11px; }
.banner__spinner {
  width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto;
  border: 2.5px solid var(--hair); border-top-color: var(--racing); animation: spin .8s linear infinite;
}
.banner__text { font-size: .84rem; font-weight: 600; color: var(--ink); }
.banner__bar { height: 5px; background: var(--hair-2); border-radius: 4px; overflow: hidden; }
.banner__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--racing), var(--racing-bright)); border-radius: 4px; transition: width .4s var(--ease-out); }
.banner__cancel { align-self: flex-start; }

/* ░░ Conteúdo / grid ░░ */
.content { padding: 14px; display: flex; flex-direction: column; gap: var(--gap); max-width: 1360px; margin: 0 auto; }
.grid { display: grid; gap: var(--gap); }
.card {
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px; min-width: 0;
  position: relative;
  transition: box-shadow .25s, transform .25s var(--spring);
}
.card--pad0 { padding: 0; overflow: hidden; }
.card--hero { background: linear-gradient(140deg, color-mix(in srgb, var(--racing) 5%, var(--surface)), var(--surface) 55%); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.card__title { font-size: .98rem; font-weight: 800; letter-spacing: -.014em; }
.card__sub { font-size: .74rem; color: var(--muted); font-weight: 500; margin-top: 2px; }
.card__note { font-size: .72rem; color: var(--muted); margin-top: 9px; line-height: 1.45; }
.chart-box { position: relative; width: 100%; }
.linkbtn { background: none; border: none; color: var(--racing); font-weight: 700; font-size: .76rem; padding: 4px 6px; border-radius: 7px; transition: background .15s; }
.linkbtn:hover { background: color-mix(in srgb, var(--racing) 9%, transparent); }

/* Entrada em cascata dos blocos */
.content > * { animation: rise .5s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.99); } }

/* ░░ KPIs hero ░░ */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.kpi {
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; cursor: pointer;
  transition: transform .25s var(--spring), box-shadow .25s;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi:active { transform: scale(.98); }
.kpi::before { content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background: var(--racing); border-radius: 4px 0 0 4px; }
.kpi::after { content:""; position:absolute; right:-30%; top:-65%; width:80%; height:120%; border-radius:50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--racing) 6%, transparent), transparent); pointer-events:none; }
.kpi[data-status="vendida"]::before { background: var(--st-vendida); }
.kpi[data-status="andamento"]::before { background: var(--st-andamento); }
.kpi[data-status="perdida"]::before { background: var(--st-perdida); }
.kpi[data-status="valor"]::before { background: var(--c5); }
.kpi[data-status="alerta"]::before { background: var(--st-perdida); }
.kpi__label { font-size: .7rem; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; gap: 5px; }
.kpi__value { font-size: 1.72rem; font-weight: 800; letter-spacing: -.04em; margin-top: 6px; line-height: 1.02; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kpi__value small { font-size: .9rem; font-weight: 700; color: var(--muted); }
.kpi__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 6px; min-height: 26px; }
.kpi__spark { height: 26px; flex: 1; min-width: 0; }
.delta { font-size: .72rem; font-weight: 800; padding: 2.5px 8px; border-radius: 999px; white-space: nowrap; display:inline-flex; align-items:center; gap:3px; }
.delta--up { color: var(--st-vendida-ink); background: color-mix(in srgb, var(--st-vendida) 15%, transparent); }
.delta--down { color: var(--st-perdida); background: color-mix(in srgb, var(--st-perdida) 15%, transparent); }
.delta--flat { color: var(--muted); background: var(--hair-2); }

/* Mini-stats (linha secundária) */
.ministats { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.ministat {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius);
  padding: 13px 15px; box-shadow: var(--shadow-sm); min-width: 0;
  transition: transform .25s var(--spring), box-shadow .25s;
}
.ministat[data-drill] { cursor: pointer; }
.ministat[data-drill]:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.ministat__ico {
  width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center;
  font-size: 1.15rem; flex: 0 0 auto;
  background: color-mix(in srgb, var(--racing) 10%, transparent);
}
.ministat--warn .ministat__ico { background: color-mix(in srgb, var(--st-perdida) 12%, transparent); }
.ministat--ok .ministat__ico { background: color-mix(in srgb, var(--st-vendida) 12%, transparent); }
.ministat__txt { min-width: 0; }
.ministat__label { font-size: .68rem; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ministat__value { font-size: 1.18rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.ministat__sub { font-size: .68rem; color: var(--muted); font-weight: 600; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ░░ Insights ░░ */
.insight-strip { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
.insight {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform .25s var(--spring), box-shadow .25s;
}
.insight:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.insight::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c1); }
.insight--positivo::before { background: var(--st-vendida); }
.insight--atencao::before  { background: var(--st-andamento); }
.insight--critico::before  { background: var(--st-perdida); }
.insight--info::before     { background: var(--c1); }
.insight__ico { font-size: 1.3rem; line-height: 1.2; flex: 0 0 auto; }
.insight__title { font-weight: 800; font-size: .9rem; letter-spacing: -.01em; }
.insight__body { font-size: .8rem; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }
.insight__actions { margin-top: 8px; display: flex; gap: 8px; }
.insight__kind {
  margin-left: auto; flex: 0 0 auto; font-size: .62rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; padding: 3px 8px; border-radius: 999px;
}
.insight--positivo .insight__kind { color: var(--st-vendida-ink); background: color-mix(in srgb, var(--st-vendida) 13%, transparent); }
.insight--atencao .insight__kind  { color: #9a6208; background: color-mix(in srgb, var(--st-andamento) 16%, transparent); }
.insight--critico .insight__kind  { color: var(--st-perdida); background: color-mix(in srgb, var(--st-perdida) 13%, transparent); }
.insight--info .insight__kind     { color: var(--racing); background: color-mix(in srgb, var(--racing) 10%, transparent); }
:root[data-theme="dark"] .insight--atencao .insight__kind { color: var(--st-andamento); }

/* Briefing IA */
.briefing { position: relative; }
.briefing__body { font-size: .84rem; line-height: 1.6; color: var(--ink-2); }
.briefing__body h3 { font-size: .86rem; color: var(--ink); margin: 12px 0 4px; }
.briefing__body strong { color: var(--ink); }
.briefing__body ul { margin: 6px 0; padding-left: 20px; }
.briefing__body li { margin: 3px 0; }
.ai-provider { font-size: .66rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }

/* ░░ Status pill ░░ */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill::before { content:""; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.pill--vendida { color: var(--st-vendida-ink); background: color-mix(in srgb, var(--st-vendida) 14%, transparent); }
.pill--vendida::before { background: var(--st-vendida); }
.pill--andamento { color: #9a6208; background: color-mix(in srgb, var(--st-andamento) 18%, transparent); }
.pill--andamento::before { background: var(--st-andamento); }
.pill--perdida { color: var(--st-perdida); background: color-mix(in srgb, var(--st-perdida) 14%, transparent); }
.pill--perdida::before { background: var(--st-perdida); }
:root[data-theme="dark"] .pill--andamento { color: var(--st-andamento); }
.chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: .68rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--hair);
}

/* ░░ Tabelas ░░ */
.tbl { width: 100%; border-collapse: collapse; font-size: .82rem; }
.tbl th { text-align: left; font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 750; padding: 10px; border-bottom: 1px solid var(--hair); background: var(--surface); cursor: pointer; user-select: none; white-space: nowrap; position: relative; transition: color .15s; }
.tbl th:hover { color: var(--racing); }
.tbl th::after { content: "⇅"; opacity: .35; margin-left: 5px; font-size: .8em; }
.tbl th.th-sort-asc::after { content: "▲"; opacity: 1; color: var(--racing); }
.tbl th.th-sort-desc::after { content: "▼"; opacity: 1; color: var(--racing); }
/* Cabeçalho fixo SÓ dentro de contêiner com scroll próprio (senão esconde atrás do appbar) */
.tbl__scroll--capped { max-height: 64vh; overflow-y: auto; }
.tbl__scroll--capped th { position: sticky; top: 0; z-index: 1; }
.tbl th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--hair-2); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr[data-drill] { cursor: pointer; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.barcell { position: relative; }
.barcell__bar { position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 62%; background: color-mix(in srgb, var(--racing) 15%, transparent); border-radius: 5px; z-index: 0; transition: width .6s var(--ease-out); }
.barcell__val { position: relative; z-index: 1; font-variant-numeric: tabular-nums; font-weight: 700; padding-left: 6px; }
.convbadge { font-variant-numeric: tabular-nums; font-weight: 700; }
.rank-n { display:inline-grid; place-items:center; width: 23px; height: 23px; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-weight: 800; font-size: .72rem; margin-right: 8px; }
.rank-1 .rank-n { background: var(--racing); color: #fff; box-shadow: var(--shadow-glow); }
.rank-2 .rank-n { background: var(--seq-300); color: #fff; }
.rank-3 .rank-n { background: var(--seq-200); color: var(--racing-deep); }

/* ░░ Heatmaps ░░ */
.heat { display: grid; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat__row { display: grid; gap: 3px; align-items: center; }
.heat__label { font-size: .72rem; font-weight: 650; white-space: nowrap; padding-right: 8px; text-align: right; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.heat__cell { height: 38px; min-width: 24px; border-radius: 7px; display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: #fff; transition: transform .12s var(--spring); }
.heat__cell:hover { transform: scale(1.12); z-index: 2; }
.heat__colhead { font-size: .6rem; color: var(--muted); text-align: center; font-weight: 750; }
.heat--hour .heat__cell { height: 26px; min-width: 18px; border-radius: 5px; font-size: 0; }

/* ░░ Legenda ░░ */
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; }
.legend__item { display: flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; color: var(--ink-2); }
.legend__swatch { width: 11px; height: 11px; border-radius: 4px; flex: 0 0 auto; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--hair); border-radius: 12px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { border: none; background: none; padding: 6px 13px; border-radius: 9px; font-weight: 700; font-size: .78rem; color: var(--ink-2); transition: all .2s var(--spring); }
.seg button:active { transform: scale(.95); }
.seg button.is-active { background: var(--surface); color: var(--racing); box-shadow: var(--shadow-sm); }

.empty { text-align: center; padding: 42px 16px; color: var(--muted); }
.empty h3 { font-size: 1rem; margin-bottom: 6px; color: var(--ink-2); }

.note-inline { font-size: .72rem; color: var(--muted); font-weight: 600; }
.tag-herdada { font-size: .6rem; font-weight: 800; text-transform: uppercase; color: #9a6208; background: color-mix(in srgb, var(--c3) 16%, transparent); padding: 1px 5px; border-radius: 5px; margin-left: 5px; letter-spacing: .03em; }
:root[data-theme="dark"] .tag-herdada { color: var(--c3); }

/* ░░ Drawer de negociações ░░ */
.drawer-overlay { position: fixed; inset: 0; background: rgba(7,11,32,.45); z-index: 50; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .25s var(--ease-out); }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; z-index: 51; background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  right: 0; top: 0; bottom: 0; width: min(580px, 96vw);
  border-left: 1px solid var(--hair);
  border-radius: 22px 0 0 22px;
  animation: slideIn .34s var(--spring);
}
@keyframes slideIn { from { transform: translateX(60px); opacity: 0; } }
.drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid var(--hair); }
.drawer__head h2 { font-size: 1.06rem; font-weight: 800; letter-spacing: -.015em; }
.drawer__sub { font-size: .76rem; color: var(--muted); margin-top: 3px; }
.drawer__headactions { display: flex; gap: 6px; align-items: center; }
.drawer .iconbtn { color: var(--ink-2); background: var(--surface-2); border-color: var(--hair); width: 34px; height: 34px; backdrop-filter: none; }
.drawer__body { flex: 1; overflow-y: auto; padding: 6px 0; overscroll-behavior: contain; }
.drawer__foot { padding: 12px 18px; border-top: 1px solid var(--hair); font-size: .82rem; font-weight: 700; display: flex; justify-content: space-between; gap: 10px; background: var(--surface-2); border-radius: 0 0 0 22px; flex-wrap: wrap; }
.deal-row { padding: 13px 18px; border-bottom: 1px solid var(--hair-2); display: grid; gap: 6px; animation: rise .4s var(--ease-out) both; }
.deal-row__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.deal-row__name { font-weight: 700; font-size: .86rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-row__meta { font-size: .73rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.deal-row__amount { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.deal-row a { color: var(--racing); text-decoration: none; font-weight: 700; font-size: .74rem; }

/* ░░ Painel do Analista IA ░░ */
.ai-panel {
  position: fixed; z-index: 61; right: 0; top: 0; bottom: 0;
  width: min(480px, 96vw);
  background: var(--surface);
  border-left: 1px solid var(--hair); border-radius: 22px 0 0 22px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: slideIn .34s var(--spring);
}
.ai-panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--hair);
  background: linear-gradient(120deg, color-mix(in srgb, var(--racing) 8%, var(--surface)), var(--surface));
  border-radius: 22px 0 0 0;
}
.ai-panel__title { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: .98rem; }
.ai-panel__title .orb {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .9rem;
  background: radial-gradient(circle at 30% 30%, var(--racing-bright), var(--racing-deep));
  color: #fff; box-shadow: var(--shadow-glow);
}
.ai-panel__sub { font-size: .68rem; color: var(--muted); font-weight: 600; margin-top: 2px; }
.ai-chat { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.ai-msg { max-width: 88%; padding: 11px 14px; border-radius: 18px; font-size: .84rem; line-height: 1.55; animation: rise .3s var(--ease-out) both; overflow-wrap: break-word; }
.ai-msg--user { align-self: flex-end; background: var(--racing); color: #fff; border-bottom-right-radius: 6px; font-weight: 550; }
.ai-msg--bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--hair); color: var(--ink); border-bottom-left-radius: 6px; }
.ai-msg--bot h3 { font-size: .84rem; margin: 8px 0 3px; }
.ai-msg--bot ul, .ai-msg--bot ol { margin: 5px 0; padding-left: 18px; }
.ai-msg--bot li { margin: 2px 0; }
.ai-msg--bot code { background: var(--hair-2); padding: 1px 5px; border-radius: 5px; font-size: .78rem; }
.ai-msg--err { border-color: var(--st-perdida); color: var(--st-perdida); }
.ai-cursor { display: inline-block; width: 8px; height: 15px; vertical-align: -2px; background: var(--racing); border-radius: 2px; animation: pulse .8s infinite; margin-left: 2px; }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 16px 10px; }
.ai-suggest button {
  border: 1px solid var(--hair); background: var(--surface-2); color: var(--ink-2);
  border-radius: 999px; padding: 6px 12px; font-size: .73rem; font-weight: 650;
  transition: all .2s var(--spring);
}
.ai-suggest button:hover { border-color: var(--racing); color: var(--racing); transform: translateY(-1px); }
.ai-form { display: flex; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--hair); }
.ai-form input {
  flex: 1; padding: 11px 14px; border-radius: 999px; border: 1px solid var(--hair);
  background: var(--surface-2); color: var(--ink); font-size: .84rem; min-width: 0;
}
.ai-form input:focus { outline: none; border-color: var(--racing); box-shadow: 0 0 0 3px color-mix(in srgb, var(--racing) 16%, transparent); }
.ai-form button {
  width: 42px; height: 42px; border-radius: 50%; border: none; flex: 0 0 auto;
  background: var(--racing); color: #fff; font-size: 1rem; display: grid; place-items: center;
  transition: transform .15s var(--spring), filter .15s; box-shadow: var(--shadow-glow);
}
.ai-form button:hover { filter: brightness(1.1); }
.ai-form button:active { transform: scale(.9); }
.ai-form button:disabled { opacity: .5; cursor: default; }

/* ░░ Command palette (⌘K) ░░ */
.cmdk-overlay { position: fixed; inset: 0; background: rgba(7,11,32,.4); z-index: 70; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .2s var(--ease-out); }
.cmdk {
  position: fixed; z-index: 71; left: 50%; top: 14vh; transform: translateX(-50%);
  width: min(560px, 92vw);
  background: var(--glass-hard); border: 1px solid var(--hair); border-radius: 18px;
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop .28s var(--spring);
}
@keyframes pop { from { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(.97); } }
.cmdk input {
  width: 100%; padding: 16px 18px; border: none; background: transparent; color: var(--ink);
  font-size: 1rem; border-bottom: 1px solid var(--hair);
}
.cmdk input:focus { outline: none; }
.cmdk__list { max-height: 46vh; overflow-y: auto; padding: 7px; }
.cmdk__item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px;
  font-size: .86rem; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.cmdk__item .ico { width: 26px; text-align: center; font-size: .95rem; }
.cmdk__item.is-sel { background: var(--racing); color: #fff; }
.cmdk__item .hint { margin-left: auto; font-size: .66rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.cmdk__item.is-sel .hint { color: rgba(255,255,255,.75); }
.cmdk__empty { padding: 22px; text-align: center; color: var(--muted); font-size: .84rem; }

/* ░░ Scatter tooltip custom ░░ */
.matrix-note { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }

/* ░░ Login ░░ */
.login {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 20px;
  background:
    radial-gradient(48rem 30rem at 12% -4%, color-mix(in srgb, var(--racing) 16%, transparent), transparent 62%),
    radial-gradient(40rem 30rem at 100% 20%, color-mix(in srgb, var(--c5) 10%, transparent), transparent 60%),
    var(--page);
}
.login__card {
  width: min(400px, 94vw);
  background: var(--glass-hard); border: 1px solid var(--hair); border-radius: 24px;
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-lg); padding: 34px 30px 24px;
  animation: pop2 .4s var(--spring);
}
@keyframes pop2 { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.login__brand { text-align: center; margin-bottom: 24px; }
.login__brand svg { filter: drop-shadow(0 6px 16px var(--racing-glow)); }
.login__brand h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; margin-top: 12px; }
.login__brand p { font-size: .68rem; color: var(--muted); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-top: 4px; }
.login__form { display: flex; flex-direction: column; gap: 13px; }
.login__form .field, .modal__form .field { flex: 0 0 auto; }   /* não herdar basis da barra de filtros */
.login__form input { padding: 11px 13px; font-size: .9rem; }
.login__btn { padding: 12px; font-size: .9rem; border-radius: 12px; margin-top: 4px; box-shadow: var(--shadow-glow); }
.login__error { font-size: .78rem; font-weight: 650; color: var(--st-perdida); background: color-mix(in srgb, var(--st-perdida) 10%, transparent); padding: 9px 12px; border-radius: 10px; }
.login__foot { text-align: center; font-size: .7rem; color: var(--muted); margin-top: 20px; }
.login__foot strong { color: var(--racing); }

/* ░░ Chip e menu do usuário ░░ */
.userwrap { position: relative; }
.userchip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22);
  color: #fff; padding: 5px 12px 5px 5px; border-radius: 999px; font-size: .76rem; font-weight: 700;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background .2s;
}
.userchip:hover { background: rgba(255,255,255,.22); }
.userchip__avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.9); color: var(--racing-deep); font-weight: 800; font-size: .68rem;
}
@media (max-width: 700px) { .userchip__name { display: none; } .userchip { padding: 5px; } }
.usermenu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 80; min-width: 230px;
  background: var(--glass-hard); border: 1px solid var(--hair); border-radius: 16px;
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-lg); padding: 7px; color: var(--ink);
  animation: pop2 .22s var(--spring);
}
.usermenu__info { padding: 10px 12px; border-bottom: 1px solid var(--hair); margin-bottom: 6px; }
.usermenu__fullname { font-weight: 800; font-size: .86rem; }
.usermenu__role { font-size: .7rem; color: var(--muted); font-weight: 650; margin-top: 3px; }
.usermenu__item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 10px 12px; border: none; background: none; border-radius: 10px;
  font-size: .84rem; font-weight: 650; color: var(--ink-2); text-align: left;
}
.usermenu__item:hover { background: color-mix(in srgb, var(--racing) 8%, transparent); color: var(--racing); }
.usermenu__item--danger:hover { background: color-mix(in srgb, var(--st-perdida) 10%, transparent); color: var(--st-perdida); }

/* ░░ Modais ░░ */
.modal {
  position: fixed; z-index: 71; left: 50%; top: 10vh; transform: translateX(-50%);
  width: min(440px, 94vw); max-height: 80vh; overflow-y: auto;
  background: var(--glass-hard); border: 1px solid var(--hair); border-radius: 20px;
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-lg); padding: 22px;
  animation: pop2 .28s var(--spring);
}
.modal--wide { width: min(760px, 96vw); }
.modal h2 { font-size: 1.08rem; font-weight: 800; letter-spacing: -.015em; }
.modal__sub { font-size: .76rem; color: var(--muted); margin: 4px 0 14px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.modal__form { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.modal .iconbtn.modal__close { color: var(--ink-2); background: var(--surface-2); border-color: var(--hair); backdrop-filter: none; }

/* Gestão de usuários */
.uform {
  background: var(--surface-2); border: 1px solid var(--hair); border-radius: var(--radius-sm);
  padding: 14px; display: grid; gap: 11px; margin-bottom: 14px;
  grid-template-columns: 1fr 1fr;
}
.uform .field--full { grid-column: 1 / -1; }
.uform__teams { display: flex; flex-wrap: wrap; gap: 6px; }
.uform__teams label {
  display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 650;
  border: 1px solid var(--hair); border-radius: 999px; padding: 5px 11px; cursor: pointer;
  background: var(--surface); color: var(--ink-2); transition: all .15s;
}
.uform__teams label:has(input:checked) { background: var(--racing); border-color: var(--racing); color: #fff; }
.uform__teams input { display: none; }
.uform__row { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.uswitch { display: inline-flex; align-items: center; gap: 7px; font-size: .78rem; font-weight: 650; color: var(--ink-2); cursor: pointer; }
.badge-role { font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 999px; }
.badge-role--super_admin { color: var(--racing); background: color-mix(in srgb, var(--racing) 12%, transparent); }
.badge-role--gestor { color: var(--c2); background: color-mix(in srgb, var(--c2) 12%, transparent); }
.uinactive { opacity: .5; }

/* Indicador "digitando" (resposta em processamento) */
.ai-typing { display: inline-flex; gap: 4px; align-items: center; padding: 3px 2px; }
.ai-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: tydot 1.2s infinite; }
.ai-typing span:nth-child(2) { animation-delay: .18s; }
.ai-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes tydot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* Badge de resposta nova no botão da IA */
.aibtn { position: relative; }
.aibtn.has-news::after {
  content: ""; position: absolute; top: -3px; right: -3px; width: 11px; height: 11px;
  border-radius: 50%; background: #37e29b; border: 2px solid var(--racing);
  animation: pulse 1.2s infinite;
}

/* Painel Sistema */
.sys-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .sys-grid { grid-template-columns: 1fr 1fr; } }
.sys-group { background: var(--surface-2); border: 1px solid var(--hair); border-radius: var(--radius-sm); padding: 13px 15px; }
.sys-group__title { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 9px; }
.sys-row { display: flex; justify-content: space-between; gap: 10px; font-size: .82rem; padding: 4px 0; border-bottom: 1px dashed var(--hair-2); }
.sys-row:last-child { border-bottom: none; }
.sys-row span { color: var(--ink-2); }
.sys-row b { font-variant-numeric: tabular-nums; text-align: right; }

/* Barra de progresso de carregamento (topo) */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100;
  background: linear-gradient(90deg, var(--racing), var(--racing-bright), var(--c2));
  transform: scaleX(0); transform-origin: left; opacity: 0;
  transition: transform .3s var(--ease-out), opacity .3s;
  box-shadow: 0 0 8px var(--racing-glow);
}
.topbar.is-loading { opacity: 1; transform: scaleX(0.7); transition: transform 8s cubic-bezier(.1,.7,.3,1); }
.topbar.is-done { opacity: 0; transform: scaleX(1); transition: transform .3s var(--ease-out), opacity .5s .2s; }

/* Fade suave do conteúdo ao trocar de aba */
.content.is-entering { animation: contentFade .4s var(--ease-out); }
@keyframes contentFade { from { opacity: 0; transform: translateY(6px); } }

/* Toast de erro (sentinela) */
.err-toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(80px);
  z-index: 120; max-width: min(560px, 92vw);
  background: var(--ink); color: var(--surface); font-size: .8rem; font-weight: 650;
  padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: all .35s var(--spring);
}
.err-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ░░ Footer ░░ */
.appfoot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 20px 16px; font-size: .74rem; color: var(--muted); max-width: 1360px; margin: 0 auto; flex-wrap: wrap; }
.appfoot__by strong { color: var(--racing); }
kbd { font-family: inherit; font-size: .66rem; font-weight: 800; border: 1px solid var(--hair); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--surface-2); color: var(--ink-2); }

.skeleton { background: linear-gradient(90deg, var(--hair-2) 25%, var(--surface-2) 37%, var(--hair-2) 63%); background-size: 400% 100%; animation: sk 1.4s infinite; border-radius: 10px; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.is-refreshing { opacity: .55; transition: opacity .2s; }

/* ░░ Navegação lateral (desktop) ░░ */
.sidenav {
  display: none; position: fixed; left: 0; top: var(--appbar-h); bottom: 0; z-index: 35;
  flex-direction: column; gap: 3px; width: 224px;
  padding: 16px 12px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(180%); -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-right: 1px solid var(--hair);
  overflow-y: auto;
}
.snav__item {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border: 1px solid transparent; background: none;
  border-radius: 12px; color: var(--ink-2); font-weight: 700; font-size: .86rem;
  text-align: left; transition: all .2s var(--spring);
}
.snav__item .snav__ico { font-size: 1.05rem; width: 22px; text-align: center; }
.snav__item:hover { color: var(--racing); background: color-mix(in srgb, var(--racing) 7%, transparent); }
.snav__item:active { transform: scale(.97); }
.snav__item.is-active {
  color: var(--racing); background: var(--surface); border-color: var(--hair);
  box-shadow: var(--shadow-sm);
}
.snav__item.is-active::before {
  content: ""; position: absolute; left: -12px; top: 22%; bottom: 22%; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--racing);
}

/* ░░ Botão "Explique para mim" ░░ */
.explain-btn {
  display: inline-grid; place-items: center; width: 20px; height: 20px;
  margin-left: 6px; vertical-align: middle; flex: 0 0 auto;
  border-radius: 50%; border: 1px solid var(--hair); background: var(--surface-2);
  color: var(--muted); font-size: .68rem; font-weight: 800; line-height: 1;
  transition: all .18s var(--spring);
}
.explain-btn:hover { color: #fff; background: var(--racing); border-color: var(--racing); transform: scale(1.12); }

/* Disclaimer da IA */
.ai-disclaimer {
  padding: 0 16px calc(12px + env(safe-area-inset-bottom));
  font-size: .68rem; color: var(--muted); text-align: center;
}
@media (max-width: 700px) { .ai-form { padding-bottom: 10px; } }

/* Linha total do panorama */
.mx-total td { background: var(--surface-2); font-weight: 800; }

/* ░░ Navegação inferior (app mobile 2026) ░░ */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: none;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  background: var(--glass-hard);
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid var(--hair);
  justify-content: space-around; align-items: stretch; gap: 4px;
}
.bnav__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 52px; padding: 6px 2px; border: none; background: none; border-radius: 14px;
  color: var(--muted); font-size: .62rem; font-weight: 750;
  transition: all .2s var(--spring);
}
.bnav__item:active { transform: scale(.92); }
.bnav__item .bnav__ico { font-size: 1.25rem; line-height: 1.2; }
.bnav__item.is-active { color: var(--racing); background: color-mix(in srgb, var(--racing) 9%, transparent); }
.bnav__orb {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1rem; color: #fff; margin-top: -14px;
  background: radial-gradient(circle at 30% 30%, var(--racing-bright), var(--racing-deep));
  box-shadow: var(--shadow-glow); border: 3px solid var(--surface);
}
.bnav__item--ai { color: var(--racing); }
.bnav__item--ai.has-news .bnav__orb::after {
  content: ""; position: absolute; margin: -22px 0 0 22px; width: 10px; height: 10px;
  border-radius: 50%; background: #37e29b; border: 2px solid var(--surface);
}

/* ░░ Sheet (mobile) ░░ */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 72;
  background: var(--glass-hard); border-top: 1px solid var(--hair);
  border-radius: 24px 24px 0 0;
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-lg);
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  animation: sheetUp .32s var(--spring);
}
@keyframes sheetUp { from { transform: translateY(40%); opacity: 0; } }
.sheet__grabber { width: 42px; height: 5px; border-radius: 3px; background: var(--baseline); margin: 2px auto 14px; }
.sheet__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sheet__item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 6px; border: 1px solid var(--hair); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-2); font-size: .72rem; font-weight: 700;
  transition: all .2s var(--spring);
}
.sheet__item:active { transform: scale(.94); }
.sheet__item.is-active { border-color: var(--racing); color: var(--racing); background: color-mix(in srgb, var(--racing) 7%, var(--surface)); }
.sheet__item .ico { font-size: 1.4rem; }

/* Botão "Filtros" (mobile) */
.filters__toggle {
  display: none; align-items: center; gap: 6px; width: 100%;
  padding: 10px 14px; margin-top: 2px; border-radius: var(--radius-xs);
  border: 1px solid var(--hair); background: var(--surface); color: var(--ink-2);
  font-size: .8rem; font-weight: 700;
}
.filters__count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--racing); color: #fff; font-size: .68rem; font-weight: 800;
}
.lognum { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .74rem; }

/* ░░ Responsivo ░░ */
@media (min-width: 640px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .ministats { grid-template-columns: repeat(4, 1fr); }
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .insight-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 980px) {
  :root { --gap: 16px; }
  .content { padding: 22px; }
  .kpis { grid-template-columns: repeat(6, 1fr); }
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--wide-narrow { grid-template-columns: 1.7fr 1fr; }
  .span-2 { grid-column: span 2; }
  .appbar__titles p { font-size: .7rem; }
  /* Sidebar assume a navegação; pílulas somem; conteúdo desloca à direita */
  .tabs { display: none; }
  .sidenav { display: flex; }
  .filters, .banner, .content, .appfoot { margin-left: 224px; }
  .content, .appfoot { max-width: none; padding-right: 26px; }
}
@media (max-width: 979px) { .span-2 { grid-column: auto; } }

/* ░░ Modo app (smartphone) ░░ */
@media (max-width: 700px) {
  .tabs { display: none; }                       /* navegação vai para baixo */
  .bottomnav { display: flex; }
  /* Header robusto: só marca + IA + status + avatar (o resto vive no "Mais") */
  #cmdkBtn, #syncBtn, #themeBtn { display: none; }
  .appbar { gap: 6px; padding: 0 10px; }
  .appbar__brand { min-width: 0; flex: 1 1 auto; overflow: hidden; }
  .appbar__titles { min-width: 0; overflow: hidden; }
  .appbar__titles h1 { overflow: hidden; text-overflow: ellipsis; }
  .appbar__actions { flex: 0 0 auto; gap: 6px; }
  /* Painel IA: cabeçalho respeita o notch e o fechar é alvo de toque grande */
  .ai-panel__head { padding-top: calc(16px + env(safe-area-inset-top)); }
  .ai-panel .iconbtn { width: 44px; height: 44px; font-size: 1.1rem; }
  .ai-panel__close { background: var(--surface-2) !important; border: 1px solid var(--hair) !important; color: var(--ink) !important; }
  .drawer__head { padding-top: calc(16px + env(safe-area-inset-top)); }
  .drawer .iconbtn { width: 44px; height: 44px; }
  /* Inputs com >=16px NÃO disparam o zoom automático do iOS ao focar */
  input, select, textarea, .field select, .field input, .ai-form input,
  .login__form input, .modal__form input, #cmdkInput { font-size: 16px !important; }
  /* Painel IA/drawer acompanham a altura VISÍVEL (some o teclado → botão enviar
     fica sempre visível). --vvh é atualizado por JS via visualViewport. */
  .ai-panel.vv-fit, .drawer.vv-fit { height: var(--vvh, 100dvh); bottom: auto; }
  body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .err-toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
  /* Filtros recolhidos atrás do botão "Filtros" */
  .filters__toggle { display: flex; }
  .filters__dims, .filters__range, .crumb { display: none; }
  .filters.is-open .filters__dims { display: flex; }
  .filters.is-open .filters__range:not([hidden]) { display: flex; }
  .filters.is-open .crumb { display: block; }
  .filters { padding-bottom: 10px; }
  .field { flex: 1 1 46%; }
  /* Painel/drawer ocupam a tela toda, sem raio */
  .drawer, .ai-panel { width: 100vw; border-radius: 0; }
  .drawer__foot { border-radius: 0; }
  .ai-chat { padding-bottom: 4px; }
  .ai-form { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .appfoot { flex-direction: column; align-items: center; gap: 4px; text-align: center; }
}
@media (max-width: 639px) {
  .kpi__value { font-size: 1.5rem; }
  /* Modais em tela cheia (padrão de app) */
  .modal, .modal--wide {
    inset: 0; top: 0; left: 0; transform: none;
    width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }
  .cmdk { top: 8vh; }
  .insight-strip { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
