/* Coaching Portal: stylesheet of the redesign (2026-09).
 *
 * Pages built on base_app.html use this file. Pages that are not redesigned
 * yet still use style.css; that file goes away when the last page has moved.
 *
 * Rules behind every choice below (decided with Marc, 2026-09-21):
 * - Dark is the default theme. Light is opt-in via <html data-theme="light">.
 * - Three signal colours, everything else is grey. Blue = action, done, coach
 *   feedback. Gold = reward. Bright red = danger. Green and red are never
 *   used as opposites: colourblind people see them alike.
 * - Colour never carries a meaning alone: each state also has a shape, an
 *   icon or a word.
 * - A phone is narrow. No box inside the screen, no double padding. A screen
 *   is a stack of bands from edge to edge, separated by hairlines and by two
 *   ground tones.
 * - Everything tapped in the gym is at least 48px high.
 * - Numbers use the monospaced font, so they line up in columns.
 */

/* ---------------------------------------------------------------- fonts
 * Served from our own static folder: no request leaves the server. */
@font-face { font-family: "Plex Sans"; font-weight: 400; font-display: swap; src: url("/static/fonts/ibm-plex-sans-latin-400.woff2") format("woff2"); }
@font-face { font-family: "Plex Sans"; font-weight: 500; font-display: swap; src: url("/static/fonts/ibm-plex-sans-latin-500.woff2") format("woff2"); }
@font-face { font-family: "Plex Sans"; font-weight: 600; font-display: swap; src: url("/static/fonts/ibm-plex-sans-latin-600.woff2") format("woff2"); }
@font-face { font-family: "Plex Mono"; font-weight: 500; font-display: swap; src: url("/static/fonts/ibm-plex-mono-latin-500.woff2") format("woff2"); }
@font-face { font-family: "Plex Mono"; font-weight: 600; font-display: swap; src: url("/static/fonts/ibm-plex-mono-latin-600.woff2") format("woff2"); }

/* ---------------------------------------------------------------- colours */
:root {
    --bg: #0f1317;          /* ground tone 1: the screen */
    --surface: #171c22;     /* ground tone 2: lifted bands, bars, menus */
    --field: #080a0d;       /* input fields: the darkest tone, so they read as holes */
    --line: #2a323c;        /* hairlines, borders, empty progress track */
    --text: #e9edf1;
    --muted: #8a96a5;

    --go: #4c8dff;          /* action, done, coach feedback, links */
    --go-ink: #051225;      /* writing on a blue button */
    --go-edge: #2f66c9;     /* the pressed edge under a blue button */
    --reward: #ffcf24;      /* flat gold, for small marks such as tier dots */
    --gold-ink: #2a1500;    /* writing on gold */
    --danger: #ff3358;      /* red writing and icons */
    --danger-fill: #ff2347; /* a filled red button, white writing on it */

    --sans: "Plex Sans", system-ui, sans-serif;
    --mono: "Plex Mono", ui-monospace, monospace;
    --radius: 8px;
}

html[data-theme="light"] {
    --bg: #f3f5f7;
    --surface: #ffffff;
    --field: #ffffff;
    --line: #d8dde3;
    --text: #12161b;
    --muted: #5a6573;
    --go: #1f5fd1;
    --go-ink: #ffffff;
    --go-edge: #143f91;
    --reward: #f5b800;
    --danger: #e8112f;
    --danger-fill: #e8112f;
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }

/* The hidden attribute must win over every display rule below: the script
   hides a swapped-out exercise and the error band with it. */
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.5;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--go); text-decoration: none; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.big-number { font: 600 1.75rem/1.1 var(--mono); }
.title { font-size: 1.4rem; font-weight: 600; line-height: 1.2; }
.subtitle { font-size: 1.1rem; font-weight: 600; }

/* Small capital label. Use it only where a number would be unclear without it. */
.label {
    font: 500 0.72rem var(--mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Inline icons come from the sprite in partials/_icons.svg:
   <svg class="icon"><use href="#i-flame"/></svg> */
.icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

/* ---------------------------------------------------------------- shell
 * The page is a column: top bar, content, bottom bar. Three widths:
 * - a phone (below 600px): the column fills the screen;
 * - a tablet (600 to 899px): the column fills the screen as well, there is
 *   no second column to put next to it (a phone-sized strip with dark
 *   borders on both sides looked broken on Marc's Galaxy tablet);
 * - a wide screen (from 900px): the four tabs become a side menu at the
 *   left and the page is a readable column next to it (below). */
.shell {
    min-height: 100vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}
.shell-content { flex: 1; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.topbar-group { display: flex; align-items: center; gap: 8px; }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--text);
    display: grid;
    place-items: center;
    font: 600 0.8rem var(--mono);
}

/* The bottom bars stick to the lower edge, in reach of the thumb. */
.tabbar, .actionbar {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
}
.tabbar { display: grid; grid-template-columns: repeat(4, 1fr); }
.tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 9px 0 12px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--muted);
}
/* The open tab differs by the bar above it and by its brightness, not by colour alone. */
.tabbar a.is-active { color: var(--text); box-shadow: inset 0 2px 0 var(--go); }

/* The log form replaces the tabs with its own bar: rest timer and Finish. */
.actionbar {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px 12px 14px;
}

/* Wide screen (a desktop browser): a phone-sized strip in the middle of a wide
   window looks broken. The four tabs become a side menu at the left, as on
   the coach side, and the page gets a readable width next to it.
   The shell's children are: .topbar, .shell-content, then .tabbar or (log
   form) .actionbar. */
