/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    height: 52px;
    padding: 0 var(--sp-5);
    border-radius: var(--r-md);
    font-size: 16px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-base) var(--ease), filter var(--dur-base) var(--ease), opacity var(--dur-base) var(--ease);
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--grad);
    color: #ffffff;
    box-shadow: var(--shadow-glow);
    width: 100%;
}

.btn-primary:hover {
    filter: brightness(1.06);
}

.btn-secondary {
    width: 100%;
    height: 48px;
    border-radius: var(--r-md);
    border: 1.5px dashed var(--border);
    background: transparent;
    color: var(--orange);
    font-size: 15px;
    font-weight: 700;
    margin: var(--sp-4) 0;
}

.btn-ghost {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    height: 40px;
    padding: 0 var(--sp-4);
    font-size: 14px;
    border-radius: var(--r-sm);
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    flex-shrink: 0;
    transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.icon-btn:active {
    transform: scale(0.92);
}

.icon-btn.icon-btn-ghost {
    border-color: transparent;
    background: transparent;
}

/* ---------- cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}

.card-glass {
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
    box-shadow: var(--shadow-lg);
}

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    box-shadow: var(--shadow-sm);
}

.form-card h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    margin-bottom: var(--sp-3);
}

.form-card h2 svg {
    flex-shrink: 0;
    color: var(--orange);
}

.form-card form,
.form-card .field-stack {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}

.form-error {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
    border-radius: var(--r-sm);
    padding: 10px 12px;
    font-size: 13.5px;
    margin: 0 0 var(--sp-3);
}

/* ---------- stat tiles ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-3);
    margin-bottom: var(--sp-6);
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    box-shadow: var(--shadow-sm);
    transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon-chip {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--grad-soft);
    color: var(--orange);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--sp-1);
}

.stat-label {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 600;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.stat-value-sm {
    font-size: 17px;
}

.stat-sub {
    font-size: 12px;
    color: var(--muted);
}

/* ---------- badges / chips ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--surface-2);
    color: var(--muted);
    padding: 3px 8px;
    border-radius: 999px;
}

.badge-accent {
    background: var(--grad-soft);
    color: var(--orange);
}

.sport-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: var(--r-sm);
    background: color-mix(in srgb, var(--muscle-c, var(--sport-c, var(--red))) 16%, var(--surface));
    color: var(--muscle-c, var(--sport-c, var(--red)));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.chip-group.is-compact {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.chip-group.is-compact::-webkit-scrollbar {
    display: none;
}

.chip-group.is-compact .chip {
    padding: 6px 12px;
    font-size: 12px;
    flex-shrink: 0;
}

.chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 15px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.chip:has(input:checked) {
    background: var(--grad-soft);
    border-color: color-mix(in srgb, var(--orange) 45%, transparent);
    color: var(--orange);
    font-weight: 800;
}

.chip input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* ---------- avatar ---------- */
.avatar {
    border-radius: 50%;
    background: var(--grad);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: var(--shadow-glow);
}

.avatar[class*="sport-color-"] {
    background: var(--sport-c);
}

.avatar-picker {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--sp-2);
}

.avatar-option {
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--sport-c);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}

.avatar-option:hover {
    transform: scale(1.06);
}

.avatar-option.is-active {
    border-color: var(--ink);
}

/* ---------- inputs ---------- */
.form-card label,
label.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-top: var(--sp-3);
    margin-bottom: 6px;
}

.form-card label.chip {
    display: flex;
    margin: 0;
}

.field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.field-label-row label:not(.chip) {
    margin: 0;
}

.form-card input,
.form-card select,
input.input,
select.input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--paper);
    color: var(--ink);
    font-size: 16px;
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.form-card select,
select.input {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a716a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.form-card button[type="submit"] {
    margin-top: var(--sp-4);
}

html[data-theme="dark"] .form-card select,
html[data-theme="dark"] select.input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a79e93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .form-card select,
    html:not([data-theme="light"]) select.input {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a79e93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    }
}

