:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7280; --border: #e3e6eb;
  --accent: #2a7de1; --strava: #fc4c02; --ok: #3aa676; --err: #d64545;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #12151b; --card: #1b2029; --text: #e7e9ee; --muted: #9aa3b2; --border: #2a303b; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 0 0 1rem; }
.muted { color: var(--muted); font-weight: normal; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; background: var(--card); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.1rem; }
.who { display: flex; align-items: center; gap: .6rem; }
.who img { width: 28px; height: 28px; border-radius: 50%; }
.who form { margin: 0; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem; }
.narrow { max-width: 480px; margin: 3rem auto; }
.center { text-align: center; }

.btn { display: inline-block; padding: .7rem 1.4rem; border-radius: 8px; border: 0; background: var(--accent); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; margin-top: 1rem; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { padding: .4rem .9rem; margin: 0; }
.btn.google { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
.btn.strava { background: var(--strava); }
button.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
button.link.danger { color: var(--err); }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid var(--border); background: var(--card); }
.flash.error { border-color: var(--err); color: var(--err); }
.flash.success { border-color: var(--ok); }

.steps { list-style: none; padding: 0; display: flex; justify-content: center; gap: 1.5rem; color: var(--muted); font-size: .9rem; }
.steps .done::before { content: "✓ "; color: var(--ok); }
.steps .current { color: var(--text); font-weight: 600; }

.syncbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.syncbar .actions { display: flex; align-items: center; gap: 1rem; }
.syncbar form { margin: 0; }
.status { color: var(--muted); margin-left: .5rem; }
.status.error { color: var(--err); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; display: flex; flex-direction: column; min-width: 0; }
.tile .label { color: var(--muted); font-size: .85rem; }
.tile .value { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .value small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.tile .sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chart { position: relative; height: 320px; }
.chart.short { height: 220px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { font-size: .75rem; padding: 0 .4rem; border-radius: 4px; background: var(--ok); color: #fff; }
.strava-link { color: var(--strava); font-size: .85rem; }
