/*
html5doctor.com Reset Stylesheet
v1.6.1
Last Updated: 2010-09-17
Author: Richard Clark - http://richclarkdesign.com
Twitter: @rich_clark
*/

html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {
    margin:0;
    padding:0;
    border:0;
    outline:0;
    font-size:100%;
    vertical-align:baseline;
    background:transparent;
}

body {
    line-height:1;
}

article,aside,details,figcaption,figure,
footer,header,hgroup,menu,nav,section {
    display:block;
}

nav ul {
    list-style:none;
}

blockquote, q {
    quotes:none;
}

blockquote:before, blockquote:after,
q:before, q:after {
    content:'';
    content:none;
}

a {
    margin:0;
    padding:0;
    font-size:100%;
    vertical-align:baseline;
    background:transparent;
}

del {
    text-decoration: line-through;
}

abbr[title], dfn[title] {
    border-bottom:1px dotted;
    cursor:help;
}

table {
    border-collapse:collapse;
    border-spacing:0;
}

hr {
    display:block;
    height:1px;
    border:0;
    border-top:1px solid #cccccc;
    margin:1em 0;
    padding:0;
}

input, select, button, textarea {
    vertical-align:middle;
    font-family: inherit;
}

/* ============================================
   eriklassen.eu — bold & energetic, mobile-first
   ============================================ */

:root {
    --bg: #ffffff;
    --surface: #f7f2f0;
    --text: #14171a;
    --muted: #75695f;
    --accent: #e8442b;
    --accent-dark: #c7371f;
    --onaccent: #ffffff;
    --border: #ead9d4;
    --navbg: #14171a;
    --navtext: #ffffff;
    --radius: 10px;
    /* Backlog B-20 — the palette has no "positive/success" tone (--accent is
       used for CTAs, not completion state); adding these two rather than
       overloading --accent for two different meanings. */
    --success: #2f9e44;
    --success-bg: #eaf7ec;
    /* Backlog B-20 follow-up — "Not completed" (skipped) is now also a done
       state, just a red one. Reuses --accent itself (already the site's red,
       already used elsewhere for attention/warning text) rather than a new
       hue; only the tinted background is new, mirroring --success-bg. */
    --danger-bg: #fbe9e6;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.main-wrapper {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---------- Header / nav ---------- */

header {
    background: var(--navbg);
}

header nav .main-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    flex-wrap: wrap;
    padding-top: 8px;
    padding-bottom: 8px;
}

.brand {
    display: inline-flex;
    align-items: center;
    height: 56px;
}

/* Backlog B-23 — SVG wordmark, sized to sit comfortably inside the 56px nav row */
.brand-logo {
    height: 30px;
    width: auto;
    display: block;
}

.nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    color: var(--navtext);
    font-size: 22px;
    cursor: pointer;
    order: 3;
}

.nav-menu {
    display: none;
    width: 100%;
    order: 4;
    flex-direction: column;
    border-top: 0.5px solid rgba(255,255,255,0.15);
    margin-top: 8px;
    padding-top: 8px;
}

.nav-menu.open {
    display: flex;
}

header nav ul {
    display: flex;
    flex-direction: column;
    width: 100%;
}

header nav ul li {
    list-style: none;
    width: 100%;
}

header nav ul li a {
    display: block;
    width: 100%;
    padding: 12px 4px;
    font-size: 16px;
    color: var(--navtext);
    min-height: 44px;
    line-height: 20px;
}

header nav ul li a:hover {
    color: var(--accent);
    text-decoration: none;
}

.nav-login {
    width: 100%;
    padding-top: 8px;
    border-top: 0.5px solid rgba(255,255,255,0.15);
    margin-top: 8px;
}

.nav-login form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-login form input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 0.5px solid rgba(255,255,255,0.25);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.08);
    color: var(--navtext);
    font-size: 16px;
}

.nav-login form input::placeholder {
    color: rgba(255,255,255,0.6);
}

.nav-login form button {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--onaccent);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}

.nav-login form button:hover {
    background: var(--accent-dark);
}

