/* ============================================================
   Suivi Sport — Design System
   ============================================================ */

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

:root {
    --bg:            #090912;
    --bg-card:       rgba(255,255,255,0.04);
    --bg-card-hover: rgba(255,255,255,0.065);
    --bg-input:      rgba(255,255,255,0.06);
    --border:        rgba(255,255,255,0.08);
    --border-focus:  rgba(124,58,237,0.6);

    --accent:        #7c3aed;
    --accent-light:  #a78bfa;
    --accent-2:      #3b82f6;
    --gradient:      linear-gradient(135deg, #7c3aed 0%, #3b82f6 100%);
    --gradient-text: linear-gradient(135deg, #a78bfa 0%, #60a5fa 100%);

    --success:  #10b981;
    --danger:   #ef4444;
    --warning:  #f59e0b;

    --text:      #f1f5f9;
    --text-dim:  #94a3b8;
    --text-muted:#475569;

    --radius:    14px;
    --radius-sm: 8px;
    --radius-xs: 5px;

    --shadow:    0 4px 24px rgba(0,0,0,0.5);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
    --glow:      0 0 24px rgba(124,58,237,0.25);

    --nav-h:     64px;
    --transition:0.18s ease;
}

/* ── Typography ── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; }

.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Navbar ── */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: rgba(9,9,18,0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 32px;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}
.nav-logo { font-size: 24px; }
.nav-title {
    font-size: 18px;
    font-weight: 800;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-link:hover { color: var(--text); background: var(--bg-card-hover); }
.nav-link.active { color: var(--accent-light); background: rgba(124,58,237,0.15); }

.nav-mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
}
.nav-mobile-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-dim);
    border-radius: 2px;
    transition: var(--transition);
}

/* ── Nav user (desktop) ── */
.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 16px;
    border-left: 1px solid var(--border);
    flex-shrink: 0;
}
.nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gradient);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav-username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav-link-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
}
.nav-link-logout svg { width: 16px; height: 16px; }
.nav-link-logout:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

/* ── Nav user (mobile, dans le menu hamburger) ── */
.nav-mobile-user { display: none; }

/* ── Main content ── */
.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: calc(var(--nav-h) + 32px) 24px 64px;
}

/* ── Page header ── */
.page-header {
    margin-bottom: 32px;
}
.page-header h1 {
    font-size: clamp(24px, 4vw, 36px);
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}
.page-header p { color: var(--text-dim); font-size: 15px; }

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: background var(--transition), border-color var(--transition);
}
.card:hover { background: var(--bg-card-hover); }
.card-sm { padding: 16px; }
.card-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* ── Stat cards (dashboard) ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), border-color var(--transition);
}
.stat-card:hover { transform: translateY(-2px); border-color: rgba(124,58,237,0.3); }
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient);
    opacity: 0.04;
}
.stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    background: rgba(124,58,237,0.15);
    margin-bottom: 14px;
    font-size: 20px;
}
.stat-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 4px;
}
.stat-label { font-size: 13px; color: var(--text-dim); }

/* ── Grids ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 > * { min-width: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    user-select: none;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 4px 12px rgba(124,58,237,0.35);
}
.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(124,58,237,0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255,255,255,0.07);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.12); }

.btn-danger {
    background: rgba(239,68,68,0.12);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-success {
    background: rgba(16,185,129,0.12);
    color: var(--success);
    border: 1px solid rgba(16,185,129,0.2);
}
.btn-success:hover { background: rgba(16,185,129,0.2); }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.06);
    color: var(--text-dim);
    border: 1px solid var(--border);
}
.btn-icon:hover { background: rgba(255,255,255,0.12); color: var(--text); }
.btn-icon svg { width: 16px; height: 16px; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 7px;
    letter-spacing: 0.2px;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
    -webkit-appearance: none;
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}
select.form-control option { background: #1e1e3a; }

/* Number input with ± */
.num-input-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color var(--transition);
}
.num-input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }
.num-btn {
    width: 36px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.05);
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    font-weight: 300;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
    user-select: none;
}
.num-btn:hover { background: rgba(124,58,237,0.2); color: var(--accent-light); }
.num-input-inner {
    flex: 1;
    min-width: 0;
    padding: 10px 6px;
    background: none;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    outline: none;
    -moz-appearance: textfield;
}
.num-input-inner::-webkit-inner-spin-button,
.num-input-inner::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ── Séance builder ── */
.exercice-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    transition: border-color var(--transition);
}
.exercice-block:focus-within { border-color: rgba(124,58,237,0.35); }
.exercice-block.sortable-ghost { opacity: .35; }
.exercice-block.sortable-chosen { box-shadow: 0 0 0 2px var(--accent); }