@media (min-width: 900px) {
    .shell {
        max-width: none;
        margin: 0;
        border-inline: 0;
        display: grid;
        grid-template-columns: 220px minmax(0, 760px);
        grid-template-rows: auto 1fr auto;
        grid-template-areas: "nav top" "nav main" "nav bar";
    }
    .shell > .topbar { grid-area: top; border-right: 1px solid var(--line); }
    .shell > .shell-content { grid-area: main; border-right: 1px solid var(--line); }
    .shell > .actionbar { grid-area: bar; border-right: 1px solid var(--line); }
    .shell > .tabbar {
        grid-area: nav;
        position: sticky;
        top: 0;
        bottom: auto;
        align-self: start;
        height: 100vh;
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 18px 10px;
        border-top: 0;
        border-right: 1px solid var(--line);
    }
    .shell > .tabbar a { flex-direction: row; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: var(--radius); font-size: 1rem; }
    .shell > .tabbar a.is-active { background: var(--bg); box-shadow: inset 3px 0 0 var(--go); }
    .shell > .tabbar .icon { width: 18px; height: 18px; }
    /* A screen without the tabs (the log form, the workout-complete screen)
       has nothing to put in the side column: the page is centred instead of
       sitting next to an empty dark strip. */
    .shell:not(:has(> .tabbar)) {
        grid-template-columns: minmax(0, 760px);
        grid-template-areas: "top" "main" "bar";
        justify-content: center;
        border-inline: 1px solid var(--line);
        margin: 0 auto;
        width: fit-content;
        min-width: min(100%, 760px);
    }
    .shell:not(:has(> .tabbar)) > .topbar,
    .shell:not(:has(> .tabbar)) > .shell-content,
    .shell:not(:has(> .tabbar)) > .actionbar { border-right: 0; }
}

/* ---------------------------------------------------------------- bands and rows */
.band {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}
.band.is-lifted { background: var(--surface); }
.band.is-tight { padding-block: 10px; }

.split { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* A list: one line per entry, a hairline between entries. */
.rows > * {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 0 16px;
    border-bottom: 1px solid var(--line);
}
.rows .row-name { font-size: 1.05rem; font-weight: 500; }
.rows .row-value { font: 500 1rem var(--mono); color: var(--muted); white-space: nowrap; }

/* A whole row that is one tappable action, such as "+ Add set". */
.link-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    min-height: 52px;
    border-bottom: 1px solid var(--line);
    color: var(--go);
    font-size: 1.05rem;
    font-weight: 600;
}
.link-row.is-quiet { color: var(--muted); font-weight: 500; }

/* ---------------------------------------------------------------- buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: 600 1rem var(--sans);
    cursor: pointer;
}
.btn.is-wide { width: 100%; }
.btn.is-tall { min-height: 56px; font-size: 1.1rem; }

/* The one thing a screen wants from you. At most one per screen. */
.btn-go {
    border: 0;
    background: var(--go);
    color: var(--go-ink);
    box-shadow: 0 3px 0 var(--go-edge);
}
.btn-go:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--go-edge); }

/* Red is flat and filled, with white writing. Gold is never flat: the two can
   look alike to colourblind people, so they differ in form as well. */
.btn-danger { border: 0; background: var(--danger-fill); color: #ffffff; }

.btn:focus-visible, .set-field:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* A bare icon that is still a full-size tap target. */
.icon-btn {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 0;
    background: none;
    color: var(--text);
    cursor: pointer;
}

/* ---------------------------------------------------------------- chips, bars, dots */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: 500 0.8rem var(--mono);
    white-space: nowrap;
}
.chip .icon { width: 14px; height: 14px; }

.meter { display: block; height: 8px; border-radius: 4px; background: var(--line); }
.meter > i { display: block; height: 100%; border-radius: 4px; background: var(--go); }

/* The plan as a map: one row per week, one numbered bubble per training day.
   Row: the week's name, its bubbles, how many of its days are done.
   Bubble: done = filled, skipped = dashed ring, next = bright ring, open =
   grey ring. The day on screen has a short bar under its bubble. The number
   inside gives the map structure even when nothing is trained yet.
   A bubble is a button; its tap area is larger than the bubble itself. */
.plan-map { display: flex; flex-direction: column; }
.plan-week { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 8px; padding: 2px 0; border-top: 1px solid var(--line); }
.plan-week:first-child { border-top: 0; }
.week-label { font-size: 0.9rem; color: var(--muted); }
.plan-week.is-current .week-label { color: var(--text); font-weight: 600; }
.week-days { display: flex; flex-wrap: wrap; }
.week-count { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.day-dot {
    position: relative;
    width: 38px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: var(--muted);
    font: 500 0.8rem var(--mono);
}
/* the ring sits behind the number */
.day-dot::before { content: ""; position: absolute; width: 30px; height: 30px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--muted) 60%, var(--bg)); z-index: -1; }
.week-days { isolation: isolate; }
.day-dot.is-done { color: var(--go-ink); font-weight: 600; }
.day-dot.is-done::before { background: var(--go); border-color: var(--go); }
.day-dot.is-next { color: var(--text); font-weight: 600; }
.day-dot.is-next::before { border-color: var(--text); }
.day-dot.is-skipped::before { border-style: dashed; }
/* a phone: slightly smaller bubbles, so a week of 8 days stays on one row */
@media (max-width: 480px) {
    .plan-week { grid-template-columns: 46px 1fr auto; gap: 4px; }
    .week-label { font-size: 0.8rem; }
    .day-dot { width: 30px; }
    .day-dot::before { width: 26px; height: 26px; }
}
/* the day on screen: a short bar under its bubble */
.day-dot.is-shown::after { content: ""; position: absolute; bottom: 1px; width: 14px; height: 3px; border-radius: 2px; background: var(--text); }

