/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Reset
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Race calendar and results
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.races-page,
.race-detail-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ── Page header ── */
.races-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.races-page-header .page-title {
    margin-bottom: 2px;
}

.races-page-header p {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
}

.races-page-switch {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 15px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-card);
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.races-page-switch:hover {
    border-color: var(--amber-border);
}

/* ── Feed warning ── */
.races-feed-warning {
    padding: 9px 12px;
    border: 1px solid var(--amber-border);
    border-left: 3px solid var(--accent);
    border-radius: 0 7px 7px 0;
    background: var(--amber-tint);
    color: var(--text-2);
    font-size: 11px;
}

/* ── Calendar: next race card ── */
.race-next-card {
    display: flex;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid var(--amber-border);
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.04);
}

.race-next-card__date {
    display: flex;
    flex: 0 0 104px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 130px;
    background: var(--amber-tint);
    color: var(--amber-dark);
    font-family: var(--font-mono);
    text-transform: uppercase;
}

.race-next-card__date span,
.race-next-card__date small {
    font-size: 10px;
    letter-spacing: 0.1em;
}

.race-next-card__date strong {
    font-size: 38px;
    line-height: 1.05;
}

.race-next-card__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 22px 26px;
}

.race-card__eyebrow {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.race-next-card h2 {
    margin-top: 5px;
    font-size: 24px;
    letter-spacing: -0.025em;
}

.race-next-card p {
    margin-top: 5px;
    color: var(--text-2);
    font-size: 12px;
}

/* ── Calendar: schedule section ── */
.races-section {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.04);
}

.races-section__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 14px 18px 11px;
    border-bottom: 1px solid var(--row-border);
}

.races-section__header h2 {
    font-size: 14px;
}

.races-section__header span {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 9px;
}

.race-schedule-row {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) auto 104px;
    align-items: center;
    gap: 14px;
    min-height: 72px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--row-border);
    color: inherit;
    text-decoration: none;
}

.race-schedule-row:hover h3 {
    color: var(--amber-dark);
}

.race-schedule-row:last-child {
    border-bottom: 0;
}

.race-schedule-row__date {
    display: flex;
    flex-direction: column;
    font-family: var(--font-mono);
}

.race-schedule-row__date strong {
    font-size: 13px;
}

.race-schedule-row__date span,
.race-schedule-row__main span {
    color: var(--muted);
    font-size: 9px;
}

.race-schedule-row__main h3 {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.race-distance-pill,
.race-status-pill {
    padding: 4px 7px;
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 9px;
    white-space: nowrap;
}

.race-distance-pill {
    background: var(--tag-race-pace-bg);
    color: var(--tag-race-pace-text);
}

.race-status-pill {
    text-align: center;
}

.race-status-pill--upcoming {
    background: var(--amber-tint);
    color: var(--amber-dark);
}

.race-status-pill--pending {
    background: var(--surface-2);
    color: var(--muted);
}

.races-empty {
    padding: 30px 18px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

/* ── Results: PB strip ── */
.race-pb-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.race-pb-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    padding: 16px 18px;
    text-decoration: none;
    transition: background 0.1s;
}

.race-pb-card:hover {
    background: var(--surface-2);
}

.race-pb-card__indicator {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: var(--accent);
}

.race-pb-card__label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}

.race-pb-card__time {
    margin: 11px 0 6px;
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}

.race-pb-card__sub {
    font-size: 11px;
    line-height: 1.4;
    color: var(--muted);
}

/* ── Results: year sections ── */
.races-year {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.races-year__header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border);
}

.races-year__header h3 {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.races-year__header span {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
}

/* ── Results: race cards ── */
.race-results-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.race-result-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 13px;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.04);
    text-decoration: none;
}

.race-result-card:hover h3 {
    color: var(--amber-dark);
}

.race-result-card__image-wrap {
    position: relative;
    height: 118px;
    flex-shrink: 0;
    background: var(--surface-2);
}

.race-result-card__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.race-result-card__image--empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: radial-gradient(
        var(--border-rail) 1px,
        transparent 1.5px
    );
    background-size: 16px 16px;
    background-color: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.race-result-card__image--empty span {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--border-rail);
    letter-spacing: -0.01em;
    text-align: center;
}

.race-result-card__type-badge {
    position: absolute;
    left: 11px;
    bottom: 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #fff;
    background: rgba(33, 29, 23, 0.62);
    backdrop-filter: blur(2px);
    padding: 3px 8px;
    border-radius: 6px;
}

.race-result-card__content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.race-result-card__body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 13px 15px 11px;
    flex: 1;
}

.race-result-card__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
}

.race-result-card__meta-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--track);
    flex-shrink: 0;
}

.race-result-card h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.race-result-card__place {
    min-height: 15px;
    font-size: 12px;
    line-height: 1.2;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.race-result-card__footer {
    display: flex;
    align-items: baseline;
    gap: 9px;
    margin-top: auto;
    padding: 11px 15px 13px;
    border-top: 1px solid var(--row-border);
}

.race-result-card__time {
    font-family: var(--font-mono);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}

.race-result-card__pace {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
}

.race-result-card__rank {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: var(--amber-tint);
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

/* ── Race detail: back link ── */
.race-detail-back {
    align-self: flex-start;
    font-size: 13px;
    font-weight: 600;
    color: var(--amber-dark);
    text-decoration: none;
}

.race-detail-back:hover {
    color: var(--amber-dark);
}

.race-detail-back--mobile {
    display: none;
}

/* ── Race detail: hero ── */
.race-detail-hero__img-wrap {
    position: relative;
    height: 280px;
    background: var(--surface-2);
    background-image: radial-gradient(var(--track) 1px, transparent 1.5px);
    background-size: 16px 16px;
}

.race-detail-hero__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 32%;
    display: block;
}

.race-detail-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(28, 24, 18, 0) 34%,
        rgba(28, 24, 18, 0.78) 100%
    );
}

.race-detail-hero__badge {
    position: absolute;
    left: 24px;
    top: 22px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #fff;
    background: rgba(33, 29, 23, 0.5);
    backdrop-filter: blur(3px);
    padding: 5px 11px;
    border-radius: 7px;
}

.race-detail-hero__title-block {
    position: absolute;
    left: 26px;
    bottom: 22px;
    right: 26px;
}

.race-detail-hero__eyebrow {
    display: block;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #f0d9b8;
}

.race-detail-hero h1 {
    margin: 9px 0 0;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: #fff;
    text-wrap: pretty;
}

.race-detail-hero--no-image .race-detail-hero__eyebrow {
    color: var(--muted);
}

.race-detail-hero--no-image h1 {
    color: var(--text);
}

/* ── Race detail: stats ── */
.race-detail-stats {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 1px;
    background: var(--border);
    border-top: 1px solid var(--border);
}

.race-detail-stats > div {
    background: var(--bg-card);
    padding: 16px 18px;
}

.race-detail-stats span {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.race-detail-stats strong {
    display: block;
    margin-top: 9px;
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
    white-space: nowrap;
}

.race-detail-stats small {
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}

/* ── Race detail: actions ── */
.race-detail-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    padding: 16px 18px;
    border-top: 1px solid var(--border);
}

.race-detail-actions__secondary {
    display: flex;
    gap: 9px;
}

.race-detail-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 15px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-card);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.race-detail-action:hover {
    border-color: var(--amber-border);
    color: var(--text);
}

.race-detail-action--primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.race-detail-action--primary:hover {
    background: var(--amber-dark);
    border-color: var(--amber-dark);
    color: #fff;
}

/* ── Race report ── */
.race-report__body {
    padding: 0 22px 20px;
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.65;
}

.race-report__body > * + * {
    margin-top: 12px;
}

.race-report__body a {
    color: var(--amber-dark);
}

.race-report__body ul,
.race-report__body ol {
    padding-left: 20px;
}

.race-report__body table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 10px;
}

.race-report__body th,
.race-report__body td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--row-border);
    text-align: left;
}

/* ── Race gallery ── */
.race-gallery__grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 7px;
    padding: 0 4px 4px;
}

.race-gallery__item {
    display: block;
    aspect-ratio: 1;
    border-radius: 9px;
    overflow: hidden;
    background: var(--surface-2);
    border: 0;
    padding: 0;
    cursor: zoom-in;
}

.race-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
    display: block;
}

.race-gallery__item:hover img {
    transform: scale(1.04);
}

/* ── Lightbox ── */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(28, 24, 18, 0.92);
    backdrop-filter: blur(4px);
}

.lightbox[hidden] {
    display: none;
}

.lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: transparent;
    border: 0;
    cursor: zoom-out;
    width: 100%;
    height: 100%;
}

.lightbox__image {
    position: relative;
    z-index: 1;
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    display: block;
}