/* Drag handle */
.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    color: var(--text-muted);
    cursor: grab;
    touch-action: none;
    border-radius: 6px;
    transition: color .15s, background .15s;
}
.drag-handle:hover { color: var(--text); background: rgba(255,255,255,.06); }
.drag-handle:active { cursor: grabbing; }

/* Chronomètre flottant */
#timerWrap {
    position: fixed;
    bottom: calc(var(--nav-h) + 16px);
    right: 16px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
#timerFabBtn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
    transition: border-color .2s, box-shadow .2s;
    padding: 0;
    gap: 1px;
}
#timerFabBtn:hover { border-color: var(--accent); box-shadow: 0 4px 20px rgba(124,58,237,.3); }
#timerFabLabel { font-size: 9px; font-weight: 800; color: var(--accent); line-height: 1; }
#timerPanel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    width: 230px;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.timer-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
#timerDisplay {
    font-size: 52px;
    font-weight: 800;
    text-align: center;
    letter-spacing: -2px;
    font-variant-numeric: tabular-nums;
    margin-bottom: 14px;
    transition: color .3s;
}
#timerDisplay.timer-done { color: var(--accent); }
.timer-presets {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 12px;
}
@media (min-width: 769px) {
    #timerWrap { bottom: 24px; }
}

.exercice-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.exercice-select-wrap { flex: 1; }

.series-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.serie-row {
    display: grid;
    grid-template-columns: 28px 1fr 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    animation: slideIn 0.2s ease;
}
.serie-row:hover { background: rgba(255,255,255,0.05); }

.echec-toggle { font-size: 16px; filter: grayscale(1); opacity: 0.45; }
.echec-toggle:hover { filter: grayscale(0.3); opacity: 0.75; }
.echec-toggle.echec-active { filter: none; opacity: 1; background: rgba(251,146,60,0.12); border-color: rgba(251,146,60,0.25); }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.serie-num {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(124,58,237,0.15);
    color: var(--accent-light);
}

.serie-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 3px;
}

/* ── Toggle switch ── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    cursor: pointer;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border);
    border-radius: 28px;
    transition: background 0.2s, border-color 0.2s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    left: 3px; top: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
    background: rgba(124,58,237,0.3);
    border-color: rgba(124,58,237,0.5);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
    background: var(--accent-light);
}

/* ── Badge "En cours" ── */
.badge-encours {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(249,115,22,0.12);
    color: #fb923c;
    border: 1px solid rgba(249,115,22,0.25);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    vertical-align: middle;
    margin-left: 6px;
    white-space: nowrap;
}
.badge-encours::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #fb923c;
    animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.7); }
}

/* ── Badge & tags ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-purple  { background: rgba(124,58,237,0.2); color: var(--accent-light); }
.badge-blue    { background: rgba(59,130,246,0.2); color: #93c5fd; }
.badge-green   { background: rgba(16,185,129,0.2); color: #6ee7b7; }
.badge-orange  { background: rgba(245,158,11,0.2); color: #fcd34d; }
.badge-red     { background: rgba(239,68,68,0.2);  color: #fca5a5; }
.badge-pink    { background: rgba(236,72,153,0.2); color: #f9a8d4; }
.badge-gray    { background: rgba(255,255,255,0.08); color: var(--text-dim); }

.muscle-badge { font-size: 12px; }

/* ── Historique cards ── */
.seance-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    text-decoration: none;
    color: inherit;
    transition: all var(--transition);
    cursor: pointer;
}
.seance-card:hover { background: var(--bg-card-hover); border-color: rgba(124,58,237,0.3); transform: translateX(4px); }

.seance-date-block {
    flex-shrink: 0;
    text-align: center;
    width: 52px;
    padding: 10px 8px;
    background: rgba(124,58,237,0.1);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(124,58,237,0.2);
}
.seance-day   { font-size: 22px; font-weight: 800; color: var(--accent-light); line-height: 1; }
.seance-month { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-top: 2px; }

