:root {
    /* Backgrounds — warm charcoal with subtle depth */
    --bg-deep: #0a0a0c;
    --bg-surface: #131316;
    --bg-card: #1a1a1f;
    --bg-elevated: #222228;
    --bg-hover: #2a2a32;
    /* Borders */
    --border-subtle: #28282e;
    --border-medium: #38383f;
    --border-strong: #48484f;
    /* Text — warm whites */
    --text-primary: #eae8e4;
    --text-secondary: #9e9a94;
    --text-tertiary: #6a6660;
    --text-muted: #464440;
    /* Accent — electric amber/gold */
    --accent: #e8a830;
    --accent-dim: #b8842a;
    --accent-glow: rgba(232,168,48,0.12);
    /* Sport discipline colors — vibrant */
    --swim: #38bdf8;
    --bike: #f59e0b;
    --gym: #34d399;
    --run: #f87171;
    /* Semantic */
    --green: #34d399;
    --red: #f87171;
    --orange: #fb923c;
    --blue: #38bdf8;
    --purple: #a78bfa;
    /* Typography */
    --font-display: 'Instrument Serif', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    /* Shadows */
    --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 0 0 1px var(--border-subtle);
    --shadow-elevated: 0 8px 24px rgba(0,0,0,0.5), 0 0 0 1px var(--border-subtle);
    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-medium: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Custom dropdown (replaces native select) */
.cp-select { position: relative; display: inline-block; }
.cp-select-trigger {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    background: var(--bg-elevated); border: 1px solid var(--border-medium);
    color: var(--text-primary); padding: 7px 12px; border-radius: var(--radius-sm);
    font-family: inherit; font-size: inherit; cursor: pointer;
    transition: border-color var(--transition-fast); min-width: 80px;
    user-select: none; white-space: nowrap;
}
.cp-select-trigger:hover { border-color: var(--border-strong); }
.cp-select.open .cp-select-trigger { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.cp-select-arrow { font-size: 0.65em; color: var(--text-tertiary); transition: transform var(--transition-fast); }
.cp-select.open .cp-select-arrow { transform: rotate(180deg); }
.cp-select-dropdown {
    display: none; position: absolute; top: calc(100% + 4px); left: 0; min-width: 100%;
    background: var(--bg-card); border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-elevated);
    z-index: 200; max-height: 200px; overflow-y: auto;
    padding: 4px 0;
}
.cp-select.open .cp-select-dropdown { display: block; }
.cp-select.drop-up .cp-select-dropdown { top: auto; bottom: calc(100% + 4px); }
.cp-select-option {
    padding: 7px 12px; cursor: pointer; font-size: 0.9em;
    color: var(--text-secondary); transition: background var(--transition-fast);
    white-space: nowrap;
}
.cp-select-option:hover { background: var(--bg-hover); color: var(--text-primary); }
.cp-select-option.selected { color: var(--accent); font-weight: 600; }
.cp-select-dropdown::-webkit-scrollbar { width: 4px; }
.cp-select-dropdown::-webkit-scrollbar-track { background: transparent; }
.cp-select-dropdown::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 2px; }
/* Inline selects (filter bar etc) */
.filter-bar .cp-select-trigger, .prof-field .cp-select-trigger { font-size: inherit; }
.filter-bar .cp-select-trigger { background: var(--bg-deep); padding: 5px 10px; font-family: var(--font-mono); font-size: 0.75em; color: var(--text-secondary); }
/* Hide original select when upgraded */
select.cp-upgraded { display: none !important; }

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    background-image: radial-gradient(ellipse at 50% 0%, rgba(200,164,85,0.03) 0%, transparent 50%);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* LOGIN SCREEN */
#login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    background: var(--bg-deep);
}
.login-video {
    position: absolute;
    top: 50%; left: 50%;
    min-width: 100%; min-height: 100%;
    width: auto; height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
    opacity: 0;
    transition: opacity 2s ease;
    z-index: 0;
}
.login-video.active { opacity: 1; }
.login-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(12,11,10,0.7) 0%, rgba(12,11,10,0.4) 40%, rgba(12,11,10,0.75) 100%),
        radial-gradient(ellipse at 50% 50%, transparent 30%, rgba(12,11,10,0.5) 100%);
    z-index: 1;
}
.login-box {
    text-align: center;
    max-width: 400px;
    width: 90%;
    padding: 60px 40px 48px;
    position: relative;
    z-index: 2;
}
.login-icon {
    border-radius: 16px;
    margin-bottom: 12px;
    animation: loginFadeIn 0.8s ease both;
}
.login-brand {
    font-family: var(--font-display);
    font-size: 3.4em;
    color: #fff;
    font-weight: 400;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    text-shadow: 0 2px 20px rgba(0,0,0,0.5);
    animation: loginFadeIn 0.8s ease both;
}
.login-tagline {
    color: var(--accent);
    font-size: 0.85em;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 32px;
    text-shadow: 0 1px 10px rgba(0,0,0,0.5);
    animation: loginFadeIn 0.8s ease 0.15s both;
}
.login-value {
    color: rgba(255,255,255,0.75);
    font-size: 0.88em;
    line-height: 1.6;
    margin-bottom: 36px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    text-shadow: 0 1px 8px rgba(0,0,0,0.4);
    animation: loginFadeIn 0.8s ease 0.3s both;
}
.login-google-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    animation: loginFadeIn 0.8s ease 0.45s both;
}
.login-sports-ticker {
    overflow: hidden;
    margin: 0 -40px 32px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #fff 15%, #fff 85%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0%, #fff 15%, #fff 85%, transparent 100%);
    animation: loginFadeIn 0.8s ease 0.35s both;
}
.ticker-track {
    display: flex;
    white-space: nowrap;
    animation: tickerScroll 25s linear infinite;
}
.ticker-track span {
    font-family: var(--font-display);
    font-size: 0.72em;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    flex-shrink: 0;
    padding: 0 4px;
}
.ticker-dot {
    color: var(--accent) !important;
    font-size: 0.45em !important;
    opacity: 0.6;
    vertical-align: middle;
}
@keyframes tickerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.login-footer {
    color: rgba(255,255,255,0.35);
    font-size: 0.7em;
    margin-top: 24px;
    letter-spacing: 0.05em;
    animation: loginFadeIn 0.8s ease 0.6s both;
}
.login-footer a { color: var(--text-tertiary); text-decoration: none; }
.login-footer a:hover { color: var(--accent); }
@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.login-box .error {
    color: var(--red);
    font-size: 0.82em;
    margin-top: 12px;
    display: none;
    font-weight: 500;
}
#app-content { display: none; }

/* NAVIGATION */
nav {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}
nav .nav-inner {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    align-items: stretch;
}
nav .logo {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: 1.25em;
    font-weight: 400;
    padding: 16px 24px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}
.last-updated {
    font-family: var(--font-mono);
    font-size: 0.7em;
    color: var(--text-tertiary);
    padding: 4px 10px;
    border-radius: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    margin-right: 8px;
    white-space: nowrap;
}
.refresh-btn {
    background: none;
    border: 1px solid var(--border-subtle);
    color: var(--text-tertiary);
    font-size: 1.1em;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 8px;
    transition: all 0.2s;
}
.refresh-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}
.refresh-btn.spinning {
    animation: spin 1s linear infinite;
    color: var(--accent);
    pointer-events: none;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.last-updated.stale {
    color: #d9534f;
    border-color: #d9534f;
}
nav .logo span {
    color: var(--text-tertiary);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.6em;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border: 1px solid var(--border-medium);
    padding: 2px 8px;
    border-radius: 3px;
}
nav ul {
    list-style: none;
    display: flex;
    margin-left: auto;
    gap: 2px;
    padding-right: 8px;
}
nav li { padding: 0; }
nav a {
    display: flex;
    align-items: center;
    padding: 0 18px;
    height: 100%;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.82em;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    position: relative;
}
nav a:hover {
    color: var(--text-primary);
    background: var(--accent-glow);
}
nav a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.nav-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-right: 8px;
}

/* Hamburger — hidden on desktop */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px;
    margin-left: auto;
    flex-direction: column;
    gap: 5px;
    z-index: 102;
}
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all 0.3s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Nav avatar */
.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-medium);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.65em;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}
.nav-avatar:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}
.nav-avatar.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #0c0b0a;
}
.nav-sync-dot {
    position: absolute; bottom: -1px; right: -1px; width: 8px; height: 8px;
    border-radius: 50%; border: 2px solid var(--bg-surface);
    display: none;
}
.nav-sync-dot.fresh { display: block; background: #34d399; }
.nav-sync-dot.stale { display: block; background: var(--accent); }
.nav-sync-dot.error { display: block; background: #f87171; }
.nav-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.nav-avatar-wrap { position: relative; }
.avatar-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    min-width: 160px;
    z-index: 200;
    overflow: hidden;
}
.avatar-menu.open { display: block; }
.avatar-menu a {
    display: block;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85em;
    transition: all 0.15s;
    border-bottom: 1px solid var(--border-subtle);
}
.avatar-menu a:last-child { border-bottom: none; }
.avatar-menu-divider { height: 1px; background: var(--border-subtle); margin: 4px 0; }
/* Settings */
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 0.9em; color: var(--text-primary); }
.settings-control { display: flex; gap: 4px; }
.settings-theme-btn { padding: 6px 16px; border: 1px solid var(--border-medium); border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary); font-family: var(--font-body); font-size: 0.82em; cursor: pointer; transition: all var(--transition-fast); }
.settings-theme-btn.active { background: var(--accent); color: var(--bg-deep); border-color: var(--accent); font-weight: 600; }
.settings-theme-btn:hover:not(.active) { border-color: var(--accent-dim); color: var(--text-primary); }
.avatar-menu-setting { display: flex !important; justify-content: space-between; align-items: center; }
.avatar-menu-toggle { font-size: 1.1em; opacity: 0.6; }
.avatar-menu-logout { color: var(--text-tertiary) !important; font-size: 0.8em !important; }
.avatar-menu-logout:hover { color: #f87171 !important; }
.avatar-menu a:hover { background: var(--accent-glow); color: var(--text-primary); }
.ath-sub-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0;
    position: sticky;
    top: 82px;
    z-index: 60;
    background: var(--bg-deep);
}
.ath-sub-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.85em;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
}
.ath-sub-tab:hover { color: var(--text-primary); }
.ath-sub-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.ath-tab-content { display: none; }
.ath-tab-content.active { display: block; }