.lightbox__nav {
    position: absolute;
    z-index: 2;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(252, 250, 245, 0.12);
    border: 1px solid rgba(252, 250, 245, 0.2);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.lightbox__nav:hover {
    background: rgba(252, 250, 245, 0.24);
}

.lightbox__nav--prev {
    left: 24px;
}
.lightbox__nav--next {
    right: 24px;
}

.lightbox__ui {
    position: absolute;
    z-index: 2;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.lightbox__counter {
    color: rgba(252, 250, 245, 0.7);
    font-family: var(--font-mono);
    font-size: 12px;
}

.lightbox__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(252, 250, 245, 0.12);
    border: 1px solid rgba(252, 250, 245, 0.2);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.lightbox__close:hover {
    background: rgba(252, 250, 245, 0.24);
}

/* ── Responsive ── */
@media (max-width: 700px) {
    .races-page-header {
        align-items: flex-start;
    }

    .race-next-card__date {
        flex-basis: 82px;
        min-height: 112px;
    }

    .race-next-card__date strong {
        font-size: 31px;
    }

    .race-next-card__body {
        padding: 17px 16px;
    }

    .race-next-card h2 {
        font-size: 19px;
    }

    .race-schedule-row {
        grid-template-columns: 62px minmax(0, 1fr) auto;
        gap: 9px;
        padding: 10px 12px;
    }

    .race-status-pill {
        grid-column: 2 / -1;
        justify-self: start;
    }

    /* PB strip: stays 3-col, smaller */
    .race-pb-card {
        padding: 11px 11px 12px;
    }

    .race-pb-card__label {
        font-size: 9px;
        letter-spacing: 0.08em;
    }

    .race-pb-card__time {
        margin: 8px 0 4px;
        font-size: 19px;
    }

    .race-pb-card__sub {
        font-size: 9px;
        line-height: 1.3;
    }

    /* Race cards: horizontal rows */
    .race-results-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .race-result-card {
        flex-direction: row;
    }

    .race-result-card__image-wrap {
        width: 96px;
        flex-shrink: 0;
        height: auto;
        min-height: 90px;
    }

    .race-result-card__content {
        flex: 1;
        min-width: 0;
    }

    .race-result-card__body {
        padding: 11px 13px 8px;
    }

    .race-result-card__meta {
        font-size: 10px;
    }

    .race-result-card h3 {
        font-size: 14px;
    }

    .race-result-card__footer {
        padding: 8px 13px 11px;
    }

    .race-result-card__time {
        font-size: 16px;
    }

    .race-result-card__rank {
        font-size: 10px;
        padding: 2px 7px;
    }

    /* Race detail */
    .race-detail-back--desktop {
        display: none;
    }

    .race-detail-back--mobile {
        display: block;
        position: absolute;
        top: 16px;
        left: 18px;
        z-index: 10;
        font-size: 13px;
        font-weight: 600;
        color: #fff;
        text-decoration: none;
    }

    .race-detail-hero__img-wrap {
        height: 260px;
    }

    .race-detail-hero h1 {
        font-size: 24px;
        line-height: 1.1;
    }

    .race-detail-hero__badge {
        display: none;
    }

    .race-detail-stats {
        grid-auto-flow: unset;
        grid-template-columns: repeat(3, 1fr);
    }

    .race-detail-stats > div {
        padding: 11px 12px 12px;
    }

    .race-detail-stats span {
        font-size: 9px;
        letter-spacing: 0.08em;
    }

    .race-detail-stats strong {
        font-size: 16px;
        margin-top: 7px;
    }

    .race-detail-stats small {
        font-size: 10px;
    }

    .race-detail-actions {
        padding: 12px 14px;
        flex-direction: column;
        align-items: stretch;
    }

    .race-detail-actions__secondary {
        gap: 8px;
    }

    .race-detail-actions__secondary .race-detail-action {
        flex: 1;
        justify-content: center;
        height: 40px;
    }

    .race-detail-action--primary {
        justify-content: center;
        height: 42px;
    }

    .race-gallery__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .race-gallery__item {
        border-radius: 8px;
    }

    .race-report__body {
        overflow-x: auto;
        padding: 0 16px 16px;
    }

    .lightbox__nav--prev {
        left: 12px;
    }
    .lightbox__nav--next {
        right: 12px;
    }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Design tokens — warm amber (default / light)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
:root {
    --bg: #f3efe7;
    --bg-card: #fcfaf5;
    --bg-rail: #efe9dd;
    --surface: #fcfaf5;
    --surface-2: #f1ebde;
    --border: #e7e0d2;
    --border-rail: #e1d9c8;
    --row-border: #efe9dd;
    --track: #ece5d7;
    --text: #2a2620;
    --text-2: #6f6757;
    --muted: #9b9281;

    --accent: #d9700f;
    --amber-dark: #b65f0c;
    --amber-tint: #f7ead6;
    --amber-border: #eed8b6;
    --pace: #3b6ea5;
    --hr: #c8553d;
    --elev: #5b8a51;
    --tsb-pos: #5b8a51;
    --tsb-neg: #c8553d;
    --tan: #c2a878;

    /* Training load chart */
    --chart-tsb-fill: rgba(217, 112, 15, 0.09);
    --chart-atl-fill: rgba(200, 85, 61, 0.09);
    --chart-corridor: rgba(200, 85, 61, 0.07);
    /* Pace distribution zone lines */
    --pd-lt2: #4e8ab0;
    --pd-vo2max: #c8553d;
    --pd-marathon: #9b78c0;
    --pd-tenk: #d9700f;

    --rail-w: 204px;
    --rail-bg: #efe9dd;
    --rail-border: #e1d9c8;
    --rail-active-bg: #f3e3cf;
    --rail-active-text: #b65f0c;

    --font-sans: "Hanken Grotesk", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", monospace;

    --tag-race-bg: #fde8e4;
    --tag-race-text: #7e2a1e;
    --tag-workout-bg: #f5e4cf;
    --tag-workout-text: #b65f0c;
    --tag-long-bg: #e6efe1;
    --tag-long-text: #3a6632;
    --tag-easy-bg: #ece5d7;
    --tag-easy-text: #6f6757;
    --tag-recovery-bg: #f1ebde;
    --tag-recovery-text: #8a8273;
    --tag-intensity-bg: #e3ecf5;
    --tag-intensity-text: #3b6ea5;
    --tag-race-pace-bg: #dff4f0;
    --tag-race-pace-text: #2c7065;
    --tag-interval-bg: #ede9fe;
    --tag-interval-text: #5b21b6;

    --pol-fast: #d9700f;
    --pol-slow: #e9dcc4;
    --pol-text: #ffffff;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Base
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.5;
}

a {
    color: inherit;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   App layout — rail + content
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: row;
    background: var(--bg);
    color: var(--text);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Left rail navigation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.rail {
    width: var(--rail-w);
    padding: 24px 18px;
    background: var(--bg-rail);
    border-right: 1px solid var(--border-rail);
    display: flex;
    flex-direction: column;
    gap: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.rail-logo {
    display: block;
    padding: 0 0 28px;
    color: var(--text);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 20px;
    text-decoration: none;
    flex-shrink: 0;
    letter-spacing: 0;
}
.rail-logo-dot {
    color: var(--accent);
}

.rail-nav {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.rail-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rail-group-label {
    display: block;
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #a59b86;
    padding: 0 8px 6px;
}

.rail-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    color: #6f6757;
    text-decoration: none;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 500;
    transition:
        background 0.1s,
        color 0.1s;
    white-space: nowrap;
}
.rail-link:hover {
    color: var(--rail-active-text);
    background: rgba(217, 112, 15, 0.08);
}
.rail-link--active {
    background: var(--rail-active-bg);
    color: var(--rail-active-text);
    font-weight: 600;
}

.rail-link-icon {
    width: 6px;
    height: 6px;
    border-radius: 1px;
    background: currentColor;
    flex-shrink: 0;
    opacity: 0.55;
}
.rail-link--active .rail-link-icon,
.rail-link:hover .rail-link-icon {
    opacity: 1;
}

.rail-footer {
    border-top: 1px solid var(--border-rail);
    padding: 14px 4px 4px;
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    margin-top: 16px;
}
.rail-footer-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 12px;
    padding: 5px 8px;
    border-radius: 6px;
    line-height: 1;
}
.rail-footer-btn:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.06);
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: var(--rail-w);
    padding: 28px;
    min-width: 0;
    max-width: calc(var(--rail-w) + 920px);
}

/* ── Mobile: bottom tab bar ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --rail-w: 0px;
    }

    .rail {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 48px;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border-rail);
        overflow: hidden;
        padding: 0;
        background: var(--bg-rail);
        gap: 0;
    }
    .rail-logo {
        display: none;
    }
    .rail-nav {
        flex: 1;
        display: flex;
        flex-direction: row;
        align-items: stretch;
        padding: 0;
        overflow: hidden;
        gap: 0;
    }
    .rail-group {
        display: contents;
    }
    .rail-group-label {
        display: none;
    }
    .rail-link {
        flex: 1;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 3px;
        padding: 4px 2px;
        font-size: 10px;
        text-align: center;
        border-radius: 0;
    }
    .rail-link-icon {
        width: 14px;
        height: 14px;
        border-radius: 3px;
    }
    .rail-footer {
        display: none;
    }
    .main-content {
        margin-left: 0;
        padding: 16px 16px 64px;
    }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Page container
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.page {
    max-width: 880px;
}

/* Dashboard page: flex column with uniform card gap */
.dash-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Page title row */
.page-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}
.page-title-row {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 20px;
}
.page-title-row .page-title {
    margin-bottom: 0;
}
.page-title-link {
    font-size: 11px;
    color: var(--muted);
    text-decoration: none;
}
.page-title-link:hover {
    color: var(--text);
}

/* Section title */
.section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 10px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Widget — shared surface card base
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.widget {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.04);
}
/* ── Widget header system ── */
.widget__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px 16px;
    direction: ltr;
}
.widget__body {
    padding: 14px 20px;
}
.widget__title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
}
.widget__meta {
    font-size: 11px;
    color: var(--muted);
    font-family: var(--font-mono);
}
.widget__sub {
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--muted);
    font-family: var(--font-mono);
}
.tl-chart-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
@media (max-width: 600px) {
    .widget__header {
        flex-wrap: wrap;
        row-gap: 6px;
        padding: 14px 16px 12px;
    }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Stat grid — unified (activity page + dashboard)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* Activity primary stats — 4 cards */
.act-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}
.act-stat {
    padding: 9px 14px 8px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.act-stat:last-child {
    border-right: none;
}
.act-stat__label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}
.act-stat__value {
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.act-stat__sub {
    font-size: 11px;
    color: var(--muted);
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

/* Load chips row */
.act-load-row {
    display: flex;
    gap: 6px;
    margin: 12px 0;
    flex-wrap: wrap;
}
.act-load-chip {
    font-size: 11px;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 8px;
    font-variant-numeric: tabular-nums;
}
.act-load-chip__label {
    color: var(--muted);
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 3px;
}
.act-load-chip--gear {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 2px 6px 2px 8px;
}
.gear-inline-select {
    background: none;
    border: none;
    color: var(--text-2);
    font-family: inherit;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    padding: 0 2px;
    cursor: pointer;
    outline: none;
    max-width: 220px;
}
.gear-status {
    font-size: 10px;
    align-self: center;
}
.gear-status--loading {
    color: var(--muted);
}
.gear-status--success {
    color: var(--elev);
    font-weight: 600;
}
.gear-status--error {
    color: var(--hr);
}

/* Meta badges below chart (Elev, Cadence, Shoe) */
.act-meta-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    margin-top: -8px;
}
.act-meta-badge {
    font-size: 11px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}
.act-meta-badge__label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-right: 3px;
}

/* stats-grid kept for race fitness block */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 16px;
}
.stat-box {
    background: var(--surface);
    padding: 10px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.stat-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    white-space: nowrap;
}
.stat-value {
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    white-space: nowrap;
    letter-spacing: -0.01em;
}
.stat-secondary {
    font-size: 11px;
    color: var(--muted);
    font-weight: 400;
}
.stats-grid--fitness {
    margin-top: 0;
}
.stats-grid--fitness .stat-value {
    font-size: 14px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Dashboard analytics — form strip (7-col grid)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.dash-analytics {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.04);
}
.dash-stat {
    background: var(--bg-card);
    padding: 15px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: visible;
}
.dash-stat__label {
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}
.dash-stat__value {
    font-family: var(--font-mono);
    font-size: 27px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text);
    padding-top: 4px;
    font-variant-numeric: tabular-nums;
}
.dash-stat__sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

