/**
 * Solvyr Compound - Custom Styles
 *
 * Custom CSS for Compound fitness app.
 * Target: ≤10 KB unminified
 *
 * Only CSS variables, rare helpers, minor Bootstrap fixes.
 * Bootstrap utilities for layout/spacing.
 */

/* ============================================================================
   CSS Variables
   ============================================================================ */
/* ============================================================================
   RESKIN — "Iron Room" design tokens (graphite + electric cyan, sharp edges)
   Remaps Bootstrap's --bs-* vars so every component inherits the new system.
   ============================================================================ */
:root,
[data-bs-theme="light"] {
    /* Accent palette */
    --bs-primary: #00B4D8;        --bs-primary-rgb: 0, 180, 216;
    --bs-secondary: #7A828C;      --bs-secondary-rgb: 122, 130, 140;
    --bs-success: #1DB954;        --bs-success-rgb: 29, 185, 84;
    --bs-warning: #F5A623;        --bs-warning-rgb: 245, 166, 35;
    --bs-danger: #E63946;         --bs-danger-rgb: 230, 57, 70;
    --bs-info: #00B4D8;           --bs-info-rgb: 0, 180, 216;

    /* Surfaces & text */
    --bs-body-bg: #F5F6F7;
    --bs-body-color: #1A1D21;
    --bs-card-bg: #FFFFFF;
    --bs-border-color: #D4D8DC;
    --bs-secondary-color: #5D6670;   /* AA on white & body bg (was #7A828C @ 3.6:1) */
    /* Cyan is a FILL color — as text it fails contrast (2.46:1). Links and
       text-accents use the darker "action cyan" in light mode. */
    --bs-link-color: #007FA3;
    --bs-link-color-rgb: 0, 127, 163;
    --bs-link-hover-color: #006E85;
    --bs-link-hover-color-rgb: 0, 110, 133;

    /* Edges — effectively square (2px); true 0 on full-bleed elements only */
    --bs-border-radius: 2px;      --bs-border-radius-sm: 2px;
    --bs-border-radius-lg: 2px;   --bs-border-radius-xl: 2px;
    --bs-border-radius-xxl: 2px;  --bs-border-radius-pill: 2px;

    /* Subtle tints (badges / soft backgrounds) */
    --bs-primary-bg-subtle: #D6F4FB;  --bs-primary-text-emphasis: #006E85;
    --bs-secondary-bg-subtle: #E8EAEC; --bs-secondary-text-emphasis: #41464C;
    --bs-success-bg-subtle: #D1F5E0;  --bs-success-text-emphasis: #0F6630;
    --bs-warning-bg-subtle: #FDEFD5;  --bs-warning-text-emphasis: #8A5B00;
    --bs-danger-bg-subtle: #FBDFE1;   --bs-danger-text-emphasis: #8A1F27;
    --bs-info-bg-subtle: #D6F4FB;     --bs-info-text-emphasis: #006E85;

    /* Interaction states + ink-on-accent (dark ink on cyan/amber/green fills) */
    --compound-primary-hover: #0096BB;
    --compound-primary-active: #00859F;
    --compound-ink-on-accent: #0B2E36;
    --focus-ring-color: #007FA3;

    /* Chart series ramp (after primary + accent): graphite, deep cyan, pale cyan */
    --compound-chart-3: #7A828C;
    --compound-chart-4: #005F73;
    --compound-chart-5: #7FE3F7;

    /* Compound aliases (mapped onto Iron Room) */
    --compound-primary: #00B4D8;
    --compound-secondary: #7A828C;   /* muted gray — keeps neutral buttons neutral */
    --compound-success: #1DB954;
    --compound-warning: #F5A623;
    --compound-danger: #E63946;
    --compound-info: #00B4D8;
    --compound-light: #F5F6F7;
    --compound-dark: #1A1D21;
    --compound-accent: #FF6B2B;      /* warm orange — PRs / drop-sets / deload (used deliberately) */

    /* Radius aliases used by component / shared CSS */
    --radius-sm: 2px;  --radius-md: 2px;  --radius-lg: 2px;  --radius-pill: 2px;
    --solvyr-radius: 2px;  --solvyr-radius-sm: 2px;  --solvyr-radius-lg: 2px;
    --color-border: #D4D8DC;  --color-surface: #FFFFFF;  --color-text-muted: #5D6670;

    /* Type — Barlow Condensed (display) + Inter (UI/body) via Google Fonts */
    --font-heading: 'Barlow Condensed', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    /* Spacing scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
}

[data-bs-theme="dark"] {
    --bs-primary: #00C8F0;        --bs-primary-rgb: 0, 200, 240;
    --bs-secondary: #8A939D;      --bs-secondary-rgb: 138, 147, 157;
    --bs-success: #1DB954;        --bs-success-rgb: 29, 185, 84;
    --bs-warning: #F5A623;        --bs-warning-rgb: 245, 166, 35;
    --bs-danger: #E63946;         --bs-danger-rgb: 230, 57, 70;
    --bs-info: #00C8F0;           --bs-info-rgb: 0, 200, 240;

    --bs-body-bg: #111316;
    --bs-body-color: #E8EAED;
    --bs-card-bg: #1C1F23;
    --bs-border-color: #2E3238;
    --bs-secondary-color: #8A939D;
    --bs-link-color: #00C8F0;
    --bs-link-color-rgb: 0, 200, 240;
    --bs-link-hover-color: #33D4F5;
    --bs-link-hover-color-rgb: 51, 212, 245;

    --bs-primary-bg-subtle: #003D4D;  --bs-primary-text-emphasis: #7FE3F7;
    --bs-secondary-bg-subtle: #25282D; --bs-secondary-text-emphasis: #B8BEC5;
    --bs-success-bg-subtle: #0A3520;  --bs-success-text-emphasis: #5FE08F;
    --bs-warning-bg-subtle: #3D2E08;  --bs-warning-text-emphasis: #F5C76A;
    --bs-danger-bg-subtle: #3D1216;   --bs-danger-text-emphasis: #F2949B;
    --bs-info-bg-subtle: #003D4D;     --bs-info-text-emphasis: #7FE3F7;

    --compound-primary: #00C8F0;
    --compound-secondary: #8A939D;
    --compound-light: #1C1F23;
    --compound-dark: #E8EAED;
    --compound-accent: #FF7A3C;

    --color-border: #2E3238;  --color-surface: #1C1F23;  --color-text-muted: #8A939D;

    --compound-primary-hover: #33D4F5;
    --compound-primary-active: #5CDDF7;
    --compound-ink-on-accent: #062730;
    --focus-ring-color: #00C8F0;

    --compound-chart-3: #8A939D;
    --compound-chart-4: #4FB7CE;
    --compound-chart-5: #B8EEF9;

    /* Shared-component tokens (solvyr-modal / Confirm) — shared tokens.css has
       no dark block, so the dialog would stay white-on-white without these. */
    --surface: #1C1F23;
    --text-color: #E8EAED;
    --text-muted: #8A939D;
    --border-color: #2E3238;
    --backdrop: rgba(0, 0, 0, 0.6);
}