/* One training day on the home screen */
.row-text { display: flex; flex-direction: column; padding-block: 6px; }
.day-head { gap: 4px; border-bottom: 0; }
.day-actions { gap: 4px; }
/* a form button that looks like a link row */
button.link-row { width: 100%; border-inline: 0; border-top: 0; background: none; font-family: var(--sans); cursor: pointer; }
.day-actions .link-row { border-bottom: 0; min-height: 44px; }

.feedback-item video { width: 100%; margin-top: 10px; border-radius: var(--radius); }

/* ---------------------------------------------------------------- logging a set
 * The most used part of the app, so it gets the whole width and the biggest
 * type. A row reads like a sentence: 97.5 x 5 @ 8, then the estimated 1RM.
 * Columns: menu | weight | x | reps | @ | effort | e1RM. The head row and the
 * prescription row (Rx) use the same columns, so everything lines up. */
.set-row {
    display: grid;
    grid-template-columns: 36px 1.5fr 12px 1fr 12px 1fr 62px;
    gap: 6px;
    align-items: center;
    padding: 5px 12px 5px 4px;
    border-bottom: 1px solid var(--line);
}
.set-row .separator { color: var(--muted); text-align: center; font-size: 0.9rem; }
.set-row .e1rm { font: 500 0.95rem var(--mono); color: var(--muted); text-align: right; }

.set-row.is-head { padding-block: 8px 4px; border-bottom: 0; }
.set-row.is-head span { font: 500 0.68rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-align: center; }

.set-row.is-prescription { min-height: 40px; background: var(--surface); }
.set-row.is-prescription span { font: 500 1rem var(--mono); color: var(--muted); text-align: center; }
.set-row.is-prescription .rx-mark { color: var(--go); font-weight: 600; }

/* A grey number is the target from the program (placeholder). A bright number
   is what the athlete typed (value). */
.set-field {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--field);
    color: var(--text);
    font: 600 1.2rem var(--mono);
    text-align: center;
}
.set-field::placeholder { color: var(--muted); opacity: 0.55; font-weight: 500; }

.exercise-head {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 18px 56px 14px;
    text-align: center;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.exercise-head .exercise-name { font-size: 1.3rem; font-weight: 600; }

.coach-note { padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.coach-note b { display: block; color: var(--go); font-weight: 600; margin-bottom: 2px; }

/* ---------------------------------------------------------------- log form */
/* Fields that are not part of a set row: a label above, the field below. */
.field-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
/* justify-content: a label that wraps onto two lines must not push its field
   below the fields next to it */
.field-grid label, .field-label { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; font-size: 0.875rem; color: var(--muted); }
.field {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--field);
    color: var(--text);
    font: 600 1.05rem var(--mono);
    text-align: center;
}
.field.is-text { font: 400 1rem var(--sans); text-align: left; padding: 0 12px; }
.field.is-note { height: auto; min-height: 72px; padding: 12px; font: 400 1rem var(--sans); text-align: left; resize: none; }
.field.is-readonly { display: grid; place-items: center; color: var(--muted); }
.field::placeholder, .note-line::placeholder { color: var(--muted); opacity: 0.6; font-weight: 400; }
/* the browser's own date and time fields follow the theme */
input[type="date"], input[type="time"] { color-scheme: dark; }
html[data-theme="light"] input[type="date"], html[data-theme="light"] input[type="time"] { color-scheme: light; }

/* Top bar of the log form: back, the day, the running workout time. */
.topbar-title { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.25; min-width: 0; }
.topbar .icon-btn { margin-left: -12px; }
.clock { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); font: 600 1rem var(--mono); font-variant-numeric: tabular-nums; }
.clock .icon { width: 18px; height: 18px; color: var(--muted); }

/* Bottom bar: the manual rest clock (start or pause, time, reset) and Finish. */
.rest-clock { display: inline-flex; align-items: center; min-height: 56px; border: 1px solid var(--line); border-radius: var(--radius); font: 600 1.15rem var(--mono); font-variant-numeric: tabular-nums; }
.rest-clock .icon-btn { width: 44px; color: var(--muted); }

/* Interval clock on a HIIT row: the Start button, or while it runs the
   countdown with the phase word above, the round below and Stop at the right.
   Work is blue, the pause and the get-ready count are quiet. */
.iclock-face { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "phase stop" "time stop" "round stop"; align-items: center; column-gap: 16px; padding: 8px 0 2px; }
.iclock-phase { grid-area: phase; font: 600 0.8rem var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.iclock-time { grid-area: time; font: 600 3.4rem var(--mono); line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--muted); }
.iclock-round { grid-area: round; font: 500 0.95rem var(--mono); color: var(--muted); }
.iclock-face.is-work .iclock-phase, .iclock-face.is-work .iclock-time { color: var(--go); }
.iclock-face.is-ready .iclock-time { color: var(--text); }
.iclock-stop { grid-area: stop; }

/* One exercise. A gap in the darkest tone separates it from the next one. */
.exercise { border-bottom: 14px solid var(--field); }
.exercise.is-added .exercise-head { box-shadow: inset 3px 0 0 var(--go); }
.icon-large { width: 26px; height: 26px; }
.rx-hint { padding: 6px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }

