@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* =====================================================
   1. TOKENS  (paleta original preservada)
   ===================================================== */
:root {
    /* Marca */
    --primary: #4f46e5;
    --primary-600: #4338ca;
    --primary-100: #e0e7ff;
    --primary-50: #eef2ff;

    /* Azuis do avatar */
    --blue: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --blue-800: #1e40af;
    --blue-50: #eff6ff;

    /* Semânticas */
    --green: #16a34a;
    --green-700: #15803d;
    --green-bg: #dcfce7;
    --green-ink: #166534;
    --red: #dc2626;
    --red-700: #b91c1c;
    --red-bg: #fee2e2;
    --red-ink: #991b1b;
    --run: #ff5722;
    --sky: #0284c7;
    --sky-bg: #e0f2fe;
    --sky-ink: #0369a1;

    /* Neutros */
    --ink: #0f172a;
    --ink-2: #1e293b;
    --text: #334155;
    --muted: #64748b;
    --subtle: #94a3b8;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #f1f5f9;
    --bg: #f4f6f9;

    /* Forma */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 24px;

    /* Elevação */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 12px 32px -14px rgba(15, 23, 42, .22), 0 2px 6px rgba(15, 23, 42, .05);
    --ring: 0 0 0 4px rgba(79, 70, 229, .16);

    --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* =====================================================
   2. BASE
   ===================================================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4 { color: var(--ink); font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: 1.75rem; line-height: 1.2; }
h2 { font-size: 1.375rem; line-height: 1.25; }
h3 { font-size: 1.0625rem; line-height: 1.3; font-weight: 650; }
h4 { font-size: .9375rem; line-height: 1.35; font-weight: 650; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }

:focus-visible { outline: 3px solid rgba(79, 70, 229, .35); outline-offset: 2px; border-radius: 6px; }

.icon { flex: none; display: inline-block; vertical-align: middle; }
.is-hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }

/* =====================================================
   3. BOTÕES
   ===================================================== */
.btn, .btn-primary, .btn-auth, :where(button) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 18px;
    background: var(--primary);
    color: #fff;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -.005em;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(79, 70, 229, .28);
    transition: background-color .18s, box-shadow .18s, border-color .18s, color .18s, transform .12s;
}
.btn:hover, .btn-primary:hover, .btn-auth:hover, :where(button):hover {
    background: var(--primary-600);
    box-shadow: 0 6px 14px -6px rgba(79, 70, 229, .55);
    color: #fff;
}
.btn:active, .btn-primary:active, .btn-auth:active, :where(button):active { transform: translateY(1px) scale(.99); box-shadow: none; }
.btn:disabled, :where(button):disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { min-height: 48px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.btn-block, .btn-auth { width: 100%; }
.btn-auth { min-height: 48px; font-size: 15px; border-radius: 12px; margin-top: 8px; }

.btn-secondary { background: var(--surface); color: var(--ink-2); border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-2); color: var(--ink); border-color: var(--subtle); box-shadow: var(--shadow-xs); }

.btn-soft { background: var(--primary-50); color: var(--primary); box-shadow: none; }
.btn-soft:hover { background: var(--primary-100); color: var(--primary-600); box-shadow: none; }

.btn-ghost { background: transparent; color: var(--muted); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); box-shadow: none; }

.btn-success { background: var(--green); box-shadow: 0 1px 2px rgba(22, 163, 74, .3); }
.btn-success:hover { background: var(--green-700); box-shadow: 0 6px 14px -6px rgba(22, 163, 74, .55); }

.btn-danger { background: var(--red); box-shadow: 0 1px 2px rgba(220, 38, 38, .3); }
.btn-danger:hover { background: var(--red-700); box-shadow: 0 6px 14px -6px rgba(220, 38, 38, .55); }

.btn-soft-danger { background: var(--red-bg); color: var(--red-ink); box-shadow: none; }
.btn-soft-danger:hover { background: #fecaca; color: var(--red-ink); box-shadow: none; }

.btn-soft-sky { background: var(--sky-bg); color: var(--sky-ink); box-shadow: none; }
.btn-soft-sky:hover { background: #bae6fd; color: var(--sky-ink); box-shadow: none; }

/* =====================================================
   4. FORMULÁRIOS
   ===================================================== */
.form-group, .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.form-group label, .field label, label.label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
}
.form-group label .opt, .field label .opt { color: var(--subtle); font-weight: 500; }

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    font-size: 14.5px;
    color: var(--ink);
    outline: none;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
textarea { padding: 12px 14px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--subtle); }

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):hover,
select:hover, textarea:hover { border-color: var(--subtle); }

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):focus,
select:focus, textarea:focus { border-color: var(--primary); box-shadow: var(--ring); }