/* CONTENT LAYOUT */
.page {
    display: none;
    padding: 104px 20px 40px;
    max-width: 1080px;
    margin: 0 auto;
    animation: pageIn 0.3s ease-out;
}
.page.active { display: block; }

@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* RECOVERY SCORE */
.recovery-widget {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 32px 24px 28px;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.recovery-widget::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.04;
    background: radial-gradient(circle at 50% 30%, currentColor 0%, transparent 70%);
    pointer-events: none;
}
.recovery-score-ring {
    display: inline-block;
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 12px;
}
.recovery-score-ring svg {
    width: 140px;
    height: 140px;
    transform: rotate(-90deg);
}
.recovery-score-ring .ring-bg {
    fill: none;
    stroke: var(--border-subtle);
    stroke-width: 6;
}
.recovery-score-ring .ring-fill {
    fill: none;
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.recovery-green .ring-fill { stroke: var(--green); }
.recovery-yellow .ring-fill { stroke: var(--accent); }
.recovery-orange .ring-fill { stroke: var(--orange); }
.recovery-red .ring-fill { stroke: var(--red); }
.recovery-score {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-size: 3.2em;
    font-weight: 400;
    line-height: 1;
}
.recovery-green .recovery-score { color: var(--green); }
.recovery-yellow .recovery-score { color: var(--accent); }
.recovery-orange .recovery-score { color: var(--orange); }
.recovery-red .recovery-score { color: var(--red); }
.recovery-label {
    color: var(--text-tertiary);
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 500;
}
.recovery-status {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-top: 6px;
    font-weight: 500;
}
.recovery-bar { display: none; }
.recovery-fill { display: none; }

/* STATS BAR */
.stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}
.stat {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 12px;
    text-align: center;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-fast);
}
.stat:hover {
    border-color: var(--border-medium);
    transform: translateY(-1px);
}
.stat .value {
    font-family: var(--font-mono);
    font-size: 1.6em;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: -0.02em;
}
.stat .label {
    font-size: 0.7em;
    color: var(--text-tertiary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}
.stat.green .value { color: var(--green); }
.stat.red .value { color: var(--red); }

/* FILTER BAR */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}
.filter-label {
    color: var(--text-tertiary);
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
    margin-right: 4px;
}
.filter-btn {
    background: transparent;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    padding: 5px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.75em;
    font-weight: 500;
    transition: all var(--transition-fast);
}
.filter-btn:hover {
    border-color: var(--accent-dim);
    color: var(--accent);
    background: var(--accent-glow);
}
.filter-btn.active {
    background: var(--accent);
    color: var(--bg-deep);
    border-color: var(--accent);
    font-weight: 600;
}
.filter-sep {
    width: 1px;
    height: 20px;
    background: var(--border-medium);
    margin: 0 6px;
}
.filter-select {
    background: var(--bg-deep);
    padding: 5px 28px 5px 10px;
    font-family: var(--font-mono);
    font-size: 0.75em;
    color: var(--text-secondary);
}

/* CHARTS */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 20px 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition-fast);
}
.chart-container:hover {
    border-color: var(--border-medium);
}
.ts-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
    justify-content: center;
}
.ts-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7em;
    color: var(--text-tertiary);
}
.ts-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
}
.chart-container h2 {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: 1.15em;
    font-weight: 400;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
}
canvas { max-height: 320px; }

/* TODAY'S TRAINING */
.today-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
}
.today-card h2 {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: 1.15em;
    font-weight: 400;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
}
.today-rest {
    color: var(--green);
    font-size: 1.1em;
    font-weight: 500;
}
.today-session {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 10px;
}
.today-title {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 6px;
}
.today-detail {
    color: var(--text-secondary);
    font-size: 0.85em;
    line-height: 1.5;
}

/* POPUP / MODAL */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(8,7,6,0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    justify-content: center;
    align-items: center;
}
.popup-overlay.show { display: flex; }
.popup {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 640px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 24px 48px rgba(0,0,0,0.5);
    animation: popIn 0.2s ease-out;
}
@keyframes popIn {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.popup h3 {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: 1.2em;
    font-weight: 400;
    margin-bottom: 14px;
}
.popup .popup-details {
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.7;
}
/* YouTube popup */
.yt-popup { text-align: center; }
.yt-frame { width: 100%; height: 400px; border: none; border-radius: 8px; background: #000; }
.yt-open-btn { display: inline-block; padding: 10px 24px; background: #d9534f; color: #fff; text-decoration: none; border-radius: 6px; font-weight: 600; font-size: 0.9em; transition: background 0.2s; }
.yt-open-btn:hover { background: #c9302c; text-decoration: none; }
@media (max-width: 600px) { .yt-frame { height: 250px; } }

.popup-close {
    float: right;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.4em;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.popup-close:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

/* CALENDAR */
.calendar {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.calendar th {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    padding: 10px;
    text-align: center;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    border: 1px solid var(--border-subtle);
}
.calendar td {
    border: 1px solid var(--border-subtle);
    vertical-align: top;
    padding: 6px;
    height: 100px;
    background: var(--bg-card);
    transition: background var(--transition-fast);
}
.cal-empty { background: var(--bg-surface) !important; }
.cal-day { position: relative; }
.cal-today {
    background: rgba(200,164,85,0.06) !important;
    border-color: var(--accent-dim) !important;
}
.cal-has-training { background: rgba(75,168,196,0.04) !important; }
.cal-num {
    font-family: var(--font-mono);
    font-size: 0.75em;
    color: var(--text-tertiary);
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}
.cal-today .cal-num {
    color: var(--accent);
    font-weight: 600;
}
.cal-session {
    font-size: 0.68em;
    padding: 3px 6px;
    margin: 2px 0;
    background: var(--bg-elevated);
    border-radius: 3px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}
.cal-session:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.cal-link { display: block; margin-top: 20px; text-align: center; }
.cal-link a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 500;
    padding: 10px 24px;
    border: 1px solid var(--accent-dim);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    letter-spacing: 0.03em;
}
.cal-link a:hover {
    background: var(--accent);
    color: var(--bg-deep);
    border-color: var(--accent);
}
.cal-month-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    position: sticky;
    top: 54px;
    background: var(--bg-deep);
    z-index: 50;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 12px;
    max-width: 1080px;
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
}
.cal-nav-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1em;
    transition: all var(--transition-fast);
}
.cal-nav-btn:hover {
    border-color: var(--accent-dim);
    color: var(--accent);
    background: var(--accent-glow);
}
.cal-month-title {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: 1.3em;
    font-weight: 400;
    min-width: 200px;
    text-align: center;
}
.cal-nav-today {
    background: transparent;
    border: 1px solid var(--accent-dim);
    color: var(--accent);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.78em;
    font-weight: 600;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: all var(--transition-fast);
}
.cal-nav-today:hover {
    background: var(--accent);
    color: var(--bg-deep);
}

@media (max-width: 600px) {
    .calendar td { height: 70px; padding: 3px; }
    .cal-session { font-size: 0.6em; padding: 2px 4px; }
}

/* ZWO DOWNLOADS */
.zwo-downloads {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}
.zwo-downloads h3 {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: 1.15em;
    font-weight: 400;
    margin-bottom: 4px;
}
.zwo-downloads > p {
    color: var(--text-tertiary);
    font-size: 0.82em;
    margin-bottom: 16px;
}
.zwo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}
.zwo-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-card);
}
.zwo-card:hover {
    border-color: var(--accent-dim);
    background: var(--bg-elevated);
    transform: translateY(-2px);
    box-shadow: var(--shadow-elevated);
}
.zwo-icon { font-size: 1.6em; margin-bottom: 6px; opacity: 0.7; }
.zwo-name {
    color: var(--text-primary);
    font-size: 0.82em;
    font-weight: 600;
    text-align: center;
    margin-bottom: 6px;
}
.zwo-dl {
    color: var(--accent);
    font-size: 0.72em;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.zwo-profile {
    width: 100%;
    max-width: 500px;
    height: 140px;
    display: block;
    margin: 8px 0 4px;
    background: var(--bg-deep);
    border-radius: var(--radius-sm);
    padding: 4px;
}
.zwo-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--accent-dim);
    border-radius: var(--radius-sm);
    color: var(--accent);
    text-decoration: none;
    font-size: 0.82em;
    font-weight: 500;
    margin: 4px 0;
    transition: all var(--transition-fast);
}
.zwo-inline:hover {
    background: var(--accent);
    color: var(--bg-deep);
    text-decoration: none;
}
.zwo-btn-icon { margin-right: 2px; }