.nav-login > a {
    display: block;
    padding: 12px 4px;
    color: var(--navtext);
    font-size: 15px;
}

.nav-login > a:hover {
    color: var(--accent);
}

/* Desktop nav: collapse the hamburger, show inline */
@media (min-width: 760px) {
    .nav-toggle {
        display: none;
    }

    .nav-menu {
        display: flex;
        flex-direction: row;
        align-items: center;
        width: auto;
        order: 2;
        border-top: none;
        margin-top: 0;
        padding-top: 0;
        gap: 8px;
    }

    header nav ul {
        flex-direction: row;
        width: auto;
    }

    header nav ul li {
        width: auto;
    }

    header nav ul li a {
        width: auto;
        padding: 8px 12px;
        min-height: auto;
    }

    .nav-login {
        width: auto;
        display: flex;
        align-items: center;
        gap: 10px;
        border-top: none;
        margin-top: 0;
        padding-top: 0;
    }

    .nav-login form {
        flex-direction: row;
        gap: 6px;
    }

    .nav-login form input {
        width: 150px;
    }

    .nav-login form button {
        width: auto;
        padding: 0 16px;
    }

    .nav-login > a {
        padding: 8px 4px;
    }
}

/* ---------- Page content ---------- */

.main-container {
    padding: 28px 0 40px;
}

.main-container h2 {
    font-size: 26px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 16px;
}

.main-container p {
    margin-bottom: 10px;
    color: var(--text);
}

.main-container ul {
    margin: 0 0 12px 20px;
}

.main-container li {
    list-style: disc;
    margin-bottom: 4px;
}

/* ---------- Buttons ---------- */

.btn,
.btn-default,
button,
input[type="submit"] {
    display: inline-block;
    min-height: 44px;
    padding: 0 20px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--onaccent);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}

.btn:hover,
.btn-default:hover,
button:hover,
input[type="submit"]:hover {
    background: var(--accent-dark);
}

/* ---------- Forms ---------- */

.form-group {
    margin-bottom: 16px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
}

select {
    background-color: var(--bg);
}

/* Signup page */
.signup-form {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding-top: 8px;
}

.signup-form input {
    margin-bottom: 10px;
    text-align: left;
}

.signup-form button {
    display: block;
    width: 100%;
}

/* ---------- Tables ---------- */

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 16px;
}

table.table,
table.table-bordered,
table.table-dark {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    white-space: nowrap;
}

table.table th,
table.table td,
table.table-bordered th,
table.table-bordered td,
table.table-dark th,
table.table-dark td {
    padding: 10px 12px;
    border: 0.5px solid var(--border);
    text-align: left;
}

table.table th,
table.table-bordered th,
table.table-dark th {
    background: var(--navbg);
    color: var(--navtext);
    font-weight: 500;
}

table.table tr:nth-child(even) td,
table.table-bordered tr:nth-child(even) td,
table.table-dark tr:nth-child(even) td {
    background: var(--surface);
}

/* ---------- Reports / progress (B-02) ---------- */

.report-empty {
    color: var(--muted);
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

/* Backlog B-31 — inline login/signup feedback banner. Replaces login's old
   silent redirect (nothing rendered the ?login=X flag at all) and signup's
   jarring alert() popups. Same box shape as .report-empty; colored via the
   existing --danger-bg/--success-bg tokens (B-20) rather than new ones. */
.form-banner {
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 0.5px solid var(--border);
}

.form-banner--error {
    background: var(--danger-bg);
    color: var(--accent);
    border-color: var(--accent);
}

.form-banner--success {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success);
}

.form-banner.is-dismissed {
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* ---------- PR celebration banner (B-44) ---------- */

.pr-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 700;
    background: var(--navbg);
    color: var(--navtext);
    padding: 18px 20px 16px;
    border-bottom: 4px solid var(--accent);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    text-align: center;
    cursor: pointer;
    transform: translateY(0);
    transition: transform 0.35s ease, opacity 0.35s ease;
}

