:root {
    --bg: #010714;
    --bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(28,125,240,0.10), transparent 60%),
               radial-gradient(900px 500px at -10% 0%, rgba(14,95,207,0.08), transparent 60%);
    /* superfícies translúcidas — ~10% de transparência, deixam o fundo da marca aparecer */
    --panel: rgba(7, 18, 42, 0.90);
    --panel-2: rgba(13, 27, 56, 0.90);
    --panel-hover: rgba(20, 38, 72, 0.90);
    --text: #f1f5f9;
    --text-2: #eaf1fa;
    --muted: #c3cedd;
    --muted-2: #93a1b5;
    --accent: #1c7df0;
    --accent-hover: #0e5fcf;
    /* Verde de destaque da marca (igual ao site oficial) — usado em botões e regressiva */
    --green: #05e0a3;
    --green-hover: #04c490;
    --on-green: #04132f;
    --danger: #ef4444;
    --border: rgba(148, 163, 184, 0.10);
    --border-strong: rgba(148, 163, 184, 0.20);
    --shadow: 0 1px 3px rgba(0,0,0,0.35), 0 4px 12px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
    margin: 0;
    position: relative;   /* ancora a camada de fundo */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02', 'cv11';
}

/* Camada de fundo (constelação): cobre toda a altura do documento e rola
   junto com o conteúdo (position: absolute, não fixed). */
#bg-image {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('/static/bg-integracao.png');
    background-size: 100% auto;
    background-position: top center;
    background-repeat: repeat-y;
    z-index: -1;
    pointer-events: none;
    filter: brightness(0.9);
}
/* Overlay escuro sobre a imagem de fundo (deixa tudo mais escuro de forma uniforme) */
#bg-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(1, 7, 20, 0.22);
    pointer-events: none;
}

/* Garante que o atributo hidden sempre esconda (mesmo com display flex/grid) */
[hidden] { display: none !important; }

/* Evita vazamento horizontal da página (scroll lateral indesejado) */
html, body { overflow-x: hidden; max-width: 100%; }

/* Fundo plexus neon: atrás de tudo, sutil, não interativo */
#plexus {
    display: none;   /* substituído pelo bg.jpg estático */
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.55;
}

/* Itens de grid/flex encolhem corretamente (sem forçar overflow pelo conteúdo) */
.chart-box, .card, .compare-box, .goal-mini, .record-card, .badge-card,
.cards > *, .charts-grid > *, .compare-grid > *, .records-grid > *,
.goals-mini > *, .badge-grid > *, .cal-grid > * { min-width: 0; }
.chart-box canvas { max-width: 100%; }

/* ---------- Nav ---------- */
.nav {
    background: rgba(5, 8, 16, 0.82);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
    padding-top: env(safe-area-inset-top);
}
.nav-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    text-decoration: none;
}
.brand svg { color: var(--accent); }
.brand-logo { height: 28px; width: auto; display: block; }
.brand-logo-full { height: 30px; width: auto; display: block; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a {
    color: var(--text-2);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 7px 11px;
    border-radius: 8px;
    transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--text); background: rgba(148, 163, 184, 0.08); }
.nav-links a.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.18);
    box-shadow: inset 0 0 0 1px rgba(59,130,246,0.35);
}

/* Athlete switcher dropdown */
.athlete-switch { position: relative; }
.athlete-switch summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 7px 12px;
    border-radius: 8px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    transition: background .15s, border-color .15s;
}
.athlete-switch summary::-webkit-details-marker { display: none; }
.athlete-switch summary:hover { background: var(--panel-hover); border-color: var(--border-strong); }
.athlete-switch[open] summary { background: var(--panel-hover); }
.athlete-switch summary svg:first-child { color: var(--muted); }
.dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--panel);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.45);
    min-width: 200px;
    padding: 4px;
    z-index: 50;
}
.dropdown form { margin: 0; }
.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-2);
    font: inherit;
    font-size: 0.9rem;
    text-align: left;
    padding: 8px 12px;
    border-radius: 7px;
    cursor: pointer;
    text-decoration: none;
}
.dropdown-item:hover { background: var(--panel-hover); color: var(--text); }
.dropdown-item.active { color: var(--text); }
.dropdown-item.active svg { color: var(--accent); }
.dropdown-item:last-child {
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 10px;
    color: var(--muted);
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 28px 80px;
}

/* ---------- Page header ---------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.page-title {
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    color: #ffffff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.55);
}
.page-sub {
    color: #e8eef7;
    margin: 6px 0 0;
    font-size: 0.95rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.streak-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(249,115,22,0.15), rgba(239,68,68,0.10));
    border: 1px solid rgba(249,115,22,0.3);
    color: #fdba74;
    padding: 8px 14px;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 500;
}
.streak-pill strong { color: #fff; font-weight: 700; }

.db-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 500;
    border: 1px solid;
}
.db-ok {
    background: rgba(16,185,129,0.10);
    border-color: rgba(16,185,129,0.30);
    color: #34d399;
}
.db-warn {
    background: rgba(239,68,68,0.10);
    border-color: rgba(239,68,68,0.30);
    color: #f87171;
}

/* ---------- Range tabs ---------- */
.range-tabs {
    display: inline-flex;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    gap: 2px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}
.range-tab {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 7px;
    white-space: nowrap;
    transition: color .15s, background .15s;
}
.range-tab:hover { color: var(--text); background: rgba(148,163,184,0.06); }
.range-tab.active {
    color: var(--text);
    background: var(--panel-hover);
    box-shadow: inset 0 0 0 1px var(--border-strong);
}
.range-tab .rt-short { display: none; }

/* Barra de períodos que cabe sem rolagem (distribui igualmente) */
.range-tabs-fit { display: flex; width: 100%; }
.range-tabs-fit .range-tab {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    padding: 7px 6px;
}

