/* Barlow Condensed (SIL OFL 1.1, voir /fonts/barlow-condensed.LICENSE), servie par le site. */
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/barlow-condensed-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/barlow-condensed-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/barlow-condensed-600-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/barlow-condensed-600-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/barlow-condensed-700-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/barlow-condensed-700-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('/fonts/barlow-condensed-800-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('/fonts/barlow-condensed-800-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

:root {
    /* ── Dark theme (default) ── */
    --bg:           #111111;
    --sidebar-bg:   #191919;
    --surface:      #1e1e1e;
    --surface-2:    #252525;
    --border:       rgba(255,255,255,0.07);
    --border-2:     rgba(255,255,255,0.13);
    --text:         #f0f0f0;
    --muted:        #888888;
    --muted-2:      #4a4a4a;

    --accent:       #caff00;
    --accent-hover: #b5e200;
    --accent-text:  #caff00;
    --accent-light: #caff00;
    --accent-bg:    rgba(202,255,0,0.1);
    --accent-bd:    rgba(202,255,0,0.28);

    --danger:       #ef4444;
    --danger-bg:    rgba(239,68,68,0.12);

    --sidebar-w:    250px;
    --radius:       10px;
    --radius-sm:    6px;
    --radius-lg:    14px;
    --font-display: 'Barlow Condensed', system-ui, sans-serif;
    /* Même famille partout : --font sert aux textes courants, --font-display aux titres */
    --font:         'Barlow Condensed', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --svg-bg:       #161616;
}

[data-theme="light"] {
    --bg:           #f0f0ee;
    --sidebar-bg:   #ffffff;
    --surface:      #ffffff;
    --surface-2:    #e8e8e6;
    --border:       rgba(0,0,0,0.08);
    --border-2:     rgba(0,0,0,0.15);
    --text:         #0a0a0a;
    --muted:        #666660;
    --muted-2:      #999990;
    --accent-text:  #3d6800;
    --accent-light: #3d6800;
    --accent-bg:    rgba(202,255,0,0.12);
    --accent-bd:    rgba(202,255,0,0.45);
    --danger:       #dc2626;
    --danger-bg:    rgba(220,38,38,0.1);
    --svg-bg:       #e4e4e2;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ── Layout ───────────────────────────────────────────────── */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.25s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.25rem 1.1rem 1.15rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-logo-img {
    height: 48px;
    width: auto;
    display: block;
}

/* Logo selon le thème : une seule des deux images est affichée */
[data-theme="light"] .logo-dark,
:root:not([data-theme="light"]) .logo-light { display: none; }

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.5rem;
}

.nav-section { margin-bottom: 1.25rem; }

.nav-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted-2);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0.4rem 0.65rem 0.3rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
    font-family: var(--font-display);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s, color 0.12s;
    margin-bottom: 1px;
    white-space: nowrap;
    min-height: auto;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
[data-theme="light"] .nav-item:hover { background: rgba(0,0,0,0.05); }
.nav-item.active { background: var(--accent-bg); color: var(--accent-light); font-weight: 600; }
.nav-item.dim { opacity: 0.3; cursor: not-allowed; pointer-events: none; }

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}
.nav-icon svg { width: 20px; height: 20px; }

.sidebar-footer {
    padding: 0.75rem 0.5rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 99;
}

/* ── Main area ────────────────────────────────────────────── */

.main-area {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Top bar ──────────────────────────────────────────────── */

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    gap: 1rem;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.top-bar-spacer { flex: 1; }

.user-menu-wrap { position: relative; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 0.3rem 0.75rem 0.3rem 0.3rem;
    cursor: pointer;
    min-height: auto;
    font-family: var(--font);
    transition: background 0.12s, border-color 0.12s;
}
.user-chip:hover { background: var(--surface-2); border-color: var(--border-2); transform: none; }

.user-chip-chevron {
    display: flex;
    align-items: center;
    color: var(--muted);
    transition: transform 0.15s;
}
.user-chip-chevron svg { width: 12px; height: 12px; }
.user-chip[aria-expanded="true"] .user-chip-chevron { transform: rotate(180deg); }

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    min-width: 200px;
    z-index: 200;
    padding: 0.3rem;
}
[data-theme="light"] .user-dropdown { box-shadow: 0 8px 24px rgba(0,0,0,0.1); }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
    min-height: auto;
    font-family: var(--font);
}
button.dropdown-item:hover { background: var(--surface-2); color: var(--text); transform: none; }

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: #0a0a0a;
    flex-shrink: 0;
    text-transform: uppercase;
    font-family: var(--font-display);
}

