/*
  Kapacity app styles. Tokens from /tokens.css (design-tokens.md is the
  rationale); component styles carried over from /design-reference mockups.
*/
@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Space+Grotesk:wght@400;500;700&display=swap');

:root {
  --ink: #14171A; --ink-soft: #5B5E60; --ink-mute: #8A8D8E;
  --paper: #F6F4EE; --surface: #FFFFFF; --line: #E4E0D6;
  --coral: #E8562B; --coral-deep: #B5401E; --coral-tint: #FBE7E0;
  --teal: #0F6E56; --amber: #C97A2B;
  --neutral-100: #D9D5C9; --neutral-200: #C9C5B8; --neutral-300: #B9B6AA; --neutral-400: #A9A69C; --neutral-500: #8A8D8E;
  --font-display: 'Archivo Black', sans-serif;
  --font-body: 'Space Grotesk', sans-serif;
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px; --radius-xl: 20px; --radius-pill: 999px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body { font-family: var(--font-body); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 26px 20px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; margin-bottom: 40px; padding-left: 4px; }
.brand svg path { stroke: var(--coral); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; font-size: 14px; color: var(--ink-soft); font-weight: 500; }
.side-nav a.active { background: var(--paper); color: var(--ink); font-weight: 700; }
.side-nav a:hover { color: var(--ink); }
.side-nav a.disabled { color: #C7C4BA; pointer-events: none; }
.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.plan-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; font-size: 12.5px; color: var(--ink-soft); }
.plan-card b { display: block; color: var(--ink); font-size: 13.5px; margin-bottom: 6px; }
.plan-card .upgrade-link { display: block; margin-top: 12px; color: var(--ink); font-weight: 700; }
.plan-card .upgrade-link span { color: var(--coral); }
.plan-card .upgrade-link:hover { color: var(--coral); }
.plan-switch { display: flex; align-items: center; gap: 4px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 11px; font-weight: 700; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.03em; }
.plan-switch span { margin-right: auto; }
.plan-switch button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); border-radius: var(--radius-pill); padding: 4px 10px; font-size: 12px; font-weight: 700; text-transform: none; letter-spacing: 0; }
.plan-switch button:hover:not([disabled]) { border-color: var(--ink); color: var(--ink); }
.plan-switch button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; cursor: default; opacity: 1; }
.powered-by { font-size: 11px; color: var(--ink-mute); padding-left: 4px; }
.powered-by img { height: 14px; vertical-align: middle; }
.legal-mini { display: flex; gap: 8px; }
.legal-mini a:hover { color: var(--ink); }
.brand-block { margin-bottom: 40px; }
.brand-block .brand { margin-bottom: 2px; }
/* Lines up under "kapacity": 4px padding + 20px mark + 9px gap. */
.brand-tag { font-size: 11.5px; color: var(--ink-mute); padding-left: 33px; }
.made-by { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 18px; }
.made-by-logo { display: flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 700; color: var(--ink); }
.made-by-logo svg { width: 16px; height: 16px; flex-shrink: 0; }
.made-by-logo svg path { stroke: var(--coral); }
.made-by-tag { font-size: 12.5px; color: var(--ink-mute); }

