/* ── Activity overflow menu (Download GPX / Mark as Target Race / Delete) ── */
        .activity-menu { position: relative; }
        .activity-menu-btn {
            display: flex; align-items: center; justify-content: center;
            width: 34px; height: 34px; padding: 0;
            border: 1px solid #cbd5e1; border-radius: 6px;
            background: #f8fafc; color: #374151; cursor: pointer;
        }
        .activity-menu-btn:hover { background: #f1f5f9; }
        .activity-menu-btn.is-active { background: #e2e8f0; }
        html.dark-mode .activity-menu-btn { background: #0f172a; border-color: #334155; color: #94a3b8; }
        html.dark-mode .activity-menu-btn:hover, html.dark-mode .activity-menu-btn.is-active { background: #1e293b; }

        .activity-menu-panel {
            display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 200;
            min-width: 210px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
            box-shadow: 0 8px 24px rgba(15,23,42,0.15); padding: 6px;
            flex-direction: column; gap: 2px;
        }
        .activity-menu-panel.is-open { display: flex; }
        .activity-menu-item {
            display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
            padding: 8px 10px; border: none; background: none; border-radius: 6px;
            font-size: 0.88em; color: #374151; cursor: pointer; white-space: nowrap;
        }
        .activity-menu-item:hover { background: #f1f5f9; }
        .activity-menu-item--danger { color: #dc2626; }
        .activity-menu-item--danger:hover { background: #fef2f2; }
        html.dark-mode .activity-menu-panel { background: #1e293b; border-color: #334155; }
        html.dark-mode .activity-menu-item { color: #cbd5e1; }
        html.dark-mode .activity-menu-item:hover { background: #0f172a; }
        html.dark-mode .activity-menu-item--danger { color: #f87171; }
        html.dark-mode .activity-menu-item--danger:hover { background: rgba(220,38,38,0.14); }

/* ── Elevation correction (menu chip, banner, comparison modal) ── */
        .elev-chip { font-size: 0.72em; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: #dcfce7; color: #166534; }
        html.dark-mode .elev-chip { background: rgba(34,197,94,0.18); color: #86efac; }

        .elev-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px; font-size: 0.92em; }
        .elev-banner[hidden] { display: none; }
        .elev-banner__text { flex: 1; min-width: 220px; color: #0c4a6e; }
        .elev-banner__btn { padding: 5px 12px; border-radius: 6px; border: 1px solid #0ea5e9; background: #0ea5e9; color: #fff; font-weight: 600; font-size: 0.92em; cursor: pointer; }
        .elev-banner__dismiss { border: none; background: none; color: #64748b; font-size: 1.3em; line-height: 1; cursor: pointer; padding: 0 4px; }
        html.dark-mode .elev-banner { background: #0c1a2b; border-color: #164e63; }
        html.dark-mode .elev-banner__text { color: #bae6fd; }

        .modal.modal--wide { width: min(680px, 94vw); max-height: 92vh; overflow-y: auto; }
        .elev-lede { margin: 0; color: #475569; font-size: 0.92em; line-height: 1.5; }
        .elev-status { padding: 14px; border-radius: 8px; background: #f8fafc; color: #475569; font-size: 0.92em; text-align: center; }
        .elev-status--error { background: #fef2f2; color: #b91c1c; }
        .elev-status[hidden], .elev-upsell[hidden] { display: none; }
        .elev-upsell { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; border-radius: 8px; background: #fefce8; border: 1px solid #fde68a; color: #78350f; font-size: 0.92em; }
        .elev-upsell .modal-action { text-decoration: none; }
        .elev-chart svg { display: block; width: 100%; height: auto; }
        .elev-chart .elev-axis { stroke: #e2e8f0; stroke-width: 1; }
        .elev-chart .elev-tick { fill: #64748b; font-size: 11px; }
        .elev-chart .elev-line--watch { fill: none; stroke: #64748b; stroke-width: 1.8; stroke-dasharray: 5 3; }
        .elev-chart .elev-line--terrain { fill: none; stroke: oklch(52% 0.16 155); stroke-width: 2.2; }
        .elev-legend { display: flex; gap: 16px; font-size: 0.82em; color: #475569; margin-top: 4px; }
        .elev-legend__item { display: inline-flex; align-items: center; gap: 6px; }
        .elev-swatch { display: inline-block; width: 18px; height: 0; border-top: 2px solid; }
        .elev-swatch--watch { border-top-style: dashed; border-color: #64748b; }
        .elev-swatch--terrain { border-color: oklch(52% 0.16 155); border-top-width: 3px; }
        .elev-compare { width: 100%; border-collapse: collapse; font-size: 0.9em; margin-top: 10px; }
        .elev-compare th { text-align: right; font-weight: 600; color: #64748b; padding: 4px 8px; border-bottom: 1px solid #e2e8f0; }
        .elev-compare td { text-align: right; padding: 6px 8px; border-bottom: 1px solid #f1f5f9; font-variant-numeric: tabular-nums; }
        .elev-compare th:first-child, .elev-compare td:first-child { text-align: left; color: #0f172a; font-weight: 600; }
        .elev-compare .elev-delta--up { color: #b45309; }
        .elev-compare .elev-delta--down { color: #0369a1; }
        .elev-note { margin: 8px 0 0; color: #64748b; font-size: 0.82em; line-height: 1.45; }
        html.dark-mode .elev-lede, html.dark-mode .elev-legend { color: #94a3b8; }
        html.dark-mode .elev-status { background: #0f172a; color: #94a3b8; }
        html.dark-mode .elev-chart .elev-axis { stroke: #334155; }
        html.dark-mode .elev-compare th { border-color: #334155; color: #94a3b8; }
        html.dark-mode .elev-compare td { border-color: #1e293b; }
        html.dark-mode .elev-compare td:first-child { color: #e2e8f0; }

/* ── Map overlay header (type switcher + expand) ── */
        .map-overlay-header {
            position: absolute; top: 8px; left: 8px; right: 8px; z-index: 10;
            display: flex; align-items: center; justify-content: space-between; gap: 6px;
            pointer-events: none;
        }
        .map-overlay-header > * { pointer-events: auto; }

        /* Frosted-glass pill behind the type buttons */
        .map-overlay-header .map-type-btns {
            background: rgba(255,255,255,0.92);
            backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
            border-radius: 20px; padding: 3px 4px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.18);
            /* Wrap onto a second row on narrow maps so the expand button is never pushed out */
            flex-wrap: wrap; min-width: 0;
        }
        .map-overlay-header .mini-map-expand-btn { flex-shrink: 0; }
        html.dark-mode .map-overlay-header .map-type-btns {
            background: rgba(15,23,42,0.88);
        }

        /* Frosted-glass expand button */
        .map-overlay-header .mini-map-expand-btn {
            background: rgba(255,255,255,0.92);
            backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
            border-radius: 7px; padding: 6px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.18);
        }
        html.dark-mode .map-overlay-header .mini-map-expand-btn {
            background: rgba(15,23,42,0.88); color: #94a3b8;
        }
        /* Hide expand button when already fullscreen */
        .mini-map-container.is-fullscreen .map-overlay-header .mini-map-expand-btn { display: none; }

        /* ── Map overlay playback bar (bottom of container) ── */
        .map-overlay-playback {
            position: absolute; bottom: 0; left: 0; right: 0;
            background: rgba(255,255,255,0.88) !important;
            backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
            border-top: 1px solid rgba(0,0,0,0.08) !important;
        }
        html.dark-mode .map-overlay-playback {
            background: rgba(15,23,42,0.90) !important;
            border-top-color: rgba(255,255,255,0.08) !important;
        }

        /* ── Map type switcher pills ── */
        .map-type-btns { display: flex; gap: 3px; flex-shrink: 0; }
        .map-type-btn {
            font-size: 0.7em; font-weight: 600; padding: 2px 8px; border-radius: 12px;
            border: 1px solid transparent; background: none; color: #374151; cursor: pointer;
            transition: background 0.13s, color 0.13s;
            white-space: nowrap;
        }
        .map-type-btn:hover { background: rgba(0,0,0,0.07); }
        .map-type-btn.is-active { background: oklch(37% 0.15 155); color: #fff; }
        .map-type-btn.is-loading { opacity: 0.6; cursor: wait; }
        .map-type-btn--locked { color: #92400e; background: #fef3c7; }
        .map-type-btn--locked:hover { background: #fde68a; }
        html.dark-mode .map-type-btn { color: #cbd5e1; }
        html.dark-mode .map-type-btn:hover { background: rgba(255,255,255,0.12); }
        html.dark-mode .map-type-btn.is-active { background: oklch(37% 0.15 155); color: #fff; }
        html.dark-mode .map-type-btn--locked { background: #451a03; color: #fcd34d; }

        /* Fullscreen toggle inside the 3D flyover playback bar */
        .map-play-expand {
            flex-shrink: 0; display: flex; align-items: center; justify-content: center;
            width: 26px; height: 26px; padding: 0;
            border: none; border-radius: 7px; background: #e2e8f0; color: #374151;
            cursor: pointer; transition: background 0.15s, color 0.15s;
        }
        .map-play-expand:hover { background: #cbd5e1; }
        html.dark-mode .map-play-expand { background: #334155; color: #94a3b8; }
        html.dark-mode .map-play-expand:hover { background: #475569; color: #e2e8f0; }

        /* ── Photorealistic 3D terrain map (Map3DElement) ── */
        /* Fills the mini-map container; sits above the 2D map div but below the
           overlay header / playback bars, which come later in the DOM. */
        #workoutMap3d { position: absolute; inset: 0; }
        #workoutMap3d gmp-map-3d { width: 100%; height: 100%; }

        /* ── 3D Follow button ── */
        .map-follow-btn {
            flex-shrink: 0; font-size: 0.72em; font-weight: 700; padding: 3px 9px;
            border: none; border-radius: 20px; background: #e2e8f0; color: #374151;
            cursor: pointer; letter-spacing: 0.03em; transition: background 0.15s, color 0.15s;
        }
        .map-follow-btn:hover { background: #cbd5e1; }
        .map-follow-btn.is-active { background: #7c3aed; color: #fff; }
        .map-follow-btn.is-active:hover { background: #6d28d9; }
        html.dark-mode .map-follow-btn { background: #334155; color: #94a3b8; }
        html.dark-mode .map-follow-btn:hover { background: #475569; color: #e2e8f0; }
        html.dark-mode .map-follow-btn.is-active { background: #7c3aed; color: #fff; }

        /* ── Strength Overview card ── */
        .strength-overview-card { grid-column: 1 / -1; }
        .strength-stat-tiles {
            display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px;
        }
        .strength-stat-tile {
            flex: 1 1 100px; min-width: 90px;
            display: flex; flex-direction: column; align-items: center;
            background: #f1f5f9; border-radius: 10px; padding: 12px 10px 8px;
        }
        html.dark-mode .strength-stat-tile { background: #1e293b; }
        .strength-stat-value {
            font-size: 1.45em; font-weight: 700; color: oklch(37% 0.15 155); line-height: 1.1;
        }
        html.dark-mode .strength-stat-value { color: oklch(68% 0.14 155); }
        .strength-stat-label {
            font-size: 0.7em; font-weight: 600; color: #64748b; text-transform: uppercase;
            letter-spacing: 0.05em; margin-top: 4px; text-align: center;
        }
        /* ── Exercise Breakdown card ── */
        .strength-breakdown-card { grid-column: 1 / -1; }
        .strength-ex-row { align-items: baseline; }
        .strength-ex-name { font-weight: 600; color: oklch(14% 0.018 155); overflow-wrap: break-word; }
        html.dark-mode .strength-ex-name { color: #e2e8f0; }
        .strength-ex-val { color: #0f766e; font-size: 0.88em; }
        html.dark-mode .strength-ex-val { color: #2dd4bf; }

        /* ── Quick AI Analysis card ── */
        .quick-ai-result { color: #1e293b; }
        html.dark-mode .quick-ai-result { color: #e2e8f0; }

        html.dark-mode .activity-title-input { background: oklch(14% 0.018 155); border-color: #475569; color: #e2e8f0; }
        html.dark-mode .activity-title-edit-btn { color: #94a3b8; }
        /* Long/unbroken workout titles (from FIT metadata or an athlete rename)
           shouldn't blow out the header row layout. */
        #activityTitleText { overflow-wrap: anywhere; }

        /* ── Workout PR Banner ── */
        .workout-pr-banner { display:flex; align-items:center; gap:10px; padding:10px 16px; margin-bottom:16px; background:#fefce8; border:1px solid #fde68a; border-radius:8px; font-size:0.92em; flex-wrap:wrap; }
        .workout-pr-banner__icon { font-size:1.3em; flex-shrink:0; }
        .workout-pr-banner__text { flex:1; color:#78350f; }
        .workout-pr-banner__link { color:#d97706; font-weight:600; text-decoration:none; white-space:nowrap; }
        .workout-pr-banner__link:hover { text-decoration:underline; }
        html.dark-mode .workout-pr-banner { background:#1c1407; border-color:#78350f; }
        html.dark-mode .workout-pr-banner__text { color:#fde68a; }
        html.dark-mode .workout-pr-banner__link { color:#fbbf24; }

/* ── Workout review: planned session, verdict, flags, race specificity ── */
.review-intent { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 0.85em; }
.review-intent__label { color: #475569; font-weight: 600; }
.review-intent__select { padding: 4px 8px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; color: #0f172a; font: inherit; }
.review-intent__source, .review-intent__status { color: #64748b; font-size: 0.92em; }
html.dark-mode .review-intent__label { color: #cbd5e1; }
html.dark-mode .review-intent__select { background: #0f172a; border-color: #475569; color: #e2e8f0; }
html.dark-mode .review-intent__source, html.dark-mode .review-intent__status { color: #94a3b8; }

.review-verdict {
    margin: 14px 0 16px; padding: 14px 16px 12px;
    border: 1px solid #cbd5e1; border-radius: 8px; background: #f8fafc;
}
.review-verdict__line { margin: 0 0 10px; font-size: 1em; line-height: 1.45; color: #0f172a; }
.review-verdict__k { font-weight: 700; color: #475569; }
.review-verdict__sep { margin: 0 8px; color: #94a3b8; }
.review-headline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 16px; margin: 0 0 10px; }
.review-headline__item { min-width: 0; }
.review-headline dt { font-size: 0.72em; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #64748b; }
.review-headline dd { margin: 2px 0 0; font-size: 1.35em; font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }
.review-recovery { margin: 0 0 10px; padding: 6px 10px; border-radius: 6px; background: #fff7ed; color: #9a3412; font-size: 0.9em; font-weight: 600; }
.review-flags { border-top: 1px solid #e2e8f0; padding-top: 10px; }
.review-flags__title { margin: 0 0 6px; font-size: 0.8em; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #475569; }
.review-flags__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.review-flag { padding: 8px 10px; border-radius: 6px; border: 1px solid #e2e8f0; background: #fff; }
.review-flag--caution { border-color: #fdba74; background: #fff7ed; }
.review-flag__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 0.92em; color: #0f172a; }
.review-flag__value { font-variant-numeric: tabular-nums; color: #334155; }
.review-flag--caution .review-flag__value { color: #9a3412; font-weight: 600; }
.review-flag__kind { font-size: 0.8em; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }
.review-flag__why { margin: 3px 0 2px; font-size: 0.85em; line-height: 1.45; color: #334155; }
.review-flag__link { font-size: 0.82em; font-weight: 600; color: oklch(40% 0.15 155); }
.review-flags__none, .review-note { margin: 4px 0 0; font-size: 0.86em; color: #475569; }
html.dark-mode .review-verdict { background: #111c2e; border-color: #334155; }
html.dark-mode .review-verdict__line, html.dark-mode .review-headline dd, html.dark-mode .review-flag__head { color: #e2e8f0; }
html.dark-mode .review-verdict__k, html.dark-mode .review-flags__title { color: #cbd5e1; }
html.dark-mode .review-headline dt, html.dark-mode .review-flag__kind { color: #94a3b8; }
html.dark-mode .review-recovery { background: rgba(124,45,18,0.25); color: #fdba74; }
html.dark-mode .review-flags { border-top-color: #334155; }
html.dark-mode .review-flag { background: #0f172a; border-color: #334155; }
html.dark-mode .review-flag--caution { background: rgba(124,45,18,0.22); border-color: #9a3412; }
html.dark-mode .review-flag__value, html.dark-mode .review-flag__why, html.dark-mode .review-flags__none, html.dark-mode .review-note { color: #cbd5e1; }
html.dark-mode .review-flag--caution .review-flag__value { color: #fdba74; }
html.dark-mode .review-flag__link { color: oklch(75% 0.12 155); }

.race-fit-verdict { margin: 4px 0 8px; font-size: 0.9em; color: #334155; }
.race-fit-card--warn .race-fit-verdict strong { color: #b45309; }
.race-fit-card--ok .race-fit-verdict strong { color: #15803d; }
.review-race__bar { display: block; height: 4px; margin-bottom: 8px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.review-race__bar i { display: block; height: 100%; background: #64748b; border-radius: 999px; }
html.dark-mode .race-fit-verdict { color: #cbd5e1; }
html.dark-mode .review-race__bar { background: #1e293b; }
html.dark-mode .review-race__bar i { background: #94a3b8; }

/* ── Summary detail sections ── */
.review-detail { display: grid; gap: 22px; }
.review-section__head { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid #e2e8f0; font-size: 1em; font-weight: 700; color: #0f172a; }
.review-section__badge { font-size: 0.75em; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #fff7ed; color: #9a3412; }
.review-section .summary-metrics-grid { margin-top: 0; }
.card-basis { margin: 0 0 6px; font-size: 0.74em; color: #64748b; }
.summary-section--compact { grid-column: 1 / -1; padding: 8px 14px; }
.card-compact { margin: 0; font-size: 0.88em; color: #334155; }
.card-compact__title { font-weight: 700; margin-right: 8px; color: #0f172a; }
.summary-section--flagged { border-color: #fdba74; }
.metric--flag-caution { background: rgba(255,237,213,0.55); border-radius: 4px; padding-left: 4px; }
.metric--flag-caution .metric-value { color: #c2410c; font-weight: 700; }
.metric--flag-info { background: #f1f5f9; border-radius: 4px; padding-left: 4px; }
.metric-advice--flag-info, .metric-advice--info { color: #334155; background: #f8fafc; border-color: #e2e8f0; }
.metric-advice--flag-caution { color: #9a3412; background: #fff7ed; border-color: #fdba74; }
.summary-card--hide-advice > .metric-advice--flag { display: block; }
.summary-section--pulse { box-shadow: 0 0 0 3px oklch(75% 0.12 155); transition: box-shadow 0.3s ease; }
.review-footnote { font-size: 0.85em; text-align: center; color: #64748b; margin-top: 16px; }
html.dark-mode .review-section__head { border-bottom-color: #334155; }
html.dark-mode .review-section__head, html.dark-mode .card-compact__title { color: #e2e8f0; }
html.dark-mode .review-section__badge { background: rgba(124,45,18,0.3); color: #fdba74; }
html.dark-mode .card-basis, html.dark-mode .review-footnote { color: #94a3b8; }
html.dark-mode .card-compact { color: #cbd5e1; }
html.dark-mode .summary-section--flagged { border-color: #9a3412; }
html.dark-mode .metric--flag-caution { background: rgba(154,52,18,0.22); }
html.dark-mode .metric--flag-caution .metric-value { color: #fb923c; }
html.dark-mode .metric--flag-info { background: #1e293b; }
html.dark-mode .metric-advice--flag-info, html.dark-mode .metric-advice--info { color: #cbd5e1; background: #1e293b; border-color: #334155; }
html.dark-mode .metric-advice--flag-caution { color: #fdba74; background: rgba(124,45,18,0.2); border-color: #9a3412; }

@media (max-width: 640px) {
    .review-headline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .review-headline dd { font-size: 1.15em; }
    .review-verdict { padding: 12px; }
}

.exercise-sets-table { width:100%; border-collapse:collapse; font-size:0.88em; }
                                .exercise-sets-table th { text-align:left; padding:6px 10px; border-bottom:2px solid #e2e8f0; font-weight:600; color:#64748b; font-size:0.8em; text-transform:uppercase; letter-spacing:0.04em; }
                                .exercise-sets-table td { padding:7px 10px; border-bottom:1px solid #f1f5f9; vertical-align:middle; }
                                .exercise-sets-table tr:last-child td { border-bottom:none; }
                                .exercise-sets-table tr:hover td { background:#f8fafc; }
                                .set-num { font-weight:600; color:oklch(37% 0.15 155); min-width:36px; }
                                .set-exercise { font-weight:500; overflow-wrap: break-word; }
                                .set-reps { font-variant-numeric: tabular-nums; }
                                .set-weight { color:#0f766e; font-weight:500; }
                                .set-duration { color:#64748b; font-size:0.9em; }
                                html.dark-mode .exercise-sets-table th { color:#94a3b8; border-bottom-color:#334155; }
                                html.dark-mode .exercise-sets-table td { border-bottom-color:#1e293b; }
                                html.dark-mode .exercise-sets-table tr:hover td { background:#1e293b; }

.workout-comments-section {
                    margin-top: 12px;
                    padding: 14px 16px;
                    background: var(--sidebar-bg, #fff);
                    border: 1px solid #e2e8f0;
                    border-radius: 8px;
                }
                html.dark-mode .workout-comments-section { background: #1e293b; border-color: #334155; }
                .wc-label {
                    display: block;
                    font-size: 0.9em;
                    font-weight: 700;
                    color: #374151;
                    margin-bottom: 10px;
                }
                html.dark-mode .wc-label { color: #cbd5e1; }
                .wc-thread { margin-bottom: 12px; max-height: 300px; overflow-y: auto; }
                .wc-entry {
                    padding: 10px 0;
                    border-bottom: 1px solid #f1f5f9;
                }
                .wc-entry:last-child { border-bottom: none; }
                html.dark-mode .wc-entry { border-color: #1e293b; }
                /* Pinned coach note / private note — small tinted cards above the conversation */
                .wc-entry--pinned, .wc-entry--private {
                    border: 1px solid #e2e8f0;
                    background: #f8fafc;
                    border-radius: 8px;
                    padding: 9px 12px;
                    margin-bottom: 8px;
                }
                .wc-entry--private { border-color: #ddd6fe; background: #f5f3ff; }
                html.dark-mode .wc-entry--pinned { background: #0f172a; border-color: #334155; }
                html.dark-mode .wc-entry--private { background: #1e1b4b; border-color: #4c1d95; }
                .wc-entry-header {
                    display: flex;
                    align-items: baseline;
                    gap: 10px;
                    margin-bottom: 4px;
                }
                .wc-entry-header .urc-avatar { --s: 24px; align-self: center; }
                .wc-entry-author {
                    font-size: 0.88em;
                    font-weight: 700;
                    color: #111827;
                    overflow-wrap: break-word;
                }
                html.dark-mode .wc-entry-author { color: #e2e8f0; }
                .wc-entry-date { font-size: 0.78em; color: #9ca3af; }
                .wc-inline-edit, .wc-entry-edit, .wc-entry-delete {
                    margin-left: auto;
                    border: none; background: none; padding: 0;
                    font-size: 0.78em; font-weight: 600; color: #2563eb; cursor: pointer;
                }
                .wc-inline-edit:hover, .wc-entry-edit:hover, .wc-entry-delete:hover { text-decoration: underline; }
                .wc-entry-edit + .wc-entry-delete, .wc-entry-edit ~ .wc-entry-delete { margin-left: 8px; }
                .wc-entry-delete { color: #dc2626; }
                html.dark-mode .wc-inline-edit, html.dark-mode .wc-entry-edit { color: #60a5fa; }
                .wc-entry-body {
                    font-size: 0.88em;
                    color: #374151;
                    line-height: 1.55;
                    white-space: pre-wrap;
                    overflow-wrap: anywhere;
                }
                html.dark-mode .wc-entry-body { color: #cbd5e1; }
                .wc-thread-empty { font-size: 0.83em; color: #9ca3af; padding: 6px 0 10px; }
                .wc-thread-input { min-height: 52px; }
                .wc-thread-input--coach { min-height: 150px; }
                .wc-entry-edited { font-size: 0.75em; color: #9ca3af; font-style: italic; }
                .wc-entry-edit-box { margin-top: 4px; }
                .wc-entry-edit-box .wc-textarea { min-height: 110px; }
                .wc-textarea {
                    width: 100%;
                    box-sizing: border-box;
                    padding: 10px 12px;
                    border: 1px solid #d1d5db;
                    border-radius: 7px;
                    font-size: 0.9em;
                    font-family: inherit;
                    resize: vertical;
                    min-height: 64px;
                    background: #f9fafb;
                    color: #111827;
                    transition: border-color 0.15s;
                }
                .wc-textarea:focus { outline: none; border-color: oklch(45% 0.16 155); }
                html.dark-mode .wc-textarea { background: oklch(14% 0.018 155); border-color: #475569; color: #e2e8f0; }
                html.dark-mode .wc-textarea:focus { border-color: #818cf8; }
                /* Composer + inline editor share a wrapping action row */
                .wc-composer { margin-top: 4px; }
                .wc-inline-editor { margin-top: 10px; }
                .wc-composer-row {
                    display: flex; flex-wrap: wrap; align-items: center;
                    gap: 8px 12px; margin-top: 6px;
                }
                .wc-private-toggle {
                    display: inline-flex; align-items: center; gap: 6px;
                    font-size: 0.82em; color: #475569; cursor: pointer; user-select: none;
                }
                html.dark-mode .wc-private-toggle { color: #94a3b8; }
                .wc-composer-row { flex-wrap: nowrap; gap: 6px 10px; }
                .wc-composer .wc-attach-slot, .wc-composer .msg-attach { display: contents; }
                .wc-composer .msg-attach__btn { padding: 4px 7px; white-space: nowrap; }
                .wc-composer .msg-attach__btn span { display: none; }
                .wc-composer .gc-ta-btn { display: inline-flex; align-items: center; min-width: 30px; justify-content: center; }
                .wc-composer .msg-attach__strip { order: -1; flex: 0 0 100%; }
                .wc-composer .msg-attach__strip:empty { display: none; }
                .wc-composer .msg-attach__status { order: 5; font-size: 0.75rem; }
                .wc-composer .gc-ta-btn { padding: 4px 9px; font-size: 0.8rem; white-space: nowrap; }
                .wc-composer .wc-save-btn { padding: 6px 16px; }
                .wc-composer .wc-private-toggle { white-space: nowrap; font-size: 0.8em; }
                .wc-composer-row:has(.msg-attach__strip > *) { flex-wrap: wrap; }
                .wc-counter { font-size: 0.75em; color: #9ca3af; margin-left: auto; white-space: nowrap; }
                html.dark-mode .wc-counter { color: #64748b; }
                .wc-save-status { font-size: 0.82em; color: #6b7280; }
                .wc-save-status--ok { color: #16a34a; }
                .wc-save-status--err { color: #dc2626; }
                html.dark-mode .wc-save-status { color: #94a3b8; }
                .wc-save-btn {
                    padding: 8px 18px;
                    background: oklch(45% 0.16 155);
                    color: #fff;
                    border: none;
                    border-radius: 6px;
                    font-size: 0.875em;
                    font-weight: 600;
                    cursor: pointer;
                    transition: background 0.15s;
                }
                .wc-save-btn:hover { background: #4f46e5; }
                .wc-save-btn:disabled { opacity: 0.55; cursor: default; }
                .wc-save-btn--ghost { background: none; color: #64748b; }
                .wc-save-btn--ghost:hover { background: #f1f5f9; color: #334155; }
                html.dark-mode .wc-save-btn--ghost { color: #94a3b8; }
                html.dark-mode .wc-save-btn--ghost:hover { background: #1e293b; color: #e2e8f0; }
                @media (max-width: 640px) {
                    .workout-comments-section { padding: 12px; }
                    .wc-counter { font-size: 0.7em; }
                    .wc-composer-row .wc-save-btn { flex: 1 1 auto; }
                }
/* Loading spinner animation (legacy — kept for any inline usages) */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* URC chart loader — spinning ring */
.charts-loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
}
.urc-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.urc-loader__ring {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: urc-spin 0.75s linear infinite;
}
.urc-loader__label {
    font-size: 0.82em;
    color: #9ca3af;
    letter-spacing: 0.03em;
}
@keyframes urc-spin {
    to { transform: rotate(360deg); }
}
html.dark-mode .urc-loader__ring  { border-color: #334155; border-top-color: #3b82f6; }

/* ── HR/Power zone chart boxes ── */
.chart-box--fixed { flex: 0 0 300px; height: 280px; position: relative; }
.chart-box--flex { flex: 1; min-width: 260px; height: 280px; position: relative; }

.activity-title-edit-btn,
.fuel-del-btn,
.fuel-dup-btn,
.map-overlay-header .mini-map-expand-btn,
.map-type-btn {
    touch-action: manipulation;
}

/* ── Mobile: charts shrink to fit instead of overflowing, small icon
   buttons get a bigger tap area. Untouched above 480px. ── */
@media (max-width: 480px) {
    .chart-box--fixed { flex-basis: min(300px, 100%); min-width: 0; }
    .chart-box--flex { min-width: 0; }
    .graph-section { overflow-x: auto; }

    .activity-title-edit-btn { padding: 10px !important; font-size: 1.15em !important; }
    .fuel-del-btn, .fuel-dup-btn { padding: 10px 8px; }
    .map-overlay-header .mini-map-expand-btn { padding: 9px; }
    .map-type-btn { padding: 8px 12px; }
}
html.dark-mode .urc-loader__label { color: #6b7280; }

/* Similar Routes tab — moved from an inline <style> in index.html */
.similar-routes-metric-btn { padding:5px 12px; border:1px solid #cbd5e1; border-radius:6px; background:#fff; color:#475569; cursor:pointer; font-size:0.82em; }
.similar-routes-metric-btn.active { background:#2563eb; border-color:#2563eb; color:#fff; }
.similar-routes-stats-table { width:100%; border-collapse:collapse; font-size:0.85em; }
.similar-routes-stats-table th, .similar-routes-stats-table td { padding:7px 10px; text-align:right; border-bottom:1px solid #e2e8f0; white-space:nowrap; }
.similar-routes-stats-table th:first-child, .similar-routes-stats-table td:first-child { text-align:left; }
.similar-routes-stats-table tr.similar-routes-row--current { background:#eff6ff; font-weight:600; }
.similar-routes-stats-table td:first-child a { color:#2563eb; text-decoration:none; }
.similar-routes-stats-table td:first-child a:hover { text-decoration:underline; }
.similar-routes-stats-table tbody tr:not(.similar-routes-row--current):hover { background:#f8fafc; }
.similar-routes-legend-item:hover { opacity:0.65; }
.similar-routes-stats-table tr.similar-routes-row--hover-highlight { background:#fef9c3 !important; }
.similar-routes-stats-table th.similar-routes-sortable { cursor:pointer; user-select:none; }
.similar-routes-stats-table th.similar-routes-sortable:hover { color:#2563eb; }

/* ── Workout analysis redesign (body.wa-page, tokens from tp_redesign.css) ──
   Only the analysis view gets body.rd-page.wa-page; login, 2FA and HR-zone
   views rendered by index.html keep the old look. */
.wa-page {
    --wa-pr-bg: #fff6e5;
    --wa-pr-border: #f3d29a;
    --wa-pr-ink: #8a4b00;
    --wa-caution-bg: #fff7ed;
    --wa-caution-border: #f5c79a;
    --wa-caution-ink: #9a3412;
}
html.dark-mode .wa-page {
    --wa-pr-bg: #33260f;
    --wa-pr-border: #6b4a1c;
    --wa-pr-ink: #f0c27a;
    --wa-caution-bg: #33200f;
    --wa-caution-border: #7a4320;
    --wa-caution-ink: #f3b07a;
}

.wa-page .container { padding: 0 28px 64px; }
.wa-page .container h2 { font-family: inherit; }

/* Header band */
.wa-page .wa-head {
    max-width: none; margin: 0 -28px 20px; padding: 20px 28px 16px;
    background: var(--rd-surface); border-bottom: 1px solid var(--rd-border);
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.wa-head__text { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 420px; }
.wa-eyebrow { font-size: 12px; font-weight: 600; color: var(--rd-faint); text-transform: uppercase; letter-spacing: .06em; }
.wa-title-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.wa-page .wa-title { margin: 0; font-size: 24px; line-height: 1.25; }
.wa-title--editable { cursor: pointer; }
.wa-page .wa-icon-btn {
    width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: transparent;
    color: var(--rd-faint); cursor: pointer; display: inline-grid; place-items: center;
}
.wa-page .wa-icon-btn:hover { background: var(--rd-hover); color: var(--rd-ink); }
.wa-rename { gap: 8px !important; }
.wa-page .wa-rename__input { width: 320px; max-width: 100%; height: 32px; font-size: 14px; }
.wa-rename__status { font-size: 13px; color: var(--rd-muted); }
.wa-head__meta { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; font-size: 13px; color: var(--rd-muted); }
.wa-page .wa-head .garmin-attr { font-size: 13px; font-weight: 400; color: var(--rd-muted); }
.wa-page .wa-head .garmin-attr__model { color: var(--rd-muted); }
.wa-page .viewing-as-badge { background: var(--rd-accent-soft); color: var(--rd-heading); border: 0; border-radius: 999px; }
.wa-page .review-intent { margin: 0; font-size: 13px; }
.wa-page .review-intent__label { color: var(--rd-muted); font-weight: 500; }
.wa-page .review-intent__select { height: 30px; padding: 0 8px; border: 1px solid var(--rd-input-border); border-radius: 7px; background: var(--rd-surface); color: var(--rd-ink); }
.wa-page .review-intent__select:focus { outline: none; border-color: var(--rd-accent); box-shadow: 0 0 0 3px var(--rd-accent-ring); }
.wa-page .review-intent__source,
.wa-page .review-intent__status { color: var(--rd-faint); }
.wa-head__actions { display: flex; align-items: center; gap: 8px; flex: none; }
.wa-page .activity-menu-btn { width: 32px; height: 32px; border-radius: 7px; border-color: var(--rd-input-border); background: var(--rd-surface); color: var(--rd-muted); }
.wa-page .activity-menu-btn:hover,
.wa-page .activity-menu-btn.is-active { background: var(--rd-hover); color: var(--rd-ink); }
.wa-page .activity-menu-panel { background: var(--rd-surface); border-color: var(--rd-border); box-shadow: var(--rd-shadow-pop); }
.wa-page .activity-menu-item { font-size: 13px; color: var(--rd-ink); }
.wa-page .activity-menu-item:hover { background: var(--rd-hover); }
.wa-page .activity-menu-item--danger { color: var(--rd-danger); }
.wa-page .activity-menu-item--danger:hover { background: var(--rd-danger-soft); }

/* Compact header: back link, icon tile, title/meta, plan chip, AI banner, icon tabs */
.wa-page .wa-head { padding: 12px 28px 12px; align-items: flex-end; gap: 10px 16px; margin-bottom: 12px; }
.wa-head__text { gap: 6px; }
.wa-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; color: var(--rd-accent); text-decoration: none; }
.wa-back:hover { text-decoration: underline; }
.wa-titlebox { display: flex; align-items: center; gap: 12px; min-width: 0; }
.wa-titlebox__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wa-tile { flex: none; width: 42px; height: 42px; border-radius: 11px; background: var(--rd-accent-soft); color: var(--rd-accent); display: grid; place-items: center; }
.wa-page .wa-title { font-size: 22px; line-height: 1.2; letter-spacing: -0.01em; }
.wa-page .wa-head__meta { gap: 2px 10px; }
.wa-head__when::after { content: "\00b7"; margin-left: 10px; color: var(--rd-faintest); }
.wa-head__when:last-child::after { content: none; }
.wa-plan-chip {
    height: 44px; padding: 0 12px; border: 1px solid var(--rd-accent-border); background: var(--rd-accent-soft);
    border-radius: 10px; cursor: pointer; display: flex; align-items: center; gap: 10px; text-align: left;
    color: var(--rd-ink); font: inherit; max-width: 100%;
}
.wa-plan-chip:hover { border-color: var(--rd-accent); }
.wa-plan-chip > svg { flex: none; color: #8a5a2b; }
.wa-plan-chip__text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.wa-plan-chip__text b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.wa-plan-chip__text small { font-size: 11px; color: var(--rd-muted); }
.wa-plan-chip__badge { flex: none; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #e5f4ea; color: #1e6b3a; }
.wa-plan-chip__badge--partial { background: #fdf0e0; color: #8a4b00; }
.wa-plan-chip__badge--missed { background: #fde8e6; color: #9b2c22; }
html.dark-mode .wa-plan-chip__badge { background: #12301f; color: #86d6a3; }
html.dark-mode .wa-plan-chip__badge--partial { background: #33200f; color: #f3b07a; }
html.dark-mode .wa-plan-chip__badge--missed { background: #3a1613; color: #f1a39c; }
.review-intent--tab { margin: 0 0 12px !important; }

.wa-page .quick-ai-card { margin-bottom: 12px !important; padding: 10px 14px; background: #faf9fe; border-color: #e6e1f5; border-radius: 10px; }
.wa-page .quick-ai-card .card-header { margin: 0 0 2px; padding: 0; border: 0; }
.wa-page .quick-ai-card .card-header h2 { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #6a4bc4; }
.wa-page .quick-ai-result { font-size: 13px !important; line-height: 1.5 !important; }
.wa-page .quick-ai-result.is-clamped { display: -webkit-box !important; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.quick-ai-more { border: 0; background: none; padding: 2px 0 0; font: inherit; font-size: 12px; font-weight: 600; color: #6a4bc4; cursor: pointer; }
html.dark-mode .wa-page .quick-ai-card { background: #1a1730; border-color: #3a3560; }
html.dark-mode .wa-page .quick-ai-card .card-header h2, html.dark-mode .quick-ai-more { color: #b9a6f0; }

.wa-page .tab { gap: 22px; margin-top: 0; }
.wa-page .tab button { font-size: 14px; padding: 8px 0 11px; }
.tab-ico { flex: none; }
.tab-ico--activity { color: #1d5fa7; }
.tab-ico--laps { color: #5b6675; }
.tab-ico--power { color: #f2b400; fill: #fbd34d; }
.tab-ico--routes { color: #2b7de0; }
.tab-ico--summary { color: #3b8f7a; }
.tab-ico--plan { color: #8a5a2b; }
.tab-ico--race { color: #dc2626; }
.tab-ico--fkt { height: 16px; width: auto; }
.tab-ico--yard { color: #7b61c9; }
.tab-emoji { font-size: 15px; line-height: 1; }
html.dark-mode .tab-ico--laps { color: #94a3b8; }
html.dark-mode .tab-ico--activity { color: #6aa8ee; }
html.dark-mode .tab-ico--plan { color: #c79a66; }

.wa-page .wa-hero { margin: 0 -28px 16px; padding: 0 28px; background: var(--rd-surface); border-bottom: 1px solid var(--rd-border); }
.wa-page .wa-hero .wa-head { margin: 0; padding: 12px 0 10px; background: none; border: 0; }
.wa-page .wa-hero .tab { border-bottom: 0; margin: 0; }
.wa-page .wa-hero .quick-ai-card, .wa-page .wa-hero .elev-banner, .wa-page .wa-hero .workout-pr-banner { margin: 0 0 10px !important; }
@media (max-width: 720px) { .wa-page .wa-hero { margin: 0 -16px 12px; padding: 0 16px; } .wa-page .wa-hero .wa-head { margin: 0; padding: 12px 0 8px; } }

.wa-page .wa-chartcard { background: var(--rd-surface); border: 1px solid var(--rd-border); border-radius: 14px; padding: 14px 16px 12px; }
.wa-page .wa-chartcard .metric-selector-bar { border-bottom: 0; padding-bottom: 0; margin-bottom: 8px; }
.wa-page .wa-chartcard .activity-controls-bar { padding-bottom: 10px; margin-bottom: 0; border-bottom: 1px solid var(--rd-border-soft); }
.wa-page .wa-chartcard .garmin-charts-container { border: 0; border-radius: 0; }
.wa-page .wa-chartcard .garmin-charts-readout { margin-top: 4px; }

.wa-page #SimilarRoutes.tabcontent, .wa-page #TrainingPlan.tabcontent {
    background: var(--rd-surface); border: 1px solid var(--rd-border); border-radius: 14px; padding: 18px 20px 20px;
}
.wa-page #SimilarRoutes h2 { margin-top: 0 !important; }
.wa-page #TrainingPlan .review-verdict { background: none; border: 0; border-radius: 0; padding: 0 0 16px; margin: 0 0 16px; border-bottom: 1px solid var(--rd-border-soft); }
.wa-page #TrainingPlan .review-intent--tab { margin-bottom: 14px !important; }
@media (max-width: 720px) { .wa-page #SimilarRoutes.tabcontent, .wa-page #TrainingPlan.tabcontent { padding: 14px 14px 16px; } }

.charts-hint-btn { display: none; flex: none; width: 28px; height: 28px; padding: 0; border: 0; background: none; color: var(--rd-faint); cursor: pointer; place-items: center; }
@media (max-width: 720px) {
    .wa-page .wa-chartcard { padding: 12px 12px 10px; }
    .wa-page .wa-chartcard .metric-selector-bar { flex-wrap: wrap; }
    .charts-hint-btn { display: inline-grid; order: -1; }
    .wa-page .activity-controls-bar { flex-wrap: wrap; gap: 6px; }
    .wa-page .activity-controls-bar .garmin-charts-hint { display: none; flex: 1 0 100% !important; order: 5; }
    .wa-page .activity-controls-bar .garmin-charts-hint.is-open { display: block; }
    .wa-page .activity-controls-bar .garmin-x-toggle-btn, .wa-page .activity-controls-bar .btn-reset-zoom { padding: 4px 8px; font-size: 0.8em; }
}

.chart-sheet-open, .chart-sheet-backdrop, .chart-sheet-grip, .chart-sheet-title, .chart-sheet-save { display: none; }

/* Phone layout: slim top bar (back, title, menu), full-width tab strip, then meta, plan chip and AI on the page */
@media (max-width: 720px) {
    .wa-page .wa-hero { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; margin: 0 -16px 12px; padding: 0; background: none; border: 0; position: relative; }
    .wa-page .wa-hero::before { content: ""; grid-column: 1 / -1; grid-row: 1; background: var(--rd-surface); border-bottom: 1px solid var(--rd-border); }
    .wa-page .wa-hero .wa-head, .wa-head__text, .wa-titlebox, .wa-titlebox__body, .wa-head__actions { display: contents; }
    .wa-page .wa-hero .wa-back { grid-column: 1; grid-row: 1; z-index: 1; width: 44px; height: 52px; justify-content: center; font-size: 0; align-self: center; color: var(--rd-accent); }
    .wa-page .wa-hero .wa-back svg { width: 20px; height: 20px; }
    .wa-tile { display: none; }
    .wa-page .wa-hero .wa-title-row { grid-column: 2; grid-row: 1; z-index: 1; flex-wrap: nowrap; align-self: center; }
    .wa-page .wa-hero .wa-title { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
    .wa-page .wa-hero .wa-rename { grid-column: 1 / -1; grid-row: 3; padding: 10px 16px 0; flex-wrap: wrap; }
    .wa-page .wa-hero .activity-menu { grid-column: 3; grid-row: 1; z-index: 2; align-self: center; justify-self: center; }
    .wa-page .wa-hero .tab { grid-column: 1 / -1; grid-row: 2; position: sticky; top: 52px; z-index: 20; padding: 0 16px; background: var(--rd-surface); border-bottom: 1px solid var(--rd-border); gap: 22px; }
    .wa-page .wa-hero .tab button { height: 44px; padding: 0; box-sizing: border-box; }
    .wa-page .wa-hero .wa-head__meta { grid-column: 1 / -1; grid-row: 4; padding: 12px 16px 0; font-size: 13px; }
    .wa-page .wa-hero .wa-plan-chip { grid-column: 1 / -1; grid-row: 5; margin: 10px 12px 0; height: auto; min-height: 52px; padding: 8px 12px; border-radius: 12px; width: auto; }
    .wa-page .wa-hero .wa-plan-chip::after { content: "\203A"; font-size: 22px; line-height: 1; color: var(--rd-faint); }
    .wa-plan-chip__text { flex: 1; }
    .wa-plan-chip__text b { max-width: none; font-size: 14px; }
    .wa-page .wa-hero .quick-ai-card, .wa-page .wa-hero .elev-banner, .wa-page .wa-hero .workout-pr-banner { grid-column: 1 / -1; margin: 12px 12px 0 !important; }
    .wa-page .wa-hero .quick-ai-card { padding: 12px 14px; border-radius: 12px; }
    .wa-page .wa-hero .quick-ai-result { font-size: 14px !important; }

    .wa-page .wa-chartcard .metric-selector-bar { flex-wrap: nowrap; gap: 6px; }
    .wa-page .wa-chartcard .metric-chip-save, .charts-hint-btn { display: none !important; }
    .chart-sheet-open { display: inline-grid; flex: none; width: 44px; height: 44px; padding: 0; border: 0; background: none; color: var(--rd-muted); cursor: pointer; place-items: center; border-radius: 10px; }
    .chart-sheet-backdrop { position: fixed; inset: 0; z-index: 400; background: rgba(27, 36, 48, .4); }
    .chart-sheet-backdrop:not(.is-open) { display: none; }
    .wa-page .wa-chartcard .activity-controls-bar#chartSheet {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 401; margin: 0; padding: 8px 16px 24px;
        background: var(--rd-surface); border-radius: 16px 16px 0 0; border: 0; box-shadow: 0 -8px 32px rgba(27, 36, 48, .18);
        flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 12px; transform: translateY(105%); visibility: hidden; transition: transform .2s ease, visibility .2s;
    }
    .wa-page .wa-chartcard .activity-controls-bar#chartSheet.is-open { transform: none; visibility: visible; }
    .chart-sheet-grip { display: block; align-self: center; width: 36px; height: 4px; border-radius: 2px; background: var(--rd-border); }
    .chart-sheet-title { display: block; margin: 0; font-size: 17px; font-weight: 700; color: var(--rd-heading); }
    #chartSheet .garmin-charts-hint { display: block !important; order: 9; flex: none !important; font-size: 12px !important; }
    #chartSheet .garmin-x-toggle { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
    #chartSheet #garminShowStopsWrap { grid-template-columns: 1fr; }
    #chartSheet .garmin-x-toggle-btn { height: 40px; font-size: 14px !important; padding: 0 8px !important; }
    #chartSheet .btn-reset-zoom { height: 44px; font-size: 14px !important; }
    .chart-sheet-save { display: block; height: 48px; border: 1px solid var(--rd-input-border); background: var(--rd-surface); border-radius: 10px; color: var(--rd-ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
}

.wa-page .ra-subpanel:not([hidden]) { background: var(--rd-surface); border: 1px solid var(--rd-border); border-top: 0; border-radius: 0 0 14px 14px; padding: 18px 20px 20px; margin-top: 0; }
.wa-page .tabcontent .ra-subtabs { display: flex; margin: 12px 0 0; padding: 0 10px; background: var(--rd-surface); border: 1px solid var(--rd-border); border-bottom-color: var(--rd-border-soft); border-radius: 14px 14px 0 0; gap: 4px; }
.wa-page .tabcontent .ra-subtab { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 12px 12px 10px; font-size: 14px; font-weight: 500; color: var(--rd-muted); }
.wa-page .tabcontent .ra-subtab:hover:not(.is-active) { background: none; color: var(--rd-ink); }
.wa-page .tabcontent .ra-subtab.is-active { background: none; color: var(--rd-heading); font-weight: 600; border-bottom-color: var(--rd-accent); }
.wa-page .ra-subpanel .race-analysis-stat { background: var(--rd-surface-2); }
@media (max-width: 720px) { .wa-page .ra-subpanel:not([hidden]) { padding: 14px 14px 16px; } }

/* Banners */
.wa-page .workout-pr-banner { background: var(--wa-pr-bg); border-color: var(--wa-pr-border); border-radius: 10px; font-size: 14px; padding: 10px 16px; }
.wa-page .workout-pr-banner__text { color: var(--wa-pr-ink); }
.wa-page .workout-pr-banner__link { color: var(--wa-pr-ink); }
.wa-page .elev-banner { background: var(--rd-accent-soft); border-color: var(--rd-accent-border); border-radius: 10px; font-size: 14px; }
.wa-page .elev-banner__text { color: var(--rd-heading); }
.wa-page .elev-banner__btn { background: var(--rd-accent); border-color: var(--rd-accent); border-radius: 7px; }
.wa-page .elev-banner__btn:hover { background: var(--rd-accent-hover); }

/* Cards */
.wa-page .summary-section,
.wa-page .review-verdict,
.wa-page .workout-comments-section,
.wa-page .graph-section,
.wa-page .map-section {
    background: var(--rd-surface); border: 1px solid var(--rd-border); border-radius: 12px; box-shadow: none; color: var(--rd-ink);
}
.wa-page .summary-section { padding: 14px 16px; }
.wa-page .summary-section h2,
html.dark-mode .wa-page .summary-section h2 {
    border-bottom: 0; padding-bottom: 0; margin-bottom: 6px; font-size: 15px; font-weight: 600; letter-spacing: 0; color: var(--rd-heading);
}
html.dark-mode .wa-page .container h2,
html.dark-mode .wa-page .container h3 { color: var(--rd-heading); }
.wa-page .summary-section--flagged { border-color: var(--wa-caution-border); }
.wa-page .quick-ai-card { padding: 16px 20px; }
.wa-page .quick-ai-result { color: var(--rd-ink-2); line-height: 1.55; }

.wa-page .review-verdict { margin: 0 0 16px; padding: 16px 20px 14px; }
.wa-page .review-verdict__line { color: var(--rd-ink); font-size: 14px; }
.wa-page .review-verdict__k { color: var(--rd-muted); font-weight: 600; }
.wa-page .review-verdict__sep { color: var(--rd-faintest); }
.wa-page .review-headline dt { font-size: 11px; color: var(--rd-faint); }
.wa-page .review-headline dd { color: var(--rd-heading); font-size: 22px; }
.wa-page .review-flags { border-top-color: var(--rd-border-soft); }
.wa-page .review-flags__title { font-size: 11px; color: var(--rd-faint); }
.wa-page .review-flag { background: var(--rd-surface); border-color: var(--rd-border); border-radius: 8px; }
.wa-page .review-flag--caution { background: var(--wa-caution-bg); border-color: var(--wa-caution-border); }
.wa-page .review-flag__head { color: var(--rd-ink); }
.wa-page .review-flag--caution .review-flag__value { color: var(--wa-caution-ink); }
.wa-page .review-flag__why { color: var(--rd-ink-2); }
.wa-page .review-flag__link { color: var(--rd-accent); }
.wa-page .review-recovery { background: var(--wa-caution-bg); color: var(--wa-caution-ink); }
.wa-page .review-race__bar { background: var(--rd-border-soft); }
.wa-page .review-race__bar i { background: var(--rd-accent); }
.wa-page .review-section__head { color: var(--rd-heading); border-bottom-color: var(--rd-border); font-size: 15px; font-weight: 600; }
.wa-page .review-section__badge { background: var(--wa-caution-bg); color: var(--wa-caution-ink); }
.wa-page .metric-advice--flag-caution { background: var(--wa-caution-bg); border-color: var(--wa-caution-border); color: var(--wa-caution-ink); }
.wa-page .summary-section--pulse { box-shadow: 0 0 0 3px var(--rd-accent-ring); }

/* Tabs: underline style like the Training Programs tabs */
.wa-page .tab {
    display: flex; gap: 24px; overflow-x: auto; scrollbar-width: none; margin-top: 8px;
    background: transparent; border: 0; border-bottom: 1px solid var(--rd-border); border-radius: 0;
}
.wa-page .tab button {
    float: none; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    padding: 10px 0 12px; background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
    font-size: 15px; font-weight: 500; color: var(--rd-muted); transition: color .12s, border-color .12s;
}
.wa-page .tab button:hover { background: none; color: var(--rd-ink); }
.wa-page .tab button.active { background: none; color: var(--rd-heading); font-weight: 600; border-bottom-color: var(--rd-accent); }
html.dark-mode .wa-page .tab,
html.dark-mode .wa-page .tab button { background: none; }
html.dark-mode .wa-page .tab button.active { color: var(--rd-heading); }
.wa-page .tabcontent { padding: 16px 0 0; color: var(--rd-ink); }

.wa-page .graph-section h2,
html.dark-mode .wa-page .graph-section h2 { margin: 0 0 10px; font-size: 16px; font-weight: 600; color: var(--rd-heading); }
.wa-page .summary-view-toggle { background: var(--rd-surface-2); color: var(--rd-muted); border-radius: 8px; }
.wa-page .summary-view-toggle-btn { background: var(--rd-surface); border-color: var(--rd-input-border); color: var(--rd-ink); }
.wa-page .summary-view-toggle-btn:hover { background: var(--rd-hover); }
.wa-page .tabcontent .summary-view-toggle-btn.is-active { background: var(--rd-accent); border-color: var(--rd-accent); color: #fff; }

/* Controls that used the old green accent */
.wa-page .tabcontent .map-type-btn.is-active { background: var(--rd-accent); color: #fff; }
.wa-page .strength-stat-tile { background: var(--rd-surface-2); }
.wa-page .strength-stat-value { color: var(--rd-heading); }
.wa-page .set-num { color: var(--rd-heading); }
.wa-page .wc-label { color: var(--rd-ink); font-size: 14px; font-weight: 600; }
.wa-page .wc-textarea { background: var(--rd-surface); border-color: var(--rd-input-border); color: var(--rd-ink); border-radius: 8px; }
.wa-page .wc-textarea:focus { border-color: var(--rd-accent); box-shadow: 0 0 0 3px var(--rd-accent-ring); }
.wa-page .wc-save-btn { background: var(--rd-accent); border-radius: 7px; }
.wa-page .wc-save-btn:hover { background: var(--rd-accent-hover); }
.wa-page .wc-save-btn--ghost { background: none; color: var(--rd-muted); }
.wa-page .wc-save-btn--ghost:hover { background: var(--rd-hover); color: var(--rd-ink); }
.wa-page .similar-routes-metric-btn { background: var(--rd-surface); border-color: var(--rd-input-border); color: var(--rd-ink); }
.wa-page .similar-routes-metric-btn.active { background: var(--rd-accent); border-color: var(--rd-accent); color: #fff; }

@media (max-width: 720px) {
    .wa-page .container { padding: 0 16px 48px; }
    .wa-page .wa-head { margin: 0 -16px 12px; padding: 12px 16px; }
    .wa-page .wa-title { font-size: 19px; }
    .wa-tile { width: 36px; height: 36px; border-radius: 9px; }
    .wa-head__actions { width: 100%; flex-wrap: wrap; }
    .wa-plan-chip { flex: 1 1 auto; min-width: 0; }
    .wa-plan-chip__text b { max-width: 150px; }
    .wa-page .tab { gap: 18px; }
    .wa-page .tab button { font-size: 14px; }
}

/* ── Tab contents: Mile Splits, Race Analysis, Fuel Log, Power, Summary ──
   Prefixed with .tabcontent so these beat the html.dark-mode rules in style.css. */
.wa-page :focus-visible { outline-color: var(--rd-accent); }

/* Race Analysis outer tab: keep the red "this was a race" cue, drop the red slab */
.wa-page .tab #raceAnalysisTabBtn,
html.dark-mode .wa-page .tab #raceAnalysisTabBtn { color: var(--rd-danger); font-weight: 600; background: none; }
.wa-page .tab #raceAnalysisTabBtn:hover,
html.dark-mode .wa-page .tab #raceAnalysisTabBtn:hover { background: none; color: var(--rd-danger); }
.wa-page .tab #raceAnalysisTabBtn.active,
html.dark-mode .wa-page .tab #raceAnalysisTabBtn.active { background: none; color: var(--rd-danger); border-bottom-color: var(--rd-danger); }
.wa-page .tab #raceAnalysisTabBtn.active .wc-tab-dot { background: var(--rd-danger); }
.wa-page .tab .wc-tab-dot { top: 6px; right: -9px; }

/* Shared table look (Mile Splits, Race Analysis) */
.wa-page .tabcontent .splits-table,
.wa-page .tabcontent .race-analysis-table { margin-top: 8px; box-shadow: none; font-size: 13px; font-variant-numeric: tabular-nums; }
.wa-page .tabcontent .splits-table th,
.wa-page .tabcontent .race-analysis-table th {
    background: var(--rd-surface-2); color: var(--rd-muted); font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--rd-border); padding: 9px 12px;
}
.wa-page .tabcontent .splits-table td,
.wa-page .tabcontent .race-analysis-table td { color: var(--rd-ink); border-bottom: 1px solid var(--rd-border-soft); padding: 9px 12px; }
.wa-page .tabcontent .splits-table tr:nth-child(even) { background: transparent; }
.wa-page .tabcontent .splits-table tbody tr:hover,
.wa-page .tabcontent .race-analysis-table tbody tr:hover { background: var(--rd-hover); }
.wa-page .tabcontent .splits-table td.split-best { background: var(--rd-accent-soft); color: var(--rd-heading); }
.wa-page .tabcontent .splits-table td.split-warn { background: var(--wa-caution-bg); color: var(--wa-caution-ink); }
.wa-page .tabcontent .splits-table-container { border: 1px solid var(--rd-border); border-radius: 10px; }
.wa-page .tabcontent .splits-table-container .splits-table { margin-top: 0; }
.wa-page .tabcontent .race-analysis-row--flag td { background: var(--rd-danger-soft); }

/* Laps: save bar under the activity charts + Laps tab */
.lap-save-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 10px; padding: 12px 16px; background: var(--rd-surface-2); border: 1px solid var(--rd-border); border-radius: 10px; }
.lap-save-stats { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; flex: 1; min-width: 0; }
.lap-stat { display: flex; flex-direction: column; gap: 2px; }
.lap-stat__label { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--rd-muted); }
.lap-stat__value { font-size: 14px; font-weight: 600; color: var(--rd-heading); font-variant-numeric: tabular-nums; }
.lap-stat__value small { font-size: 11px; font-weight: 400; color: var(--rd-muted); }
.lap-zone-select { position: absolute; pointer-events: none; background: rgba(0,123,255,0.12); border: 1px solid rgba(0,123,255,0.4); }
.chart-box--flex canvas { cursor: crosshair; }
.lap-saved-note { font-size: 13px; font-weight: 600; color: var(--rd-accent); }
.lap-save-form { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.lap-name-field { display: flex; flex-direction: column; gap: 3px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--rd-muted); }
.lap-name-field input { min-width: 220px; padding: 7px 10px; font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--rd-ink); background: var(--rd-surface); border: 1px solid var(--rd-border); border-radius: 6px; }
.lap-name-field input:focus { outline: 2px solid var(--rd-accent); outline-offset: 0; }
.lap-btn { padding: 7px 16px; font-size: 13px; font-weight: 500; color: var(--rd-ink); background: var(--rd-surface); border: 1px solid var(--rd-border); border-radius: 999px; cursor: pointer; }
.lap-btn:hover { background: var(--rd-hover); }
.lap-btn:disabled { opacity: .6; cursor: default; }
.lap-btn--primary { background: var(--rd-heading); border-color: var(--rd-heading); color: var(--rd-surface); }
.lap-btn--primary:hover { background: var(--rd-heading); opacity: .88; }
.lap-btn--small { padding: 4px 12px; font-size: 12px; }
.lap-btn--danger { color: var(--rd-danger); }

.wa-page .tabcontent .laps-section-title { margin: 22px 0 8px; font-size: 15px; font-weight: 700; color: var(--rd-heading); }
.laps-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#autoLapsTable tbody tr { cursor: pointer; }
.wa-page .tabcontent #autoLapsTable tbody tr.is-selected td { background: var(--rd-accent-soft); }
.my-lap { cursor: pointer; }
.my-lap.is-selected { background: var(--rd-accent-soft); }
.laps-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 16px; }
.laps-hint--lead { flex: 1 1 320px; margin: 0; }
.laps-controls { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.laps-seg-group { display: flex; align-items: center; gap: 8px; }
.laps-seg { display: flex; gap: 2px; padding: 2px; background: var(--rd-surface-2); border-radius: 7px; }
.laps-seg-btn { border: 0; font: inherit; font-size: 13px; font-weight: 500; padding: 5px 12px; border-radius: 5px; cursor: pointer; background: transparent; color: var(--rd-muted); }
.laps-seg-btn.is-active { background: var(--rd-surface); color: var(--rd-heading); box-shadow: 0 1px 2px rgba(20, 25, 35, .14); }
.laps-summary, .laps-verdicts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 18px; }
.laps-verdicts { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 14px; }
.laps-summary:empty, .laps-verdicts:empty { display: none; }
.laps-summary-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--rd-border); border-radius: 8px; background: var(--rd-surface); }
.laps-verdicts .laps-summary-card { background: var(--rd-surface-2); border-color: transparent; }
.laps-summary-card__headline { font-size: 17px; font-weight: 600; }
.laps-summary-card__detail { font-size: 13px; color: var(--rd-muted); }
.laps-ribbon-wrap { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.laps-ribbon-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.laps-ribbon-title { font-size: 13px; font-weight: 600; color: var(--rd-heading); }
.laps-legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--rd-muted); }
.laps-legend-chips { display: flex; gap: 2px; }
.laps-legend-chips i { display: block; width: 22px; height: 10px; border-radius: 2px; }
.laps-ribbon { display: flex; gap: 4px; min-height: 74px; overflow-x: auto; padding-bottom: 6px; }
.laps-ribbon.is-scroll { scrollbar-width: thin; }
.laps-block { min-width: 64px; padding: 10px 12px; border-radius: 6px; outline: 2px solid transparent; outline-offset: -2px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; justify-content: center; }
.laps-block.is-selected { outline-color: var(--rd-heading); }
.laps-block__top { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--rd-muted); }
.laps-block__value { white-space: nowrap; font-size: 16px; font-weight: 600; color: var(--rd-heading); font-variant-numeric: tabular-nums; }
.laps-block__delta { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lap-trend { display: flex; align-items: center; gap: 10px; }
.lap-trend__bar { position: relative; display: block; width: 96px; height: 12px; background: var(--rd-surface-2); border-radius: 3px; }
.lap-trend__mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--rd-border); }
.lap-trend__fill { position: absolute; top: 2px; bottom: 2px; border-radius: 2px; }
.lap-trend__delta { min-width: 46px; font-weight: 600; }
.laps-th { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.laps-th__name { color: var(--rd-heading); }
.laps-ref-badge { padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--rd-surface); background: var(--rd-heading); }
.laps-set-ref { font: inherit; font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--rd-accent); background: transparent; border: 1px solid var(--rd-border); border-radius: 4px; padding: 2px 7px; cursor: pointer; }
.laps-cell-value { display: inline-block; min-width: 84px; }
.laps-pill { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.laps-hint, .laps-empty { margin: 0 0 10px; font-size: 13px; color: var(--rd-muted); }
.laps-check-col { width: 36px; text-align: center; }
.my-laps-list { border: 1px solid var(--rd-border); border-radius: 10px; }
.my-laps-list .laps-empty { margin: 0; padding: 14px 16px; }
.my-lap { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--rd-border-soft); font-size: 13px; }
.my-lap:last-child { border-bottom: 0; }
.my-lap__main { display: flex; align-items: center; gap: 10px; flex: 0 1 260px; min-width: 0; cursor: pointer; }
.my-lap__name { font-weight: 600; color: var(--rd-heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-lap__rename { padding: 4px 8px; font-size: 13px; min-width: 160px; color: var(--rd-ink); background: var(--rd-surface); border: 1px solid var(--rd-border); border-radius: 6px; }
.my-lap__meta { flex: 1; color: var(--rd-muted); font-variant-numeric: tabular-nums; }
.my-lap__actions { display: flex; gap: 6px; }

.laps-compare { margin-bottom: 8px; padding: 14px 16px; background: var(--rd-surface); border: 1px solid var(--rd-border); border-radius: 10px; }
.laps-chart-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.laps-chart-title { font-weight: 700; color: var(--rd-heading); flex: 1; }
.laps-overlay-toggles { display: flex; align-items: center; gap: 6px; }
.laps-overlay-label { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--rd-muted); }
.laps-chip { padding: 4px 12px; font-size: 12px; color: var(--rd-muted); background: var(--rd-surface); border: 1px solid var(--rd-border); border-radius: 999px; cursor: pointer; }
.laps-chip[aria-pressed="true"] { color: var(--rd-heading); border-color: var(--rd-heading); font-weight: 600; }
.laps-chart-wrap { width: 100%; margin-bottom: 12px; }
.laps-chart-wrap canvas { display: block; max-width: 100%; }
.laps-col-sub { font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--rd-muted); }
.wa-page .tabcontent .splits-table td small { font-size: 11px; color: var(--rd-muted); }
@media (max-width: 640px) {
    .my-lap { flex-wrap: wrap; }
    .my-lap__main { flex-basis: 100%; }
    .lap-name-field input { min-width: 0; width: 100%; }
}

/* Race Analysis */
.wa-race-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.wa-page .tabcontent .wa-race-head__title { margin: 0; font-size: 20px; font-weight: 700; color: var(--rd-heading); }
.wa-race-head__date { font-size: 13px; color: var(--rd-muted); font-variant-numeric: tabular-nums; }
.wa-race-head__refresh { margin-left: auto; }
.wa-page .tabcontent .race-analysis-stats-row { gap: 12px; }
.wa-page .tabcontent .race-analysis-stat { background: var(--rd-surface); border: 1px solid var(--rd-border); border-radius: 12px; padding: 12px 14px; }
.wa-page .tabcontent .race-analysis-stat__label { font-size: 11px; color: var(--rd-faint); letter-spacing: .04em; }
.wa-page .tabcontent .race-analysis-stat__value { font-size: 22px; color: var(--rd-heading); font-variant-numeric: tabular-nums; }
.wa-page .tabcontent .race-analysis-stat__sub { font-size: 12px; color: var(--rd-muted); }
.wa-page .tabcontent .race-analysis-map { border: 1px solid var(--rd-border); border-radius: 12px; background: var(--rd-surface-2); }
.wa-page .tabcontent .race-analysis-subhead { font-size: 15px; font-weight: 600; color: var(--rd-heading); }
.wa-page .tabcontent .race-analysis-callout { background: var(--wa-caution-bg); border-color: var(--wa-caution-border); color: var(--rd-ink); border-radius: 10px; font-size: 13px; }
.wa-page .tabcontent .race-analysis-bar-row:hover { background: var(--rd-hover); }
.wa-page .tabcontent .race-analysis-bar-row__track { background: var(--rd-border-soft); }
.wa-page .tabcontent .ra-stop-btn { background: var(--rd-surface); border-color: var(--rd-input-border); color: var(--rd-ink); border-radius: 6px; }
.wa-page .tabcontent .ra-stop-btn:hover { border-color: var(--rd-accent); color: var(--rd-accent); }

/* Execution score: red/amber/green bands stay, they carry the score meaning */
.wa-page .tabcontent .res-ring { width: 108px; height: 108px; border-width: 6px; }
.wa-page .tabcontent .res-comp-lbl { color: var(--rd-ink); font-size: 13px; font-weight: 600; }
.wa-page .tabcontent .res-comp-wt { color: var(--rd-faint); font-weight: 500; }
.wa-page .tabcontent .res-bar-track { background: var(--rd-border-soft); height: 8px; }
.wa-page .tabcontent .res-comp-val { color: var(--rd-ink); font-weight: 700; }
.wa-page .tabcontent .res-comp-detail,
.wa-page .tabcontent .res-meta { color: var(--rd-muted); }
.wa-page .tabcontent .res-difficulty { color: var(--rd-ok-ink); }
.wa-page .tabcontent .res-method { color: var(--rd-ink-2); }
.wa-page .tabcontent .res-method > summary { color: var(--rd-accent); }

/* Activity sidebar feel / RPE widget, info icons */
.wa-page .tabcontent .info-icon { border-color: var(--rd-accent); color: var(--rd-accent); background: var(--rd-surface); }
.wa-page .tabcontent .feel-face--active { background: var(--rd-accent-soft); border-color: var(--rd-accent); }
.wa-page .tabcontent .feel-face--active .feel-face-label { color: var(--rd-heading); }
.wa-page .tabcontent .rpe-slider::-webkit-slider-thumb { border-color: var(--rd-accent); }
.wa-page .tabcontent .rpe-slider::-moz-range-thumb { border-color: var(--rd-accent); }
.wa-page .tabcontent .metric-chip-save { background: var(--rd-surface); border-color: var(--rd-input-border); color: var(--rd-ink); }
.wa-page .tabcontent .metric-chip-save:hover { background: var(--rd-hover); }

/* Power */
.wa-page .tabcontent .pdc-metrics-bar,
.wa-page .tabcontent .pdc-insights { background: var(--rd-surface-2); border-color: var(--rd-border); }
.wa-page .tabcontent .pdc-metric__val { color: var(--rd-heading); }

/* Fuel Log */
.wa-page .tabcontent .fuel-tip { background: var(--rd-accent-soft); border-color: var(--rd-accent-border); color: var(--rd-heading); }
.wa-page .tabcontent .fuel-deficit-fill { background: var(--rd-accent); }
.wa-page .tabcontent .fuel-cat-tab.is-active,
.wa-page .tabcontent .fuel-dc-btn.is-active { background: var(--rd-accent); border-color: var(--rd-accent); color: #fff; }
.wa-page .tabcontent .fuel-scan-quick-btn,
.wa-page .tabcontent .fuel-save-btn,
.wa-page .tabcontent .fuel-modal-add { background: var(--rd-accent); color: #fff; border-radius: 8px; }
.wa-page .tabcontent .fuel-scan-quick-btn:hover,
.wa-page .tabcontent .fuel-save-btn:hover,
.wa-page .tabcontent .fuel-modal-add:hover { background: var(--rd-accent-hover); }
.wa-page .tabcontent .fuel-scan-drop,
.wa-page .tabcontent .fuel-scan-btn { border-color: var(--rd-accent); background: var(--rd-accent-soft); color: var(--rd-heading); }
.wa-page .tabcontent .fuel-scan-drop:hover,
.wa-page .tabcontent .fuel-scan-drop.is-dragover,
.wa-page .tabcontent .fuel-scan-btn:hover { background: var(--rd-accent-row); }
.wa-page .tabcontent .fuel-food-chip:hover { border-color: var(--rd-accent); background: var(--rd-accent-soft); }
.wa-page .tabcontent .fuel-dup-btn:hover { color: var(--rd-accent); }
.wa-page .tabcontent .fuel-add-custom-btn:hover { border-color: var(--rd-accent); color: var(--rd-accent); }
.wa-page .tabcontent .fuel-scan-overlay-title { color: var(--rd-heading); }
.wa-page .premium-lock-banner__cta { background: var(--rd-accent); }
.wa-page .premium-lock-banner__cta:hover { background: var(--rd-accent-hover); }
.wa-page .activity-metrics-zoomed-badge { background: var(--rd-accent); }
.wa-page .elev-chart .elev-line--terrain { stroke: var(--rd-accent); }
.wa-page .elev-swatch--terrain { border-color: var(--rd-accent); }
html.dark-mode .wa-page .activity-title-input,
html.dark-mode .wa-page .wc-textarea { background: var(--rd-surface); border-color: var(--rd-input-border); color: var(--rd-ink); }
.wa-page .fuel-modal-add { background: var(--rd-accent); }
.wa-page .fuel-modal-add:hover { background: var(--rd-accent-hover); }
.wa-page .fuel-scan-spinner { border-top-color: var(--rd-accent); }
.wa-page .fuel-scan-overlay-title { color: var(--rd-heading); }

/* ── Login + two-factor screens (body.rd-page.ix-auth, tokens from tp_redesign.css) ── */
body.ix-auth { background: var(--rd-bg); font-family: 'IBM Plex Sans', Helvetica, Arial, sans-serif; color: var(--rd-ink); -webkit-font-smoothing: antialiased; }
body.ix-auth .container { background: none; overflow: visible; box-shadow: none; padding: 0; }
body.ix-auth .login-form {
    background: var(--rd-surface); border: 1px solid var(--rd-border); border-radius: 12px; box-shadow: var(--rd-shadow-pop);
    padding: 32px; gap: 18px; color: var(--rd-ink);
}
body.ix-auth .login-form :is(input, button) { font-family: inherit; }
body.ix-auth .login-form h2,
html.dark-mode body.ix-auth .login-form h2 { color: var(--rd-heading); font-size: 20px; font-weight: 600; margin: 4px 0 0; }
body.ix-auth .login-form label { font-size: 13px; font-weight: 500; color: var(--rd-ink-2); }
body.ix-auth .login-form input[type="text"],
body.ix-auth .login-form input[type="password"],
html.dark-mode body.ix-auth .login-form input { height: 40px; box-sizing: border-box; padding: 0 12px; border: 1px solid var(--rd-input-border); border-radius: 8px; font-size: 15px; background: var(--rd-surface); color: var(--rd-ink); }
body.ix-auth .login-form input:focus { outline: none; border-color: var(--rd-accent); box-shadow: 0 0 0 3px var(--rd-accent-ring); }
body.ix-auth .login-form button[type="submit"] { height: 40px; padding: 0; border-radius: 8px; background: var(--rd-accent); font-size: 15px; font-weight: 600; }
body.ix-auth .login-form button[type="submit"]:hover { background: var(--rd-accent-hover); }
body.ix-auth .login-form a { transition: color .12s; }
body.ix-auth .login-form a[href="/auth/google/login"] { height: 40px; padding: 0 16px; border-color: var(--rd-input-border); background: var(--rd-surface); color: var(--rd-ink); font-weight: 500; }
body.ix-auth .login-form a[href="/auth/google/login"]:hover { border-color: var(--rd-accent); }
body.ix-auth .login-form a[href="/auth/facebook/login"] { height: 40px; padding: 0 16px; border-color: var(--rd-input-border); background: var(--rd-surface); color: var(--rd-ink); font-weight: 500; }
body.ix-auth .login-form a[href="/auth/facebook/login"]:hover { border-color: var(--rd-accent); }
body.ix-auth .ix-link { color: var(--rd-accent); text-decoration: none; }
body.ix-auth .ix-link:hover { text-decoration: underline; }
body.ix-auth .ix-link--strong { font-weight: 600; }
body.ix-auth .ix-notice { padding: 10px 14px; margin-bottom: 4px; border-radius: 8px; font-size: 14px; background: var(--rd-accent-soft); color: var(--rd-heading); border: 1px solid var(--rd-accent-border); }
body.ix-auth .ix-notice--err { background: var(--rd-danger-soft); color: var(--rd-danger); border-color: var(--rd-danger-border); }
body.ix-auth .login-form p { color: var(--rd-muted) !important; }
body.has-site-bg .login-form { box-shadow: 0 24px 64px oklch(0% 0 0 / .32); }
body.has-site-bg.login-page { padding: 24px 16px; box-sizing: border-box; }

/* Race Analysis: backyard yards */
.by-chart-wrap { position: relative; height: 260px; margin: 8px 0 14px; }
.by-goals { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 4px; }
.by-chip { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 9px; font-size: 11px; font-weight: 700; }
.by-goals .by-chip { margin-left: 0; padding: 3px 10px; }
.by-chip--ok { background: oklch(93% 0.05 155); color: oklch(33% 0.1 155); }
.by-chip--spare { background: oklch(92% 0.08 85); color: oklch(38% 0.08 70); }
.by-chip--red, .by-chip--over, .by-chip--incomplete { background: oklch(92% 0.05 25); color: oklch(42% 0.17 27); }
html.dark-mode .by-chip--ok { background: oklch(28% 0.06 155); color: oklch(82% 0.1 155); }
html.dark-mode .by-chip--spare { background: oklch(30% 0.06 80); color: oklch(88% 0.09 85); }
html.dark-mode .by-chip--red, html.dark-mode .by-chip--over, html.dark-mode .by-chip--incomplete { background: oklch(30% 0.08 25); color: oklch(85% 0.1 25); }
.by-goal { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 9px; font-size: 10px; font-weight: 800; background: var(--rd-accent, #16a34a); color: #fff; vertical-align: middle; }
.by-key-tag { display: block; font-size: 11px; font-weight: 600; color: var(--rd-muted, #64748b); white-space: normal; }
.by-ra-row--red td:nth-child(3), .by-ra-row--over td:nth-child(3) { font-weight: 700; }

.ra-lps-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 12px; margin: 0 0 12px; border: 1px solid var(--rd-border, #e2e8f0); border-radius: 10px; background: var(--rd-surface-2, #f8fafc); font-size: 13px; }
.ra-lps-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.ra-lps-toggle span, .ra-lps-note { color: var(--rd-muted, #64748b); font-size: 12px; }
.ra-lps-fields { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.ra-lps-fields label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.ra-lps-fields input { width: 84px; padding: 5px 7px; border: 1px solid var(--rd-border, #cbd5e1); border-radius: 6px; font-size: 12px; background: var(--rd-surface, #fff); color: var(--rd-ink, inherit); }
.ra-lps-fields[hidden], .ra-lps-fields input[hidden], .ra-lps-fields label[hidden] { display: none; }
.ra-lps-fields input[type="checkbox"] { width: 16px; height: 16px; }
@media (max-width: 600px) {
    .ra-lps-fields { width: 100%; }
    .ra-lps-fields label { flex: 1 1 calc(50% - 14px); min-width: 0; }
    .ra-lps-fields label.ra-wide { flex-basis: 100%; }
    .ra-lps-fields input:not([type="checkbox"]) { flex: 1 1 auto; width: auto; min-width: 0; }
    .ra-lps-fields select { flex: 0 0 auto; }
}

/* Race Analysis: fixed-time races */
.by-chart-wrap.tr-chart--short { height: 200px; }
.tr-milestones { display: flex; flex-wrap: wrap; gap: 8px; }
.tr-milestones .by-chip { margin-left: 0; padding: 3px 10px; font-variant-numeric: tabular-nums; }
.tr-lap-table-wrap { max-height: 420px; overflow: auto; }
.tr-lap-table-wrap thead th { position: sticky; top: 0; background: var(--rd-surface, #fff); }

.by-ra-table tfoot td { font-weight: 600; border-top: 2px solid var(--rd-border, #cbd5e1); background: var(--rd-surface-2, #f8fafc); }

/* Analyze Race dialog */
.modal.ar-modal { width: min(720px, 94vw); max-height: 92vh; padding: 0; gap: 0; overflow: hidden; }
.ar-modal .modal-header { padding: 20px 28px 16px; }
.ar-modal .modal-header h3 { display: flex; align-items: center; gap: 10px; font-size: 1.35em; margin: 0; }
.ar-body { padding: 0 28px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; border-top: 1px solid var(--rd-border-soft, #e2e8f0); padding-top: 18px; }
.ar-activity { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 12px; background: var(--rd-surface-2, #f8fafc); border: 1px solid var(--rd-border-soft, #e2e8f0); }
.ar-activity__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--rd-accent-soft, #e0f2fe); color: var(--rd-accent, #0369a1); flex: none; }
.ar-activity__text { flex: 1; min-width: 0; }
.ar-activity__text strong { display: block; font-size: 1.02em; }
.ar-activity__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.85em; color: var(--rd-muted, #64748b); margin-top: 2px; font-variant-numeric: tabular-nums; }
.ar-device { font-size: 0.78em; padding: 3px 9px; border: 1px solid var(--rd-border, #cbd5e1); border-radius: 6px; background: var(--rd-surface, #fff); color: var(--rd-ink-2, #334155); }
.ar-label { font-size: 0.9em; font-weight: 700; color: var(--rd-ink-2, #334155); margin-bottom: 8px; display: flex; justify-content: space-between; }
.ar-label span { font-weight: 400; color: var(--rd-muted, #64748b); }
.ar-seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 12px; background: var(--rd-surface-2, #eef2f7); }
.ar-seg__btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--rd-muted, #64748b); font: inherit; font-weight: 600; cursor: pointer; }
.ar-seg__btn.is-on { background: var(--rd-surface, #fff); color: var(--rd-heading, #0f2a4a); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15); }
.ar-hint { margin: 8px 0 0; font-size: 0.85em; color: var(--rd-muted, #64748b); }
.ar-loop { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 0.85em; font-weight: 600; }
.ar-loop[hidden] { display: none; }
.ar-timed { display: flex; flex-wrap: wrap; gap: 0 16px; }
.ar-timed[hidden] { display: none; }
.ar-loop select { padding: 6px 8px; border: 1px solid var(--rd-border, #cbd5e1); border-radius: 8px; font: inherit; background: var(--rd-surface, #fff); color: inherit; }
.ar-loop input { width: 96px; padding: 6px 8px; border: 1px solid var(--rd-border, #cbd5e1); border-radius: 8px; font: inherit; }
.ar-options { display: flex; flex-direction: column; gap: 10px; }
.ar-loading { padding: 18px; text-align: center; color: var(--rd-muted, #64748b); font-size: 0.9em; }
.ar-opt { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--rd-border, #d6dde8); border-radius: 12px; background: var(--rd-surface, #fff); cursor: pointer; }
.ar-opt:hover { border-color: var(--rd-accent, #2563eb); }
.ar-opt.is-on { border-color: var(--rd-accent, #1d4f91); background: var(--rd-accent-soft, #f3f7fd); box-shadow: 0 0 0 1px var(--rd-accent, #1d4f91); }
.ar-radio { flex: none; width: 20px; height: 20px; margin-top: 2px; border: 2px solid var(--rd-border, #b6c0cf); border-radius: 50%; position: relative; background: var(--rd-surface, #fff); }
.ar-opt.is-on .ar-radio { border-color: var(--rd-accent, #1d4f91); background: var(--rd-accent, #1d4f91); }
.ar-opt.is-on .ar-radio::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: #fff; }
.ar-opt__text { flex: 1; min-width: 0; }
.ar-opt__title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-weight: 700; font-size: 1.02em; }
.ar-opt__sub { font-size: 0.85em; color: var(--rd-muted, #64748b); margin-top: 3px; }
.ar-prio { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 6px; background: var(--rd-heading, #0f2a4a); color: #fff; font-size: 0.8em; font-weight: 800; }
.ar-chip { padding: 2px 9px; border-radius: 999px; background: oklch(93% 0.06 155); color: oklch(33% 0.1 155); font-size: 0.75em; font-weight: 700; }
html.dark-mode .ar-chip { background: oklch(28% 0.06 155); color: oklch(82% 0.1 155); }
.ar-select { width: 100%; margin-top: 10px; padding: 9px 10px; border: 1px solid var(--rd-border, #cbd5e1); border-radius: 8px; font: inherit; background: var(--rd-surface, #fff); color: inherit; }
.ar-create { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.ar-create label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8em; font-weight: 600; flex: 1; }
.ar-create input, .ar-create select { padding: 8px 10px; border: 1px solid var(--rd-border, #cbd5e1); border-radius: 8px; font: inherit; font-weight: 400; background: var(--rd-surface, #fff); color: inherit; }
.ar-create__row { display: flex; flex-wrap: wrap; gap: 10px; }
.ar-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 28px; border-top: 1px solid var(--rd-border-soft, #e2e8f0); background: var(--rd-surface-2, #f8fafc); }
.ar-consequence { flex: 1 1 260px; margin: 0; font-size: 0.85em; color: var(--rd-muted, #64748b); }
.ar-footer__buttons { display: flex; gap: 10px; margin-left: auto; }
.ar-primary { display: inline-flex; align-items: center; gap: 8px; background: var(--rd-accent, #1d4f91); border-color: var(--rd-accent, #1d4f91); color: #fff; }
.ar-primary:disabled { opacity: .6; cursor: default; }
@media (max-width: 560px) { .ar-modal .modal-header, .ar-body, .ar-footer { padding-left: 16px; padding-right: 16px; } .ar-footer__buttons { width: 100%; } .ar-footer__buttons .modal-action { flex: 1; justify-content: center; } }

.res-ring-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.res-yards { font-size: 12px; font-weight: 600; color: var(--rd-muted, #64748b); text-align: center; }

/* ── Fuel Log tab (redesign) ─────────────────────────────────── */
.fl {
    --fl-surface: var(--rd-surface, #fff);
    --fl-surface-2: var(--rd-surface-2, #f8f9fb);
    --fl-border: var(--rd-border, #e3e7ec);
    --fl-border-soft: var(--rd-border-soft, #edf0f3);
    --fl-input-border: var(--rd-input-border, #d5dbe2);
    --fl-ink: var(--rd-ink, #1b2430);
    --fl-ink-2: var(--rd-ink-2, #3d4a5c);
    --fl-muted: var(--rd-muted, #5b6675);
    --fl-faint: var(--rd-faint, #8a94a3);
    --fl-faintest: var(--rd-faintest, #b3bbc6);
    --fl-heading: var(--rd-heading, #16365e);
    --fl-accent: var(--rd-accent, #1d5fa7);
    --fl-accent-hover: var(--rd-accent-hover, #164a84);
    --fl-accent-soft: var(--rd-accent-soft, #eef4fb);
    --fl-accent-border: var(--rd-accent-border, #c6d4e6);
    --fl-green: var(--rd-success, #2e9e5b);
    --fl-amber: var(--rd-warn-dot, #d99a00);
    --fl-red: var(--rd-missed, #d14b3f);
    --fl-blue: var(--rd-accent, #1d5fa7);
    --fl-danger: var(--rd-danger, #b42318);
    --fl-danger-soft: var(--rd-danger-soft, #fdf0ef);
    --fl-seg-bg: var(--rd-neutral-soft, #eef0f3);
    display: flex; flex-direction: column; gap: 16px; padding: 0 0 24px; color: var(--fl-ink);
    font-variant-numeric: tabular-nums;
}
.fl button { font-family: inherit; }
.fl input[type=number]::-webkit-inner-spin-button, .fl input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.fl input[type=number] { -moz-appearance: textfield; }
.fl-icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fl-icon--lg { width: 24px; height: 24px; color: var(--fl-faintest); }
.fl-icon--accent { color: var(--fl-accent); }
.fl-muted { color: var(--fl-faint); font-weight: 400; font-size: 13px; }
.fl-muted--error { color: var(--fl-danger); }
.fl-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.fl-h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--fl-heading); flex: 1; }
.fl-count { font-weight: 400; color: var(--fl-faint); }
.fl-card { background: var(--fl-surface); border: 1px solid var(--fl-border); border-radius: 14px; padding: 16px; }

/* Hour bar */
.fl-slotbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 8px 4px;
    background: color-mix(in srgb, var(--fl-surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--fl-border); }
.fl-slotbar__label { flex: none; font-size: 12px; font-weight: 600; color: var(--fl-muted); white-space: nowrap; }
.fl-slotbar__pills { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; padding: 2px; }
.fl-pill { flex: none; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--fl-border); background: var(--fl-surface);
    color: var(--fl-ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; white-space: nowrap; }
.fl-pill:hover { border-color: var(--fl-accent); }
.fl-pill__label { font-size: 13px; font-weight: 600; }
.fl-pill__sub { font-size: 11px; font-weight: 500; opacity: .8; }
.fl-pill.is-active { background: var(--fl-accent); border-color: var(--fl-accent); color: #fff; }

/* Overview: KPIs + chart */
.fl-overview { display: flex; gap: 20px; flex-wrap: wrap; align-items: stretch; }
.fl-kpis { flex: 1 1 380px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.fl-kpi { display: flex; flex-direction: column; gap: 5px; padding: 12px; border-radius: 10px; background: var(--fl-surface-2); min-width: 0; }
.fl-kpi__label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--fl-muted); }
.fl-kpi__value { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.fl-kpi__value b { font-size: 24px; font-weight: 700; color: var(--fl-heading); line-height: 1.1; }
.fl-kpi__value small { font-size: 12px; color: var(--fl-muted); }
.fl-kpi__bar { position: relative; height: 5px; border-radius: 3px; background: var(--fl-border); }
.fl-kpi__target { position: absolute; top: -2px; bottom: -2px; background: color-mix(in srgb, var(--fl-green) 22%, transparent); border-radius: 2px; }
.fl-kpi__fill { position: relative; display: block; height: 100%; border-radius: 3px; }
.fl-kpi__sub { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--fl-muted); }
.fl-chart { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.fl-chart__head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 10px; flex-wrap: wrap; }
.fl-chart__title { font-size: 13px; font-weight: 600; color: var(--fl-ink-2); }
.fl-chart__legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--fl-muted); }
.fl-chart__swatch { width: 12px; height: 9px; border-radius: 2px; background: color-mix(in srgb, var(--fl-green) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fl-green) 40%, transparent); }
.fl-chart__body { display: flex; gap: 6px; }
.fl-chart__axis { flex: none; width: 22px; height: 110px; display: flex; flex-direction: column; justify-content: space-between; font-size: 10px; color: var(--fl-faint); text-align: right; }
.fl-chart__axis span:first-child { transform: translateY(-6px); }
.fl-chart__axis span:last-child { transform: translateY(6px); }
.fl-chart__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fl-chart__plot { position: relative; height: 110px; border-bottom: 1px solid var(--fl-input-border); }
.fl-chart__band { position: absolute; left: 0; right: 0; top: 25%; height: 25%; background: color-mix(in srgb, var(--fl-green) 10%, transparent);
    border-top: 1px dashed color-mix(in srgb, var(--fl-green) 40%, transparent); border-bottom: 1px dashed color-mix(in srgb, var(--fl-green) 40%, transparent); }
.fl-chart__bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 8px; }
.fl-bar { flex: 1; min-width: 0; height: 100%; border: none; padding: 0; background: transparent; border-radius: 6px 6px 0 0; cursor: pointer;
    display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; color: var(--fl-ink); }
.fl-bar.is-active { background: var(--fl-accent-soft); box-shadow: inset 0 -2px 0 var(--fl-accent); }
.fl-bar__val { font-size: 11px; font-weight: 700; }
.fl-bar__col { display: block; width: 60%; min-height: 3px; border-radius: 4px 4px 0 0; }
.fl-chart__labels { display: flex; gap: 8px; }
.fl-chart__labels span { flex: 1; min-width: 0; text-align: center; font-size: 11px; font-weight: 500; color: var(--fl-muted); white-space: nowrap; }
.fl-chart__labels span.is-active { font-weight: 700; color: var(--fl-heading); }

/* Insight */
.fl-insight { align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--rd-warn-soft, #fff8ea); border: 1px solid var(--rd-warn-border, #f3dfb1); }
.fl-insight .fl-icon { color: var(--rd-warn-ink, #9a6a00); margin-top: 2px; width: 18px; height: 18px; }
.fl-insight__text { flex: 1; font-size: 14px; line-height: 1.45; color: var(--rd-warn-ink, #5c4300); text-wrap: pretty; }
.fl-insight__btn { flex: none; min-height: 36px; padding: 0 12px; border: 1px solid var(--rd-warn-border, #e8cd8f); background: var(--fl-surface); border-radius: 8px;
    font-size: 13px; font-weight: 600; color: var(--rd-warn-ink, #8a4b00); cursor: pointer; white-space: nowrap; }

/* Two columns */
.fl-cols { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.fl-add { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.fl-add.is-dragover { border-color: var(--fl-accent); box-shadow: 0 0 0 3px var(--rd-accent-ring, #1d5fa71f); }
.fl-card__head { display: flex; align-items: center; gap: 8px; }
.fl-searchrow { display: flex; gap: 8px; }
.fl-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 48px; box-sizing: border-box; border: 1px solid var(--fl-input-border);
    border-radius: 10px; background: var(--fl-surface); padding: 0 6px 0 12px; color: var(--fl-faint); }
.fl-search:focus-within { border-color: var(--fl-accent); }
.fl-search input { flex: 1; min-width: 0; max-width: none; height: 100%; border: none; outline: none; background: transparent; font-size: 16px; color: var(--fl-ink); padding: 0; }
.fl-search__clear { flex: none; width: 36px; height: 36px; border: none; background: transparent; border-radius: 8px; color: var(--fl-faint); cursor: pointer; display: grid; place-items: center; padding: 0; }
.wa-page .tabcontent .fl-scanbtn { flex: none; height: 48px; padding: 0 14px; box-sizing: border-box; border: none; border-radius: 10px; background: var(--fl-accent); color: #fff;
    cursor: pointer; display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.wa-page .tabcontent .fl-scanbtn:hover { background: var(--fl-accent-hover); }
.fl-scanbtn .fl-icon { width: 18px; height: 18px; }
.fl-ai { border: 1px solid var(--fl-accent-border); background: var(--fl-accent-soft); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.fl-ai__head { display: flex; align-items: center; gap: 8px; }
.fl-ai__title { flex: 1; font-size: 14px; font-weight: 600; color: var(--fl-heading); }
.fl-ai__row { display: flex; gap: 8px; flex-wrap: wrap; }
.fl-ai__input { flex: 1 1 220px; min-width: 0; height: 48px; box-sizing: border-box; border: 1px solid var(--fl-accent-border); border-radius: 10px;
    background: var(--fl-surface); padding: 0 12px; font-size: 16px; color: var(--fl-ink); outline: none; }
.fl-ai__input:focus { border-color: var(--fl-accent); box-shadow: 0 0 0 3px var(--rd-accent-ring, #1d5fa71f); }
.wa-page .tabcontent .fl-ai__btn { flex: 1 0 auto; height: 48px; padding: 0 18px; border: none; border-radius: 10px; background: color-mix(in srgb, var(--fl-accent) 45%, var(--fl-surface));
    color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.wa-page .tabcontent .fl-ai__btn.is-ready { background: var(--fl-accent); }
.wa-page .tabcontent .fl-ai__btn:disabled { opacity: .7; cursor: wait; }
.fl-ai__hint { font-size: 12px; color: var(--fl-muted); margin: 0; min-height: 0; }
.fl-cats { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; }
.fl-cat { flex: none; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--fl-input-border); background: var(--fl-surface); color: var(--fl-ink);
    font-size: 13px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.wa-page .tabcontent .fl-cat.is-active { background: var(--fl-heading); border-color: var(--fl-heading); color: var(--fl-surface); font-weight: 600; }
.fl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.fl-grid > p, .fl-grid > .fl-nomatch { grid-column: 1 / -1; margin: 0; }
.fl-tile { position: relative; min-height: 60px; border: 1px solid var(--fl-border); background: var(--fl-surface); border-radius: 10px; min-width: 0; }
.fl-tile:hover { border-color: var(--fl-accent); }
.fl-tile.is-added { border-color: var(--fl-accent); background: var(--fl-accent-soft); }
.fl-tile__add { width: 100%; height: 100%; min-height: 58px; padding: 9px 34px 9px 12px; border: none; background: transparent; border-radius: 10px; cursor: pointer;
    text-align: left; color: var(--fl-ink); display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; box-sizing: border-box; }
.fl-tile__add:active { transform: scale(.98); }
.fl-tile__name { font-size: 13px; font-weight: 600; line-height: 1.25; text-wrap: pretty; }
.fl-tile__meta { font-size: 12px; color: var(--fl-faint); }
.fl-tile__count { position: absolute; top: 7px; right: 7px; min-width: 22px; height: 22px; padding: 0 6px; box-sizing: border-box; border-radius: 999px; background: var(--fl-accent);
    color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; pointer-events: none; }
.fl-tile__star { position: absolute; bottom: 2px; right: 2px; width: 32px; height: 32px; border: none; background: transparent; border-radius: 8px; color: var(--fl-faintest);
    cursor: pointer; display: grid; place-items: center; padding: 0; }
.fl-tile__star:hover { color: var(--fl-amber); }
.fl-tile__star.is-on { color: var(--fl-amber); }
.fl-tile__star.is-on .fl-icon { fill: currentColor; }
.fl-tile__star .fl-icon { width: 15px; height: 15px; }
.fl-nomatch { padding: 14px; border-radius: 10px; background: var(--fl-surface-2); font-size: 13px; color: var(--fl-muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fl-nomatch span { flex: 1; min-width: 180px; }
.fl-ghost { min-height: 40px; padding: 0 12px; border: 1px solid var(--fl-input-border); background: var(--fl-surface); border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--fl-accent); cursor: pointer; }
.fl-linkbtn { align-self: flex-start; min-height: 40px; padding: 0 4px; border: none; background: transparent; font-size: 13px; font-weight: 600; color: var(--fl-accent); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.fl-inline-link { background: none; border: none; color: inherit; text-decoration: underline; cursor: pointer; font-size: inherit; padding: 0; }

/* Log */
.fl-log { flex: 1 1 380px; min-width: 0; padding: 0; overflow: hidden; display: flex; flex-direction: column; position: sticky; top: 76px; }
.fl-log__head { padding: 14px 16px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--fl-border-soft); }
.fl-clear { min-height: 36px; padding: 0 10px; border: none; background: transparent; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--fl-danger); cursor: pointer; }
.fl-clear:hover { background: var(--fl-danger-soft); }
.fl-log__empty { padding: 28px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.fl-log__empty-title { font-size: 14px; font-weight: 600; color: var(--fl-ink-2); }
.fl-log__empty-sub { font-size: 13px; color: var(--fl-muted); max-width: 280px; text-wrap: pretty; }
.fl-log__list { display: flex; flex-direction: column; max-height: calc(100vh - 330px); overflow-y: auto; }
.fl-group { display: flex; flex-direction: column; }
.fl-group__head { display: flex; align-items: center; gap: 8px; padding: 9px 16px; border: none; border-bottom: 1px solid var(--fl-border-soft); background: var(--fl-surface-2);
    text-align: left; color: var(--fl-ink); width: 100%; box-sizing: border-box; cursor: pointer; font: inherit; }
div.fl-group__head { cursor: default; }
.fl-group__head.is-active { background: var(--fl-accent-soft); }
.fl-group__label { font-size: 12px; font-weight: 700; color: var(--fl-heading); text-transform: uppercase; letter-spacing: .05em; }
.fl-group__range { font-size: 12px; color: var(--fl-faint); }
.fl-group__sum { margin-left: auto; display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--fl-ink-2); white-space: nowrap; }
.fl-row { border-bottom: 1px solid var(--fl-border-soft); background: var(--fl-surface); }
.fl-row.is-open { background: var(--fl-surface-2); }
.fl-row__main { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 16px; }
.fl-row__info { flex: 1; min-width: 0; min-height: 44px; border: none; background: transparent; padding: 0; text-align: left; cursor: pointer; color: var(--fl-ink);
    display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.fl-row__name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; font-weight: 600; }
.fl-row__nametext { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-mine { flex: none; font-size: 10px; font-weight: 600; color: var(--rd-purple-ink, #6b3fa0); background: var(--rd-purple-soft, #f3ecfb); border-radius: 4px; padding: 1px 5px; }
.fl-row__meta { font-size: 12px; color: var(--fl-muted); }
.fl-stepper { flex: none; display: flex; align-items: center; border: 1px solid var(--fl-input-border); border-radius: 10px; overflow: hidden; height: 44px; background: var(--fl-surface); }
.fl-stepper button { width: 40px; height: 100%; border: none; background: var(--fl-surface); color: var(--fl-accent); cursor: pointer; display: grid; place-items: center; padding: 0; }
.fl-stepper button:active { background: var(--fl-seg-bg); }
.fl-stepper button.is-danger { color: var(--fl-danger); }
.fl-stepper input { width: 40px; height: 100%; border: none; border-left: 1px solid var(--fl-border-soft); border-right: 1px solid var(--fl-border-soft); text-align: center;
    font-size: 16px; font-weight: 600; color: var(--fl-ink); outline: none; padding: 0; background: transparent; border-radius: 0; }
.fl-row__detail { padding: 2px 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.fl-row__perserving { font-size: 12px; color: var(--fl-muted); }
.fl-row__moves { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fl-row__moveslabel { font-size: 12px; font-weight: 600; color: var(--fl-muted); margin-right: 2px; }
.fl-move { min-width: 44px; height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--fl-input-border); background: var(--fl-surface); color: var(--fl-ink); font-size: 12px; font-weight: 600; cursor: pointer; }
.fl-move.is-active { background: var(--fl-accent); border-color: var(--fl-accent); color: #fff; }
.fl-spacer { flex: 1; }
.fl-remove { height: 36px; padding: 0 10px; border: none; background: transparent; border-radius: 8px; color: var(--fl-danger); font-size: 13px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 5px; }
.fl-remove:hover { background: var(--fl-danger-soft); }
.fl-duplicate { height: 36px; padding: 0 10px; border: none; background: transparent; border-radius: 8px; color: var(--fl-accent); font-size: 13px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 5px; }
.fl-duplicate:hover { background: var(--fl-accent-soft, rgba(30, 90, 160, 0.08)); }
.fl-log__foot { padding: 12px 16px; background: var(--fl-surface-2); border-top: 1px solid var(--fl-border); display: flex; flex-direction: column; gap: 6px; }
.fl-log__totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.fl-log__totals div { display: flex; flex-direction: column; min-width: 0; }
.fl-log__totals span { font-size: 11px; color: var(--fl-faint); }
.fl-log__totals b { font-size: 14px; font-weight: 700; white-space: nowrap; }
.fl-log__ratio { font-size: 12px; color: var(--fl-muted); }

/* Post-run */
.fl-post { display: flex; flex-direction: column; gap: 16px; }
.fl-field { display: flex; flex-direction: column; gap: 8px; }
.fl-label { font-size: 14px; font-weight: 500; color: var(--fl-ink-2); }
.fl-seg { display: grid; padding: 3px; background: var(--fl-seg-bg); border-radius: 10px; gap: 2px; }
.fl-seg--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fl-seg--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 420px; }
.wa-page .tabcontent .fl-seg button { height: 42px; border: none; border-radius: 8px; background: transparent; color: var(--fl-muted); font-size: 14px; font-weight: 500; cursor: pointer; min-width: 0; padding: 0; }
.wa-page .tabcontent .fl-seg button.is-active { background: var(--fl-surface); color: var(--fl-heading); font-weight: 600; box-shadow: 0 1px 2px #1b24301f; border: none; }
.fl-notes { box-sizing: border-box; width: 100%; border: 1px solid var(--fl-input-border); border-radius: 10px; padding: 10px 12px; font-size: 16px; line-height: 1.45;
    color: var(--fl-ink); background: var(--fl-surface); outline: none; resize: vertical; font-family: inherit; }
.fl-notes:focus { border-color: var(--fl-accent); box-shadow: 0 0 0 3px var(--rd-accent-ring, #1d5fa71f); }

/* Sticky save bar */
.fl-savebar { position: sticky; bottom: 0; z-index: 35; display: flex; align-items: center; gap: 12px; padding: 10px 16px; margin: 0 -4px; background: var(--fl-surface);
    border-top: 1px solid var(--fl-border); box-shadow: 0 -6px 20px #1b24300f; }
.fl-savebar__summary { flex: 1; min-width: 0; min-height: 44px; border: none; background: transparent; padding: 0; text-align: left; cursor: pointer; color: var(--fl-ink);
    display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.fl-savebar__main { font-size: 14px; font-weight: 700; color: var(--fl-heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-savebar__status { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--fl-faint); }
.fl-savebar__status .fl-dot { width: 6px; height: 6px; }
.fl-savebar__status.is-ok { color: var(--rd-success-ink, #1e6b3a); }
.fl-savebar__status.is-warn { color: var(--rd-warn-ink, #9a6a00); }
.fl-savebar__status.is-error { color: var(--fl-danger); }
.fl-savebar__btn { flex: none; height: 48px; padding: 0 20px; border: none; background: var(--fl-accent); color: #fff; border-radius: 10px; font-size: 15px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.fl-savebar__btn:hover { background: var(--fl-accent-hover); }
.fl-savebar__btn .fl-icon { width: 17px; height: 17px; }
.fl-toast { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); z-index: 80; width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box;
    background: var(--rd-toast-bg, #1b2430); color: #fff; border-radius: 10px; padding: 12px 16px; font-size: 14px; align-items: center; gap: 16px; box-shadow: 0 10px 30px #1b243040; }
html.dark-mode .fl-toast { color: #1b2430; }
.fl-toast button { border: none; background: transparent; color: var(--rd-toast-link, #9cc3e8); font-weight: 600; font-size: 14px; cursor: pointer; padding: 6px 0; min-height: 32px; }

@media (max-width: 760px) {
    .fl-log { position: static; }
    .fl-log__list { max-height: none; }
    .fl-scanbtn__label { display: none; }
}

.fl-linkbtn--head { margin-left: auto; min-height: 36px; padding: 0 10px; border-radius: 8px; }
.fl-linkbtn--head:hover { background: var(--fl-accent-soft); }
.fl-linkbtn:disabled { opacity: .6; cursor: wait; }

/* ── Zones & splits card (Activity tab) ── */
.zs-card { margin-top: 16px; background: #fff; border: 1px solid #e3e7ec; border-radius: 14px; overflow: hidden; }
.zs-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px 20px 14px; }
.zs-head__text { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 2px; }
.zs-head h2 { margin: 0; font-size: 16px; font-weight: 600; color: #16365e; }
.zs-basis { font-size: 12px; color: #5b6675; }
.zs-note { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: #fff7e6; border: 1px solid #f3d9a4; font-size: 13px; line-height: 1.45; color: #5a4310; }
html.dark-mode .zs-note { background: #3a2f12; border-color: #5c4a1c; color: #f1d9a0; }
.zs-toggle { display: flex; gap: 2px; padding: 3px; background: #eef1f5; border-radius: 9px; }
.zs-toggle__btn { height: 30px; padding: 0 12px; border: none; border-radius: 7px; background: transparent; font: inherit; font-size: 13px; font-weight: 500; color: #5b6675; cursor: pointer; white-space: nowrap; }
.zs-toggle__btn.is-active { background: #fff; box-shadow: 0 1px 2px #1b24301f; font-weight: 600; color: #16365e; }
.zs-summary { display: flex; flex-direction: column; gap: 12px; padding: 0 20px 18px; }
.zs-bar { display: flex; gap: 2px; height: 30px; border-radius: 8px; overflow: hidden; }
.zs-bar span { flex-basis: 0; min-width: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; overflow: hidden; white-space: nowrap; }
.zs-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
.zs-legend__item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.zs-legend__name { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #3d4a5c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zs-legend__name i { flex: none; width: 9px; height: 9px; border-radius: 2px; }
.zs-legend__time { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.zs-legend__time small { font-size: 12px; font-weight: 500; color: #5b6675; }
.zs-legend__range { font-size: 11px; color: #8a94a3; font-variant-numeric: tabular-nums; }
.zs-table-wrap { overflow-x: auto; }
.zs-table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.zs-table th { padding: 9px 10px; text-align: right; font-size: 12px; font-weight: 600; color: #5b6675; background: #f8f9fb; border-top: 1px solid #e3e7ec; border-bottom: 1px solid #e3e7ec; }
.zs-table td { padding: 10px; text-align: right; color: #3d4a5c; border-bottom: 1px solid #edf0f3; }
.zs-table th:first-child, .zs-table td:first-child { text-align: left; padding-left: 20px; }
.zs-table th:last-child, .zs-table td:last-child { text-align: left; padding: 10px 20px 10px 14px; }
.zs-table tbody tr:hover { background: #f3f7fb; }
.zs-split { font-weight: 600; color: #1b2430; white-space: nowrap; }
.zs-pace { white-space: nowrap; color: #1b2430; }
.zs-pace strong { font-weight: 700; }
.zs-fastest { margin-right: 6px; padding: 1px 6px; border-radius: 999px; background: #e8f1fc; color: #1d5fa7; font-size: 10px; font-weight: 700; }
.zs-elev { white-space: nowrap; }
.zs-mix { display: flex; gap: 1px; height: 10px; min-width: 150px; border-radius: 3px; overflow: hidden; background: #edf0f3; }
.zs-mix span { flex-basis: 0; }
html.dark-mode .zs-card { background: #111c2e; border-color: #334155; }
html.dark-mode .zs-head h2, html.dark-mode .zs-split, html.dark-mode .zs-pace, html.dark-mode .zs-legend__time { color: #e2e8f0; }
html.dark-mode .zs-basis, html.dark-mode .zs-legend__time small, html.dark-mode .zs-toggle__btn, html.dark-mode .zs-table th { color: #94a3b8; }
html.dark-mode .zs-legend__name, html.dark-mode .zs-table td { color: #cbd5e1; }
html.dark-mode .zs-toggle { background: #1e293b; }
html.dark-mode .zs-toggle__btn.is-active { background: #0f172a; color: #e2e8f0; }
html.dark-mode .zs-table th { background: #0f172a; border-color: #334155; }
html.dark-mode .zs-table td { border-bottom-color: #1e293b; }
html.dark-mode .zs-table tbody tr:hover { background: #172236; }
html.dark-mode .zs-mix { background: #1e293b; }

/* ── Power tab ── */
.pw-page { display: flex; flex-direction: column; gap: 16px; }
.pw-body { display: flex; flex-direction: column; gap: 16px; }
.pw-nodata { color: #64748b; text-align: center; padding: 24px 0; margin: 0; }
.pw-card { background: #fff; border: 1px solid #e3e7ec; border-radius: 14px; }
.pw-muted { font-size: 12px; color: #5b6675; font-variant-numeric: tabular-nums; }
.pw-label { font-size: 12px; font-weight: 600; color: #5b6675; }
.pw-eyebrow { flex: 1; font-size: 11px; font-weight: 600; color: #8a94a3; text-transform: uppercase; letter-spacing: .06em; }
.pw-card h2, .pw-keys-head h2 { margin: 0; font-size: 16px; font-weight: 600; color: #16365e; }
.pw-effect, .pw-why { padding: 22px 26px; display: flex; flex-direction: column; gap: 10px; }
.pw-effect__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pw-effect__title { font-size: 30px !important; font-weight: 700 !important; letter-spacing: -0.01em; }
.pw-narrative { margin: 0; max-width: 640px; font-size: 16px; line-height: 1.5; color: #3d4a5c; text-wrap: pretty; }
.pw-narrative b { color: #1b2430; }
.pw-chip { align-self: flex-start; padding: 6px 12px; border-radius: 999px; background: #f1edfb; color: #5a3fa8; font-size: 13px; font-weight: 600; }
.pw-how { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 20px; border-top: 1px solid #edf0f3; }
.pw-how__row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.pw-how__row .pw-eyebrow { flex: none; }
.pw-how__label { font-size: 20px; font-weight: 700; color: #16365e; }
.pw-how__sub { margin: 4px 0 0; font-size: 14px; color: #3d4a5c; }
.pw-intensity__val { font-size: 22px; font-weight: 700; color: #16365e; font-variant-numeric: tabular-nums; }
.pw-work { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pw-gauge { position: relative; display: flex; gap: 2px; height: 8px; }
.pw-gauge span { flex-basis: 0; }
.pw-gauge span:first-child { border-radius: 4px 0 0 4px; }
.pw-gauge span:last-of-type { border-radius: 0 4px 4px 0; }
.pw-gauge i { position: absolute; top: -4px; width: 4px; height: 16px; margin-left: -2px; border-radius: 2px; background: #16365e; box-shadow: 0 0 0 2px #fff; }
.pw-gauge__labels { display: flex; gap: 2px; font-size: 11px; color: #5b6675; }
.pw-gauge__labels span { flex-basis: 0; white-space: nowrap; }
.pw-gauge__labels .is-active { font-weight: 700; color: #16365e; }
.pw-why__grid { display: flex; flex-wrap: wrap; gap: 16px 40px; align-items: center; }
.pw-why__main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pw-why__dur { display: flex; gap: 6px; align-items: baseline; font-size: 14px; color: #3d4a5c; }
.pw-why__dur b { color: #1b2430; }
.pw-why__pct { display: flex; align-items: baseline; gap: 8px; }
.pw-why__pct span { font-size: 44px; font-weight: 700; line-height: 1; color: #5a3fa8; font-variant-numeric: tabular-nums; }
.pw-why__pct small { font-size: 13px; color: #5b6675; }
.pw-why__main .pw-key__bar { height: 8px; border-radius: 4px; }
.pw-why__main .pw-key__bar i { border-radius: 4px; }
.pw-why__blurb { flex: 1 1 280px; margin: 0; font-size: 14px; line-height: 1.5; color: #3d4a5c; text-wrap: pretty; }
.pw-why__others { display: flex; gap: 8px 16px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid #edf0f3; font-size: 13px; color: #5b6675; }
.pw-why__others:empty { display: none; }
.pw-why__others b { color: #1b2430; font-weight: 600; }
.pw-drift__legend { display: flex; gap: 16px; font-size: 12px; color: #5b6675; }
.pw-drift__legend span { display: flex; align-items: center; gap: 6px; }
.pw-drift__legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.pw-drift__svg { width: 100%; height: auto; display: block; }
.pw-drift__plot { position: relative; }
.pw-drift__hl { fill: #7b61c9; pointer-events: none; }
.pw-drift__tip { position: absolute; top: 0; z-index: 2; display: flex; flex-direction: column; gap: 3px; min-width: 170px; padding: 10px 12px; background: #fff; border: 1px solid #c9d6e6; border-radius: 10px; box-shadow: 0 4px 14px #1b243026; font-size: 12px; color: #5b6675; pointer-events: none; }
.pw-drift__tip[hidden] { display: none; }
.pw-drift__tip b { font-size: 13px; color: #16365e; margin-bottom: 2px; }
.pw-drift__tip span { display: flex; justify-content: space-between; gap: 16px; }
.pw-drift__tip em { font-style: normal; font-weight: 600; color: #1b2430; font-variant-numeric: tabular-nums; }
html.dark-mode .pw-drift__tip { background: #111c2e; border-color: #334155; color: #94a3b8; }
html.dark-mode .pw-drift__tip b, html.dark-mode .pw-drift__tip em { color: #e2e8f0; }
.pw-drift__stats { display: flex; gap: 12px 40px; flex-wrap: wrap; padding-top: 4px; }
.pw-drift__stats div { display: flex; flex-direction: column; gap: 2px; }
.pw-drift__val { font-size: 26px; font-weight: 700; color: #16365e; font-variant-numeric: tabular-nums; }
.pw-drift__stats small { font-size: 12px; color: #5b6675; }
#pwDrift:not([hidden]) { display: flex; flex-direction: column; gap: 12px; }
html.dark-mode .pw-drift__val { color: #e2e8f0; }
html.dark-mode .pw-drift__legend, html.dark-mode .pw-drift__stats small { color: #94a3b8; }
.pw-adv__head { width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px 22px; border: none; background: transparent; border-radius: 14px; font: inherit; color: #16365e; text-align: left; cursor: pointer; }
.pw-adv__t { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pw-adv__t b { font-size: 15px; font-weight: 600; color: #1b2430; }
.pw-adv__t small { font-size: 12px; color: #5b6675; }
.pw-adv__caret { transition: transform .15s; color: #5b6675; }
.pw-adv.is-open .pw-adv__caret { transform: rotate(180deg); }
.pw-adv__body { display: flex; flex-direction: column; gap: 16px; }
.pw-adv__body[hidden] { display: none; }
.pw-adv__tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { .pw-adv__caret { transition: none; } }
.pw-pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pw-pill--improving, .pw-pill--peak { background: #e5f4ea; color: #1e6b3a; }
.pw-pill--maintaining { background: #eef1f5; color: #3d4a5c; }
.pw-pill--minimal { background: #fdf0e0; color: #8a4b00; }
.pw-btn { height: 32px; padding: 0 10px; border: 1px solid #d5dbe2; background: #fff; border-radius: 8px; font: inherit; font-size: 12px; font-weight: 500; color: #3d4a5c; cursor: pointer; white-space: nowrap; }
.pw-btn.is-active { background: #eef4fb; border-color: #b9d0ec; color: #1d5fa7; }
.pw-info { flex: none; width: 22px; height: 22px; margin-left: auto; border: none; background: transparent; border-radius: 6px; color: #8a94a3; font: italic 700 13px Georgia, serif; cursor: pointer; padding: 0; }
.pw-info:hover { background: #eef4fb; color: #1d5fa7; }
.pw-link { border: none; background: transparent; color: #1d5fa7; font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; padding: 4px; white-space: nowrap; }
.pw-calc { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.pw-calc[hidden] { display: none; }
.pw-calc__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pw-calc__head h2 { font-size: 15px; }
.pw-calc__steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 6px 12px; align-items: start; }
.pw-step { border-radius: 10px; }
.pw-step.is-open { background: #f5f8fc; }
.pw-step__head { width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 10px; border: none; background: transparent; cursor: pointer; text-align: left; font: inherit; color: #1b2430; border-radius: 10px; }
.pw-step__n { flex: none; width: 22px; height: 22px; border-radius: 6px; background: #16365e; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.pw-step__t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pw-step__t b { font-size: 13px; font-weight: 600; }
.pw-step__t small { font-size: 12px; font-weight: 600; color: #1d5fa7; font-variant-numeric: tabular-nums; }
.pw-step__caret { flex: none; color: #8a94a3; font-size: 16px; line-height: 1; }
.pw-step__body { display: flex; flex-direction: column; gap: 4px; padding: 0 12px 12px 42px; }
.pw-step__body span { font-size: 12px; line-height: 1.45; color: #5b6675; }
.pw-step__body code { font: inherit; font-size: 13px; font-weight: 500; color: #1b2430; padding: 5px 8px; background: #fff; border: 1px solid #e3e7ec; border-radius: 6px; font-variant-numeric: tabular-nums; }
.pw-chartcard { padding: 16px 20px 14px; display: flex; flex-direction: column; gap: 12px; }
.pw-chartcard__head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; }
.pw-chartcard__head > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.pw-seg { display: flex; gap: 2px; padding: 3px; background: #eef1f5; border-radius: 9px; }
.pw-seg__btn { height: 30px; padding: 0 12px; border: none; border-radius: 7px; background: transparent; font: inherit; font-size: 13px; font-weight: 500; color: #5b6675; cursor: pointer; white-space: nowrap; }
.pw-seg__btn.is-active { background: #fff; box-shadow: 0 1px 2px #1b24301f; font-weight: 600; color: #16365e; }
.pw-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: #5b6675; }
.pw-legend span { display: flex; align-items: center; gap: 6px; }
.pw-legend i { width: 18px; display: inline-block; }
.pw-chartbox { position: relative; height: 340px; }
.pw-keys-wrap { display: flex; flex-direction: column; gap: 10px; }
.pw-keys-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 0 2px; }
.pw-keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.pw-key { background: #fff; border: 1px solid #e3e7ec; border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; text-align: left; cursor: pointer; color: #1b2430; min-width: 0; font: inherit; }
.pw-key:hover { border-color: #c9d6e6; }
.pw-key.is-selected { border-color: #7b61c9; box-shadow: 0 0 0 1px #7b61c9; }
.pw-key__top { display: flex; align-items: center; gap: 8px; }
.pw-key__top > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pw-key__top b { font-size: 14px; font-weight: 700; }
.pw-key__top small { font-size: 12px; color: #5b6675; }
.pw-key__top em { font-style: normal; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #f1edfb; color: #5a3fa8; white-space: nowrap; flex: none; }
.pw-key__pct { display: flex; align-items: baseline; gap: 6px; font-size: 28px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.pw-key__pct small { font-size: 12px; font-weight: 400; color: #5b6675; }
.pw-key__bar { position: relative; height: 6px; border-radius: 3px; background: #edf0f3; }
.pw-key__bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: #7b61c9; }
.pw-key__bar u { position: absolute; left: 90%; top: -3px; bottom: -3px; width: 1px; background: #8a94a3; }
.pw-key__sub { font-size: 12px; color: #5b6675; font-variant-numeric: tabular-nums; }
.pw-key__sub b { color: #1b2430; }
.pw-profile { padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.pw-profile__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pw-profile__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px 20px; }
.pw-profile__item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pw-profile__name { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #5b6675; }
.pw-profile__name span { flex: 1; }
.pw-profile__val { font-size: 26px; font-weight: 700; line-height: 1.1; color: #16365e; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pw-profile__item p { margin: 0; font-size: 13px; line-height: 1.45; color: #3d4a5c; text-wrap: pretty; }
html.dark-mode .pw-card, html.dark-mode .pw-key { background: #111c2e; border-color: #334155; }
html.dark-mode .pw-card h2, html.dark-mode .pw-keys-head h2, html.dark-mode .pw-intensity__val, html.dark-mode .pw-profile__val, html.dark-mode .pw-gauge__labels .is-active { color: #e2e8f0; }
html.dark-mode .pw-narrative, html.dark-mode .pw-profile__item p { color: #cbd5e1; }
html.dark-mode .pw-narrative b, html.dark-mode .pw-key, html.dark-mode .pw-key__sub b, html.dark-mode .pw-step__head { color: #e2e8f0; }
html.dark-mode .pw-muted, html.dark-mode .pw-label, html.dark-mode .pw-key__sub, html.dark-mode .pw-key__top small, html.dark-mode .pw-profile__name, html.dark-mode .pw-gauge__labels { color: #94a3b8; }
html.dark-mode .pw-how, html.dark-mode .pw-why__others { border-color: #334155; }
html.dark-mode .pw-how__label, html.dark-mode .pw-adv__t b, html.dark-mode .pw-why__dur b, html.dark-mode .pw-why__others b { color: #e2e8f0; }
html.dark-mode .pw-how__sub, html.dark-mode .pw-why__blurb, html.dark-mode .pw-why__dur { color: #cbd5e1; }
html.dark-mode .pw-why__pct span, html.dark-mode .pw-chip { color: #c4b5fd; }
html.dark-mode .pw-chip { background: #2a2447; }
html.dark-mode .pw-btn { background: #0f172a; border-color: #334155; color: #cbd5e1; }
html.dark-mode .pw-seg { background: #1e293b; }
html.dark-mode .pw-seg__btn { color: #94a3b8; }
html.dark-mode .pw-seg__btn.is-active { background: #0f172a; color: #e2e8f0; }
html.dark-mode .pw-step.is-open { background: #172236; }
html.dark-mode .pw-step__body code { background: #0f172a; border-color: #334155; color: #e2e8f0; }
html.dark-mode .pw-key__bar { background: #1e293b; }
html.dark-mode .pw-gauge i { box-shadow: 0 0 0 2px #111c2e; background: #e2e8f0; }

.wa-page .race-analysis-stats-row, .wa-page #raceAnalysisBody > .ra-note { margin-bottom: 0; }
.wa-page .activity-sport-cards { margin-top: 14px; }

/* ── Race Analysis → Race Readiness ── */
.rr-intro { margin: 4px 0 14px; font-size: 13px; color: #5b6675; }
.rr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.rr-card { padding: 14px 16px; border: 1px solid #e3e7ec; border-left-width: 4px; border-radius: 10px; background: #fff; display: flex; flex-direction: column; gap: 4px; }
.rr-card__t { font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: #5b6675; }
.rr-card__u { font-size: 14px; font-weight: 600; }
.rr-card__v { font-size: 26px; font-weight: 700; color: #16365e; line-height: 1.1; }
.rr-card__s { font-size: 12px; color: #5b6675; line-height: 1.4; }
.rr-card__a { margin-top: 6px; font-size: 12px; font-weight: 600; }
.rr-g { border-left-color: #2e9e5b; } .rr-g .rr-card__v { color: #1e6b3a; }
.rr-a { border-left-color: #d99a00; } .rr-a .rr-card__v { color: #9a6a00; }
.rr-r { border-left-color: #d14b3f; } .rr-r .rr-card__v { color: #b42318; }
.rr-n { border-left-color: #c3cbd5; } .rr-n .rr-card__v { color: #8a94a3; }
html.dark-mode .rr-card { background: #1b2430; border-color: #2b3646; }
html.dark-mode .rr-card__v { color: #d7e3f4; }
html.dark-mode .rr-intro, html.dark-mode .rr-card__t, html.dark-mode .rr-card__s { color: #9aa5b3; }

/* Embedded in the coach calendar modal (?embed=1): hide app chrome, fill the frame */
body.is-embed .sidebar,
body.is-embed .sidebar-backdrop,
body.is-embed .sidebar-mobile-bar,
body.is-embed .br-trigger { display: none !important; }
body.is-embed.has-sidebar .app-shell { margin-left: 0; margin-top: 0; }
body.is-embed .container { max-width: none; padding: 12px 16px; border-radius: 0; box-shadow: none; background: transparent; }

/* Race Analysis: FKT attempts */
.ar-loop--wide { flex-basis: 100%; flex-wrap: wrap; }
.ar-loop input[type="file"] { width: auto; max-width: 100%; border: 0; padding: 0; }
.fkt-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0 12px; font-size: 12px; color: var(--rd-muted, #64748b); }
.fkt-legend[hidden] { display: none; }
.fkt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.fkt-sw { display: inline-block; width: 18px; height: 4px; border-radius: 2px; }
.fkt-sw--route { background: #94a3b8; height: 6px; }
.fkt-sw--track { background: #2563eb; }
.fkt-sw--off { background: #dc2626; }
.fkt-sw--cut { background: #d97706; }
.fkt-lede { margin: 4px 0 8px; font-size: 14px; }
.fkt-note { margin: 6px 0 0; font-size: 12px; color: var(--rd-muted, #64748b); }
.fkt-ops { margin: 8px 0 0; padding-left: 20px; line-height: 1.5; font-size: 13px; }
.fkt-sections { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.fkt-sections .by-chip { margin-left: 0; padding: 3px 10px; font-variant-numeric: tabular-nums; }
.fkt-table-wrap { overflow-x: auto; max-height: 420px; overflow-y: auto; }
.fkt-table-wrap thead th { position: sticky; top: 0; background: var(--rd-surface, #fff); }
.fkt-behind { color: oklch(48% 0.17 27); font-weight: 600; }
.fkt-ahead { color: oklch(45% 0.12 155); font-weight: 600; }
html.dark-mode .fkt-behind { color: oklch(78% 0.12 25); }
html.dark-mode .fkt-ahead { color: oklch(80% 0.12 155); }
.fkt-row--shortcut td:first-child { color: oklch(50% 0.13 70); font-weight: 600; }
.fkt-row--detour td:first-child, .fkt-row--off_route td:first-child { color: oklch(48% 0.17 27); font-weight: 600; }
.fkt-evidence { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.fkt-ev { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.fkt-ev__icon { flex: 0 0 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.fkt-ev--ok .fkt-ev__icon { background: oklch(93% 0.05 155); color: oklch(33% 0.1 155); }
.fkt-ev--warn .fkt-ev__icon { background: oklch(92% 0.08 85); color: oklch(38% 0.08 70); }
.fkt-ev--fail .fkt-ev__icon { background: oklch(92% 0.05 25); color: oklch(42% 0.17 27); }
.fkt-ev--info .fkt-ev__icon { background: var(--rd-surface-2, #eef2f7); color: var(--rd-muted, #64748b); }
html.dark-mode .fkt-ev--ok .fkt-ev__icon { background: oklch(28% 0.06 155); color: oklch(82% 0.1 155); }
html.dark-mode .fkt-ev--warn .fkt-ev__icon { background: oklch(30% 0.06 80); color: oklch(88% 0.09 85); }
html.dark-mode .fkt-ev--fail .fkt-ev__icon { background: oklch(30% 0.08 25); color: oklch(85% 0.1 25); }
.fkt-ev__detail { display: block; color: var(--rd-muted, #64748b); font-size: 12px; }
.fkt-plan { margin-top: 12px; }
.fkt-plan summary { cursor: pointer; font-weight: 600; font-size: 13px; }

/* Race Analysis: race format bar (labels above full-width controls, like the site's forms) */
.ra-format-bar { padding: 16px; margin: 0 0 12px; border: 1px solid var(--rd-border, #e2e8f0); border-radius: 12px; background: var(--rd-surface-2, #f8fafc); }
.ra-format-head .ra-field { max-width: 340px; }
.ra-field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rd-border-soft, #e2e8f0); }
.ra-field-grid[hidden], .ra-field[hidden] { display: none; }
.ra-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ra-field--wide { grid-column: 1 / -1; }
.ra-field--span2 { grid-column: span 2; }
.ra-field__label { font-size: 13px; font-weight: 500; color: var(--rd-ink-2, #475569); }
.ra-field__control { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ra-field__control :is(input:not([type="checkbox"]):not([type="file"]), select, textarea) {
    flex: 1 1 auto; min-width: 0; width: 100%; height: 38px; padding: 0 10px; box-sizing: border-box;
    border: 1px solid var(--rd-input-border, #cbd5e1); border-radius: 8px; background: var(--rd-surface, #fff);
    color: var(--rd-ink, inherit); font: inherit; font-size: 14px;
}
.ra-field__control textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; line-height: 1.4; }
.ra-field__control :is(input, select, textarea):focus { border-color: var(--rd-accent, #2563eb); box-shadow: 0 0 0 3px var(--rd-accent-ring, rgba(37, 99, 235, .2)); outline: none; }
.ra-field__control :is(input, select, textarea):disabled { opacity: .6; }
.ra-field__control input[hidden] { display: none; }
.ra-field__control select.ra-unit-select { flex: 0 0 76px; }
.ra-field__unit { flex: 0 0 auto; font-size: 13px; color: var(--rd-muted, #64748b); }
.ra-check { display: flex; align-items: center; gap: 8px; align-self: end; min-height: 38px; font-size: 14px; color: var(--rd-ink-2, #475569); cursor: pointer; }
.ra-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--rd-accent, #2563eb); }
.ra-file-input { max-width: 100%; font-size: 13px; color: var(--rd-muted, #64748b); }
.ra-file-input::file-selector-button {
    height: 38px; padding: 0 14px; margin-right: 10px; border: 1px solid var(--rd-input-border, #cbd5e1); border-radius: 8px;
    background: var(--rd-surface, #fff); color: var(--rd-ink, inherit); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
}
.ra-file-input::file-selector-button:hover { border-color: var(--rd-accent, #2563eb); color: var(--rd-accent, #2563eb); }
.ra-more { grid-column: 1 / -1; }
.ra-more summary { cursor: pointer; width: max-content; font-size: 13px; font-weight: 500; color: var(--rd-accent, #2563eb); }
.ra-more .ra-field-grid { margin-top: 10px; padding-top: 0; border-top: 0; }
.ra-format-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 16px; }
.ra-format-foot .ra-lps-note { flex: 1 1 240px; }
@media (max-width: 600px) {
    .ra-format-bar { padding: 14px; }
    .ra-format-head .ra-field { max-width: none; }
    .ra-field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
@media (max-width: 380px) {
    .ra-field-grid { grid-template-columns: 1fr; }
    .ra-field--span2 { grid-column: auto; }
}

/* Inline error, used instead of the browser's alert() */
.urc-inline-error { margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--rd-danger-border, #f0c8c4); border-radius: 10px; background: var(--rd-danger-soft, #fdf0ef); color: var(--rd-danger, #b42318); font-size: 13px; line-height: 1.4; }
.urc-inline-error[hidden] { display: none; }

/* Analyze Race dialog: FKT setup */
.ar-seg--three { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 12px; }
.ar-seg--three .ar-seg__btn { padding: 9px 6px; font-size: 0.85em; }
.ar-fkt { margin-top: 4px; }
.ar-fkt .ar-field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; min-width: 0; }
.ar-fkt .ar-field[hidden] { display: none; }
.ar-field__label { font-size: 0.85em; font-weight: 600; color: var(--rd-ink-2, #334155); }
.ar-field__label small { font-weight: 400; color: var(--rd-muted, #64748b); }
.ar-fkt :is(input[type="text"], input[type="url"], select) { width: 100%; box-sizing: border-box; height: 40px; padding: 0 12px; border: 1px solid var(--rd-input-border, #cbd5e1); border-radius: 8px; background: var(--rd-surface, #fff); color: var(--rd-ink, inherit); font: inherit; }
.ar-fkt :is(input, select):focus { border-color: var(--rd-accent, #2563eb); box-shadow: 0 0 0 3px var(--rd-accent-ring, rgba(37, 99, 235, .2)); outline: none; }
.ar-fkt .ar-file { font-size: 0.85em; color: var(--rd-muted, #64748b); }
.ar-fkt .ar-file::file-selector-button { height: 36px; padding: 0 14px; margin-right: 10px; border: 1px solid var(--rd-input-border, #cbd5e1); border-radius: 8px; background: var(--rd-surface, #fff); color: var(--rd-ink, inherit); font: inherit; font-weight: 500; cursor: pointer; }
.ar-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .ar-field-row { grid-template-columns: 1fr; gap: 0; } }
.ar-check { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 0.9em; color: var(--rd-ink-2, #334155); cursor: pointer; }
.ar-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--rd-accent, #2563eb); }

/* Race Analysis: FKT standing card */
.fkt-standing { margin: 0 0 12px; padding: 14px 16px; border: 1px solid var(--rd-border, #e2e8f0); border-radius: 12px; background: var(--rd-surface-2, #f8fafc); }
.fkt-standing__head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.fkt-standing__head .by-chip { margin-left: 0; padding: 3px 10px; }
.fkt-standing__text { margin: 8px 0 0; font-size: 14px; line-height: 1.45; }
.fkt-standing__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 12px; }
.fkt-standing__actions a { margin: 0; }

/* Info bubble (the "i" next to a label) */
.urc-tip { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-left: 4px; border-radius: 50%; background: var(--rd-border, #cbd5e1); color: var(--rd-ink-2, #475569); font-size: 10px; font-weight: 700; font-style: normal; cursor: help; vertical-align: middle; }
.urc-tip:focus-visible { outline: 2px solid var(--rd-accent, #2563eb); outline-offset: 2px; }
.urc-tip__bubble { display: none; position: absolute; z-index: 300; bottom: calc(100% + 8px); left: -8px; width: 300px; max-width: min(300px, 78vw); padding: 10px 12px; border-radius: 8px; background: #1e293b; color: #e2e8f0; font-size: 12px; font-weight: 400; line-height: 1.5; text-align: left; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); pointer-events: none; }
.urc-tip__bubble strong { color: #fff; }
.urc-tip__bubble em { display: block; margin-top: 6px; color: #94a3b8; font-style: normal; }
.urc-tip:hover .urc-tip__bubble, .urc-tip:focus .urc-tip__bubble { display: block; }

/* FKT link lookup */
.ar-inline { display: flex; gap: 8px; min-width: 0; }
.ar-inline input { flex: 1 1 auto; min-width: 0; }
.ar-lookup { flex: 0 0 auto; height: 40px; }
.fkt-lookup-note { display: block; margin-top: 6px; font-size: 13px; line-height: 1.45; color: var(--rd-muted, #64748b); }
.fkt-lookup-note[hidden] { display: none; }
.fkt-lookup-note.is-error { color: var(--rd-danger, #b42318); }

/* The style bubble is placed by script (see placeTip in fkt-view.js) so it can't be clipped by a modal */
.fkt-tip__bubble { position: fixed !important; bottom: auto !important; right: auto !important; transform: none !important; opacity: 0; display: block !important; visibility: hidden; transition: opacity .12s ease; z-index: 3000 !important; }
.fkt-tip__bubble.is-placed { opacity: 1; visibility: visible; }
.fkt-tip__bubble::after { display: none !important; }

/* FKT pacing breakdown */
.fkt-subhead { margin: 14px 0 6px; font-size: 13px; font-weight: 700; color: var(--rd-ink-2, #334155); }
.fkt-row--slow td { background: var(--rd-danger-soft, #fdf0ef); }
.ra-fkt-strip { display: flex; flex-direction: column; gap: 10px; }
.ra-fkt-strip__text { margin: 0; font-size: 13px; line-height: 1.5; color: var(--rd-muted, #64748b); }
.ra-fkt-strip__text strong { color: var(--rd-ink, inherit); }
.ra-fkt-strip .ra-format-foot { margin-top: 0; }
.ra-fkt-strip .rd-btn { text-decoration: none; }

/* The FKT logo is dark teal; lift it on dark backgrounds so it stays readable. */
.wa-race-head__logo { height: 26px; width: auto; margin-right: 6px; vertical-align: middle; }
html.dark-mode .tab-ico--fkt, html.dark-mode .wa-race-head__logo { filter: brightness(1.8) saturate(1.15); }

/* FKT record ghost and replay on the Activity map */
.fkt-ghost-hud { position: absolute; left: 10px; right: 10px; bottom: 58px; z-index: 6; display: none; padding: 6px 10px; border-radius: 10px;
    background: rgba(15, 23, 42, 0.85); color: #fff; font-size: 12px; line-height: 1.4; pointer-events: none; }
.fkt-ghost-dot { display: inline-block; width: 9px; height: 9px; margin: 0 4px 0 0; border-radius: 50%; border: 1.5px solid #fff; vertical-align: -1px; }
.fkt-ghost-dot--you { background: #22c55e; }
.fkt-ghost-dot--rec { background: #f59e0b; margin-left: 6px; }
.fkt-ghost-bad { color: #fca5a5; }
.fkt-issues { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fkt-issue { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; cursor: pointer;
    border: 1px solid var(--rd-border, #e2e8f0); border-left: 4px solid #dc2626; background: var(--rd-surface, #fff); color: inherit; font: inherit; }
.fkt-issue:hover, .fkt-issue:focus-visible { background: var(--rd-danger-soft, #fdf0ef); }
.fkt-issue strong { font-size: 13px; }
.fkt-issue span { font-size: 12.5px; color: var(--rd-muted, #64748b); }
.fkt-issue em { font-size: 12px; font-style: normal; color: var(--rd-accent, #2563eb); }
.fkt-issue--cut, .fkt-issue--shortcut { border-left-color: #d97706; }

/* FKT Analysis tab: the player on its own map, and the per-mile heat key */
.fkt-ghost-hud--tab { bottom: 54px; }
.race-analysis-map .fkt-player { z-index: 7; }
.fkt-sw--heat { width: 46px; background: linear-gradient(90deg, #16a34a, #facc15, #dc2626); border-radius: 3px; }
.fkt-heat-key { display: inline-flex; align-items: center; gap: 6px; }
.fkt-info { font-size: 12.5px; line-height: 1.5; color: #0f172a; }

.fkt-info__sub { color: #475569; }

.splits-table tr.is-current td { font-weight: 600; background: rgba(37, 99, 235, 0.06); }

.fkt-maptype { display: inline-flex; margin: 10px; padding: 3px; gap: 2px; border-radius: 999px; background: var(--rd-surface, #fff); box-shadow: 0 1px 4px rgba(15, 23, 42, 0.3); }
.fkt-maptype button { border: 0; background: transparent; color: var(--rd-muted, #475569); font: inherit; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.fkt-maptype button.is-active { background: #0f2a4a; color: #fff; }
.dark-mode .fkt-maptype button.is-active { background: #3b82f6; }

.fkt-zoom { display: flex; flex-direction: column; margin: 10px; border-radius: 12px; overflow: hidden; background: var(--rd-surface, #fff); box-shadow: 0 1px 4px rgba(15, 23, 42, 0.3); }
.fkt-zoom button { width: 34px; height: 34px; border: 0; background: transparent; color: var(--rd-muted, #475569); font: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.fkt-zoom button + button { border-top: 1px solid var(--rd-border, #d8dee8); }
.fkt-zoom button:hover { background: rgba(37, 99, 235, 0.08); color: #0f2a4a; }