/* Decorative chrome-gradient strip, echoing the header wordmark's chrome
   treatment (header.php's #brandChrome SVG gradient) — this is the one
   deliberately new visual flourish, same carve-out precedent as B-23's own
   chrome gradient. */
.pr-banner::before {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #ffffff 0%, #c9cdd2 30%, #7d838a 60%, #3a3e42 100%);
}

.pr-banner.is-dismissed {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.pr-banner-close {
    position: absolute;
    top: 10px;
    right: 14px;
    width: 32px;
    height: 32px;
    min-height: 32px;
    border: none;
    background: transparent;
    color: var(--navtext);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.pr-banner-headline {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.3px;
    margin: 6px 0 10px;
}

.pr-banner-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.pr-banner-row {
    font-size: 15px;
}

.pr-banner-name {
    font-weight: 600;
}

.pr-banner-weight {
    color: var(--accent);
    font-weight: 800;
    margin-left: 8px;
}

@media (prefers-reduced-motion: reduce) {
    .pr-banner,
    .form-banner {
        transition: none;
    }
}

.report-ranges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.report-range {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    min-height: 44px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

.report-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.report-range:hover {
    text-decoration: none;
    border-color: var(--accent);
    color: var(--accent);
}

.report-range.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--onaccent);
}

.report-range.is-active:hover {
    color: var(--onaccent);
}

.report-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.report-stat {
    flex: 1 1 140px;
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.report-stat-num {
    display: block;
    font-size: 40px;
    font-weight: 700;
    line-height: 1;
    color: var(--accent);
}

.report-stat-label {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
}

/* Backlog B-25 — word-value stat cards (e.g. "Wednesday", "October") need a
   smaller face than the numeric stat cards, or long words overflow/clip. */
.report-stat-num--text {
    font-size: 22px;
    word-break: break-word;
}

.report-h3 {
    font-size: 20px;
    font-weight: 500;
    color: var(--text);
    margin: 24px 0 4px;
}

.report-sub {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 12px;
}

/* Backlog T-13 — was a bare, uncarded box; every other reporting component
   (.report-stat, .report-range, .report-mode) sits inside the surface/border/
   radius card treatment, so the Chart.js canvases floated visibly
   disconnected from the rest of the module. */
.report-chart {
    position: relative;
    width: 100%;
    height: 300px;
    margin-bottom: 12px;
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-sizing: border-box;
}

.report-exform {
    margin-bottom: 16px;
}

.report-exform select {
    max-width: 360px;
}

/* Backlog B-02 Phase 4 — ORM-vs-rep-count mode toggle + rep-count input */
.report-mode-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.report-mode {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 8px 14px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

.report-mode.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--onaccent);
}

.report-reps-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.report-reps-input label {
    font-size: 14px;
    color: var(--text);
}

.report-reps-input input[type="number"] {
    max-width: 100px;
    min-height: 44px;
}

.report-reps-input button {
    min-height: 44px;
}

.report-metric-label {
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 8px;
}

/* Backlog B-03 — personalised homepage greeting */
.home-greeting {
    position: relative; /* backlog B-48 — anchors .streak-badge's corner position */
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}

/* Backlog B-48 ("Streak Forge") — chrome-edged badge chip docking in the
   greeting card's corner. Chrome-gradient border echoes the header
   wordmark's treatment (same carve-out precedent as B-23/B-44) on top of
   the site's existing --navbg/--navtext/--accent tokens. */
.streak-badge {
    position: absolute;
    top: -10px;
    right: 14px;
    background: var(--navbg);
    color: var(--navtext);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid #c9cdd2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: help;
}

.home-greeting-icon {
    font-size: 28px;
    line-height: 1;
}

.home-greeting-primary {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
}

.home-greeting-secondary {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
}

.home-greeting-secondary a {
    color: var(--accent);
}

/* Backlog B-38 — frontpage rework. Every rule below builds only on the
   existing --text/--muted/--accent/--surface/--border/--radius tokens and
   the existing .btn/.btn-link/.report-stat card idiom — no new tokens, no JS. */

.home-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.home-barmath {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
}

.home-barmath-label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 4px;
}