select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 18px; height: 18px; flex: none; }

/* campo com unidade (cm, kg, %) */
.input-unit { position: relative; }
.input-unit input { padding-right: 46px !important; }
.input-unit .unit {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    font-size: 13px; font-weight: 500; color: var(--subtle); pointer-events: none;
}

/* campo de senha */
.input-wrap { position: relative; }
.input-wrap input { padding-right: 84px !important; }
.input-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    min-height: 32px; padding: 0 10px;
    background: transparent; color: var(--muted); box-shadow: none;
    font-size: 13px; font-weight: 600; border-radius: 8px;
}
.input-toggle:hover { background: var(--surface-3); color: var(--ink); box-shadow: none; }
.input-toggle:active { transform: translateY(-50%) scale(.98); }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 20px 16px;
}
.span-all { grid-column: 1 / -1; }
.hint { font-size: 12.5px; color: var(--muted); }

.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--ink-2); cursor: pointer; line-height: 1.4; }
.check small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* =====================================================
   5. ALERTAS E TOASTS
   ===================================================== */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 14px; font-weight: 500;
    margin-bottom: 20px;
}
.alert.success { background: var(--green-bg); color: var(--green-ink); border-color: #bbf7d0; }
.alert.error { background: var(--red-bg); color: var(--red-ink); border-color: #fecaca; }
.alert .icon { margin-top: 1px; }

.toast-stack {
    position: fixed; right: 24px; bottom: 24px; z-index: 1000;
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 10px;
    max-width: 380px;
    padding: 12px 16px;
    background: var(--ink); color: #fff;
    border-radius: 12px;
    font-size: 14px; font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: toastIn .22s ease-out;
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; flex: none; }
.toast.error::before { background: #f87171; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .22s, transform .22s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* =====================================================
   6. LOGIN / CADASTRO
   ===================================================== */
body.auth-body { background: var(--surface); min-height: 100vh; display: block; padding: 0; }

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    min-height: 100vh;
}

.auth-aside {
    position: relative; overflow: hidden;
    background: var(--primary); color: #fff;
    padding: 56px clamp(40px, 6vw, 88px);
    display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
.auth-aside .brand { color: #fff; padding: 0; }
.auth-aside .brand-mark { background: #fff; color: var(--primary); }

.auth-pitch { position: relative; z-index: 1; max-width: 520px; }
.auth-pitch h1 {
    color: #fff;
    font-size: clamp(2rem, 3.4vw, 3.125rem);
    line-height: 1.08; font-weight: 800; letter-spacing: -.035em;
    margin-bottom: 20px;
}
.auth-pitch > p { font-size: 1.0625rem; line-height: 1.6; color: rgba(255, 255, 255, .82); max-width: 44ch; }

.auth-points { list-style: none; display: grid; gap: 16px; margin-top: 40px; }
.auth-points li { display: flex; align-items: center; gap: 14px; font-size: 15px; font-weight: 500; color: rgba(255, 255, 255, .95); }
.auth-points .pt {
    width: 36px; height: 36px; border-radius: 10px; flex: none;
    background: rgba(255, 255, 255, .14);
    display: grid; place-items: center;
}

.auth-route { position: absolute; right: -4%; bottom: -6%; width: 78%; max-width: 560px; opacity: .9; pointer-events: none; }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 48px 32px; background: var(--surface); }
.auth-container { width: 100%; max-width: 400px; }

.auth-card h2 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: 8px; }
.auth-sub { font-size: 15px; color: var(--muted); margin-bottom: 32px; line-height: 1.5; }
.auth-card .form-group { margin-bottom: 18px; }

.auth-toggle { text-align: center; font-size: 14px; color: var(--muted); margin-top: 28px; }
.auth-toggle a { font-weight: 700; color: var(--primary); }
.auth-toggle a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* =====================================================
   7. MARCA
   ===================================================== */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.125rem; letter-spacing: -.03em; color: var(--ink); padding: 0 8px; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: var(--primary); color: #fff; display: grid; place-items: center; flex: none; }

/* =====================================================
   8. SHELL DO APLICATIVO
   ===================================================== */
body.dashboard-body { display: flex; min-height: 100vh; background: var(--bg); }

.sidebar {
    width: 272px; flex: none;
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; gap: 28px;
    padding: 24px 16px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    overflow-y: auto;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }

.nav-btn, .nav-link {
    display: flex; align-items: center; gap: 12px;
    width: 100%; min-height: 42px; padding: 0 12px;
    background: transparent; color: var(--muted);
    border: none; border-radius: 10px; box-shadow: none;
    font-size: 14.5px; font-weight: 500; text-align: left; text-decoration: none;
    cursor: pointer; white-space: nowrap;
    transition: background-color .15s, color .15s;
}
.nav-btn:hover, .nav-link:hover { background: var(--surface-3); color: var(--ink); box-shadow: none; }
.nav-btn:active { transform: none; }
.nav-btn.active { background: var(--primary-50); color: var(--primary); font-weight: 650; box-shadow: none; }
.nav-btn.active:hover { background: var(--primary-50); color: var(--primary); }
.nav-sep { height: 1px; background: var(--line); margin: 10px 4px; }

.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 16px 8px 0; border-top: 1px solid var(--line); }
.avatar-chip {
    width: 38px; height: 38px; border-radius: 50%; flex: none;
    background: var(--primary-100); color: var(--primary);
    display: grid; place-items: center;
    font-weight: 700; font-size: 13.5px; letter-spacing: 0;
}
.sidebar-user .who { min-width: 0; flex: 1; line-height: 1.3; }
.sidebar-user .who strong { display: block; font-size: 14px; color: var(--ink); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .who span { font-size: 12.5px; color: var(--muted); }
.icon-btn {
    width: 38px; height: 38px; border-radius: 10px; flex: none;
    display: grid; place-items: center;
    color: var(--muted); background: transparent;
    transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--red-bg); color: var(--red); }

.main-content { flex: 1; min-width: 0; padding: 40px clamp(20px, 4vw, 56px) 72px; }
.tab-content { display: none; max-width: 1180px; margin: 0 auto; }
.tab-content.active { display: block; animation: tabIn .22s ease-out; }
@keyframes tabIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page-header .lead { margin-top: 6px; color: var(--muted); font-size: 15px; max-width: 60ch; }

/* =====================================================
   9. CARTÕES E PAINÉIS
   ===================================================== */
.panel, .plan-card, .chart-container {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 24px;
    box-shadow: var(--shadow-xs);
}
.panel + .panel { margin-top: 20px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-head p { font-size: 13.5px; color: var(--muted); margin-top: 2px; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-xs);
    display: flex; flex-direction: column; gap: 14px;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stat-label { font-size: 13.5px; font-weight: 500; color: var(--muted); }
.stat-chip { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.chip-indigo { background: var(--primary-50); color: var(--primary); }
.chip-blue { background: var(--blue-50); color: var(--blue-600); }
.chip-green { background: var(--green-bg); color: var(--green); }
.chip-red { background: var(--red-bg); color: var(--red); }

.stat-value { font-size: 1.875rem; font-weight: 800; letter-spacing: -.035em; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
.stat-value .unit { font-size: .9375rem; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.stat-value.empty { color: var(--line-strong); }
.stat-foot { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); line-height: 1.35; }
.stat-foot.good { color: var(--green); }
.stat-foot a { font-weight: 600; }

/* legado (dashboard_interativo) */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-xs); }
.card h2 { margin-bottom: 4px; }
.card > p { color: var(--muted); font-size: 14px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; }
.dash-grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-col { display: flex; flex-direction: column; gap: 20px; }
.dash-col .panel + .panel { margin-top: 0; }

/* =====================================================
   10. AVATAR CORPORAL
   ===================================================== */
.avatar-stage {
    display: grid; place-items: center;
    height: 380px;
    border-radius: var(--r-md);
    background-color: var(--surface-2);
    background-image: radial-gradient(var(--line) 1.2px, transparent 1.2px);
    background-size: 18px 18px;
    border: 1px solid var(--surface-3);
}
.avatar-stage svg { height: 340px; width: auto; max-width: 100%; overflow: visible; }
#human-avatar .part {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform .9s cubic-bezier(.2, .8, .2, 1);
}
.avatar-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.avatar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.avatar-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* legado dashboard_interativo */
.avatar-container { display: grid; place-items: center; height: 350px; border-radius: var(--r-md); background-color: var(--surface-2); background-image: radial-gradient(var(--line) 1.2px, transparent 1.2px); background-size: 18px 18px; border: 1px solid var(--surface-3); margin-top: 18px; }
svg#human-avatar .part { transform-box: fill-box; transform-origin: center; transition: transform .9s cubic-bezier(.2, .8, .2, 1); }

/* =====================================================
   11. MEDIDAS E GRÁFICO
   ===================================================== */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.metric { padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--surface-3); }
.metric .k { display: block; font-size: 12.5px; color: var(--muted); }
.metric .v { display: block; margin-top: 2px; font-size: 1.125rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric .v small { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-left: 2px; letter-spacing: 0; }

.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-label { fill: var(--subtle); font-size: 12px; font-family: var(--font); }
.chart-area { fill: var(--primary); opacity: .09; }
.chart-line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: #fff; stroke: var(--primary); stroke-width: 2.5; }
.chart-dot:hover { stroke-width: 4; }
.chart-goal { stroke: var(--green); stroke-width: 1.5; stroke-dasharray: 5 5; }
.chart-goal-label { fill: var(--green); font-size: 12px; font-weight: 600; font-family: var(--font); }

/* =====================================================
   12. ESTADOS VAZIOS
   ===================================================== */
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 44px 24px; color: var(--muted); }
.empty-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; margin-bottom: 6px; }
.empty h4 { font-size: 1rem; color: var(--ink); }
.empty p { max-width: 40ch; font-size: 14px; }
.empty .btn { margin-top: 10px; }
.empty.compact { padding: 28px 16px; }