/* ---------- Stat cards ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 22px;
    position: relative;
    overflow: hidden;
    transition: transform .15s ease, border-color .15s ease;
    box-shadow: var(--shadow);
}
.card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 60%, rgba(255,255,255,0.02));
    pointer-events: none;
}

.card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}
.card-icon svg { width: 20px; height: 20px; }

.card-run .card-icon { background: rgba(59,130,246,0.15); color: #60a5fa; }
.card-swim .card-icon { background: rgba(6,182,212,0.15); color: #22d3ee; }
.card-cal .card-icon { background: rgba(249,115,22,0.15); color: #fb923c; }
.card-days .card-icon { background: rgba(16,185,129,0.15); color: #34d399; }
.card-gym .card-icon { background: rgba(239,68,68,0.15); color: #f87171; }
.card-trail .card-icon { background: rgba(132,204,22,0.15); color: #a3e635; }
.card-bike .card-icon { background: rgba(234,179,8,0.15); color: #facc15; }

.card-label {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 6px;
}
.card-value {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text);
}
.card-value span {
    font-size: 0.95rem;
    color: var(--muted);
    font-weight: 500;
    margin-left: 2px;
}
.card-foot {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.82rem;
}
.card-foot strong { color: var(--text-2); font-weight: 600; }

/* ---------- Onboarding: importar do Strava ---------- */
/* ---------- Card oficial da prova (hero + regressiva) ---------- */
.race-hero {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(28,125,240,0.35);
    background:
        radial-gradient(900px 320px at 85% -40%, rgba(28,125,240,0.30), transparent 60%),
        linear-gradient(135deg, rgba(10,42,107,0.92), rgba(4,19,47,0.92));
    box-shadow: 0 8px 30px rgba(0,0,0,0.35);
    padding: 26px 24px;
    margin-bottom: 24px;
    text-align: center;
}
.race-hero-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--green);
    background: rgba(5,224,163,0.12);
    border: 1px solid rgba(5,224,163,0.35);
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 10px;
}
.race-hero-title { margin: 0 0 4px; font-size: 1.55rem; font-weight: 800; }
.race-hero-meta { margin: 0 0 18px; color: var(--text-2); font-size: 0.92rem; }
.countdown {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}
.cd-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 64px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 10px 6px;
}
.cd-num { font-size: 1.8rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--green); }
.cd-lab { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 6px; }
.cd-sep { font-size: 1.6rem; font-weight: 800; color: var(--muted-2); align-self: center; }
.cd-live { font-size: 1.2rem; font-weight: 800; color: var(--green); }
.race-hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-inscricao { font-weight: 700; padding: 12px 28px; }
@media (max-width: 560px) {
    .race-hero-title { font-size: 1.3rem; }
    .cd-unit { min-width: 0; flex: 1; padding: 8px 2px; }
    .cd-num { font-size: 1.4rem; }
    .cd-sep { display: none; }
    .countdown { gap: 6px; }
    .race-hero-actions { width: 100%; }
    .race-hero-actions a { flex: 1; }
}

.onboard-card {
    display: flex;
    align-items: center;
    gap: 18px;
    background: linear-gradient(135deg, rgba(59,130,246,0.14), rgba(168,85,247,0.08));
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 16px;
    padding: 22px;
    margin-bottom: 24px;
}
.onboard-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 14px;
    background: rgba(59,130,246,0.2);
    color: #93c5fd;
    display: flex;
    align-items: center;
    justify-content: center;
}
.onboard-icon svg { width: 26px; height: 26px; }
.onboard-body h2 { margin: 0 0 6px; font-size: 1.15rem; }
.onboard-body p { margin: 0 0 14px; color: var(--text-2); font-size: 0.92rem; line-height: 1.5; }

/* Passo a passo (steps numerados) */
.steps { display: flex; flex-direction: column; gap: 12px; }
.step {
    display: flex;
    gap: 14px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: var(--shadow);
}
.step-num {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.step-body strong { display: block; color: var(--text); font-size: 0.95rem; margin-bottom: 3px; }
.step-body p { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.step-body a { color: var(--accent); }
.step-body code {
    background: var(--panel-2);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--text-2);
}

.install-banner { position: relative; }
.banner-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.banner-close:hover { color: var(--text); }
.kbd {
    display: inline-block;
    background: var(--panel-2);
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    padding: 0 7px;
    font-weight: 700;
}

@media (max-width: 640px) {
    .onboard-card { flex-direction: column; text-align: center; }
}

/* ---------- Próximas provas ---------- */
.race-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, rgba(249,115,22,0.14), rgba(234,179,8,0.08));
    border: 1px solid rgba(249,115,22,0.3);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 24px;
    text-decoration: none;
    color: inherit;
    transition: transform .1s;
}
.race-banner:hover { transform: translateY(-2px); }
.race-banner-count, .race-count {
    flex-shrink: 0;
    width: 64px;
    text-align: center;
    line-height: 1;
}
.race-days { display: block; font-size: 1.9rem; font-weight: 800; color: #fb923c; letter-spacing: -0.03em; }
.race-days-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; }
.race-banner-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.race-banner-name { font-size: 1.05rem; font-weight: 600; color: var(--text); margin: 2px 0; }
.race-banner-pred { font-size: 0.85rem; color: var(--text-2); }

.race-list { display: flex; flex-direction: column; gap: 14px; }
.race-card {
    display: flex;
    gap: 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: var(--shadow);
}
.race-count {
    border-right: 1px solid var(--border);
    padding-right: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.race-body { flex: 1; min-width: 0; }
.race-name { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.race-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    color: var(--muted);
    font-size: 0.85rem;
    margin: 6px 0;
}
.race-pred {
    background: rgba(234,179,8,0.10);
    border: 1px solid rgba(234,179,8,0.25);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.88rem;
    color: var(--text-2);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}
.race-pred .muted { color: var(--muted); }
.race-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.race-actions form { margin: 0; }
.race-done summary { list-style: none; display: inline-block; }
.race-done summary::-webkit-details-marker { display: none; }
.race-result-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--muted);
}
.race-result-form input {
    width: 56px;
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 7px 8px;
    font: inherit;
    text-align: center;
}

/* ---------- Insights (coach) ---------- */
.insights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}
.insight {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: var(--shadow);
}
.insight-ico {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.insight-ico svg { width: 19px; height: 19px; }
.insight-text { font-size: 0.9rem; color: var(--text-2); line-height: 1.4; }

.pred-base { border-color: rgba(59,130,246,0.4); }

/* ---------- Comparativo de período ---------- */
.compare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.compare-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: var(--shadow);
}
.compare-head {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 14px;
}
.compare-sub { color: var(--muted); font-weight: 400; font-size: 0.8rem; }
.compare-rows { display: flex; flex-direction: column; gap: 10px; }
.compare-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.compare-metric { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.delta {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 100px;
}
.delta-up { background: rgba(16,185,129,0.15); color: #34d399; }
.delta-down { background: rgba(239,68,68,0.15); color: #f87171; }
.delta-flat { background: rgba(148,163,184,0.12); color: var(--muted); }

/* ---------- Seções de painel (metas, recordes) ---------- */
.panel-section { margin-bottom: 28px; }
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
}
.section-head h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.section-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color .15s;
}
.section-link:hover { color: var(--accent); }

/* Metas (barra de progresso) */
.goals-list { display: flex; flex-direction: column; gap: 14px; }
.goals-mini {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}
.goal-card, .goal-mini {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.goal-done { border-color: rgba(16,185,129,0.4); }
.goal-top, .goal-mini-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-2);
}
.goal-mini-top { margin-bottom: 10px; }
.goal-title strong { color: var(--text); }
.goal-period {
    background: var(--panel-2);
    color: var(--muted);
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 100px;
    margin-left: 4px;
}
.goal-bar {
    height: 9px;
    background: var(--panel-2);
    border-radius: 100px;
    overflow: hidden;
}
.goal-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 100px;
    transition: width .4s ease;
}
.goal-done .goal-fill { background: linear-gradient(90deg, #059669, #34d399); }
.goal-foot, .goal-mini-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--muted);
}
.goal-mini-foot { justify-content: flex-start; }
.goal-values { color: var(--text-2); font-weight: 500; }
.goal-pct { font-weight: 600; color: var(--accent); }
.goal-pct.is-done { color: #34d399; }

/* Recordes */
.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}
.record-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.record-label {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 8px;
}
.record-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}
.record-unit { font-size: 0.9rem; color: var(--muted); font-weight: 500; }
.record-sub { font-size: 0.78rem; color: var(--muted-2); margin-top: 4px; }