.home-barmath-text {
    font-size: 16px;
    color: var(--text);
    margin: 0;
}

.home-barmath-text strong {
    color: var(--accent);
}

.home-hero {
    text-align: center;
    padding: 32px 16px 8px;
    margin-bottom: 8px;
}

.home-hero h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    margin: 0 0 12px;
}

.home-hero p {
    font-size: 16px;
    color: var(--muted);
    max-width: 480px;
    margin: 0 auto 24px;
}

.home-hero-ctas {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Backlog B-14 — hot-swap exercise mid-programme */

.swap-btn {
    min-height: 44px;
}

.swap-note {
    font-size: 13px;
    color: var(--muted);
    margin: 8px 0 0;
}

.btn-link {
    display: inline-block;
    min-height: 44px;
    padding: 8px 0;
    border: none;
    background: none;
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
}

/* Bug fix (2026-07-09) — same unconditional-`display`-beats-`[hidden]` issue as
   .adv-major-row above. .swap-undo (B-14's "Undo swap" button) carries this
   class and is toggled via `hidden`, so it was silently showing on every
   expanded row regardless of whether a swap had happened. */
.btn-link[hidden] {
    display: none;
}

.swap-sheet {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    border: none;
    border-top: 0.5px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 20px 16px;
    background: var(--bg);
}

.swap-sheet::backdrop {
    background: rgba(20, 23, 26, 0.4);
}

.swap-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.swap-sheet-sub {
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 16px;
}

/* Backlog B-51 — "Add another exercise" sits between the row list and the
   Save button, reusing .swap-sheet/.form-group/.btn-link verbatim (no new
   dialog styling needed, same bottom-sheet idiom as the Swap feature). */
.add-exercise-row {
    margin: 4px 0 16px;
}

.swap-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.swap-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    min-height: 48px;
    padding: 10px 16px;
    margin-bottom: 12px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 16px;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.swap-tool {
    font-size: 13px;
    color: var(--muted);
}

.swap-tool--changed {
    color: var(--accent);
    font-weight: 500;
}

.swap-empty {
    color: var(--muted);
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 14px;
}

/* ==========================================================================
   Backlog B-18 — mobile-first table redesign
   Two shared patterns replace the old `.table-scroll` horizontal-scroll
   tables on programme.php and all_exercises.php:
     1. `.table-collapse` — a collapsed-row list built on native <details>/
        <summary> (pattern "B", Erik's pick 2026-07-09). No JS needed for
        the expand/collapse itself; keyboard + screen-reader open state
        comes for free from the browser.
     2. `.ex-cards` — stacked cards, one per exercise (pattern "A", Erik's
        pick for user_exercises.php).
   history.php intentionally NOT touched here — folded into B-17's overhaul
   instead (Erik, 2026-07-09).
   ========================================================================== */

/* ---------- Pattern B: collapsed table + expandable row ---------- */

.table-collapse {
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}

.table-collapse-head {
    display: flex;
    background: var(--navbg);
    color: var(--navtext);
    font-weight: 500;
    font-size: 14px;
    padding: 10px 14px;
}

.table-collapse-head span:first-child {
    flex: 1;
}

.row-collapse {
    border-bottom: 0.5px solid var(--border);
    background: var(--bg);
}

.row-collapse:last-of-type {
    border-bottom: none;
}

.row-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
    font-size: 16px;
}

.row-summary::-webkit-details-marker {
    display: none;
}

.row-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.row-value {
    color: var(--muted);
    font-size: 14px;
}

.row-chev {
    color: var(--muted);
    font-size: 12px;
    transition: transform 0.15s ease;
}

.row-collapse[open] .row-chev {
    color: var(--accent);
    transform: rotate(180deg);
}