/* Tooltip for dash stats */
.dash-tip {
    cursor: help;
    border-bottom: 1px dashed var(--border);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.dash-tooltip {
    position: fixed;
    z-index: 9999;
    width: 240px;
    padding: 8px 11px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    white-space: normal;
    pointer-events: none;
    color: var(--text);
    box-shadow: 0 4px 16px rgba(40, 30, 10, 0.1);
}
@media (max-width: 600px) {
    .dash-analytics {
        grid-template-columns: repeat(12, 1fr);
        gap: 8px;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }
    .dash-stat {
        grid-column: span 4;
        min-width: 0;
        min-height: 78px;
        padding: 11px 12px 10px;
        overflow: hidden;
        border: 1px solid var(--border);
        border-radius: 12px;
    }
    .dash-stat:nth-child(n + 4) {
        grid-column: span 3;
        min-height: 66px;
        padding: 10px 9px;
    }
    .dash-stat__value {
        font-size: 22px;
        padding-top: 2px;
    }
    .dash-stat:nth-child(n + 4) .dash-stat__value {
        font-size: 16px;
    }
    .dash-stat__label {
        font-size: 9px;
    }
    .dash-stat:nth-child(n + 4) .dash-stat__label {
        font-size: 8px;
        letter-spacing: 0.06em;
    }
    .dash-stat__sub {
        overflow: hidden;
        font-size: 9px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .dash-stat:nth-child(n + 4) .dash-stat__sub {
        font-size: 8px;
    }
}

/* TSB colors */
.tsb-positive {
    color: var(--tsb-pos);
}
.tsb-negative {
    color: var(--tsb-neg);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Dashboard top bar
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.dash-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.dash-top-bar__left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.dash-top-bar__title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}
.dash-top-bar__date {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
}
.dash-top-bar__right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dash-top-bar .rail-footer-btn {
    font-size: 14px;
    padding: 4px 8px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   TSS weekly targets widget
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.tss-targets {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 20px;
}
.tss-targets__current {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 52px;
    flex-shrink: 0;
}
.tss-targets__val {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.tss-targets__lbl {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-top: 4px;
    white-space: nowrap;
}
.tss-targets__ramp {
    font-size: 11px;
    font-weight: 700;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}
.tss-targets__ramp--pos {
    color: var(--tsb-pos);
}
.tss-targets__ramp--neg {
    color: var(--tsb-neg);
}
.tss-targets__bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tss-targets__name {
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    width: 48px;
    flex-shrink: 0;
}
.tss-targets__num {
    width: 32px;
}
.tss-fill--maintain {
    background: var(--tan);
}
.tss-fill--build5 {
    background: var(--tan);
}
.tss-fill--build8 {
    background: var(--tan);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Dashboard page header
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.dash-header {
    margin-bottom: 20px;
}
.dash-header__date {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}
.dash-header__meta {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: var(--muted);
}
.dash-header__meta a {
    color: var(--accent);
    text-decoration: none;
}
.dash-header__meta a:hover {
    opacity: 0.8;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Week insight widget (dashboard)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.week-insight-widget {
    padding: 14px 16px 12px;
    margin-bottom: 16px;
}
.week-insight-widget__header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}
.week-insight-widget__headline {
    font-size: 13px;
    font-weight: 600;
}
.week-insight-widget__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}
.wi-chip {
    font-size: 11px;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    white-space: nowrap;
}
.wi-chip strong {
    font-weight: 600;
    color: var(--text);
}
.wi-chip--fixed {
    opacity: 0.75;
}
.week-insight-widget__rec {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-2);
    margin: 0;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Bar row — unified progress indicator base
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bar-row__track {
    flex: 1;
    height: 7px;
    background: var(--track);
    border-radius: 6px;
    overflow: hidden;
}
.bar-row__fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}
.weekly-target-fill {
    background: var(--tan);
}
.load-target-fill {
    background: var(--accent);
}
.weekly-target-fill--achieved,
.target-fill--achieved {
    background: var(--tsb-pos);
}
.bar-row__value {
    font-size: 10px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    text-align: right;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Progress bars — weekly km targets
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.progress-bars {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 12px 20px 14px;
    border-bottom: 1px solid var(--border);
}
.prog-label {
    font-size: 10px;
    color: var(--muted);
    width: 72px;
    flex-shrink: 0;
}
.prog-value {
    width: 80px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Snapshot / Training Zones widget
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.snapshot-widget {
    /* margin handled by dash-page gap */
}
.snapshot-date-link {
    color: var(--muted);
    text-decoration: none;
}
.snapshot-date-link:hover {
    color: var(--text);
}
.snapshot-zone-toggle {
    margin: 0 22px 14px;
}

/* Polarized bar */
.polarized-wrap {
    padding: 0 22px 18px;
}
.polarized-bar {
    display: flex;
    height: 22px;
    border-radius: 7px;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
}
.polarized-fast {
    background: var(--pol-fast);
    position: relative;
    min-width: 0;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.polarized-slow {
    background: var(--pol-slow);
    position: relative;
    min-width: 0;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8a7a5c;
}
.polarized-pct {
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}
.polarized-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 500;
    color: var(--muted);
    margin-top: 5px;
}

/* Zone layout — 2-col desktop */
.sz-cols {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 0 30px;
    padding: 0 22px 20px;
}

.zone-group-label {
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 11px;
}

/* Intensity zone rows */
.zone-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
}
.zone-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    width: 118px;
    flex-shrink: 0;
}
.zone-bar {
    position: relative;
    flex: 1;
    height: 14px;
    display: flex;
    align-items: center;
    border-radius: 4px;
    overflow: hidden;
    background: var(--surface-2);
}
.zone-bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 4px;
    z-index: 0;
}
.zone-bar-text {
    position: relative;
    z-index: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    padding-left: 6px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.zone-bar-pct {
    position: relative;
    z-index: 1;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
    padding-right: 5px;
    font-variant-numeric: tabular-nums;
    width: 34px;
    text-align: right;
    flex-shrink: 0;
}
.zone-pace {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    width: 78px;
    text-align: right;
    flex-shrink: 0;
}
.zone-hr {
    font-family: var(--font-mono);
    font-size: 11px;
    color: #bdb3a0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    width: 62px;
    text-align: right;
    flex-shrink: 0;
}

/* Race zone cards */
.sz-racing .zone-group-label {
    margin-top: 0;
}
.zone-row--race {
    appearance: none;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: 8px;
    margin-bottom: 6px;
    gap: 10px;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition:
        border-color 0.15s,
        background 0.15s,
        transform 0.15s;
}
.zone-row--race:hover {
    border-color: color-mix(in srgb, var(--accent) 32%, transparent);
}
.zone-row--race:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.zone-row--race--active {
    background: color-mix(in srgb, var(--accent) 9%, var(--surface-2));
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}
.zone-row--race .zone-label {
    width: auto;
    flex: 1;
}
.zone-row--race .zone-pace {
    width: auto;
    text-align: right;
}
.zone-row--race .zone-hr {
    width: auto;
    text-align: right;
}
.zone-row--race-meta {
    display: flex;
    gap: 14px;
}
.race-pace-breakdown {
    margin-top: 10px;
}
.race-pace-breakdown--visible {
    animation: race-pace-reveal 0.2s ease-out;
}
.race-pace-breakdown__title {
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.race-pace-breakdown__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}
.race-pace-pill {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 5px;
    min-width: 0;
    padding: 7px 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 7px;
}
.race-pace-pill__percent {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 9px;
}
.race-pace-pill__value {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
@keyframes race-pace-reveal {
    from {
        opacity: 0;
        transform: translateY(-3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@media (prefers-reduced-motion: reduce) {
    .race-pace-breakdown--visible {
        animation: none;
    }
}

@media (max-width: 600px) {
    .act-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .act-stat:nth-child(2) {
        border-right: none;
    }
    .act-stat:nth-child(1),
    .act-stat:nth-child(2) {
        border-bottom: 1px solid var(--border);
    }

    /* Zones: single column, compact */
    .sz-cols {
        grid-template-columns: 1fr;
        gap: 16px 0;
        padding: 0 16px 16px;
    }
    .polarized-wrap {
        padding: 0 16px 16px;
    }
    .snapshot-zone-toggle {
        margin: 0 16px 14px;
    }
    .polarized-bar {
        height: 20px;
        font-size: 10px;
        border-radius: 6px;
    }
    .zone-label {
        font-size: 11px;
        width: 84px;
    }
    .zone-bar {
        height: 12px;
        border-radius: 4px;
    }
    .zone-bar-pct {
        font-size: 10px;
        width: 26px;
    }
    .zone-pace {
        font-size: 10px;
        width: 66px;
    }
    .zone-hr {
        font-size: 10px;
        width: 52px;
    }

    /* Racing: 2-col grid of cards on mobile */
    .sz-racing {
        margin-top: 0;
    }
    .sz-racing .zone-group-label {
        margin-bottom: 8px;
    }
    .sz-racing-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .zone-row--race {
        flex-direction: column;
        align-items: flex-start;
        padding: 9px 11px;
        margin-bottom: 0;
    }
    .zone-row--race-meta {
        flex-direction: column;
        gap: 2px;
    }
    .zone-row--race .zone-pace,
    .zone-row--race .zone-hr {
        text-align: left;
        font-size: 11px;
    }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Race result widget (activity page)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.rr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 22px;
    border-bottom: 1px solid var(--border);
}
.rr-header__left {
    display: flex;
    align-items: center;
    gap: 11px;
}
.rr-header__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #f3e3cf;
    color: #c95c19;
    font-size: 14px;
    flex-shrink: 0;
}
.rr-header__title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}
.rr-header__badge {
    font: 600 10px/1 var(--font-mono);
    color: #b65f0c;
    background: #f3e3cf;
    padding: 3px 9px;
    border-radius: 6px;
    white-space: nowrap;
}
.rr-header__view-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: 600 12px/1 var(--font-sans);
    color: #b65f0c;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.rr-header__view-link:hover { opacity: .8; }
.rr-arrow {
    font-family: var(--font-mono);
    color: #c95c19;
}
.rr-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
}
.rr-stat {
    background: var(--bg-card);
    padding: 17px 22px;
}
@media (max-width: 600px) {
    .rr-stat { padding: 11px 14px; }
    .rr-stat__value { margin-top: 7px; font-size: 19px !important; }
    .rr-header { padding: 12px 16px; }
}
.rr-stat__label {
    font: 600 10px/1 var(--font-sans);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.rr-stat__value {
    margin-top: 10px;
    font: 600 27px/1 var(--font-mono);
    letter-spacing: -0.02em;
    color: var(--text);
}
.rr-stat__value--pace { color: var(--accent); }
.rr-stat__unit {
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--muted);
}
.rr-empty-body {
    padding: 20px 22px;
    font-size: 13px;
    color: var(--muted);
}
.rr-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px;
    border-top: 1px solid var(--border);
}
.rr-footer__left {
    display: flex;
    align-items: center;
    gap: 11px;
}
.rr-source-badge {
    font: 600 10px/1 var(--font-mono);
    color: var(--muted);
    background: #f0eadd;
    padding: 4px 10px;
    border-radius: 6px;
}
.rr-edit-link {
    font: 600 12px/1 var(--font-sans);
    color: #b65f0c;
    text-decoration: none;
    cursor: pointer;
}
.rr-edit-link:hover { opacity: .8; }
.rr-zones-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 14px;
    border-radius: 9px;
    background: var(--bg-card);
    border: 1px solid #e1d9c8;
    color: #6f6757;
    font: 600 13px/1 var(--font-sans);
    cursor: pointer;
    white-space: nowrap;
}
.rr-zones-btn:hover { background: var(--track); }
.rr-zones-btn:disabled { opacity: .5; cursor: default; }
.rr-form {
    padding: 18px 22px;
}
.rr-form__fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}
.rr-form__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.rr-form__label {
    font: 600 10px/1 var(--font-sans);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.rr-form__select,
.rr-form__input {
    height: 34px;
    padding: 0 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 7px;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text);
    outline: none;
}
.rr-form__select:focus,
.rr-form__input:focus { border-color: var(--accent); }
.rr-form__input--narrow { width: 80px; }
.rr-form__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}
.rr-form__save {
    height: 34px;
    padding: 0 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font: 600 13px var(--font-sans);
    cursor: pointer;
}
.rr-form__save:hover { opacity: .88; }
.rr-form__cancel {
    font: 600 12px var(--font-sans);
    color: var(--muted);
    text-decoration: none;
}
.rr-form__cancel:hover { color: var(--text); }
@media (max-width: 600px) {
    .rr-footer { padding: 11px 16px; }
    .rr-source-prefix { display: none; }
}
.snapshot-status {
    font-size: 11px;
    color: var(--muted);
    display: block;
    margin-top: 6px;
}
.snapshot-ok {
    color: var(--elev);
}
.snapshot-err {
    color: var(--hr);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Race readiness widget
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* Two-column row: race readiness + pace dist */
.dash-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

@media (max-width: 768px) {
    .dash-2col {
        grid-template-columns: 1fr;
    }
}

.race-readiness {
    display: flex;
    flex-direction: column;
}
.race-readiness__bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 22px 18px;
}
.race-bar-row {
    display: flex;
    align-items: center;
    gap: 13px;
}
.race-bar-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    width: 74px;
    flex-shrink: 0;
}
.race-bar-pace {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    width: 62px;
    flex-shrink: 0;
}
.race-bar-fill {
    background: var(--accent);
}
.race-bar-stat {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    width: 96px;
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .race-bar-label {
        font-size: 12px;
        width: 62px;
    }
    .race-bar-pace {
        font-size: 11px;
        width: 50px;
    }
    .race-bar-stat {
        font-size: 10px;
        width: 78px;
    }
    .race-bar-row {
        gap: 10px;
    }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Charts — unified wrapper
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.charts {
    margin-bottom: 16px;
}
.chart-row {
    padding: 10px 14px 8px;
    border-bottom: 1px solid var(--border);
}
.chart-row:last-child {
    border-bottom: none;
}
.chart-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 6px;
}
.chart-area {
    border-radius: 3px;
    overflow: hidden;
}
.chart-wrap {
    position: relative;
    cursor: crosshair;
}
.chart-tooltip {
    position: absolute;
    top: 8px;
    padding: 4px 9px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    display: none;
    gap: 8px;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.charts-loading,
.charts-missing {
    color: var(--muted);
    font-size: 11px;
    padding: 12px 14px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Training load chart
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.tl-chart-wrap {
    /* margin handled by dash-page gap */
}
.weekly-mileage-header {
    gap: 12px;
}
.weekly-mileage-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.weekly-mileage-legend {
    color: var(--accent);
}
.chart-win-btns {
    display: inline-flex;
    background: var(--bg-rail);
    border-radius: 8px;
    padding: 3px;
    gap: 1px;
    flex-shrink: 0;
}
.chart-win-btn {
    background: transparent;
    border: none;
    border-radius: 5px;
    color: var(--muted);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 3px 9px;
    line-height: 1.6;
    transition:
        background 0.1s,
        color 0.1s,
        box-shadow 0.1s;
}
.chart-win-btn:hover {
    color: var(--text-2);
}
.chart-win-btn--active {
    background: var(--bg-card);
    color: var(--amber-dark);
    box-shadow: 0 1px 3px rgba(40, 30, 10, 0.1);
}
.chart-select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 3px 6px;
    cursor: pointer;
}
.tl-canvas-wrap {
    position: relative;
    padding: 0;
}
.tl-canvas-wrap canvas {
    display: block;
    width: 100%;
    cursor: grab;
}
.tl-canvas-wrap canvas:active {
    cursor: grabbing;
}
.tl-tooltip {
    position: absolute;
    top: 8px;
    pointer-events: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    gap: 8px;
    align-items: center;
}
.tl-tip-date {
    color: var(--muted);
}
.tl-tip-race {
    color: var(--accent);
    font-size: 10px;
}
.tl-tip-val {
    font-weight: 600;
}
.chart-legend {
    display: flex;
    gap: 16px;
    padding: 8px 20px 12px;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--muted);
    border-top: 1px solid var(--border);
}
.chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.chart-legend-item::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    flex-shrink: 0;
}
.tl-ctl-leg {
    color: #3b6ea5;
}
.tl-atl-leg {
    color: #c8553d;
}
.tl-tsb-leg {
    color: #d9700f;
}
.tl-race-leg {
    color: var(--accent);
}
.tl-corridor-leg {
    color: #c8553d;
    opacity: 0.5;
}

@media (max-width: 600px) {
    .weekly-mileage-header {
        align-items: flex-start;
    }
    .weekly-mileage-controls {
        width: 100%;
        justify-content: space-between;
        gap: 6px;
    }
    .weekly-mileage-controls .chart-win-btn {
        padding-right: 7px;
        padding-left: 7px;
    }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Pace distribution histogram
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.pace-dist-wrap {
    /* margin handled by dash-page gap */
}
.pace-dist-header {
    gap: 8px;
    flex-wrap: wrap;
}
.pace-dist-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.pace-dist-date-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
}
.pace-dist-date-label {
    font-size: 10px;
    color: var(--muted);
    white-space: nowrap;
}
.pace-dist-date-input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: inherit;
    font-size: 10px;
    padding: 2px 5px;
}
.pace-dist-canvas-wrap {
    position: relative;
}
.pace-dist-canvas-wrap canvas {
    display: block;
    width: 100%;
}
.pace-dist-tooltip {
    position: absolute;
    pointer-events: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 7px 11px;
    font-size: 11px;
    color: var(--text);
    white-space: nowrap;
    gap: 6px;
    align-items: center;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.pace-dist-tip-label {
    font-size: 9px;
    color: var(--muted);
}
.pace-dist-tip-pace {
    color: var(--pace);
    font-variant-numeric: tabular-nums;
}
.pace-dist-tip-km {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Daily mileage chart
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.daily-mileage-wrap {
    /* margin handled by dash-page gap */
}
.daily-mileage-wrap .tl-canvas-wrap canvas {
    cursor: default;
}
.daily-mileage-tooltip {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}
.daily-mileage-tip-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.daily-mileage-tip-row--rest {
    color: var(--muted);
}
.daily-mileage-tip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.daily-mileage-tip-cat {
    color: var(--muted);
}
.daily-mileage-tip-total {
    margin-top: 2px;
    padding-top: 4px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    width: 100%;
}
.daily-mileage-legend {
    justify-content: space-between;
    gap: 12px 20px;
    flex-wrap: wrap;
}
.daily-mileage-legend-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.daily-mileage-legend-item__label {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.daily-mileage-legend-item__value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.daily-mileage-legend-item__sub {
    font-size: 10px;
    font-weight: 400;
    color: var(--muted);
    margin-left: 4px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Tags
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.6;
}
.tag--manual {
    border-color: var(--accent);
    color: var(--accent);
}
.tag--race {
    background: var(--tag-race-bg);
    color: var(--tag-race-text);
    border-color: transparent;
}
.tag--workout {
    background: var(--tag-workout-bg);
    color: var(--tag-workout-text);
    border-color: transparent;
}
.tag--long {
    background: var(--tag-long-bg);
    color: var(--tag-long-text);
    border-color: transparent;
}
.tag--easy {
    background: var(--tag-easy-bg);
    color: var(--tag-easy-text);
    border-color: transparent;
}
.tag--recovery {
    background: var(--tag-recovery-bg);
    color: var(--tag-recovery-text);
    border-color: transparent;
}
.tag--intensity {
    background: var(--tag-intensity-bg);
    color: var(--tag-intensity-text);
    border-color: transparent;
}
.tag--race-pace {
    background: var(--tag-race-pace-bg);
    color: var(--tag-race-pace-text);
    border-color: transparent;
}
.tag--interval {
    background: var(--tag-interval-bg);
    color: var(--tag-interval-text);
    border-color: transparent;
}
.tag--dnf {
    background: var(--tag-race-bg);
    color: var(--tag-race-text);
    border-color: transparent;
}
.tag--steady {
    background: var(--tag-intensity-bg);
    color: var(--tag-intensity-text);
    border-color: transparent;
}

.tag--filter {
    cursor: pointer;
}
.tag--filter:hover {
    filter: brightness(0.95);
}
.tag--active {
    outline: 2px solid currentColor;
    outline-offset: -1px;
}
.tag--row {
    font-size: 9px;
    padding: 1px 5px;
}
.tag--expand {
    background: none;
    border: 1px dashed var(--border);
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}
.tag--expand:hover {
    border-color: var(--muted);
    color: var(--text);
}
.interval-tags-group {
    display: contents;
}
.interval-tags-group[hidden] {
    display: none;
}

.tag-remove {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.4;
    cursor: pointer;
    font-size: 11px;
    padding: 0;
    line-height: 1;
    margin-left: 1px;
}
.tag-remove:hover {
    opacity: 1;
}
.tag-remove-form {
    display: inline;
    margin: 0;
}

.activity-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    padding: 10px 0 14px;
}
.tag-input {
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-family: inherit;
    font-size: 10px;
    padding: 2px 4px;
    outline: none;
    width: 80px;
}
.tag-input:focus {
    border-bottom-color: var(--accent);
}
.tag-add-form {
    display: inline-flex;
}

/* Tag filter */
.tag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding-bottom: 12px;
}
.filter-logic-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    align-self: center;
}
.filter-mode {
    font-size: 10px;
    padding: 2px 7px;
    color: var(--muted);
    text-decoration: none;
    line-height: 1.6;
}
.filter-mode:hover {
    color: var(--text);
}
.filter-mode--active {
    background: var(--surface-2);
    color: var(--text);
}
.filter-mode + .filter-mode {
    border-left: 1px solid var(--border);
}
.tag-filter-clear {
    font-size: 10px;
    color: var(--muted);
    text-decoration: none;
    padding: 2px 6px;
    align-self: center;
}
.tag-filter-clear:hover {
    color: var(--text);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Tables — unified base
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.splits-section {
    margin: 12px 0;
    padding-bottom: 0;
}
.activity-chart-wrap {
    position: relative;
    cursor: crosshair;
}
.splits-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.splits-table th {
    text-align: left;
    color: var(--muted);
    font-weight: 500;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 5px 10px;
    border-bottom: 1px solid var(--border);
}
.splits-table th.num {
    text-align: right;
}
.splits-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--row-border);
    font-variant-numeric: tabular-nums;
}
.splits-table td.num {
    text-align: right;
}
.splits-table td.pace {
    color: var(--pace);
}
.splits-table td.muted {
    color: var(--muted);
}
.splits-table tr:last-child td {
    border-bottom: none;
}