/* ============================================================================
   RESKIN — global overrides (sharp edges, hairline elevation, type)
   ============================================================================ */
.shadow-sm, .shadow, .shadow-lg { box-shadow: none !important; }
.btn { box-shadow: none !important; }
.rounded-pill { border-radius: var(--bs-border-radius) !important; }

/* Cards: 1px hairline border, no shadow (elevation = border, not blur) */
.card { border: 1px solid var(--bs-border-color); box-shadow: none; border-radius: var(--bs-border-radius); }
.card.border-0 { border: 1px solid var(--bs-border-color) !important; }
.card-header { background: transparent; border-bottom: 1px solid var(--bs-border-color); }
.dropdown-menu { border: 1px solid var(--bs-border-color); box-shadow: none; }
.modal-content, .solvyr-modal { border: 1px solid var(--bs-border-color); box-shadow: none; }

/* Typography */
body { font-family: var(--font-body); }
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}
.navbar-brand { font-family: var(--font-heading); }

/* Dark-mode safety: utilities that assume a light page */
[data-bs-theme="dark"] .text-dark { color: var(--bs-body-color) !important; }
[data-bs-theme="dark"] .bg-white { background-color: var(--bs-card-bg) !important; }
[data-bs-theme="dark"] .bg-light { background-color: rgba(var(--bs-secondary-rgb), 0.12) !important; }

/* ============================================================================
   RESKIN — Bootstrap component-variable remaps
   BS 5.3 compiles literal colors into per-component vars (--bs-btn-bg,
   --bs-link-color-rgb, --bs-card-bg, …); the :root --bs-primary remap above
   never reaches them. Re-point each component at the Iron Room palette.
   Doctrine: cyan/amber/green fills carry DARK INK (safety-signage look + AA);
   danger fills darken to keep white ink legible.
   ============================================================================ */
.btn-primary {
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-color: var(--compound-ink-on-accent);
    --bs-btn-hover-bg: var(--compound-primary-hover);
    --bs-btn-hover-border-color: var(--compound-primary-hover);
    --bs-btn-hover-color: var(--compound-ink-on-accent);
    --bs-btn-active-bg: var(--compound-primary-active);
    --bs-btn-active-border-color: var(--compound-primary-active);
    --bs-btn-active-color: var(--compound-ink-on-accent);
    --bs-btn-disabled-bg: var(--bs-primary);
    --bs-btn-disabled-border-color: var(--bs-primary);
    --bs-btn-disabled-color: var(--compound-ink-on-accent);
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn-outline-primary {
    --bs-btn-color: var(--bs-link-color);
    --bs-btn-border-color: var(--bs-link-color);
    --bs-btn-hover-bg: var(--bs-primary);
    --bs-btn-hover-border-color: var(--bs-primary);
    --bs-btn-hover-color: var(--compound-ink-on-accent);
    --bs-btn-active-bg: var(--compound-primary-active);
    --bs-btn-active-border-color: var(--compound-primary-active);
    --bs-btn-active-color: var(--compound-ink-on-accent);
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn-success {
    --bs-btn-bg: var(--bs-success);
    --bs-btn-border-color: var(--bs-success);
    --bs-btn-color: #06281A;
    --bs-btn-hover-bg: #169A45;
    --bs-btn-hover-border-color: #169A45;
    --bs-btn-hover-color: #06281A;
    --bs-btn-active-bg: #128A3D;
    --bs-btn-active-border-color: #128A3D;
    --bs-btn-active-color: #06281A;
}
.btn-warning {
    --bs-btn-bg: var(--bs-warning);
    --bs-btn-border-color: var(--bs-warning);
    --bs-btn-color: #2E2208;
    --bs-btn-hover-bg: #DD9114;
    --bs-btn-hover-border-color: #DD9114;
    --bs-btn-hover-color: #2E2208;
}
.btn-danger {
    --bs-btn-bg: #C42B37;            /* darkened: 4.5:1+ with white ink */
    --bs-btn-border-color: #C42B37;
    --bs-btn-color: #FFFFFF;
    --bs-btn-hover-bg: #A82430;
    --bs-btn-hover-border-color: #A82430;
    --bs-btn-hover-color: #FFFFFF;
    --bs-btn-active-bg: #962029;
    --bs-btn-active-border-color: #962029;
    --bs-btn-active-color: #FFFFFF;
}
.btn-outline-danger {
    --bs-btn-color: #C42B37;
    --bs-btn-border-color: #C42B37;
    --bs-btn-hover-bg: #C42B37;
    --bs-btn-hover-border-color: #C42B37;
    --bs-btn-hover-color: #FFFFFF;
}
[data-bs-theme="dark"] .btn-outline-danger {
    --bs-btn-color: #F2949B;
    --bs-btn-border-color: #E63946;
    --bs-btn-hover-bg: #C42B37;
    --bs-btn-hover-border-color: #C42B37;
    --bs-btn-hover-color: #FFFFFF;
}
.btn-outline-secondary {
    --bs-btn-color: var(--bs-secondary-color);
    --bs-btn-border-color: var(--bs-border-color);
    --bs-btn-hover-bg: rgba(var(--bs-secondary-rgb), 0.15);
    --bs-btn-hover-color: var(--bs-body-color);
    --bs-btn-hover-border-color: var(--bs-secondary);
    --bs-btn-active-bg: rgba(var(--bs-secondary-rgb), 0.25);
    --bs-btn-active-color: var(--bs-body-color);
    --bs-btn-active-border-color: var(--bs-secondary);
}
.form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}
.form-check-input:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}
.pagination {
    --bs-pagination-color: var(--bs-link-color);
    --bs-pagination-hover-color: var(--bs-link-hover-color);
    --bs-pagination-focus-color: var(--bs-link-hover-color);
    --bs-pagination-active-bg: var(--bs-primary);
    --bs-pagination-active-border-color: var(--bs-primary);
    --bs-pagination-active-color: var(--compound-ink-on-accent);
}
.progress-bar { background-color: var(--bs-primary); color: var(--compound-ink-on-accent); }
.nav-pills {
    --bs-nav-pills-link-active-bg: var(--bs-primary);
    --bs-nav-pills-link-active-color: var(--compound-ink-on-accent);
}
.dropdown-menu {
    --bs-dropdown-link-active-bg: var(--bs-primary);
    --bs-dropdown-link-active-color: var(--compound-ink-on-accent);
}
.list-group {
    --bs-list-group-active-bg: var(--bs-primary);
    --bs-list-group-active-border-color: var(--bs-primary);
    --bs-list-group-active-color: var(--compound-ink-on-accent);
}