.user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
}

.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 0.2rem;
    min-height: auto;
    line-height: 1;
    align-items: center;
    justify-content: center;
}
.hamburger svg { width: 22px; height: 22px; }

/* ── Content ──────────────────────────────────────────────── */

.content {
    flex: 1;
    padding: 0 2rem 2.5rem;
}

/* ── Dashboard greeting ───────────────────────────────────── */

.dash-greeting {
    padding: 1.5rem 0 1.25rem;
}

.dash-greeting-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--muted);
    margin-bottom: 0.2rem;
}

.dash-greeting-name {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text);
    line-height: 1.05;
}

/* ── Dashboard main grid ──────────────────────────────────── */

.dash-main-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.25rem;
    align-items: stretch;
}

.dash-main-left {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

/* ── Featured session card ────────────────────────────────── */

.feat-session-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.feat-session-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 0.75rem;
    gap: 1rem;
}

.feat-session-header-icon {
    color: var(--muted-2);
    flex-shrink: 0;
    margin-top: 0.25rem;
}
.feat-session-header-icon svg { width: 22px; height: 22px; }

.feat-session-name {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text);
    line-height: 1;
    margin-bottom: 0.35rem;
}

.feat-session-meta {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}

.feat-session-exercises {
    padding: 0 1.5rem;
    border-top: 1px solid var(--border);
}

.feat-exercise-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}
.feat-exercise-row:last-child { border-bottom: none; }

.feat-exercise-name {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text);
}

.feat-exercise-sets {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-light);
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.03em;
}

.btn-start-session {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    background: var(--accent);
    color: #0a0a0a;
    border: none;
    border-radius: 0;
    padding: 1rem;
    /* le letter-spacing laisse un blanc après la dernière lettre : on recentre */
    padding-left: calc(1rem + 0.12em);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s;
    min-height: auto;
    margin-top: 0.75rem;
}
.btn-start-session:hover { background: var(--accent-hover); }
.btn-start-session > svg, .btn-start-session > i[data-lucide] { width: 20px; height: 20px; top: 0.05em; }

/* ── Volume card ──────────────────────────────────────────── */

.vol-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.vol-card-title,
.card-section-label {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.2rem;
}

.vol-card-total {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-light);
    letter-spacing: -0.01em;
}

/* ── Heatmap sidebar ──────────────────────────────────────── */

.heatmap-side {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    align-self: stretch;
}

.heatmap-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-shrink: 0;
}

.heatmap-side-title {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.heatmap-svg {
    background: var(--svg-bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.heatmap-svg svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ── Colour scale ─────────────────────────────────────────── */

.heat-scale {
    margin-top: 0.75rem;
    flex-shrink: 0;
}

.heat-scale-bar {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--surface-2), #caff00);
}

.heat-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.3rem;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

/* ── Cards ────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.1rem;
}
.card-head h3 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}

.card-badge {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.2rem 0.55rem;
    color: var(--muted);
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent-light);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    min-height: auto;
    font-family: var(--font);
    transition: opacity 0.12s;
}
.link-btn:hover { opacity: 0.7; background: none; transform: none; }

/* ── Section header ───────────────────────────────────────── */

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

/* ── Typographie ──────────────────────────────────────────── */

h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.875rem;
}
h3 { font-size: 0.85rem; font-weight: 500; margin-bottom: 0.5rem; color: var(--muted); }

/* ── Boutons ──────────────────────────────────────────────── */

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: var(--accent);
    color: #0a0a0a;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s, opacity 0.12s;
    min-height: 38px;
    touch-action: manipulation;
    white-space: nowrap;
    font-family: var(--font);
    letter-spacing: 0.02em;
}
button:hover { background: var(--accent-hover); }
button:active { opacity: 0.85; }