.form-card input:focus,
.form-card select:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px var(--orange-soft);
}

.form-card textarea {
    width: 100%;
    min-height: 76px;
    padding: 12px 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--paper);
    color: var(--ink);
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
}

/* ---------- auto intensity gauge (course/vélo, calculée à partir de la distance/durée) ---------- */
.intensity-gauge {
    --intensity-legere: var(--success);
    --intensity-moderee: #eab308;
    --intensity-soutenue: var(--orange);
    --intensity-intense: var(--danger);
    margin: var(--sp-2) 0 var(--sp-1);
}

.intensity-gauge-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}

.intensity-gauge-track {
    height: 8px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}

.intensity-gauge-fill {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: var(--intensity-legere);
    transition: width 0.25s var(--ease), background-color 0.25s var(--ease);
}

.intensity-gauge[data-level="legere"] .intensity-gauge-fill { background: var(--intensity-legere); }
.intensity-gauge[data-level="moderee"] .intensity-gauge-fill { background: var(--intensity-moderee); }
.intensity-gauge[data-level="soutenue"] .intensity-gauge-fill { background: var(--intensity-soutenue); }
.intensity-gauge[data-level="intense"] .intensity-gauge-fill { background: var(--intensity-intense); }

.card-title-sm {
    font-size: 15.5px;
}

/* ---------- field grid (2 columns for short fields) ---------- */
.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3);
}

.field-full {
    grid-column: 1 / -1;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field label {
    margin-top: 0;
}

.chip-caps {
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 12px;
    font-weight: 700;
}

/* ---------- shades: each sub-category is a tint/shade of its sport's own color ---------- */
.shade-1 { --muscle-c: var(--sport-c); }
.shade-2 { --muscle-c: color-mix(in srgb, var(--sport-c) 80%, white 20%); }
.shade-3 { --muscle-c: color-mix(in srgb, var(--sport-c) 80%, black 20%); }
.shade-4 { --muscle-c: color-mix(in srgb, var(--sport-c) 60%, white 40%); }
.shade-5 { --muscle-c: color-mix(in srgb, var(--sport-c) 60%, black 40%); }
.shade-6 { --muscle-c: color-mix(in srgb, var(--sport-c) 45%, white 55%); }
.shade-7 { --muscle-c: color-mix(in srgb, var(--sport-c) 45%, black 55%); }
.shade-8 { --muscle-c: color-mix(in srgb, var(--sport-c) 70%, #7a4a00 30%); }
.shade-9 { --muscle-c: color-mix(in srgb, var(--sport-c) 30%, black 70%); }
.shade-10 { --muscle-c: color-mix(in srgb, var(--sport-c) 90%, black 10%); }

.chip-muscle {
    background: color-mix(in srgb, var(--muscle-c, var(--sport-c, var(--orange))) 14%, var(--surface));
    border-color: color-mix(in srgb, var(--muscle-c, var(--sport-c, var(--orange))) 40%, transparent);
    color: var(--muscle-c, var(--sport-c, var(--orange)));
}

.chip-muscle:has(input:checked) {
    background: var(--muscle-c, var(--sport-c, var(--orange)));
    border-color: var(--muscle-c, var(--sport-c, var(--orange)));
    color: #ffffff;
}

.exercise-icon-tile.muscle-tinted {
    background: color-mix(in srgb, var(--muscle-c, var(--sport-c, var(--orange))) 18%, var(--surface));
    color: var(--muscle-c, var(--sport-c, var(--orange)));
}

.muscle-heading-plain {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 var(--sp-2);
}

/* ---------- sport tabs (exercise library) ---------- */
.sport-tabs {
    display: flex;
    gap: var(--sp-2);
    overflow-x: auto;
    padding-bottom: var(--sp-2);
    margin-bottom: var(--sp-4);
    scrollbar-width: none;
}

.sport-tabs::-webkit-scrollbar {
    display: none;
}

.sport-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 9px 15px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.sport-color-1 { --sport-c: #ff6a1a; }
.sport-color-2 { --sport-c: #f2600f; }
.sport-color-3 { --sport-c: #eab308; }
.sport-color-4 { --sport-c: #dc2626; }
.sport-color-5 { --sport-c: #fb7185; }
.sport-color-6 { --sport-c: #f97316; }

.sport-tab.active {
    background: var(--sport-c, var(--orange));
    color: #ffffff;
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

.chip-sm {
    padding: 6px 11px;
    font-size: 12px;
    gap: 5px;
}

/* ---------- skeleton ---------- */
.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--surface-2);
    border-radius: var(--r-sm);
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent);
    animation: shimmer 1.6s infinite;
}

@media (prefers-reduced-motion: reduce) {
    .skeleton::after {
        animation: none;
    }
}

/* ---------- hero (dashboard) ---------- */
.hero {
    margin: 0 0 var(--sp-3);
    padding: var(--sp-6) var(--sp-5) 56px;
    border-radius: var(--r-xl);
    background: var(--grad);
    color: #ffffff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-glow);
}

.hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-bg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--red) 80%, transparent) 0%,
        color-mix(in srgb, var(--orange) 84%, transparent) 100%);
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0 10px, transparent 10px 22px);
    pointer-events: none;
}

.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, 0.28), transparent 55%);
    pointer-events: none;
}