/* Cards must sit ON the canvas, not melt into it — BS 5.3's component-level
   --bs-card-bg: var(--bs-body-bg) shadows the :root token. */
.card { --bs-card-bg: var(--color-surface); }

/* ============================================================================
   Contrast pass — cyan is a fill, not a text color (light theme)
   ============================================================================ */
.text-primary, .text-info { color: var(--bs-link-color) !important; }
.badge.bg-primary, .badge.bg-info { color: var(--compound-ink-on-accent); }
.badge.bg-warning { color: #2E2208; }
.badge.bg-success { color: #06281A; }

/* ============================================================================
   Dark-mode component fixes (form fields, light-hardcoded components)
   ============================================================================ */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
    background-color: var(--bs-card-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .form-control::placeholder { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .table-light {
    --bs-table-bg: var(--bs-card-bg);
    --bs-table-color: var(--bs-body-color);
    --bs-table-border-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .btn-light {
    --bs-btn-bg: var(--bs-card-bg);
    --bs-btn-color: var(--bs-body-color);
    --bs-btn-border-color: var(--bs-border-color);
    --bs-btn-hover-bg: rgba(var(--bs-secondary-rgb), 0.2);
    --bs-btn-hover-color: var(--bs-body-color);
    --bs-btn-hover-border-color: var(--bs-secondary);
}
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ============================================================================
   Iron Room utilities (inline-style migration targets)
   ============================================================================ */
.icon-chip {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--bs-border-radius);
    flex: 0 0 auto;
}
.icon-chip-lg {
    width: 96px; height: 96px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--bs-border-radius);
    border: 2px solid var(--bs-border-color);
}
.icon-2xl { font-size: 3rem; }
.text-2xs { font-size: 0.75rem; }
.chart-wrap { position: relative; height: 240px; }
.chart-wrap-sm { position: relative; height: 200px; }
.chart-wrap-lg { position: relative; height: 320px; }
.mw-420 { max-width: 420px; }
.mw-460 { max-width: 460px; }
.mw-680 { max-width: 680px; }
.text-prewrap { white-space: pre-wrap; font-family: inherit; }
.scroll-sentinel { height: 1px; }
.search-results-scroll { max-height: 400px; overflow-y: auto; }
.accent-left-orange { border-left: 3px solid var(--compound-accent) !important; }
.week-numeral {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--bs-link-color);
}

/* Hover affordance: border accent, never blur (Iron Room elevation rule) */
.card-hover { transition: border-color 0.15s ease-in-out; }
.card-hover:hover { border-color: var(--bs-primary) !important; }

/* PR moments are ORANGE (--compound-accent), never yellow */
.pr-chip {
    background-color: var(--compound-accent);
    color: #321405;
}
.text-accent { color: var(--compound-accent) !important; }

/* Highlighted "all-time max" row in set-history tables — orange is reserved
   for the PR value itself; the rest of the row just gets weight. */
.is-max-row td { font-weight: 600; }
.is-max-row td.max-weight-cell { color: var(--compound-accent); }

/* Dashed ghost CTA (tracker "Add Exercise") */
.btn-dashed { border-style: dashed !important; border-width: 2px !important; }

/* Minimum touch target for icon-only text buttons */
.btn-touch {
    min-width: 36px; min-height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
}

/* Tracker empty-state hint — visible only while the exercise list is empty */
.tracker-empty-hint { display: none; }
#exerciseList:empty + .tracker-empty-hint { display: block; }

/* Settings unit cards — visible selected state */
.unit-card { cursor: pointer; transition: border-color 0.15s ease-in-out; }
.unit-card.active { border: 2px solid var(--bs-primary) !important; }

/* Home insight rail — bounded, scrolls internally instead of stretching the
   page. Thin visible scrollbar + bottom padding so the cut never looks broken. */
.insight-scroll {
    max-height: 560px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bs-border-color) transparent;
    padding-bottom: 0.75rem;
}
.insight-scroll::-webkit-scrollbar { width: 6px; }
.insight-scroll::-webkit-scrollbar-thumb { background: var(--bs-border-color); border-radius: 3px; }

/* Soft reveal for re-rendered async content (class-based, no inline styles) */
@keyframes fadeInSoft { from { opacity: 0; } to { opacity: 1; } }
.insight-reveal { animation: fadeInSoft 0.4s ease; }
@media (prefers-reduced-motion: reduce) { .insight-reveal { animation: none; } }

/* Tracker sticky save bar — themed component (replaces bg-white utility) */
.tracker-savebar {
    background-color: var(--bs-card-bg);
    border-top: 1px solid var(--bs-border-color);
}

/* Previous-session ghost values — read as intentional suggestions, not blanks */
.ghost-sets .weight-input:placeholder-shown,
.ghost-sets .reps-input:placeholder-shown,
.ghost-sets .bodyweight-input:placeholder-shown,
.ghost-sets .added-weight-input:placeholder-shown,
.ghost-sets .assist-weight-input:placeholder-shown,
.ghost-sets .duration-display-input:placeholder-shown,
.ghost-sets .distance-input:placeholder-shown {
    background-color: rgba(var(--bs-primary-rgb), 0.06);
    border-style: dashed;
}
.ghost-sets .weight-input:placeholder-shown::placeholder,
.ghost-sets .reps-input:placeholder-shown::placeholder {
    color: var(--bs-link-color);
    opacity: 0.75;
}

/* Skip link (a11y) */
.skip-link {
    position: absolute; left: 8px; top: 8px; z-index: 2100;
    background: var(--bs-primary); color: var(--compound-ink-on-accent);
    padding: 0.5rem 1rem; text-decoration: none;
}

/* ============================================================================
   Public landing page — graphite hero, cyan rule, data-as-decoration
   (theme-independent: the landing is the brand statement, always dark)
   ============================================================================ */
.landing-hero {
    background: #111316;
    color: #E8EAED;
    border-bottom: 2px solid #00B4D8;
}
.landing-hero .display-3 { letter-spacing: 0.02em; }
.landing-hero .lead { color: #8A939D; max-width: 560px; }
.landing-rule {
    width: 64px; height: 2px;
    background: #00B4D8;
    margin-bottom: 1.5rem;
}
.landing-stat-strip {
    background: #16181C;
    border-top: 1px solid #2E3238;
    border-bottom: 1px solid #2E3238;
    color: #E8EAED;
}
.landing-stat-strip .stat-value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.6rem;
    color: #00C8F0;
    line-height: 1;
}
.landing-stat-strip .stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8A939D;
}
.landing-feature-card {
    border: 1px solid var(--bs-border-color);
    border-top: 2px solid var(--bs-primary);
    height: 100%;
}
.landing-pr-flash {
    display: inline-block;
    background: #FF6B2B;
    color: #321405;
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.35rem 0.75rem;
}
.landing-cta-band {
    background: #111316;
    color: #E8EAED;
    border-top: 2px solid #00B4D8;
}
.share-sublabel {
    color: #8A939D;
    letter-spacing: 0.08em;
}