/* EMOM rows have four number fields: reps, kg, every, bouts. */
.set-row.is-emom { grid-template-columns: 36px 1fr 1.3fr 1fr 1fr; }
/* A freeform set is one line of text. */
.set-row.is-freeform { grid-template-columns: 36px 1fr; }
.set-field.is-text { font: 400 1rem var(--sans); text-align: left; padding: 0 12px; }
/* A prescription that is a sentence (cardio, freeform), not columns. */
.set-row.is-text { grid-template-columns: 36px 1fr; }
.set-row.is-text span:last-child { text-align: left; font: 400 1rem var(--sans); color: var(--text); padding-block: 8px; }

/* The athlete's note for one exercise: a quiet line that grows while typing. */
.note-line {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 13px 16px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: none;
    color: var(--text);
    font: 400 1rem var(--sans);
    resize: none;
}
.note-line:focus { outline: none; background: var(--surface); }

/* Uploaded form-check videos under an exercise */
.video-block { display: flex; flex-direction: column; }
.video-block .video-status { padding: 0 16px; }
.video-block .video-status:not(:empty) { padding-block: 8px; }
.video-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.video-row a { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; }
.video-row .coach-comment { grid-column: 1 / -1; }
.video-row .coach-comment b { color: var(--go); font-weight: 600; }
.video-remove { border: 0; background: none; color: var(--muted); font: 500 0.9rem var(--sans); min-height: 40px; cursor: pointer; }

details.unfold > summary.is-quiet-summary { color: var(--muted); justify-content: space-between; }

/* ---------------------------------------------------------------- windows
 * A window over the page (exercise history, add an exercise). On a phone it
 * rises from the lower edge, in reach of the thumb. Opened and closed by
 * openModal() and closeModal() in app.js, which toggle the class "active". */
