:root {
    --bg: #0f1115;
    --panel: #161a22;
    --panel-2: #1d222d;
    --border: #262c38;
    --text: #e6e8ee;
    --text-muted: #8c93a4;
    --accent: #fc4c02; /* Strava orange */
    --accent-2: #4cc9f0;
    --good: #2dd4bf;
    --warn: #f59e0b;
    --bad: #ef4444;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

.brand {
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.02em;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.athlete-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--panel-2);
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    border: 1px solid var(--border);
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.athlete-name {
    font-size: 13px;
    color: var(--text);
}

.link-muted {
    color: var(--text-muted);
    font-size: 13px;
}

.main {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
}
.btn:hover { background: var(--panel); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { filter: brightness(1.1); }

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.signin-hero {
    text-align: center;
    padding: 64px 16px;
}
.signin-hero h1 {
    font-size: 28px;
    margin: 0 0 12px;
}
.signin-hero p {
    color: var(--text-muted);
    margin: 0 0 32px;
}

.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
}
@media (max-width: 880px) {
    .layout { grid-template-columns: 1fr; }
}

.sidebar { display: flex; flex-direction: column; gap: 12px; }
.sidebar h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 0 0 8px; }

.slider-row { display: flex; align-items: center; gap: 8px; }
.slider-row input[type=range] { flex: 1; }
.slider-row .value {
    font-variant-numeric: tabular-nums;
    min-width: 70px;
    text-align: right;
}
.slider-row .value.editable {
    cursor: text;
    padding: 1px 4px;
    border-radius: 4px;
    border: 1px dashed transparent;
}
.slider-row .value.editable:hover {
    border-color: var(--border);
    background: var(--panel-2);
}
.slider-row .value-input {
    width: 80px;
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--accent-2);
    border-radius: 4px;
    padding: 1px 4px;
    font-family: inherit;
    font-size: inherit;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.select {
    width: 100%;
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 8px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
}

.bike-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.chart { height: 560px; }

.kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--panel-2);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 12px;
}

.muted { color: var(--text-muted); font-size: 13px; }
.warn  { color: var(--warn); }
.row   { display: flex; gap: 8px; flex-wrap: wrap; }
.status-line { color: var(--text-muted); font-size: 12px; padding-top: 8px; }
.hint  { font-size: 11px; cursor: help; }

.btn-tiny { padding: 3px 8px; font-size: 12px; }

.bike-row {
    display: grid;
    grid-template-columns: auto 12px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    border-bottom: 1px solid var(--border);
}
.bike-row:last-of-type { border-bottom: none; }
.bike-swatch { width: 12px; height: 12px; border-radius: 50%; }
.bike-meta { min-width: 0; }
.bike-name { font-weight: 500; }
.bike-sub  { color: var(--text-muted); font-size: 12px; }

.bike-edit-panel {
    padding: 8px 0 10px 24px;
    border-bottom: 1px solid var(--border);
    display: grid;
    gap: 6px;
}
.bike-edit-panel label {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.bike-edit-panel input,
.bike-edit-panel select {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 4px 6px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 12px;
    min-width: 0;
}
.select.select-tiny { padding: 3px 6px; font-size: 12px; }

.diag-header { margin-bottom: 16px; }
.diag-header h1 { margin: 0 0 4px; font-size: 22px; }
.diag-header .muted { margin: 0 0 8px; }
.diag-summary { font-size: 13px; margin-bottom: 12px; }
.chart-small { height: 220px; margin-top: 16px; }

.activity-list {
    display: grid;
    gap: 2px;
    max-height: 600px;
    overflow-y: auto;
}
.activity-row {
    display: grid;
    grid-template-columns: 200px 90px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 6px 8px;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}
.activity-row:hover { background: var(--panel-2); text-decoration: none; }
.act-date  { font-variant-numeric: tabular-nums; }
.act-type  { color: var(--text-muted); }
.act-meta  { color: var(--text-muted); }
.act-flags { font-size: 12px; }

.sync-status {
    margin-bottom: 10px;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sync-status b { font-variant-numeric: tabular-nums; }

@keyframes pulse-fade {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
}
.pulse-dot {
    color: var(--good);
    display: inline-block;
    animation: pulse-fade 1.2s ease-in-out infinite;
    margin-right: 2px;
}
.ok  { color: var(--good); }
.bad { color: var(--bad); }

.job-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.job-head {
    display: flex;
    align-items: center;
    gap: 6px;
}
.job-icon { width: 12px; display: inline-flex; align-items: center; }
.job-label { font-weight: 500; }
.job-counts { margin-left: auto; font-variant-numeric: tabular-nums; }
.job-msg { font-size: 11px; min-height: 14px; }

.progress-track {
    height: 6px;
    background: var(--panel-2);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.progress-fill {
    height: 100%;
    transition: width 0.4s ease;
    border-radius: 3px;
}
.progress-fill.running { background: var(--accent); }
.progress-fill.done    { background: var(--good); }
.progress-fill.error   { background: var(--bad); }

@keyframes indeterminate-slide {
    0%   { left: -40%; right: 100%; }
    60%  { left: 100%; right: -90%; }
    100% { left: 100%; right: -90%; }
}
.progress-track.indeterminate { background: var(--panel-2); }
.progress-track.indeterminate .progress-fill {
    width: 40% !important;
    position: absolute;
    top: 0; bottom: 0;
    animation: indeterminate-slide 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