/* Pace zone left border */
.split-row.zone-1 td:first-child {
    border-left: 2px solid #3b82f6;
}
.split-row.zone-2 td:first-child {
    border-left: 2px solid #22c55e;
}
.split-row.zone-3 td:first-child {
    border-left: 2px solid #f59e0b;
}
.split-row.zone-4 td:first-child {
    border-left: 2px solid #ef4444;
}
.split-row.zone-5 td:first-child {
    border-left: 2px solid #a855f7;
}

/* Lap role buttons */
.lap-role-th {
    width: 52px;
    padding: 0 4px !important;
}
.lap-role-cell {
    padding: 2px 4px !important;
    user-select: none;
    white-space: nowrap;
}
.lap-role-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    transition:
        background 0.1s,
        color 0.1s,
        border-color 0.1s;
    margin: 0 1px;
}
.lap-role-btn:hover {
    border-color: var(--text-2);
    color: var(--text);
}
.lap-role-btn--work.active {
    background: var(--tag-race-bg);
    border-color: transparent;
    color: var(--tag-race-text);
}
.lap-role-btn--recovery.active {
    background: var(--tag-long-bg);
    border-color: transparent;
    color: var(--tag-long-text);
}

/* Lap summary table */
.lap-summary {
    overflow: auto;
    margin: 12px 0;
    padding-bottom: 0;
}
.lap-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.lap-summary-table th {
    text-align: left;
    color: var(--muted);
    font-weight: 500;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 5px 10px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.lap-summary-table th.num {
    text-align: right;
}
.lap-summary-table td {
    padding: 7px 10px;
    font-variant-numeric: tabular-nums;
    border-bottom: 1px solid var(--row-border);
    white-space: nowrap;
}
.lap-summary-table td.num {
    text-align: right;
}
.lap-summary-table td.pace {
    color: var(--pace);
}
.lap-summary-table td.decouple {
    color: var(--muted);
}
.lap-summary-table tr:last-child td {
    border-bottom: none;
}
.lap-summary-label {
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}
.lap-summary-row--work .lap-summary-label {
    color: var(--tag-race-text);
}
.lap-summary-row--recovery .lap-summary-label {
    color: var(--tag-long-text);
}

/* Zones table (history page) */
.snapshots-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.snapshot-card-header {
    background: var(--bg);
}
.snapshot-card-date {
    font-size: 13px;
    font-weight: 600;
}
.snapshot-card-vdot {
    font-size: 11px;
    color: var(--muted);
}

.zones-table-header {
    display: flex;
    gap: 12px;
    padding: 5px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.zones-table-header .zt-label {
    font-size: 9px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    width: 150px;
    flex-shrink: 0;
}
.zones-table-header .zt-pace {
    font-size: 9px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    width: 120px;
    flex-shrink: 0;
}
.zones-table-header .zt-hr {
    font-size: 9px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.zt-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 14px;
    border-bottom: 1px solid var(--row-border);
}
.zt-row:last-child {
    border-bottom: none;
}
.zt-row .zt-label {
    font-size: 11px;
    color: var(--muted);
    width: 150px;
    flex-shrink: 0;
}
.zt-row .zt-pace {
    font-size: 12px;
    font-weight: 500;
    color: var(--pace);
    font-variant-numeric: tabular-nums;
    width: 120px;
    flex-shrink: 0;
}
.zt-row .zt-hr {
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .zones-table-header,
    .zt-row {
        gap: 6px;
        padding: 5px 10px;
    }
    .zone-group-label {
        padding: 7px 10px 5px;
    }
    .zones-table-header .zt-label,
    .zt-row .zt-label {
        flex: 1;
        width: auto;
    }
    .zones-table-header .zt-pace,
    .zt-row .zt-pace {
        width: 88px;
    }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Weekly view — Runs page
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.weeks {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.filtered-list {
    display: flex;
    flex-direction: column;
}
.filtered-list .act-date {
    width: 130px;
}

.week-current {
    border-color: var(--accent);
}
.week-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--amber-dark);
}
.week-total {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.week-activities {
    min-height: 40px;
}
.week-empty {
    height: 40px;
}

/* Week note */
.week-note-frame {
    display: block;
}
.week-note {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    padding: 10px 12px 10px 15px;
    font-size: 12px;
    color: var(--text);
    border: 1px solid var(--border);
    border-left: 3px solid var(--tan);
    border-radius: 9px;
    background: var(--surface-2);
    line-height: 1.5;
    text-decoration: none;
}
.week-note--editable {
    cursor: pointer;
    transition:
        border-color 0.12s,
        background 0.12s;
}
.week-note--editable:hover {
    border-color: var(--border-rail);
    background: var(--bg-card);
}
.week-note-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.week-note-body {
    color: var(--text-2);
    font-size: 12px;
    white-space: pre-wrap;
}
.week-note-hint {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 9px;
    line-height: 1;
    transition: color 0.1s;
    white-space: nowrap;
}
.week-note--editable:hover .week-note-hint {
    color: var(--amber-dark);
}
.week-note--empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    color: var(--muted);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 10px;
    white-space: normal;
    border: 1px dashed var(--border-rail);
    background: transparent;
}
.week-note--empty:hover {
    color: var(--amber-dark);
    border-color: var(--amber-border);
    background: var(--amber-tint);
}
.week-note-add {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1;
}
.week-note-editor {
    padding: 12px 12px 12px 14px;
    border: 1px solid var(--amber-border);
    border-left: 3px solid var(--tan);
    border-radius: 9px;
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(217, 112, 15, 0.06);
}
.note-textarea {
    width: 100%;
    min-height: 66px;
    max-height: 240px;
    padding: 9px 10px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 12px;
    line-height: 1.6;
    resize: none;
    outline: none;
    display: block;
    transition:
        border-color 0.12s,
        box-shadow 0.12s,
        background 0.12s;
}
.note-textarea:focus {
    border-color: var(--accent);
    background: var(--bg-card);
    box-shadow: 0 0 0 2px rgba(217, 112, 15, 0.1);
}
.note-textarea::placeholder {
    color: var(--muted);
}
.week-note-editor__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 9px;
}
.week-note-editor__help {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 9px;
}
.week-note-editor__actions {
    display: flex;
    gap: 7px;
}
.week-note-btn {
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}
.week-note-btn--cancel {
    border-color: var(--border);
    background: transparent;
    color: var(--muted);
}
.week-note-btn--cancel:hover {
    color: var(--text);
}
.week-note-btn--save {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}
.week-note-btn--save:hover {
    filter: brightness(0.95);
}

/* Week insight (coaching band) */
.week-insight {
    display: block;
    margin: 12px 20px;
    padding: 10px 14px 10px 16px;
    font-size: 12px;
    line-height: 1.6;
    background: var(--amber-tint);
    border: 1px solid var(--amber-border);
    border-left: 3px solid var(--accent);
    border-radius: 9px;
}
.week-insight__rec {
    color: #8a4a07;
    display: block;
    font-weight: 500;
}
.week-insight__stats {
    font-family: var(--font-mono);
    font-size: 11px;
    color: #9b8a6e;
    display: block;
    margin-top: 2px;
}
.week-block > .week-note-frame {
    margin: 12px 20px;
}

/* Activity rows */
.activity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 14px;
    border-bottom: 1px solid var(--row-border);
    cursor: pointer;
    font-size: 12px;
    color: inherit;
    text-decoration: none;
    transition: background 0.08s;
}
.activity-row:hover {
    background: var(--bg);
}
.activity-row:last-child {
    border-bottom: none;
}