/* ============================================================================
   Workout Tracker Styles
   ============================================================================ */

/* Exercise cards */
.exercise-card {
    border-left: 3px solid var(--compound-primary);
    border-radius: var(--bs-border-radius);
    overflow: hidden;
    transition: border-left-color 0.15s ease-in-out;
}

.exercise-card:hover {
    box-shadow: none;
    border-left-color: var(--bs-link-hover-color);
}

.exercise-card .card-header {
    background-color: rgba(var(--bs-primary-rgb), 0.06);
    border-bottom: 1px solid var(--bs-border-color);
}

/* Exercise type badge */
.exercise-type-badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.35em 0.65em;
}

/* Set row hover state (theme-aware) */
.set-row:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

.set-row:hover .set-number-badge {
    background-color: var(--compound-primary);
    transform: scale(1.1);
    transition: transform 0.1s ease-in-out;
}

/* Compact input sizing for set rows */
.set-row .form-control {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    height: 31px; /* Compact height */
    line-height: 1.5;
}

.set-row .form-select {
    padding: 0.25rem 1.75rem 0.25rem 0.5rem;
    font-size: 0.875rem;
    height: 31px;
    line-height: 1.5;
}

/* Ensure weight inputs with units stay compact */
.set-row .weight-input-with-unit input {
    padding-right: 2rem; /* room for the unit suffix without starving the value */
    height: 31px;
}

.set-row .weight-input-with-unit::after {
    font-size: 0.7rem; /* Smaller unit label */
    right: 0.3rem;
}

/* Compact volume and PR display */
.set-row .volume-display {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.set-row .pr-cell {
    min-width: 110px;
    max-width: 110px;
    overflow: hidden;
}

.set-row .pr-badge {
    font-size: 0.7rem;
    padding: 0.2em 0.4em;
    margin-right: 0.25rem;
    display: inline-block;
    white-space: nowrap;
}

.set-row .pr-badge:last-child {
    margin-right: 0;
}

/* Ensure table rows stay compact */
.set-row td {
    vertical-align: middle;
    padding: 0.375rem 0.5rem;
}

/* Compact checkbox styling */
.set-row .form-check {
    margin-bottom: 0;
    min-height: 31px;
    display: flex;
    align-items: center;
}

.set-row .form-check-input {
    width: 1rem;
    height: 1rem;
    margin-top: 0;
}

.set-row .form-check-label {
    font-size: 0.75rem;
    margin-left: 0.35rem;
}

/* Tracker column widths (migrated from inline styles). The display:none
   toggles stay inline in the view — workout-tracker.js drives visibility via
   el.style.display and a CSS-hidden cell could never be re-shown. */
.workout-tracker th.col-set { width: 50px; }
.workout-tracker th.col-type { width: 100px; }
.workout-tracker th.bodyweight-header { width: 85px; }
.workout-tracker th.assist-weight-header { width: 70px; }
.workout-tracker th.added-weight-header { width: 75px; }
.workout-tracker th.weight-header { width: 95px; }
.workout-tracker th.reps-header { width: 60px; }
.workout-tracker th.duration-header { width: 85px; }
.workout-tracker th.distance-header { width: 75px; }
.workout-tracker th.steps-header { width: 75px; }
.workout-tracker th.rpe-header { width: 80px; }
.workout-tracker th.tempo-header { width: 80px; }
.workout-tracker th.loadbasis-header { width: 90px; }
.workout-tracker th.volume-header { width: 100px; }
.workout-tracker th.col-pr { width: 110px; }
.workout-tracker th.col-actions { width: 70px; }
.workout-tracker th.col-drag { width: 50px; }
.set-row .bodyweight-input { width: 85px; }
.set-row .assist-weight-input { width: 80px; }
.set-row .added-weight-input { width: 80px; }
.set-row .weight-input { width: 85px; }
.set-row .reps-input { width: 50px; }
.set-row .duration-display-input { width: 75px; }
.set-row .distance-input { width: 65px; }
.set-row .steps-input { width: 65px; }
.set-row .tempo-input { width: 70px; }
.set-row .loadbasis-select { width: 90px; }

/* Compact table headers */
.workout-tracker table thead th {
    padding: 0.5rem 0.5rem;
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bs-secondary-color);
    vertical-align: middle;
}