.seance-info { flex: 1; min-width: 0; }
.seance-name { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.seance-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--text-dim); }
.seance-meta span { display: flex; align-items: center; gap: 4px; }
.seance-meta svg { width: 13px; height: 13px; }

.seance-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Chart container ── */
.chart-wrap {
    position: relative;
    width: 100%;
    height: 300px;
}
.chart-wrap canvas { width: 100% !important; height: 100% !important; }

/* ── Progression page ── */
.prog-selector {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.prog-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.prog-stat {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    text-align: center;
}
.prog-stat-value { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.prog-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Stats récap séance (4 colonnes desktop, 2x2 mobile) */
.recap-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
@media (max-width: 480px) {
    .recap-stats { grid-template-columns: repeat(2, 1fr); }
}

.chart-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
    padding: 4px;
    width: fit-content;
}
.chart-tab {
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-dim);
    transition: all var(--transition);
}
.chart-tab.active { background: var(--gradient); color: #fff; }
.chart-tab:hover:not(.active) { color: var(--text); }

/* ── Exercices management ── */
.exercice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.exercice-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.exercice-item:hover { background: var(--bg-card-hover); border-color: rgba(124,58,237,0.25); }
.exercice-item-name { font-size: 14px; font-weight: 500; }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text-dim); }
.empty-state p  { font-size: 14px; margin-bottom: 24px; }


/* ── Alert / toast ── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.25); color: #6ee7b7; }
.alert-danger  { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.25);  color: #fca5a5; }

#toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    z-index: 999;
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    max-width: 320px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { background: #10b981; color: #fff; box-shadow: 0 4px 20px rgba(16,185,129,0.4); }
#toast.error   { background: #ef4444; color: #fff; box-shadow: 0 4px 20px rgba(239,68,68,0.4); }

/* ── Modal ── */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
    background: #161625;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 480px;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
}
.modal-backdrop.open .modal { transform: scale(1) translateY(0); }
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ── Share card preview ── */
#shareModalBackdrop .modal { max-width: 400px; }
#sharePreview {
    width: 100%;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 32px rgba(124,58,237,0.35);
    margin-bottom: 16px;
    display: block;
}

/* ── Divider ── */
.divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