/* SESSION LOG CARDS */
.session-log-header {
    font-family: var(--font-display);
    font-size: 1.3em;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.session-log-subtitle {
    color: var(--text-tertiary);
    font-size: 0.85em;
    margin-bottom: 20px;
}
.session-log-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition-fast);
    border-left: 4px solid #888;
}
.session-log-card:hover {
    border-color: var(--border-medium);
}
.session-log-card[data-sport="swim"] { border-left-color: var(--swim, #5bc0de); }
.session-log-card[data-sport="bike"] { border-left-color: var(--bike, #e8c547); }
.session-log-card[data-sport="run"] { border-left-color: var(--run, #d9534f); }
.session-log-card[data-sport="strength"] { border-left-color: var(--gym, #34d399); }
.session-log-card[data-sport="multi"] { border-left-color: var(--purple, #a78bfa); }
/* Multi-sport segments */
.multi-sport-segments { display: flex; flex-direction: column; gap: 2px; margin: 8px 0; }
.multi-seg {
    display: grid; grid-template-columns: 24px 50px 70px 60px auto; align-items: center; gap: 6px;
    padding: 6px 8px; background: var(--bg-elevated); border-radius: var(--radius-sm);
    font-family: var(--font-mono); font-size: 0.78em;
}
.multi-seg-transition { opacity: 0.5; padding: 3px 8px; }
.multi-seg-transition .multi-seg-label { font-style: italic; }
.multi-seg-total { border-top: 1px solid var(--border-medium); background: transparent; font-weight: 600; color: var(--text-primary); margin-top: 2px; padding-top: 8px; }
.multi-seg-icon { display: flex; align-items: center; }
.multi-seg-icon svg { width: 14px; height: 14px; }
.multi-seg-label { color: var(--text-secondary); font-family: var(--font-body); font-weight: 500; }
.multi-seg-dist { color: var(--text-primary); }
.multi-seg-dur { color: var(--accent); }
.multi-seg-hr { color: var(--text-tertiary); }
@media (max-width: 500px) {
    .multi-seg { grid-template-columns: 20px 40px 55px 50px auto; font-size: 0.7em; }
}
.session-log-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.session-log-date {
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-size: 0.78em;
    font-weight: 500;
    min-width: 72px;
}
.session-log-sport-icon {
    font-size: 1.2em;
    flex-shrink: 0;
}
.session-log-name {
    font-family: var(--font-display);
    font-size: 1.05em;
    font-weight: 400;
    color: var(--text-primary);
    flex: 1;
}
.session-log-dur-badge {
    font-size: 0.72em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-tertiary);
}
.session-log-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px 16px;
    margin-bottom: 10px;
}
.session-log-metric {
    display: flex;
    flex-direction: column;
}
.session-log-metric-label {
    font-size: 0.68em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
}
.session-log-metric-value {
    font-family: var(--font-mono);
    font-size: 0.92em;
    font-weight: 500;
    color: var(--text-primary);
}
.session-log-intensity-bar {
    height: 4px;
    border-radius: 2px;
    margin: 8px 0;
    background: var(--bg-elevated);
    overflow: hidden;
}
.session-log-intensity-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}
.session-log-intensity-fill.easy { background: #66bb6a; width: 33%; }
.session-log-intensity-fill.moderate { background: #e8c547; width: 66%; }
.session-log-intensity-fill.hard { background: #d9534f; width: 100%; }
.session-log-notes {
    font-size: 0.82em;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 6px;
}
.last-session-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.last-session-card:hover { border-color: var(--accent-dim); }
.last-session-card h3 { font-family: var(--font-display); color: var(--text-primary); font-size: 1em; margin-bottom: 8px; }
.last-session-card .lsc-summary { font-size: 0.85em; color: var(--text-secondary); line-height: 1.5; }
.last-session-card .lsc-link { font-size: 0.8em; color: var(--accent); margin-top: 8px; display: inline-block; }
.session-log-prescribed {
    font-size: 0.82em;
    color: var(--text-secondary);
    padding: 8px 12px;
    margin: 6px 0;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-dim);
    line-height: 1.5;
}
.session-log-prescribed-label {
    color: var(--accent);
    font-weight: 600;
}
.session-log-prescribed-goal {
    color: var(--text-tertiary);
    font-size: 0.9em;
    margin-top: 4px;
}
.session-log-coach {
    font-size: 0.82em;
    color: var(--accent);
    line-height: 1.5;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--accent-glow);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-dim);
}
.session-log-coach-label {
    font-weight: 600;
    font-size: 0.85em;
    margin-bottom: 2px;
    color: var(--accent-dim);
}
.session-log-card { cursor: pointer; }
.session-log-card.expanded { border-color: var(--accent-dim); }
.session-log-expand-icon {
    font-size: 0.7em;
    color: var(--text-tertiary);
    transition: transform 0.2s ease;
    margin-left: 6px;
    flex-shrink: 0;
}
.session-log-card.expanded .session-log-expand-icon { transform: rotate(90deg); }
.session-detail {
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-subtle);
    padding: 16px 4px 12px;
    margin-top: 12px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    animation: slideDown 0.2s ease;
}
@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 600px; }
}
.session-detail-section { margin-bottom: 14px; }
.session-detail-section-title {
    font-size: 0.72em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}
.session-detail-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px 12px;
}
.session-detail-metric {
    display: flex;
    flex-direction: column;
    padding: 6px 10px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}
.session-detail-metric .sdm-label {
    font-size: 0.65em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
}
.session-detail-metric .sdm-value {
    font-family: var(--font-mono);
    font-size: 1em;
    font-weight: 500;
    color: var(--text-primary);
}
.session-detail canvas { max-height: 150px; }
.session-detail-te {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}
.session-detail-te-value {
    font-family: var(--font-mono);
    font-size: 1.4em;
    font-weight: 600;
    color: var(--accent);
}
.session-detail-te-label {
    font-size: 0.82em;
    color: var(--text-secondary);
}

/* WEEK DAY NAVIGATION */
.week-day-nav a {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
}
.week-day-nav a:hover {
    color: var(--accent);
    border-color: var(--accent-dim);
    background: var(--accent-glow);
}
.week-day-nav a.today {
    color: var(--accent);
    border-color: var(--accent-dim);
    background: rgba(200,164,85,0.08);
}
.week-day-nav a.active {
    background: var(--accent);
    color: var(--bg-deep);
    border-color: var(--accent);
}

/* DAY HEADERS */
.day-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    margin: 24px 0 14px;
    border: 1px solid var(--border-subtle);
}
.day-icon { font-size: 1.2em; }
.day-name {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-weight: 400;
    font-size: 1.15em;
}
.day-activity {
    color: var(--text-tertiary);
    font-size: 0.82em;
    margin-left: auto;
    font-weight: 500;
}

/* SESSION CARDS */
.session-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition-fast);
}
.session-card:hover {
    border-color: var(--border-medium);
}
.week-completed-badge {
    font-size: 0.78em;
    color: #66bb6a;
    background: rgba(102,187,106,0.08);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    margin: -4px 0 12px 0;
    font-family: var(--font-mono);
}
.session-title {
    font-family: var(--font-display);
    font-size: 1.1em;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 10px;
}
.session-icon { margin-right: 6px; }
.session-meta-item {
    display: flex;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 0.85em;
}
.meta-key {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.85em;
    font-weight: 500;
    min-width: 90px;
    flex-shrink: 0;
}
.meta-value {
    color: var(--text-secondary);
    line-height: 1.5;
}

/* WORKOUT STEPS */
/* Planned multi-sport segments */
.session-segments { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.session-segment { background: var(--bg-deep); border-radius: var(--radius-sm); padding: 12px 14px; }
.session-segment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.session-segment-header svg { width: 16px; height: 16px; }
.session-segment-title { font-family: var(--font-display); font-size: 0.95em; color: var(--text-primary); flex: 1; }
.session-segment-dur { font-family: var(--font-mono); font-size: 0.78em; color: var(--accent); }
.session-segment-target { font-size: 0.78em; color: var(--accent); margin-top: 6px; font-family: var(--font-mono); }
.session-segment .workout-steps { border: none; padding: 0; background: transparent; margin: 0; }

.workout-steps {
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-top: 12px;
}
.step-item {
    color: var(--text-secondary);
    font-size: 0.85em;
    padding: 5px 0;
    padding-left: 18px;
    position: relative;
    line-height: 1.5;
}
.step-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--border-strong);
}
.step-highlight {
    color: var(--accent);
    font-size: 0.85em;
    padding: 6px 0;
    margin-top: 4px;
    font-weight: 500;
}
.step-section {
    color: var(--green);
    font-size: 0.85em;
    font-weight: 600;
    padding: 8px 0 4px;
    margin-top: 6px;
    border-top: 1px solid var(--border-subtle);
}

/* MARKDOWN CONTENT */
.md-content h1 {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: 1.7em;
    font-weight: 400;
    margin: 28px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
}
.md-content h2 {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: 1.35em;
    font-weight: 400;
    margin: 24px 0 12px;
}
.md-content h3 {
    font-family: var(--font-display);
    color: var(--text-secondary);
    font-size: 1.1em;
    font-weight: 400;
    margin: 16px 0 8px;
}
.md-content p {
    margin: 8px 0;
    line-height: 1.65;
    color: var(--text-secondary);
}
.md-content strong { color: var(--text-primary); }
.md-content a {
    color: var(--blue);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-fast);
}
.md-content a:hover { border-bottom-color: var(--blue); }
.md-content li {
    margin: 4px 0 4px 20px;
    line-height: 1.55;
    color: var(--text-secondary);
}
.md-content code {
    background: var(--bg-elevated);
    padding: 2px 7px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--accent);
    border: 1px solid var(--border-subtle);
}
.md-content hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 28px 0;
}