.hero-watermark {
    position: absolute;
    right: -20px;
    bottom: -24px;
    color: #ffffff;
    opacity: 0.14;
    transform: rotate(-10deg);
    pointer-events: none;
}

.hero-watermark svg {
    display: block;
}

.hero-avatar {
    position: absolute;
    top: var(--sp-5);
    right: var(--sp-5);
    z-index: 3;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.24);
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(6px);
    color: #ffffff;
    font-weight: 900;
    font-size: 16px;
    overflow: hidden;
}

.hero-text {
    position: relative;
    padding-right: 56px;
}

.hero-eyebrow {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.6em;
    font-weight: 600;
}

.hero-title {
    font-size: clamp(24px, 4vw, 30px);
    font-weight: 900;
    margin: 4px 0 2px;
    position: relative;
}

.hero-sub {
    margin: 0;
    font-size: 13.5px;
    opacity: 0.92;
    position: relative;
}

.hero-streak {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    vertical-align: middle;
}

.hero-cta {
    background: #ffffff;
    color: var(--red);
    box-shadow: none;
    margin-top: var(--sp-4);
    width: auto;
    position: relative;
    height: 48px;
}

.hero-stats {
    margin-top: -42px;
    position: relative;
    z-index: 2;
}

.last-session {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4);
}

.last-session-title {
    font-weight: 700;
    font-size: 14.5px;
}

.last-session-media {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.last-session-media img {
    width: 100%;
    height: 100%;
    border-radius: var(--r-lg);
    object-fit: cover;
}

.last-session-media .sport-icon-badge {
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 24px;
    height: 24px;
    border: 2px solid var(--surface);
}

/* ---------- home page: extra breathing room ---------- */
.dashboard-page .hero {
    margin-bottom: var(--sp-6);
}

.dashboard-page .card-grid {
    gap: var(--sp-4);
}

.dashboard-page .section-title {
    margin-top: var(--sp-8);
}

@media (min-width: 960px) {
    .hero {
        padding: 34px 36px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--sp-6);
    }

    .hero-title {
        font-size: clamp(26px, 2.6vw, 34px);
    }

    .hero-cta {
        margin-top: 0;
        margin-right: var(--sp-5);
    }

    .hero-stats {
        margin-top: 0;
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ---------- exercise library / workout entries ---------- */
.muscle-heading {
    font-size: 12.5px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin: var(--sp-5) 0 var(--sp-2);
}

.exercise-list {
    margin: var(--sp-4) 0;
}

.exercise-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.exercise-card:has(.exercise-checkbox:checked) {
    background: var(--grad-soft);
    border-color: color-mix(in srgb, var(--orange) 40%, transparent);
    box-shadow: var(--shadow-md);
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-items: start;
}

.library-grid .exercise-card {
    margin-bottom: 0;
}

.library-grid .muscle-heading {
    grid-column: 1 / -1;
}

@media (min-width: 960px) {
    .library-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.exercise-card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--surface-2);
    margin-bottom: 10px;
    flex-shrink: 0;
}

.exercise-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.exercise-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muscle-c, var(--sport-c, var(--orange)));
}