/* Suppression : même rendu discret que les boutons secondaires, pas de rouge */
button.secondary, button.danger {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 500;
}
button.secondary:hover, button.danger:hover {
    background: rgba(255,255,255,0.08);
    border-color: var(--border-2);
}
[data-theme="light"] button.secondary:hover,
[data-theme="light"] button.danger:hover {
    background: #dddde0;
    filter: none;
}

button > svg, button > i[data-lucide] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    /* L'icône se centre sur la ligne, l'œil la compare au centre des lettres :
       on la redescend sur le centre capitale/hauteur d'x (valeur mesurée
       pour Barlow Condensed, cf. tests/e2e/typography.spec.js). */
    position: relative;
    top: 0.055em;
}
/* Libellé en capitales : le centre visuel est celui de la capitale */
.badge > svg, .badge > i[data-lucide] { position: relative; top: 0.05em; }
/* Bouton sans libellé : rien à aligner */
.icon-btn > svg, .icon-btn > i[data-lucide] { top: 0; }

/* Bouton icône seule : carré, le libellé vit dans aria-label/title */
.icon-btn { padding: 0.5rem; min-width: 38px; gap: 0; }

/* ── Inputs ───────────────────────────────────────────────── */

input, select, textarea {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    min-height: 38px;
    width: 100%;
    transition: border-color 0.12s;
    font-family: var(--font);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
select option { background: var(--surface); color: var(--text); }

label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.3rem;
}

ul { list-style: none; }

/* ── Listes programmes / séances ──────────────────────────── */

#programs li, #sessions li {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    transition: box-shadow 0.15s;
}
#sessions li.sortable {
    position: relative;
    padding-left: 2.25rem;
    transition: box-shadow 0.15s, transform 0.18s ease;
}
#programs li { cursor: pointer; }
#programs li:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.35); }

.session-exercise-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem 0.75rem 2.25rem;
    margin-bottom: 0.5rem;
    position: relative;
    transition: border-color 0.12s, transform 0.18s ease;
}
.session-exercise-card:hover { border-color: var(--border-2); }
.session-exercise-card.dragging,
#sessions li.dragging {
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    transition: border-color 0.12s;
    z-index: 2;
}
.session-exercise-card.settling,
#sessions li.settling { z-index: 2; }

.session-exercise-handle,
.session-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-2);
    cursor: grab;
    touch-action: none;
    user-select: none;
    transition: color 0.12s;
}
.session-exercise-handle svg,
.session-handle svg { width: 16px; height: 16px; }
.session-exercise-handle:hover,
.session-handle:hover { color: var(--accent); }
.session-exercise-card.dragging .session-exercise-handle,
#sessions li.dragging .session-handle { color: var(--accent); cursor: grabbing; }

.session-exercise-remove {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    width: 20px;
    height: 20px;
    min-height: auto;
    padding: 0;
    background: none;
    border: none;
    color: var(--muted-2);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.12s, background 0.12s;
}
.session-exercise-remove svg { width: 12px; height: 12px; }
.session-exercise-remove:hover { color: var(--text); background: var(--surface-2); }

.session-exercise-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: 1.5rem;
}

.session-exercise-desc {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 0.3rem;
    line-height: 1.45;
}

.view-header {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.view-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.item-actions  { display: flex; gap: 0.4rem; flex-shrink: 0; }

.inline-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.875rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--accent-bd);
}
.inline-form input { flex: 1; min-width: 140px; width: auto; }

#exercise-add-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.875rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
#exercise-add-form select { flex: 2; min-width: 160px; width: auto; }
#exercise-add-form .sets-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
#exercise-add-form .sets-field input { width: 4rem; text-align: center; }
#exercise-add-form .sets-field input[aria-invalid="true"] { border-color: var(--danger); }

.session-exercise-sets {
    margin-left: 0.5rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent);
}

#history-exercises li {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: border-color 0.12s;
}
#history-exercises li:hover { border-color: var(--accent-bd); }

.set-count {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0a0a0a;
    background: var(--accent);
    border-radius: 4px;
    padding: 0.18rem 0.55rem;
    flex-shrink: 0;
}

/* ── Séance en cours ──────────────────────────────────────── */