/* Ensure table doesn't grow row height */
.workout-tracker .table {
    margin-bottom: 0;
}

.workout-tracker .table td,
.workout-tracker .table th {
    border-color: var(--bs-border-color);
}

/* Completed set row — subtle success tint + left marker */
.set-row[data-is-complete="true"] {
    background-color: rgba(var(--bs-success-rgb), 0.08);
    border-left: 2px solid var(--compound-success);
}

.set-row[data-is-complete="true"] .set-complete-checkbox:checked {
    background-color: var(--compound-success);
    border-color: var(--compound-success);
}

/* PR badge animation */
.pr-badge {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Shake animation for input validation errors */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Fixed bottom bar - for workout tracker complete button */
.workout-tracker .fixed-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040; /* Bootstrap modal is 1055, navbar is 1030 */
    box-shadow: none;
    border-top: 1px solid var(--bs-border-color);
    border-radius: 0;
}

/* Add bottom padding to exercise list so last card isn't hidden */
.workout-tracker #exerciseList {
    padding-bottom: 80px; /* Space for fixed button */
}

/* Timer display - monospaced numbers for consistent width */
.duration-timer {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: color-mix(in srgb, var(--bs-body-bg) 90%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Exercise search results list */
#exerciseSearchResults .list-group-item {
    cursor: pointer;
}

#exerciseSearchResults .list-group-item:hover {
    background-color: var(--compound-light);
}

/* Set type badge colors (fills carry legible ink) */
.set-type-badge-normal {
    background-color: #5D6670;
    color: #FFFFFF;
}

.set-type-badge-warmup {
    background-color: var(--bs-warning);
    color: #2E2208;
}

.set-type-badge-dropset {
    background-color: var(--compound-accent);
    color: #321405;
}

.set-type-badge-rest-pause {
    background-color: #C42B37;
    color: #FFFFFF;
}

/* Volume display — action-cyan (AA in both themes; raw cyan fails on white) */
.volume-display {
    color: var(--bs-link-color);
}

/* Stats display */
#totalVolume,
#totalSets,
#totalExercises {
    color: var(--bs-link-color);
}

/* ============================================================================
   Form Enhancements
   ============================================================================ */

/* Remove spin buttons from number inputs */
input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Weight inputs with unit suffix */
.weight-input-with-unit {
    position: relative;
}

.weight-input-with-unit input {
    padding-right: 3rem;
}

.weight-input-with-unit::after {
    content: attr(data-unit);
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--compound-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    pointer-events: none;
}

/* Validation warning style */
.input-validation-warning {
    border-color: var(--compound-warning) !important;
    box-shadow: none !important;
}

/* Form focus states — crisp border change, no glow */
.form-control:focus,
.form-select:focus {
    border-color: var(--compound-primary);
    box-shadow: none;
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

/* Text truncation */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Cursor helpers */
.cursor-pointer {
    cursor: pointer;
}

.cursor-not-allowed {
    cursor: not-allowed;
}

/* Empty state — the one panel pattern (dashed hairline, quiet tint) */
.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-md);
    color: var(--color-text-muted);
    background: rgba(var(--bs-secondary-rgb), 0.08);
    border: 1px dashed var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

/* ============================================================================
   Accessibility
   ============================================================================ */

/* Keyboard navigation focus indicators — AA-contrast ring, all interactives */
.btn:focus-visible,
a:focus-visible,
.nav-link:focus-visible,
.page-link:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--focus-ring-color);
    outline-offset: 2px;
}

/* Touch target sizes */
.set-complete-checkbox {
    width: 1.5rem;
    height: 1.5rem;
    cursor: pointer;
}

.btn-sm {
    min-height: 44px;
    padding: 0.5rem 1rem;
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    .pr-badge {
        animation: none;
    }

    .exercise-card {
        transition: none;
    }

    .set-row:hover .set-number-badge {
        transform: none;
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .exercise-card {
        border-left-width: 6px;
    }

    .set-row[data-is-complete="true"] {
        border-left-width: 4px;
    }
}

/* ============================================================================
   Mobile Responsiveness
   ============================================================================ */

@media (max-width: 768px) {
    /* More space for fixed bottom bar on mobile */
    .workout-tracker #exerciseList {
        padding-bottom: 120px;
    }

    /* Improve stats hierarchy */
    #totalVolume {
        font-size: 2rem;
        font-weight: 700;
    }

    #totalSets,
    #totalExercises {
        font-size: 1.5rem;
        font-weight: 600;
    }
}

/* Exercise-card action cluster — compact, evenly sized (desktop: a tidy
   right-aligned row of icon buttons rather than sprawling full-width buttons). */
.exercise-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
}
.exercise-actions .btn {
    min-height: 40px;
}

@media (max-width: 576px) {
    /* Full width buttons on mobile */
    .fixed-bottom .container {
        padding: 0;
    }

    /* Title on its own line; actions become ONE evenly-sized row (4–5 across)
       instead of each button stretching to full width and stacking. */
    .exercise-card .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-sm);
    }
    .exercise-card .card-header .exercise-actions {
        width: 100%;
        justify-content: space-between;
    }
    .exercise-card .card-header .exercise-actions .btn {
        flex: 1 1 0;
        min-width: 0;
        min-height: 44px;
    }

    /* Set-logging table → stacked cards (no horizontal scroll mid-set on a phone).
       JS shows cells via style.display='' (CSS applies) and hides via 'none' (kept). */
    .workout-tracker .table-responsive { overflow-x: visible; }
    .workout-tracker table.table { border: 0; }
    .workout-tracker table.table thead { display: none; }
    .workout-tracker .set-row {
        display: block;
        border: 1px solid var(--color-border, #dee2e6);
        border-radius: var(--radius-md, 0.5rem);
        padding: 0.4rem 0.75rem;
        margin-bottom: 0.75rem;
        background: var(--color-surface, #fff);
    }
    .workout-tracker .set-row td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        width: 100%;
        border: 0;
        padding: 0.3rem 0;
        white-space: normal;
    }
    .workout-tracker .set-row td[data-label]::before {
        content: attr(data-label);
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--color-text-muted, #6c757d);
        flex: 0 0 auto;
    }
    /* Inputs/selects fill the right side of each row (override fixed inline widths) */
    .workout-tracker .set-row td .form-control,
    .workout-tracker .set-row td .form-select,
    .workout-tracker .set-row td .weight-input-with-unit,
    .workout-tracker .set-row td .weight-input-with-unit input {
        width: 100% !important;
        max-width: 62%;
        margin-left: auto;
    }
    /* Save toggle + delete: full-width, large tap targets */
    .workout-tracker .set-row .complete-cell .form-check {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        min-height: 44px;
        margin: 0;
        padding: 0;
    }
    .workout-tracker .set-row .set-complete-checkbox {
        width: 1.75rem;
        height: 1.75rem;
        margin: 0;
        float: none;
    }
    .workout-tracker .set-row .delete-set-btn { width: 100%; min-height: 40px; }
}