.act-date {
    color: var(--muted);
    width: 88px;
    flex-shrink: 0;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.act-date[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    padding: 3px 7px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
    z-index: 20;
}
.act-date-short {
    display: none;
}
.act-date-numeric {
    display: none;
    font-variant-numeric: tabular-nums;
}
.act-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.act-dist {
    width: 56px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.act-pace {
    width: 72px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.act-hr {
    width: 52px;
    text-align: right;
    flex-shrink: 0;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.act-load {
    width: 42px;
    text-align: right;
    flex-shrink: 0;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.act-load--easy {
    opacity: 0.45;
}
.act-load--hard {
    color: var(--accent);
}
.activity-row .act-unit {
    display: none;
}
.pace {
    color: var(--pace);
}

/* Loads mode header */
.loads-col-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 14px;
    font-size: 9px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    border-radius: 6px 6px 0 0;
}
.loads-col-header__date {
    width: 88px;
    flex-shrink: 0;
}
.loads-col-header__name {
    flex: 1;
}
.loads-col-header__dist {
    width: 56px;
    text-align: right;
    flex-shrink: 0;
}
.loads-col-header__pace {
    width: 72px;
    text-align: right;
    flex-shrink: 0;
}
.loads-col-header__hr {
    width: 52px;
    text-align: right;
    flex-shrink: 0;
}
.loads-col-header__load {
    width: 42px;
    text-align: right;
    flex-shrink: 0;
}
.loads-col-header__tip {
    cursor: help;
    border-bottom: 1px dashed currentColor;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.loads-col-header__tip[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    width: 260px;
    padding: 7px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 11px;
    line-height: 1.5;
    white-space: normal;
    pointer-events: none;
    z-index: 30;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

@media (max-width: 600px) {
    .activity-row {
        gap: 4px;
        padding: 6px 10px;
    }
    .act-date {
        width: 45px;
    }
    .act-date-full {
        display: none;
    }
    .act-date-short {
        display: inline;
    }
    .act-dist {
        width: 36px;
    }
    .act-pace {
        width: 42px;
    }
    .act-hr {
        width: 24px;
    }
    .act-load {
        width: 25px;
    }
    .tag--row {
        font-size: 9px;
        padding: 1px 3px;
    }
    .loads-col-header {
        gap: 4px;
        padding: 4px 10px;
    }
    .loads-col-header__date {
        width: 45px;
    }
    .loads-col-header__dist {
        width: 36px;
    }
    .loads-col-header__pace {
        width: 42px;
    }
    .loads-col-header__hr {
        width: 24px;
    }
    .loads-col-header__load {
        width: 34px;
    }
    .filtered-list .act-date {
        width: 60px;
    }
    .filtered-list .act-date-short {
        display: none;
    }
    .filtered-list .act-date-numeric {
        display: inline;
    }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Pagination
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.pagination {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
}
.pag-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    padding: 4px 12px;
    text-decoration: none;
    transition:
        border-color 0.1s,
        color 0.1s;
}
.pag-btn:hover:not(:disabled) {
    color: var(--text);
    border-color: var(--text-2);
}
.pag-btn:disabled {
    opacity: 0.25;
    cursor: default;
}
.pag-info {
    color: var(--muted);
    font-size: 11px;
}
.pag-spacer {
    flex: 1;
}
.loads-hidden .act-load,
.loads-hidden .loads-col-header__load {
    display: none;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Date / tag filter
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.df-wrap {
    padding-bottom: 10px;
}
.df-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.df-label {
    font-size: 10px;
    color: var(--muted);
    white-space: nowrap;
}
.df-input {
    font-size: 11px;
    font-family: monospace;
    padding: 4px 7px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text);
    width: 118px;
}
.df-input:focus {
    outline: none;
    border-color: var(--muted);
}
.df-select {
    font-size: 11px;
    padding: 3px 5px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text);
}
.df-select--sm {
    max-width: 150px;
}
.df-dir-btn {
    font-size: 11px;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.5;
}
.df-dir-btn:hover {
    border-color: var(--muted);
}
.df-span-group {
    display: flex;
    align-items: center;
    gap: 4px;
}
.df-span-tabs {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.df-tab {
    font-size: 11px;
    padding: 3px 8px;
    border: none;
    border-right: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    line-height: 1.4;
    transition:
        background 0.1s,
        color 0.1s;
}
.df-tab:last-child {
    border-right: none;
}
.df-tab:hover {
    color: var(--text);
    background: var(--bg);
}
.df-tab--active {
    background: var(--bg);
    color: var(--text);
    font-weight: 600;
}
.df-span-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
}
.df-span-inputs[hidden] {
    display: none;
}
.df-n {
    font-size: 11px;
    font-family: monospace;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text);
    width: 40px;
    text-align: center;
}
.df-apply {
    font-size: 10px;
    padding: 4px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
}
.df-apply:hover {
    border-color: var(--muted);
}
.df-clear {
    font-size: 10px;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
}
.df-clear:hover {
    color: var(--text);
}
.df-active-range {
    font-size: 10px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    padding-bottom: 4px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Activity detail page
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.activity-nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.back-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 11px;
}
.back-link:hover {
    color: var(--text);
}
.act-arrows {
    display: flex;
    gap: 5px;
}
.act-arrow {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    padding: 2px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    line-height: 1.6;
    transition:
        border-color 0.1s,
        color 0.1s;
}
.act-arrow:hover {
    color: var(--text);
    border-color: var(--text-2);
}

.activity-header {
    margin-bottom: 18px;
}
.activity-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}
.activity-title--editable {
    cursor: text;
    outline: none;
    border-radius: 3px;
}
.activity-title--editable:hover {
    opacity: 0.75;
}
.activity-title--editing {
    box-shadow: 0 0 0 2px var(--border);
    white-space: nowrap;
    overflow: hidden;
}
.activity-name-status {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    line-height: 1.4;
}
.activity-name-status:empty {
    display: none;
}
.activity-name-status--loading {
    color: var(--muted);
}
.activity-name-status--success {
    color: var(--elev);
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
}
.activity-name-status--error {
    flex: 0 0 100%;
    padding: 7px 9px;
    border: 1px solid color-mix(in srgb, var(--hr) 28%, transparent);
    border-radius: 7px;
    background: color-mix(in srgb, var(--hr) 8%, var(--bg-card));
    color: var(--hr);
    font-size: 11px;
}
.activity-date {
    color: var(--muted);
    font-size: 11px;
}

/* Map */
.activity-map {
    height: 300px;
    border-radius: 6px;
    border: 1px solid var(--border);
    margin: 16px 0;
    overflow: hidden;
    position: relative;
}
.map-lock-btn {
    width: 26px;
    height: 26px;
    font-size: 14px;
    line-height: 26px;
    text-align: center;
    cursor: pointer;
    background: #fff;
    border: none;
    display: block;
    padding: 0;
}
.map-lock-btn:hover {
    background: #f0f0f0;
}
.map-lock-btn--active {
    background: #e8f4e8;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Login
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.login-wrap {
    display: flex;
    justify-content: center;
    padding-top: 120px;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 220px;
}
.login-field {
    display: flex;
}
.login-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    padding: 8px 10px;
    outline: none;
}
.login-input:focus {
    border-color: var(--accent);
}
.login-input:disabled {
    opacity: 0.5;
}
.login-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    padding: 7px;
    transition:
        color 0.1s,
        border-color 0.1s;
}
.login-btn:hover:not(:disabled) {
    color: var(--accent);
    border-color: var(--accent);
}
.login-btn:disabled {
    opacity: 0.4;
    cursor: default;
}
.login-error {
    color: var(--hr);
    font-size: 11px;
    padding-top: 2px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Misc utils
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.loading {
    color: var(--muted);
    padding: 40px 0;
}
.error {
    color: var(--hr);
    padding: 40px 0;
}

/* Badges (workout_type) */
.badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    margin-left: 5px;
    vertical-align: middle;
}
.badge-race {
    background: var(--tag-race-bg);
    color: var(--tag-race-text);
}
.badge-long {
    background: var(--tag-long-bg);
    color: var(--tag-long-text);
}
.badge-workout {
    background: var(--tag-workout-bg);
    color: var(--tag-workout-text);
}

/* Nav spacer / owner btn (legacy, still used in some places) */
.nav-spacer {
    flex: 1;
}
.nav-owner-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    padding: 4px 8px;
}
.nav-owner-btn:hover {
    color: var(--text);
}

/* Nav link (legacy top-nav, kept for any remaining uses) */
.nav {
    display: none;
}

/* Disabled rail link */
.rail-link--disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Mobile-only top header + burger menu
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.mob-header {
    display: none;
}

@media (max-width: 768px) {
    .mob-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 44px;
        background: var(--bg-rail);
        border-bottom: 1px solid var(--border-rail);
        padding: 0 16px;
        z-index: 110;
    }

    .mob-logo {
        color: var(--text);
        font-family: var(--font-mono);
        font-weight: 700;
        font-size: 16px;
        text-decoration: none;
    }
    .mob-logo-dot {
        color: var(--accent);
    }

    .mob-menu {
        position: relative;
    }

    /* Hide the default details marker */
    .mob-menu summary {
        list-style: none;
    }
    .mob-menu summary::-webkit-details-marker {
        display: none;
    }

    .mob-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        cursor: pointer;
        border-radius: 6px;
        user-select: none;
        -webkit-user-select: none;
        transition: background 0.1s;
    }
    .mob-menu-btn:hover {
        background: var(--bg);
    }
    .mob-menu-icon {
        font-size: 18px;
        color: var(--text-2);
    }

    .mob-menu-dropdown {
        position: absolute;
        top: calc(100% + 6px);
        right: 0;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 8px;
        min-width: 160px;
        overflow: hidden;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        z-index: 120;
    }

    .mob-menu-item {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        padding: 11px 16px;
        font-family: inherit;
        font-size: 13px;
        color: var(--text);
        background: none;
        border: none;
        border-bottom: 1px solid var(--border);
        cursor: pointer;
        text-align: left;
        text-decoration: none;
    }
    .mob-menu-item:last-child {
        border-bottom: none;
    }
    .mob-menu-item:hover {
        background: var(--bg);
    }
    .mob-menu-item--btn {
        font-family: inherit;
    }
    .mob-menu-item-icon {
        font-size: 14px;
        opacity: 0.6;
    }

    /* When burger details is open, dim the background */
    .mob-menu[open] .mob-menu-btn {
        background: var(--bg);
    }

    /* Adjust main-content for top header */
    .main-content {
        padding-top: 56px;
        padding-bottom: 64px;
        margin-left: 0;
        padding-left: 14px;
        padding-right: 14px;
    }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Activity detail — Instrument redesign
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.activity-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.activity-page .widget {
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.04);
}
.activity-page .activity-nav-row,
.activity-page .activity-header,
.activity-page .act-stats,
.activity-page .activity-tags,
.activity-page .splits-section,
.activity-page .lap-summary {
    margin: 0;
}
.activity-page .activity-nav-row {
    min-height: 34px;
}
.activity-page .back-link {
    color: var(--amber-dark);
    font-size: 13px;
    font-weight: 600;
}
.activity-page .act-arrows {
    gap: 7px;
}
.activity-page .act-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-color: var(--border-rail);
    border-radius: 8px;
    background: var(--bg-card);
    font-family: var(--font-mono);
    font-size: 13px;
}
.activity-page .activity-title {
    margin: 0;
    font-size: 25px;
    font-weight: 800;
    line-height: 1.08;
}
.activity-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.activity-heading-copy {
    min-width: 0;
}
.activity-heading-row .act-arrows {
    flex-shrink: 0;
}
.activity-title-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 9px;
}
.activity-title-line .activity-title {
    min-width: 0;
}
.activity-page .activity-date {
    display: block;
    margin-top: 7px;
    font-family: var(--font-mono);
    font-size: 13px;
}
.activity-page .activity-name-status {
    position: static;
    margin: 0;
}
.activity-page .activity-tags {
    padding: 12px 0 0;
    gap: 6px;
}
.activity-page .tag {
    padding: 3px 8px;
    border-radius: 6px;
    border: 0;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
}
.activity-page .tag-input {
    width: 74px;
    padding: 3px 8px;
    border: 1px dashed #d8cfbd;
    border-radius: 6px;
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: 11px;
}
.activity-page .act-stats {
    grid-template-columns: repeat(6, 1fr);
    border-radius: 14px;
    background: var(--border);
}
.activity-page .act-stat {
    /*min-height: 82px;*/
    padding: 14px 15px;
    border-right: 1px solid var(--border);
    background: var(--bg-card);
    gap: 0;
}
.activity-page .act-stat__label,
.act-card-label {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.activity-page .act-stat__value {
    margin-top: 9px;
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 600;
    line-height: 1;
    overflow: visible;
}
.activity-page .act-stat__sub,
.activity-page .act-unit {
    color: var(--muted);
    font-size: 10px;
    font-weight: 400;
}
.activity-page .act-stat:nth-child(4) .act-stat__value {
    color: var(--hr);
}
.act-overview {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 16px;
    align-items: stretch;
}
.act-overview--no-map {
    grid-template-columns: minmax(280px, 38%);
    justify-content: end;
}
.activity-map-card {
    position: relative;
    min-width: 0;
}
.activity-page .activity-map {
    height: 322px;
    margin: 0;
    border: 0;
    border-radius: 14px;
}
.activity-map-distance {
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 500;
    padding: 6px 11px;
    border-radius: 8px;
    background: #211d17;
    color: #f4ede0;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
}
.act-overview-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.act-session-load {
    flex: 1;
    padding: 18px 20px;
}
.act-session-load__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 14px;
}
.act-session-load__stats > div {
    display: flex;
    flex-direction: column;
}
.act-session-load__stats span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.act-session-load__value {
    font-family: var(--font-mono);
    font-size: 27px;
    font-weight: 600;
    line-height: 1;
}
.act-session-load__value--rtss {
    color: var(--accent);
}
.act-session-load__value--suffer {
    color: var(--hr);
}
.act-session-load__rows {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--row-border);
}
.act-session-load__rows > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}
.act-session-load__rows span {
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
}
.act-session-load__rows strong {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
}
.act-overview-side turbo-frame {
    display: block;
}
.act-gear-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 82px;
    padding: 16px 20px;
}
.act-gear-card__copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.activity-page .gear-inline-select {
    max-width: 230px;
    margin: 7px 0 0 -4px;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 700;
}
.act-gear-card__name {
    margin-top: 7px;
    font-size: 14px;
    line-height: 1;
}
.act-gear-card__distance {
    margin-top: 5px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
}
.act-gear-card .gear-status {
    position: absolute;
    right: 20px;
}
.act-fatigue-card {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px 22px;
    overflow: visible;
}
.act-fatigue-card--good {
    --fatigue-accent: #5b8a51;
    --fatigue-accent-bg: #e7efe2;
    --fatigue-value: #5b8a51;
}
.act-fatigue-card--watch {
    --fatigue-accent: #c95c19;
    --fatigue-accent-bg: #f3e4d5;
    --fatigue-value: #c95c19;
}
.act-fatigue-card--fade {
    --fatigue-accent: #c8553d;
    --fatigue-accent-bg: #f3dfda;
    --fatigue-value: #c8553d;
}
.act-fatigue-card--muted {
    --fatigue-accent: var(--muted);
    --fatigue-accent-bg: var(--track);
    --fatigue-value: var(--text);
}
.act-fatigue-card__intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.act-fatigue-card__head {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 9px;
}
.act-fatigue-card__dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 2px;
    background: var(--fatigue-accent);
}
.act-fatigue-card__head strong {
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1;
}
.act-fatigue-card__confidence {
    flex-shrink: 0;
    padding: 5px 11px;
    border-radius: 7px;
    background: var(--fatigue-accent-bg);
    color: var(--fatigue-accent);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
}
.act-fatigue-card__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--border);
}
.act-fatigue-card__grid > div {
    min-width: 0;
    padding: 14px 16px;
    background: var(--bg-card);
}
.act-fatigue-card__grid > div:first-child {
    border-radius: 10px 0 0 10px;
}
.act-fatigue-card__grid > div:last-child {
    border-radius: 0 10px 10px 0;
}
.act-fatigue-card__grid span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 1;
    text-transform: uppercase;
}
.act-fatigue-card__tip {
    width: max-content;
    max-width: 100%;
}
.act-fatigue-card__grid strong {
    display: block;
    margin-top: 8px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
    white-space: nowrap;
}
.act-fatigue-card__grid small {
    color: var(--muted);
    font-size: 11px;
}
.act-fatigue-card__grid > div:first-child strong {
    color: var(--fatigue-value);
}
.act-fatigue-card__summary {
    margin: 0;
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.55;
    text-wrap: pretty;
}
.activity-page > turbo-frame#fatigue-metric {
    display: block;
}
.activity-page > turbo-frame#fatigue-metric:empty {
    display: none;
}
.activity-card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 22px 14px;
}
.activity-chart-sub {
    display: block;
    margin-top: 5px;
}
.activity-chart-card .activity-card-header {
    align-items: center;
}
.activity-chart-card .activity-chart-wrap {
    padding: 0 22px;
}
.activity-chart-card canvas {
    display: block;
    width: 100%;
}
.activity-chart-legend {
    display: flex;
    gap: 18px;
    padding: 10px 22px 16px;
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 11px;
}
.activity-chart-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.activity-chart-legend span::before {
    content: "";
    width: 14px;
    height: 2px;
    background: currentColor;
}
.activity-chart-legend__pace {
    color: var(--pace);
}
.activity-chart-legend__hr {
    color: var(--hr);
}
.activity-chart-legend__elev {
    color: #a88b5e;
}
.workout-reserve-card {
    overflow: hidden;
}

#workout-assessment {
    display: block;
}

.workout-assessment-prompt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 20px;
}

.workout-assessment-prompt > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.workout-assessment-button {
    position: relative;
    flex: 0 0 auto;
    min-width: 74px;
    padding: 7px 13px;
    border: 1px solid var(--amber-border);
    border-radius: 6px;
    background: var(--amber-tint);
    color: var(--amber-dark);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.workout-assessment-button:hover {
    border-color: var(--accent);
}

#workout-assessment[busy] .workout-assessment-button {
    color: transparent;
    pointer-events: none;
}

