/* ── Google Fonts (Inter como fallback até Aileron ser adicionado) ─────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* ── Design Tokens ────────────────────────────────────────────────────────── */
:root {
  --primary:        #5252A2;
  --primary-light:  #587EBF;
  --primary-dark:   #3d3d7a;
  --purple:         #9460A8;
  --orange:         #E88826;
  --orange-dark:    #E46538;

  --text-primary:   #2C2C2C;
  --text-secondary: #737373;
  --bg-element:     #C7CFDD;
  --bg-section:     #F1F3F6;
  --bg-page:        #F9F9F9;

  --success:        #58BF63;
  --warning:        #E8C326;
  --link:           #5252A2;

  --sidebar-w:      240px;
  --sidebar-collapsed-w: 56px;
  --header-h:       64px;
  --radius:         8px;
  --shadow:         0 1px 4px rgba(0,0,0,.10);
  --shadow-md:      0 4px 16px rgba(0,0,0,.12);

  --font:           'Aileron', 'Inter', sans-serif;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .22s ease;
}
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-w); overflow-y: hidden; }
body.sidebar-collapsed .main-wrapper { margin-left: var(--sidebar-collapsed-w); }

.sidebar__mee-logo {
  position: relative;
  width: 100%;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar__mee-logo img {
  width: 100%;
  height: auto;
  display: block;
}
body.sidebar-collapsed .sidebar__mee-logo { display: none; }

body.sidebar-collapsed .sidebar__logo-text { opacity: 0; width: 0; }

/* Botão toggle — posicionado sobre a logo MEE */
.sidebar__toggle {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--primary);
  border: none;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s;
  z-index: 1;
}
.sidebar__toggle:hover { background: var(--primary-dark); }
.sidebar__toggle svg { transition: transform .22s; flex-shrink: 0; }
body.sidebar-collapsed .sidebar__toggle svg { transform: rotate(180deg); }

/* Collapsed: esconde a imagem, mantém o container como área clicável do toggle */
body.sidebar-collapsed .sidebar__mee-logo img { display: none; }
body.sidebar-collapsed .sidebar__mee-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 0;
}
body.sidebar-collapsed .sidebar__toggle {
  position: static;
  background: rgba(255,255,255,.12);
}

.sidebar__nav { padding: 16px 0; flex: 1; }
.sidebar__nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,.75);
  font-size: 13.5px;
  font-weight: 600;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.sidebar__nav a:hover,
.sidebar__nav a.active {
  background: rgba(255,255,255,.10);
  color: #fff;
  border-left-color: var(--orange);
  text-decoration: none;
}
.sidebar__nav a svg { flex-shrink: 0; opacity: .8; }
.sidebar__nav a.active svg { opacity: 1; }
.sidebar__nav a span { white-space: nowrap; overflow: hidden; transition: opacity .15s, width .22s; }
.sidebar__nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  width: 100%;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: rgba(255,255,255,.75);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-align: left;
}
.sidebar__nav button:hover {
  background: rgba(255,255,255,.10);
  color: #fff;
  border-left-color: var(--orange);
}
.sidebar__nav button svg { flex-shrink: 0; opacity: .8; }
.sidebar__nav button span { white-space: nowrap; overflow: hidden; transition: opacity .15s, width .22s; }
.sidebar__nav-divider { height: 1px; background: rgba(255,255,255,.1); margin: 6px 16px; }
body.sidebar-collapsed .sidebar__nav button { padding: 11px 0; justify-content: center; gap: 0; border-left: none; }
body.sidebar-collapsed .sidebar__nav button:hover { border-left: none; border-right: 3px solid var(--orange); }
body.sidebar-collapsed .sidebar__nav button span { opacity: 0; width: 0; }
body.sidebar-collapsed .sidebar__nav-divider { margin: 6px 8px; }
body.sidebar-collapsed .sidebar__nav a { padding: 11px 0; justify-content: center; gap: 0; border-left: none; }
body.sidebar-collapsed .sidebar__nav a.active,
body.sidebar-collapsed .sidebar__nav a:hover { border-left: none; border-right: 3px solid var(--orange); }
body.sidebar-collapsed .sidebar__nav a span { opacity: 0; width: 0; }