.section-sub { color: var(--muted); font-size: 0.82rem; }

/* Projeção de meta */
.goal-proj { font-size: 0.78rem; font-weight: 600; }
.proj-ok { color: #34d399; }
.proj-behind { color: #fb923c; }

/* ---------- Conquistas ---------- */
.badge-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--panel-2);
    padding: 2px 9px;
    border-radius: 100px;
    margin-left: 6px;
}
.badge-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.badge-chip {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--panel);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.badge-chip svg { width: 22px; height: 22px; }
.badge-chip-locked { color: var(--muted-2); opacity: 0.45; }

.badge-progress-bar {
    height: 10px;
    background: var(--panel-2);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 24px;
}
.badge-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    border-radius: 100px;
    transition: width .5s ease;
}
.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}
.badge-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 16px;
    text-align: center;
    box-shadow: var(--shadow);
}
.badge-unlocked { border-color: rgba(251,191,36,0.35); }
.badge-locked { opacity: 0.85; }
.badge-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-2);
    color: var(--muted);
}
.badge-icon svg { width: 26px; height: 26px; }
.badge-locked .badge-icon { color: var(--muted-2); }
.badge-title { font-weight: 600; font-size: 0.95rem; color: var(--text); }
.badge-desc { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.badge-share {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-2);
    border-radius: 8px;
    padding: 6px 12px;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.badge-share:hover { background: rgba(59,130,246,0.12); color: var(--text); border-color: var(--accent); }

/* Sheet de compartilhamento de conquista (preview do card 9:16) */
.share-sheet .sheet { max-width: 460px; margin: 0 auto; }
.share-preview-wrap {
    display: flex;
    justify-content: center;
    padding: 4px 0 14px;
}
.share-preview-wrap canvas {
    height: 52vh;
    width: auto;
    max-width: 100%;
    border-radius: 16px;
    box-shadow: 0 14px 44px rgba(0,0,0,0.55);
    touch-action: none;
    cursor: grab;
}
.share-preview-wrap canvas:active { cursor: grabbing; }
.share-hint {
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    margin: 0 0 10px;
}
.share-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-2);
    font-size: 0.9rem;
    padding: 4px 2px 12px;
    cursor: pointer;
}
.share-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.share-actions {
    display: flex;
    gap: 10px;
}
.share-actions > button {
    flex: 1;
    justify-content: center;
}
.share-variants {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 2px 0 12px;
}
.variant-arrow {
    background: var(--panel-2);
    border: 1px solid var(--border-strong);
    color: var(--text);
    width: 38px; height: 38px;
    border-radius: 50%;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}
.variant-arrow:active { background: var(--panel); }
.variant-center { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 90px; }
.variant-label { font-size: 0.85rem; color: var(--text-2); font-weight: 600; }
.variant-dots { display: flex; gap: 6px; }
.variant-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.variant-dot.is-on { background: var(--accent); }
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.badge-bar {
    height: 6px;
    background: var(--panel-2);
    border-radius: 100px;
    overflow: hidden;
    margin: 10px 0 4px;
}
.badge-fill { height: 100%; background: var(--accent); border-radius: 100px; }
.badge-pct { font-size: 0.72rem; color: var(--muted); }