#workout-assessment[busy] .workout-assessment-button::after {
    position: absolute;
    inset: 7px 4px;
    color: var(--amber-dark);
    content: "Assessing…";
}
.workout-reserve-header {
    align-items: center;
}
.workout-reserve-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 22px 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--border);
    gap: 1px;
}
.workout-reserve-stat {
    min-width: 0;
    padding: 12px 14px;
    background: var(--bg-card);
}
.workout-reserve-stat__label,
.workout-reserve-reps__label {
    display: block;
    color: var(--muted);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.workout-reserve-stat__value {
    display: block;
    margin-top: 7px;
    overflow: hidden;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.workout-reserve-stat--primary .workout-reserve-stat__value {
    color: var(--pd-marathon);
    font-size: 22px;
}
.workout-reserve-stat__value small {
    margin-left: 2px;
    font-size: 10px;
    font-weight: 500;
}
.workout-reserve-stat__sub {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
}
.workout-reserve-insights {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 22px 16px;
}
.workout-reserve-insight {
    padding: 11px 12px;
    border-left: 3px solid var(--border-rail);
    background: var(--surface-2);
    border-radius: 0 7px 7px 0;
}
.workout-reserve-insight--lead {
    border-left-color: var(--pd-marathon);
}
.workout-reserve-insight__title {
    display: block;
    margin-bottom: 4px;
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
}
.workout-reserve-insight p {
    color: var(--text-2);
    font-size: 11px;
    line-height: 1.45;
}
.workout-reserve-reps {
    margin: 0 22px 16px;
}
.workout-reserve-records {
    margin: -4px 22px 16px;
}
.workout-reserve-reps__label {
    margin-bottom: 7px;
}
.workout-reserve-reps__list {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: thin;
}
.workout-reserve-rep {
    display: grid;
    grid-template-columns: auto auto;
    align-items: baseline;
    gap: 1px 7px;
    flex: 0 0 auto;
    min-width: 70px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-card);
    font-family: var(--font-mono);
    font-size: 10px;
}
.workout-reserve-rep b {
    color: var(--muted);
    font-size: 9px;
}
.workout-reserve-rep span {
    color: var(--pd-marathon);
    font-weight: 600;
}
.workout-reserve-rep small {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 8px;
}
.workout-reserve-records__list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 7px;
}
.workout-reserve-record {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    padding: 5px 8px;
    border: 1px solid color-mix(in srgb, var(--tsb-pos) 35%, var(--border));
    border-radius: 6px;
    background: color-mix(in srgb, var(--tsb-pos) 7%, var(--bg-card));
    font-family: var(--font-mono);
    font-size: 9px;
}
.workout-reserve-record b {
    color: var(--text-2);
}
.workout-reserve-record span {
    color: var(--tsb-pos);
    font-weight: 600;
}
.wr-assessment,
.wr-evidence,
.wr-next-step {
    margin-right: 22px;
    margin-left: 22px;
}
.wr-assessment {
    padding: 15px 17px;
    border-left: 3px solid var(--pd-marathon);
    border-radius: 0 9px 9px 0;
    background: var(--surface-2);
}
.wr-assessment__eyebrow,
.wr-section-label {
    display: block;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.wr-assessment h3 {
    margin-top: 5px;
    color: var(--text);
    font-size: 17px;
    line-height: 1.25;
}
.wr-assessment p,
.wr-next-step p {
    margin-top: 5px;
    color: var(--text-2);
    font-size: 12px;
    line-height: 1.5;
}
.wr-evidence {
    padding: 14px 0 13px;
    border-bottom: 1px solid var(--row-border);
}
.wr-evidence ul {
    display: grid;
    gap: 7px;
    margin: 9px 0 0;
    padding: 0;
    list-style: none;
}
.wr-evidence li {
    position: relative;
    padding-left: 14px;
    color: var(--text-2);
    font-size: 11px;
    line-height: 1.45;
}
.wr-evidence li::before {
    position: absolute;
    top: 0.55em;
    left: 1px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--pd-marathon);
    content: "";
}
.wr-next-step {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--tsb-pos) 28%, var(--border));
    border-radius: 8px;
    background: color-mix(in srgb, var(--tsb-pos) 6%, var(--bg-card));
}
.wr-next-step .wr-section-label {
    color: var(--tsb-pos);
}
.wr-next-step p {
    color: var(--text);
    font-weight: 500;
}
.workout-reserve-chart-wrap {
    position: relative;
    cursor: crosshair;
}
.workout-reserve-chart-wrap canvas {
    display: block;
    width: 100%;
}
.workout-reserve-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 22px 12px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 9px;
}
.workout-reserve-chart-legend span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.wr-key {
    width: 13px;
    height: 3px;
    border-radius: 2px;
}
.wr-key--short {
    background: var(--hr);
}
.wr-key--interval {
    background: var(--accent);
}
.wr-key--sustained {
    background: var(--pace);
}
.wr-key--durability {
    background: var(--elev);
}
.workout-reserve-profile {
    margin: 0 22px 12px;
    border-top: 1px solid var(--border);
}
.workout-reserve-profile summary {
    padding: 10px 0 7px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    cursor: pointer;
}
.workout-reserve-profile__grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    padding-bottom: 5px;
}
.workout-reserve-profile__item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 6px 7px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 8px;
    text-decoration: none;
}
.workout-reserve-profile__item:hover {
    border-color: var(--pd-marathon);
}
.workout-reserve-profile__item strong {
    overflow: hidden;
    color: var(--text-2);
    font-size: 9px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.workout-reserve-caveat {
    padding: 0 22px 16px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}
.activity-data-card {
    padding: 0 22px 10px;
    overflow: hidden;
}
.activity-data-card .activity-card-header {
    padding-left: 0;
    padding-right: 0;
}
.activity-data-card .splits-table th,
.activity-data-card .lap-summary-table th {
    height: 26px;
    padding: 0 10px 9px;
    background: transparent;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.09em;
}
.activity-data-card .splits-table td,
.activity-data-card .lap-summary-table td {
    height: 42px;
    padding: 8px 10px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
}
.activity-data-card .splits-table td.pace,
.activity-data-card .lap-summary-table td.pace {
    color: var(--text);
    font-weight: 600;
}
.activity-data-card .lap-hr,
.activity-data-card .summary-hr,
.activity-data-card .split-hr {
    color: var(--hr);
}
.activity-data-card .split-row td:first-child {
    border-left-width: 3px;
}
.activity-page .lap-role-btn {
    width: 25px;
    height: 25px;
    border-radius: 5px;
    font-family: var(--font-mono);
}
.lap-summary-label {
    font-family: var(--font-sans) !important;
    font-size: 13px !important;
    text-transform: none;
    letter-spacing: 0;
}
.lap-summary-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 2px;
    background: var(--accent);
}
.lap-summary-row--recovery .lap-summary-dot {
    background: #e9c48a;
}
.lap-summary-value {
    display: inline-flex;
    align-items: baseline;
    justify-content: flex-end;
    white-space: nowrap;
}
.lap-summary-value .act-unit {
    margin-left: 3px;
}
.activity-page .lap-summary-table th.num,
.activity-page .lap-summary-table td.num {
    text-align: left;
}
.activity-page .lap-summary-value {
    justify-content: flex-start;
}
.lap-summary-time {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    white-space: nowrap;
}
.lap-summary-stopped {
    color: var(--amber-dark);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
}
.race-pace-card {
    padding-bottom: 20px;
}
.race-pace-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    margin: 0 22px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--border);
}
.race-pace-item {
    min-width: 0;
    padding: 14px 16px;
    background: var(--bg-card);
}
.race-pace-item__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 5px;
}
.race-pace-item__head strong {
    font-size: 13px;
}
.race-pace-item__head span {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    white-space: nowrap;
}
.race-pace-item__value {
    margin-top: 11px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 600;
    line-height: 1;
}
.race-pace-item__value--active {
    color: var(--accent);
}
.race-pace-item__value small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
}
.split-zone-track {
    display: block;
    width: 100%;
    height: 9px;
    overflow: hidden;
    border-radius: 5px;
    background: var(--track);
}
.split-zone-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #edcf9f;
}
.zone-2 .split-zone-fill {
    background: #dfac67;
}
.zone-3 .split-zone-fill {
    background: #c97032;
}
.zone-4 .split-zone-fill {
    background: #9e4126;
}
.zone-5 .split-zone-fill {
    background: #6f2519;
}