/* Block headers (season plan) */
.block-header {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    margin: 24px 0 14px;
    font-family: var(--font-display);
    font-size: 1.1em;
    font-weight: 400;
    color: var(--text-primary);
    box-shadow: var(--shadow-card);
}
.md-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.md-content th {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    padding: 10px 14px;
    text-align: left;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    border-bottom: 1px solid var(--border-medium);
}
.md-content td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.85em;
    color: var(--text-secondary);
    transition: background var(--transition-fast);
}
.md-content tr:hover td { background: var(--bg-elevated); }

.generated {
    text-align: center;
    color: var(--text-muted);
    margin: 36px 0;
    font-size: 0.75em;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
}

/* SESSION LOG */
.session-log {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
}
.session-log h2 {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: 1.15em;
    font-weight: 400;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
}
.session-row {
    display: grid;
    grid-template-columns: 56px 28px 1fr auto auto;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
}
.session-row:last-child { border-bottom: none; }
.session-row:hover { background: var(--bg-elevated); }
.session-row-date {
    font-family: var(--font-mono);
    font-size: 0.75em;
    color: var(--text-tertiary);
    font-weight: 500;
}
.session-row-icon { font-size: 1.1em; text-align: center; }
.session-row-name {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.session-row-dur {
    font-family: var(--font-mono);
    font-size: 0.78em;
    color: var(--text-tertiary);
    font-weight: 500;
    text-align: right;
}
.session-row-metric {
    font-family: var(--font-mono);
    font-size: 0.78em;
    color: var(--accent);
    font-weight: 500;
    min-width: 60px;
    text-align: right;
}

/* RACE COUNTDOWN */
.race-countdown {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}
.race-countdown::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-dim), var(--accent), var(--accent-dim));
}
.race-countdown-number {
    font-family: var(--font-display);
    font-size: 3.5em;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 4px;
}
.race-countdown-label {
    color: var(--text-tertiary);
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 500;
    margin-bottom: 16px;
}
.race-progress-bar {
    background: var(--bg-deep);
    border-radius: 4px;
    height: 6px;
    width: 100%;
    max-width: 300px;
    margin: 0 auto 6px;
    overflow: hidden;
}
.race-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-dim), var(--accent));
    border-radius: 4px;
    transition: width 0.5s ease;
}
.race-progress-label {
    font-family: var(--font-mono);
    font-size: 0.7em;
    color: var(--text-muted);
    font-weight: 500;
}

/* TWO-COLUMN CHART GRID */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.charts-grid .chart-full {
    grid-column: 1 / -1;
}

/* STATS TREND ARROWS */
.trend-arrow {
    font-size: 0.6em;
    margin-left: 3px;
    vertical-align: middle;
}
.trend-good { color: var(--green); }
.trend-bad { color: var(--red); }
.trend-stable { color: var(--text-muted); font-size: 0.7em; }

/* BLOCK BREADCRUMB */
.block-breadcrumb {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: 6px 24px;
    font-size: 0.72em;
    color: var(--text-tertiary);
    font-weight: 500;
    letter-spacing: 0.02em;
    position: fixed;
    top: 54px;
    left: 0;
    right: 0;
    z-index: 90;
}
.block-breadcrumb-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding-left: 16px;
}

/* FLOATING ACTION BUTTON */
.fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg-deep);
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(200,164,85,0.4);
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-medium);
}
.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(200,164,85,0.5);
}
.fab:active { transform: scale(0.95); }
.fab.hidden { display: none; }

/* LOADING STATE */
.loading-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.85em;
}
.loading-placeholder::after {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    border: 2px solid var(--border-medium);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 16px auto 0;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .stats {
        grid-template-columns: repeat(3, 1fr);
    }
    .stats .stat:nth-child(4),
    .stats .stat:nth-child(5),
    .stats .stat:nth-child(6) {
        grid-column: span 1;
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .session-row {
        grid-template-columns: 48px 24px 1fr auto;
    }
    .session-row-metric { display: none; }
}

@media (max-width: 700px) {
    .hamburger { display: flex; }
    nav .nav-inner {
        flex-wrap: wrap;
        position: relative;
    }
    nav .logo { padding: 12px 16px; flex: 1; }
    nav ul {
        display: none;
        width: 100%;
        flex-direction: column;
        padding: 0;
        background: var(--bg-surface);
        border-top: 1px solid var(--border-subtle);
        order: 10;
    }
    nav ul.open { display: flex; }
    nav li { width: 100%; }
    nav a {
        padding: 14px 24px;
        height: auto;
        border-bottom: none;
        border-left: 3px solid transparent;
        font-size: 0.85em;
    }
    nav a.active {
        border-bottom: none;
        border-left-color: var(--accent);
        background: var(--accent-glow);
    }
    nav a:hover { background: var(--bg-elevated); }
    .nav-actions { padding-right: 4px; gap: 2px; }
    .last-updated { display: none; }
    .charts-grid { grid-template-columns: 1fr; }
    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    .stat { padding: 10px 8px; }
    .stat .value { font-size: 1.3em; }
    .stat .label { font-size: 0.65em; }
    .chart-container { padding: 14px; border-radius: var(--radius-md); }
    .chart-container h2 { font-size: 1em; }
    .filter-bar { padding: 8px 10px; }
    .day-header { flex-wrap: wrap; padding: 10px 14px; }
    .day-activity { margin-left: 0; width: 100%; margin-top: 4px; }
    .session-card { padding: 14px 16px; }
    .session-log-card { padding: 14px 16px; }
    .session-log-metrics { grid-template-columns: repeat(2, 1fr); }
    .session-log-top { flex-wrap: wrap; gap: 6px; }
    .session-detail-metrics { grid-template-columns: repeat(2, 1fr); }
    .session-meta-item { flex-direction: column; gap: 2px; }
    .meta-key { min-width: auto; }
    .workout-steps { padding: 10px 14px; }
    .zwo-profile { height: 100px !important; }
    .zwo-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .today-card { padding: 14px; }
    .block-header { padding: 10px 14px; font-size: 1em; }
    .md-content table { font-size: 0.8em; }
    .md-content th, .md-content td { padding: 6px 8px; }
    .recovery-score-ring { width: 120px; height: 120px; }
    .recovery-score-ring svg { width: 120px; height: 120px; }
    .recovery-score { font-size: 2.6em; }
    .page { padding: 90px 12px 32px; }
    .race-countdown-number { font-size: 2.5em; }
    .block-breadcrumb { padding: 5px 12px; font-size: 0.65em; top: 44px; }
    .block-breadcrumb-inner { padding-left: 4px; }
    .ath-sub-tabs { top: 68px; }
    .week-top-bar { top: 108px; }
    .fab { width: 48px; height: 48px; font-size: 1.2em; bottom: 20px; right: 20px; }
    /* Athlete page mobile */
    .athlete-header { flex-direction: column; text-align: center; gap: 12px; padding: 20px 16px; }
    .athlete-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .athlete-section { padding: 14px 16px; }
    .athlete-zones-table { font-size: 0.8em; }
    .athlete-equip-list { gap: 6px; }
    .athlete-equip-tag { font-size: 0.8em; padding: 5px 10px; }
    /* Goals mobile */
    .goals-grid { grid-template-columns: 1fr !important; }
    .goals-tabs { flex-wrap: wrap; }
    .goals-page-header { padding: 18px 14px; }
    .goals-page-race-name { font-size: 1.1em; }
    /* Filter bar mobile */
    .filter-bar { flex-wrap: wrap; gap: 4px; }
    .filter-btn { padding: 4px 8px; font-size: 0.7em; }
}

/* LIGHT THEME */
[data-theme="light"] {
    --bg-deep: #f7f6f3;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-elevated: #f0eee9;
    --bg-hover: #e8e6e0;
    --border-subtle: #e0ddd6;
    --border-medium: #ccc8bf;
    --border-strong: #aca89e;
    --text-primary: #18171a;
    --text-secondary: #504e48;
    --text-tertiary: #888480;
    --text-muted: #b0aca5;
    --accent: #b8841e;
    --accent-dim: #8e6618;
    --accent-glow: rgba(184,132,30,0.1);
    --swim: #0891b2;
    --bike: #b8841e;
    --gym: #059669;
    --run: #dc2626;
    --green: #059669;
    --red: #dc2626;
    --orange: #d97706;
    --blue: #0891b2;
    --shadow-card: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px var(--border-subtle);
    --shadow-elevated: 0 4px 16px rgba(0,0,0,0.08), 0 0 0 1px var(--border-subtle);
}
[data-theme="light"] .zwo-profile {
    background: var(--bg-elevated);
}

/* THEME TOGGLE */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    margin: auto 16px auto 0;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}
.theme-icon-sun { display: none; }
.theme-icon-moon { display: inline; }
[data-theme="light"] .theme-icon-sun { display: inline; }
[data-theme="light"] .theme-icon-moon { display: none; }