/* ============================================================================
   Touch targets & accessibility (phone-at-the-gym use)
   ============================================================================ */
.workout-tracker .set-complete-checkbox {
    width: 1.4rem;
    height: 1.4rem;
}

.workout-tracker .delete-set-btn {
    min-width: 40px;
    min-height: 40px;
}

@media (max-width: 768px) {
    /* Larger tap targets for sweaty/gloved fingers mid-workout */
    .workout-tracker .set-complete-checkbox {
        width: 1.75rem;
        height: 1.75rem;
    }
    .workout-tracker .delete-set-btn {
        min-width: 44px;
        min-height: 44px;
    }
    /* Keep the multi-column set table legible (horizontal scroll, no wrap) */
    .workout-tracker .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    .workout-tracker .table td,
    .workout-tracker .table th {
        white-space: nowrap;
    }
}

/* Completed-set status is not colour-only — add a check glyph for colour-blind / AT users. */
.workout-tracker .set-row[data-is-complete="true"] .set-complete-checkbox + .form-check-label::after {
    content: " \2713";
    font-weight: 700;
    color: var(--compound-success);
}

/* ============================================================================
   Print Styles
   ============================================================================ */
@media print {
    .no-print {
        display: none !important;
    }
}

/* ============================================================================
   Rest timer chip (F1) + finish-line celebration (F3)
   ============================================================================ */