/* Laps use the prototype's explicit instrument grid, not the shared table. */
.lap-grid-row {
    display: grid;
    grid-template-columns: 26px repeat(5, minmax(0, 1fr));
    gap: 0 14px;
}
.laps-card--with-roles .lap-grid-row {
    grid-template-columns: 26px 78px repeat(5, minmax(0, 1fr));
}
.lap-grid-head {
    padding: 0 0 9px;
    border-bottom: 1px solid var(--row-border);
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.lap-grid-head > div:nth-last-child(-n + 5),
.lap-grid-data > div:nth-last-child(-n + 5) {
    text-align: right;
}
.lap-grid-data {
    align-items: center;
    margin-left: -11px;
    padding: 10px 0 10px 11px;
    border-bottom: 1px solid var(--row-border);
    border-left: 3px solid #e9c48a;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
}
.lap-grid-data:last-child {
    border-bottom: 0;
}
.lap-grid-data.zone-1 {
    border-left-color: #e9c48a;
}
.lap-grid-data.zone-2 {
    border-left-color: #e0923c;
}
.lap-grid-data.zone-3 {
    border-left-color: #c95c19;
}
.lap-grid-data.zone-4 {
    border-left-color: #9e4126;
}
.lap-grid-data.zone-5 {
    border-left-color: #6f2519;
}
.lap-grid-index {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-align: left !important;
}
.lap-grid-time,
.lap-grid-elev {
    color: var(--text-2);
}
.lap-grid-pace {
    font-weight: 600;
}
.lap-grid-hr {
    color: var(--hr);
}
.lap-role-cell {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    padding: 0 !important;
    text-align: left !important;
}
.lap-role-actions {
    display: flex;
    gap: 4px;
}
.activity-page .lap-role-btn {
    width: 22px;
    height: 22px;
    margin: 0;
    border: 1px solid var(--border-rail);
    border-radius: 6px;
    background: var(--surface-2);
    color: #a59b86;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
}
.activity-page span.lap-role-btn {
    cursor: default;
}
.activity-page .lap-role-btn--work.active {
    border-color: #c95c19;
    background: #c95c19;
    color: #fff;
}
.activity-page .lap-role-btn--recovery.active {
    border-color: #3b6ea5;
    background: #3b6ea5;
    color: #fff;
}
/* Splits have their own fixed-width grid and deliberately no left zone stripe. */
.activity-split-row {
    display: grid;
    grid-template-columns: 34px 74px 62px 60px minmax(0, 1fr);
    gap: 0 14px;
    align-items: center;
}
.activity-split-head {
    padding: 0 0 9px;
    border-bottom: 1px solid var(--row-border);
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.activity-split-head > div:nth-child(2),
.activity-split-head > div:nth-child(3),
.activity-split-head > div:nth-child(4) {
    text-align: right;
}
.activity-split-data {
    min-height: 35px;
    padding: 7px 0;
    border-bottom: 1px solid #f2ede2;
    font-family: var(--font-mono);
}
.activity-split-data:last-child {
    border-bottom: 0;
}
.activity-split-km {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}
.activity-split-pace {
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}
.activity-split-hr {
    color: var(--hr);
    font-size: 12px;
    font-weight: 500;
    text-align: right;
}
.activity-split-elev {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    text-align: right;
}
.activity-split-zone {
    min-width: 0;
}
.split-zone-fill--1 {
    background: #e9c48a;
}
.split-zone-fill--2 {
    background: #e0923c;
}
.split-zone-fill--3 {
    background: #c95c19;
}
.split-zone-fill--4 {
    background: #9e4126;
}
.split-zone-fill--5 {
    background: #6f2519;
}

@media (max-width: 768px) {
    .activity-page {
        gap: 13px;
    }
    .activity-page .activity-nav-row {
        min-height: 24px;
    }
    .activity-page .act-arrows {
        display: flex;
    }
    .activity-page .activity-title {
        font-size: 21px;
    }
    .activity-page .activity-date {
        margin-top: 6px;
        font-size: 12px;
    }
    .activity-page .activity-tags {
        padding-top: 11px;
        gap: 5px;
    }
    .activity-page .tag,
    .activity-page .tag-input {
        padding: 3px 8px;
        border-radius: 5px;
        font-size: 10px;
    }
    .activity-page .act-stats {
        display: grid;
        grid-template-columns: repeat(12, 1fr);
        gap: 8px;
        overflow: visible;
        border: 0;
        background: transparent;
    }
    .activity-page .act-stat {
        grid-column: span 4;
        min-height: 78px;
        padding: 11px 12px;
        border: 1px solid var(--border) !important;
        border-radius: 12px;
    }
    .activity-page .act-stat:nth-child(n + 4) {
        grid-column: span 3;
        min-height: 66px;
        padding: 10px 9px;
    }
    .activity-page .act-stat__label {
        font-size: 9px;
    }
    .activity-page .act-stat__value {
        margin-top: 8px;
        font-size: 20px;
    }
    .activity-page .act-stat:nth-child(n + 4) .act-stat__value {
        margin-top: 6px;
        font-size: 15px;
    }
    .activity-page .act-unit,
    .activity-page .act-stat__sub {
        display: block;
        margin-top: 3px;
        font-size: 8px;
    }
    .act-overview,
    .act-overview--no-map {
        grid-template-columns: 1fr;
    }
    .activity-page .activity-map {
        height: 200px;
    }
    .activity-map-distance {
        right: 12px;
        bottom: 12px;
        padding: 5px 9px;
        font-size: 10px;
    }
    .act-overview-side {
        gap: 8px;
    }
    .act-session-load {
        padding: 15px 16px;
    }
    .act-session-load__value {
        font-size: 22px;
    }
    .act-session-load__rows {
        margin-top: 13px;
        padding-top: 13px;
    }
    .act-gear-card {
        min-height: 72px;
        padding: 14px 16px;
    }
    .activity-page .gear-inline-select {
        font-size: 13px;
    }
    .activity-page > turbo-frame#fatigue-metric .act-fatigue-card {
        padding: 15px 16px;
        gap: 13px;
    }
    .activity-page > turbo-frame#fatigue-metric .act-fatigue-card__intro {
        gap: 10px;
    }
    .activity-page > turbo-frame#fatigue-metric .act-fatigue-card__head {
        margin-top: 7px;
    }
    .activity-page > turbo-frame#fatigue-metric .act-fatigue-card__head strong {
        font-size: 16px;
    }
    .activity-page > turbo-frame#fatigue-metric .act-fatigue-card__confidence {
        padding: 4px 8px;
        font-size: 9px;
    }
    .activity-page > turbo-frame#fatigue-metric .act-fatigue-card__grid > div {
        padding: 10px 11px;
    }
    .activity-page > turbo-frame#fatigue-metric .act-fatigue-card__grid strong {
        font-size: 15px;
    }
    .activity-page > turbo-frame#fatigue-metric .act-fatigue-card__summary {
        font-size: 12px;
        line-height: 1.45;
    }
    .activity-card-header {
        padding: 15px 16px 12px;
    }
    .activity-card-header .widget__title {
        font-size: 14px;
    }
    .activity-chart-card .activity-card-header {
        align-items: center;
    }
    .activity-chart-sub {
        display: none;
    }
    .activity-chart-card .activity-chart-wrap {
        padding: 0 16px;
    }
    .activity-chart-legend {
        gap: 12px;
        padding: 10px 16px 14px;
        font-size: 10px;
    }
    .wr-assessment,
    .wr-evidence,
    .wr-next-step {
        margin-right: 16px;
        margin-left: 16px;
    }
    .wr-assessment {
        padding: 13px 14px;
    }
    .wr-assessment h3 {
        font-size: 15px;
    }
    .workout-reserve-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin: 0 16px 12px;
    }
    .workout-reserve-stat {
        padding: 10px 11px;
    }
    .workout-reserve-stat__value {
        font-size: 15px;
    }
    .workout-reserve-stat--primary .workout-reserve-stat__value {
        font-size: 19px;
    }
    .workout-reserve-insights {
        grid-template-columns: 1fr;
        margin: 0 16px 12px;
    }
    .workout-reserve-reps {
        margin: 0 16px 12px;
    }
    .workout-reserve-records {
        margin: -3px 16px 12px;
    }
    .workout-reserve-chart-wrap {
        padding: 0;
    }
    .workout-reserve-chart-legend {
        gap: 8px 11px;
        padding: 8px 16px 11px;
    }
    .workout-reserve-profile {
        margin: 0 16px 10px;
    }
    .workout-reserve-profile__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .workout-reserve-caveat {
        padding: 0 16px 14px;
    }
    .activity-data-card {
        padding: 0 16px 15px;
    }
    .activity-data-card .activity-card-header {
        padding: 15px 0 12px;
    }
    .laps-card .splits-table thead,
    .lap-summary-table thead,
    .splits-card .splits-table thead {
        display: none;
    }
    .laps-card .splits-table,
    .laps-card .splits-table tbody,
    .lap-summary-table,
    .lap-summary-table tbody,
    .splits-card .splits-table,
    .splits-card .splits-table tbody {
        display: block;
        width: 100%;
    }
    .laps-card .splits-table tbody {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .laps-card .split-row {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 7px 10px;
        padding: 9px 12px;
        border: 1px solid var(--border);
        border-left-width: 3px;
        border-radius: 10px;
        background: var(--surface-2);
    }
    .laps-card .split-row.zone-1 {
        border-left-color: #3b82f6;
    }
    .laps-card .split-row.zone-2 {
        border-left-color: #22c55e;
    }
    .laps-card .split-row.zone-3 {
        border-left-color: #f59e0b;
    }
    .laps-card .split-row.zone-4 {
        border-left-color: #ef4444;
    }
    .laps-card .split-row.zone-5 {
        border-left-color: #a855f7;
    }
    .laps-card .splits-table td {
        display: block;
        height: auto;
        padding: 0;
        border: 0 !important;
        text-align: left;
        font-size: 11px;
    }
    .laps-card .lap-index {
        grid-column: 1;
        grid-row: 1;
        align-self: center;
    }
    .laps-card .lap-role-cell {
        grid-column: 2 / 5;
        grid-row: 1;
        justify-self: end;
    }
    .laps-card .lap-dist {
        grid-column: 1;
    }
    .laps-card .lap-dist,
    .laps-card .lap-time,
    .laps-card .lap-pace,
    .laps-card .lap-hr {
        grid-row: 2;
    }
    .laps-card .lap-time {
        grid-column: 2;
        color: var(--text-2);
    }
    .laps-card .lap-pace {
        grid-column: 3;
    }
    .laps-card .lap-hr {
        grid-column: 4;
    }
    .laps-card .lap-elev {
        display: none !important;
    }
    .activity-data-card .act-unit {
        display: inline;
    }
    .laps-card td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 3px;
        color: var(--muted);
        font-family: var(--font-sans);
        font-size: 8px;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }
    .laps-card .lap-index::before,
    .laps-card .lap-role-cell::before {
        display: none !important;
    }
    .lap-summary-table tbody {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .lap-summary-table tr {
        display: flex;
        flex-direction: column;
        gap: 5px;
        padding: 11px 12px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface-2);
    }
    .lap-summary-table td {
        display: grid;
        grid-template-columns: minmax(58px, 1fr) minmax(0, 1fr);
        align-items: baseline;
        width: 100%;
        height: auto !important;
        padding: 0 !important;
        border: 0 !important;
        font-size: 10px !important;
        text-align: left;
    }
    .lap-summary-table .lap-summary-value {
        margin-left: 0;
    }
    .lap-summary-table .lap-summary-time {
        margin-left: 0;
    }
    .lap-summary-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-family: var(--font-sans);
        font-size: 9px;
        font-weight: 500;
    }
    .lap-summary-table .lap-summary-label {
        display: flex;
        justify-content: flex-start;
        margin-bottom: 4px;
        font-size: 13px !important;
    }
    .lap-summary-table .lap-summary-label::before {
        display: none;
    }
    .race-pace-card {
        padding-bottom: 15px;
    }
    .race-pace-grid {
        grid-template-columns: 1fr;
        margin: 0 16px;
        border-radius: 0;
        border: 0;
        background: transparent;
        gap: 0;
    }
    .race-pace-item {
        display: grid;
        grid-template-columns: 70px 1fr auto;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid var(--row-border);
    }
    .race-pace-item:last-child {
        border-bottom: 0;
    }
    .race-pace-item__head {
        display: contents;
    }
    .race-pace-item__head strong {
        font-size: 12px;
    }
    .race-pace-item__value {
        margin: 0;
        font-size: 12px;
    }
    .splits-card .split-row {
        display: grid;
        grid-template-columns: 26px 58px 46px 1fr;
        gap: 10px;
        align-items: center;
        border-bottom: 1px solid var(--row-border);
    }
    .splits-card .splits-table td {
        display: block;
        height: auto;
        padding: 7px 0;
        border: 0 !important;
        text-align: left;
        font-size: 11px;
    }
    .splits-card .split-elev {
        display: none !important;
    }
    .splits-card .split-zone {
        min-width: 0;
    }

    .lap-grid-head,
    .laps-card--with-roles .lap-grid-head {
        display: grid;
        grid-template-columns: 28px 46px repeat(4, minmax(0, 1fr));
        gap: 0 4px;
        padding: 0 10px 7px 13px;
        font-size: 8px;
        letter-spacing: 0.05em;
    }
    .lap-grid-head > div {
        min-width: 0;
        text-align: right;
    }
    .lap-grid-head > div:first-child,
    .laps-card--with-roles .lap-grid-head > div:nth-child(2) {
        text-align: left;
    }
    .lap-grid-head > div:last-child {
        display: none;
    }
    .lap-grid {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .lap-grid-data,
    .laps-card--with-roles .lap-grid-data {
        grid-template-columns: 28px 46px repeat(4, minmax(0, 1fr));
        grid-template-rows: auto;
        gap: 0 4px;
        align-items: center;
        margin-left: 0;
        padding: 8px 10px;
        border: 1px solid var(--border);
        border-left-width: 3px;
        border-radius: 8px;
        background: var(--surface-2);
        font-size: 11px;
    }
    .lap-grid-data.zone-1 {
        border-left-color: #e9c48a;
    }
    .lap-grid-data.zone-2 {
        border-left-color: #e0923c;
    }
    .lap-grid-data.zone-3 {
        border-left-color: #c95c19;
    }
    .lap-grid-data.zone-4 {
        border-left-color: #9e4126;
    }
    .lap-grid-data.zone-5 {
        border-left-color: #6f2519;
    }
    .lap-grid-index {
        grid-column: 1;
        grid-row: 1;
        align-self: center;
    }
    .lap-grid-data .lap-role-cell {
        grid-column: 2;
        grid-row: 1;
        justify-self: stretch;
        justify-content: flex-start;
    }
    .lap-grid-dist,
    .lap-grid-time,
    .lap-grid-pace,
    .lap-grid-hr {
        grid-row: 1;
        text-align: right !important;
    }
    .lap-grid-dist {
        grid-column: 3;
    }
    .lap-grid-time {
        grid-column: 4;
    }
    .lap-grid-pace {
        grid-column: 5;
    }
    .lap-grid-hr {
        grid-column: 6;
    }
    .lap-grid-elev {
        display: none;
    }
    .lap-grid-data [data-label]::before {
        display: none;
    }
    .lap-grid-pace .act-unit,
    .lap-grid-hr .act-unit {
        display: none;
    }
    .lap-grid-data .lap-grid-index {
        gap: 0;
    }
    .lap-grid-data .lap-role-actions {
        gap: 2px;
    }

    .activity-split-head {
        display: none;
    }
    .activity-split-row {
        grid-template-columns: 26px 62px 50px minmax(0, 1fr);
        gap: 0 10px;
    }
    .activity-split-data {
        min-height: 32px;
        padding: 6px 0;
    }
    .activity-split-km {
        font-size: 11px;
    }
    .activity-split-pace {
        font-size: 12px;
        text-align: left;
    }
    .activity-split-hr {
        font-size: 11px;
        text-align: left;
    }
    .activity-split-elev {
        display: none;
    }
    .split-zone-track {
        height: 8px;
    }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Week Hero block
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.wh-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.04);
}

.wh-week-nav {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 0 2px 8px;
}

.wh-week-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    transition:
        border-color 0.1s,
        color 0.1s,
        background 0.1s;
}

.wh-week-nav__link:hover {
    border-color: var(--text-2);
    color: var(--text);
}

.wh-week-nav__link--disabled {
    opacity: 0.38;
    pointer-events: none;
}

.wh-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 18px 22px 14px;
}

.wh-week-type {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 3px;
    text-transform: uppercase;
}

.wh-week-range {
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.wh-header__stats {
    text-align: right;
    flex-shrink: 0;
}

.wh-km-big {
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1;
}

.wh-km-unit {
    font-size: 13px;
    font-weight: 400;
    color: var(--muted);
    letter-spacing: 0;
}

.wh-header-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-2);
    margin-top: 5px;
}

/* Coaching band */
.wh-coaching {
    margin: 12px 20px 0;
    padding: 10px 14px 10px 16px;
    font-size: 12px;
    line-height: 1.6;
    background: var(--amber-tint);
    border: 1px solid var(--amber-border);
    border-left: 3px solid var(--accent);
    border-radius: 9px;
}

.wh-coaching__rec {
    color: #8a4a07;
    font-weight: 500;
    display: block;
}

.wh-coaching__stats {
    font-family: var(--font-mono);
    font-size: 11px;
    color: #9b8a6e;
    display: block;
    margin-top: 2px;
}

/* Week note sits as a compact inset panel inside the hero card. */
.wh-card .week-note-frame {
    margin: 10px 20px 0;
}

/* Two-column targets */
.wh-targets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 28px;
    margin-top: 14px;
    padding: 16px 20px 14px;
}

@media (max-width: 600px) {
    .wh-card .week-note-frame {
        margin-right: 16px;
        margin-left: 16px;
    }
    .week-note-editor__help {
        display: none;
    }
    .wh-targets {
        grid-template-columns: 1fr;
        row-gap: 20px;
    }
}

.wh-targets__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 10px;
    min-height: 28px;
    display: flex;
    align-items: center;
}

.wh-load-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.wh-load-header .wh-targets__label {
    margin-bottom: 0;
}

.wh-load-chips {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.wh-load-rtss {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.wh-load-unit {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--muted);
}

.wh-ramp-chip {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

.wh-ramp-chip--pos {
    background: #e6efe1;
    color: #3a6632;
}

.wh-ramp-chip--neg {
    background: #fde8e4;
    color: #7e2a1e;
}

/* Volume / load bar rows */
.wh-vol-bars {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.wh-vol-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wh-vol-bar-label {
    display: flex;
    flex-direction: column;
    width: 72px;
    flex-shrink: 0;
}

.wh-vol-bar-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.2;
}

.wh-vol-bar-sub {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--muted);
}

.wh-vol-bar-val {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--muted);
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
    min-width: 56px;
}

/* Sessions list */
.wh-sessions {
}

.wh-sessions-hdr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px 10px;
}

.wh-sessions-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.wh-sessions-count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
}

.wh-sessions-list {
    border-top: 1px solid var(--border);
}

/* Desktop: transparent wrappers — children flow into the parent flex row */
.wh-sess-top {
    display: contents;
}
.wh-sess-bottom {
    display: contents;
}

/* Restore logical desktop order via flex order */
.wh-sess-when {
    order: 1;
}
.wh-sess-body {
    order: 2;
}
.wh-sess-dist {
    order: 3;
}
.wh-sess-pace {
    order: 4;
}
.wh-sess-hr {
    order: 5;
}
.wh-sess-load {
    order: 6;
}
.wh-sess-suf {
    order: 7;
}

.wh-sess-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    border-bottom: 1px solid var(--row-border);
    color: inherit;
    text-decoration: none;
    transition: background 0.1s;
}

.wh-sess-row--last {
    border-bottom: none;
}

.wh-sess-row:hover {
    background: var(--surface-2);
}

.wh-sess-when {
    flex-shrink: 0;
    width: 42px;
}

.wh-sess-date {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    color: var(--text);
}

.wh-sess-time {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--muted);
    margin-top: 1px;
}

.wh-sess-body {
    flex: 1;
    min-width: 0;
}

.wh-sess-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 3px;
}

.wh-sess-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wh-sess-dist {
    display: inline-flex;
    align-items: baseline;
    justify-content: flex-end;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
    text-align: right;
    min-width: 42px;
}

.wh-sess-pace {
    display: inline-flex;
    align-items: baseline;
    justify-content: flex-end;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--pace);
    flex-shrink: 0;
    text-align: right;
    min-width: 36px;
}

.wh-sess-hr {
    display: inline-flex;
    align-items: baseline;
    justify-content: flex-end;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--hr);
    flex-shrink: 0;
    text-align: right;
    min-width: 28px;
}
.wh-sess-unit {
    margin-left: 3px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 400;
}

.wh-sess-load-group {
    order: 6;
    display: contents;
    color: var(--muted);
}

.wh-sess-load {
    font-family: var(--font-mono);
    font-size: 11px;
    flex-shrink: 0;
    text-align: right;
    min-width: 32px;
}

.wh-sess-suf {
    font-family: var(--font-mono);
    font-size: 11px;
    flex-shrink: 0;
    text-align: right;
    min-width: 28px;
}

