:root{
  --bg:#060815;
  --bg-panel:#0e1226;
  --bg-panel-2:#131834;
  --border:#212852;
  --text:#eef1fb;
  --text-dim:#828ab3;
  --accent:#2f6fed;
  --accent-2:#ffb020;
  --accent-3:#00d4a0;
  --accent-4:#5b93ff;
  --accent-cyan:#22d3ee;
  --danger:#ff4d4d;
  --gold:#ffd54a;
  --silver:#c9d2e0;
  --bronze:#d68a4a;
  --radius:14px;
  --shadow:0 8px 24px rgba(0,0,0,.45);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:
    radial-gradient(circle at 12% -10%, rgba(47,111,237,.22), transparent 42%),
    radial-gradient(circle at 92% 6%, rgba(0,212,160,.10), transparent 45%),
    repeating-linear-gradient(115deg, rgba(255,255,255,.025) 0 2px, transparent 2px 90px),
    var(--bg);
  color:var(--text);
  font-family:'Segoe UI',system-ui,-apple-system,Roboto,Arial,sans-serif;
  line-height:1.4;
  min-height:100vh;
}
a{color:inherit}
.wrap{max-width:1720px;margin:0 auto;padding:0 24px 60px}

/* ---- Faixa xadrez de corrida (topo da sidebar) ---- */
.checkered-strip{
  height:20px;width:100%;
  background:repeating-conic-gradient(#fff 0% 25%, transparent 0% 50%) 0 0 / 20px 20px;
  opacity:.92;
}

/* ---- Marca d'água: logo translúcida atrás do conteúdo de todas as views,
   no maior tamanho que couber, centralizada ---- */
body::after{
  content:'';position:fixed;inset:0;z-index:0;pointer-events:none;
  background:url('logo.png?v=19') center center / contain no-repeat;
  opacity:.05;
}

/* ---- Layout: sidebar + conteúdo ---- */
.app-layout{display:flex;min-height:100vh;position:relative;z-index:1}
.sidebar{
  width:250px;flex-shrink:0;background:var(--bg-panel);border-right:1px solid var(--border);
  display:flex;flex-direction:column;position:sticky;top:0;height:100vh;overflow-y:auto;
}
.sidebar .side-logo{
  display:flex;flex-direction:column;align-items:center;gap:0;padding:22px 18px 16px;
  border-bottom:1px solid var(--border);position:relative;
  text-decoration:none;color:inherit;cursor:pointer;transition:background .15s;
}
.sidebar .side-logo:hover{background:rgba(255,255,255,.04)}
.sidebar .side-logo img{width:100%;max-width:210px;height:auto}
.sidebar .side-logo span{display:none}
.sidebar nav{padding:14px 10px;display:flex;flex-direction:column;gap:3px;flex:1}
.sidebar nav a{
  display:flex;align-items:center;gap:12px;padding:11px 14px;border-radius:10px;
  color:var(--text-dim);text-decoration:none;font-size:14px;font-weight:600;
  transition:background .15s,color .15s;
}
.sidebar nav a .ic{font-size:17px;width:22px;text-align:center}
.sidebar nav a:hover{background:var(--bg-panel-2);color:var(--text)}
.sidebar nav a.active{background:linear-gradient(90deg, rgba(47,111,237,.22), rgba(47,111,237,.03));color:#fff;box-shadow:inset 3px 0 0 var(--accent)}
.sidebar .side-foot{padding:16px 18px;border-top:1px solid var(--border);font-size:11px;color:var(--text-dim)}

/* ---- Sidebar minimizada (só ícones) ---- */
.sidebar{transition:width .2s ease}
#sidebar-collapse{
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
  width:30px;height:30px;margin:12px 12px 0 auto;border-radius:8px;cursor:pointer;
  background:var(--bg-panel-2);border:1px solid var(--border);color:var(--text-dim);
}
#sidebar-collapse:hover{color:var(--text);border-color:var(--accent)}
#sidebar-collapse .icon{width:15px;height:15px;transform:rotate(180deg);transition:transform .2s}
.sidebar.collapsed{width:64px}
.sidebar.collapsed .side-logo,
.sidebar.collapsed .side-foot{display:none}
.sidebar.collapsed #sidebar-collapse{margin:12px auto 0}
.sidebar.collapsed #sidebar-collapse .icon{transform:rotate(0deg)}
.sidebar.collapsed nav{padding:14px 8px}
.sidebar.collapsed nav a{font-size:0;gap:0;justify-content:center;padding:12px 0}
.sidebar.collapsed nav a .ic{width:auto}
.sidebar.collapsed nav a.active{box-shadow:inset 2px 0 0 var(--accent)}

.content{flex:1;min-width:0}
#sidebar-toggle{display:none}

@media (max-width:880px){
  .sidebar{position:fixed;left:0;top:0;bottom:0;z-index:100;transform:translateX(-100%);transition:transform .2s;box-shadow:var(--shadow)}
  .sidebar.open{transform:translateX(0)}
  #sidebar-toggle{
    display:flex;align-items:center;justify-content:center;position:fixed;top:12px;left:12px;z-index:101;
    width:42px;height:42px;gap:0;font-size:0;
    background:var(--bg-panel);border:1px solid var(--border);border-radius:10px;
    color:var(--text);cursor:pointer;box-shadow:var(--shadow);
  }
  #sidebar-toggle .icon{width:18px;height:18px}
  /* conteúdo começa ABAIXO do botão fixo — sem sobreposição em nenhuma página */
  .content header.top{padding-top:64px}
  /* páginas sem header (ex.: /sobre): mesmo respiro no topo */
  #view-mount > .wrap:first-child{padding-top:64px}
}