.exercise-image-placeholder svg {
    width: 30%;
    height: 30%;
}

.exercise-card-media .favorite-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    color: #ffffff;
    padding: 0;
}

.exercise-card-media .favorite-btn.is-active {
    color: var(--orange);
}

.exercise-card .exercise-desc {
    display: none;
}

.exercise-card-browse {
    position: relative;
    cursor: pointer;
    outline: none;
}

.exercise-hover-info {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 16px;
    border-radius: var(--r-lg);
    background: rgba(10, 8, 6, 0.86);
    color: #ffffff;
    opacity: 0;
    transform: scale(0.98);
    transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
    pointer-events: none;
    overflow-y: auto;
}

.exercise-card-browse:hover .exercise-hover-info,
.exercise-card-browse:focus-visible .exercise-hover-info,
.exercise-card-browse:focus-within .exercise-hover-info {
    opacity: 1;
    transform: scale(1);
}

.exercise-hover-muscle {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--orange);
}

.exercise-hover-name {
    font-size: 14px;
    font-weight: 800;
}

.exercise-hover-info p {
    margin: 4px 0 0;
    font-size: 12.5px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.85);
}

.exercise-detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
}

.exercise-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    margin-bottom: 4px;
}

.exercise-detail-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.exercise-order-badge {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.exercise-detail-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.btn-move-exercise:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.exercise-card-body {
    flex: 1;
    min-width: 0;
}

.exercise-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
}

.exercise-check {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    position: relative;
}

.exercise-check input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.exercise-icon-tile {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--grad-soft);
    color: var(--orange);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.exercise-name {
    font-size: 15px;
    font-weight: 700;
}

.favorite-btn {
    border: none;
    background: none;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    display: flex;
    transition: color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.favorite-btn:active {
    transform: scale(0.85);
}

.favorite-btn.is-active,
.favorite-btn[data-active="true"] {
    color: var(--orange);
}

.exercise-meta,
.exercise-desc {
    font-size: 12.5px;
    color: var(--muted);
    margin: 6px 0 0;
}

.exercise-meta.intro-text {
    margin-bottom: var(--sp-6);
}

.sets-editor {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fade-slide-up 0.3s var(--ease) both;
}

.set-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.set-number {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--surface-2);
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.set-row input[type="number"] {
    width: 64px;
    height: 40px;
    padding: 0 8px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--paper);
    color: var(--ink);
    font-size: 12px;
}

.set-row input[type="number"]::placeholder {
    font-size: 11px;
}

.set-row .set-note {
    flex: 1 1 100px;
    height: 40px;
    padding: 0 10px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--paper);
    color: var(--ink);
    font-size: 12px;
}

@media (max-width: 600px) {
    .set-row input[type="number"] {
        flex: 1 1 72px;
        width: auto;
    }

    .set-row .set-note {
        flex: 1 1 100%;
        order: 5;
    }
}

.btn-remove-set {
    width: 32px;
    height: 32px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    flex-shrink: 0;
}

.btn-add-set {
    align-self: flex-start;
    border: none;
    background: none;
    color: var(--orange);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 0;
}

/* ---------- sport picker ---------- */
.sport-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-3);
}