@media (max-width: 600px) {
    /* Header */
    .wh-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) max-content;
        align-items: start;
        padding: 14px 12px 12px;
        column-gap: 6px;
    }

    .wh-week-nav {
        margin-right: 0;
        margin-left: 0;
    }

    .wh-week-nav__link {
        padding: 6px 8px;
        font-size: 9px;
    }

    .wh-header__period {
        min-width: 0;
    }

    .wh-week-type {
        margin-bottom: 4px;
        font-size: 9px;
        line-height: 1.2;
        letter-spacing: 0.035em;
        white-space: nowrap;
    }

    .wh-week-range {
        font-size: clamp(13px, 3.6vw, 14px);
        line-height: 1.2;
        white-space: nowrap;
    }

    .wh-header__stats {
        display: grid;
        justify-items: end;
        min-width: 0;
    }

    .wh-km-big {
        font-size: clamp(19px, 5.65vw, 22px);
        white-space: nowrap;
    }

    .wh-km-unit {
        font-size: 10px;
    }

    .wh-header-meta {
        font-size: clamp(7px, 2.05vw, 8px);
        line-height: 1.2;
        margin-top: 4px;
        white-space: nowrap;
    }

    /* Coaching band */
    .wh-coaching {
        margin: 10px 16px 0;
        padding: 9px 11px 9px 13px;
    }

    /* Targets */
    .wh-targets {
        padding: 14px 16px 12px;
    }

    /* Sessions header */
    .wh-sessions-hdr {
        padding: 12px 16px 10px;
    }

    .wh-sessions-count {
        font-size: 10px;
    }

    /* Sessions list — no top border, gap between cards */
    .wh-sessions-list {
        border-top: none;
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 0 12px 14px;
    }

    /* Each session becomes a card */
    .wh-sess-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 10px 12px;
        border: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface-2);
    }

    .wh-sess-row--last {
        border-bottom: 1px solid var(--border);
    }

    .wh-sess-row:hover {
        background: var(--bg);
    }

    /* Reset order — mobile uses column layout, DOM order is correct */
    .wh-sess-when,
    .wh-sess-body,
    .wh-sess-dist,
    .wh-sess-pace,
    .wh-sess-hr,
    .wh-sess-load-group,
    .wh-sess-load,
    .wh-sess-suf {
        order: unset;
    }

    /* Group load + suf together on the right of the top bar */
    .wh-sess-load-group {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    /* Top row: date/time left, rTSS right */
    .wh-sess-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 7px;
    }

    .wh-sess-when {
        display: flex;
        flex-direction: row;
        align-items: baseline;
        gap: 5px;
        width: auto;
    }

    .wh-sess-time {
        margin-top: 0;
        font-size: 10px;
    }

    /* Body: tags + name */
    .wh-sess-body {
        margin-bottom: 8px;
    }

    .wh-sess-name {
        white-space: normal;
    }

    /* Bottom row: dist · pace */
    .wh-sess-bottom {
        display: flex;
        gap: 14px;
        font-family: var(--font-mono);
        font-size: 11px;
    }

    .wh-sess-dist {
        text-align: left;
        min-width: auto;
        font-size: 11px;
    }

    .wh-sess-pace {
        text-align: left;
        min-width: auto;
    }

    /* Compact two-line session grid: metrics stay aligned and comparable. */
    .wh-sess-row {
        display: grid;
        grid-template-columns: minmax(54px, 1fr) auto auto auto 30px 26px;
        grid-template-rows: auto auto;
        align-items: baseline;
        gap: 7px 8px;
        padding: 9px 10px;
    }

    .wh-sess-top,
    .wh-sess-bottom,
    .wh-sess-load-group {
        display: contents;
    }

    .wh-sess-when {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    .wh-sess-dist {
        grid-column: 2;
        grid-row: 1;
        white-space: nowrap;
        justify-content: flex-end;
    }

    .wh-sess-pace {
        grid-column: 3;
        grid-row: 1;
        white-space: nowrap;
        justify-content: flex-end;
    }

    .wh-sess-hr {
        grid-column: 4;
        grid-row: 1;
        min-width: 0;
        justify-content: flex-end;
    }

    .wh-sess-load {
        grid-column: 5;
        grid-row: 1;
        min-width: 0;
    }

    .wh-sess-suf {
        grid-column: 6;
        grid-row: 1;
        min-width: 0;
    }

    .wh-sess-body {
        grid-column: 1 / -1;
        grid-row: 2;
        display: flex;
        align-items: center;
        gap: 6px;
        min-width: 0;
        margin-bottom: 0;
        overflow: hidden;
    }

    .wh-sess-tags {
        flex: 0 1 auto;
        flex-wrap: nowrap;
        max-width: 52%;
        min-width: 0;
        margin-bottom: 0;
        overflow: hidden;
    }

    .wh-sess-tags .tag {
        flex-shrink: 0;
    }

    .wh-sess-tags .tag:nth-child(n + 4) {
        display: none;
    }

    .wh-sess-name {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        color: var(--text-2);
        font-size: 12px;
        font-weight: 500;
        line-height: 1.35;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

.wh-sess-load-chip {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.wh-sess-load-chip--hard {
    background: #fde8e4;
    color: #7e2a1e;
}

/* ─── Fitness signals card (dashboard + analysis) ──────────────────── */
.perf-card {
    overflow: visible;
}
.perf-card__header {
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
}
.perf-card__analysis-link {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.perf-card__analysis-link:hover {
    color: var(--accent-dark);
}
.perf-card__body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 18px 22px 20px;
}
.perf-card__section {
    display: flex;
    flex-direction: column;
    gap: 13px;
}
.perf-card__section + .perf-card__section {
    border-top: 1px solid var(--border);
    padding-top: 18px;
}
.perf-card__section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.perf-card__headline {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 9px;
}
.perf-card__dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 2px;
    background: var(--accent);
}
.perf-card__headline strong {
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1;
}
.perf-card__headline .act-unit,
.perf-card__headline small {
    display: inline;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}
.perf-card__badge {
    flex-shrink: 0;
    padding: 5px 11px;
    border-radius: 7px;
    background: var(--track);
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.perf-card__grid {
    display: grid;
    gap: 1px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--border);
}
.perf-card__grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.perf-card__grid > div {
    min-width: 0;
    padding: 14px 16px;
    background: var(--bg-card);
}
.perf-card__grid > div:first-child { border-radius: 10px 0 0 10px; }
.perf-card__grid > div:last-child  { border-radius: 0 10px 10px 0; }
.perf-card__grid span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 1;
    text-transform: uppercase;
}
.perf-card__tip {
    width: max-content;
    max-width: 100%;
}
.perf-card__grid strong {
    display: block;
    margin-top: 8px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
    white-space: nowrap;
}
.perf-card__grid strong .act-unit {
    display: inline;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}
.perf-card__grid small {
    color: var(--muted);
    font-size: 11px;
}
.perf-card__trend--up   { color: #4a7543; }
.perf-card__trend--down { color: #c8553d; }
.perf-card__trend--flat { color: var(--text); }
.perf-card__summary {
    margin: 0;
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.55;
    text-wrap: pretty;
}
.perf-card__source-link {
    color: var(--accent);
    font-weight: 600;
}
@media (max-width: 600px) {
    .perf-card__header {
        gap: 10px;
        padding: 16px 18px 14px;
    }
    .perf-card__body {
        padding: 16px 18px 18px;
    }
    .perf-card__section-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }
    .perf-card__badge {
        align-self: flex-start;
    }
    .perf-card__grid > div  { padding: 10px 12px; }
    .perf-card__grid strong { font-size: 17px; }
    .perf-card__headline strong { font-size: 16px; }
}
@media (max-width: 430px) {
    .perf-card__grid--three {
        grid-template-columns: 1fr;
    }
    .perf-card__grid > div:first-child,
    .perf-card__grid > div:last-child {
        border-radius: 0;
    }
    .perf-card__grid > div:first-child {
        border-radius: 10px 10px 0 0;
    }
    .perf-card__grid > div:last-child {
        border-radius: 0 0 10px 10px;
    }
}

.fitness-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.fitness-chart-card {
    padding-bottom: 20px;
}
.fitness-chart-shell {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.fitness-chart-controls {
    align-self: flex-end;
    margin: -4px 22px 0;
}
.fitness-canvas-wrap canvas {
    display: block;
    width: 100%;
    cursor: grab;
}
.fitness-canvas-wrap .tl-tooltip {
    max-width: min(520px, calc(100vw - 48px));
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    white-space: normal;
    line-height: 1.35;
}
.fitness-canvas-wrap .tl-tooltip .tl-tip-val {
    color: var(--muted);
}
.performance-curve-card .fitness-canvas-wrap canvas {
    cursor: default;
}
.performance-curve-card .fitness-canvas-wrap {
    padding-bottom: 4px;
}
.fitness-chart-empty {
    margin: 0 22px 20px;
    color: var(--muted);
    font-size: 13px;
}
.fitness-chart-legend-note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: -4px 22px 0;
    color: var(--muted);
    font-size: 12px;
}
.fitness-chart-legend-swatch {
    display: inline-block;
    width: 14px;
    height: 0;
    border-top: 1.5px dotted var(--muted);
    flex: none;
}
.fitness-estimate-head {
    display: grid;
    grid-template-columns: minmax(140px, auto) repeat(3, minmax(0, 1fr));
    gap: 1px;
    margin: 0 22px 18px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--border);
    overflow: hidden;
}
.fitness-estimate-head__main,
.fitness-estimate-head__stat {
    min-width: 0;
    padding: 14px 16px;
    background: var(--bg-card);
}
.fitness-estimate-head__main {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.fitness-estimate-head__main strong {
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}
.fitness-estimate-head__main span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.fitness-estimate-head__stat strong {
    display: block;
    margin-top: 8px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
    white-space: nowrap;
}
.fitness-estimate-head__stat strong small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}
.fitness-estimate-head__stat strong.fitness-estimate-head__anchor {
    font-size: 14px;
    white-space: normal;
}
.fitness-estimate-head__stat strong.fitness-estimate-head__anchor .perf-card__source-link {
    text-decoration: none;
}
.fitness-estimate-head__stat strong.fitness-estimate-head__anchor .perf-card__source-link:hover {
    text-decoration: underline;
}
.fitness-estimate-head__stat > span:last-child:not(.act-card-label) {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}
@media (max-width: 700px) {
    .fitness-estimate-head {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
.race-predictions-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin: 0 22px 20px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--border);
    overflow: hidden;
}
.race-prediction {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 14px 16px;
    background: var(--bg-card);
}
.race-prediction strong {
    margin-top: 6px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1;
}
.race-prediction__pace {
    margin-top: 4px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 12px;
}
.race-prediction__range {
    margin-top: 6px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
}
.race-prediction__flag {
    align-self: flex-start;
    margin-top: 6px;
    padding: 3px 7px;
    border-radius: 6px;
    background: var(--track);
    color: var(--amber-dark);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .05em;
    line-height: 1;
    text-transform: uppercase;
}
.zone-refresh-nudge {
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 0 11px 11px 0;
    background: var(--bg-card);
}
.zone-refresh-nudge p {
    margin: 0;
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.55;
}
.zone-refresh-nudge a {
    color: var(--accent);
    font-weight: 600;
}
@media (max-width: 700px) {
    .race-predictions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin: 0 18px 16px;
    }
}
.durability-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    margin: 0 22px 12px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
    min-height: 60px;
}
.durability-bar {
    flex: 1 1 0;
    max-width: 14px;
    min-width: 4px;
    border-radius: 3px 3px 0 0;
    background: var(--muted);
}
.durability-bar--good { background: #5b8a51; }
.durability-bar--watch { background: #d9700f; }
.durability-bar--fade { background: #c8553d; }
.durability-thresholds {
    display: flex;
    gap: 14px;
    margin: 0 22px 18px;
    font-size: 11px;
    color: var(--muted);
}
.durability-thresholds__item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.durability-thresholds__item::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
}
.durability-thresholds__item--watch::before { background: #d9700f; }
.durability-thresholds__item--fade::before { background: #c8553d; }
.performance-proofs-card {
    overflow: visible;
}
.performance-proofs-card__header {
    margin-bottom: 0;
}
.performance-proofs-card__title-line {
    display: flex;
    align-items: baseline;
    gap: 9px;
}
.performance-proofs-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin: 0 22px 16px;
}
.performance-proof {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    padding: 15px 15px 16px;
    background: #f3efe7;
    border: 1px solid var(--border);
    border-top: 3px solid var(--proof-accent, var(--muted));
    border-radius: 13px;
}
.performance-proof__top {
    min-width: 0;
}
.performance-proof__top .act-card-label {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.performance-proof h3 {
    min-width: 0;
    margin: 0;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}
.performance-proof__value strong {
    display: block;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 25px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
}
.performance-proof__value > span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.performance-proof__value .act-unit {
    display: inline;
    font-size: 10px;
    white-space: nowrap;
}
.performance-proof__value--empty strong {
    color: #c3b89f;
}
.performance-proof__value--empty span {
    font-family: var(--font-sans);
    font-size: 11px;
}
.performance-proof__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    padding-top: 9px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
}
.performance-proof__source {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}
@media (max-width: 860px) {
    .performance-proofs-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 700px) {
    .fitness-line-chart {
        min-width: 680px;
    }
    .fitness-chart-controls {
        align-self: flex-start;
        margin: -4px 18px 0;
    }
    .performance-proofs-card__title-line {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
    .performance-proofs-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin: 0 18px 14px;
    }
    .performance-proof {
        gap: 10px;
    }
    .performance-proof h3 {
        font-size: 15px;
    }
    /* Value row: time · pace inline */
    .performance-proof__value {
        display: flex;
        align-items: baseline;
        gap: 9px;
    }
    .performance-proof__value strong {
        font-size: 21px;
    }
    .performance-proof__value > span {
        margin-top: 0;
        font-size: 11px;
    }
}

/* ─── Activity best-effort PR chips ────────────────────────────────── */
.act-pr-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 8px;
}
.act-pr-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 8px;
    background: #fef9c3;
    border: 1px solid #d4c63a;
    font: 600 12px var(--font-sans);
    color: #6d5f11;
}
.act-pr-chip__icon { font-size: 13px; }
.act-pr-chip__imp {
    font: 500 11px var(--font-mono);
    color: #4a7543;
}