/* Backlog B-20 — set on a row's <details> by JS once its completion status
   select has a real value (anything but the empty placeholder). Visible
   whether the row is collapsed or expanded, since the whole point is not
   having to re-open a row to check if it's done.
   Two variants: .row-done (green) for any real completion value, .row-skipped
   (red) specifically for "Not completed" — Erik: "Not completed means skipped,
   really," i.e. still a real, deliberate answer (the set happened or didn't),
   just not a positive one, so it should look distinct rather than blank. */
.row-collapse.row-done {
    border-left: 4px solid var(--success);
    background: var(--success-bg);
}

.row-collapse.row-done .row-value {
    color: var(--success);
    font-weight: 500;
}

.row-collapse.row-skipped {
    border-left: 4px solid var(--accent);
    background: var(--danger-bg);
}

.row-collapse.row-skipped .row-value {
    color: var(--accent);
    font-weight: 500;
}

.row-detail {
    background: var(--surface);
    padding: 4px 14px 16px;
}

.row-detail-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    font-size: 14px;
    border-bottom: 0.5px solid var(--border);
}

.row-detail-line:last-of-type {
    border-bottom: none;
}

.row-k {
    color: var(--muted);
}

.row-detail select {
    margin: 10px 0;
}

.row-detail .swap-btn {
    width: 100%;
}

/* Backlog B-21 — Progression mode's per-step breakdown (one {reps, weight}
   pair + its own completion picker per set, instead of one flat weight for
   the whole row). Reuses .row-detail-line's border-between-rows look. */
.prog-steps {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
}

.prog-step {
    padding: 10px 0;
    border-bottom: 0.5px solid var(--border);
}

.prog-step:last-child {
    border-bottom: none;
}

.prog-step-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    margin-bottom: 6px;
}

.prog-step-reps {
    font-weight: 500;
}

.prog-step-weight {
    color: var(--accent);
    font-weight: 500;
}

.prog-step-completion {
    width: 100%;
}

/* Backlog B-05 — plate calculator enhancement, inline per-step breakdown.
   Own line below .prog-step-line (not a 3rd flex child there — see
   programme.php's B-05 comment), small/muted like .report-sub so it reads
   as a secondary detail, not competing with the reps/weight line above it. */
.prog-step-plates {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
}

/* Backlog B-30 — exercise lists (all_exercises.php, user_exercises.php)
   grouped by major, A-Z within each group. Sits as a sibling of
   .row-collapse inside .table-collapse, right before that group's first row
   — .row-collapse:last-of-type above still targets correctly since it's
   type-scoped, not position-scoped. */
.exercise-group-heading {
    padding: 8px 14px;
    background: var(--surface);
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 0.5px solid var(--border);
}

/* Backlog B-28 — history grouped by training session. Each session's
   <details> body holds one .session-set block per matching set (there can be
   several sets for the same exercise, and several exercises per session), so
   this needs its own header line + the existing .row-detail-line rows below
   it — same border-between-blocks look as .prog-step above. */
.session-set {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.session-set:last-child {
    border-bottom: none;
}

.session-set-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-weight: 500;
    margin-bottom: 4px;
}

/* Backlog B-13 — richer exercise media. A local <details>/<summary> toggle
   per exercise so the demo video is opt-in and lazy: collapsed content isn't
   fetched by the browser until the user expands it, so a page full of
   exercises never loads a page full of iframes. Works the same whether the
   toggle sits inside an already-collapsed row (all_exercises.php,
   programme.php) or a stacked card (user_exercises.php, pre-B-26). */
.ex-media {
    margin-top: 10px;
}

.ex-media-toggle {
    display: inline-block;
    min-height: 44px;
    line-height: 44px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
}

.ex-media-toggle::-webkit-details-marker {
    display: none;
}

.ex-media-frame {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    margin-top: 6px;
}

.ex-media-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: var(--radius);
}

/* all_exercises.php's "Use" toggle. */
.row-use-toggle {
    /* Backlog B-19 — real checkbox now, not the old text-input hack. Sized
       generously (bigger than the browser default) since this is the primary
       tap target in the row's collapsed summary. */
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.row-toggle-note {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

/* Backlog B-17 — history.php filter form + pagination */
.history-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
    padding: 14px;
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
}

.history-filters .form-group {
    flex: 1 1 140px;
    min-width: 120px;
    margin-bottom: 0;
}

.history-filters-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.history-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    font-size: 14px;
}