.sport-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 8px;
    aspect-ratio: 4 / 5;
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--sport-c, var(--orange));
    color: #ffffff;
    font-size: 15px;
    font-weight: 800;
    text-decoration: none;
    padding: var(--sp-4);
    box-shadow: var(--shadow-sm);
    transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}

.sport-card:not(.disabled):hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.sport-card-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sport-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--sport-c, var(--orange)) 30%, transparent) 0%,
        color-mix(in srgb, var(--sport-c, var(--orange)) 60%, black 40%) 100%);
}

.sport-card .sport-icon-badge {
    position: relative;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.sport-card-name {
    position: relative;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.sport-card.disabled {
    filter: grayscale(0.8);
    opacity: 0.6;
    pointer-events: none;
}

.soon-badge {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* ---------- history timeline ---------- */
.history-card {
    padding: var(--sp-4) var(--sp-5);
}

.history-exercise {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    padding: 10px 0;
    border-top: 1px solid var(--border);
}

.history-exercise-name {
    font-size: 14px;
    font-weight: 700;
}

/* ---------- progress charts ---------- */
.chart-wrap {
    position: relative;
    height: 240px;
    margin-top: var(--sp-2);
}

.pr-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-3);
}

.pr-badge {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    position: relative;
}

.pr-badge-new {
    border: 1.5px solid var(--orange);
}

.pr-new-tag {
    position: absolute;
    top: -9px;
    right: var(--sp-3);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--grad);
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 960px) {
    .pr-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.stat-trio {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-2);
}

/* ---------- stats banner ---------- */
.stats-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-4) var(--sp-5);
    box-shadow: var(--shadow-sm);
}

.stats-banner-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stats-banner-updated {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    color: var(--muted);
    font-size: 11px;
}

/* ---------- calendar (planning) ---------- */
.calendar-card {
    padding: var(--sp-4) var(--sp-3);
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-2) var(--sp-3);
}

.calendar-month-label {
    font-weight: 800;
    font-size: 15px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.calendar-weekday {
    text-align: center;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding-bottom: 6px;
}

.calendar-cell {
    min-height: 52px;
    border-radius: 10px;
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 3px;
    position: relative;
}

.calendar-cell.empty {
    background: transparent;
}

.calendar-cell.today {
    background: var(--grad-soft);
    box-shadow: inset 0 0 0 1.5px var(--orange);
}

.calendar-day-number {
    font-size: 11.5px;
    font-weight: 600;
}

.day-bubbles {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.day-bubble {
    display: flex;
    align-items: center;
    gap: 3px;
    border: none;
    border-radius: 999px;
    background: var(--grad);
    color: #ffffff;
    font-size: 8.5px;
    font-weight: 700;
    padding: 2px 6px;
    cursor: pointer;
    line-height: 1.4;
}

.day-bubble svg {
    width: 9px;
    height: 9px;
    flex-shrink: 0;
}

.workout-dialog {
    width: min(420px, calc(100vw - 48px));
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-lg);
}

.workout-dialog::backdrop {
    background: rgba(10, 8, 6, 0.5);
}

@media (min-width: 960px) {
    .calendar-cell {
        min-height: 84px;
        align-items: flex-start;
        justify-content: flex-start;
        padding: 8px;
    }

    .calendar-day-number {
        font-size: 13px;
    }

    .day-bubbles {
        align-items: flex-start;
    }

    .day-bubble {
        font-size: 10px;
    }
}

/* ---------- reminder banner ---------- */
.reminder-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--r-md);
    background: var(--orange-soft);
    color: var(--orange);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.reminder-banner span {
    flex: 1;
}

/* ---------- nutrition ---------- */
.nutrition-layout {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.supplement-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: var(--sp-3) 0 var(--sp-4);
}

