/* Ritmo — design system. Escuro por padrão, acento amarelo. */

@font-face { font-family: 'Inter'; src: url('../fonts/Inter-Regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/Inter-Medium.woff') format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/Inter-SemiBold.woff') format('woff'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/Inter-Bold.woff') format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Inter Display'; src: url('../fonts/InterDisplay-SemiBold.woff') format('woff'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter Display'; src: url('../fonts/InterDisplay-Bold.woff') format('woff'); font-weight: 700; font-display: swap; }

:root {
  --bg: #09090a;
  --bg-elev: #0f0f11;
  --surface: #141416;
  --surface-2: #1b1b1e;
  --surface-3: #252529;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #f4f4f5;
  --text-2: #a8a8b0;
  --text-3: #6f6f78;
  --accent: #ffd60a;
  --accent-2: #ffe55c;
  --accent-ink: #171300;
  --accent-soft: rgba(255, 214, 10, 0.12);
  --accent-line: rgba(255, 214, 10, 0.35);
  --accent-text: #ffd60a;
  --hero: #ffd60a;
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.12);
  --warn: #fbbf24;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --info: #7dd3fc;
  --c-weight: #ffd60a;
  --c-walk: #5eead4;
  --c-run: #ff8a65;
  --c-bike: #9aa5ff;
  --c-goal: #4ade80;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --nav-h: 68px;
  --top-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-num: 'Inter Display', 'Inter', system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #f4f4f1;
  --bg-elev: #fbfbf9;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --surface-3: #e6e6e1;
  --line: rgba(10, 10, 10, 0.08);
  --line-2: rgba(10, 10, 10, 0.14);
  --text: #121214;
  --text-2: #55555c;
  --text-3: #8a8a92;
  --accent: #f5c400;
  --accent-2: #e0b200;
  --accent-ink: #171300;
  --accent-soft: rgba(245, 196, 0, 0.16);
  --accent-line: rgba(176, 140, 0, 0.45);
  --accent-text: #7a5f00;
  --hero: #121214;
  --ok: #16a34a;
  --ok-soft: rgba(22, 163, 74, 0.1);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --c-weight: #d4a900;
  --c-walk: #0d9488;
  --c-run: #ea580c;
  --c-bike: #4f46e5;
  --c-goal: #16a34a;
  --shadow: 0 10px 28px rgba(20, 20, 20, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; }
.ic { flex: none; display: block; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.accent { color: var(--accent-text); }
.ok { color: var(--ok); }
.danger { color: var(--danger); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- Shell ---------- */
#app { min-height: 100%; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) 16px 0;
  display: flex; align-items: center; gap: 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar h1 { font: 700 20px/1 var(--font-num); letter-spacing: -0.02em; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .back { margin-left: -8px; }
.view { padding: 8px 16px calc(var(--nav-h) + var(--safe-b) + 28px); max-width: 720px; margin: 0 auto; animation: viewIn .22s var(--ease); }
.view.no-nav { padding-bottom: calc(var(--safe-b) + 24px); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--text-3); font-size: 11px; font-weight: 600; padding: 8px 0; min-height: 48px;
  transition: color .15s;
}
.bottomnav a.active { color: var(--text); }
.bottomnav a.active .ic { color: var(--accent-text); }
.bottomnav .fab-slot { display: flex; justify-content: center; }
.bottomnav .fab {
  width: 56px; height: 56px; border-radius: 18px; margin-top: -18px;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 8px 24px rgba(255, 214, 10, 0.28); padding: 0;
}
.bottomnav .fab.live { animation: pulseRing 1.6s infinite; }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 rgba(255, 214, 10, .5); } 100% { box-shadow: 0 0 0 14px rgba(255, 214, 10, 0); } }
@media (min-width: 900px) {
  .bottomnav { max-width: 560px; left: 50%; transform: translateX(-50%); bottom: 16px; border-radius: 22px; border: 1px solid var(--line); height: var(--nav-h); padding-bottom: 0; }
}