/* SESSION COMPLIANCE TRACKER */
.compliance-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
}
.compliance-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}
.compliance-title {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: 1.05em;
    font-weight: 400;
}
.compliance-total {
    font-family: var(--font-mono);
    font-size: 0.82em;
    color: var(--accent);
    font-weight: 500;
}
.compliance-bar-wrap {
    background: var(--bg-deep);
    border-radius: 3px;
    height: 4px;
    width: 100%;
    margin-bottom: 14px;
    overflow: hidden;
}
.compliance-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-dim), var(--accent));
    border-radius: 3px;
    transition: width 0.5s ease;
}
.compliance-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}
.compliance-disc {
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    min-width: 44px;
}
.compliance-dots {
    display: flex;
    gap: 5px;
}
.compliance-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    transition: all var(--transition-fast);
}
.compliance-dot.filled {
    background: var(--green);
    box-shadow: 0 0 6px rgba(106,171,110,0.4);
}
.compliance-dot.empty {
    background: var(--bg-deep);
    border: 2px solid var(--border-medium);
}
.compliance-complete .compliance-disc { color: var(--green); }
.compliance-partial .compliance-disc { color: var(--accent); }
.compliance-partial .compliance-dot.filled { background: var(--accent); box-shadow: 0 0 6px rgba(200,164,85,0.3); }
.compliance-none .compliance-disc { color: var(--text-muted); }
.compliance-unplanned .compliance-disc { color: #5bc0de; }
.compliance-unplanned .compliance-dot.bonus { background: #5bc0de; box-shadow: 0 0 6px rgba(91,192,222,0.4); }
.compliance-dot.bonus { background: #5bc0de; border-radius: 50%; }
.compliance-hours {
    font-size: 0.8em;
    color: var(--text-tertiary);
    margin: 6px 0 10px;
    font-family: var(--font-mono);
}
.compliance-hrs {
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    font-size: 0.9em;
}
.compliance-count {
    font-family: var(--font-mono);
    font-size: 0.72em;
    color: var(--text-muted);
    margin-left: auto;
    font-weight: 500;
}

/* WEEK SELECTOR / TOP BAR */
.week-top-bar {
    position: sticky;
    top: 124px;
    background: var(--bg-deep);
    z-index: 50;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 12px;
    padding-top: 8px;
}
.week-selector {
    display: block;
    width: 100%;
    max-width: 260px;
    margin: 0 auto 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.82em;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: border-color var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236e695f' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}
.week-selector:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.week-day-nav {
    display: flex;
    gap: 4px;
    padding: 0 0 12px;
}

/* Gantt Timeline */
.gantt-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 24px 20px 16px;
    margin-bottom: 32px;
}
.gantt-title {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    letter-spacing: 0.02em;
}
.gantt-svg {
    width: 100%;
    height: auto;
    max-height: 230px;
}
@media (max-width: 700px) {
    .gantt-container {
        padding: 16px 10px 10px;
        margin-bottom: 20px;
    }
    .gantt-svg {
        max-height: 180px;
    }
}
/* GOALS */
.goals-summary {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
}
.goals-summary-title {
    font-family: var(--font-display);
    font-size: 1.1em;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}
.goals-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}
.goal-mini-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}
.goal-mini-name {
    font-size: 0.78em;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}
.goal-mini-bar {
    background: var(--bg-deep);
    border-radius: 3px;
    height: 5px;
    overflow: hidden;
    margin-bottom: 4px;
}
.goal-mini-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.goal-mini-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.68em;
    color: var(--text-tertiary);
}
.goal-milestone-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.goal-milestone-row:last-child { border-bottom: none; }
.goal-milestone-check {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6em;
    flex-shrink: 0;
}
.goal-milestone-check.completed {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}
.goal-milestone-check.pending {
    border-color: var(--accent);
}
.goal-milestone-name {
    font-size: 0.78em;
    color: var(--text-secondary);
    flex: 1;
}
.goal-milestone-date {
    font-size: 0.68em;
    color: var(--text-tertiary);
}
.goal-status-badge {
    font-size: 0.62em;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.goal-status-badge.completed { background: var(--green); color: #fff; }
.goal-status-badge.pending { background: var(--accent); color: #000; }
.goal-status-badge.planned { background: var(--bg-elevated); color: var(--text-tertiary); border: 1px solid var(--border-subtle); }
.goal-status-badge.active { background: rgba(91,192,222,0.15); color: #5bc0de; }

/* Athlete Profile */
.athlete-header {
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}
.athlete-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 2em;
    color: #0c0b0a;
    font-weight: 700;
    flex-shrink: 0;
}
.athlete-avatar-img {
    object-fit: cover;
    border: 3px solid var(--accent);
    background: var(--bg-elevated);
}
.athlete-info h2 { font-family: var(--font-display); margin: 0 0 4px 0; color: var(--text-primary); }
.athlete-info p { margin: 0; color: var(--text-secondary); font-size: 0.9em; }
.athlete-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
}
.athlete-section h3 {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: 1.1em;
    margin: 0 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}
.athlete-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.athlete-stat {
    text-align: center;
    padding: 12px 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}
.athlete-stat .value {
    font-family: var(--font-mono);
    font-size: 1.3em;
    color: var(--accent);
    font-weight: 600;
}
.athlete-stat .label {
    font-size: 0.8em;
    color: var(--text-tertiary);
    margin-top: 4px;
}
.athlete-zones-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}
.athlete-zones-table th {
    text-align: left;
    padding: 6px 10px;
    color: var(--text-tertiary);
    font-weight: 500;
    border-bottom: 1px solid var(--border-subtle);
}
.athlete-zones-table td {
    padding: 6px 10px;
    color: var(--text-secondary);
}
.athlete-zones-table tr:nth-child(even) td { background: var(--bg-elevated); }
.zone-bar {
    height: 6px;
    border-radius: 3px;
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
}
.athlete-equip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.athlete-editable {
    cursor: pointer;
    position: relative;
    transition: all 0.15s;
    border-bottom: 1px dashed var(--border-medium);
    padding-bottom: 1px;
}
.athlete-editable:hover {
    border-bottom-color: var(--accent);
}
.athlete-editable::after {
    content: '\270E';
    font-size: 0.55em;
    color: var(--text-tertiary);
    margin-left: 4px;
    vertical-align: super;
}
.athlete-editable:hover::after { color: var(--accent); }
.athlete-stat.editing .athlete-editable { display: none; }
.athlete-stat .athlete-inline-input {
    display: none;
    width: 80px;
    background: var(--bg-deep);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 1em;
    text-align: center;
    padding: 4px 6px;
    outline: none;
}
.athlete-stat.editing .athlete-inline-input { display: inline-block; }
.athlete-section-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    min-height: 36px;
}
.athlete-save-btn {
    background: var(--accent);
    color: #0c0b0a;
    border: none;
    border-radius: var(--radius-md);
    padding: 8px 22px;
    font-family: var(--font-body);
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: none;
}
.athlete-save-btn.visible { display: inline-block; }
.athlete-save-btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.athlete-save-btn:active { transform: translateY(0); }
.athlete-save-btn.saving {
    opacity: 0.6;
    pointer-events: none;
}
.athlete-save-status {
    font-size: 0.8em;
    color: var(--text-tertiary);
}
.athlete-unsaved-dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    display: none;
    margin-left: 6px;
}
.athlete-unsaved-dot.visible { display: inline-block; }
.athlete-equip-tag {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 6px 14px;
    font-size: 0.85em;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.athlete-equip-remove {
    cursor: pointer;
    color: var(--text-tertiary);
    font-size: 0.9em;
    line-height: 1;
    transition: color 0.15s;
    display: none;
}
.athlete-equip-remove:hover { color: #d9534f; }
.athlete-section.editing .athlete-equip-remove { display: inline; }
.athlete-equip-add {
    display: none;
    align-items: center;
    gap: 6px;
}
.athlete-section.editing .athlete-equip-add { display: inline-flex; }
.athlete-equip-add input {
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    font-size: 0.85em;
    color: var(--text-primary);
    font-family: var(--font-body);
    outline: none;
    width: 140px;
}
.athlete-equip-add input:focus { border-color: var(--accent); }
.athlete-equip-add select {
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 6px 8px;
    font-size: 0.85em;
    color: var(--text-primary);
    font-family: var(--font-body);
}
.athlete-equip-add button {
    background: var(--bg-elevated);
    border: 1px solid var(--accent-dim);
    border-radius: var(--radius-md);
    color: var(--accent);
    padding: 6px 12px;
    font-size: 0.85em;
    cursor: pointer;
}
.athlete-equip-add button:hover { background: var(--accent-glow); }
/* Garmin Integration Panel */
.garmin-panel-title {
    cursor: pointer;
    user-select: none;
}
.garmin-toggle-icon {
    font-size: 0.7em;
    transition: transform 0.2s;
    display: inline-block;
}
.garmin-panel-body.collapsed {
    display: none;
}
.garmin-panel-body.collapsed ~ .garmin-panel-title .garmin-toggle-icon {
    transform: rotate(-90deg);
}
.garmin-status-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.garmin-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-tertiary);
    flex-shrink: 0;
}
.garmin-status-indicator.fresh { background: #66bb6a; box-shadow: 0 0 8px rgba(102,187,106,0.4); }
.garmin-status-indicator.stale { background: var(--accent); }
.garmin-status-indicator.error { background: #d9534f; }
.garmin-status-info {
    flex: 1;
    min-width: 120px;
}
.garmin-status-label {
    font-size: 0.7em;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.garmin-status-value {
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 2px;
}
.garmin-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}
.garmin-metric {
    text-align: center;
    padding: 10px 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}
.garmin-metric .gm-value {
    font-family: var(--font-mono);
    font-size: 1.2em;
    color: var(--accent);
    font-weight: 600;
}
.garmin-metric .gm-label {
    font-size: 0.7em;
    color: var(--text-tertiary);
    margin-top: 3px;
}
.garmin-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.garmin-action-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    padding: 8px 16px;
    font-family: var(--font-body);
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.garmin-action-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}
.garmin-action-btn.saving {
    opacity: 0.5;
    pointer-events: none;
}
.garmin-btn-icon { font-size: 1.1em; }
.garmin-btn-primary {
    background: var(--accent) !important;
    color: #0c0b0a !important;
    border-color: var(--accent) !important;
    font-weight: 600;
}
.garmin-btn-primary:hover { filter: brightness(1.15); }
.garmin-section-label {
    font-size: 0.75em;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 14px 0 6px;
}
.garmin-account-toggle { cursor: pointer; }
.garmin-account-link { transition: color 0.2s; }
.garmin-account-toggle:hover .garmin-account-link { color: var(--accent); }
.garmin-creds-arrow {
    font-size: 0.7em;
    display: inline-block;
    transition: transform 0.2s;
}
.garmin-creds-arrow.open { transform: rotate(180deg); }
.garmin-sync-section { margin-top: 4px; }
.garmin-sync-bar-wrap { margin-bottom: 14px; }
.garmin-sync-bar {
    height: 6px;
    background: var(--bg-deep);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}
.garmin-sync-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}
.garmin-sync-bar-label {
    font-family: var(--font-mono);
    font-size: 0.75em;
    color: var(--text-tertiary);
}
.garmin-sync-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.82em;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236e695f'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    cursor: pointer;
}
.garmin-sync-select:focus { border-color: var(--accent); outline: none; }
.garmin-sync-date {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.82em;
    color-scheme: dark;
}
.garmin-sync-date:focus { border-color: var(--accent); outline: none; }
.garmin-sync {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.garmin-sync-period {
    display: flex;
    align-items: center;
    gap: 6px;
}
.garmin-sync-period label {
    font-size: 0.75em;
    color: var(--text-tertiary);
}
.garmin-sync-period input[type="date"] {
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 6px 8px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8em;
}
.garmin-sync-period input[type="date"]:focus { border-color: var(--accent); outline: none; }
.garmin-creds {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 14px;
    border: 1px solid var(--border-subtle);
}
.garmin-creds-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.garmin-creds-row:last-child { margin-bottom: 0; }
.garmin-creds-row label {
    font-size: 0.8em;
    color: var(--text-tertiary);
    min-width: 65px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.garmin-creds-row input {
    flex: 1;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85em;
}
.garmin-creds-row input:focus { border-color: var(--accent); outline: none; }
.garmin-action-status {
    font-size: 0.8em;
    color: var(--text-tertiary);
    margin-top: 8px;
    min-height: 18px;
}

/* SVG Icons */
svg { vertical-align: middle; display: inline-block; }
.day-icon svg { width: 14px; height: 14px; }
.session-log-sport-icon svg { width: 18px; height: 18px; }
.session-icon svg { width: 18px; height: 18px; }
h3 svg { width: 20px; height: 20px; margin-right: 4px; }

/* Feed */
.feed-date-sep { font-family: var(--font-display); font-size: 0.9em; color: var(--text-tertiary); padding: 16px 0 6px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 8px; }
.feed-view-btn { background: var(--bg-elevated); border: 1px solid var(--border-subtle); color: var(--text-tertiary); padding: 5px 10px; font-size: 1em; cursor: pointer; border-radius: var(--radius-sm); transition: all 0.15s; }
.feed-view-btn.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }
.feed-view-btn:hover { border-color: var(--accent-dim); }
.feed-custom-range { display: inline-flex; align-items: center; gap: 6px; }
.feed-custom-range input[type="date"] {
    background: var(--bg-elevated); border: 1px solid var(--border-medium);
    color: var(--text-primary); padding: 4px 8px; border-radius: var(--radius-sm);
    font-family: var(--font-mono); font-size: 0.72em;
}
.feed-custom-range input[type="date"]:focus { border-color: var(--accent); outline: none; }
.feed-pinned { margin-bottom: 16px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 16px; }
.feed-section-title { font-family: var(--font-display); font-size: 1em; color: var(--text-tertiary); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.feed-section-title svg { width: 16px; height: 16px; color: var(--accent); }
.feed-cal-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; }
.feed-cal-arrow { background: none; border: 1px solid var(--border-subtle); color: var(--text-secondary); padding: 4px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.8em; }
.feed-cal-arrow:hover { border-color: var(--accent); color: var(--accent); }
.feed-cal-title { font-family: var(--font-display); font-size: 1.1em; color: var(--text-primary); min-width: 140px; text-align: center; }
.feed-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.feed-cal-header { text-align: center; font-size: 0.7em; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; padding: 6px 0; }
.feed-cal-cell { min-height: 70px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 4px; position: relative; }
.feed-cal-cell.today { border-color: var(--accent); }
.feed-cal-cell.empty { background: transparent; border-color: transparent; min-height: 0; }
.feed-cal-num { font-size: 0.72em; color: var(--text-tertiary); font-family: var(--font-mono); margin-bottom: 2px; }
.feed-cal-cell.today .feed-cal-num { color: var(--accent); font-weight: 600; }
.feed-cal-dots { display: flex; flex-direction: column; gap: 2px; }
.feed-cal-dot { font-size: 0.6em; padding: 1px 4px; border-radius: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity 0.15s; }
.feed-cal-dot:hover { opacity: 0.8; }
.feed-popup-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1000; display: flex; justify-content: center; align-items: flex-start; padding: 60px 16px; overflow-y: auto; }
.feed-popup { background: var(--bg-deep); border: 1px solid var(--border-medium); border-radius: var(--radius-lg); max-width: 600px; width: 100%; padding: 20px; position: relative; max-height: 80vh; overflow-y: auto; }
.feed-popup-close { position: absolute; top: 10px; right: 14px; background: none; border: none; color: var(--text-tertiary); font-size: 1.2em; cursor: pointer; }
.feed-popup-close:hover { color: var(--text-primary); }
@media (max-width: 700px) { .feed-cal-cell { min-height: 50px; } .feed-cal-dot { font-size: 0.5em; } }
.feed-planned-wrap { position: relative; opacity: 0.75; }
.feed-type-badge { position: absolute; top: 8px; right: 12px; font-size: 0.6em; padding: 2px 8px; border-radius: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; z-index: 1; }
.feed-type-badge.planned { background: rgba(155,89,182,0.15); color: #9b59b6; }

/* Coach Page */
.coach-block-status {
    background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
    padding: 20px 24px; margin-bottom: 16px; box-shadow: var(--shadow-elevated);
    position: relative; overflow: hidden;
}
.coach-block-status::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-dim));
}
.cbs-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cbs-block-info { flex: 1; }
.coach-block-name { font-family: var(--font-display); font-size: 1.2em; color: var(--text-primary); margin-bottom: 2px; }
.coach-block-week { font-size: 0.78em; color: var(--text-tertiary); }
.cbs-race-countdown { text-align: right; }
.cbs-race-days { font-family: var(--font-mono); font-size: 1.8em; font-weight: 700; color: var(--accent); line-height: 1; }
.cbs-race-label { font-size: 0.65em; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; }
/* Week segments */
.cbs-weeks { display: flex; gap: 4px; margin-bottom: 16px; }
.cbs-week-seg { flex: 1; height: 6px; border-radius: 3px; background: var(--bg-elevated); position: relative; transition: background 0.3s; }
.cbs-week-seg.done { background: var(--accent); }
.cbs-week-seg.current { background: var(--accent); opacity: 0.6; animation: cbsPulse 2s ease-in-out infinite; }
.cbs-week-seg.recovery { background: var(--blue); opacity: 0.4; }
@keyframes cbsPulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }
.cbs-week-labels { display: flex; gap: 4px; margin-top: 2px; margin-bottom: 14px; }
.cbs-week-label { flex: 1; font-size: 0.6em; text-align: center; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.cbs-week-label.current { color: var(--accent); font-weight: 600; }
/* Gauges row */
.cbs-gauges { display: flex; gap: 8px; }
.cbs-gauge { flex: 1; background: var(--bg-elevated); border-radius: var(--radius-md); padding: 14px 12px; text-align: center; position: relative; }
.cbs-gauge-ring { width: 56px; height: 56px; margin: 0 auto 8px; position: relative; }
.cbs-gauge-ring svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.cbs-gauge-ring-track { fill: none; stroke: var(--bg-hover); stroke-width: 5; }
.cbs-gauge-ring-fill { fill: none; stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 0.8s ease; }
.cbs-gauge-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-family: var(--font-mono); font-size: 1.1em; font-weight: 700; }
.cbs-gauge-label { font-size: 0.65em; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.cbs-gauge-sub { font-size: 0.72em; color: var(--text-secondary); font-family: var(--font-body); margin-top: 2px; }
@media (max-width: 500px) {
    .cbs-gauges { flex-wrap: wrap; }
    .cbs-gauge { min-width: 90px; }
    .cbs-race-days { font-size: 1.4em; }
}
.coach-section { margin-bottom: 20px; }
.coach-section-title { font-family: var(--font-display); font-size: 1.1em; color: var(--text-primary); margin: 0 0 12px; }
.coach-log-filters { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.coach-log-entry {
    background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
    padding: 14px 18px; margin-bottom: 8px; cursor: pointer; transition: border-color 0.2s;
}
.coach-log-entry:hover { border-color: var(--border-medium); }
.coach-log-entry-header { display: flex; align-items: center; gap: 10px; }
.coach-log-date { font-family: var(--font-mono); font-size: 0.75em; color: var(--text-tertiary); min-width: 75px; }
.coach-log-type {
    font-size: 0.65em; padding: 2px 8px; border-radius: 8px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.coach-log-type.daily_digest { background: rgba(91,192,222,0.15); color: #5bc0de; }
.coach-log-type.session_review { background: rgba(102,187,106,0.15); color: #66bb6a; }
.coach-log-type.weekly_review { background: rgba(232,197,71,0.15); color: var(--accent); }
.coach-log-type.plan { background: rgba(155,89,182,0.15); color: #9b59b6; }
.coach-log-type.block_review { background: rgba(255,152,0,0.15); color: #ff9800; }
.coach-log-type.adjustment { background: rgba(217,83,79,0.15); color: #d9534f; }
.coach-log-title { flex: 1; font-size: 0.9em; color: var(--text-primary); font-weight: 500; }
.coach-grade-badge {
    font-size: 0.65em; padding: 2px 8px; border-radius: 8px; font-weight: 600; text-transform: uppercase;
}
.coach-grade-badge.nailed-it { background: rgba(102,187,106,0.15); color: #66bb6a; }
.coach-grade-badge.close { background: rgba(232,197,71,0.15); color: var(--accent); }
.coach-grade-badge.on-track { background: rgba(91,192,222,0.15); color: #5bc0de; }
.coach-grade-badge.missed { background: rgba(217,83,79,0.15); color: #d9534f; }
.coach-log-summary { font-size: 0.82em; color: var(--text-tertiary); margin-top: 6px; }
.coach-log-content { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.coach-log-content.open { display: block; }
.coach-log-content table { width: 100%; border-collapse: collapse; font-size: 0.82em; margin: 8px 0; }
.coach-log-content th, .coach-log-content td { padding: 4px 8px; text-align: left; border-bottom: 1px solid var(--border-subtle); }
.coach-log-content th { color: var(--text-tertiary); font-weight: 600; }
.coach-log-content strong { color: var(--text-primary); }
.coach-log-content h2, .coach-log-content h3 { font-family: var(--font-display); color: var(--accent); margin: 12px 0 6px; font-size: 1em; }
.coach-log-expand { font-size: 0.75em; color: var(--text-muted); }
.session-review-toggle { background: none; border: none; color: var(--accent); font-size: 0.78em; cursor: pointer; padding: 4px 0; margin-top: 4px; }
.session-review-toggle:hover { text-decoration: underline; }
.session-log-coach-summary { font-size: 0.82em; color: var(--text-secondary); margin-top: 4px; }

/* Unified card accordion pattern */
.card-accordions { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.card-accordion { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); overflow: hidden; }
.card-accordion-header {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: var(--bg-elevated); cursor: pointer; transition: background var(--transition-fast);
    user-select: none;
}
.card-accordion-header:hover { background: var(--bg-hover); }
.card-accordion-icon { color: var(--text-tertiary); flex-shrink: 0; }
.card-accordion-icon svg { width: 14px; height: 14px; }
.card-accordion-label { font-family: var(--font-body); font-size: 0.75em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); flex-shrink: 0; }
.card-accordion-summary { flex: 1; font-size: 0.78em; color: var(--text-secondary); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-accordion-arrow { color: var(--text-muted); font-size: 0.8em; flex-shrink: 0; transition: transform var(--transition-fast); }
.card-accordion-body { display: none; padding: 12px 14px 12px 16px; border-top: 1px solid var(--border-subtle); background: var(--bg-deep); border-left: 3px solid var(--accent-dim); margin-left: 8px; }
.card-accordion-body.open { display: block; }
.card-accordion-body .session-card { margin: 0; box-shadow: none; border: none !important; border-left: none !important; background: transparent; padding: 0; }
.card-accordion-body .session-title { font-family: var(--font-body); font-size: 0.9em; color: var(--text-primary); }
.card-accordion-body .session-icon { display: none; }
.card-accordion-body table { width: 100%; border-collapse: collapse; font-size: 0.82em; margin: 8px 0; }
.card-accordion-body th, .card-accordion-body td { padding: 4px 8px; text-align: left; border-bottom: 1px solid var(--border-subtle); }
.card-accordion-body th { color: var(--text-tertiary); font-weight: 600; }
.card-accordion-body h2, .card-accordion-body h3 { font-family: var(--font-display); color: var(--accent); margin: 12px 0 6px; font-size: 1em; }
.card-accordion-body strong { color: var(--text-primary); }
.card-accordion-body p { font-size: 0.85em; color: var(--text-secondary); margin: 4px 0; line-height: 1.5; }
@media (max-width: 700px) { .card-accordion-summary { max-width: 120px; } }

/* Connection Cards */
.conn-cards { display: flex; flex-direction: column; gap: 16px; }
.conn-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 20px 24px; box-shadow: var(--shadow-card); }
.conn-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border-subtle); }
.conn-card-logo { width: 36px; height: 36px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.2em; font-weight: 700; flex-shrink: 0; }
.conn-card-logo.garmin-logo { background: #1d3c5b; color: #00b9e4; font-family: var(--font-display); font-size: 0.9em; }
.conn-card-logo.strava-logo { background: #fc4c02; color: #fff; font-size: 0.8em; }
.conn-card-title { flex: 1; }
.conn-card-title h4 { margin: 0 0 3px; font-family: var(--font-display); font-size: 1em; color: var(--text-primary); }
.conn-account { font-size: 0.8em; color: var(--text-tertiary); font-family: var(--font-mono); }
.conn-account.connected { color: #66bb6a; }
.conn-status-badge { font-size: 0.72em; padding: 3px 10px; border-radius: 999px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.conn-status-badge.connected { background: rgba(102,187,106,0.15); color: #66bb6a; }
.conn-status-badge.disconnected { background: var(--bg-elevated); color: var(--text-tertiary); }
.strava-connect-btn { display: inline-flex; align-items: center; gap: 8px; background: #fc4c02; color: #fff; border: none; border-radius: var(--radius-md); padding: 10px 20px; font-family: var(--font-body); font-size: 0.88em; font-weight: 600; cursor: pointer; transition: filter 0.2s; }
.strava-connect-btn:hover { filter: brightness(1.1); }
.conn-disconnect-btn { background: transparent; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); color: var(--text-tertiary); padding: 6px 14px; font-size: 0.78em; cursor: pointer; transition: all 0.2s; }
.conn-disconnect-btn:hover { border-color: #d9534f; color: #d9534f; }
.strava-webhook-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75em; color: var(--text-tertiary); margin-top: 10px; }
.strava-webhook-dot { width: 7px; height: 7px; border-radius: 50%; background: #66bb6a; box-shadow: 0 0 6px rgba(102,187,106,0.5); }

/* Profile Questionnaire */
.prof-sport-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85em;
    color: var(--text-secondary);
    transition: all 0.2s;
    margin: 0 6px 6px 0;
}
.prof-sport-chip input { display: none; }
.prof-sport-chip.checked { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.prof-field-row { display: flex; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.prof-field { flex: 1; min-width: 120px; margin-bottom: 6px; }
.prof-field label { display: block; font-size: 0.72em; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 3px; }
.prof-field input, .prof-field select, .prof-field textarea {
    width: 100%; box-sizing: border-box;
    background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
    padding: 7px 10px; color: var(--text-primary); font-family: var(--font-body); font-size: 0.85em;
}
.prof-field select { padding-right: 32px; }
.prof-field input:focus, .prof-field select:focus, .prof-field textarea:focus { border-color: var(--accent); outline: none; }
.prof-field textarea { resize: vertical; }
.prof-add-btn {
    background: none; border: 1px dashed var(--border-medium); border-radius: var(--radius-md);
    color: var(--text-tertiary); padding: 8px 16px; cursor: pointer; font-size: 0.82em; margin-top: 8px;
    transition: all 0.2s;
}
.prof-add-btn:hover { border-color: var(--accent); color: var(--accent); }
.prof-remove-btn {
    position: absolute; top: 8px; right: 8px;
    background: none; border: none; color: var(--text-tertiary); cursor: pointer; font-size: 0.9em;
}
.prof-remove-btn:hover { color: #d9534f; }
.prof-injury-card, .prof-race-card {
    background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
    padding: 12px 14px; margin-bottom: 8px; position: relative;
}
.prof-constraint {
    display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap;
}
.prof-constraint select, .prof-constraint input {
    background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: 4px;
    padding: 6px 8px; color: var(--text-primary); font-size: 0.82em; font-family: var(--font-body);
}
.prof-constraint input { flex: 1; min-width: 150px; }
.prof-constraint .prof-remove-btn { position: static; }
.prof-schedule { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin-bottom: 10px; }
.prof-sched-day { display: flex; align-items: center; gap: 8px; }
.prof-sched-label { font-size: 0.8em; color: var(--text-tertiary); min-width: 30px; font-weight: 600; }
.prof-sched-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.prof-sched-chip {
    display: inline-flex; align-items: center;
    padding: 4px 8px; border: 1px solid var(--border-subtle); border-radius: 4px;
    cursor: pointer; font-size: 0.85em; color: var(--text-tertiary); transition: all 0.15s;
}
.prof-sched-chip input { display: none; }
.prof-sched-chip.checked { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
/* Garmin-sourced field pattern */
.prof-garmin-field { position: relative; }
.prof-garmin-field .prof-source-badge {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 0.65em; padding: 1px 6px; border-radius: 8px;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
    vertical-align: middle; margin-left: 6px;
}
.prof-source-badge.garmin { background: rgba(0,185,228,0.15); color: #00b9e4; }
.prof-source-badge.manual { background: rgba(200,164,85,0.15); color: var(--accent); }
.prof-source-badge.computed { background: rgba(102,187,106,0.15); color: #66bb6a; }
.prof-garmin-field .prof-garmin-ref {
    font-size: 0.72em; color: var(--text-muted); font-family: var(--font-mono);
    margin-top: 2px;
}
.prof-override-toggle {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.72em; color: var(--text-tertiary); cursor: pointer; margin-top: 4px;
}
.prof-override-toggle input { width: 14px; height: 14px; accent-color: var(--accent); }
.prof-computed-value {
    font-family: var(--font-mono); font-size: 1.1em; color: var(--accent);
    font-weight: 600; padding: 6px 0;
}

/* Race history compact list */
/* Time editor (HH:MM:SS) */
.time-editor { display: inline-flex; align-items: center; gap: 2px; font-family: var(--font-mono); font-size: 0.9em; }
.time-num { width: 40px; text-align: center; background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font-mono); font-size: 1em; padding: 8px 4px; -moz-appearance: textfield; }
.time-num::-webkit-inner-spin-button, .time-num::-webkit-outer-spin-button { -webkit-appearance: none; }
.time-num:focus { border-color: var(--accent); outline: none; }

.race-history-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    background: var(--bg-elevated); border-radius: var(--radius-sm);
    cursor: pointer; transition: background var(--transition-fast); margin-bottom: 6px;
}
.race-history-item:hover { background: var(--bg-hover); }
.race-history-icon { flex-shrink: 0; color: var(--text-tertiary); }
.race-history-icon svg { width: 18px; height: 18px; }
.race-history-info { flex: 1; min-width: 0; }
.race-history-event { font-size: 0.9em; color: var(--text-primary); font-weight: 500; }
.race-history-meta { font-size: 0.72em; color: var(--text-tertiary); margin-top: 2px; }
.race-history-splits { font-size: 0.72em; color: var(--text-secondary); margin-top: 4px; display: flex; gap: 10px; align-items: center; }
.race-history-splits svg { width: 12px; height: 12px; vertical-align: middle; }
.race-history-result { font-family: var(--font-mono); font-size: 1em; color: var(--accent); font-weight: 700; flex-shrink: 0; }

.prof-floating-save {
    position: sticky;
    bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    z-index: 50;
    margin-top: 20px;
}
.prof-save-btn {
    background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
    color: var(--text-secondary); padding: 10px 20px; cursor: pointer; font-size: 0.85em; transition: all 0.2s;
}
.prof-save-primary { background: var(--accent); color: #0c0b0a; border-color: var(--accent); font-weight: 600; }
.prof-save-primary:hover { filter: brightness(1.15); }
.prof-save-status { font-size: 0.8em; color: var(--text-tertiary); }
.prof-disc { border-left: 3px solid var(--accent-dim); }
.prof-inline-num { width: 70px; background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font-mono); font-size: 1em; padding: 2px 6px; text-align: right; }
.prof-inline-num:focus { border-color: var(--accent); outline: none; }
.prof-disc-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0; padding: 12px; background: var(--bg-elevated); border-radius: var(--radius-md); }
.prof-zones-collapse { margin-top: 10px; }
.prof-zones-collapse summary { cursor: pointer; color: var(--text-secondary); font-size: 0.85em; padding: 6px 0; }
.prof-zones-collapse summary:hover { color: var(--accent); }
.prof-zones-collapse[open] summary { color: var(--accent); }
.prof-chip-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.prof-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 0.78em; background: var(--bg-elevated); border: 1px solid var(--border-subtle); cursor: pointer; transition: all 0.15s; color: var(--text-secondary); }
.prof-chip input { display: none; }
.prof-chip.checked { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }
.prof-chip:hover { border-color: var(--accent-dim); }
.prof-time-input { display: flex; align-items: center; gap: 2px; font-family: var(--font-mono); }
.prof-time-num { width: 42px; text-align: center; background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font-mono); font-size: 0.9em; padding: 6px 4px; }
.prof-time-num:focus { border-color: var(--accent); outline: none; }
.prof-race-splits { padding: 8px 0 0; border-top: 1px solid var(--border-subtle); margin-top: 8px; }
@media (max-width: 700px) {
    .prof-field-row { flex-direction: column; }
    .prof-schedule { grid-template-columns: 1fr; }
}

.goals-page-sport {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin: 4px 0 8px;
    letter-spacing: 0.02em;
}
.goal-disc-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 8px;
}
.goal-disc-header {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-subtle);
}
.goal-disc-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
}
.goal-disc-field label {
    display: block;
    font-size: 0.72em;
    color: var(--text-tertiary);
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.goal-disc-field input, .goal-disc-field select {
    width: 100%;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 6px 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85em;
    box-sizing: border-box;
}
.goal-disc-field input:focus, .goal-disc-field select:focus { border-color: var(--accent); outline: none; }
.goal-req { color: var(--accent); font-size: 0.85em; }
.goals-top-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.goals-top-bar .goals-tabs { flex: 1; margin-bottom: 0; }
.goals-add-btn-top {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--accent);
    padding: 8px 16px;
    font-family: var(--font-body);
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.goals-add-btn-top:hover { border-color: var(--accent); background: var(--accent-glow); }

/* Goals tabs */
.goals-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.goals-tab {
    padding: 8px 20px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9em;
    transition: all 0.2s;
}
.goals-tab:hover { border-color: var(--accent); color: var(--text-primary); }
.goals-tab.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

/* Goals full page */
.goals-page-header {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    margin-bottom: 24px;
    text-align: center;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}
.goals-page-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-dim), var(--accent), var(--accent-dim));
}
.goals-page-race-name {
    font-family: var(--font-display);
    font-size: 1.6em;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.goals-page-race-meta {
    color: var(--text-tertiary);
    font-size: 0.85em;
    margin-bottom: 8px;
}
.goals-page-target {
    font-size: 0.9em;
    color: var(--accent);
    font-weight: 600;
}
.goals-race-details {
    margin-top: 12px;
    font-size: 0.85em;
    color: var(--text-secondary);
}
.goals-race-course {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.goals-race-targets {
    color: var(--text-tertiary);
    font-size: 0.95em;
}
.goals-race-previous {
    color: var(--text-tertiary);
    font-size: 0.9em;
    margin-top: 4px;
    font-style: italic;
}
.goals-header-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    justify-content: center;
}
.goals-header-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    padding: 4px 12px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
}
.goals-header-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.goals-header-btn-del:hover { border-color: #d9534f; color: #d9534f; }
.goals-section-title {
    font-family: var(--font-display);
    font-size: 1.15em;
    color: var(--text-primary);
    margin: 24px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-subtle);
}
.goals-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
.goal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-card);
}
.goal-card-name {
    font-size: 0.88em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.goal-card-deadline {
    font-size: 0.72em;
    color: var(--text-tertiary);
    margin-bottom: 10px;
}
.goal-bar {
    background: var(--bg-deep);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 6px;
}
.goal-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.goal-card-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.75em;
    color: var(--text-secondary);
}
.goal-card-pct {
    font-weight: 600;
}
.goal-milestones-list {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-card);
    margin-bottom: 20px;
}
.goal-milestone-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.goal-milestone-item:last-child { border-bottom: none; }
.goal-ms-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72em;
    flex-shrink: 0;
}
.goal-ms-check.completed { background: var(--green); border-color: var(--green); color: #fff; }
.goal-ms-check.pending { border-color: var(--accent); }
.goal-ms-info { flex: 1; }
.goal-ms-name { font-size: 0.85em; color: var(--text-primary); font-weight: 500; }
.goal-ms-date { font-size: 0.72em; color: var(--text-tertiary); }
.goal-ms-badge {
    font-size: 0.65em;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.goal-ms-badge.completed { background: var(--green); color: #fff; }
.goal-ms-badge.pending { background: rgba(192,167,71,0.2); color: var(--accent); }
.goal-ms-badge.planned { background: var(--bg-elevated); color: var(--text-tertiary); border: 1px solid var(--border-subtle); }

/* Goals editor */
.goals-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: center; }
.goals-edit-btn, .goals-add-btn { padding: 10px 20px; border-radius: var(--radius-md); font-family: var(--font-body); font-size: 0.85em; cursor: pointer; transition: all 0.2s; }
.goals-edit-btn { background: var(--bg-card); border: 1px solid var(--accent-dim); color: var(--accent); }
.goals-edit-btn:hover { background: var(--accent); color: var(--bg-deep); }
.goals-add-btn { background: var(--accent); border: none; color: var(--bg-deep); font-weight: 600; }
.goals-add-btn:hover { background: var(--accent-dim); }
.goal-editor-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); z-index: 300; justify-content: center; align-items: flex-start; padding-top: 60px; backdrop-filter: blur(4px); }
.goal-editor-overlay.show { display: flex; }
.goal-editor { background: var(--bg-card); border: 1px solid var(--border-medium); border-radius: var(--radius-lg); padding: 28px; max-width: 600px; width: 90%; max-height: 80vh; overflow-y: auto; }
.goal-editor h3 { font-family: var(--font-display); color: var(--accent); margin-bottom: 16px; }
.goal-editor label { display: block; color: var(--text-secondary); font-size: 0.8em; margin: 10px 0 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.goal-editor input, .goal-editor select { width: 100%; padding: 10px 12px; background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font-body); font-size: 0.9em; }
.goal-editor input:focus, .goal-editor select:focus { border-color: var(--accent); outline: none; }
.goal-editor-row { display: flex; gap: 12px; }
.goal-editor-row > div { flex: 1; }
.goal-editor-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.goal-editor-save { padding: 10px 24px; background: var(--accent); border: none; color: var(--bg-deep); border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; }
.goal-editor-cancel { padding: 10px 24px; background: none; border: 1px solid var(--border-subtle); color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer; }
.goal-editor-save:hover { background: var(--accent-dim); }
.goal-editor-delete { padding: 10px 24px; background: none; border: 1px solid #d9534f; color: #d9534f; border-radius: var(--radius-sm); cursor: pointer; margin-right: auto; }
.goal-editor-status { color: var(--accent); font-size: 0.85em; margin-top: 10px; text-align: center; }

@media (max-width: 700px) {
    .goals-grid { grid-template-columns: 1fr; }
    .goals-summary-grid { grid-template-columns: 1fr 1fr; }
    .goals-page-race-name { font-size: 1.2em; }
}