.history-pagination a {
    color: var(--accent);
}

.history-pagination-disabled {
    color: var(--muted);
}

/* ---------- Pattern A: stacked cards ---------- */

.ex-cards {
    margin-bottom: 16px;
}

.ex-card {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
}

.ex-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 500;
}

.ex-card-status {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--muted);
}

.ex-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
}

.ex-card-k {
    display: block;
    font-size: 11px;
    color: var(--muted);
}

.ex-card-v {
    display: block;
    font-size: 14px;
}

@media (min-width: 600px) {
    .ex-card-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* Backlog B-24 — manual ORM edit on user_exercises.php. Display is set only on
   the ":not([hidden])" form (rather than unconditionally on the base class),
   to sidestep the same "unconditional display beats [hidden]" pitfall fixed
   above for .adv-major-row/.btn-link. */
.ex-card-orm {
    display: block;
}

.ex-card-orm-view:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* Backlog T-12 — was min-height: 32px, undershooting the app's own
   mobile-first 44px minimum tap-target standard (already applied to
   .btn-link and every other primary control). This is the same text-link
   "edit" affordance as .btn-link/.ex-admin-edit-btn, just added on a
   different day (B-24) with its own copy of the rule instead of reusing one
   — align it to the app's actual standard rather than leaving three
   almost-identical, inconsistently-sized components. */
.ex-card-orm-edit-btn {
    border: none;
    background: none;
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
    padding: 8px 0;
    min-height: 44px;
}

/* Backlog B-46 — "Recalculate", same text-link affordance/tap-target as
   .ex-card-orm-edit-btn right above, just muted instead of accent-colored
   so Edit stays the visually primary action. */
.ex-card-orm-recalc-btn {
    border: none;
    background: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
    padding: 8px 0;
    min-height: 44px;
}

/* Backlog B-46 follow-up — Erik: "suggest action when orm has both been
   upped and downed" in the window. Swaps Recalculate from muted to
   accent-coloured + bold when OrmConfidence flags "mixed", so the
   suggested action is visibly distinct, not just explained in a tooltip. */
.ex-card-orm-recalc-btn--suggested {
    color: var(--accent);
    font-weight: 700;
}

/* Backlog B-46 — ORM confidence badge. Tiers map onto the existing
   success/muted/accent tokens rather than inventing new colours: an "up"
   update is the site's one positive tone, "mixed"/"not trained" lean on
   the site's one alert tone (already doing double duty for danger per
   B-20) since both call for action, "down" sits there too since it's a
   real regression, and "trained recently" (no change either way) is
   neutral on --muted. */
.orm-confidence {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 2px 6px;
    border-radius: calc(var(--radius) - 4px);
    cursor: help;
}

.orm-confidence--updated_up {
    color: var(--success);
    background: var(--success-bg);
}

.orm-confidence--updated_down {
    color: var(--accent);
    background: var(--danger-bg);
}

.orm-confidence--trained_recently {
    color: var(--muted);
    background: var(--surface);
}

.orm-confidence--not_trained_recently {
    color: var(--muted);
    background: var(--danger-bg);
}

/* Backlog B-46 follow-up — Erik, 2026-07-16: "suggest action when orm has
   both been upped and downed" within the window. Bordered, not just
   coloured, so it reads as distinctly more urgent than a plain "down" at a
   glance, not just a different hue. */
.orm-confidence--mixed {
    color: var(--accent);
    background: var(--danger-bg);
    border: 1px solid var(--accent);
}

/* ---------- B-46 manual recalculate (weight + reps calculator) ---------- */

.ex-card-orm-recalc-form:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
    margin-top: 4px;
}

.ex-card-orm-recalc-label {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    color: var(--muted);
    gap: 2px;
}

.ex-card-orm-recalc-weight,
.ex-card-orm-recalc-reps {
    width: 70px;
}