/* ---- Header ---- */
header.top{
  padding:28px 20px 22px;
  display:flex;align-items:center;justify-content:space-between;
  border-bottom:1px solid var(--border);
  background:linear-gradient(180deg, rgba(47,111,237,.10), transparent);
}
header.top .brand{display:flex;align-items:center;gap:16px}
header.top .logo-img{height:46px;width:auto;display:block;border-radius:6px}
header.top h1{font-size:22px;margin:0;letter-spacing:.3px}
header.top p{margin:2px 0 0;color:var(--text-dim);font-size:13px}
header.top .badge{
  font-size:11px;color:var(--text-dim);border:1px solid var(--border);
  padding:6px 12px;border-radius:20px;background:var(--bg-panel);
}

/* ---- KPI cards ---- */
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:14px;margin:26px 0}
.kpi{
  background:linear-gradient(145deg,var(--bg-panel),var(--bg-panel-2));
  border:1px solid var(--border);border-radius:var(--radius);
  padding:18px 20px;box-shadow:var(--shadow);position:relative;overflow:hidden;
}
.kpi .v{font-size:30px;font-weight:800;letter-spacing:-.5px}
.kpi .l{font-size:12.5px;color:var(--text-dim);margin-top:4px;text-transform:uppercase;letter-spacing:.5px}