.workout-exercise {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
}
.workout-exercise.is-current { border-color: var(--accent-bd); }
.workout-exercise.is-done .workout-exercise-head strong { color: var(--muted); }
.workout-exercise:not(.is-current):not(.is-done) .set-count { color: var(--muted); background: var(--surface-2); }
.workout-exercise-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.workout-exercise:not(.is-current) { cursor: pointer; transition: border-color 0.12s; }
.workout-exercise:not(.is-current):hover { border-color: var(--accent-bd); }
.workout-sets tr.is-done { cursor: pointer; }
.workout-sets tr.is-done:hover td { background: var(--surface-2); }
.workout-sets-wrap { margin-top: 0.75rem; }
.workout-sets { min-width: 0; }
.workout-sets th, .workout-sets td { padding: 0.45rem 0.6rem; vertical-align: middle; }
.workout-sets .set-num { color: var(--muted); font-weight: 700; width: 3.5rem; }
.workout-sets td:last-child { width: 1%; text-align: right; }
.workout-sets tr.is-current td { background: var(--accent-bg); }
.workout-sets tr.is-saving { opacity: 0.55; cursor: progress; }
.workout-sets tr.is-saving input { cursor: progress; }
.workout-sets tr.is-pending td { color: var(--muted-2); }
.workout-sets .set-input { width: 100%; min-width: 3.5rem; max-width: 6rem; min-height: 36px; font-size: 1rem; }
.workout-sets #btn-add-set { min-width: 36px; min-height: 36px; padding: 0.35rem; }

.workout-done {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 1rem;
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-text);
}
.workout-done > svg { width: 18px; height: 18px; }

/* ── Table ────────────────────────────────────────────────── */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 280px;
    background: var(--surface);
}
th, td {
    padding: 0.6rem 0.875rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
th {
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: var(--surface-2);
}
tr:last-child td { border-bottom: none; }

/* ── Login ────────────────────────────────────────────────── */

body.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.auth-logo {
    margin-bottom: 2rem;
}
.auth-logo img {
    height: 36px;
    width: auto;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
}
.auth-card h2 { margin-bottom: 1.5rem; font-size: 1.4rem; }
.form-group { margin-bottom: 1rem; }
.form-group input { width: 100%; }
.auth-card button { width: 100%; margin-top: 0.75rem; min-height: 44px; font-size: 0.95rem; }

.error-msg {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.7rem 1rem;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    min-height: 44px;
}
.btn-google:hover { background: #f8f9fa; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }

/* ── Badge ────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    border: none;
    color: var(--muted);
    background: var(--surface-2);
    flex-shrink: 0;
}
.badge.private { color: #0a0a0a; background: var(--accent); }
.badge > svg, .badge > i[data-lucide] { width: 11px; height: 11px; }

.session-date-row td {
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.5rem 0.875rem 0.25rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: none;
}

/* ── Landing ──────────────────────────────────────────────── */

body.landing-page { max-width: 100%; padding: 0; }

.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: var(--sidebar-bg);
    position: sticky;
    top: 0;
    z-index: 10;
}
.landing-nav-logo img { height: 28px; width: auto; }

.landing-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 5rem 2rem 4rem;
    max-width: 720px;
    margin: 0 auto;
}
.landing-hero h1 {
    font-family: var(--font-display);
    font-size: 4.5rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.0;
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    color: var(--text);
}
.landing-hero h1 em { font-style: normal; color: var(--accent-text); }
[data-theme="light"] .landing-hero h1 em { color: var(--accent-text); }
.landing-hero p {
    font-size: 1.05rem;
    color: var(--muted);
    max-width: 460px;
    margin-bottom: 2.5rem;
    line-height: 1.65;
}

.btn-hero {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent);
    color: #0a0a0a;
    border: none;
    border-radius: var(--radius);
    padding: 0.875rem 2rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
    box-shadow: 0 4px 20px rgba(202,255,0,0.25);
    font-family: var(--font);
}
.btn-hero:hover { background: var(--accent-hover); transform: translateY(-1px); }