.ex-card-orm-recalc-calc-btn,
.ex-card-orm-recalc-cancel-btn {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 12px;
}

.ex-card-orm-recalc-result {
    display: block;
    width: 100%;
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.ex-card-orm-recalc-use-btn {
    display: inline-block;
    border: none;
    background: none;
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    font-size: 12px;
    padding: 10px 2px;
    margin: -10px 0;
}

.ex-card-orm-form:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.ex-card-orm-input {
    width: 80px;
}

.ex-card-orm-save-btn,
.ex-card-orm-cancel-btn {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 12px;
}

.ex-card-orm-note {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

/* Backlog B-29 — admin-only inline edit of every exercise attribute on
   all_exercises.php. Same edit/save/cancel toggle idea as B-24's ORM edit,
   scaled up to a whole small form instead of one field. */
.ex-admin {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 0.5px solid var(--border);
}

/* Backlog T-12 — same 32px→44px tap-target fix as .ex-card-orm-edit-btn
   above; see that comment. */
.ex-admin-edit-btn {
    border: none;
    background: none;
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
    padding: 8px 0;
    min-height: 44px;
}

.ex-admin-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

/* Bug fix (2026-07-10) — same unconditional-`display`-beats-`[hidden]` issue
   already hit twice before in this project (B-01's .adv-major-row, B-14's
   .btn-link/.swap-undo): an author-stylesheet `display` always beats the
   browser's default `[hidden] { display: none }` regardless of specificity,
   so the edit form was rendering open on page load instead of staying
   collapsed behind "Edit exercise" until clicked. */
.ex-admin-form[hidden] {
    display: none;
}

.ex-admin-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--muted);
}

.ex-admin-form input,
.ex-admin-form select {
    min-height: 40px;
}

.ex-admin-checkbox {
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
    color: var(--text) !important;
}

.ex-admin-checkbox input {
    width: 22px;
    height: 22px;
    min-height: auto;
    flex-shrink: 0;
}

.ex-admin-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.ex-admin-note {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}

/* Backlog B-01 — Simple/Advanced programme mode */

.mode-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.mode-toggle-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
}

.adv-major-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

/* Bug fix (2026-07-09) — an unconditional `display` on a class always beats the
   browser's default `[hidden] { display: none }` (author stylesheet rules take
   precedence over user-agent rules regardless of specificity), so JS toggling
   `row.hidden = true` had no visual effect: every major row stayed visible
   whether its checkbox was checked or not. Same fix applied to .btn-link below
   for .swap-undo, which had the identical latent bug. */
.adv-major-row[hidden] {
    display: none;
}

.adv-major-row label {
    flex: 1 1 200px;
}

.adv-major-row input[type="number"] {
    width: 90px;
    flex: 0 0 auto;
}

.adv-major-clamp-note {
    flex: 1 1 100%;
    font-size: 12px;
    color: var(--accent);
}

/* Backlog B-01 fix — majors as checkboxes, not a native <select multiple>.
   A multi-select requires Ctrl/Cmd+click to deselect a single option, which
   isn't discoverable — Erik: "otherwise it's impossible to deselect majors."
   Checkboxes toggle with a single tap, no modifier keys, and work the same
   on mobile. */
.majors-picker {
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin: 0 0 16px;
}

.majors-picker legend {
    padding: 0 6px;
    font-weight: bold;
}

.majors-picker-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.majors-picker-checkbox {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.majors-picker-note {
    font-size: 13px;
    color: var(--accent);
    margin: 6px 0 0;
}

/* Backlog B-22 — Manual programme mode's exercise picker. Reuses
   .majors-picker/.majors-picker-option/.majors-picker-checkbox for the
   fieldset chrome and checkbox sizing, and .row-right/.row-chev (B-18) for
   the chevron so open/closed state looks consistent with programme.php's
   collapsed rows. Only adds what's new below: the per-major collapse group,
   the per-exercise Sets input, and the "N picked" summary badge. */
.manual-picker-group {
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    background: var(--bg);
}

.manual-picker-group:last-child {
    margin-bottom: 0;
}

.manual-picker-group-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 14px;
    cursor: pointer;
    list-style: none;
    font-weight: 500;
}