.rest-timer-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--bs-border-radius);
    background: var(--color-surface, #f1f3f5);
    border: 1px solid var(--color-border, #dee2e6);
    font-weight: 600;
}
.rest-timer-chip .rest-time {
    min-width: 3.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-size: 1.1rem;
}
.rest-timer-chip .rest-label {
    color: var(--color-text-muted, #6c757d);
    font-weight: 500;
}
.rest-timer-chip.rest-done {
    background: var(--bs-success);
    color: #fff;
    border-color: var(--bs-success);
    animation: rest-flash 0.6s ease-in-out 2;
}
@keyframes rest-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

.e1rm-display { font-variant-numeric: tabular-nums; }

.celebrate-emoji {
    font-size: 3rem;
    animation: celebrate-pop 0.5s ease-out;
}
@keyframes celebrate-pop {
    0% { transform: scale(0.4); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 2000;
}
.confetti-piece {
    position: absolute;
    top: -10px;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    opacity: 0.9;
    animation: confetti-fall 3s linear forwards;
}
@keyframes confetti-fall {
    0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(105vh) rotate(720deg); opacity: 0.8; }
}
@media (prefers-reduced-motion: reduce) {
    .confetti-piece, .celebrate-emoji, .rest-timer-chip.rest-done { animation: none; }
}

/* Superset grouping — linked exercise cards share a colored left edge */
.exercise-card.superset-linked {
    border-left: 4px solid var(--bs-primary);
}

/* Advanced-options gating — hide opt-in fields unless the user enables them */
.workout-tracker.ff-hide-rpe .rpe-header,
.workout-tracker.ff-hide-rpe .rpe-cell { display: none !important; }
.workout-tracker.ff-hide-tempo .tempo-header,
.workout-tracker.ff-hide-tempo .tempo-cell { display: none !important; }
.workout-tracker.ff-hide-notes .set-note-btn { display: none !important; }
.workout-tracker.ff-hide-unilateral .loadbasis-header,
.workout-tracker.ff-hide-unilateral .loadbasis-cell { display: none !important; }

/* Training calendar heat-map — trained days are BRAND cyan, not green */
.cal-grid { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-col { display: flex; flex-direction: column; gap: 3px; }
.cal-cell { width: 14px; height: 14px; border-radius: 2px; background: var(--bs-border-color, #e9ecef); }
.cal-cell.cal-workout { background: var(--bs-primary); }
.cal-cell.cal-rest { background: var(--bs-secondary); }
.cal-cell.cal-today { box-shadow: inset 0 0 0 2px var(--compound-accent); }
.cal-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }
.cal-legend-dot.cal-workout { background: var(--bs-primary); }
.cal-legend-dot.cal-rest { background: var(--bs-secondary); }
.cal-month-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================================================
   Navbar / brand (relocated from views/partials/header.php inline <style>)
   Navbar is bg-dark in both themes — tokens here are theme-independent.
   ============================================================================ */
.navbar-brand-main {
    font-family: var(--font-heading, 'Barlow Condensed', sans-serif);
    font-size: 1.4rem;
    line-height: 1;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #FFFFFF;
    transition: color 0.2s ease-in-out;
}
.navbar-brand-main:hover { color: rgba(255, 255, 255, 0.85); }
.navbar-brand-sub {
    font-size: 0.70rem;
    line-height: 1;
    opacity: 0.7;
    font-weight: 400;
    color: #FFFFFF;
    transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;
    margin-top: -2px;
}
.navbar-brand-sub:hover { opacity: 1; color: rgba(255, 255, 255, 0.85); }
.navbar-brand-stack { line-height: 1; }

/* Crisp active nav: cyan accent + 2px underline, no pill highlight.
   Raw brand cyan is fine here — the navbar is dark in both themes. */
.navbar .nav-link { border-bottom: 2px solid transparent; border-radius: 0; }
.navbar .nav-link.active {
    color: #00C8F0 !important;
    border-bottom-color: #00C8F0;
}
.navbar .nav-link:hover { color: #00C8F0 !important; }

/* Compact the marketing footer on phones (app pages are thin; footer was ~40%
   of scroll at 390px) */
@media (max-width: 576px) {
    footer h5, footer h6 { font-size: 0.9rem; margin-bottom: 0.5rem; }
    footer .row > [class*="col"] { margin-bottom: 0.75rem; }
    footer ul li { line-height: 1.7; }
    footer { font-size: 0.85rem; }
}

/* ============================================================================
   Exercise Library page (relocated from views/pages/exercises.php <style>).
   Card rules are scoped under .exercise-library — the tracker reuses the
   .exercise-card class name for non-clickable cards and must not inherit
   cursor/hover. Blur shadows replaced with hairline/border accents (Iron Room).
   ============================================================================ */
.exercise-library .exercise-card {
    transition: border-color 0.2s ease;
    cursor: pointer;
    animation: fadeIn 0.3s ease-out;
}
.exercise-library .exercise-card:hover {
    transform: none;
    box-shadow: none !important;
    border-color: var(--bs-primary);
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.muscle-badge {
    font-size: 0.75rem;
    padding: 0.25em 0.5em;
    margin: 0.125rem;
    display: inline-block;
}
/* Muscle roles: primary = brand cyan (fill + ink), secondary/stabilizer = neutral.
   Red is reserved for destructive actions, not anatomy. */
.muscle-primary {
    background-color: var(--bs-primary);
    color: var(--compound-ink-on-accent);
}
.muscle-secondary {
    background-color: var(--bs-secondary-bg-subtle);
    color: var(--bs-secondary-text-emphasis);
}
.muscle-stabilizer {
    background-color: var(--bs-secondary-bg-subtle);
    color: var(--bs-secondary-text-emphasis);
}
.difficulty-beginner { color: var(--bs-success-text-emphasis); }
.difficulty-intermediate { color: var(--bs-warning-text-emphasis); }
.difficulty-advanced { color: var(--bs-danger-text-emphasis); }
.exercise-meta {
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
}

/* Sticky sidebar on desktop */
@media (min-width: 992px) {
    .filter-sidebar {
        position: sticky;
        top: 80px;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }
}
/* Mobile filter sidebar */
@media (max-width: 991px) {
    .filter-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        z-index: 1040;
        background: var(--bs-card-bg);
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .filter-sidebar.show { transform: translateX(0); }
    .filter-sidebar .card { border: none; box-shadow: none; }
}

/* Skeleton loading cards */
.skeleton-card {
    background: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    padding: 1rem;
    height: 200px;
}
.skeleton-title, .skeleton-badges, .skeleton-meta, .skeleton-muscles {
    height: 16px;
    background: linear-gradient(90deg, var(--bs-border-color) 25%, var(--bs-tertiary-bg) 50%, var(--bs-border-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 2px;
    margin-bottom: 12px;
}
.skeleton-title { height: 24px; width: 70%; }
.skeleton-badges { height: 20px; width: 50%; }
.skeleton-meta { width: 80%; }
.skeleton-muscles { width: 90%; margin-bottom: 0; }
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Active filter badges */
.filter-badge { cursor: pointer; transition: opacity 0.2s; }
.filter-badge:hover { opacity: 0.8; }

/* ---------- Exercise detail modal (normalized to the Iron Room system:
   surface header + hairline rule + cyan top accent, no colored slab) ---------- */
#exerciseDetailModal .modal-content { border-top: 2px solid var(--bs-primary); }
#exerciseDetailModal .modal-header {
    background: var(--bs-card-bg);
    border-bottom: 1px solid var(--bs-border-color);
    padding: 1.25rem 1.5rem;
}
#exerciseDetailModal .modal-title {
    color: var(--bs-body-color);
    font-weight: 700;
    font-size: 1.5rem;
}
#exerciseDetailModal .modal-body {
    padding: 2rem;
    background: var(--bs-tertiary-bg);
    max-height: 75vh;
    overflow-y: auto;
}
.modal.fade .modal-dialog { transition: transform 0.3s ease-out; transform: scale(0.95); }
.modal.show .modal-dialog { transform: scale(1); }

.exercise-badges-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.quick-stats-bar {
    display: flex;
    gap: 2rem;
    background: var(--bs-card-bg);
    padding: 1rem 1.5rem;
    border-radius: var(--bs-border-radius);
    border: 1px solid var(--bs-border-color);
    margin-bottom: 1.5rem;
    box-shadow: none;
    flex-wrap: wrap;
}
.stat-item { display: flex; align-items: center; gap: 0.5rem; }
.stat-item i { color: var(--bs-link-color); font-size: 1.1rem; }
.stat-item span { font-weight: 600; color: var(--bs-body-color); }

.exercise-info-section,
.muscle-targets-section {
    background: var(--bs-card-bg);
    border-radius: var(--bs-border-radius);
    border: 1px solid var(--bs-border-color);
    padding: 1.5rem;
    box-shadow: none;
    margin-bottom: 1.5rem;
}
.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--bs-border-color);
}
.section-header i { margin-right: 0.5rem; color: var(--bs-link-color); font-size: 1.1rem; }
.section-header h6 {
    margin: 0;
    font-weight: 700;
    color: var(--bs-body-color);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.exercise-description p { color: var(--bs-body-color); line-height: 1.7; margin-bottom: 0; }
.exercise-instructions {
    background: var(--bs-tertiary-bg);
    border-radius: var(--bs-border-radius);
    padding: 1.5rem;
    border-left: 4px solid var(--bs-primary);
}
.instruction-section { margin-bottom: 1.5rem; }
.instruction-section:last-child { margin-bottom: 0; }
.instruction-section-title {
    color: var(--bs-body-color);
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}
.instruction-section-title i { color: var(--bs-link-color); font-size: 0.9rem; }
.instruction-section-content { color: var(--bs-secondary-color); line-height: 1.7; margin: 0; font-size: 0.95rem; }
.instruction-list { padding-left: 1.5rem; margin-bottom: 0; }
.instruction-list li { margin-bottom: 0.75rem; color: var(--bs-body-color); line-height: 1.6; }
.instruction-list li:last-child { margin-bottom: 0; }
.tips-box {
    background: var(--bs-warning-bg-subtle);
    border-left: 4px solid var(--bs-warning);
    padding: 1rem 1.5rem;
    border-radius: var(--bs-border-radius);
    position: relative;
}
.tips-box i.fa-quote-left { color: var(--bs-warning); opacity: 0.5; font-size: 1.5rem; margin-bottom: 0.5rem; }
.tips-box p { margin: 0; color: var(--bs-warning-text-emphasis); line-height: 1.6; font-style: italic; }

/* Muscle circles (donut charts) */
.muscle-circles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.muscle-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem 0.75rem;
    background: var(--bs-tertiary-bg);
    border: 1px solid transparent;
    border-radius: var(--bs-border-radius);
    transition: border-color 0.3s;
    cursor: default;
    position: relative;
}
.muscle-card:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--bs-border-color);
}
.muscle-circle {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: circleFadeIn 0.6s ease-out;
    margin-bottom: 0.75rem;
    background: conic-gradient(
        var(--muscle-color) calc(var(--percentage) * 1%),
        var(--bs-border-color) calc(var(--percentage) * 1%),
        var(--bs-border-color) 100%
    );
}
@keyframes circleFadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}
.muscle-circle::before {
    content: '';
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--bs-card-bg);
}
.muscle-circle-content { position: relative; z-index: 1; text-align: center; }
.muscle-percentage { font-size: 1.35rem; font-weight: 700; line-height: 1; color: var(--muscle-color); }
.muscle-info { width: 100%; }
.muscle-role-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 2px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
}
.muscle-role-primary { background: var(--bs-primary); color: var(--compound-ink-on-accent); }
.muscle-role-secondary { background: var(--bs-secondary-bg-subtle); color: var(--bs-secondary-text-emphasis); }
.muscle-role-stabilizer { background: var(--bs-secondary-bg-subtle); color: var(--bs-secondary-text-emphasis); }
.muscle-name { font-weight: 700; color: var(--bs-body-color); font-size: 0.85rem; margin-bottom: 0.2rem; }
.muscle-region { font-size: 0.7rem; color: var(--bs-secondary-color); }