.supplement-row {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 6px;
    padding: 12px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.supplement-row:hover {
    border-color: color-mix(in srgb, var(--orange) 40%, transparent);
    background: var(--grad-soft);
}

.supplement-row-head {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
}

.supplement-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.supplement-row:hover .supplement-dot {
    border-color: var(--orange);
}

@media (min-width: 960px) {
    .nutrition-layout {
        flex-direction: row;
        align-items: flex-start;
    }

    .nutrition-supplements {
        width: 340px;
        flex-shrink: 0;
        position: sticky;
        top: 88px;
    }

    .nutrition-timeline {
        flex: 1;
    }
}

.nutrition-card {
    display: flex;
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-5);
    align-items: flex-start;
}

/* ---------- goals ---------- */
.goal-card {
    padding: var(--sp-4) var(--sp-5);
}

.goal-card.goal-achieved {
    opacity: 0.7;
}

.goal-progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
    margin: var(--sp-3) 0 6px;
}

.goal-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--grad);
    transition: width 0.5s var(--ease);
}

/* ---------- profile summary ---------- */
.profile-summary {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}

.profile-avatar {
    width: 60px;
    height: 60px;
    font-size: 22px;
    overflow: hidden;
}

.avatar-edit-trigger {
    position: relative;
    overflow: visible;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform var(--dur-base) var(--ease);
}

.avatar-edit-trigger:hover {
    transform: scale(1.04);
}

.avatar-edit-badge {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink);
    border: 2px solid var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.avatar-dialog {
    width: min(360px, calc(100vw - 48px));
}

.avatar-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-3);
}

.avatar-dialog-header .wizard-step {
    margin: 0;
}

.avatar-dialog .avatar-picker {
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: var(--sp-3);
}

.avatar-dialog .avatar-option {
    width: 100%;
}

.avatar-dialog-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin: var(--sp-3) 0 var(--sp-2);
}

.avatar-color-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.avatar-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--sport-c);
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    transition: transform var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}

.avatar-color-swatch:hover {
    transform: scale(1.08);
}

.avatar-color-swatch.is-active {
    border-color: var(--ink);
}

.avatar-dialog-submit {
    margin-top: var(--sp-4);
    width: 100%;
}


.profile-photo-actions form {
    margin: 0;
}

.profile-summary-name {
    font-size: 19px;
    font-weight: 800;
    margin-bottom: 2px;
}

/* ---------- wizard ---------- */
.wizard-step {
    margin: var(--sp-5) 0 var(--sp-2);
}

.wizard-step:first-child {
    margin-top: 0;
}

/* ---------- wizard (nouvelle séance) ---------- */
.wizard-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: var(--sp-4);
}

.wizard-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    background: var(--surface-2);
    color: var(--muted);
    flex-shrink: 0;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.wizard-dot.is-active {
    background: var(--grad);
    color: #ffffff;
}

.wizard-dot-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    max-width: 60px;
}

.search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.search-field svg {
    position: absolute;
    left: 14px;
    color: var(--muted);
    pointer-events: none;
}

.search-field input {
    width: 100%;
    height: 44px;
    padding: 0 14px 0 40px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
}

.wizard-next,
.wizard-back {
    margin-top: var(--sp-4);
}

.recap-card #recap-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.recap-card .empty-hint {
    padding: var(--sp-2) 0;
}

@media (min-width: 960px) {
    .wizard-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 440px;
        gap: var(--sp-6);
        align-items: start;
    }

    .wizard-page[data-step="2"] {
        display: block !important;
        position: sticky;
        top: var(--sp-6);
        max-height: calc(100vh - var(--sp-6) * 2);
        overflow-y: auto;
        padding-right: var(--sp-1);
    }

    .wizard-next,
    .wizard-back {
        display: none;
    }

    .wizard-progress {
        display: none;
    }
}

@media (max-width: 959px) {
    .sticky-mobile-cta {
        position: fixed;
        left: var(--sp-4);
        right: var(--sp-4);
        bottom: calc(var(--sp-4) + env(safe-area-inset-bottom));
        z-index: 45;
    }
}

/* ---------- toast ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--paper);
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 200;
}