/* =====================================================
   13. ESPORTES
   ===================================================== */
.sport-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 14px; align-items: end; }
.sport-form .actions { display: flex; gap: 8px; }

.sport-list { display: grid; gap: 10px; }
.sport-item {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 18px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
    transition: border-color .15s, box-shadow .15s;
}
.sport-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.sport-item .name { font-size: 15.5px; font-weight: 650; color: var(--ink); letter-spacing: -.01em; }
.sport-item .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sport-item .actions { display: flex; gap: 8px; flex: none; }

.chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 999px;
    background: var(--surface-3); color: var(--text);
    font-size: 12.5px; font-weight: 600; line-height: 1.2;
}
.chip.leve { background: var(--sky-bg); color: var(--sky-ink); }
.chip.moderada { background: var(--primary-50); color: var(--primary-600); }
.chip.intensa { background: var(--red-bg); color: var(--red-ink); }
.chip.kcal { background: var(--red-bg); color: var(--red-ink); }

/* =====================================================
   14. CORRIDAS (ESTILO STRAVA)
   ===================================================== */
.record-bar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
    margin-bottom: 16px; overflow: hidden;
}
.rec-stat { padding: 22px 26px; }
.rec-stat + .rec-stat { border-left: 1px solid var(--line); }
.rec-stat .k { display: block; font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.rec-stat .v { font-size: 2.5rem; font-weight: 800; letter-spacing: -.045em; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
.rec-stat .u { font-size: .9375rem; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.rec-stat.main .v { color: var(--primary); }

.record-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.record-controls .or { color: var(--subtle); font-size: 13px; padding: 0 4px; }
.file-btn input { display: none; }

.runs-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.map-panel { position: sticky; top: 24px; padding: 20px; }
.map-panel .panel-head { margin-bottom: 14px; }
#map {
    height: 540px; width: 100%;
    border-radius: var(--r-md); border: 1px solid var(--line);
    z-index: 0; background: var(--surface-3);
}

.feed-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.feed-head span { font-size: 13px; color: var(--muted); }
.feed { display: flex; flex-direction: column; gap: 14px; }

.run-card, .run-item-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 18px;
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    transition: border-color .18s, box-shadow .18s;
}
.run-card:hover { border-color: #c7d2fe; box-shadow: var(--shadow-md); }
.run-card.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.run-card--static { cursor: default; }
.run-card--static:hover { border-color: var(--line); box-shadow: var(--shadow-xs); }
.run-card + .run-card--static { margin-top: 0; }

.run-card__head { display: flex; align-items: center; gap: 12px; }
.run-card__head .avatar-chip { width: 40px; height: 40px; }
.run-card__who { font-size: 14px; font-weight: 650; color: var(--ink); line-height: 1.25; }
.run-card__when { font-size: 12.5px; color: var(--muted); }
.run-card__title { margin: 14px 0 14px; font-size: 1.125rem; font-weight: 750; letter-spacing: -.02em; color: var(--ink); }

.run-stats { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 12px; }
.run-stats .k { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.run-stats .v { display: block; margin-top: 2px; font-size: 1.125rem; font-weight: 700; letter-spacing: -.025em; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.run-stats .v small { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
.run-stats .main .v { font-size: 1.5rem; color: var(--primary); letter-spacing: -.04em; }

.run-route {
    margin-top: 16px; height: 150px; border-radius: var(--r-md); overflow: hidden;
    display: grid; place-items: center;
    background-color: var(--surface-2);
    background-image:
        linear-gradient(var(--surface-3) 1px, transparent 1px),
        linear-gradient(90deg, var(--surface-3) 1px, transparent 1px);
    background-size: 28px 28px;
    border: 1px solid var(--surface-3);
}
.run-route svg { width: 100%; height: 100%; display: block; }
.run-route .none { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--subtle); }

.run-map { height: 170px; width: 100%; border-radius: var(--r-md); margin-top: 16px; border: 1px solid var(--line); z-index: 0; }

.run-card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 13px; color: var(--muted); }
.run-card__foot .go { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; transition: color .15s; }
.run-card:hover .run-card__foot .go { color: var(--primary); }

/* Leaflet */
.leaflet-container { font-family: var(--font); }
.leaflet-control-attribution { font-size: 10px; }

/* =====================================================
   15. CONTEÚDO GERADO PELA IA (dieta / treino)
   ===================================================== */
.prose { color: var(--text); font-size: 15px; line-height: 1.65; }
.prose > :first-child { margin-top: 0; }
.prose h3 { font-size: 1.25rem; margin: 1.8em 0 .5em; padding-bottom: .5em; border-bottom: 1px solid var(--line); }
.prose h3:first-child { margin-top: 0; }
.prose h4 { font-size: 1rem; margin: 1.4em 0 .4em; color: var(--primary-600); }
.prose p { margin: .6em 0; max-width: 72ch; }
.prose ul, .prose ol { margin: .6em 0 1em; padding-left: 1.25rem; display: grid; gap: .35em; max-width: 72ch; }
.prose li::marker { color: var(--primary); }
.prose strong { color: var(--ink); font-weight: 650; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.prose th { color: var(--ink); background: var(--surface-2); font-weight: 650; }

/* =====================================================
   16. CHAT IA
   ===================================================== */
.chat-container {
    display: flex; flex-direction: column;
    height: min(640px, calc(100vh - 210px)); min-height: 420px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); box-shadow: var(--shadow-xs); overflow: hidden;
}
.chat-box { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.msg { padding: 12px 16px; border-radius: 16px; max-width: min(78%, 620px); font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; }
.msg.ai { background: var(--surface-3); color: var(--ink); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user { background: var(--primary); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.typing { display: inline-flex; gap: 5px; padding: 16px 18px; }
.msg.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--subtle); animation: bounce 1.1s infinite ease-in-out; }
.msg.typing span:nth-child(2) { animation-delay: .15s; }
.msg.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.chat-input-box { display: flex; gap: 10px; padding: 16px; border-top: 1px solid var(--line); background: var(--surface); }

/* =====================================================
   17. PÁGINAS AUXILIARES (perfil biométrico, admin, interativo)
   ===================================================== */
body.page-body { background: var(--bg); min-height: 100vh; }
.page-wrap { max-width: 980px; margin: 0 auto; padding: 32px 20px 56px; }
.page-wrap.wide { max-width: 1200px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.topbar .brand { padding: 0; }
.back-link { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); padding: 8px 12px 8px 8px; margin-left: -8px; border-radius: 10px; transition: background-color .15s, color .15s; }
.back-link:hover { background: var(--surface); color: var(--primary); }

.form-section { margin-bottom: 20px; }
.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.section-head .stat-chip { width: 42px; height: 42px; }
.section-head h3 { font-size: 1.0625rem; }
.section-head p { font-size: 13.5px; color: var(--muted); }

.savebar {
    position: sticky; bottom: 16px; z-index: 5;
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    margin-top: 8px; padding: 14px 18px;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
}

.admin-card { max-width: 560px; margin: 12vh auto 0; text-align: center; padding: 40px 32px; }
.admin-card .stat-chip { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 20px; }
.admin-card p { color: var(--muted); margin: 8px 0 28px; }

/* =====================================================
   18. LAYOUT DE DESKTOP EM QUALQUER TELA
   O layout de notebook/desktop é a única referência: não há mais
   breakpoints que empilhem colunas ou troquem a barra lateral.
   No celular o navegador reduz a página inteira proporcionalmente
   (veja <meta name="viewport" content="width=1280"> em cada página);
   as regras de "responsivo.css" garantem que nada estoure ao reduzir.
   ===================================================== */






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

/* =====================================================
   19. AJUSTES: duração (h + min), status do GPS, GPX e unidades cm/m
   ===================================================== */
.sport-form { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr) auto; }
.dur-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dur-group .input-unit input { padding-right: 44px !important; }

.gps-status {
    margin: -8px 0 16px; padding: 10px 14px; border-radius: 12px;
    font-size: 13.5px; font-weight: 500; border: 1px solid var(--line);
    background: var(--surface-2); color: var(--text);
}
.gps-status.ok { background: var(--green-bg); color: var(--green-ink); border-color: transparent; }
.gps-status.error { background: var(--red-bg); color: var(--red-ink); border-color: transparent; }

.gpx-panel {
    display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap;
    margin: 0 0 20px; padding: 16px 20px;
    background: var(--primary-50); border: 1px solid var(--primary-100); border-radius: var(--r-lg);
}
.gpx-panel__info { display: flex; flex-direction: column; flex: 1; min-width: 180px; }
.gpx-panel__info strong { color: var(--ink); font-size: 15px; }
.gpx-panel__info span { color: var(--muted); font-size: 13.5px; }
.gpx-duration { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gpx-duration .dur-group { width: 200px; }
.gpx-note { font-size: 13px; color: var(--text); max-width: 26ch; line-height: 1.35; }
.gpx-field { width: 220px; }
.gpx-actions { display: flex; gap: 8px; }

/* Medidas de comprimento: número + seletor cm / m */
.input-length { display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 8px; }
.input-length select { padding-left: 12px; padding-right: 32px; font-weight: 600; }
.field-note { min-height: 0; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.field-note:empty { display: none; }
.field-note.warn { color: #b45309; }
.field-note.error { color: var(--red); font-weight: 600; }
:root[data-theme="dark"] .field-note.warn { color: #fbbf24; }
.unit-legend { margin: -6px 0 18px; font-size: 13px; color: var(--muted); }

/* Campos com máscara (1,75 m / 00:00): setas ▲▼ no estilo do campo numérico, unidade à direita */
.input-unit.su input[data-su-input] { padding-right: 80px !important; }
.su-steppers {
    position: absolute; right: 44px; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; width: 18px; overflow: hidden;
    border-radius: 5px; background: var(--surface-3);
    opacity: 0; transition: opacity .12s;
}
.su:hover .su-steppers, .su:focus-within .su-steppers { opacity: 1; }
@media (hover: none) { .su-steppers { opacity: 1; } }
.su-steppers button {
    display: flex; align-items: center; justify-content: center;
    width: 18px; height: 13px; min-height: 0; padding: 0; border: 0; border-radius: 0;
    background: transparent; color: var(--muted); box-shadow: none; cursor: pointer;
}
.su-steppers button:hover { background: var(--line); color: var(--ink); box-shadow: none; transform: none; }
.su-steppers button::before { content: ""; border-left: 4px solid transparent; border-right: 4px solid transparent; }
.su-steppers [data-su-up]::before { border-bottom: 5px solid currentColor; }
.su-steppers [data-su-down]::before { border-top: 5px solid currentColor; }