.landing-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    max-width: 900px;
    margin: 0 auto 5rem;
    padding: 0 2rem;
}
.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: box-shadow 0.2s;
}
.feature-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.35); }
.feature-icon {
    width: 40px; height: 40px;
    background: var(--accent-bg);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1rem;
}
.feature-icon svg { width: 20px; height: 20px; color: var(--accent-light); }
.feature-card h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
.feature-card p { font-size: 0.875rem; color: var(--muted); line-height: 1.55; }

.landing-footer a { color: inherit; }
.landing-footer a:hover { color: var(--accent-text); }

/* ── Pages légales (confidentialité) ─────────────────────── */
.legal-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    line-height: 1.6;
}
.legal-page h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.legal-page h2 { font-size: 1.2rem; margin: 2rem 0 0.5rem; }
.legal-page p, .legal-page li { color: var(--text); }
.legal-page ul { padding-left: 1.25rem; }
.legal-page li { margin-bottom: 0.4rem; }
.legal-page a { color: var(--accent-text); }
.legal-page .legal-updated { color: var(--muted); font-size: 0.85rem; }
.auth-legal { margin-top: 1rem; font-size: 0.8rem; color: var(--muted); text-align: center; }
.auth-legal a { color: var(--accent-text); }

.landing-footer {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--muted-2);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
}

/* ── Bibliothèque exercices ───────────────────────────────── */

.exercise-group { margin-bottom: 1.75rem; }

.exercise-group-title {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.group-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.exercise-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    border-radius: var(--radius);
    margin-bottom: 0.4rem;
    transition: border-color 0.15s;
    cursor: pointer;
}
.exercise-item:hover { border-left-color: var(--accent); border-color: var(--border-2); }

.exercise-item-name {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text);
    min-width: 160px;
}

.chips-row { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.muscle-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    white-space: nowrap;
}
.chip-dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,0.6); flex-shrink: 0; }

/* ── Détail exercice ─────────────────────────────────────── */

.exercise-detail-body { display: flex; gap: 2rem; align-items: flex-start; max-width: 900px; }
.exercise-detail-schema { flex: 1; min-width: 0; }
.exercise-detail-chips { width: 200px; flex-shrink: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.exercise-detail-chips .picker-label { color: var(--muted); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.exercise-detail-chips .muscle-chip-sel { display: block; margin-bottom: 0.35rem; }

/* ── Créateur d'exercice ──────────────────────────────────── */

.exercise-creator { max-width: 900px; }
.creator-name-row { margin-bottom: 1.1rem; }
.creator-primary-group { display: flex; align-items: center; gap: 0.45rem; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 0.5rem; }
.creator-name-row input { font-size: 1rem; font-weight: 500; padding: 0.7rem 1rem; min-height: 46px; margin-bottom: 0.5rem; }
.exercise-description-textarea { resize: vertical; font-size: 0.875rem; line-height: 1.5; padding: 0.6rem 0.75rem; min-height: 38px; }

.muscle-picker { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.muscle-picker-header { display: flex; align-items: center; justify-content: space-between; padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--border); gap: 0.75rem; flex-wrap: wrap; }
.picker-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text); }

.face-tabs { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; }
.face-tab { background: none; border: none; color: var(--muted); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.22rem 0.65rem; border-radius: 4px; cursor: pointer; min-height: auto; font-family: var(--font); transition: background 0.12s, color 0.12s; white-space: nowrap; }
.face-tab.active { background: var(--accent); color: #0a0a0a; }
.face-tab:hover:not(.active) { background: rgba(255,255,255,0.07); color: var(--text); }
[data-theme="light"] .face-tab:hover:not(.active) { background: rgba(0,0,0,0.06); }

.muscle-picker-svg { background: var(--svg-bg); padding: 0.5rem; }
.muscle-picker-svg svg { max-height: 480px; max-width: 100%; width: auto; height: auto; display: block; margin: 0 auto; }

.muscle-selection-info { padding: 0.75rem 1.1rem; border-top: 1px solid var(--border); display: flex; align-items: flex-start; gap: 0.75rem; min-height: 50px; flex-wrap: wrap; }
.selection-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding-top: 0.2rem; flex-shrink: 0; white-space: nowrap; }
.muscle-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; flex: 1; }
.no-selection { font-size: 0.78rem; color: var(--muted-2); font-style: italic; padding-top: 0.15rem; }