.modal { display: none; position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.6); align-items: flex-end; justify-content: center; }
.modal.active { display: flex; }
.modal-content { width: 100%; max-width: 480px; max-height: 85vh; display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--line); border-radius: 16px 16px 0 0; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.modal-body { display: flex; flex-direction: column; gap: 12px; padding: 16px; overflow-y: auto; }
.history-day { display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.chart-container { overflow-x: auto; }

/* ---------------------------------------------------------------- coach side
 * The coach works on a wide screen as well as on the phone.
 * Wide: a side menu at the left, the page at the right, panels side by side.
 * The rule "no box inside the screen" is a phone rule; on a wide screen
 * panels next to each other are the point.
 * Phone (below 800px): the side menu is hidden, a tab bar sits at the bottom,
 * panels lose their frame and become full-width bands. */
.coach { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.coach-nav { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; gap: 2px; padding: 18px 10px; background: var(--surface); border-right: 1px solid var(--line); }
.coach-nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: var(--radius); color: var(--muted); font-weight: 500; }
.coach-nav a.is-active { background: var(--bg); color: var(--text); box-shadow: inset 3px 0 0 var(--go); }
.coach-nav .icon { width: 18px; height: 18px; }
.coach-nav .coach-brand { color: var(--text); font-weight: 600; margin-bottom: 8px; }
.coach-nav-label { padding: 16px 10px 4px; }
/* the theme switch and Log out at the end of the side menu look like its links */
.coach-nav-button { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: var(--radius); background: none; color: var(--muted); font: 500 1rem var(--sans); cursor: pointer; text-align: left; }
.coach-nav form { margin: 0; }
.count-pill { margin-left: auto; padding: 1px 7px; border-radius: 999px; background: var(--reward); color: var(--gold-ink); font: 600 0.72rem var(--mono); }
.coach-main { min-width: 0; max-width: 1180px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.coach-tabbar { display: none; }

.panel { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 12px 16px; }
.need-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.need { gap: 4px; padding: 14px 16px; color: var(--text); }
/* a number that asks for an action has a blue frame; zero stays quiet */
.need.is-open { border-color: var(--go); }
.need-number { font: 600 2rem/1.1 var(--mono); }
.coach-columns { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; align-items: start; }
.coach-stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.session-row { display: flex; flex-direction: column; gap: 3px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.session-row:last-child, .item-row:last-child { border-bottom: 0; }
.session-row b { color: var(--text); font-weight: 500; }
.session-who { color: var(--text); font-weight: 600; }
.item-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.item-row > a { white-space: nowrap; font-weight: 500; }

/* Tabs inside a page (one athlete: Training, Videos, Progress, ...). On a
   phone they scroll sideways. */
.page-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.page-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 12px 16px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.page-tabs a.is-active { color: var(--text); box-shadow: inset 0 -2px 0 var(--go); }
.page-tabs .count-pill { margin-left: 0; }

.week-head { padding: 12px 16px 4px; }
.panel-stack { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.panel-stack > form, .panel-stack > .btn.is-wide, .panel-stack > .alert { width: 100%; }
/* name and value pairs: "program   Powerbuilding Peak, 11 of 24" */
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* the logged sets of one session, folded under "All sets" */
.set-details > summary { cursor: pointer; color: var(--go); font-weight: 500; padding: 4px 0; list-style: none; }
.set-details > summary::-webkit-details-marker { display: none; }
.table-scroll { overflow-x: auto; }
.set-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.set-table th { text-align: left; padding: 6px 10px 6px 0; font: 500 0.68rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.set-table td { padding: 5px 10px 5px 0; border-top: 1px solid var(--line); vertical-align: top; }

/* the coach's review of one video */
.video-review { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.video-review video { width: 100%; max-width: 560px; border-radius: var(--radius); background: var(--field); }
.video-review-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; max-width: 560px; }
.video-review-form textarea { min-height: 48px; width: 100%; }

/* the athletes list: one line per athlete, the whole line is the link */
.athlete-line { display: grid; grid-template-columns: 1.4fr 1.4fr 1.3fr 0.8fr 0.9fr 0.6fr 1.3fr; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text); }
.athlete-line:last-child { border-bottom: 0; }
.athlete-line.is-head { padding-block: 10px; }
.athlete-line .meter { max-width: 140px; margin-bottom: 2px; }
a.athlete-line:hover { background: var(--bg); }
/* awards inside a panel: the bands need no second frame */
.panel .stat:last-child, .panel .band:last-child, .panel .unfold:last-child { border-bottom: 0; }

/* Effort of a session: circle up to RPE 8, triangle from 8.5, square from 9.5.
   The shape carries the meaning as well as the colour. */
.effort { display: inline-flex; align-items: center; gap: 7px; font: 500 0.95rem var(--mono); white-space: nowrap; }
.effort::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--go); }
.effort.is-hard::before { background: var(--reward); border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.effort.is-max::before { background: var(--danger); border-radius: 2px; }

@media (max-width: 800px) {
    .coach { display: flex; flex-direction: column; }
    .coach-nav { display: none; }
    .coach-main { flex: 1; padding: 0; gap: 0; }
    .coach-main > .split { padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
    /* the tab bar comes before the page in the markup: put it below */
    .coach-tabbar { display: grid; order: 2; }
    .coach-tabbar .menu > summary { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 12px; font-size: 0.7rem; font-weight: 500; color: var(--muted); }
    .need-grid, .coach-columns { grid-template-columns: 1fr; gap: 0; }
    .coach-stack { gap: 0; }
    .panel { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
    .panel-head { background: var(--surface); }
    .need { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
    .need .label { order: 2; }
    .need-number { order: 1; font-size: 1.5rem; }
    .need .small { order: 3; width: 100%; }
    /* the athletes list: name and program on the first line, the numbers below */
    .athlete-line.is-head { display: none; }
    .athlete-line { grid-template-columns: 1fr 1fr 1fr; gap: 4px 12px; }
    .athlete-line > :nth-child(1) { grid-column: 1 / 3; }
    .athlete-line > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; color: var(--muted); }
    .athlete-line > :nth-child(6) { grid-column: 3; grid-row: 1; text-align: right; }
    .athlete-line > :nth-child(7) { grid-column: 1 / -1; }
    .page-tabs { background: var(--surface); }
}
/* a menu that opens upward, for the "More" entry of a bottom bar */
.menu-list.opens-up { top: auto; bottom: 100%; right: 0; }

/* ---------------------------------------------------------------- profile and login */
.profile-head { align-items: center; text-align: center; gap: 6px; }
.profile-picture { width: 96px; height: 96px; border-radius: 50%; border: 1px solid var(--line); object-fit: cover; }
.profile-picture.is-empty { display: grid; place-items: center; background: var(--bg); font: 600 1.6rem var(--mono); color: var(--muted); }
.band-note { padding: 8px 16px 0; }
/* a row that is one action, with its text at the left instead of centred */
.link-row.is-left { justify-content: flex-start; padding: 0 16px; font-weight: 500; }
form > .link-row { width: 100%; }

.login { max-width: 400px; min-height: 100vh; margin: 0 auto; padding: 24px 16px; display: flex; flex-direction: column; justify-content: center; gap: 20px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }

/* ---------------------------------------------------------------- menus
 * A menu is a plain <details> element: the browser opens and closes it, no
 * script needed. <summary> is the button, .menu-list the list that drops down. */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: grid; place-items: center; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { color: var(--go); }

.menu-list {
    position: absolute;
    z-index: 10;
    top: 100%;
    min-width: 240px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--field);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}
.menu-list.opens-left { right: 0; }
.menu-list > * {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: none;
    color: var(--text);
    font: 400 1.05rem var(--sans);
    text-align: left;
    cursor: pointer;
}
.menu-list > *:last-child { border-bottom: 0; }
/* a form inside a menu (Log out): the form is only a wrapper, its button is the entry */
.menu-list > form { padding: 0; }
.menu-list > form > button { display: flex; align-items: center; width: 100%; min-height: 52px; padding: 0 16px; border: 0; background: none; color: var(--text); font: 400 1.05rem var(--sans); cursor: pointer; }
.menu-list .icon { color: var(--go); }
.menu-list .is-danger, .menu-list .is-danger .icon { color: var(--danger); }

/* The round menu of an exercise sits in the top right corner of its head. */
.exercise-head .menu { position: absolute; right: 8px; top: 10px; }
.exercise-head .menu > summary { width: 48px; height: 48px; color: var(--go); }
/* The three dots at the start of a set row. */
.set-row .menu > summary { width: 36px; height: 48px; color: var(--muted); }

/* ---------------------------------------------------------------- messages */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--go);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 0.95rem;
}
/* An error has a red border, a red tint and an icon: never the colour alone. */
.alert-error {
    border-color: var(--danger);
    background: color-mix(in srgb, var(--danger) 16%, var(--surface));
}
.alert-error .icon { color: var(--danger); }


/* ---------------------------------------------------------------- history */
/* The month: seven columns, large cells. A trained day is filled and carries
   the label of its workout (D1, D2) as the link; the open one has a ring. */
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font: 500 0.95rem var(--mono); }
.month b { padding-bottom: 4px; color: var(--muted); font-weight: 400; font-size: 0.72rem; }
.month span { min-height: 46px; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); line-height: 1.15; }
.month .is-trained { background: color-mix(in srgb, var(--go) 24%, var(--surface)); color: var(--text); }
.month .is-trained a { font-size: 0.68rem; font-weight: 600; padding: 2px 8px; }
/* The whole cell is the tap target of its first workout, not just the small
   label. A second workout on the same day stays tappable on top of it. */
