:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #17202a;
  --muted: #67727e;
  --line: #dfe5eb;
  --accent: #e85d2a;
  --accent-dark: #c7471a;
  --accent-soft: #fff0ea;
  --secondary-bg: #273544;
  --secondary-text: #ffffff;
  --category-easy: #2f855a;
  --category-intervals: #e85d2a;
  --category-steady: #3578c6;
  --category-unclassified: #7a8793;
  --good: #237a57;
  --warn: #9d6500;
  --danger: #a43030;
  --shadow: 0 10px 30px rgba(28, 39, 49, 0.06);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; background: var(--bg); color: var(--text); overflow-x: hidden; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
button, input, select { font: inherit; }
main > *, .card, .two-column > *, .section-heading > *, .control-grid > *, .form-grid > * { min-width: 0; }
img, svg { max-width: 100%; }
button, .file-button { cursor: pointer; }

.site-header, main, footer { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.site-header { display: flex; justify-content: space-between; gap: 24px; align-items: center; padding: 34px 0 22px; }
h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.7rem); letter-spacing: -0.035em; }
.subtitle { margin: 8px 0 0; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.header-account { display: grid; gap: 8px; justify-items: end; max-width: 560px; }
.connection-disclosure { margin: 0; max-width: 540px; color: var(--muted); font-size: .78rem; line-height: 1.45; text-align: right; }
.connection-disclosure a { color: inherit; text-underline-offset: 2px; }
.header-actions .button-link.ghost { color: var(--text); border-color: var(--line); background: transparent; }


main { display: grid; gap: 18px; padding-bottom: 36px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.controls-card { padding: 18px 22px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

h2 { margin: 0; font-size: 1.15rem; }
p { line-height: 1.5; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading.compact { margin-bottom: 16px; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: .9rem; }

button, .file-button { border: 1px solid transparent; border-radius: 10px; padding: 10px 14px; font-weight: 650; transition: 120ms ease; }
button:hover, .file-button:hover { transform: translateY(-1px); }
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-dark); }
.secondary { background: var(--secondary-bg); color: var(--secondary-text); }
.secondary:hover { filter: brightness(1.08); }
.ghost, .file-button { background: transparent; border-color: var(--line); color: var(--text); }
.full-width { width: 100%; margin-top: 16px; }
.small-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.file-button input { display: none; }
.danger-link { background: none; border: 0; color: var(--danger); padding: 2px 0; }
.footer-action { background: transparent; border: 0; color: var(--muted); padding: 2px 0; text-decoration: underline; text-underline-offset: 2px; font-weight: 650; }
.footer-action:hover { color: var(--text); transform: none; }

.badge { background: var(--surface-soft); border: 1px solid var(--line); color: var(--muted); padding: 7px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; }

/* Keep the official Strava artwork free of the app's generic button chrome. */
.strava-connect-button {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  line-height: 0;
  box-shadow: none;
}
.strava-connect-button:hover { transform: none; }
.strava-connect-button img { display: block; width: auto; height: 48px; max-width: 100%; }
.strava-connect-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.badge.connected { background: #edf9f4; color: var(--good); border-color: #bde8d6; }

.control-grid { display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 14px; align-items: end; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label, .button-field { display: grid; gap: 7px; color: var(--muted); font-size: .84rem; font-weight: 650; }
input, select { width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inline-fields { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.time-fields { grid-template-columns: 1fr auto 1fr auto 1fr; }
.inline-fields span { color: var(--muted); }
.checkbox-label { grid-template-columns: auto 1fr; align-items: center; align-self: end; min-height: 42px; }
.checkbox-label input { width: auto; }
.status-line { min-height: 20px; margin-top: 10px; color: var(--muted); font-size: .86rem; }
.status-line.error { color: var(--danger); }
.history-status { margin-top: 2px; font-size: .8rem; }

.summary-metrics { display: flex; gap: 24px; text-align: right; }
.summary-metrics > div { display: grid; gap: 3px; }
.metric-label { font-size: .75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.summary-metrics strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.chart-heading-copy { display: grid; gap: 8px; }
.chart-tabs { display: inline-flex; width: fit-content; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); gap: 2px; }
.chart-tab { background: transparent; color: var(--muted); border: 0; border-radius: 999px; padding: 6px 10px; font-size: .78rem; font-weight: 700; box-shadow: none; transform: none !important; }
.chart-tab:hover { color: var(--text); }
.chart-tab.active { background: var(--secondary-bg); color: var(--secondary-text); }
.chart-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chart-pane { min-width: 0; }

.chart-wrap { position: relative; min-height: 360px; background: linear-gradient(180deg, rgba(248,250,252,.75), rgba(255,255,255,.2)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
#fitnessChart, #hrSpeedChart { display: block; width: 100%; height: 360px; }
.empty-state { display: grid; place-items: center; min-height: 180px; color: var(--muted); text-align: center; padding: 24px; }
.chart-wrap .empty-state { position: absolute; inset: 0; }
.legend { display: flex; gap: 14px 18px; margin-top: 11px; color: var(--muted); font-size: .8rem; flex-wrap: wrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.category-easy { background: var(--category-easy); }
.category-intervals { background: var(--category-intervals); }
.category-steady { background: var(--category-steady); }
.category-unclassified { background: var(--category-unclassified); }
.line { width: 18px; display: inline-block; border-top: 2px dashed currentColor; margin: 0 6px 3px 0; }
.goal-line-key { color: #50657a; }

.chart-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 11px; }
.chart-footer .legend { margin-top: 0; }
#shareProgressBtn { white-space: nowrap; flex: 0 0 auto; }

.chart-footer-secondary { justify-content: space-between; min-height: 38px; }
.age-legend { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .8rem; }
.age-swatch { width: 11px; height: 11px; border-radius: 50%; display: inline-block; background: var(--text); }
.age-swatch.old { opacity: .18; }
.age-swatch.middle { opacity: .52; }
.age-swatch.new { opacity: .95; }

.goal-result { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr 1.35fr; gap: 10px; }
.goal-result > div { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; padding: 13px; display: grid; gap: 4px; }
.goal-result span { color: var(--muted); font-size: .76rem; font-weight: 700; }
.goal-result strong { font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.goal-index { background: var(--accent-soft) !important; border-color: #ffd2c2 !important; }
.fine-print { color: var(--muted); font-size: .78rem; margin: 13px 0 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: .86rem; }
th { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr[data-id] { cursor: pointer; }
tbody tr[data-id]:hover { background: var(--surface-soft); }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; font-size: .73rem; font-weight: 750; }
.pill.yes { color: var(--good); background: #edf9f4; }
.pill.no { color: var(--muted); background: var(--surface-soft); }
.pill.category-easy { color: var(--category-easy); background: color-mix(in srgb, var(--category-easy) 13%, transparent); }
.pill.category-intervals { color: var(--category-intervals); background: color-mix(in srgb, var(--category-intervals) 13%, transparent); }
.pill.category-steady { color: var(--category-steady); background: color-mix(in srgb, var(--category-steady) 13%, transparent); }
.pill.category-unclassified { color: var(--category-unclassified); background: color-mix(in srgb, var(--category-unclassified) 13%, transparent); }
.run-name-cell { display: grid; gap: 3px; }
.strava-link { width: fit-content; color: #fc5200; font-size: .75rem; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.compact-empty { min-height: 90px; }
.runs-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}
.runs-pagination button {
  min-width: 92px;
  padding: 8px 12px;
}
.runs-page-info {
  min-width: 190px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 650;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.rep-checkbox { width: auto; }

.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; border: 1px solid transparent; border-radius: 10px; padding: 10px 14px; font-weight: 650; transition: 120ms ease; }
.button-link:hover { transform: translateY(-1px); }
.button-link[aria-disabled="true"] { pointer-events: none; opacity: .55; }
button:disabled { cursor: wait; opacity: .65; transform: none !important; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }


.support-strip { display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--surface-soft); color: var(--muted); }
.support-strip > div { display: grid; gap: 2px; }
.support-strip strong { color: var(--text); font-size: .9rem; }
.support-strip span { font-size: .82rem; line-height: 1.4; }
.support-link { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; text-decoration: none; line-height: 0; }
.support-link img { display: block; width: min(220px, 38vw); height: auto; border-radius: 11px; }
.support-link:hover img { filter: brightness(.96); transform: translateY(-1px); }
.support-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.interval-test-toggle {
  display: grid;
  gap: 5px;
  justify-items: start;
  padding: 4px 2px 0;
  color: var(--muted);
  font-size: .78rem;
}
.interval-test-toggle label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 650;
  cursor: pointer;
}
.interval-test-toggle input { width: auto; margin: 0; }
.interval-test-toggle small { padding-left: 24px; line-height: 1.45; }
.interval-test-toggle strong { color: var(--text); }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 0 0 34px; color: var(--muted); font-size: .82rem; }
.footer-links { display: flex; align-items: center; gap: 14px; }
.footer-links a { color: var(--muted); text-underline-offset: 2px; }
.hidden { display: none !important; }
.toast { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); background: #17202a; color: white; border-radius: 10px; padding: 11px 14px; box-shadow: 0 16px 40px rgba(0,0,0,.16); opacity: 0; transform: translateY(12px); pointer-events: none; transition: 180ms ease; max-width: 360px; z-index: 20; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (min-width: 801px) {
  .chart-card > .section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
    align-items: start;
    width: 100%;
  }

  .chart-card .summary-metrics {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    text-align: center;
  }

  .chart-card .summary-metrics > div { min-width: 0; }
}

@media (max-width: 800px) {
  .site-header, main, footer { width: min(100% - 24px, 1180px); }
  .site-header { align-items: stretch; flex-direction: column; gap: 16px; padding: 22px 0 16px; }
  .site-header > div:first-child { min-width: 0; }
  .header-account { width: 100%; max-width: none; justify-items: start; }
  .connection-disclosure { max-width: 680px; text-align: left; font-size: .8rem; }
  h1 { font-size: clamp(1.75rem, 8vw, 2.3rem); }
  .subtitle { font-size: .92rem; }

  .header-actions { width: 100%; justify-content: flex-start; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
  .header-actions .badge { grid-column: 1 / -1; width: fit-content; }
  .header-actions button, .header-actions .button-link { width: 100%; }
  .header-actions .strava-connect-button { width: fit-content; justify-self: start; }
  .strava-connect-button img { height: 44px; }

  main { gap: 14px; padding-bottom: 26px; }
  .card { padding: 16px; border-radius: 14px; }
  .controls-card { padding: 15px 16px; }
  .two-column, .control-grid, .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .button-field button, .full-width { min-height: 44px; }

  input, select { min-height: 44px; font-size: 16px; }
  .inline-fields { min-width: 0; }
  .inline-fields input { min-width: 0; padding-inline: 8px; }
  .time-fields { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 5px; }
  .pace-cutoff-fields { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }

  .section-heading { flex-direction: column; gap: 12px; margin-bottom: 14px; }
  .section-heading p { font-size: .86rem; }
  .summary-metrics { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; text-align: center; }
  .summary-metrics > div { padding: 8px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
  .metric-label { font-size: .68rem; }

  .chart-heading-copy { width: 100%; }
  .chart-tabs { width: 100%; display: grid; grid-template-columns: 1fr 1fr; border-radius: 11px; }
  .chart-tab { width: 100%; min-height: 38px; border-radius: 8px; }
  .chart-card { padding-inline: 12px; }
  .chart-wrap { min-height: 280px; border-radius: 10px; }
  #fitnessChart, #hrSpeedChart { height: 280px; }
  .chart-footer, .chart-footer-secondary { width: 100%; align-items: stretch; flex-direction: column; gap: 10px; }
  .legend { gap: 9px 12px; font-size: .76rem; }
  .age-legend { font-size: .76rem; }
  #shareProgressBtn { align-self: flex-end; width: auto; min-height: 40px; }

  .goal-result { grid-template-columns: 1fr; gap: 8px; }
  .goal-result > div { padding: 11px 12px; }

  .support-strip { align-items: flex-start; flex-direction: column; gap: 11px; padding: 13px 14px; }
  .support-link img { width: min(195px, 62vw); }

  .small-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .small-actions > * { width: 100%; min-height: 42px; text-align: center; justify-content: center; }

  .table-wrap { overflow: visible; }
  .responsive-table { min-width: 0; display: block; }
  .responsive-table thead { display: none; }
  .responsive-table tbody { display: grid; gap: 10px; }
  .responsive-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
  .responsive-table td { display: grid; gap: 3px; padding: 0; border: 0; min-width: 0; font-size: .85rem; }
  .responsive-table td::before { content: attr(data-label); color: var(--muted); font-size: .67rem; font-weight: 750; text-transform: uppercase; letter-spacing: .045em; }

  /* Runs use a denser two-row card on phones: name/category, then the metrics. */
  .runs-table tbody { gap: 7px; }
  .runs-table tr {
    grid-template-columns: minmax(0, 1.45fr) repeat(3, minmax(0, 1fr));
    gap: 6px 9px;
    padding: 9px 10px;
  }
  .runs-table td { gap: 1px; font-size: .79rem; line-height: 1.22; }
  .runs-table td::before { font-size: .58rem; letter-spacing: .035em; }
  .runs-table td:nth-child(2) { grid-column: 1 / 4; grid-row: 1; }
  .runs-table td:nth-child(4) { grid-column: 4; grid-row: 1; align-self: start; justify-self: end; }
  .runs-table td:nth-child(1) { grid-column: 1; grid-row: 2; white-space: nowrap; font-size: .73rem; }
  .runs-table td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .runs-table td:nth-child(5) { grid-column: 3; grid-row: 2; }
  .runs-table td:nth-child(6) { grid-column: 4; grid-row: 2; }
  .runs-table td:nth-child(1)::before,
  .runs-table td:nth-child(2)::before { display: none; }
  .laps-table td:nth-child(2) { grid-column: 1 / -1; }
  .run-name-cell { gap: 2px; font-size: .84rem; line-height: 1.2; }
  .strava-link { font-size: .7rem; }
  .runs-table .pill { padding: 3px 6px; font-size: .66rem; }
  .rep-checkbox { min-height: auto; }


  .runs-pagination { gap: 8px; margin-top: 13px; }
  .runs-pagination button { width: auto; min-width: 82px; min-height: 40px; padding: 8px 10px; }
  .runs-page-info { min-width: 0; flex: 1; font-size: .76rem; }

  .interval-test-toggle { padding-inline: 4px; }
  .interval-test-toggle label { align-items: flex-start; }
  .interval-test-toggle input { margin-top: 2px; min-height: auto; }
  .interval-test-toggle small { padding-left: 0; }

  footer { align-items: flex-start; flex-direction: column; gap: 12px; padding-bottom: calc(26px + env(safe-area-inset-bottom)); }
  .footer-links { width: 100%; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 10px 16px; }
  .toast { left: 12px; right: 12px; max-width: none; }
}

@media (max-width: 420px) {
  .site-header, main, footer { width: calc(100% - 18px); }
  .card { padding: 14px; }
  .chart-card { padding-inline: 9px; }
  .summary-metrics { gap: 6px; }
  .summary-metrics > div { padding-inline: 4px; }
  .chart-wrap { min-height: 260px; }
  #fitnessChart, #hrSpeedChart { height: 260px; }
  .small-actions { grid-template-columns: 1fr; }
  .responsive-table tr { grid-template-columns: 1fr 1fr; padding: 12px; gap: 9px 12px; }
  .runs-table tr {
    grid-template-columns: minmax(0, 1.35fr) repeat(3, minmax(0, 1fr));
    padding: 8px 9px;
    gap: 5px 7px;
  }
  .runs-table td { font-size: .75rem; }
  .runs-table td:nth-child(1) { font-size: .68rem; }
  .runs-table .pill { font-size: .62rem; }
  .support-link img { width: min(185px, 68vw); }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1318;
    --surface: #151b21;
    --surface-soft: #1b232b;
    --text: #edf2f6;
    --muted: #9ba8b3;
    --line: #2b353e;
    --accent-soft: #3a2118;
    --secondary-bg: #2a3947;
    --secondary-text: #f3f6f8;
    --shadow: none;
  }
  .goal-index { border-color: #68402f !important; }
  .badge.connected { background: #132a22; border-color: #245541; }
  .chart-wrap { background: #11171c; }
}

/* Privacy page */
.privacy-header { padding-bottom: 12px; }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--muted); font-size: .85rem; font-weight: 650; text-decoration: none; }
.back-link:hover { color: var(--text); }
.privacy-main { max-width: 850px; }
.privacy-card { display: grid; gap: 10px; }
.privacy-card h2 { margin-top: 16px; }
.privacy-card p { margin: 0; color: var(--muted); }
.privacy-card strong { color: var(--text); }
.privacy-updated { font-size: .84rem; }
.privacy-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

/* Install prompt: visible only when app.js determines installation is relevant. */
.install-app-card {
  width: min(1180px, calc(100% - 32px));
  margin: 8px auto 22px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}

.install-app-card.hidden { display: none; }

.install-app-icon {
  width: 48px;
  height: 48px;
  display: block;
  border-radius: 12px;
  object-fit: cover;
}

.install-app-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.install-app-copy strong { color: var(--text); font-size: 1rem; }
.install-app-copy > span { color: var(--muted); font-size: .88rem; line-height: 1.4; }
.install-ios-help { margin-top: 5px; color: var(--text) !important; }

.install-app-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.install-app-primary {
  white-space: nowrap;
}

.install-app-dismiss {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  box-shadow: none;
  white-space: nowrap;
}

.install-app-dismiss:hover {
  color: var(--text);
  background: transparent;
  transform: none;
}

@media (max-width: 800px) {
  .install-app-card {
    width: min(100% - 24px, 1180px);
    grid-template-columns: 44px minmax(0, 1fr);
    padding: 16px;
    margin-top: 4px;
  }

  .install-app-icon { width: 44px; height: 44px; border-radius: 11px; }

  .install-app-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .install-app-primary { flex: 1; }
  .install-app-dismiss { width: auto; flex: 0 0 auto; }
}

@media (max-width: 420px) {
  .install-app-card { width: calc(100% - 18px); }
  .install-app-actions { align-items: stretch; }
}

/* History pipeline */
.category-estimated { background: var(--category-unclassified); }
.pill.category-estimated { color: var(--category-unclassified); background: color-mix(in srgb, var(--category-unclassified) 13%, transparent); }
.history-import-note { margin-top: 8px; }
.history-import-note code { font-size: 0.92em; }
.lap-pending { text-align: center; color: var(--muted); padding: 24px !important; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (min-width: 801px) {
  .controls-card .control-grid { grid-template-columns: minmax(120px, .8fr) minmax(150px, 1fr) auto auto; }
}

/* Activity-source layout: data providers are peers rather than part of the app header. */
.view-controls {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(180px, 260px);
  gap: 14px;
  align-items: end;
}

.source-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.source-section-heading { margin-bottom: 12px; }
.source-section-heading h2 { margin: 0; }
.source-section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .88rem;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.source-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.source-card-heading { display: grid; gap: 5px; }
.source-card-heading > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.source-card-heading strong { font-size: .95rem; color: var(--text); }
.source-card-heading p {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
}

.source-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.source-card .connection-disclosure {
  max-width: none;
  margin: 0;
  text-align: left;
  font-size: .76rem;
}

.source-card .history-import-note { margin: 0; }

@media (max-width: 700px) {
  .view-controls { grid-template-columns: 1fr 1fr; }
  .source-grid { grid-template-columns: 1fr; }
  .source-actions > button:not(.strava-connect-button),
  .source-actions > .button-link { width: 100%; text-align: center; justify-content: center; }
}

@media (max-width: 460px) {
  .view-controls { grid-template-columns: 1fr; }
}