/* Tooltip ao passar o mouse no modo colapsado */
body.sidebar-collapsed .sidebar__nav a { position: relative; }
body.sidebar-collapsed .sidebar__nav a::after {
  content: attr(data-label);
  position: absolute;
  left: calc(var(--sidebar-collapsed-w) - 4px);
  top: 50%; transform: translateY(-50%);
  background: var(--primary-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 200;
}
body.sidebar-collapsed .sidebar__nav a:hover::after { opacity: 1; }

.sidebar__mando {
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar__mando-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: rgba(255,255,255,.45);
  margin-bottom: 8px;
}
.sidebar__mando-btns {
  display: flex;
  gap: 4px;
}
.mando-btn {
  flex: 1;
  padding: 5px 0;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,.6);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.mando-btn:hover  { background: rgba(255,255,255,.1); color: #fff; }
.mando-btn.active { background: var(--orange); border-color: var(--orange); color: #fff; }

.sidebar__rodadas {
  padding: 8px 16px 12px;
}
.sidebar__rodadas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.sidebar__rodadas-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: rgba(255,255,255,.45);
}
.sidebar__rodadas-val {
  font-size: 11px;
  font-weight: 700;
  color: var(--orange);
}

/* ── Sidebar scouts filter ────────────────────────────────────────────────── */
.sidebar__scouts {
  padding: 8px 16px 12px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar__scouts-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: rgba(255,255,255,.45);
  margin-bottom: 6px;
}
.scouts-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.scouts-toggle:hover { background: rgba(255,255,255,.14); }
.scouts-toggle .arrow { font-size: 9px; opacity: .7; transition: transform .15s; }
.scouts-toggle.open .arrow { transform: rotate(180deg); }
.scouts-panel {
  display: none;
  margin-top: 4px;
  background: #fff;
  border-radius: 6px;
  padding: 6px 4px;
  max-height: 220px;
  overflow-y: auto;
}
.scouts-panel.open { display: block; }
.scouts-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 4px;
  user-select: none;
}
.scouts-item:hover { background: var(--bg-section); }
.scouts-item input[type="checkbox"] { cursor: pointer; accent-color: var(--primary); }
.scouts-item--todos {
  font-weight: 700;
  border-bottom: 1px solid var(--bg-section);
  margin-bottom: 2px;
  padding-bottom: 6px;
}
.scouts-aplicar {
  width: calc(100% - 8px);
  margin: 6px 4px 0;
  padding: 6px 0;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.scouts-aplicar:hover { background: var(--primary-dark); }

/* ── Sidebar recorrência filter ───────────────────────────────────────────── */
.sidebar__recorrencia {
  padding: 8px 16px 12px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar__recorrencia-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: rgba(255,255,255,.45);
  margin-bottom: 8px;
}
.recorrencia-item {
  margin-bottom: 10px;
}
.recorrencia-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: rgba(255,255,255,.8);
  margin-bottom: 4px;
}
.rec-val {
  font-weight: 700;
  color: var(--orange);
  white-space: nowrap;
  margin-left: 6px;
}
.rec-slider {
  width: 100%;
  accent-color: var(--orange);
  cursor: pointer;
  height: 4px;
}
.recorrencia-divider {
  height: 1px;
  background: rgba(255,255,255,.1);
  margin: 6px 0 10px;
}
.rec-pct {
  font-size: 11px;
  color: var(--orange);
  font-weight: 600;
}

.sidebar__media {
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar__media-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: rgba(255,255,255,.45);
  margin-bottom: 8px;
}

/* ── Config section — colapsada por padrão, abre para cima ───────────────── */
.sidebar__config {
  position: relative;
  border-top: 1px solid rgba(255,255,255,.10);
  flex-shrink: 0;
}

/* Painel que abre para cima */
.sidebar__config-body {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0; right: 0;
  background: var(--primary-dark);
  border-top: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 -8px 28px rgba(0,0,0,.30);
  max-height: 70vh;
  overflow-y: auto;
  z-index: 150;
}
html.theme-escuro .sidebar__config-body { background: #161625; }
html.theme-claro  .sidebar__config-body { background: #162d4e; }

.sidebar__config.open .sidebar__config-body { display: block; }

.sidebar__config-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.65);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar__config-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar__config.open .sidebar__config-btn { background: rgba(255,255,255,.08); color: #fff; }
.sidebar__config-btn svg { flex-shrink: 0; }
.sidebar__config-btn span { white-space: nowrap; overflow: hidden; transition: opacity .15s, width .22s; }

/* Chevron no botão — roda quando aberto */
.sidebar__config-chevron {
  margin-left: auto;
  flex-shrink: 0;
  transition: transform .2s;
  opacity: .6;
}
.sidebar__config.open .sidebar__config-chevron { transform: rotate(180deg); opacity: 1; }

body.sidebar-collapsed .sidebar__config-btn { padding: 13px 0; justify-content: center; gap: 0; position: relative; }
body.sidebar-collapsed .sidebar__config-btn span,
body.sidebar-collapsed .sidebar__config-chevron { opacity: 0; width: 0; overflow: hidden; }
body.sidebar-collapsed .sidebar__config-btn svg { margin: 0 auto; }
body.sidebar-collapsed .sidebar__config-btn::after {
  content: 'Configuração';
  position: absolute;
  left: calc(var(--sidebar-collapsed-w) - 4px);
  top: 50%; transform: translateY(-50%);
  background: var(--primary-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 200;
  text-transform: none;
  letter-spacing: 0;
}
body.sidebar-collapsed .sidebar__config-btn:hover::after { opacity: 1; }
body.sidebar-collapsed .sidebar__config-body { display: none; }

.sidebar__logout {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px auto 4px;
  gap: 6px;
  padding: 5px 10px;
  background: none;
  border: none;
  border-radius: 6px;
  color: rgba(255,255,255,.55);
  font-size: 12px;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar__logout:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}
body.sidebar-collapsed .sidebar__logout span { display: none; }
body.sidebar-collapsed .sidebar__logout { padding: 5px; }

.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
}

.topbar {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--bg-element);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow);
}
.topbar__title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.topbar__subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 1px; display: flex; align-items: center; gap: 5px; position: relative; }