.month .is-trained { position: relative; }
.month .is-trained a:first-of-type::after { content: ""; position: absolute; inset: 0; }
.month .is-trained a + a { position: relative; z-index: 1; }
.month .is-open { outline: 2px solid var(--go); }
.month .is-today { outline: 1px dashed var(--muted); }

.rows.is-lifted, .link-row.is-lifted { background: var(--surface); }
.stepper { padding: 0 4px; border-bottom: 1px solid var(--line); }
.stepper .link-row { border-bottom: 0; padding: 0 12px; }

/* ---------------------------------------------------------------- figures and awards */
/* A named figure: name left, value right, one line of detail below. */
.stat {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
    align-items: baseline;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}
.stat-name { font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stat-value { font: 600 1.2rem var(--mono); text-align: right; }
.stat-detail { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 0.9rem; }

/* The small heading above a group of rows. */
.band-label { padding: 18px 16px 6px; }

/* A row that unfolds in place. It replaces the pop-up windows of the old
   pages: a plain <details> element, no script. */
.unfold { border-bottom: 1px solid var(--line); }
.unfold > summary { list-style: none; cursor: pointer; }
.unfold > summary::-webkit-details-marker { display: none; }
.unfold > summary:not(.badge-row) { display: flex; align-items: center; min-height: 48px; padding: 0 16px; color: var(--go); font-weight: 500; }
.unfold[open] > summary { background: var(--surface); }
.unfold > .rows, .unfold > .stat { background: var(--surface); }
.unfold-note { padding: 4px 16px 12px; background: var(--surface); }
.rows > .is-current .row-name, .rows > .is-current .row-value { color: var(--go); font-weight: 600; }
.rows .row-value .icon { width: 18px; height: 18px; vertical-align: -3px; }

.badge-row { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: center; padding: 12px 16px; }
.badge-text { display: flex; flex-direction: column; gap: 4px; }
.badge-disc { position: relative; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; }
.badge-disc .icon { width: 26px; height: 26px; }
.badge-disc.is-locked { border: 2px solid var(--line); color: var(--muted); }

/* The top of the "workout complete" screen: everything centred, the big badge
   in the middle. The big gold badge appears only here. */
.celebration { align-items: center; text-align: center; padding-block: 28px 22px; }
.big-badge { position: relative; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; --glint-size: 60px; }
.big-badge .icon { width: 54px; height: 54px; stroke-width: 1.5; }
.new-tag { margin-left: 8px; padding: 1px 6px; border-radius: 4px; background: var(--reward); color: var(--gold-ink); font: 600 0.65rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }

/* One dot per tier of a badge family. Earned = filled, open = ring. */
.pips { display: inline-flex; gap: 5px; }
.pips i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line); }
.pips i.is-earned { background: var(--reward); border-color: var(--reward); }

/* ---------------------------------------------------------------- gold
 * Painted the way gold drawing guides do it: five tones from cream to dark
 * brown, placed in hard steps, never as a soft fade. The light follows the
 * form of the thing:
 * - flat parts are cut like a gold bar: a lighter top facet, a bright line on
 *   the top and left edge, a dark line at the bottom, bright spots in the top
 *   corners, one dark reflection in the far corner (away from the writing);
 * - round parts (.is-round) are lit like a ball, with a rim that is bright
 *   where the light hits it (<i class="gold-rim"> inside);
 * - a star-shaped glint flashes on a corner or on the rim.
 * The gold sits on ::before, behind the writing. The same in both themes. */