/* ---- Section ---- */
section{margin-top:44px}
section .sec-head{display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:10px;margin-bottom:16px}
section h2{font-size:19px;margin:0;display:flex;align-items:center;gap:8px}
section h2 .dot{
  width:15px;height:15px;flex-shrink:0;display:inline-block;border-radius:2px;
  background:repeating-conic-gradient(#fff 0% 25%, #000 0% 50%) 0 0 / 7.5px 7.5px;
  box-shadow:0 0 0 1px var(--border);
}
section .sub{color:var(--text-dim);font-size:13px;margin:2px 0 0}

.panel{
  background:var(--bg-panel);border:1px solid var(--border);border-radius:var(--radius);
  padding:20px;box-shadow:var(--shadow);
}

/* ---- Controls ---- */
.controls{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
select,input[type=text]{
  background:var(--bg-panel-2);color:var(--text);border:1px solid var(--border);
  border-radius:8px;padding:9px 12px;font-size:13.5px;outline:none;
}
select:focus,input:focus{border-color:var(--accent)}
.pill-toggle{display:flex;background:var(--bg-panel-2);border:1px solid var(--border);border-radius:8px;overflow:hidden}
.pill-toggle button{
  background:transparent;border:none;color:var(--text-dim);padding:9px 16px;cursor:pointer;font-size:13px;font-weight:600;
}
.pill-toggle button.active{background:var(--accent);color:#fff}

/* ---- Table ----
   As tabelas devem caber na área útil SEM scroll horizontal: wrap largo
   (1720px), célula compacta e nomes sem quebra de linha. O overflow-x fica
   só como salvaguarda pra janelas muito estreitas. */
.table-wrap{overflow-x:auto;border-radius:10px;border:1px solid var(--border)}
.table-wrap td{white-space:nowrap}
.pos-cell .icon{width:13px;height:13px;vertical-align:-2px;margin-right:3px}
table{border-collapse:collapse;width:100%;font-size:12.5px}
thead th{
  background:var(--bg-panel-2);color:var(--text-dim);text-transform:uppercase;font-size:10.5px;
  letter-spacing:.4px;padding:9px 8px;text-align:center;position:sticky;top:0;
  white-space:normal;line-height:1.3;max-width:140px;
}
tbody td{padding:8px;border-top:1px solid var(--border);text-align:center}
tbody tr:hover{background:rgba(255,255,255,.03)}
.pos-1 td:first-child, .pos-1 .pos-cell{color:var(--gold);font-weight:800}
.pos-2 td:first-child, .pos-2 .pos-cell{color:var(--silver);font-weight:800}
.pos-3 td:first-child, .pos-3 .pos-cell{color:var(--bronze);font-weight:800}
.tag{font-size:11px;background:var(--bg-panel-2);border:1px solid var(--border);padding:2px 8px;border-radius:12px;color:var(--text-dim)}
.num{font-variant-numeric:tabular-nums;text-align:center}
.team-link{cursor:pointer;color:var(--accent-4);text-decoration:none;font-weight:600}

/* ---- Nomes de equipe sempre em caixa alta ---- */
.team-link, .trophy .team, .podio-card .name, #team-name, .ew-name .n, .cc-value a,
.suggest-chips button, .chip span {text-transform:uppercase}
.team-link:hover{text-decoration:underline}

/* ---- Sobre / apresentação (clique na logo da sidebar) ---- */
.sobre-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
@media(max-width:1100px){.sobre-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:560px){.sobre-grid{grid-template-columns:1fr}}
.sobre-card{
  display:block;text-decoration:none;color:inherit;
  background:linear-gradient(160deg,var(--bg-panel-2),var(--bg-panel));
  border:1px solid var(--border);border-radius:14px;padding:20px;
  transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease;
}
.sobre-card:hover{transform:translateY(-3px);border-color:color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow:0 10px 28px rgba(0,0,0,.35),0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent)}
.sobre-card .ic{display:flex;width:38px;height:38px;align-items:center;justify-content:center;border-radius:10px;
  background:color-mix(in srgb, var(--accent) 16%, transparent);color:var(--accent);margin-bottom:12px}
.sobre-card .ic .icon{width:19px;height:19px}
.sobre-card .tit{font-size:15px;font-weight:800;margin-bottom:6px}
.sobre-card .desc{font-size:12.5px;color:var(--text-dim);line-height:1.5}

/* ---- Trophy cards grid ---- */
.trophy-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
@media(max-width:980px){.trophy-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:560px){.trophy-grid{grid-template-columns:1fr}}
.trophy{
  background:linear-gradient(160deg,var(--bg-panel-2),var(--bg-panel));
  border:1px solid var(--border);border-radius:12px;padding:16px;
  display:grid;row-gap:4px;column-gap:10px;
  grid-template-columns:1fr auto;
  grid-template-areas:"ev pts" "team team" "inst inst";
}
.trophy .ev{grid-area:ev;font-size:11px;text-transform:uppercase;letter-spacing:.6px;color:var(--accent-2);font-weight:700;
  display:flex;align-items:center;min-width:0;overflow-wrap:anywhere;}
.trophy .team{grid-area:team;font-size:16px;font-weight:800;margin:2px 0}
.trophy .inst{grid-area:inst;font-size:12px;color:var(--text-dim)}
.trophy .pts{grid-area:pts;justify-self:end;align-self:start;font-size:12px;background:rgba(47,111,237,.18);
  color:var(--accent-4);padding:3px 9px;border-radius:20px;font-weight:700;white-space:nowrap;height:fit-content}

/* ---- Charts ---- */
.chart-box{position:relative;height:360px}
.chart-box.short{height:280px}
.grid-2{display:grid;grid-template-columns:1.3fr .9fr;gap:18px}
.grid-2 .panel{min-width:0}
@media(max-width:900px){.grid-2{grid-template-columns:1fr}}

/* ---- Grade 2x2 dos gráficos de Curiosidades (Design x Enduro, Peso x
   Desempenho, Com Aero x Sem Aero, Aro 10" x Aro 13") — grid "achatada":
   título/gráfico/texto de cada par são linhas reais do grid, então as duas
   colunas de uma mesma linha sempre ficam com a mesma altura (stretch). ---- */
.quad-grid{
  display:grid;grid-template-columns:1fr 1fr;
  grid-template-rows:auto auto 1fr auto auto 1fr;column-gap:20px;row-gap:14px;
  margin-bottom:34px;
}
.quad-grid .panel{min-width:0}
/* Posição explícita de cada uma das 12 células (2 colunas x 6 linhas) —
   independe da ordem no DOM, então esconder um item (ex: Peso x Desempenho
   quando não há dados suficientes) não empurra os itens seguintes pra
   posição errada, como aconteceria com o fluxo automático do grid. */
.quad-grid > *:nth-child(1){grid-area:1/1}
.quad-grid > *:nth-child(2){grid-area:1/2}
.quad-grid > *:nth-child(3){grid-area:2/1}
.quad-grid > *:nth-child(4){grid-area:2/2}
.quad-grid > *:nth-child(5){grid-area:3/1}
.quad-grid > *:nth-child(6){grid-area:3/2}
.quad-grid > *:nth-child(7){grid-area:4/1}
.quad-grid > *:nth-child(8){grid-area:4/2}
.quad-grid > *:nth-child(9){grid-area:5/1}
.quad-grid > *:nth-child(10){grid-area:5/2}
.quad-grid > *:nth-child(11){grid-area:6/1}
.quad-grid > *:nth-child(12){grid-area:6/2}
@media(max-width:1100px){
  .quad-grid{grid-template-columns:1fr;grid-template-rows:none}
  .quad-grid > *{grid-area:auto !important}
}

/* ---- Mapa do Brasil (Evolução Histórica) ---- */
.brasil-map-wrap{display:flex;flex-direction:column;align-items:center;gap:10px}
.brasil-map-wrap svg{width:100%;max-width:340px;height:auto}
.brasil-map-wrap .state{transition:fill .2s}
.brasil-map-legend{width:100%}
.bm-scale{display:flex;align-items:center;justify-content:center;gap:8px;font-size:11px;color:var(--text-dim);margin-bottom:8px}
.bm-top5{display:flex;gap:6px;flex-wrap:wrap;justify-content:center}
.bm-count{
  fill:#fff;font-size:13px;font-weight:800;text-anchor:middle;dominant-baseline:middle;
  paint-order:stroke;stroke:#060815;stroke-width:3px;pointer-events:none;
}

/* ---- Os Palcos da Competição (dentro do card do mapa do Brasil) ---- */
.palcos-box{margin-top:16px;border-top:1px solid var(--border);padding-top:14px}
.palcos-head{
  font-size:12px;text-transform:uppercase;letter-spacing:.6px;color:var(--accent-2);
  font-weight:700;margin-bottom:6px;
}
.palco-row{display:flex;align-items:flex-start;gap:10px;padding:8px 0;border-top:1px solid var(--border)}
.palco-row:first-of-type{border-top:none}
.palco-ic{
  width:28px;height:28px;flex-shrink:0;border-radius:8px;display:flex;align-items:center;justify-content:center;
  background:color-mix(in srgb, var(--pc,var(--accent)) 16%, transparent);color:var(--pc,var(--accent));
}
.palco-ic .icon{width:14px;height:14px}
.palco-info{min-width:0}
.palco-nome{font-size:13.5px;font-weight:700;line-height:1.35}
.palco-nome .tag{margin-left:4px}
.palco-anos{font-size:11.5px;color:var(--text-dim);margin-top:2px;line-height:1.45}

/* ---- Compare ---- */
.compare-filters{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-start}
.compare-filters select{min-width:130px}
.year-slider-row{display:flex;align-items:center;gap:12px;margin:14px 0 4px;flex-wrap:wrap}
.year-slider-row label{font-size:12.5px;color:var(--text-dim);font-weight:700}
.year-slider-label{font-size:13px;font-weight:800;color:var(--accent-4);min-width:130px;text-align:right}

/* lista suspensa com checkboxes pra escolher as equipes */
.team-multiselect{position:relative;flex:1;min-width:240px}
.ms-toggle{
  width:100%;text-align:left;padding:10px 14px;border-radius:10px;cursor:pointer;
  background:var(--bg-panel-2);border:1px solid var(--border);color:var(--text);font-size:13.5px;
}
.ms-toggle::after{content:'▾';float:right;color:var(--text-dim)}
.ms-toggle.open::after{content:'▴'}
.ms-panel{
  position:absolute;top:calc(100% + 6px);left:0;right:0;z-index:40;
  background:var(--bg-panel);border:1px solid var(--border);border-radius:12px;padding:10px;
  box-shadow:0 14px 34px rgba(0,0,0,.5);
}
.ms-list{max-height:260px;overflow-y:auto;margin-top:8px;display:flex;flex-direction:column;gap:2px}
.ms-item{display:flex;align-items:center;gap:9px;padding:6px 8px;border-radius:8px;cursor:pointer;font-size:13px}
.ms-item:hover{background:rgba(255,255,255,.05)}
.ms-item input[type=checkbox]{accent-color:var(--accent);cursor:pointer;flex-shrink:0}
.ms-item .ms-nome{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ms-item .ms-cat{margin-left:auto;flex-shrink:0;font-size:10.5px;color:var(--text-dim)}
.ms-item.disabled{opacity:.4;cursor:not-allowed}

/* botões de comparação rápida (Top 3 histórico / do último ano) */
.quick-compare{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.btn-quick{
  display:inline-flex;align-items:center;gap:7px;padding:8px 13px;border-radius:9px;cursor:pointer;
  background:var(--bg-panel-2);border:1px solid var(--border);color:var(--text);font-size:12.5px;font-weight:700;
  transition:border-color .15s,box-shadow .15s;
}
.btn-quick:hover{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}
.btn-quick .icon{width:14px;height:14px;color:var(--accent-2)}
.btn-quick-danger{margin-left:auto}
.btn-quick-danger:hover{border-color:var(--danger);box-shadow:0 0 0 1px var(--danger)}
.btn-quick-danger .icon{color:var(--danger)}

/* slider de duas bolinhas (limite inferior e superior do período) */
.dual-slider{position:relative;flex:1;min-width:180px;height:28px}
.dual-slider .ds-track{position:absolute;left:0;right:0;top:50%;transform:translateY(-50%);height:5px;background:#212852;border-radius:3px}
.dual-slider .ds-fill{position:absolute;top:50%;transform:translateY(-50%);height:5px;background:var(--accent);border-radius:3px}
.dual-slider input[type=range]{
  position:absolute;left:0;top:50%;transform:translateY(-50%);width:100%;margin:0;
  -webkit-appearance:none;appearance:none;background:transparent;pointer-events:none;height:28px;
}
.dual-slider input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;pointer-events:auto;width:17px;height:17px;border-radius:50%;
  background:var(--accent-4);border:2.5px solid #0d1120;box-shadow:0 0 0 1px var(--accent);cursor:grab;
}
.dual-slider input[type=range]::-moz-range-thumb{
  pointer-events:auto;width:17px;height:17px;border-radius:50%;
  background:var(--accent-4);border:2.5px solid #0d1120;box-shadow:0 0 0 1px var(--accent);cursor:grab;
}
.chips{display:flex;gap:8px;flex-wrap:wrap;min-height:34px;margin:10px 0}
.chip{background:var(--bg-panel-2);border:1px solid var(--accent);color:var(--text);padding:6px 10px;border-radius:20px;font-size:12.5px;display:flex;align-items:center;gap:6px}
.chip button{background:none;border:none;color:var(--text-dim);cursor:pointer;font-size:14px;line-height:1}
.autocomplete{position:relative}
.ac-results{position:absolute;top:100%;left:0;right:0;background:var(--bg-panel-2);border:1px solid var(--border);border-radius:8px;margin-top:4px;max-height:220px;overflow:auto;z-index:20;display:none}
.ac-results div{padding:8px 12px;cursor:pointer;font-size:13px}
.ac-results div:hover{background:rgba(255,255,255,.06)}

footer{margin-top:60px;padding:26px 20px;text-align:center;color:var(--text-dim);font-size:12px;border-top:1px solid var(--border)}
.meta-badge{cursor:help;opacity:.75}
.loading{color:var(--text-dim);font-size:13px;padding:20px;text-align:center}
.error-banner{background:rgba(255,77,77,.12);border:1px solid var(--danger);color:#ffb3b3;padding:14px 18px;border-radius:10px;margin:20px 0;font-size:13.5px}
.error-banner code{background:rgba(0,0,0,.3);padding:2px 6px;border-radius:4px}

/* ---- Pódio (Últimos Campeões) ---- */
.podio{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;align-items:end;margin-bottom:18px}
.podio-card{
  border-radius:14px;padding:20px 16px;text-align:center;position:relative;overflow:hidden;
  border:1px solid var(--border);background:linear-gradient(160deg,var(--bg-panel-2),var(--bg-panel));
}
.podio-card.p1{padding-top:30px;box-shadow:0 0 0 1px var(--gold),0 12px 30px rgba(255,213,74,.15)}
.podio-card.p2{box-shadow:0 0 0 1px var(--silver)}
.podio-card.p3{box-shadow:0 0 0 1px var(--bronze)}
.podio-card .medal{display:flex;align-items:center;justify-content:center}
.podio-card .medal .icon{width:64px;height:64px}
.podio-card .medal .medal-logo{width:110px;height:110px;border-radius:14px;object-fit:cover;background:#04070f;border:1px solid var(--border)}
.team-cell-logo{display:flex;align-items:center;gap:9px}
.row-logo{width:75px;height:75px;max-width:75px;max-height:75px;flex-shrink:0;border-radius:10px;object-fit:cover;background:#04070f;border:1px solid var(--border)}
.podio-card .place{
  display:flex;align-items:center;justify-content:center;gap:6px;
  font-size:12.5px;font-weight:800;text-transform:uppercase;letter-spacing:1.2px;margin-top:14px;
}
.podio-card .place .icon{width:16px;height:16px}
.podio-card.p1 .place{color:var(--gold)}
.podio-card.p2 .place{color:var(--silver)}
.podio-card.p3 .place{color:var(--bronze)}
.podio-card .name{font-size:16.5px;font-weight:800;margin-top:8px}
.podio-card .inst{font-size:12px;color:var(--text-dim);margin-top:2px}
.podio-card .pts{margin-top:10px;font-size:22px;font-weight:800}
.podio-card .pts small{font-size:11px;color:var(--text-dim);font-weight:400}
/* pódio permanece horizontal (3 colunas) em todas as larguras */

/* ---- Perfil de equipe (Analise sua Equipe) ---- */
.team-profile-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:16px;margin-bottom:18px}
.team-profile-head h2{font-size:24px;margin:0}
.team-title-group{display:flex;align-items:center;gap:18px;min-width:0}
.team-logo-sq{
  width:75px;height:75px;max-width:75px;max-height:75px;flex-shrink:0;border-radius:12px;object-fit:cover;
  background:#04070f;border:1px solid var(--border);
}
.insta-link{
  display:inline-flex;align-items:center;gap:8px;padding:8px 14px;border-radius:10px;
  border:1px solid var(--border);background:linear-gradient(135deg,rgba(225,48,108,.12),rgba(129,52,175,.12));
  color:var(--text);font-size:13px;font-weight:700;text-decoration:none;transition:box-shadow .2s,transform .2s;
}
.insta-link:hover{box-shadow:0 0 0 1px #e1306c66,0 6px 18px rgba(225,48,108,.18);transform:translateY(-1px)}
.insta-link .icon{width:17px;height:17px;color:#e1306c}
.team-stat-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px;margin-bottom:22px}
.team-stat-row .kpi .v{font-size:24px}
.empty-hint{
  padding:60px 20px;text-align:center;color:var(--text-dim);border:1px dashed var(--border);
  border-radius:var(--radius);font-size:14px;
}
.suggest-chips{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;margin-top:16px}
.suggest-chips button{
  background:var(--bg-panel-2);border:1px solid var(--border);color:var(--text);
  padding:7px 14px;border-radius:20px;font-size:12.5px;cursor:pointer;
}
.suggest-chips button:hover{border-color:var(--accent)}

/* ---- Tools (placeholder) ---- */
.tools-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:16px}
.tool-card{
  border:1px dashed var(--border);border-radius:var(--radius);padding:26px 20px;text-align:center;
  color:var(--text-dim);background:var(--bg-panel);
}
.tool-card .ic{margin-bottom:10px}
.tool-card .ic .icon{width:30px;height:30px}
.tool-card b{color:var(--text);display:block;margin-bottom:4px;font-size:14.5px}

/* ---- Ícones (Lucide, embutidos via icons.js) ---- */
.icon{width:1em;height:1em;display:inline-block;vertical-align:-0.15em;flex-shrink:0}
h1 .icon{width:22px;height:22px;vertical-align:-4px;margin-right:8px;color:var(--accent)}
.sidebar nav a .ic .icon{width:18px;height:18px;color:currentColor}
#sidebar-toggle .icon{width:16px;height:16px}
.side-logo .icon{width:20px;height:20px}
.medal-gold{color:var(--gold)}
.medal-silver{color:var(--silver)}
.medal-bronze{color:var(--bronze)}
.trophy .ev .icon,.sec-head h2 .icon{width:14px;height:14px;vertical-align:-2px;margin-right:4px}
.chip button .icon{width:12px;height:12px}
.titulo-ic{color:var(--gold);width:14px;height:14px;vertical-align:-2px;margin-right:2px}
.trof-ouro,.trof-prata,.trof-bronze{width:18px;height:18px;vertical-align:-2px;margin-right:5px}
.trof-ouro{color:var(--gold)}
.trof-prata{color:var(--silver)}
.trof-bronze{color:var(--bronze)}

/* ---- Maiores Vencedores por Prova (Hall da Fama) ---- */
.event-winners-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px}
/* Recordes de Tempo: os 5 cards (Aceleração, Skid Pad, Autocross, Enduro,
   Eficiência) dividem a mesma linha em telas largas */
#recordes-grid{grid-template-columns:repeat(auto-fit,minmax(225px,1fr))}
/* Comparador: controles + radar à esquerda, tabela de médias à direita */
.compare-team-cell{text-align:center;white-space:normal !important}
.compare-logo{
  display:block;margin:0 auto 6px;width:75px;height:75px;border-radius:10px;
  object-fit:cover;background:#04070f;border:1px solid var(--border);
}
.comparador-grid{display:grid;grid-template-columns:1.05fr 1fr;gap:18px;align-items:start}
.comparador-grid > .panel{min-width:0;max-width:100%}
@media(max-width:1100px){.comparador-grid{grid-template-columns:1fr}}
/* Provas dinâmicas: 4 cards dividindo toda a largura */
#dinamicas-grid{grid-template-columns:repeat(4,1fr)}
@media(max-width:1100px){#dinamicas-grid{grid-template-columns:repeat(2,1fr)}}
/* Categorias de Design: 7 cards em 4 + 3, sempre ocupando toda a largura
   (linha 1: Suspensão, Chassi & Aero, Engine, Transmission;
    linha 2: Brakes, Electronics, Management) */
#design-grid{grid-template-columns:repeat(12,1fr)}
#design-grid .event-winner-card{grid-column:span 3}
#design-grid .event-winner-card:nth-child(n+5){grid-column:span 4}
@media(max-width:1100px){
  #design-grid{grid-template-columns:repeat(2,1fr)}
  #design-grid .event-winner-card,
  #design-grid .event-winner-card:nth-child(n+5){grid-column:auto}
}
.event-winner-card{
  background:linear-gradient(160deg,var(--bg-panel-2),var(--bg-panel));
  border:1px solid var(--border);border-radius:12px;padding:18px;
}
.event-winner-card .ev-title{
  display:flex;align-items:center;gap:8px;font-size:12px;text-transform:uppercase;
  letter-spacing:.6px;color:var(--accent-2);font-weight:700;margin-bottom:12px;
}
.event-winner-card .ev-title .icon{width:15px;height:15px}
.event-winner-card .ev-record{
  display:flex;align-items:flex-start;gap:8px;color:var(--accent-3);
  background:color-mix(in srgb, var(--accent-3) 10%, transparent);
  border:1px solid color-mix(in srgb, var(--accent-3) 25%, transparent);
  border-radius:8px;padding:8px 10px;margin-bottom:10px;
}
.event-winner-card .ev-record .icon{width:14px;height:14px;flex-shrink:0;margin-top:2px}
.event-winner-card .ev-record .ev-record-body{display:flex;flex-direction:column;line-height:1.4}
.event-winner-card .ev-record .ev-record-tag{font-size:10px;text-transform:uppercase;letter-spacing:.5px;color:var(--text-dim)}
.event-winner-card .ev-record .ev-record-tempo{font-size:15px;font-weight:800}
.event-winner-card .ev-record .ev-record-quem{font-size:11.5px;color:var(--text-dim)}
.tip-anos{cursor:help;text-decoration:underline dotted color-mix(in srgb, var(--text-dim) 60%, transparent);text-underline-offset:3px}
.trophy .pts[title]{cursor:help}
.sec-head h2[title]{cursor:help}
.ew-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:7px 0;border-top:1px solid var(--border)}
.ew-row:first-of-type{border-top:none}
.ew-row .ew-rank{width:18px;flex-shrink:0;color:var(--text-dim);font-size:12px;font-weight:700}
.ew-row .ew-name{flex:1;min-width:0}
.ew-row .ew-name .n{font-size:13.5px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ew-row .ew-name .i{font-size:11px;color:var(--text-dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ew-row .ew-wins{flex-shrink:0;text-align:right;font-size:13px;font-weight:800;color:var(--accent)}
.ew-row .ew-wins small{display:block;font-size:10px;color:var(--text-dim);font-weight:400}
.ew-row.ew-first .ew-rank{color:var(--gold)}

/* ---- Cards de recorde (Melhores por Prova) — paleta separada dos cards
   de pódio, pra destacar visualmente qual é o tempo recorde ---- */
.record-card{border-color:color-mix(in srgb, var(--gold) 35%, var(--border))}
.record-card .ev-title{color:var(--gold)}
.record-card .ew-row.ew-record-row{
  background:color-mix(in srgb, var(--gold) 12%, transparent);
  border-radius:8px;padding:8px 8px;margin:0 -8px 2px;border-top:none;
}
.record-card .ew-row.ew-record-row .ew-rank{color:var(--gold);width:16px}
.record-card .ew-row.ew-record-row .ew-rank .icon{width:14px;height:14px}
.record-card .ew-row.ew-record-row .ew-wins{color:var(--gold);font-size:15px}

/* ---- Curiosidades ---- */
.curio-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(270px,1fr));gap:14px}
.curio-card{
  background:linear-gradient(160deg,var(--bg-panel-2),var(--bg-panel));
  border:1px solid var(--border);border-radius:14px;padding:18px;position:relative;overflow:hidden;
  transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease;
}
.curio-card:hover{transform:translateY(-3px);border-color:color-mix(in srgb, var(--accent-2) 55%, var(--border));
  box-shadow:0 10px 28px rgba(0,0,0,.35),0 0 0 1px color-mix(in srgb, var(--accent-2) 30%, transparent)}
.curio-card .cc-label{
  font-size:15px;text-transform:uppercase;letter-spacing:.7px;font-weight:800;
  color:var(--accent-2);margin-bottom:8px;line-height:1.4;
}
.curio-card .cc-value{font-size:22px;font-weight:800;line-height:1.25;margin-bottom:6px}
.curio-card .cc-value a{color:var(--accent-4)}
.curio-card .cc-detail{font-size:12.5px;color:var(--text-dim);line-height:1.55}

/* ============================================================
   Refinamento MOBILE (vistoria completa) — layouts fluidos,
   sem sobreposição de cards e logos reduzidas só em telas pequenas
   ============================================================ */
@media (max-width:640px){
  .wrap{padding:0 12px 40px}
  section{margin-top:26px}
  .panel{padding:14px}
  header.top{flex-direction:column;align-items:flex-start;gap:12px;padding:18px 14px 14px 74px}
  header.top h1{font-size:18px}
  header.top p{font-size:12px}
  header.top .controls{width:100%}
  .controls select{flex:1;min-width:0}
  .pill-toggle{flex:1}
  .pill-toggle button{flex:1;padding:8px 10px;font-size:12px}

  /* KPIs e cards de estatística: 2 colunas fixas, sem estouro */
  .kpis{grid-template-columns:repeat(2,1fr);gap:10px}
  .kpi{padding:14px 14px}
  .kpi .v{font-size:22px}
  .team-stat-row{grid-template-columns:repeat(2,1fr);gap:10px}

  /* Grades de cards: 1 coluna para não espremer conteúdo */
  #dinamicas-grid{grid-template-columns:1fr}
  #design-grid{grid-template-columns:1fr}
  #design-grid .event-winner-card,
  #design-grid .event-winner-card:nth-child(n+5){grid-column:auto}
  .event-winners-grid{grid-template-columns:1fr}

  /* Pódio horizontal compacto: 3 cards lado a lado */
  .podio{gap:8px}
  .podio-card{padding:12px 6px}
  .podio-card.p1{padding-top:18px}
  .podio-card .medal .medal-logo{width:56px;height:56px;border-radius:10px}
  .podio-card .medal .icon{width:36px;height:36px}
  .podio-card .place{font-size:9.5px;letter-spacing:.5px;gap:4px;margin-top:8px}
  .podio-card .place .icon{width:12px;height:12px}
  .podio-card .name{font-size:12px;margin-top:5px;overflow-wrap:anywhere}
  .podio-card .pts{font-size:15px;margin-top:6px}
  .row-logo,.team-logo-sq,.compare-logo{
    width:52px;height:52px;max-width:52px;max-height:52px;border-radius:8px;
  }
  .team-profile-head h2{font-size:19px}
  .team-title-group{gap:12px}
  .insta-link{padding:6px 10px;font-size:12px}

  /* Gráficos mais baixos para caber na tela sem rolagem lateral */
  .chart-box{height:260px}
  .chart-box.short{height:220px}

  /* Comparador: controles em coluna, largura total, sem larguras mínimas */
  .compare-filters{flex-direction:column}
  .compare-filters .team-multiselect,.compare-filters select{width:100%;min-width:0}
  .team-multiselect{min-width:0}
  .ms-toggle{width:100%}
  .quick-compare{gap:6px}
  .quick-compare .btn-quick{flex:1 1 45%;justify-content:center}
  .year-slider-row{gap:8px}
  .dual-slider{min-width:0;width:100%;flex-basis:100%}
  .year-slider-label{min-width:0;text-align:left}
  .chips{display:flex;flex-wrap:wrap;gap:6px}
  .comparador-grid{gap:14px}

  /* Tabelas: fonte compacta; rolagem horizontal fica no .table-wrap */
  table{font-size:11.5px}
  tbody td{padding:6px}
  thead th{font-size:9.5px}

  .brasil-map-wrap svg{max-width:280px}
  .quad-grid{margin-bottom:24px;column-gap:0}

  /* trava overflow horizontal: nada mais força a página a "des-zoomar" */
  html,body{overflow-x:hidden}

  /* pódio: 3 cards do MESMO tamanho, alinhados */
  .podio{align-items:stretch}
  .podio-card{display:flex;flex-direction:column;justify-content:flex-start}
  .podio-card.p1{padding-top:12px}

  /* toggle Combustão/Elétrico sempre visível: controles em largura total
     abaixo do título da seção, botões com área de toque confortável */
  .sec-head .controls{width:100%}
  .sec-head .controls select{flex:1}
  #toggle-categoria{flex:1}
  #toggle-categoria button{min-height:40px}

  /* colunas de Instituição escondidas só no mobile */
  #tbl-hall th:nth-child(3),#tbl-hall td:nth-child(3){display:none}
  #tbl-ranking th:nth-child(4),#tbl-ranking td:nth-child(4){display:none}
}

@media (max-width:400px){
  .kpis{grid-template-columns:1fr 1fr;gap:8px}
  .kpi .v{font-size:19px}
  .podio-card .medal .medal-logo{width:64px;height:64px}
  .chart-box{height:230px}
}