main { padding: 36px 44px 60px; max-width: 1180px; width: 100%; min-width: 0; }
.top-row { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 16px; }
.greeting h1, .title-block h1 { font-size: 23px; font-weight: 700; letter-spacing: -0.01em; }
.greeting p { font-size: 14px; color: var(--ink-soft); margin-top: 4px; }
.title-meta { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-soft); margin-top: 6px; }
.sport-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-soft); font-weight: 500; margin-bottom: 18px; }
.back-link:hover { color: var(--ink); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn-primary { background: var(--ink); color: #fff; border: none; padding: 11px 18px; border-radius: 10px; font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary:hover { background: var(--coral); }
.btn-primary[disabled] { opacity: 0.45; pointer-events: none; }
.pro-badge { font-size: 10.5px; font-weight: 700; color: var(--coral); border: 1px solid var(--coral); border-radius: var(--radius-pill); padding: 1px 6px; }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); padding: 10px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 700; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger { background: var(--surface); border: 1px solid var(--coral); color: var(--coral-deep); padding: 10px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 700; }
.link-button { background: none; border: none; color: var(--ink-soft); font-size: 13px; font-weight: 500; text-decoration: underline; }
.sync-refresh { font-size: 13px; font-weight: 500; padding: 0; color: var(--ink-soft); text-decoration: none; }
.sync-refresh:hover:not([disabled]) { color: var(--coral); }
.sync-refresh[disabled] { text-decoration: none; cursor: default; color: var(--ink-mute); }

/* ---------- banners ---------- */
.banner { border-radius: 14px; padding: 14px 18px; font-size: 13.5px; margin-bottom: 22px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.banner.info { background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft); }
.banner.warn { background: var(--coral-tint); border: 1px solid #F0C3B3; color: var(--ink); }
.banner .actions button { padding: 7px 12px; font-size: 12.5px; }
.refreshing { display: inline-flex; align-items: center; gap: 8px; }
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--coral); animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- tiles ---------- */
.tile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px 20px 18px; display: block; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(20, 23, 26, 0.09); border-color: var(--ink); }
.tile-label { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-soft); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 16px; }
.tile-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--ink-mute); }
.tile-stat { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.tile-num { font-family: var(--font-display); font-size: 27px; letter-spacing: -0.01em; color: var(--ink); }
.tile-sub { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 14px; min-height: 32px; }
.tile-mini { margin-bottom: 14px; display: block; }
.tile-cta { font-size: 12.5px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 5px; }
.tile-cta svg { width: 11px; height: 11px; transition: transform 0.15s ease; }
.tile:hover .tile-cta { color: var(--coral); }
.tile:hover .tile-cta svg { transform: translateX(3px); }
.tile-pick { border-style: dashed; background: transparent; display: flex; flex-direction: column; }
.tile-pick-title { font-size: 17px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.tile-pick .tile-cta { margin-top: auto; }

/* ---------- panels ---------- */
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; }
.panel + .panel { margin-top: 22px; }
.grid-2 > .panel + .panel { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.panel-head h2 { font-size: 15.5px; font-weight: 700; }
.panel-head a, .panel-head span { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.empty-note { font-size: 13.5px; color: var(--ink-soft); padding: 8px 0; }

.comp-row { display: grid; grid-template-columns: 36px 1fr auto auto; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.comp-row:first-of-type { border-top: none; }
.comp-row .sport-dot { width: 10px; height: 10px; justify-self: center; }
.comp-name { font-size: 14.5px; font-weight: 700; }
.comp-sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.comp-trend { width: 74px; height: 26px; }
.comp-delta { font-size: 13.5px; font-weight: 700; text-align: right; min-width: 56px; }
.comp-delta.faster { color: var(--teal); } .comp-delta.slower { color: var(--coral); } .comp-delta.flat { color: var(--ink-mute); }

.nudge { background: var(--coral-tint); border: 1px solid #F0C3B3; border-radius: 16px; padding: 22px 24px; margin-top: 24px; }
.nudge h3 { font-size: 15px; font-weight: 700; }
.nudge p { font-size: 13.5px; color: var(--ink-soft); margin-top: 6px; max-width: 40ch; }
.nudge .btn-primary { margin-top: 14px; padding: 10px 16px; font-size: 13px; }

.activity-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.activity-row:first-of-type { border-top: none; }
.activity-name { font-weight: 500; }
.activity-date { color: var(--ink-mute); font-size: 12.5px; margin-top: 2px; }
.activity-dist { color: var(--ink-soft); text-align: right; }

/* ---------- first-run states ---------- */
.sync-hero { max-width: 560px; margin-bottom: 36px; }
.sync-hero h1 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.sync-hero p { font-size: 14px; color: var(--ink-soft); }
.progress-track { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 20px 0 10px; max-width: 420px; position: relative; }
.progress-fill.indeterminate { position: absolute; height: 100%; width: 34%; background: var(--coral); border-radius: 99px; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { from { left: -34%; } to { left: 100%; } }
.progress-caption { font-size: 12.5px; color: var(--ink-mute); }
.skeleton-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 32px; }
.skeleton-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.sk-bar { height: 10px; background: var(--paper); border-radius: 6px; margin-bottom: 14px; animation: pulse 1.6s ease-in-out infinite; }
.sk-bar.w40 { width: 40%; } .sk-bar.w60 { width: 60%; } .sk-bar.tall { height: 26px; width: 70%; margin-bottom: 18px; }
@keyframes pulse { 50% { opacity: 0.55; } }

.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 10px 20px; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease; }
.chip:hover { border-color: var(--coral); color: var(--coral); }
.chip.selected { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- comparison ---------- */
.headline-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px 26px; margin-bottom: 22px; display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.stat-bracket { display: flex; align-items: center; gap: 12px; }
.stat-num { font-family: var(--font-display); font-size: 32px; color: var(--coral); }
.stat-label { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.hc-divider { width: 1px; height: 40px; background: var(--line); }
.hc-mini { font-size: 13px; color: var(--ink-soft); }
.hc-mini b { display: block; color: var(--ink); font-size: 16px; font-weight: 700; }

.chart-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; margin-bottom: 22px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; background: var(--paper); border-radius: 9px; padding: 4px; }
.tabs button { border: none; background: transparent; padding: 7px 14px; border-radius: 7px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
.legend-note { font-size: 12.5px; color: var(--ink-mute); }
.chart-area { margin-top: 4px; overflow-x: auto; }
.chart-area svg { display: block; width: 100%; height: auto; min-width: 560px; }
.chart-loading { height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--ink-soft); font-size: 13.5px; background: repeating-linear-gradient(90deg, var(--paper) 0 1px, transparent 1px 60px); border-radius: 10px; }
.chart-empty { height: 160px; display: flex; align-items: center; justify-content: center; color: var(--ink-mute); font-size: 13.5px; text-align: center; padding: 0 24px; }

.table-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 8px 24px 6px; }
.table-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 10px; gap: 12px; flex-wrap: wrap; }
.table-panel-head h2 { font-size: 15.5px; font-weight: 700; }
.table-panel-head span { font-size: 13px; color: var(--ink-soft); }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 11.5px; letter-spacing: 0.02em; color: var(--ink-mute); font-weight: 700; padding: 10px; border-bottom: 1px solid var(--line); }
thead th.num { text-align: right; }
tbody td { padding: 13px 10px; font-size: 13.5px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody td.num { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.best td { background: var(--coral-tint); }
tbody tr.best td:first-child { border-radius: 10px 0 0 10px; }
tbody tr.best td:last-child { border-radius: 0 10px 10px 0; }
.row-check { display: flex; align-items: center; gap: 10px; }
.swatch { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.race-name { font-weight: 700; }
.race-date { color: var(--ink-mute); font-size: 12px; margin-top: 1px; }
.delta { font-weight: 700; }
.delta.faster { color: var(--teal); } .delta.slower { color: var(--coral); } .delta.flat { color: var(--ink-mute); }
.best-badge, .note-badge { display: inline-block; margin-left: 8px; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; vertical-align: middle; }
.best-badge { color: var(--coral); background: #fff; border: 1px solid var(--coral); }
.note-badge { color: var(--ink-mute); border: 1px solid var(--line); font-weight: 500; }
input[type="checkbox"] { accent-color: var(--coral); width: 15px; height: 15px; }
.show-more { display: block; text-align: center; padding: 14px 0; font-size: 13px; font-weight: 700; color: var(--ink-soft); }

/* ---------- running comparison (design-reference/kapacity-comparison.html, project context §7) ---------- */
.stat-main { display: flex; flex-direction: column; gap: 4px; }
.stat-framed { display: inline-flex; align-items: center; gap: 8px; }
.stat-framed svg { height: 30px; width: auto; flex-shrink: 0; }
.stat-framed .stat-num { line-height: 1; }
.stat-qualifier { font-family: var(--font-display); font-size: 20px; color: var(--coral); margin-left: 4px; }
.stat-unit { font-family: var(--font-body); font-size: 15px; font-weight: 700; color: var(--coral); margin-left: 4px; }
.stat-cap { font-size: 13px; color: var(--ink-soft); }
.panel-head p { font-size: 13px; color: var(--ink-soft); margin-top: 4px; max-width: 60ch; }
.panel-head p span { font-size: inherit; }

.pace-chart { overflow-x: auto; }
.pace-chart svg { display: block; width: 100%; height: auto; min-width: 560px; }
.pace-bars g.bar { cursor: pointer; outline: none; }
.pace-bars g.bar:hover rect + rect, .pace-bars g.bar:focus-visible rect + rect { opacity: 0.8; }
.pace-bars g.bar:focus-visible rect:first-of-type { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 3; }

.split-panel .panel-head { align-items: flex-start; flex-wrap: wrap; }
.split-panel:not(.show-detail) .caption-detail,
.split-panel:not(.show-detail) .key-detail,
.split-panel:not(.show-detail) td.mile .sub,
.split-panel.show-detail .caption-pace { display: none; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-soft); cursor: pointer; user-select: none; position: relative; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 32px; height: 18px; border-radius: var(--radius-pill); background: var(--line); position: relative; transition: background 0.15s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); transition: transform 0.15s; }
.switch input:checked + .track { background: var(--ink); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--ink); outline-offset: 2px; }

.grid-scroll { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
table.splits { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
table.splits th { font-size: 12px; font-weight: 700; color: var(--ink-mute); text-align: right; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; letter-spacing: 0; }
table.splits th.run-col { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.splits th.sum { color: var(--ink-soft); }
table.splits td { font-size: 14px; text-align: right; padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: top; }
table.splits tr:last-child td { border-bottom: none; }
table.splits td.run-col { text-align: left; position: sticky; left: 0; background: var(--surface); min-width: 190px; white-space: normal; z-index: 1; }
.run-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.run-name .badge { margin-left: 0; }
.run-meta { font-size: 12px; color: var(--ink-mute); margin-top: 2px; font-weight: 400; }
.remove { border: none; background: none; color: var(--ink-mute); font-size: 16px; line-height: 1; padding: 0 4px; margin-left: auto; }
.remove:hover { color: var(--ink); }
td.mile { border-left: 1px solid var(--paper); }
td.mile.empty { background: repeating-linear-gradient(135deg, var(--surface) 0 6px, var(--paper) 6px 8px); }
td.mile.best { background: var(--coral-tint); font-weight: 700; }
td.mile .pace { display: block; font-size: 14px; }
td.mile .sub { display: block; font-size: 11px; color: var(--ink-mute); font-weight: 400; margin-top: 2px; letter-spacing: 0.01em; }
td.mile.best .sub { color: var(--ink-soft); }
td.mile .part { display: block; font-size: 11px; color: var(--ink-mute); font-weight: 400; }
td.mile .sub .sk { width: 30px; height: 8px; }
table.splits td.sum { color: var(--ink-soft); }
table.splits td.sum.strong { color: var(--ink); font-weight: 700; }
table.splits .first-sum { border-left: 1px solid var(--line); }
.lvf { font-weight: 700; }
.lvf.faster { color: var(--teal); } .lvf.slower { color: var(--amber); } .lvf.flat, .lvf.none { color: var(--ink-mute); }
.delta-note { display: block; font-size: 11px; font-weight: 400; color: var(--ink-mute); }
.sk { display: inline-block; height: 10px; width: 38px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--paper), var(--line), var(--paper)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.grid-empty { padding: 32px; text-align: center; color: var(--ink-soft); font-size: 14px; border: 1px dashed var(--line); border-radius: var(--radius-md); }
.grid-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-mute); margin-top: 12px; }
.key { display: inline-flex; align-items: center; gap: 6px; }
.key i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; background: var(--coral-tint); }

table.acts { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.acts th { font-size: 12px; font-weight: 700; color: var(--ink-mute); text-align: left; padding: 8px; border-bottom: 1px solid var(--line); letter-spacing: 0; }
table.acts th.num, table.acts td.num { text-align: right; }
table.acts td { font-size: 14px; padding: 12px 8px; border-bottom: 1px solid var(--line); }
table.acts tr:last-child td { border-bottom: none; }
table.acts tr.checked td { background: var(--paper); }
table.acts tr.disabled td { color: var(--ink-mute); }
table.acts input[type="checkbox"] { accent-color: var(--ink); width: 16px; height: 16px; cursor: pointer; }
table.acts input[type="checkbox"]:disabled { cursor: not-allowed; }
.badge { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-pill); vertical-align: middle; }
.badge.fast { color: var(--coral); border: 1px solid var(--coral); }
.badge.first { color: var(--ink-soft); border: 1px solid var(--line); }
.counter { font-size: 13px; color: var(--ink-soft); }
.counter b { color: var(--ink); }

/* ---------- dashboard tour ---------- */
.tour-link { font-size: 13px; font-weight: 700; color: var(--ink-soft); padding-left: 4px; }
.tour-link:hover { color: var(--coral); }
.tour { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.tour-spot { position: fixed; border-radius: var(--radius-lg); box-shadow: 0 0 0 9999px rgba(20, 23, 26, 0.45); transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease; }
.tour-card { position: fixed; width: min(360px, calc(100vw - 32px)); background: var(--surface); border-radius: var(--radius-lg); padding: var(--space-5, 20px); box-shadow: 0 12px 32px rgba(20, 23, 26, 0.18); pointer-events: auto; outline: none; }
.tour-count { font-size: 12px; font-weight: 700; color: var(--coral); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 6px; }
.tour-card h2 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.tour-card p { font-size: 14px; color: var(--ink-soft); line-height: 1.45; }
.tour-actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.tour-nav { margin-left: auto; display: flex; gap: 8px; }
.tour-nav .btn-ghost, .tour-nav .btn-primary { padding: 8px 14px; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .tour-spot { transition: none; } }

/* ---------- range editor ---------- */
.editor { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; margin-bottom: 22px; }
.editor h2 { font-size: 15.5px; font-weight: 700; margin-bottom: 4px; }
.editor .hint { font-size: 13px; color: var(--ink-soft); margin-bottom: 16px; }
.editor-row { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }
.field input[type="number"], .field input[type="text"], .field select { font-size: 16px; font-weight: 700; color: var(--ink); border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 130px; background: var(--paper); text-transform: none; letter-spacing: 0; }
.field input:focus, .field select:focus { outline: none; border-color: var(--coral); background: var(--surface); }
.field .unit { font-size: 13px; color: var(--ink-mute); text-transform: none; font-weight: 500; }
.segmented { display: inline-flex; background: var(--paper); border-radius: 9px; padding: 4px; gap: 4px; }
.segmented label { padding: 7px 14px; border-radius: 7px; font-size: 13px; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span { color: var(--ink); }
.segmented label:has(input:checked) { background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
.range-slider { position: relative; height: 34px; margin: 6px 0 4px; max-width: 640px; }
.range-slider .track { position: absolute; top: 15px; left: 0; right: 0; height: 4px; background: var(--line); border-radius: 99px; }
.range-slider .fill { position: absolute; top: 15px; height: 4px; background: var(--coral); border-radius: 99px; }
.range-slider input[type="range"] { position: absolute; left: 0; width: 100%; top: 6px; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; height: 22px; }
.range-slider input[type="range"]::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 3px solid var(--coral); cursor: grab; }
.range-slider input[type="range"]::-moz-range-thumb { pointer-events: auto; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--coral); cursor: grab; }
.slider-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-mute); max-width: 640px; }
.editor .preview { font-size: 13px; color: var(--ink-soft); margin-top: 10px; }
.editor .error { font-size: 13px; color: var(--coral-deep); margin-top: 10px; font-weight: 700; }
.preset-chips { margin-bottom: 18px; }
.editor-dates { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 20px; }
.editor-dates h2 { font-size: 15.5px; font-weight: 700; margin-bottom: 4px; }
.editor-dates .editor-row { margin-bottom: 0; gap: 12px; }
.date-sep { font-size: 13px; color: var(--ink-mute); padding-bottom: 12px; }
.editor-dates .link-button { padding-bottom: 12px; }
/* Date fields match the distance fields above (.field input[type="number"]). */
.field input[type="date"] { font-family: var(--font-body); font-size: 16px; font-weight: 700; color: var(--ink); border: 1.5px solid var(--line); border-radius: 10px; padding: 0 10px 0 12px; width: 172px; height: 41px; background: var(--paper); text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.field input[type="date"][data-empty] { color: var(--ink-mute); font-weight: 500; }
.field input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0.4; cursor: pointer; }
.field input[type="date"]:hover::-webkit-calendar-picker-indicator { opacity: 0.75; }
.field input[type="date"]:focus { outline: none; border-color: var(--coral); background: var(--surface); }

/* ---------- settings ---------- */
.settings-section { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; margin-bottom: 18px; max-width: 720px; }
.settings-section h2 { font-size: 15.5px; font-weight: 700; margin-bottom: 4px; }
.settings-section p { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 14px; }
.settings-section.danger-zone { border-color: #F0C3B3; }

/* ---------- landing ---------- */
.landing { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; text-align: center; }
.landing .brand { margin-bottom: 30px; font-size: 20px; }
.landing h1 { font-family: var(--font-display); font-size: 44px; line-height: 1.05; max-width: 16ch; margin-bottom: 16px; }
.landing p { font-size: 16px; color: var(--ink-soft); max-width: 46ch; margin-bottom: 28px; }
.strava-connect { display: inline-block; }
.strava-connect img { height: 48px; display: block; }
.landing .fine { font-size: 12.5px; color: var(--ink-mute); margin-top: 18px; max-width: 52ch; }

@media (max-width: 1100px) { .tile-grid, .skeleton-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  main { padding: 24px 16px 48px; }
  table { font-size: 12px; }
  .hide-narrow { display: none; }
  .hc-divider { display: none; }
  .headline-card { gap: 18px; }
}