.muscle-chip-sel { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.4rem 0.2rem 0.6rem; border-radius: 4px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #fff; cursor: pointer; transition: opacity 0.12s; user-select: none; }
.muscle-chip-sel:hover { opacity: 0.85; }
.chip-x { display: inline-flex; align-items: center; opacity: 0.75; margin-left: 2px; }
.chip-x > svg, .chip-x > i[data-lucide] { width: 11px; height: 11px; }
.chip-primary { box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(255,255,255,0.4); }
.chip-star { font-size: 0.65rem; margin-right: 1px; }

/* ── Utilitaires ──────────────────────────────────────────── */

.muted   { color: var(--muted); font-size: 0.875rem; }
.date-edit-cell { display: flex; align-items: center; gap: 0.5rem; }
.hist-edit-btn, .hist-done-btn { padding: 0.25rem; min-width: 26px; min-height: auto; font-size: 0.75rem; flex-shrink: 0; }
.hist-edit-btn > svg, .hist-done-btn > svg { width: 13px; height: 13px; }
.edit-date-input { background: none; border: none; border-bottom: 1px solid var(--muted); color: var(--text); font-size: 0.8rem; font-family: inherit; padding: 0.1rem 0; cursor: pointer; width: auto; max-width: 150px; min-height: auto; }
.set-input { width: 60px; padding: 0.15rem 0.3rem; min-height: 28px; font-size: 0.85rem; }
.arrow   { color: var(--muted-2); flex-shrink: 0; }
.small   { font-size: 0.8rem; }
.empty { color: var(--muted); font-style: italic; padding: 1.5rem 1rem; text-align: center; border: none !important; background: none !important; }

[hidden] { display: none !important; }

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 1100px) {
    .dash-main-grid { grid-template-columns: 1fr; }
    .heatmap-side { position: static; }
}

@media (max-width: 640px) {
    .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-area { margin-left: 0; }
    .hamburger { display: flex; }
    .content { padding: 0 1rem 1.5rem; }
    .top-bar { padding: 0.75rem 1rem; gap: 0.5rem; }
    .user-name { display: none; }
    .user-chip-chevron { display: none; }
    .user-chip { padding: 0.2rem; border-radius: 50%; }
    .view-header { flex-direction: column; gap: 0.5rem; }
    .view-actions { width: 100%; }
    .view-actions button { flex: 1; min-width: 0; }
    .view-actions .icon-btn { flex: 0 0 auto; }
    .item-actions .icon-btn { flex: 0 0 auto; }
    .inline-form { flex-direction: column; }
    .inline-form input, .inline-form button { width: 100%; }
    .workout-sets th, .workout-sets td { padding: 0.4rem 0.3rem; }
    .workout-sets .set-num { width: 2rem; }
    #exercise-add-form { flex-direction: column; }
    #exercise-add-form select, #exercise-add-form button { width: 100%; }
    #programs li, #sessions li { flex-direction: column; align-items: flex-start; }
    .item-actions { width: 100%; flex-wrap: wrap; gap: 0.3rem; }
    .item-actions button { flex: 1; }
    .item-actions button:not(.icon-btn) { padding-inline: 0.5rem; }
    .landing-features { grid-template-columns: 1fr; padding: 0 1.25rem; }
    .landing-hero { padding: 3rem 1.25rem 2.5rem; }
    .landing-hero h1 { font-size: 2.75rem; }
    .face-tab[data-face="both"] { display: none; }
    .exercise-detail-body { flex-direction: column; }
    .exercise-detail-chips { width: 100%; }
    .dash-greeting-name { font-size: 1.8rem; }
}

/* ── Modale de confirmation ───────────────────────────────── */

.confirm-dialog {
    margin: auto;
    width: min(380px, calc(100vw - 2rem));
    padding: 0; /* le padding vit sur le form : un clic sur le dialog lui-même = clic sur le fond */
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-lg);
    font-family: var(--font);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.confirm-dialog::backdrop {
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
}
.confirm-dialog form { padding: 1.25rem; }
.confirm-dialog p {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}
.confirm-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