/* ── Topbar campeonato switcher ─────────────────────────────────────────── */
.topbar-camp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background .15s;
}
.topbar-camp-btn:hover { background: var(--primary-dark); }

.topbar-camp-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--bg-element);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 200;
  padding: 4px;
}
.topbar-camp-dropdown.open { display: block; }
.topbar-camp-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border: none;
  background: none;
  font-size: 12px;
  font-family: var(--font);
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 4px;
  transition: background .1s;
}
.topbar-camp-item:hover  { background: var(--bg-element); }
.topbar-camp-item.active { color: var(--primary); font-weight: 700; }
.topbar-camp-loading     { padding: 7px 10px; font-size: 12px; color: var(--text-secondary); }
html.theme-escuro .topbar-camp-dropdown { background: #1E293B; border-color: #334155; }

.content { padding: 28px; flex: 1; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card--stat { border-top: 3px solid var(--primary); }
.card--stat.orange { border-top-color: var(--orange); }
.card--stat.green  { border-top-color: var(--success); }
.card--stat.purple { border-top-color: var(--purple); }

.card__label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
.card__value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.card__sub   { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* ── Seções ───────────────────────────────────────────────────────────────── */
.section {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--bg-section);
}
.section__title { font-size: 15px; font-weight: 700; }
.section__body  { padding: 20px; }

/* ── Tabelas ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--bg-section);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--bg-section); transition: background .12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-section); }
tbody td { padding: 10px 14px; vertical-align: middle; }
tbody td a { color: var(--link); font-weight: 600; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-section);
  color: var(--text-secondary);
}
.badge--primary { background: var(--primary); color: #fff; }
.badge--orange  { background: var(--orange);  color: #fff; }
.badge--green   { background: var(--success); color: #fff; }
.badge--purple  { background: var(--purple);  color: #fff; }
.badge--outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); font-weight: 800; }

/* Posição na tabela */
.pos { font-weight: 700; width: 28px; text-align: center; }
.pos-1, .pos-2, .pos-3, .pos-4 { color: var(--success); }
.pos-5, .pos-6 { color: var(--orange); }
.pos-17, .pos-18, .pos-19, .pos-20 { color: var(--orange-dark); }

.club-cell { display: flex; align-items: center; gap: 8px; }
.club-logo { width: 24px; height: 24px; object-fit: contain; border-radius: 50%; background: var(--bg-section); }
.club-logo-placeholder { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 9px; font-weight: 700; flex-shrink: 0; }

/* ── Filtros ──────────────────────────────────────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; }

/* ── Multi-select combobox ──────────────────────────────────────────────── */
.ms-wrap { position: relative; min-width: 160px; }
.ms-toggle {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--bg-element);
  border-radius: 6px;
  font-family: var(--font); font-size: 13px; color: var(--text-primary);
  background: var(--bg-section);
  cursor: pointer; text-align: left; white-space: nowrap;
  transition: border-color .15s;
}
.ms-toggle:hover, .ms-toggle.open { border-color: var(--primary); }
.ms-toggle .ms-arrow { font-size: 10px; color: var(--text-secondary); transition: transform .15s; }
.ms-toggle.open .ms-arrow { transform: rotate(180deg); }
.ms-panel {
  display: none;
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 200;
  min-width: 100%; max-height: 220px; overflow-y: auto;
  background: #fff; border: 1px solid var(--bg-element);
  border-radius: 6px; box-shadow: var(--shadow-md);
  padding: 6px 0;
}
.ms-panel.open { display: block; }
.ms-item {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 12px; font-size: 12.5px; cursor: pointer;
  white-space: nowrap;
}
.ms-item:hover { background: var(--bg-section); }
.ms-todos { font-weight: 700; border-bottom: 1px solid var(--bg-section); margin-bottom: 3px; padding-bottom: 7px; }
.ms-item input[type=checkbox] { accent-color: var(--primary); width: 13px; height: 13px; cursor: pointer; }
select, input[type="text"] {
  padding: 7px 10px;
  border: 1px solid var(--bg-element);
  border-radius: 6px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-section);
  outline: none;
  transition: border-color .15s;
  min-width: 140px;
}
select:focus, input[type="text"]:focus { border-color: var(--primary); background: #fff; }

/* ── Sortable table headers ───────────────────────────────────────────────── */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: var(--bg-element); }
th.sort-asc::after  { content: ' ▲'; font-size: 9px; opacity: .7; }
th.sort-desc::after { content: ' ▼'; font-size: 9px; opacity: .7; }