/* ── Loader ── */
.loader {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 48px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Section title ── */
.section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Muscle group colors ── */
[data-group="Poitrine"]  .muscle-badge { background: rgba(59,130,246,0.15); color: #93c5fd; }
[data-group="Dos"]       .muscle-badge { background: rgba(16,185,129,0.15); color: #6ee7b7; }
[data-group="Épaules"]   .muscle-badge { background: rgba(245,158,11,0.15); color: #fcd34d; }
[data-group="Biceps"]    .muscle-badge { background: rgba(124,58,237,0.15); color: #c4b5fd; }
[data-group="Triceps"]   .muscle-badge { background: rgba(239,68,68,0.15);  color: #fca5a5; }
[data-group="Jambes"]    .muscle-badge { background: rgba(249,115,22,0.15); color: #fdba74; }
[data-group="Fessiers"]  .muscle-badge { background: rgba(236,72,153,0.15); color: #f9a8d4; }
[data-group="Abdos"]     .muscle-badge { background: rgba(20,184,166,0.15); color: #5eead4; }
[data-group="Autre"]     .muscle-badge { background: rgba(255,255,255,0.08); color: var(--text-dim); }

/* ── Dashboard recent sessions ── */
.recent-list { display: flex; flex-direction: column; gap: 10px; }

.recent-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    transition: all var(--transition);
}
.recent-item:hover { background: var(--bg-card-hover); transform: translateX(3px); border-color: rgba(124,58,237,0.25); }
.recent-item-date { font-size: 12px; font-weight: 700; color: var(--accent-light); width: 40px; flex-shrink: 0; text-align: center; }
.recent-item-name { font-size: 14px; font-weight: 600; }
.recent-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.recent-item-arrow { margin-left: auto; color: var(--text-muted); }
.recent-item-arrow svg { width: 16px; height: 16px; }

/* ── Utility ── */
.flex   { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.text-muted { color: var(--text-dim); }
.text-sm    { font-size: 13px; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ── Template items (modal modèles de séance) ── */
#templatesModal .modal {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}
#templatesModal .modal > *:last-child { flex-shrink: 0; }

.templates-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    max-height: 40vh;
    padding-right: 2px; /* évite le scrollbar overlap */
}
.template-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: background var(--transition), border-color var(--transition);
}
.template-item:hover { background: var(--bg-card-hover); border-color: rgba(124,58,237,0.25); }

/* Ligne 1 : nom + boutons sur la même rangée */
.template-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
}
.template-item-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.template-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Ligne 2 : liste exercices (peut wrapper) */
.template-item-exos {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── Note button ── */
.btn-note {
    color: var(--warning);
    border-color: rgba(245,158,11,0.2);
    background: rgba(245,158,11,0.08);
}
.btn-note:hover { background: rgba(245,158,11,0.18); color: var(--warning); }

/* ── Note popup body (lecture seule dans séance) ── */
.note-popup-body {
    background: rgba(245,158,11,0.06);
    border: 1px solid rgba(245,158,11,0.2);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-dim);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Nav logo SVG ── */
.nav-logo-svg { width: 26px; height: 22px; flex-shrink: 0; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .nav-links { display: none; flex-direction: column; position: absolute; top: var(--nav-h); left: 0; right: 0; background: rgba(9,9,18,0.98); border-bottom: 1px solid var(--border); padding: 12px; gap: 4px; }
    body.nav-open .nav-links { display: flex; }
    .nav-mobile-toggle { display: flex; }
    .nav-user { display: none; }
    .nav-mobile-user {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 10px 0 4px;
        border-top: 1px solid var(--border);
        margin-top: 4px;
    }
    .nav-mobile-user-info {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 6px 14px;
        font-size: 13px;
        font-weight: 600;
        color: var(--text-muted);
    }
    .nav-mobile-user .nav-link-logout {
        width: auto;
        height: auto;
        justify-content: flex-start;
        gap: 7px;
        padding: 8px 14px;
        border-radius: var(--radius-sm);
        font-size: 14px;
        font-weight: 500;
        color: var(--text-muted);
    }
    .nav-mobile-user .nav-link-logout:hover { color: var(--danger); background: rgba(239,68,68,0.08); }

    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .seance-card { flex-direction: column; gap: 12px; }
    .seance-actions { align-self: flex-end; }
    .seance-info { align-self: stretch; }
    .main-content { padding-top: calc(var(--nav-h) + 20px); padding-left: 16px; padding-right: 16px; overflow-x: hidden; }
    .exercice-grid { grid-template-columns: 1fr; }

    /* Séance builder mobile */
    .exercice-block { padding: 16px 12px; }
    .exercice-header { flex-wrap: wrap; gap: 8px; }
    .exercice-select-wrap { min-width: 0; }

    /* Chaque série : num + [reps col] + [poids col] + echec + delete sur une ligne */
    .serie-row {
        grid-template-columns: 24px 1fr 1fr auto 38px;
        gap: 6px;
        padding: 10px 8px;
    }
    .num-btn { width: 34px; height: 44px; font-size: 20px; }
    .num-input-inner { font-size: 15px; padding: 10px 2px; }
    .serie-label { font-size: 10px; }
}

@media (max-width: 420px) {
    /* Sur très petits écrans : empiler reps et poids, flamme et croix côte à côte à droite */
    .serie-row {
        grid-template-columns: 24px 1fr 36px 36px;
        grid-template-rows: auto auto;
        grid-template-areas:
            "num reps echec del"
            "num poids echec del";
        row-gap: 6px;
        gap: 6px;
    }
    .serie-row > .serie-num        { grid-area: num; }
    .serie-row > div:nth-of-type(2){ grid-area: reps; }
    .serie-row > div:nth-of-type(3){ grid-area: poids; }
    .serie-row > .echec-toggle     { grid-area: echec; align-self: center; }
    .serie-row > .remove-serie     { grid-area: del;   align-self: center; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .prog-stats-row { grid-template-columns: repeat(2,1fr); }
}

@media (min-width: 421px) and (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .prog-stats-row { grid-template-columns: repeat(2,1fr); }
}