/* ---------- Calendário de treinos ---------- */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.cal-month {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.cal-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    text-align: center;
}
.cal-weekdays, .cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cal-weekdays {
    margin-bottom: 6px;
}
.cal-weekdays span {
    text-align: center;
    font-size: 0.68rem;
    color: var(--muted-2);
    font-weight: 600;
}
.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    border-radius: 7px;
    color: var(--muted);
}
.cal-blank { background: transparent; }
.cal-l0 { background: var(--panel-2); color: var(--muted-2); }
.cal-l1 { background: rgba(59,130,246,0.30); color: #dbeafe; }
.cal-l2 { background: rgba(59,130,246,0.55); color: #fff; }
.cal-l3 { background: rgba(59,130,246,0.78); color: #fff; }
.cal-l4 { background: #2563eb; color: #fff; font-weight: 600; }
.cal-future { opacity: 0.35; }
.cal-today { outline: 2px solid var(--accent); outline-offset: 1px; font-weight: 700; }
/* botão de dia com treino (clicável) */
button.cal-day {
    border: none;
    font: inherit;
    cursor: pointer;
}
.cal-has { cursor: pointer; transition: transform .1s, filter .15s; }
.cal-has:hover { filter: brightness(1.2); }
.cal-has:active { transform: scale(0.92); }

/* Janela com treinos do dia */
.day-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.day-modal[hidden] { display: none; }
.day-modal-box {
    background: var(--panel);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    padding: 22px;
    max-width: 380px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.day-modal-box h3 { margin: 0 0 14px; font-size: 1.1rem; padding-right: 24px; }
.day-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}
.day-item:last-child { border-bottom: none; }
.day-item-info { color: var(--text-2); font-size: 0.9rem; text-align: right; }
.modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.cal-legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
    font-size: 0.8rem;
    color: var(--muted);
}
.cal-legend-scale { display: inline-flex; gap: 4px; }
.cal-legend-scale .cal-day { width: 18px; height: 18px; aspect-ratio: auto; }

.record-ico { display: inline-flex; vertical-align: middle; }
.record-ico svg { width: 15px; height: 15px; }

/* ---------- Ranking ---------- */
.rank-list { display: flex; flex-direction: column; gap: 12px; }
.rank-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 20px;
    box-shadow: var(--shadow);
}
.rank-leader { border-color: rgba(251,191,36,0.45); background: linear-gradient(135deg, rgba(251,191,36,0.06), transparent); }
.rank-me { box-shadow: inset 0 0 0 1px rgba(59,130,246,0.3), var(--shadow); }
.rank-pos {
    font-size: 1.25rem;
    font-weight: 700;
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--panel-2);
    color: var(--muted);
    flex-shrink: 0;
}
.rank-pos-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1a1206; }
.rank-pos-2 { background: linear-gradient(135deg, #e2e8f0, #94a3b8); color: #1e293b; }
.rank-pos-3 { background: linear-gradient(135deg, #d97757, #b45309); color: #1a0f06; }

.ico-inline {
    display: inline-flex;
    vertical-align: -2px;
}
.ico-inline svg { width: 14px; height: 14px; }
.rank-streak .ico-inline svg { width: 13px; height: 13px; }
.rank-body { flex: 1; min-width: 0; }
.rank-name { font-size: 1.1rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.rank-you {
    font-size: 0.7rem;
    background: rgba(59,130,246,0.15);
    color: #60a5fa;
    padding: 1px 7px;
    border-radius: 100px;
    font-weight: 600;
    text-transform: uppercase;
    vertical-align: middle;
}
.rank-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--muted);
    font-size: 0.9rem;
}
.rank-stats strong { color: var(--text-2); }

/* ---------- Charts ---------- */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.chart-wide { grid-column: 1 / -1; }
.chart-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 22px;
    min-height: 300px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}
.chart-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
}
.chart-header h2 {
    margin: 0;
    font-size: 0.98rem;
    color: var(--text);
    font-weight: 600;
    letter-spacing: -0.01em;
}
.chart-sub {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
}
.chart-box canvas { flex: 1; min-height: 0; max-height: 260px; }
.chart-box .table-wrap { flex: 1; overflow: auto; }
@media (max-width: 820px) {
    .charts-grid { grid-template-columns: 1fr; }
    .chart-wide { grid-column: auto; }
}

/* ---------- Table ---------- */
.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.tbl th, .tbl td {
    padding: 9px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; text-align: right; }
.tbl th {
    color: var(--muted);
    font-weight: 500;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tbl tbody tr:hover { background: rgba(148, 163, 184, 0.04); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.row-link { cursor: pointer; }
.tbl tbody tr.row-link:hover { background: rgba(59, 130, 246, 0.08); }

/* seleção múltipla */
.col-check { width: 28px; text-align: center !important; padding-right: 6px !important; }
.col-check input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 14px;
}
.bulk-bar[hidden] { display: none; }
.bulk-count { color: var(--text-2); font-size: 0.92rem; }
.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 9px 16px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.btn-danger:hover { background: #dc2626; }

.tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.tag-run { background: rgba(59,130,246,0.15); color: #60a5fa; }
.tag-swim { background: rgba(6,182,212,0.15); color: #22d3ee; }
.tag-other { background: rgba(168,85,247,0.15); color: #c084fc; }
.tag-gym { background: rgba(239,68,68,0.15); color: #f87171; }
.tag-trail { background: rgba(132,204,22,0.15); color: #a3e635; }
.tag-bike { background: rgba(234,179,8,0.15); color: #facc15; }

/* Athlete cards */
.athlete-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.athlete-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 22px;
    box-shadow: var(--shadow);
    transition: border-color .15s;
}
.athlete-card.is-active { border-color: rgba(59,130,246,0.45); }
.athlete-card > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.athlete-card > header > div {
    display: flex;
    align-items: center;
    gap: 10px;
}
.athlete-card h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.athlete-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}
.badge {
    background: rgba(59,130,246,0.15);
    color: #60a5fa;
    border: 1px solid rgba(59,130,246,0.3);
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-inline {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.form-inline .row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}
.form-inline label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-2);
    font-weight: 500;
}
.form-inline input, .form-inline select {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    font-size: 0.92rem;
}
.form-inline input:focus, .form-inline select:focus {
    outline: none;
    border-color: var(--accent);
}
.form-title {
    margin: 0 0 18px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.btn-small {
    padding: 6px 12px;
    font-size: 0.82rem;
}

@media (max-width: 640px) {
    .athlete-grid { grid-template-columns: 1fr; }
}

/* ---------- Alerts & help ---------- */
.alert {
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 22px;
    border: 1px solid var(--border-strong);
    background: var(--panel);
    box-shadow: var(--shadow);
    line-height: 1.55;
}
.alert code {
    background: var(--panel-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--text-2);
}
.alert-success {
    border-color: rgba(16,185,129,0.35);
    background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(16,185,129,0.02));
}
.alert-success strong { color: #34d399; }
.alert-error {
    border-color: rgba(239,68,68,0.35);
    background: linear-gradient(135deg, rgba(239,68,68,0.08), rgba(239,68,68,0.02));
}
.alert-error strong { color: #f87171; }
.result-list {
    margin: 10px 0 0;
    padding-left: 18px;
    color: var(--text-2);
    font-size: 0.92rem;
}
.result-list li { margin: 2px 0; }
.result-list .muted { color: var(--muted); }

.help-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px 24px;
    margin-top: 24px;
    box-shadow: var(--shadow);
}
.help-box h2 {
    margin: 0 0 12px;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.help-box ol {
    margin: 0;
    padding-left: 22px;
    color: var(--text-2);
    line-height: 1.7;
    font-size: 0.93rem;
}
.help-box li code, .form .hint code, .page-sub code {
    background: var(--panel-2);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--text-2);
}
.help-box .hint { margin-top: 12px; }

input[type="file"] {
    background: var(--panel-2);
    color: var(--text-2);
    border: 1px dashed var(--border-strong);
    border-radius: 8px;
    padding: 14px;
    width: 100%;
    font: inherit;
    font-size: 0.92rem;
    cursor: pointer;
}
input[type="file"]:hover { border-color: var(--accent); background: var(--panel-hover); }

/* ---------- Avatares ---------- */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    object-fit: cover;
    background: var(--panel-2);
    border: 1px solid var(--border-strong);
    flex-shrink: 0;
    overflow: hidden;
    color: var(--text);
    font-weight: 600;
}
.avatar-xs { width: 22px; height: 22px; font-size: 0.7rem; border-width: 0; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.6rem; }
.avatar-placeholder {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: white;
}

.athlete-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.athlete-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.avatar-edit {
    position: relative;
    cursor: pointer;
    display: inline-block;
    line-height: 0;
}
.avatar-edit:hover .avatar-edit-icon { opacity: 1; }
.avatar-edit-icon {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(5, 8, 16, 0.65);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s;
}

/* ---------- Nav ---------- */
.nav-link { display: inline-flex; align-items: center; gap: 6px; }
.nav-link .nav-icon { display: none; }
.athlete-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-name { display: inline-flex; align-items: center; gap: 8px; }

/* Barra de navegação inferior (mobile) — escondida no desktop */
.bottomnav { display: none; }
.bn-item {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--muted);
    font: inherit;
    font-size: 0.56rem;
    font-weight: 500;
    text-decoration: none;
    padding: 4px 0;
    cursor: pointer;
}
.bn-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.bn-item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bn-item.active { color: var(--accent); }
.bn-fab {
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -20px 2px 0;
    box-shadow: 0 6px 18px rgba(59,130,246,0.5);
    text-decoration: none;
}
.bn-fab svg { width: 26px; height: 26px; }

/* Bottom sheet do menu "Mais" */
.sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: flex-end;
}
.sheet-overlay[hidden] { display: none; }
.sheet {
    width: 100%;
    background: var(--panel);
    border-radius: 18px 18px 0 0;
    border-top: 1px solid var(--border-strong);
    padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
    animation: sheetUp .18s ease;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: 100px;
    background: var(--border-strong);
    margin: 8px auto 12px;
}
.sheet-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 8px;
    color: var(--text-2);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    font-size: 0.98rem;
}
.sheet-item:last-child { border-bottom: none; }
.sheet-item svg { width: 20px; height: 20px; color: var(--muted); }
.sheet-item:active { background: var(--panel-2); }
.sheet-item-primary {
    background: rgba(59,130,246,0.12);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 10px;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 6px;
    padding: 14px 12px;
}
.sheet-item-primary svg { color: var(--accent); }

@media (max-width: 720px) {
    .container { padding: 22px 16px 96px; }
    .nav-inner { padding: 10px 14px; }
    .nav-links { display: none; }       /* links migram para a barra inferior */
    .bottomnav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        z-index: 50;
        background: rgba(5, 8, 16, 0.96);
        backdrop-filter: saturate(160%) blur(14px);
        -webkit-backdrop-filter: saturate(160%) blur(14px);
        border-top: 1px solid var(--border);
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        align-items: center;
        justify-content: space-around;
    }
    .athlete-name { max-width: 120px; }

    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .page-title { font-size: 1.45rem; }
    .card-value { font-size: 1.45rem; }
    .card { padding: 16px 18px; }
    .chart-box { padding: 16px; min-height: 260px; }
    .chart-box canvas { max-height: 220px; }
    .form { padding: 18px; }
    .athlete-grid { grid-template-columns: 1fr; gap: 14px; }
    .athlete-card { padding: 16px 18px; }

    /* Tabela com scroll horizontal limpo */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tbl { font-size: 0.82rem; min-width: 460px; }

    /* Range tabs scrollable (filtro de esporte no histórico) */
    .range-tabs { width: 100%; }
    .range-tab { padding: 6px 11px; font-size: 0.82rem; }

    /* Barra de períodos: rótulos curtos, tudo cabe sem rolar */
    .range-tabs-fit { overflow-x: visible; }
    .range-tabs-fit .range-tab { padding: 7px 2px; font-size: 0.74rem; }
    .range-tabs-fit .rt-long { display: none; }
    .range-tabs-fit .rt-short { display: inline; }
}

@media (max-width: 420px) {
    .athlete-name { max-width: 64px; }
}

/* PWA standalone: zera margens superiores que conflitam com a status bar */
@media (display-mode: standalone) {
    body { padding-bottom: env(safe-area-inset-bottom); }
}

.empty { color: var(--muted); font-size: 0.95rem; }
.empty a { color: var(--accent); text-decoration: none; }
.empty a:hover { text-decoration: underline; }

/* ---------- Form ---------- */
.form {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px;
    max-width: 760px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: var(--shadow);
}
.form .row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}
.form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-2);
    font-weight: 500;
}
.form label span em {
    font-style: normal;
    color: var(--muted);
    font-weight: 400;
    font-size: 0.78rem;
    margin-left: 4px;
}
.form input, .form select, .form textarea {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
    font-size: 0.95rem;
    width: 100%;
    transition: border-color .15s, background .15s;
}
.form input:hover, .form select:hover, .form textarea:hover { background: var(--panel-hover); }
.form input:focus, .form select:focus, .form textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--panel-hover);
}
.form textarea { resize: vertical; }
.form .hint {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0;
}
.form .hint code {
    background: var(--panel-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
    color: var(--text-2);
}
.form-foot {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}
.form-foot strong { color: var(--text-2); font-weight: 600; }
.form-foot a { color: var(--accent); text-decoration: none; }
.form-foot a:hover { text-decoration: underline; }

.estimate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(249,115,22,0.10);
    border: 1px solid rgba(249,115,22,0.25);
    color: #fdba74;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 0.88rem;
    width: fit-content;
}
.estimate svg { flex-shrink: 0; }

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
}