.gold {
    position: relative;
    isolation: isolate;
    border: 0;
    color: var(--gold-ink);
    --glint-size: 24px;
    --glint-x: calc(100% - 8px);
    --glint-y: 1px;
    --glint-delay: 0s;
}
.gold::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background:
        radial-gradient(circle at 0 0, #fffbe6 0, rgba(255, 243, 180, 0.9) 4px, transparent 13px),
        radial-gradient(circle at 100% 0, rgba(255, 248, 210, 0.95) 0, transparent 10px),
        linear-gradient(180deg, #fff6d6 0 1.5px, transparent 1.5px),
        linear-gradient(90deg, #ffe98a 0 1.5px, transparent 1.5px),
        linear-gradient(0deg, #a35f00 0 2px, transparent 2px),
        linear-gradient(115deg, transparent 0 86.5%, #ffe27a 86.5% 88%, #4a2600 88%, #8a5200 100%),
        linear-gradient(180deg, #ffdc3d 0 38%, #f7bd0f 38% 100%);
}
.gold.is-round::before {
    background: radial-gradient(circle at 34% 28%,
        #fff6d6 0 9%, #ffe45c 10% 30%, #f7bd0f 31% 56%, #b86f00 57% 72%, #4a2600 73% 84%, #ffcf24 85% 100%);
}
.gold.is-round { --glint-x: 20%; --glint-y: 12%; }
.gold-rim {
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: 50%;
    background: conic-gradient(from 225deg, #fff6d6, #ffdc3d 12%, #b86f00 30%, #4a2600 50%, #b86f00 62%, #ffdc3d 80%, #fff6d6);
    /* keep only the outer 4px ring of the disc */
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
}

/* A gold progress bar is too thin for facets: it is painted as a round rod. */
.meter > i.gold::before {
    background: linear-gradient(180deg, #fff6d6 0 18%, #ffdc3d 18% 50%, #c98500 50% 85%, #8a5200 85% 100%);
}
.meter > i.gold { --glint-size: 18px; --glint-x: 100%; --glint-y: 50%; }

/* The glint: a white core, a soft yellow glow and two thin crossed rays. */
.gold::after {
    content: "";
    position: absolute;
    z-index: 1;
    left: var(--glint-x);
    top: var(--glint-y);
    width: var(--glint-size);
    height: var(--glint-size);
    translate: -50% -50%;
    opacity: 0;
    scale: 0.2;
    pointer-events: none;
    background:
        radial-gradient(circle, #ffffff 0 7%, rgba(255, 248, 214, 0.95) 13%, rgba(255, 220, 90, 0.45) 30%, transparent 58%),
        linear-gradient(90deg, transparent, #ffffff 42% 58%, transparent) center / 100% 1.5px no-repeat,
        linear-gradient(0deg, transparent, #ffffff 42% 58%, transparent) center / 1.5px 100% no-repeat;
    animation: glint 4.5s ease-in-out infinite;
    animation-delay: var(--glint-delay);
}
@keyframes glint {
    0%, 52% { opacity: 0; scale: 0.2; rotate: 0deg; }
    68% { opacity: 1; scale: 1; rotate: 18deg; }
    82% { opacity: 0.9; scale: 0.7; rotate: 30deg; }
    100% { opacity: 0; scale: 0.2; rotate: 45deg; }
}
/* Signal over noise: in a list of badges only the newest one glints. */
.gold.is-still::after { display: none; }
@media (prefers-reduced-motion: reduce) {
    .gold::after { animation: none; opacity: 0.9; scale: 0.7; }
}

/* ---------------------------------------------------------------- progress
 * Four views (Strength, Volume, Load, Body) and More, chosen with a second
 * row of tabs. A chart is drawn in Python at a phone's width (400 px) and
 * scales with the screen, up to a readable size. A chart with a long history
 * is drawn wider (class chart-scroll), scrolls sideways and opens at its
 * newest data. Legends are HTML under the chart, so they never scroll away. */
.page-tabs.is-views a { padding: 10px 14px; font-size: 0.95rem; }
.chart-container { overflow-x: auto; }
.chart-container svg { display: block; width: 100%; max-width: 560px; height: auto; }
.chart-container svg.chart-scroll { width: auto; max-width: none; }
.chart-container svg text { font-family: var(--sans); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.9rem; }
.legend > span, .stat-name .swatch { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--swatch); flex: none; }
.swatch.is-dashed { background: none; border: 2px dashed var(--swatch); }
.stat-name .swatch { margin-right: 8px; }
.unfold-note p + p { margin-top: 8px; }
.unfold-note a { text-decoration: underline; }
/* a select on the Progress page: the browser's list, in the field's clothes */
select.field.is-text { appearance: auto; }

/* The load ratio as one signal: a shape and a word, never the colour alone.
   light = ring, steady = filled circle, rising = triangle, too high = square. */
.signal { display: inline-flex; align-items: center; gap: 7px; font: 500 0.85rem var(--sans); color: var(--muted); vertical-align: 2px; }
.signal::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--go); flex: none; }
.signal.is-low::before { background: none; border: 2px solid var(--muted); box-sizing: border-box; }
.signal.is-rising::before { background: var(--reward); border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.signal.is-high::before { background: var(--danger); border-radius: 2px; }
.signal.is-high { color: var(--danger); font-weight: 600; }

/* tables under More */
.set-table td.num, .set-table th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.set-table td.is-name { white-space: nowrap; font-weight: 500; }
.set-table td.is-new { color: var(--go); font-weight: 700; }
.set-table tr.is-total td { font-weight: 600; border-top: 2px solid var(--line); }
.progress { display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- lists on the coach side
 * Programs, the library and the badges are lists: one row per entry, the
 * columns in a grid, one menu at the right. A quiet field edits in place. */
.list-row { display: grid; grid-template-columns: 1fr 80px 120px 48px; gap: 12px; align-items: center; min-height: 52px; padding: 6px 8px 6px 16px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row.is-head { min-height: 40px; padding-block: 8px; }
.list-row.is-library { grid-template-columns: 1.4fr 1.4fr 90px 48px; }
.list-row.is-badge { grid-template-columns: 40px 1.6fr 1fr 60px 48px; }
.list-row.is-archived { grid-template-columns: 1.4fr 1.4fr 90px auto; padding-right: 16px; }
.list-main { display: flex; flex-direction: column; color: var(--text); min-width: 0; }
.badge-icon { font-size: 1.4rem; text-align: center; }
.field.is-quiet { height: 40px; border-color: transparent; background: none; }
.field.is-quiet:hover { border-color: var(--line); }
.field.is-quiet:focus { border-color: var(--go); background: var(--field); }
.form-stack { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.form-stack .field-label { width: 100%; }
.panel.is-narrow { max-width: 520px; }
.menu-list > form.is-merge { flex-direction: column; align-items: stretch; gap: 8px; min-height: 0; padding: 12px 16px; cursor: default; }
.menu-list > form.is-merge .btn { min-height: 40px; }
.field-label.is-check { flex-direction: row; align-items: center; gap: 8px; }
.field-label.is-check input { width: 20px; height: 20px; }
@media (max-width: 800px) {
    /* one column for the fields and figures, the menu at the right of the first line */
    .list-row, .list-row.is-library, .list-row.is-badge, .list-row.is-archived { grid-template-columns: 1fr 48px; gap: 4px 12px; }
    .list-row.is-head { display: none; }
    .list-row > :not(.menu) { grid-column: 1; min-width: 0; }
    .list-row > .menu, .list-row.is-archived > form { grid-column: 2; grid-row: 1; }
    .list-row.is-badge > .badge-icon { display: none; }
}

/* ---------------------------------------------------------------- builder
 * A desktop tool. One block = one panel, its weeks are tabs, one week on
 * screen; the week's days stand side by side; an exercise is one row that
 * reads like a prescription, with one menu. The rarely needed fields of an
 * exercise stay inside its row in the DOM (the save script reads them there)
 * and are shown as a fixed panel at the right while the row is open. */
.builder { display: flex; flex-direction: column; gap: 16px; }
.builder.has-panel { margin-right: 400px; }
.builder-head { position: sticky; top: 0; z-index: 5; padding-block: 4px; background: var(--bg); }
.savebox { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; }
.program-header { border: 1px solid var(--line); border-radius: 12px; }
.copy-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--go); color: var(--go-ink); font: 600 0.8rem var(--sans); }
.blocks { display: flex; flex-direction: column; gap: 16px; }

/* an inline form: name, description, Save, Cancel on one line (wraps when narrow) */
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.inline-form .field-label.is-grow { flex: 1; min-width: 200px; }
.inline-form .field { height: 40px; }
.inline-form .btn { min-height: 40px; }
.add-block > .inline-form { border-bottom: 0; }
.field.is-text.field { text-align: left; }
select.field.is-text { appearance: auto; }

.block-title { display: flex; flex-direction: column; gap: 2px; }

/* the week tabs of a block */
.week-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); }
.week-tab { min-height: 44px; padding: 0 14px; border: 0; background: none; color: var(--muted); font: 500 0.95rem var(--sans); cursor: pointer; white-space: nowrap; }
.week-tab.is-active { color: var(--text); box-shadow: inset 0 -2px 0 var(--go); }
.week-tab.is-add { color: var(--go); }
.week-tabs form { margin: 0; }

.week-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 0 8px 0 16px; }
.week-bar .inline-form { flex: 1; padding: 6px 0; border-bottom: 0; }

/* the days of a week, side by side; a day is a column */
.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; padding: 0 16px 16px; }
.day-col { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); min-width: 0; }
.day-col.is-add { justify-content: center; border-style: dashed; background: none; }
.day-col.is-add .link-row { border-bottom: 0; }
.day-bar { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px 0 12px; border-bottom: 1px solid var(--line); }
.day-name { font-weight: 600; flex: 1; }
.day-col .add-wrap > summary { min-height: 44px; border-bottom: 0; }
.day-col .add-wrap .menu-list { left: 0; right: 0; top: auto; bottom: 100%; }

/* one exercise: name, then "3 x 5 @ 8 RPE" as inputs with the words between */
.ex-row { position: relative; }
.ex-main { display: flex; align-items: center; gap: 4px; min-height: 44px; padding: 2px 0 2px 6px; border-bottom: 1px solid var(--line); }
.ex-row.dirty > .ex-main { box-shadow: inset 3px 0 0 var(--reward); }
.ex-row.bad-row > .ex-main { box-shadow: inset 3px 0 0 var(--danger); }
.ex-row.is-open > .ex-main { background: var(--surface); }
.ex-main input { height: 36px; min-width: 0; padding: 0 6px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--text); font: 500 0.95rem var(--sans); }
.ex-main input:hover { border-color: var(--line); }
.ex-main input:focus { outline: none; border-color: var(--go); background: var(--field); }
.ex-main input::placeholder { color: var(--muted); opacity: 0.6; }
.ex-name { flex: 1; }
.rx { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.rx .n { width: 46px; text-align: center; font-family: var(--mono); }
.rx [data-f="reps"] { width: 62px; }  /* a range such as 8-12 */
.rx .ex-text { width: 220px; }
.rx i { font-style: normal; color: var(--muted); font-size: 0.85rem; }
.rx .unit { width: 32px; color: var(--muted); font: 500 0.75rem var(--mono); }
button.rx.is-summary { min-height: 36px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--text); font: 500 0.9rem var(--mono); cursor: pointer; text-align: right; }
button.rx.is-summary:hover { border-color: var(--line); }
.ex-main .menu > summary { width: 40px; height: 40px; color: var(--muted); }
.row-error { padding: 4px 12px 8px; color: var(--danger); font-size: 0.85rem; border-bottom: 1px solid var(--line); }
.menu-list button:disabled { color: var(--muted); cursor: default; }
.menu-list button:disabled .icon { color: var(--muted); }

/* the details of the open exercise: a fixed panel at the right */
.ex-detail { position: fixed; top: 0; right: 0; z-index: 20; width: 384px; max-width: 100vw; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3); }
.ex-detail .field { height: 40px; }
.ex-detail .field-grid { grid-template-columns: repeat(3, 1fr); }
.set-editor { display: flex; flex-direction: column; gap: 6px; counter-reset: setno; }
.set-editor .link-row { min-height: 40px; border-bottom: 0; }
.edit-set-row { display: grid; grid-template-columns: 24px 1fr 1fr 40px; gap: 6px; align-items: center; counter-increment: setno; }
.edit-set-row .set-no::before { content: counter(setno); font: 500 0.85rem var(--mono); }
.edit-set-row .icon-btn { width: 40px; height: 40px; color: var(--muted); }

@media (max-width: 800px) {
    .builder { gap: 0; }
    .builder.has-panel { margin-right: 0; }
    .builder-head { padding: 14px 16px; }
    .program-header { border: 0; border-radius: 0; }
    .days { grid-template-columns: 1fr; padding: 0 0 8px; gap: 0; }
    .day-col { border-inline: 0; border-radius: 0; }
    .ex-main { padding-left: 2px; gap: 2px; }
    .ex-main input { padding: 0 4px; }
    .rx .n { width: 38px; }
    .rx .unit { width: 26px; }
    .ex-detail { width: 100vw; }
}