.manual-picker-group-summary::-webkit-details-marker {
    display: none;
}

.manual-picker-group[open] .row-chev {
    color: var(--accent);
    transform: rotate(180deg);
}

.manual-picker-group-count {
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
}

.manual-picker-group-body {
    padding: 4px 14px 8px;
    border-top: 0.5px solid var(--border);
}

.manual-picker-option {
    flex-wrap: wrap;
}

.manual-picker-name {
    flex: 1 1 200px;
}

.manual-picker-sets {
    width: 70px;
    flex: 0 0 auto;
}

.manual-picker-sets:disabled {
    opacity: 0.4;
}

/* ============================================
   Backlog B-43 — theme system + floating controls
   Alternate skins override the same custom properties
   the whole site already renders with, scoped to
   [data-theme] on <html> — every existing component
   reskins for free, zero markup changes elsewhere.
   ============================================ */

html[data-theme="industrial"] {
    --bg: #24262a;
    --surface: #303337;
    --text: #f0eee9;
    --muted: #a39d97;
    --accent: #c8461a;
    --accent-dark: #a3390f;
    --onaccent: #ffffff;
    --border: #4a4d52;
    --navbg: #16181b;
    --navtext: #f0eee9;
    --radius: 3px;
    --success: #4f8a3d;
    --success-bg: #1e2a1a;
    --danger-bg: #362019;
}

html[data-theme="goth"] {
    --bg: #0d0b0f;
    --surface: #17141a;
    --text: #ece6f0;
    --muted: #948999;
    --accent: #9c1c40;
    --accent-dark: #7c1533;
    --onaccent: #ffffff;
    --border: #2c2530;
    --navbg: #060508;
    --navtext: #ece6f0;
    --radius: 4px;
    --success: #3f7d52;
    --success-bg: #16241b;
    --danger-bg: #2a1016;
}

html[data-theme="bubblegum"] {
    --bg: #fff0f6;
    --surface: #ffe1ee;
    --text: #3a1a2c;
    --muted: #a8728e;
    --accent: #ff4fa3;
    --accent-dark: #e13d8c;
    --onaccent: #3a1a2c;
    --border: #ffc2de;
    --navbg: #ff4fa3;
    --navtext: #ffffff;
    --radius: 22px;
    --success: #3fae6a;
    --success-bg: #e3f7ea;
    --danger-bg: #ffd9ea;
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* ---------- Back-to-top (floating) ---------- */

.fab-top {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 500;
    width: 48px;
    height: 48px;
    min-height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: var(--onaccent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: transform 0.15s ease, opacity 0.2s ease, background-color 0.2s ease;
}

.fab-top:hover {
    background: var(--accent-dark);
}

.fab-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .fab-top {
        transition: none;
    }
}

/* ---------- Theme switcher (static, lives in the header nav bar —
   Erik, 2026-07-16: didn't want it floating alongside the back-to-top
   button) ---------- */

.theme-switcher {
    position: relative;
    order: 1;
}

.nav-theme-btn {
    width: 44px;
    height: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--navtext);
    cursor: pointer;
    padding: 0;
}

.nav-theme-btn:hover {
    color: var(--accent);
}

.theme-menu {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    list-style: none;
    padding: 6px;
    min-width: 168px;
    margin: 0;
    z-index: 500;
}

.theme-menu[hidden] {
    display: none;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text);
    border-radius: calc(var(--radius) - 2px);
    font-size: 15px;
    cursor: pointer;
    text-align: left;
}

.theme-option:hover {
    background: var(--bg);
}

.theme-option[aria-current="true"] {
    font-weight: 700;
}

.swatch {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.swatch-default {
    background: #e8442b;
}

.swatch-industrial {
    background: #c8461a;
}

.swatch-goth {
    background: #9c1c40;
}

.swatch-bubblegum {
    background: #ff4fa3;
}