/* ---------- Buttons ---------- */
.btn-primary {
    background: var(--green);
    color: var(--on-green);
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    cursor: pointer;
    font: inherit;
    font-size: 0.93rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--green-hover); }
.btn-primary:active { transform: translateY(1px); }

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 9px 16px;
    cursor: pointer;
    font: inherit;
    font-size: 0.93rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

.btn-icon {
    background: transparent;
    color: var(--muted);
    border: none;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    line-height: 0;
    transition: background .15s, color .15s;
}
.btn-icon:hover { color: var(--danger); background: rgba(239, 68, 68, 0.10); }

/* Editar (link) tem hover azul, não vermelho */
a.btn-icon:hover { color: var(--accent); background: rgba(59, 130, 246, 0.10); }

.row-actions {
    display: flex;
    gap: 2px;
    align-items: center;
    justify-content: flex-end;
}
.row-actions form { margin: 0; }

.chart-link {
    text-decoration: none;
    transition: color .15s;
}
.chart-link:hover { color: var(--accent); }

.notes-cell {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}
.ex-count {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 100px;
    background: rgba(239,68,68,0.15);
    color: #f87171;
    text-decoration: none;
    vertical-align: middle;
}
.ex-count:hover { background: rgba(239,68,68,0.25); }

/* Barra de rotinas no detalhe do treino */
.routine-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}
.routine-bar form { display: flex; gap: 6px; margin: 0; flex: 1 1 240px; }
.routine-bar select, .routine-bar input {
    flex: 1;
    min-width: 0;
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    font-size: 0.9rem;
}

/* Dica de progressão (última vez) */
.progress-hint {
    background: rgba(59,130,246,0.10);
    border: 1px solid rgba(59,130,246,0.25);
    color: #93c5fd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.progress-hint strong { color: #bfdbfe; }
.hint-fill {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 3px 10px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

/* Cards de rotina */
.routine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.routine-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.routine-card > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.routine-card h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.routine-card > header form { margin: 0; }
.routine-items { list-style: none; margin: 0; padding: 0; }
.routine-items li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.routine-items li:last-child { border-bottom: none; }
.ri-name { color: var(--text); }
.ri-meta { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }

/* Cards de rotina clicáveis */
.routine-card-link { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .1s; }
.routine-card-link:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.routine-edit-hint { color: var(--accent); font-size: 0.8rem; font-weight: 500; }

/* Edição inline de exercícios da rotina */
.ex-edit-list { display: flex; flex-direction: column; gap: 8px; }
.ex-edit-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    flex-wrap: wrap;
}
.ex-edit-name { flex: 1 1 100%; font-weight: 600; color: var(--text); font-size: 0.92rem; margin-bottom: 2px; }
.ex-edit-row input {
    width: 64px;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 7px 8px;
    font: inherit;
    font-size: 0.9rem;
    text-align: center;
}
.ex-x { color: var(--muted); }
.ex-edit-row .btn-small { padding: 7px 12px; }

.routine-extra { margin-bottom: 24px; }
.routine-extra summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 0.88rem;
    padding: 8px 0;
}
.routine-extra summary:hover { color: var(--text); }


/* Paginação */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.page-info { color: var(--muted); font-size: 0.88rem; }
.is-disabled { opacity: 0.4; pointer-events: none; }

