/* ============================================================
   JARAGUÁ PELADAS — design system v2
   DNA extraído do ative.se: Kanit caixa-alta, faixa de liga com
   ano, barra de destaque nos títulos, headers de tabela sólidos,
   canvas cinza-claro + cards brancos, verde #35ad79 / amarelo #fcef57.
   ============================================================ */

@font-face { font-family:'Kanit'; font-weight:400; font-style:normal; font-display:swap; src:url('../fonts/kanit-400.woff2') format('woff2'); }
@font-face { font-family:'Kanit'; font-weight:500; font-style:normal; font-display:swap; src:url('../fonts/kanit-500.woff2') format('woff2'); }
@font-face { font-family:'Kanit'; font-weight:600; font-style:normal; font-display:swap; src:url('../fonts/kanit-600.woff2') format('woff2'); }
@font-face { font-family:'Kanit'; font-weight:700; font-style:normal; font-display:swap; src:url('../fonts/kanit-700.woff2') format('woff2'); }
@font-face { font-family:'Kanit'; font-weight:800; font-style:normal; font-display:swap; src:url('../fonts/kanit-800.woff2') format('woff2'); }

:root {
  --ink: #151515;
  --ink-2: #2c2d31;
  --ink-3: #424349;
  --green: #35ad79;
  --green-strong: #2c9367;
  --green-deep: #0e5c46;
  --green-soft: #e2f4ec;
  --sand: #fcef57;
  --sand-soft: #fdf8d9;
  --blue: #3b7cc0;
  --blue-soft: #e3edf7;
  --danger: #dc3545;
  --danger-soft: #fbe5e8;
  --amber: #e8a413;
  --amber-soft: #fdf3dc;
  --canvas: #edeff4;
  --card: #ffffff;
  --line: #e1e4ea;
  --txt: #23262b;
  --muted: #707279;
  --muted-2: #9b9b9b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(21,21,21,.05), 0 4px 14px rgba(21,21,21,.06);
  --shadow-lg: 0 8px 30px rgba(21,21,21,.14);
  --pelada: var(--green-deep);      /* recolorida por pelada via JS */
  --pelada-accent: var(--green);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Kanit', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--canvas);
  color: var(--txt);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.mono, .money { font-variant-numeric: tabular-nums; }
.up { text-transform: uppercase; letter-spacing: .06em; }
.muted { color: var(--muted); }

/* ---------- boot ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 16px;
  background: var(--ink); color: #fff; font-weight: 700; letter-spacing: .35em; font-size: 13px; }
.boot-ring { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--green); border-top-color: transparent; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   SHELL
   ============================================================ */
.shell { min-height: 100vh; display: flex; flex-direction: column; }

/* topbar preto (marca da plataforma) */
.topbar { background: var(--ink); color: #fff; }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: baseline; gap: 8px; font-weight: 800; font-size: 17px; letter-spacing: .04em; }
.brand .dot-se { color: var(--green); }
.brand small { font-weight: 500; font-size: 10.5px; color: var(--muted-2); letter-spacing: .28em; text-transform: uppercase; }
.topbar .spacer { flex: 1; }

/* seletor de papel (admin × peladeiro) */
.role-switch { display: flex; background: var(--ink-2); border-radius: 999px; padding: 3px; gap: 2px; }
.role-switch button { border: 0; background: transparent; color: var(--muted-2); font-weight: 600; font-size: 11.5px;
  padding: 6px 14px; border-radius: 999px; cursor: pointer; text-transform: uppercase; letter-spacing: .08em; }
.role-switch button.on { background: var(--green); color: #06281c; }

/* faixa da liga (padrão ative.se: nome + ano) */
.league {
  background: linear-gradient(100deg, var(--pelada) 0%, color-mix(in srgb, var(--pelada) 72%, #000) 100%);
  color: #fff; position: relative; overflow: hidden;
}
.league::after { /* chevron decorativo */
  content: ""; position: absolute; right: -60px; top: -40px; width: 300px; height: 220px;
  background: rgba(255,255,255,.05); transform: skewX(-18deg);
}
.league-in { max-width: 1120px; margin: 0 auto; padding: 20px 20px 16px; display: flex; align-items: flex-end; gap: 16px; position: relative; }
.league h1 { margin: 0; font-size: clamp(24px, 4.4vw, 34px); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; line-height: 1.05; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.league h1 .chev { font-size: .55em; opacity: .7; transform: translateY(2px); }
.league .sub { font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; opacity: .75; margin-top: 2px; }
.league .year { margin-left: auto; font-size: clamp(26px, 4.4vw, 36px); font-weight: 800; letter-spacing: .06em; opacity: .95; }

/* nav horizontal (barra escura, item ativo) */
.mainnav { background: color-mix(in srgb, var(--pelada) 55%, #10100f); position: sticky; top: 0; z-index: 40; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.mainnav-in { max-width: 1120px; margin: 0 auto; padding: 0 12px; display: flex; overflow-x: auto; scrollbar-width: none; }
.mainnav-in::-webkit-scrollbar { display: none; }
.mainnav button {
  border: 0; background: transparent; color: rgba(255,255,255,.72); cursor: pointer; white-space: nowrap;
  font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .1em;
  padding: 14px 16px 12px; border-bottom: 3px solid transparent;
}
.mainnav button:hover { color: #fff; }
.mainnav button.on { color: #fff; border-bottom-color: var(--sand); }

/* main */
.main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 22px 20px 80px; }

/* ============================================================
   COMPONENTES
   ============================================================ */

/* título de seção com barra de destaque (ative.se) */
.sec { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.sec:first-child { margin-top: 2px; }
.sec::before { content: ""; width: 5px; height: 22px; background: var(--pelada-accent); border-radius: 2px; }
.sec h2 { margin: 0; font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-2); }
.sec .aux { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 18px; }

/* aviso amarelo (padrão "Em configuração" do ative.se) */
.notice { background: var(--sand-soft); border: 1px solid #efe6a8; color: #6b5d0d; padding: 12px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 500; }

/* KPI hero escuro (DNA da landing) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; position: relative; overflow: hidden; }
.kpi.dark { background: linear-gradient(120deg, #191a1c, #232a27); border-color: #2c2d31; color: #fff; }
.kpi .k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.kpi.dark .k { color: #8fa39a; }
.kpi .v { font-size: 30px; font-weight: 800; letter-spacing: .01em; margin-top: 2px; line-height: 1.1; }
.kpi.dark .v { color: var(--green); }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 3px; font-weight: 500; }
.kpi.dark .s { color: #9aa8a1; }
.kpi .v.bad { color: var(--danger); }
.kpi .v.warn { color: var(--amber); }
.kpi .tag { position: absolute; top: 12px; right: 12px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.chip.green { background: var(--green-soft); color: var(--green-deep); }
.chip.red { background: var(--danger-soft); color: #8f1622; }
.chip.amber { background: var(--amber-soft); color: #7c5806; }
.chip.blue { background: var(--blue-soft); color: #235284; }
.chip.gray { background: #eceef1; color: #555a63; }
.chip.sand { background: var(--sand-soft); color: #6b5d0d; }
.chip.solid-green { background: var(--green); color: #06281c; }

/* botões (outline ative.se + sólido) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .1em;
  padding: 11px 18px; border-radius: 8px; border: 1px solid transparent; transition: .12s; }
.btn.primary { background: var(--green); color: #06281c; }
.btn.primary:hover { background: var(--green-strong); color: #fff; }
.btn.outline { background: transparent; border-color: #c8ccd4; color: var(--ink-2); }
.btn.outline:hover { border-color: var(--ink-2); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.sm { padding: 7px 12px; font-size: 11px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }

/* ============================================================
   TABELAS (header sólido, zebra — padrão ative.se)
   ============================================================ */
.tbl-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--card); }
table.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl thead th {
  background: var(--pelada); color: #fff; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .1em; padding: 11px 12px; text-align: left; white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.tbl tbody td { padding: 10px 12px; border-top: 1px solid var(--line); white-space: nowrap; }
.tbl tbody tr:nth-child(even) { background: #f7f9fb; }
.tbl tbody tr:hover { background: var(--green-soft); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .ctr { text-align: center; }

/* avatar */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-content: center;
  font-weight: 700; font-size: 12px; color: #fff; background: var(--ink-3); flex: none; letter-spacing: .02em; }

/* nome do atleta em tabelas */
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who b { font-weight: 600; font-size: 14px; }
.who small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; }

/* ============================================================
   GRADE DE 12 MENSALIDADES (o coração)
   ============================================================ */
.grid-wrap { overflow: auto; max-height: 66vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
table.mgrid { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 860px; width: 100%; }
.mgrid thead th {
  background: var(--pelada); color: #fff; font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  padding: 10px 6px; text-align: center; position: sticky; top: 0; z-index: 3;
}
.mgrid thead th.name-col { text-align: left; padding-left: 14px; left: 0; z-index: 4; }
.mgrid tbody td { padding: 5px 4px; border-top: 1px solid var(--line); text-align: center; }
.mgrid tbody td.name-col {
  text-align: left; padding: 7px 10px 7px 14px; position: sticky; left: 0; background: var(--card); z-index: 2;
  border-right: 1px solid var(--line); min-width: 172px; max-width: 210px; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.mgrid tbody tr:nth-child(even) td.name-col { background: #f7f9fb; }
.mgrid tbody tr:nth-child(even) { background: #f7f9fb; }
.mgrid tbody tr:hover td.name-col, .mgrid tbody tr:hover { background: var(--green-soft); }
.mgrid td.tot { font-weight: 700; font-variant-numeric: tabular-nums; padding-right: 12px; text-align: right; }

/* célula da grade */
.cell { width: 34px; height: 30px; border-radius: 7px; border: 0; cursor: pointer; font-family: inherit;
  font-weight: 700; font-size: 11.5px; display: inline-grid; place-content: center; transition: transform .08s; }
.cell:active { transform: scale(.9); }
.cell.pago { background: var(--green); color: #fff; }
.cell.pend { background: #fff; border: 1.6px dashed #d3707c; color: var(--danger); }
.cell.pend.future { border-color: #ccd0d7; color: #b6bac2; }
.cell.na { background: transparent; color: #c3c7cd; cursor: default; }
.cell.isento { background: var(--blue-soft); color: #4a76a3; cursor: default; }
.cell.parcial { background: var(--amber); color: #fff; font-size: 10px; }

/* legenda */
.legend { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 12px; color: var(--muted); padding: 10px 2px; font-weight: 500; }
.legend .cell { transform: scale(.85); cursor: default; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* barra de progresso */
.progress { height: 8px; border-radius: 999px; background: #e3e6ec; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--green); border-radius: 999px; }

/* mini gráfico de barras 12m */
.bars12 { display: flex; gap: 6px; align-items: flex-end; height: 110px; padding-top: 6px; }
.bars12 .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.bars12 .stack { position: relative; width: 100%; max-width: 34px; height: 100%; display: flex; align-items: flex-end; }
.bars12 .esp { position: absolute; bottom: 0; width: 100%; background: #e3e6ec; border-radius: 5px 5px 0 0; }
.bars12 .arr { position: relative; width: 100%; background: var(--green); border-radius: 5px 5px 0 0; min-height: 2px; }
.bars12 small { font-size: 9.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; }

/* ============================================================
   FORM / SHEET
   ============================================================ */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cdd1d9; border-radius: 8px; font-size: 15px; font-family: inherit; background: #fff; color: var(--txt); }
.field input:focus, .field select:focus { outline: 2px solid var(--green); border-color: transparent; }
.frow { display: flex; gap: 12px; } .frow > * { flex: 1; }

.scrim { position: fixed; inset: 0; background: rgba(21,21,21,.55); z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 720px) { .scrim { align-items: center; } }
.sheet { width: 100%; max-width: 520px; background: #fff; border-radius: 14px 14px 0 0; padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; animation: up .2s ease; }
@media (min-width: 720px) { .sheet { border-radius: 14px; } }
@keyframes up { from { transform: translateY(26px); opacity: .5; } }
.sheet h3 { margin: 2px 0 14px; font-size: 17px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; display:flex; align-items:center; gap:10px; }
.sheet h3::before { content: ""; width: 5px; height: 20px; background: var(--pelada-accent); border-radius: 2px; }

/* toggle */
.tgl { width: 44px; height: 26px; border-radius: 999px; background: #cfd3da; border: 0; cursor: pointer; position: relative; transition: background .15s; flex: none; }
.tgl.on { background: var(--green); }
.tgl::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.tgl.on::after { transform: translateX(18px); }

/* seg control claro */
.seg { display: inline-flex; background: #e3e6ec; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: #fff; color: var(--green-deep); box-shadow: var(--shadow); }

/* pódio / ranking simples */
.rankrow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.rankrow:first-child { border-top: 0; }
.rankrow .pos { width: 30px; height: 30px; border-radius: 8px; display: grid; place-content: center; font-weight: 800; font-size: 13px; background: #eceef1; color: var(--ink-3); flex: none; }
.rankrow .pos.p1 { background: var(--sand); color: #6b5d0d; }
.rankrow .grow { flex: 1; min-width: 0; }
.rankrow .val { font-weight: 800; font-variant-numeric: tabular-nums; }

/* switcher de peladas */
.pel-opt { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 9px; cursor: pointer; }
.pel-opt:hover { background: var(--canvas); }
.pel-opt .swatch { width: 14px; height: 26px; border-radius: 4px; flex: none; }
.pel-opt b { font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: 13.5px; }
.pel-opt small { display: block; color: var(--muted); font-size: 11.5px; }
.pel-opt.on { background: var(--green-soft); }

/* util */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .grid3 { grid-template-columns: 1fr; } }
.row-flex { display: flex; align-items: center; gap: 12px; }
.mt8{margin-top:8px}.mt16{margin-top:16px}.mb8{margin-bottom:8px}
.right { text-align: right; }
.empty { padding: 42px 20px; text-align: center; color: var(--muted); font-weight: 500; }
.empty .big { font-size: 30px; margin-bottom: 6px; }

footer.app-foot { text-align: center; padding: 26px 0 40px; color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .2em; font-weight: 500; }