/* Status de conexão/sincronização */
.status-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border-radius: 999px; background: var(--surface-2); color: var(--text-2);
  font-size: 12px; font-weight: 600; border: 1px solid var(--line); white-space: nowrap;
}
.status-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.status-chip[data-state='online'] .dot, .status-chip[data-state='synced'] .dot { background: var(--ok); }
.status-chip[data-state='offline'] .dot { background: var(--danger); }
.status-chip[data-state='pending'] .dot { background: var(--warn); }
.status-chip[data-state='saving'] .dot, .status-chip[data-state='syncing'] .dot { background: var(--accent); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }

.banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 12px; font-size: 14px;
}
.banner .ic { margin-top: 1px; }
.banner.warn { background: color-mix(in srgb, var(--warn) 10%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.banner.warn .ic { color: var(--warn); }
.banner.hl { background: var(--accent-soft); border-color: var(--accent-line); }
.banner.hl .ic { color: var(--accent-text); }
.banner.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.banner.danger .ic { color: var(--danger); }
.banner .grow { flex: 1; min-width: 0; }
.banner b { display: block; margin-bottom: 2px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card.highlight { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 14%, var(--surface)) 0%, var(--surface) 60%); border-color: var(--accent-line); }
.card.highlight .hero-num { color: var(--hero); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; font: 600 15px/1.2 var(--font); flex: 1; }
.card-head .link { font-size: 13px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 2px; min-height: 32px; }
.section-title { font: 600 13px/1 var(--font); color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; margin: 22px 4px 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid2 > .card, .grid3 > .card { margin-bottom: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { height: 12px; }

/* Indicadores numéricos */
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .v { font: 700 24px/1.05 var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; white-space: nowrap; }
.stat .v small { font: 600 13px var(--font); color: var(--text-2); margin-left: 3px; letter-spacing: 0; }
.stat .l { font-size: 12px; color: var(--text-2); font-weight: 500; }
.stat.lg .v { font-size: 40px; }
.stat.xl .v { font-size: 56px; letter-spacing: -0.035em; }
.hero-num { font: 700 64px/0.95 var(--font-num); letter-spacing: -0.045em; font-variant-numeric: tabular-nums; }
.hero-num small { font: 600 20px var(--font); letter-spacing: 0; color: var(--text-2); margin-left: 6px; }

/* Progresso */
.bar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; position: relative; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--accent); transition: width .6s var(--ease); }
.bar.thin { height: 6px; }
.bar.ok > i { background: var(--ok); }
.bar .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--bg); border-radius: 2px; }
.bar-legend { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-label { position: absolute; text-align: center; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 650; font-size: 15px; background: var(--surface-2); color: var(--text);
  transition: transform .12s var(--ease), background .15s, opacity .15s; user-select: none; text-align: center;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:active { background: var(--accent-2); }
.btn.secondary { background: var(--surface-2); border-color: var(--line-2); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
.btn.lg { min-height: 58px; font-size: 17px; border-radius: 18px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: transparent; border: 0; color: var(--text); padding: 0;
}
.icon-btn.filled { background: var(--surface-2); border: 1px solid var(--line); }
.icon-btn:active { background: var(--surface-3); }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }
.btn .spinner { width: 16px; height: 16px; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.quick .btn { min-height: 56px; border-radius: 16px; justify-content: flex-start; padding: 0 16px; }

/* ---------- Chips / segmentado ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 4px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; flex: none;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--text-2); font-size: 13px; font-weight: 600;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .sw { width: 8px; height: 8px; border-radius: 50%; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { min-height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 13px; padding: 0 8px; }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 var(--line-2) inset; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.demo { background: var(--danger-soft); color: var(--danger); }

/* ---------- Formulários ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .field > .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .err { font-size: 12px; color: var(--danger); min-height: 0; }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line-2); outline: none;
  transition: border-color .15s, background .15s; -webkit-appearance: none; appearance: none;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { border-color: var(--accent); background: var(--surface); }
.input.invalid { border-color: var(--danger); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .suffix { position: absolute; right: 14px; color: var(--text-3); font-weight: 600; pointer-events: none; }
.input-wrap .input { padding-right: 52px; }
.input.big { font: 700 34px/1 var(--font-num); text-align: center; min-height: 76px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper .input { flex: 1; }
.stepper .icon-btn { width: 56px; height: 56px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 16px; }
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); background: var(--accent-ink); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.days button { aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2); font-weight: 700; font-size: 13px; min-height: 40px; }
.days button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Listas ---------- */
.list { display: flex; flex-direction: column; }
.li {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 60px; width: 100%;
  border: 0; background: transparent; text-align: left; border-top: 1px solid var(--line); color: inherit;
}
.li:first-child { border-top: 0; }
button.li:active, a.li:active { background: var(--surface-2); }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .s { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .end { text-align: right; flex: none; }
.li .end .t { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); }
.avatar.walk { background: color-mix(in srgb, var(--c-walk) 14%, transparent); color: var(--c-walk); }
.avatar.run { background: color-mix(in srgb, var(--c-run) 14%, transparent); color: var(--c-run); }
.avatar.bike { background: color-mix(in srgb, var(--c-bike) 14%, transparent); color: var(--c-bike); }
.avatar.weight { background: var(--accent-soft); color: var(--accent); }
.avatar.goal { background: var(--ok-soft); color: var(--ok); }

/* Estados */
.empty { text-align: center; padding: 28px 16px; color: var(--text-2); }
.empty .ic { margin: 0 auto 12px; color: var(--text-3); }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 16px; }
.empty p { margin: 0 0 16px; font-size: 14px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 12px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-load { min-height: 60vh; display: grid; place-items: center; }

/* ---------- Sheet / modal / toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.6); opacity: 0; transition: opacity .2s; display: flex; align-items: flex-end; justify-content: center; }
.overlay.open { opacity: 1; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-elev); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 26px 26px 0 0; padding: 8px 20px calc(20px + var(--safe-b));
  transform: translateY(24px); transition: transform .25s var(--ease);
}
.overlay.open .sheet { transform: none; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 4px auto 14px; }
.sheet h2 { margin: 0 0 6px; font: 700 21px/1.2 var(--font-num); letter-spacing: -0.01em; }
.sheet .lead { color: var(--text-2); margin: 0 0 18px; font-size: 14px; }
.sheet .actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
@media (min-width: 640px) { .overlay { align-items: center; } .sheet { border-radius: 26px; border-bottom: 1px solid var(--line); margin: 16px; } }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 520px; width: fit-content;
  padding: 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow); animation: toastIn .25s var(--ease);
}
.toast.error { background: var(--danger); color: #fff; }
.toast.ok .ic { color: var(--ok); }
.toast button { background: var(--accent); border: 0; color: var(--accent-ink); font-weight: 700; padding: 6px 12px; margin-left: 6px; border-radius: 10px; min-height: 32px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Gráficos ---------- */
.chart { width: 100%; display: block; overflow: visible; touch-action: pan-y; }
.chart .grid line { stroke: var(--line); }
.chart .axis text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#gradAccent); }
.chart .dot { fill: var(--bg); stroke: var(--accent); stroke-width: 2; }
.chart .target { stroke: var(--ok); stroke-dasharray: 4 5; stroke-width: 1.5; }
.chart .target-label { fill: var(--ok); font-size: 11px; font-weight: 700; }
.chart .start { stroke: var(--text-3); stroke-dasharray: 2 4; stroke-width: 1; }
.chart .bar-r { fill: var(--surface-3); }
.chart .bar-r.on { fill: var(--accent); }
.chart .cursor { stroke: var(--line-2); stroke-width: 1; }
.chart-tip { font-size: 13px; color: var(--text-2); min-height: 20px; margin-top: 6px; }
.chart-tip b { color: var(--text); font-family: var(--font-num); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ---------- Mapa ---------- */
.map { position: relative; overflow: hidden; background: #111214; border-radius: var(--radius); touch-action: none; user-select: none; }
:root[data-theme='light'] .map { background: #e9e9e4; }
.map .tiles { position: absolute; inset: 0; }
.map .tiles img { position: absolute; width: 256px; height: 256px; max-width: none; user-select: none; -webkit-user-drag: none; }
:root:not([data-theme='light']) .map .tiles img { filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.92) saturate(.4); }
.map svg.overlay-route { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map .route { fill: none; stroke: var(--accent); stroke-width: 4.5; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.map .route.gap { stroke: var(--text-3); stroke-width: 2.5; stroke-dasharray: 3 6; filter: none; }
.map .me { fill: var(--accent); stroke: #000; stroke-width: 2.5; }
.map .me-acc { fill: var(--accent-soft); stroke: var(--accent-line); stroke-width: 1; }
.map .start-pt { fill: var(--ok); stroke: #000; stroke-width: 2; }
.map .end-pt { fill: var(--danger); stroke: #000; stroke-width: 2; }
.map .attrib { position: absolute; right: 6px; bottom: 4px; font-size: 10px; color: var(--text-3); background: color-mix(in srgb, var(--bg) 70%, transparent); padding: 1px 6px; border-radius: 6px; }
.map .map-ctl { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.map .map-ctl button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--bg-elev) 85%, transparent); color: var(--text); display: grid; place-items: center; padding: 0; }
.map .map-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 13px; text-align: center; padding: 20px; }
.map-grid { position: absolute; inset: 0; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 32px 32px; }

/* ---------- Tela de atividade ao vivo ---------- */
.live { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; padding: calc(var(--safe-t) + 8px) 16px calc(var(--safe-b) + 16px); overflow: hidden; }
.live-top { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.live-top .type { display: flex; align-items: center; gap: 8px; font-weight: 700; flex: 1; }
.live-state { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.live-state.running { background: var(--accent-soft); color: var(--accent-text); }
.live-state.running::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.live-state.paused { background: var(--surface-3); color: var(--text); }
.gps-ind { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; }
.gps-ind i { width: 4px; border-radius: 2px; background: var(--surface-3); }
.gps-ind i:nth-child(1) { height: 6px; } .gps-ind i:nth-child(2) { height: 11px; } .gps-ind i:nth-child(3) { height: 16px; }
.gps-ind[data-l='1'] i:nth-child(1) { background: var(--danger); }
.gps-ind[data-l='2'] i:nth-child(-n+2) { background: var(--warn); }
.gps-ind[data-l='3'] i { background: var(--ok); }
.live-main { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 0; padding-top: 4px; }
.live-primary { text-align: center; }
.live-primary .v { font: 700 clamp(64px, 22vw, 120px)/0.9 var(--font-num); letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.live.compact .live-main { justify-content: center; }
.live.compact .live-primary .v { font-size: clamp(80px, 28vw, 140px); }
.live-primary .l { color: var(--text-2); font-weight: 600; font-size: 14px; margin-top: 6px; }
.live-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.live-grid > div { background: var(--surface); padding: 10px 14px; }
.live-grid .v { font: 700 28px/1.05 var(--font-num); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-grid .v small { font: 600 13px var(--font); color: var(--text-2); letter-spacing: 0; margin-left: 2px; }
.live-grid .l { font-size: 12px; color: var(--text-2); font-weight: 600; }
.live .map { flex: 1 1 120px; min-height: 110px; }
.live.compact .map { display: none; }
.live-controls { display: flex; align-items: center; justify-content: center; gap: 22px; padding-top: 12px; flex: none; }
.live [data-b=notices] .banner { margin: 8px 0 0; }
.ctl { width: 84px; height: 84px; border-radius: 50%; border: 0; display: grid; place-items: center; padding: 0; transition: transform .12s var(--ease); }
.ctl:active { transform: scale(.94); }
.ctl.main { width: 96px; height: 96px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 30px rgba(255, 214, 10, .25); }
.ctl.stop { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.ctl.sec { width: 60px; height: 60px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.ctl-label { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-2); margin-top: 6px; }
.live.is-paused .live-primary .v, .live.is-paused .live-grid .v { color: var(--text-2); }
.live.is-paused::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(135deg, transparent 0 18px, rgba(255,255,255,.018) 18px 36px); }
.live .goal-bar { margin-top: 2px; }

/* Seleção de atividade */
.type-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.type-pick button {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 8px; border-radius: 18px;
  background: var(--surface); border: 1.5px solid var(--line-2); color: var(--text-2); font-weight: 700; font-size: 14px; min-height: 104px;
}
.type-pick button.on { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.type-pick button.on .ic { color: var(--accent-text); }
.check-list { display: flex; flex-direction: column; gap: 10px; }
.check { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.check .st { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.check .st.ok { background: var(--ok-soft); color: var(--ok); }
.check .st.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.check .st.bad { background: var(--danger-soft); color: var(--danger); }

/* ---------- Calendário ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-head h2 { flex: 1; margin: 0; font: 700 18px var(--font-num); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-3); padding: 4px 0; text-transform: uppercase; }
.cal .day {
  aspect-ratio: 1; border-radius: 12px; border: 1px solid transparent; background: var(--surface); padding: 4px; min-height: 42px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--text);
}
.cal .day.out { opacity: .3; }
.cal .day.today { border-color: var(--accent-line); color: var(--accent-text); }
.cal .day.sel { background: var(--accent); color: var(--accent-ink); }
.cal .day.sel .dots i { box-shadow: 0 0 0 1.5px var(--accent); }
.cal .dots { display: flex; gap: 3px; height: 6px; }
.cal .dots i { width: 6px; height: 6px; border-radius: 50%; }

/* ---------- Conquistas ---------- */
.ach { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ach > div { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 8px; text-align: center; }
.ach .medal { width: 48px; height: 48px; border-radius: 16px; margin: 0 auto 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); }
.ach .on .medal { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px rgba(255, 214, 10, .2); }
.ach .t { font-size: 12px; font-weight: 700; line-height: 1.2; }
.ach .s { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.ach .off .t { color: var(--text-2); }

/* Marcos */
.ms { display: flex; flex-direction: column; gap: 0; }
.ms-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; position: relative; }
.ms-item .node { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 2px solid var(--line-2); color: var(--text-3); z-index: 1; flex: none; }
.ms-item.done .node { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ms-item.next .node { border-color: var(--accent); color: var(--accent-text); }
.ms-item:not(:last-child)::after { content: ''; position: absolute; left: 13px; top: 38px; bottom: -10px; width: 2px; background: var(--line-2); }
.ms-item.done:not(:last-child)::after { background: var(--accent-line); }
.ms-item .grow { flex: 1; }

/* Onboarding / auth */
.onb { min-height: 100vh; display: flex; flex-direction: column; padding: calc(var(--safe-t) + 24px) 20px calc(var(--safe-b) + 20px); max-width: 520px; margin: 0 auto; }
.onb .brand { display: flex; align-items: center; gap: 10px; font: 700 22px var(--font-num); letter-spacing: -0.02em; }
.onb .brand .logo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.onb h1 { font: 700 34px/1.05 var(--font-num); letter-spacing: -0.03em; margin: 28px 0 10px; }
.onb .lead { color: var(--text-2); margin: 0 0 24px; }
.onb .steps { display: flex; gap: 6px; margin: 20px 0 0; }
.onb .steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.onb .steps i.on { background: var(--accent); }
.onb .foot { margin-top: auto; padding-top: 20px; display: flex; flex-direction: column; gap: 10px; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; font-size: 14px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.note { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.tag-est { font-size: 11px; font-weight: 700; color: var(--text-3); border: 1px dashed var(--line-2); border-radius: 6px; padding: 1px 6px; margin-left: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (max-width: 360px) {
  .hero-num { font-size: 52px; }
  .stat .v { font-size: 21px; }
  .live-grid .v { font-size: 24px; }
  .ctl.main { width: 84px; height: 84px; }
}
@media (max-height: 700px) {
  .live-primary .v { font-size: clamp(56px, 18vw, 96px); }
  .live-grid .v { font-size: 24px; }
  .ctl.main { width: 80px; height: 80px; }
  .ctl { width: 70px; height: 70px; }
}