/* ── Botões ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--orange  { background: var(--orange);  color: #fff; }
.btn--ghost   { background: transparent; color: var(--primary); border: 1px solid var(--primary); }

/* ── Gráficos ─────────────────────────────────────────────────────────────── */
.chart-container { position: relative; }

/* ── Perfil do Jogador ────────────────────────────────────────────────────── */
.player-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 28px;
  background: var(--primary);
  color: #fff;
}
.player-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700;
  flex-shrink: 0;
  border: 3px solid rgba(255,255,255,.3);
}
.player-header__name  { font-size: 24px; font-weight: 700; line-height: 1.1; }
.player-header__meta  { font-size: 13px; opacity: .75; margin-top: 4px; display: flex; gap: 12px; }
.player-header__tag   { background: var(--orange); color: #fff; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; display: inline-block; margin-top: 8px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ── Loading / Empty ──────────────────────────────────────────────────────── */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 60px; color: var(--text-secondary); font-size: 14px; gap: 10px;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--bg-element);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 40px; color: var(--text-secondary); }

/* ── Page Loader Overlay ────────────────────────────────────────────────── */
#page-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg, #0f1117);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
  transition: opacity .25s ease;
}
#page-loader.page-loader--done {
  opacity: 0;
  pointer-events: none;
}
.page-loader__spinner {
  width: 52px; height: 52px;
  border: 4px solid rgba(232,136,38,.18);
  border-top-color: #e88826;
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
.page-loader__text {
  font-size: .8rem;
  color: rgba(255,255,255,.35);
  letter-spacing: .04em;
}

/* ── Login Form (compartilhado entre login.html e gate) ────────────────────── */
.login-card__title {
  font-size: 18px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 6px;
}
.login-card__sub {
  font-size: 13px; color: var(--text-secondary); margin-bottom: 28px;
}
.login-field { margin-bottom: 16px; }
.login-field label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 6px;
}
.login-field input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--bg-element); border-radius: 6px;
  font-size: 14px; font-family: var(--font);
  color: var(--text-primary); background: var(--bg-page);
  transition: border-color .15s; box-sizing: border-box;
}
.login-field input:focus { outline: none; border-color: var(--primary); }
.login-btn {
  width: 100%; padding: 11px; background: var(--primary);
  color: #fff; border: none; border-radius: 6px;
  font-size: 14px; font-weight: 700; font-family: var(--font);
  cursor: pointer; margin-top: 8px; transition: background .15s;
}
.login-btn:hover:not(:disabled) { background: var(--primary-dark); }
.login-btn:disabled { opacity: .6; cursor: default; }
.login-error {
  display: none; margin-top: 18px; padding: 14px 16px;
  background: #fff3f3; border: 1px solid #f5c6c6;
  border-radius: 6px; font-size: 13px; color: #c0392b; line-height: 1.6;
}
.login-error strong { display: block; margin-bottom: 4px; font-size: 13.5px; }
.login-error.show { display: block; }
.login-notvip { background: #fff8e1; border-color: #ffe082; color: #7b5800; }
.login-notvip strong { color: #5d4200; }

/* ── Login Gate Overlay ────────────────────────────────────────────────────── */
body.login-gated .main-wrapper,
body.login-gated .sidebar {
  filter: blur(3px);
  opacity: .35;
  pointer-events: none;
  user-select: none;
}

#login-gate {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-gate__card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-page, #F9F9F9);
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
  padding: 32px 28px;
  animation: gateIn .25s ease;
}

@keyframes gateIn {
  from { opacity: 0; transform: translateY(-16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-gate__logo {
  width: 160px;
  display: block;
  margin: 0 auto 24px;
}

/* ── Temas ─────────────────────────────────────────────────────────────────── */

/* Tema Claro — inspirado em Linear / Notion */
html.theme-claro {
  --primary:        #2563EB;
  --primary-light:  #3B82F6;
  --primary-dark:   #1D4ED8;
  --purple:         #7C3AED;
  --orange:         #F59E0B;
  --orange-dark:    #D97706;
  --success:        #10B981;
  --warning:        #F59E0B;
  --link:           #2563EB;
  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --bg-element:     #E2E8F0;
  --bg-section:     #FFFFFF;
  --bg-page:        #E8EDF5;
  --shadow:         0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:      0 4px 16px rgba(0,0,0,.12);
}
html.theme-claro .sidebar { background: #1E3A5F; }
html.theme-claro .sidebar__nav a.active,
html.theme-claro .sidebar__nav a:hover { border-left-color: #F59E0B; }
html.theme-claro .mando-btn.active { background: #F59E0B; border-color: #F59E0B; }

/* Garante branco uniforme em todos os contêineres no tema claro */
html.theme-claro .card,
html.theme-claro .section,
html.theme-claro .topbar,
html.theme-claro .filters,
html.theme-claro .chart-full,
html.theme-claro .chart-box,
html.theme-claro .chart-rodada,
html.theme-claro .donut-box,
html.theme-claro .selector-box,
html.theme-claro .radar-wrap,
html.theme-claro .tabela-wrap-inner,
html.theme-claro .compare-table,
html.theme-claro .info-box       { background: #FFFFFF; border-color: #CBD5E1; }
html.theme-claro .topbar         { border-bottom-color: #CBD5E1; }
html.theme-claro thead th        { background: #F1F5F9; color: var(--text-secondary); border-color: #E2E8F0; }
html.theme-claro tbody tr:nth-child(even) { background: #F8FAFC; }
html.theme-claro tbody tr:hover  { background: #EFF6FF; }
html.theme-claro .badge          { background: #E2E8F0; color: var(--text-secondary); }

/* Tema Escuro — GitHub Dark / VS Code */
html.theme-escuro {
  --primary:        #818CF8;
  --primary-light:  #A5B4FC;
  --primary-dark:   #6366F1;
  --purple:         #C084FC;
  --orange:         #FB923C;
  --orange-dark:    #F97316;
  --success:        #34D399;
  --warning:        #FBBF24;
  --link:           #93C5FD;
  --text-primary:   #E2E8F0;
  --text-secondary: #94A3B8;
  --bg-element:     #334155;
  --bg-section:     #1E293B;
  --bg-page:        #0F172A;
  --shadow:         0 1px 4px rgba(0,0,0,.50);
  --shadow-md:      0 4px 16px rgba(0,0,0,.60);
  background: var(--bg-page);
  color: var(--text-primary);
}
html.theme-escuro .sidebar { background: #1E1E2E; }
html.theme-escuro .mando-btn { color: var(--text-primary); border-color: rgba(255,255,255,.2); }

/* Todas as superfícies brancas */
html.theme-escuro .topbar,
html.theme-escuro .card,
html.theme-escuro .section,
html.theme-escuro .filters,
html.theme-escuro .chart-full,
html.theme-escuro .chart-box,
html.theme-escuro .selector-box,
html.theme-escuro .radar-wrap,
html.theme-escuro .tabela-wrap-inner,
html.theme-escuro .info-box {
  background: #1E293B;
  border-color: #334155;
  color: var(--text-primary);
}
html.theme-escuro .topbar          { border-bottom-color: #334155; }
html.theme-escuro .section__header { border-bottom-color: #334155; }
html.theme-escuro .section__title,
html.theme-escuro .card__value,
html.theme-escuro .card__label,
html.theme-escuro .card__sub,
html.theme-escuro .topbar__title   { color: var(--text-primary); }
html.theme-escuro .topbar__subtitle,
html.theme-escuro .filter-group label { color: var(--text-secondary); }

/* Tabelas */
html.theme-escuro thead th         { background: #1E293B; color: var(--text-secondary); border-color: #334155; }
html.theme-escuro tbody tr         { border-bottom-color: #334155; }
html.theme-escuro tbody tr:hover   { background: #334155; }
html.theme-escuro tbody td         { color: var(--text-primary); }
html.theme-escuro tbody td a       { color: var(--link); }

/* Badges */
html.theme-escuro .badge           { background: #334155; color: var(--text-secondary); }

/* Formulários */
html.theme-escuro select,
html.theme-escuro input[type="number"],
html.theme-escuro input[type="text"] {
  background: #0F172A;
  color: var(--text-primary);
  border-color: #334155;
}
html.theme-escuro select:focus,
html.theme-escuro input:focus      { background: #0F172A; }
html.theme-escuro select option    { background: #1E293B; color: var(--text-primary); }

/* Multi-select */
html.theme-escuro .ms-toggle       { background: #0F172A; color: var(--text-primary); border-color: #334155; }
html.theme-escuro .ms-panel        { background: #1E293B; border-color: #334155; }
html.theme-escuro .ms-item         { color: var(--text-primary); }
html.theme-escuro .ms-item:hover   { background: #334155; }
html.theme-escuro .ms-label        { color: var(--text-primary); }

/* Scouts panel */
html.theme-escuro .scouts-panel    { background: #1E293B; }
html.theme-escuro .scouts-item     { color: var(--text-primary); }
html.theme-escuro .scouts-item:hover { background: #334155; }

/* Botões */
html.theme-escuro .btn--ghost      { color: var(--primary); border-color: var(--primary); }
html.theme-escuro .sortable        { color: var(--text-secondary); }

/* Superfícies não cobertas pela regra geral */
html.theme-escuro .chart-rodada,
html.theme-escuro .donut-box,
html.theme-escuro .compare-table   { background: #1E293B; border-color: #334155; color: var(--text-primary); }

/* Badges semânticos (bom/aviso/ruim) — legíveis no escuro */
html.theme-escuro .tt-badge--good  { background: #14532D; color: #86EFAC; }
html.theme-escuro .tt-badge--warn  { background: #713F12; color: #FDE68A; }
html.theme-escuro .tt-badge--bad   { background: #7F1D1D; color: #FCA5A5; }

/* Cores de valor conquistado/cedido — visíveis no escuro */
html.theme-escuro .val-media       { color: #60A5FA; }
html.theme-escuro .val-cedido      { color: #F87171; }

/* ── Combobox de campeonato na sidebar ────────────────────────────────────── */
.campeonato-select {
  width: 100%;
  background: var(--bg-element);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
}
.campeonato-select:focus { border-color: var(--primary); }

/* ── Mobile menu button & backdrop ───────────────────────────────────────── */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 13px; right: 14px;
  z-index: 301;
  width: 38px; height: 38px;
  border-radius: 8px;
  background: var(--primary);
  border: none;
  color: #fff;
  align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  transition: background .15s;
}
.mobile-menu-btn:hover { background: var(--primary-dark); }

.mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 299;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.mobile-backdrop.open { opacity: 1; pointer-events: auto; }

/* ── Responsivo ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }

  /* Sidebar vira drawer deslizante */
  .sidebar {
    width: 280px;
    height: 100vh;
    height: 100dvh;
    position: fixed;
    top: 0; bottom: auto;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 300;
    border-top: none;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .sidebar.open { transform: translateX(0); }

  /* Restaura elementos do sidebar que estavam ocultos no modo bottom-bar */
  .sidebar__logo { display: flex; }

  /* Nav de volta ao layout coluna */
  .sidebar__nav { flex-direction: column; padding: 16px 0; width: auto; }
  .sidebar__nav a {
    flex: none;
    flex-direction: row;
    gap: 10px;
    padding: 11px 20px;
    font-size: 13.5px;
    border-left: 3px solid transparent;
    border-top: none;
    justify-content: flex-start;
    text-align: left;
  }
  .sidebar__nav a span { opacity: 1; width: auto; }
  .sidebar__nav a.active { border-left-color: var(--orange); border-top: none; }

  /* sidebar-collapsed não se aplica no mobile */
  body.sidebar-collapsed .sidebar { width: 280px; overflow-y: auto; }
  body.sidebar-collapsed .sidebar__logo { justify-content: flex-start; padding: 20px 16px; }
  body.sidebar-collapsed .sidebar__logo img { display: block; }
  body.sidebar-collapsed .sidebar__logo-text { opacity: 1; width: auto; }
  body.sidebar-collapsed .sidebar__nav a { padding: 11px 20px; justify-content: flex-start; gap: 10px; border-left: 3px solid transparent; }
  body.sidebar-collapsed .sidebar__nav a.active { border-left-color: var(--orange); border-right: none; }
  body.sidebar-collapsed .sidebar__nav a span { opacity: 1; width: auto; }
  body.sidebar-collapsed .sidebar__config-body { display: flex; }

  /* Hamburger e backdrop ativos */
  .mobile-menu-btn { display: flex; }
  .mobile-backdrop { display: block; }

  /* Topbar: espaço para o botão hamburger */
  .topbar { padding-right: 64px; }

  .main-wrapper { margin-left: 0 !important; margin-bottom: 0; }
  .content { padding: 16px; overflow-x: hidden; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .cards-row { grid-template-columns: 1fr 1fr; }
  .ms-wrap { min-width: 0; }
  select, input[type="text"] { min-width: 0; width: 100%; }
}

@media (max-width: 480px) {
  .cards-row { grid-template-columns: 1fr; }
  .filters { flex-direction: column; }
}