.muscle-popup {
    position: absolute;
    z-index: 1050;
    background: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: none;
    padding: 1rem;
    min-width: 250px;
    max-width: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: none;
}
.muscle-card:hover .muscle-popup { opacity: 1; pointer-events: auto; display: block; }
.muscle-popup-content { text-align: center; }
.muscle-popup img { max-width: 100%; height: auto; border-radius: var(--bs-border-radius); display: block; }
.muscle-attribution {
    margin-top: 0.5rem;
    font-size: 0.65rem;
    color: var(--bs-secondary-color);
    font-style: italic;
    border-top: 1px solid var(--bs-border-color);
    padding-top: 0.5rem;
    line-height: 1.3;
}
.modal-video-button {
    width: 100%;
    text-align: center;
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--bs-border-color);
}

@media (max-width: 991px) {
    #exerciseDetailModal .modal-body { padding: 1.5rem; }
    .muscle-circles-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .muscle-circle { width: 70px; height: 70px; }
    .muscle-circle::before { width: 52px; height: 52px; }
    .muscle-percentage { font-size: 1rem; }
    .muscle-card { padding: 0.75rem 0.5rem; }
}
@media (max-width: 576px) {
    .quick-stats-bar { gap: 1rem; }
    .muscle-circles-grid { grid-template-columns: 1fr; }
    #exerciseDetailModal .modal-title { font-size: 1.25rem; }
    .muscle-popup {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: 90vw;
        max-height: 70vh;
        overflow-y: auto;
    }
    .muscle-popup.active { opacity: 1; pointer-events: auto; display: block; }
}

/* Motion guards for the relocated animations */
@media (prefers-reduced-motion: reduce) {
    .exercise-library .exercise-card,
    .skeleton-title, .skeleton-badges, .skeleton-meta, .skeleton-muscles,
    .muscle-circle,
    .modal.fade .modal-dialog,
    .filter-sidebar {
        animation: none !important;
        transition: none !important;
    }
}

/* Round C */
/* Tracker page-level bottom padding — keeps the fixed save bar from occluding
   the last content (Add Exercise button / notes) at every viewport width. */
.tracker-page-pad { padding-bottom: 110px; }

/* ============================================================================
   Wave 3 — recovery adherence, mobile bottom nav, landing product shot,
   onboarding steps
   ============================================================================ */

/* Supplement adherence dots (last 7 days) */
.adherence-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: var(--bs-border-color);
}
.adherence-dot.taken { background: var(--bs-primary); }

/* Mobile bottom nav — one-hand reach to the five core destinations.
   Hidden ≥lg (top navbar takes over) and on the tracker (save bar owns
   the bottom edge — gated in PHP as well). */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1035; /* under modals (1055), over content */
    display: flex;
    background-color: var(--bs-card-bg);
    border-top: 1px solid var(--bs-border-color);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0.5rem 0 0.4rem;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bs-secondary-color);
    text-decoration: none;
    min-height: 52px;
}
.bottom-nav-item i { font-size: 1.05rem; }
.bottom-nav-item.active {
    color: var(--bs-link-color);
    box-shadow: inset 0 2px 0 var(--bs-primary);
}
.bottom-nav-item:hover { color: var(--bs-link-color); }
.bottom-nav-primary {
    color: var(--compound-ink-on-accent);
    background: var(--bs-primary);
}
.bottom-nav-primary:hover { color: var(--compound-ink-on-accent); background: var(--compound-primary-hover); }
/* Keep page content clear of the fixed bar on phones */
@media (max-width: 991.98px) {
    body:has(.bottom-nav) main { padding-bottom: 64px; }
    body:has(.bottom-nav) footer { padding-bottom: 64px; }
}

/* Landing product-proof shot — framed live tracker strip */
.landing-shot {
    border: 2px solid #00B4D8;
    background: #111316;
    padding: 4px;
    max-width: 720px;
}
.landing-shot img { display: block; width: 100%; }

/* Onboarding step numerals (first-run checklist) */
.step-numeral {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--compound-ink-on-accent);
    background: var(--bs-primary);
    border-radius: var(--bs-border-radius);
}