/* IMC no card do atleta */
.imc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: var(--panel-2);
    border-radius: 8px;
}
.imc-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    font-weight: 600;
}
.imc-value { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.imc-cat {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 100px;
}
.imc-peso-normal { background: rgba(16,185,129,0.15); color: #34d399; }
.imc-abaixo-do-peso { background: rgba(59,130,246,0.15); color: #60a5fa; }
.imc-sobrepeso { background: rgba(249,115,22,0.15); color: #fb923c; }
.imc-obesidade { background: rgba(239,68,68,0.15); color: #f87171; }

@media (max-width: 640px) {
    .container { padding: 22px 18px 60px; }
    .nav-inner { padding: 12px 18px; }
    .page-title { font-size: 1.5rem; }
    .card-value { font-size: 1.55rem; }
}

/* ---------- login / registro (telas standalone) ---------- */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(120% 80% at 50% 0%, #0b1530 0%, #050810 60%);
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--border-strong);
    border-radius: 18px;
    padding: 32px 26px calc(28px + env(safe-area-inset-bottom));
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    margin-bottom: 22px;
}
.auth-logo { height: 32px; width: auto; }
.auth-logo-full { height: 46px; width: auto; max-width: 82%; margin-bottom: 4px; }
.auth-title { font-size: 1.5rem; margin: 0 0 6px; }
.auth-sub { color: var(--muted); font-size: 0.92rem; margin: 0 0 20px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; }
.auth-form label span { font-size: 0.85rem; color: var(--text-2); font-weight: 500; }
.auth-form input {
    width: 100%;
    padding: 12px 14px;
    background: var(--panel-2);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    color: var(--text);
    font: inherit;
}
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-btn { width: 100%; justify-content: center; margin-top: 6px; padding: 13px; }
.auth-error {
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.4);
    color: #fca5a5;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.88rem;
    margin-bottom: 16px;
}
.auth-foot { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 18px 0 0; }
.auth-foot a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* ---------- menu da conta ---------- */
.dropdown-head { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.dropdown-name-lg { font-weight: 700; }
.dropdown-code { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.dropdown-code strong { color: var(--accent); letter-spacing: 0.5px; }
.dropdown-item form, .athlete-switch .dropdown form { width: 100%; }
.athlete-switch .dropdown form .dropdown-item { width: 100%; background: none; border: none; cursor: pointer; }

/* ---------- código de amigo ---------- */
.code-card {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: var(--panel-2);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 14px 16px;
}
.code-label { font-size: 0.8rem; color: var(--muted); }
.code-value {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--accent);
    flex: 1;
    white-space: nowrap;
}
.friend-list { display: flex; flex-direction: column; gap: 8px; }
.friend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.friend-name { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.friend-req-actions { display: flex; gap: 8px; align-items: center; }
.friend-req-actions form { display: inline; }
.friend-link { color: var(--text); text-decoration: none; }
.friend-link svg { color: var(--muted); }
.friend-link:hover { color: var(--accent); }
.friend-link:hover svg { color: var(--accent); }

/* perfil resumido do amigo */
.profile-head { display: flex; align-items: center; gap: 14px; }
.rank-name-link { color: inherit; text-decoration: none; }
.rank-name-link:hover { color: var(--accent); text-decoration: underline; }

/* disputa de provas */
.race-dispute {
    margin-top: 8px;
    font-size: 0.88rem;
    color: var(--text-2);
    background: rgba(168, 85, 247, 0.10);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 8px;
    padding: 7px 10px;
}

/* ---------- sininho de notificações ---------- */
.notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 10px;
    color: var(--text-2);
    text-decoration: none;
}
.notif-bell:hover { background: var(--panel-2); color: var(--text); }
.notif-badge {
    position: absolute;
    top: 4px; right: 4px;
    min-width: 17px; height: 17px;
    padding: 0 4px;
    border-radius: 100px;
    background: #ef4444;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--bg);
}
.notif-badge[hidden] { display: none; }

/* ---------- página de notificações ---------- */
.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
}
.notif-item.is-unread { border-color: var(--accent); background: rgba(59,130,246,0.06); }
.notif-ico {
    flex-shrink: 0;
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--panel-2);
    color: var(--accent);
}
.notif-ico svg { width: 20px; height: 20px; }
.notif-trophy .notif-ico { color: #fbbf24; }
.notif-goal .notif-ico, .notif-challenge .notif-ico { color: #34d399; }
.notif-workout .notif-ico { color: #60a5fa; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; }
.notif-text { color: var(--muted); font-size: 0.88rem; margin-top: 2px; }
.notif-actions { display: flex; gap: 8px; margin-top: 10px; }
.notif-actions form { display: inline; }
.notif-link { display: inline-block; margin-top: 8px; color: var(--accent); font-size: 0.85rem; text-decoration: none; font-weight: 600; }

/* confirmação de adicionar amigo (mostra o nome) */
.confirm-card {
    background: var(--panel-2);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 18px;
}
.confirm-who { margin-bottom: 8px; }
.confirm-name { font-size: 1.25rem; font-weight: 800; color: var(--text); }
.confirm-code { font-size: 0.85rem; color: var(--accent); letter-spacing: 0.5px; font-weight: 600; }
.confirm-actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; }

/* ---------- desafios ---------- */
.challenge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.challenge-card {
    background: var(--panel);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.challenge-card.is-done { border-color: rgba(52,211,153,0.5); }
/* Desafios da prova (corridas especiais) */
.challenge-event {
    background: linear-gradient(135deg, rgba(5,224,163,0.10), var(--panel));
    border-color: rgba(5,224,163,0.32);
}
.challenge-event.is-accepted { border-color: rgba(5,224,163,0.6); }
.event-legs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.event-legs li {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.9rem; font-weight: 600; color: var(--text);
    background: rgba(255,255,255,0.04); border: 1px solid var(--border);
    border-radius: 9px; padding: 8px 11px;
}
.event-legs li svg { width: 15px; height: 15px; color: var(--green); flex-shrink: 0; }
/* logo da corrida no lugar do ícone do desafio */
.challenge-icon-logo { background: transparent !important; padding: 0; overflow: hidden; }
.challenge-icon-logo img { width: 100%; height: 100%; object-fit: contain; }
.challenge-head { display: flex; align-items: center; gap: 12px; }
.challenge-icon {
    width: 42px; height: 42px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.challenge-icon svg { width: 22px; height: 22px; }
.challenge-title { display: flex; flex-direction: column; line-height: 1.25; }
.challenge-title strong { font-size: 1.02rem; }
.challenge-sub { font-size: 0.78rem; color: var(--muted); }
.challenge-badge {
    margin-left: auto; display: inline-flex; align-items: center; gap: 4px;
    color: #34d399; font-size: 0.8rem; font-weight: 700; white-space: nowrap;
}
.challenge-badge svg { width: 14px; height: 14px; }
.challenge-meta { color: var(--text-2); font-size: 0.9rem; margin: 0; }
.challenge-progress { display: flex; flex-direction: column; gap: 6px; }
.challenge-nums { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-2); }
.challenge-pct { color: var(--muted); }
.challenge-action { margin-top: auto; }
.challenge-action button { width: 100%; justify-content: center; }

/* disputa (versus) nos desafios */
.dispute-vs { display: flex; align-items: stretch; gap: 8px; }
.dispute-side {
    flex: 1;
    display: flex; flex-direction: column; gap: 3px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
}
.dispute-side.dispute-win { border-color: rgba(251,191,36,0.5); background: rgba(251,191,36,0.08); }
.dispute-who { font-size: 0.82rem; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.dispute-who svg { width: 13px; height: 13px; color: #fbbf24; }
.dispute-res { font-size: 1.05rem; font-weight: 700; }
.dispute-x { align-self: center; color: var(--muted); font-weight: 700; }

.period-share-bar { display: flex; justify-content: center; margin: 0 0 18px; }
.period-share-bar .btn-small { justify-content: center; }

/* botão de compartilhar "chamativo" (voltado pra redes sociais) */
.btn-share-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    color: var(--on-green);
    background: linear-gradient(95deg, var(--green), #16c79a);
    border-radius: 12px;
    padding: 11px 18px;
    box-shadow: 0 4px 14px rgba(5, 224, 163, 0.25);
    transition: filter .15s, transform .1s;
}
.btn-share-cta:hover { filter: brightness(1.06); }
.btn-share-cta:active { transform: translateY(1px); }
.btn-share-cta svg { width: 16px; height: 16px; }
.period-share-bar .btn-share-cta { width: auto; }

/* versão compacta (pill) para a linha de treinos */
.btn-share-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--on-green);
    background: linear-gradient(95deg, var(--green), #16c79a);
    border-radius: 8px;
    padding: 6px 11px;
    white-space: nowrap;
}
.btn-share-row:hover { filter: brightness(1.06); }
.btn-share-row svg { width: 13px; height: 13px; }

/* ---------- Strava ---------- */
.strava-card {
    background: var(--panel-2);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    padding: 20px;
    text-align: center;
}
.btn-strava {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fc4c02;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 13px 22px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: filter .15s;
}
.btn-strava:hover { filter: brightness(1.08); }
/* Botão principal do Strava (header do dashboard) — destaque com glow */
.page-header-actions {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.btn-strava-main {
    padding: 11px 18px;
    font-size: 14px;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(252, 76, 2, 0.35), 0 1px 3px rgba(0,0,0,0.25);
}
.btn-strava-main:hover { filter: brightness(1.12); box-shadow: 0 6px 20px rgba(252, 76, 2, 0.5); }
@media (max-width: 720px) {
    .page-header-actions { width: 100%; }
    .btn-strava-main { flex: 1; }
}
.strava-status {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-weight: 600; color: var(--text); margin-bottom: 4px;
}
.strava-dot { width: 10px; height: 10px; border-radius: 50%; background: #fc4c02; box-shadow: 0 0 8px #fc4c02; }
.strava-actions { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; }
.strava-powered { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.5px; margin: 14px 0 0; text-transform: uppercase; }
.or-divider {
    display: flex; align-items: center; gap: 12px;
    color: var(--muted); font-size: 0.85rem; margin: 22px 0;
}
.or-divider::before, .or-divider::after {
    content: ""; flex: 1; height: 1px; background: var(--border);
}

/* ---------- mapa da rota (Strava) ---------- */
.route-map {
    height: 320px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    background: var(--panel-2);
    z-index: 0;
}
.route-map .leaflet-control-attribution {
    background: rgba(5,8,16,0.7);
    color: var(--muted);
}
.route-map .leaflet-control-attribution a { color: var(--text-2); }

/* ===================== Página da prova (/evento) ===================== */
.event-hero {
    text-align: center;
    padding: 22px 20px;
    margin-bottom: 22px;
    border-radius: 18px;
    border: 1px solid rgba(28,125,240,0.35);
    background:
        radial-gradient(900px 320px at 85% -40%, rgba(28,125,240,0.30), transparent 60%),
        linear-gradient(135deg, rgba(10,42,107,0.92), rgba(4,19,47,0.92));
}
.event-title { margin: 8px 0 4px; font-size: 1.7rem; font-weight: 800; }
.event-sub { margin: 0 0 16px; color: var(--text-2); }
.event-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Abas de percurso */
.route-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.route-tab {
    flex: 1; cursor: pointer; font: inherit; font-weight: 700;
    color: var(--text-2); background: var(--panel-2);
    border: 1px solid var(--border-strong); border-radius: 10px;
    padding: 10px 0; transition: all .15s;
}
.route-tab.is-active { background: var(--green); color: var(--on-green); border-color: var(--green); }
.route-caption { margin: 0 0 10px; color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.route-map {
    position: relative; width: 100%; aspect-ratio: 16 / 11;
    border-radius: 14px; overflow: hidden; border: 1px solid var(--border-strong);
    background: var(--panel-2);
}
.route-map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.route-map #route-leaflet { position: absolute; inset: 0; width: 100%; height: 100%; background: #04132f; }
.route-map .leaflet-container { background: #04132f; }
.route-map .leaflet-control-attribution { font-size: 9px; background: rgba(4,19,47,0.7); color: var(--muted); }
.route-open {
    display: inline-flex; align-items: center; gap: 7px; margin-top: 12px;
    color: var(--green); font-weight: 600; font-size: 0.9rem; text-decoration: none;
}
.route-open svg { width: 16px; height: 16px; }

/* Informações */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.info-card {
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--panel); border: 1px solid var(--border-strong);
    border-radius: 14px; padding: 16px;
}
.info-card .info-ico {
    width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(5,224,163,0.14); color: var(--green);
}
.info-card .info-ico svg { width: 20px; height: 20px; }
.info-card strong { display: block; font-size: 0.98rem; margin-bottom: 2px; }
.info-card p { margin: 0; color: var(--text-2); font-size: 0.88rem; line-height: 1.4; }

/* Kits */
.kit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kit-card {
    background: var(--panel); border: 1px solid var(--border-strong);
    border-radius: 14px; padding: 16px;
}
.kit-name { font-weight: 800; font-size: 1.1rem; margin-bottom: 12px; color: var(--green); }
.kit-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.kit-items li { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text); }
.kit-items li svg { width: 15px; height: 15px; color: var(--green); flex-shrink: 0; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item {
    background: var(--panel); border: 1px solid var(--border-strong);
    border-radius: 12px; padding: 14px 16px;
}
.faq-item summary {
    cursor: pointer; font-weight: 600; list-style: none;
    display: flex; justify-content: space-between; align-items: center;
}
.faq-item summary::after { content: '+'; color: var(--green); font-size: 1.3rem; font-weight: 700; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { margin: 10px 0 0; color: var(--text-2); font-size: 0.9rem; line-height: 1.5; }

/* ===================== Medalhas finisher (/medalhas) ===================== */
.medal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.medal-card {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    background: var(--panel); border: 1px solid var(--border-strong);
    border-radius: 16px; padding: 20px 18px; text-align: center;
}
.medal-card.is-earned {
    background: linear-gradient(160deg, rgba(5,224,163,0.12), var(--panel));
    border-color: rgba(5,224,163,0.4);
}
.medal-disc {
    position: relative; width: 92px; height: 92px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--panel-2); border: 2px solid var(--border-strong); color: var(--muted-2);
}
.medal-card.is-earned .medal-disc {
    background: radial-gradient(circle at 50% 35%, rgba(5,224,163,0.35), rgba(5,224,163,0.08));
    border-color: var(--green); color: var(--green);
    box-shadow: 0 0 24px rgba(5,224,163,0.3);
}
.medal-disc svg { width: 40px; height: 40px; }
.medal-dist {
    position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
    font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em;
    background: var(--green); color: var(--on-green);
    padding: 2px 10px; border-radius: 999px;
}
.medal-card:not(.is-earned) .medal-dist { background: var(--muted-2); color: #0b1220; }
.medal-body { min-height: 48px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.medal-time { font-size: 1.8rem; font-weight: 800; color: var(--text); }
.medal-meta { font-size: 0.8rem; color: var(--text-2); }
.medal-locked { font-size: 0.88rem; color: var(--text-2); margin: 0; line-height: 1.4; }
.medal-card .btn-share-cta, .medal-card .btn-ghost { width: 100%; justify-content: center; }

/* ===================== Plano de treino (/plano) ===================== */
.plan-status {
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--panel); border: 1px solid var(--border-strong);
    border-radius: 14px; padding: 16px; margin-bottom: 20px;
}
.plan-status .info-ico {
    width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(5,224,163,0.14); color: var(--green);
}
.plan-status .info-ico svg { width: 20px; height: 20px; }
.plan-status strong { display: block; margin-bottom: 2px; }
.plan-status p { margin: 0; color: var(--text-2); font-size: 0.88rem; line-height: 1.45; }

.plan-weeks { display: flex; flex-direction: column; gap: 12px; }
.plan-week {
    background: var(--panel); border: 1px solid var(--border-strong);
    border-radius: 14px; padding: 16px; opacity: 0.92;
}
.plan-week.is-current {
    border-color: var(--green); opacity: 1;
    background: linear-gradient(160deg, rgba(5,224,163,0.10), var(--panel));
    box-shadow: 0 0 20px rgba(5,224,163,0.15);
}
.plan-week.is-taper { border-style: dashed; }
.plan-week-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.plan-week-no {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 58px; height: 58px; flex-shrink: 0; border-radius: 12px;
    background: var(--panel-2); border: 1px solid var(--border-strong);
}
.plan-week.is-current .plan-week-no { background: var(--green); border-color: var(--green); }
.pw-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.plan-week.is-current .pw-label { color: var(--on-green); }
.pw-num { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.plan-week.is-current .pw-num { color: var(--on-green); }
.plan-week-focus { display: flex; flex-direction: column; line-height: 1.3; }
.plan-week-focus strong { font-size: 1rem; }
.plan-week-focus span { font-size: 0.82rem; color: var(--muted); }
.plan-week-head .challenge-badge { margin-left: auto; color: var(--green); }
.plan-sessions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.plan-sessions li {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    font-size: 0.9rem; color: var(--text-2);
}
.ps-day {
    flex-shrink: 0; min-width: 58px; text-align: center;
    font-size: 0.72rem; font-weight: 800; letter-spacing: 0.02em;
    color: var(--on-green); background: var(--green);
    border-radius: 7px; padding: 4px 8px;
}
.ps-cat {
    flex-shrink: 0; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
    color: var(--green); background: rgba(5,224,163,0.12);
    border: 1px solid rgba(5,224,163,0.28); border-radius: 7px; padding: 4px 8px;
}
.ps-desc { flex: 1; min-width: 140px; }
.plan-note { margin: 12px 0 0; font-size: 0.78rem; color: var(--muted); line-height: 1.4; }

/* Banner "caminho até aqui" (topo do dashboard) */
.path-banner {
    display: flex; align-items: center; gap: 14px;
    background: linear-gradient(135deg, rgba(5,224,163,0.12), var(--panel));
    border: 1px solid rgba(5,224,163,0.30);
    border-radius: 14px; padding: 16px 18px; margin-bottom: 22px;
}
.path-banner .path-ico {
    width: 44px; height: 44px; flex-shrink: 0; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(5,224,163,0.16); color: var(--green);
}
.path-banner .path-ico svg { width: 22px; height: 22px; }
.path-banner p { margin: 0; color: var(--text); font-size: 0.98rem; line-height: 1.4; }

/* Seletor de formato do card de compartilhamento + dica de hashtag */
.share-format { display: flex; gap: 8px; justify-content: center; margin: 12px 0 4px; }
.fmt-btn {
    cursor: pointer; font: inherit; font-size: 0.82rem; font-weight: 700;
    color: var(--text-2); background: var(--panel-2);
    border: 1px solid var(--border-strong); border-radius: 999px; padding: 7px 16px;
    transition: all .15s;
}
.fmt-btn.is-active { background: var(--green); color: var(--on-green); border-color: var(--green); }
.share-tag-hint { text-align: center; margin: 12px 0 0; color: var(--text-2); font-size: 0.85rem; }
.share-tag-hint strong { color: var(--green); }

/* Slider de zoom da foto no card de compartilhamento */
.share-zoom { display: flex; align-items: center; gap: 10px; margin: 6px 2px 2px; }
.share-zoom .zoom-ico { color: var(--muted); font-weight: 800; font-size: 1.1rem; width: 16px; text-align: center; }
.share-zoom input[type="range"] {
    flex: 1; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 999px;
    background: var(--border-strong); outline: none;
}
.share-zoom input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%;
    background: var(--green); cursor: pointer; border: 2px solid #04132f;
}
.share-zoom input[type="range"]::-moz-range-thumb {
    width: 20px; height: 20px; border-radius: 50%; background: var(--green); cursor: pointer; border: 2px solid #04132f;
}

/* Medalhas dos voos (combos) */
.flight-legs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 6px; }
.flight-leg {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.78rem; font-weight: 700;
    color: var(--muted-2); background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-strong); border-radius: 8px; padding: 4px 9px;
}
.flight-leg.is-ok { color: var(--green); background: rgba(5,224,163,0.12); border-color: rgba(5,224,163,0.35); }
.flight-leg svg { width: 13px; height: 13px; }

/* Dia de evento no calendário (Integramóvel etc) */
.cal-day.cal-event {
    position: relative; color: var(--on-green); font-weight: 800;
    background: var(--green); border: 1px solid var(--green); cursor: pointer;
}
.cal-event-ico {
    position: absolute; top: -6px; right: -6px; width: 16px; height: 16px;
    background: #f59e0b; color: #1a1205; border-radius: 50%;
    font-size: 11px; font-weight: 900; line-height: 16px; text-align: center;
    box-shadow: 0 0 0 2px var(--bg);
}
.event-note {
    margin: 0; font-size: 1rem; line-height: 1.5; color: var(--text);
    background: rgba(5,224,163,0.1); border: 1px solid rgba(5,224,163,0.3);
    border-radius: 12px; padding: 16px;
}

/* Autocomplete de amigos */
.ac-wrap { position: relative; }
.ac-list {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
    background: var(--panel-2); border: 1px solid var(--border-strong);
    border-radius: 10px; overflow: hidden; box-shadow: var(--shadow);
}
.ac-item {
    display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left;
    background: transparent; border: none; cursor: pointer; padding: 10px 14px; color: var(--text);
}
.ac-item:hover { background: var(--panel-hover); }
.ac-item strong { font-size: 0.95rem; font-weight: 600; }
.ac-item span { font-size: 0.8rem; color: var(--green); }
