/* ================================================
   Project Overload — Clean Theme
   ================================================ */

/* --- Design Tokens --- */
:root {
    --color-primary:       #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #eff6ff;
    --color-success:       #059669;
    --color-warning:       #d97706;
    --color-danger:        #dc2626;
    --color-info:          #0284c7;

    --sidebar-bg:          #1e293b;
    --sidebar-width:       256px;
    --sidebar-text:        rgba(255, 255, 255, 0.6);
    --sidebar-text-hover:  #ffffff;
    --sidebar-active-bg:   rgba(255, 255, 255, 0.1);
    --sidebar-active-text: #ffffff;
    --sidebar-border:      rgba(255, 255, 255, 0.07);

    --page-bg:       #f1f5f9;
    --card-bg:       #ffffff;
    --card-border:   #e2e8f0;
    --card-shadow:   0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --card-shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.1);

    --text-base:    #0f172a;
    --text-muted:   #64748b;
    --text-label:   #475569;
    --border-color: #e2e8f0;

    --radius-sm: 0.5rem;
    --radius-md: 0.625rem;
    --radius-lg: 0.875rem;

    /* Bootstrap overrides */
    --bs-primary:        #2563eb;
    --bs-primary-rgb:    37, 99, 235;
    --bs-success:        #059669;
    --bs-success-rgb:    5, 150, 105;
    --bs-warning:        #d97706;
    --bs-warning-rgb:    217, 119, 6;
    --bs-danger:         #dc2626;
    --bs-danger-rgb:     220, 38, 38;
    --bs-info:           #0284c7;
    --bs-info-rgb:       2, 132, 199;
    --bs-body-bg:        var(--page-bg);
    --bs-body-color:     var(--text-base);
    --bs-border-color:   var(--border-color);
    --bs-secondary:      #64748b;
    --bs-secondary-rgb:  100, 116, 139;
}

/* --- Base --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }

body.app-shell {
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
    background: var(--page-bg);
    color: var(--text-base);
    overflow-x: hidden;
    display: flex;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Space Grotesk", system-ui, sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

a {
    color: var(--color-primary);
}
a:hover {
    color: var(--color-primary-hover);
}

/* --- Sidebar --- */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    z-index: 1030;
    overflow-y: auto;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.app-sidebar__brand {
    padding: 1.125rem 1.25rem;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.app-sidebar__logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: #ffffff;
    text-decoration: none;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.app-sidebar__logo i {
    color: #60a5fa;
    font-size: 1rem;
}

.app-sidebar__logo:hover { color: #ffffff; }

.app-sidebar__nav {
    flex: 1;
    padding: 0.875rem 0.75rem;
    overflow-y: auto;
}

.app-sidebar__section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
    padding: 0.5rem 0.625rem 0.25rem;
    margin-top: 0.5rem;
}

.app-sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.675rem;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.13s ease, color 0.13s ease;
    margin-bottom: 0.125rem;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.app-sidebar__link i {
    width: 1rem;
    text-align: center;
    font-size: 0.875rem;
    flex-shrink: 0;
    opacity: 0.8;
}

.app-sidebar__link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--sidebar-text-hover);
}

.app-sidebar__link:hover i { opacity: 1; }

.app-sidebar__link.active {
    background: rgba(37, 99, 235, 0.15);
    color: var(--sidebar-active-text);
    font-weight: 600;
    border-left: 2px solid #60a5fa;
    padding-left: calc(0.625rem - 2px);
}

.app-sidebar__link.active i {
    color: #60a5fa;
    opacity: 1;
}

.app-sidebar__divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: 0.625rem 0.75rem;
}

.app-sidebar__footer {
    padding: 0.75rem;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

/* --- Sidebar overlay (mobile) --- */
.app-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1029;
    backdrop-filter: blur(2px);
}

.app-sidebar-overlay.is-visible {
    display: block;
}

/* --- Content wrapper --- */
.app-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-content.has-sidebar {
    margin-left: var(--sidebar-width);
}

/* --- Mobile topbar --- */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: 3.25rem;
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 0.75rem;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.app-topbar__toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 1rem;
    padding: 0.35rem 0.45rem;
    cursor: pointer;
    border-radius: 0.375rem;
    line-height: 1;
    transition: background 0.13s, color 0.13s;
}

.app-topbar__toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.app-topbar__brand {
    color: #ffffff;
    text-decoration: none;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: 0.9375rem;
}

.app-topbar__brand:hover { color: #ffffff; }

/* --- Public navbar (unauthenticated pages) --- */
.app-navbar {
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.app-navbar .navbar-brand {
    color: #ffffff;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: 1rem;
}

.app-navbar .navbar-brand:hover { color: #ffffff; }

.app-navbar .navbar-nav .nav-link {
    color: var(--sidebar-text);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.7rem;
    font-size: 0.875rem;
    transition: background 0.13s, color 0.13s;
}

.app-navbar .navbar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.app-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.2);
}

/* --- Main content area --- */
.app-main {
    flex: 1;
    padding-top: 1.75rem;
    padding-bottom: 2.5rem;
    animation: page-enter 0.22s ease-out;
}

@keyframes page-enter {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Footer --- */
.app-footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    padding: 0.875rem 0;
}

.app-footer .text-muted {
    color: var(--text-muted) !important;
    font-size: 0.8125rem;
}

/* --- Page header --- */
.page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

.page-header > div:first-child {
    min-width: 0;
    flex: 1 1 280px;
}

.page-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
}

.page-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.page-actions form { margin: 0; }

/* --- Cards --- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

.card-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--card-border);
    padding: 0.875rem 1.25rem;
}

.card-body {
    padding: 1.25rem;
}

.card .text-muted { color: var(--text-muted) !important; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.45rem 1rem;
    letter-spacing: 0.01em;
    border: 1.5px solid transparent;
    transition: background-color 0.13s ease, border-color 0.13s ease,
                box-shadow 0.13s ease, transform 0.13s ease;
    box-shadow: none;
}

.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.btn:active { transform: translateY(0); }

.btn-sm {
    font-size: 0.8rem;
    padding: 0.275rem 0.7rem;
}

.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.28);
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    color: #fff;
}

.btn-secondary {
    background: #fff;
    border-color: var(--border-color);
    color: var(--text-label);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text-base);
}

.btn-success {
    background: var(--color-success);
    border-color: var(--color-success);
    color: #fff;
    box-shadow: 0 1px 3px rgba(5, 150, 105, 0.28);
}

.btn-success:hover {
    background: #047857;
    border-color: #047857;
    color: #fff;
}

.btn-danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: #fff;
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.28);
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

.btn-info {
    background: var(--color-info);
    border-color: var(--color-info);
    color: #fff;
}

.btn-outline-secondary {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-muted);
}

.btn-outline-secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--text-base);
}

.btn-outline-secondary.active,
.btn-outline-secondary:active {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: #fff !important;
}

.btn-outline-danger {
    background: transparent;
    border-color: #fca5a5;
    color: var(--color-danger);
}

.btn-outline-danger:hover {
    background: #fef2f2;
    border-color: var(--color-danger);
    color: var(--color-danger);
}

/* --- Forms --- */
.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-label);
    margin-bottom: 0.3rem;
}

.form-control,
.form-select {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-base);
    font-size: 0.9rem;
    transition: border-color 0.13s ease, box-shadow 0.13s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    outline: none;
}

.form-check-input {
    border-color: #cbd5e1;
}

.form-check-input:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    border-color: #93c5fd;
}

/* --- Tables --- */
.table-responsive {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #fff;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-base);
    --bs-table-hover-bg: #f8fafc;
    --bs-table-border-color: var(--border-color);
}

.table thead th {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    padding: 0.625rem 0.875rem;
}

.table > :not(caption) > * > * {
    padding: 0.75rem 0.875rem;
    vertical-align: middle;
}

/* --- Badges --- */
.badge {
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.3em 0.65em;
    letter-spacing: 0.02em;
}

.badge.bg-light {
    color: var(--text-label);
    background: #f1f5f9 !important;
    border: 1px solid var(--border-color);
}

/* --- Alerts --- */
.alert {
    border-radius: var(--radius-md);
    border-width: 1px;
    font-size: 0.9rem;
    box-shadow: none;
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.alert-danger, .alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.alert-primary {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

/* --- List groups --- */
.list-group-item {
    border-color: var(--border-color);
    color: var(--text-base);
    background: transparent;
}

.list-group-item-action:hover,
.list-group-item-action:focus {
    background: #f8fafc;
    color: var(--text-base);
}

/* --- Modals --- */
.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom-color: var(--border-color);
    padding: 1rem 1.25rem;
}

.modal-footer {
    border-top-color: var(--border-color);
    padding: 0.875rem 1.25rem;
}

/* --- Pagination --- */
.pagination { gap: 0.15rem; }

.pagination .page-link {
    border-radius: var(--radius-sm);
    color: var(--text-label);
    border-color: var(--border-color);
    font-size: 0.875rem;
}

.pagination .page-link:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
    border-color: #bfdbfe;
}

.pagination .active > .page-link {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.pagination .disabled > .page-link {
    color: #94a3b8;
    background: #f8fafc;
}

/* --- Text utilities --- */
.text-muted { color: var(--text-muted) !important; }

/* --- Workout Builder --- */
.workout-builder__available,
.workout-builder__selected {
    max-height: 22rem;
    overflow-y: auto;
}

.workout-builder .list-group-item { background: #fff; }
.workout-builder__option.is-selected { opacity: 0.55; }
.workout-builder__order { display: inline-block; min-width: 1.6rem; color: var(--text-muted); }
.workout-builder__selected-item .btn-group .btn { min-width: 2rem; }

/* --- Workout Runner --- */
.workout-runner .workout-exercise-card .card-body { padding: 1rem 1.25rem 0.85rem; }
.workout-runner .card-title { font-size: 1rem; }

.workout-runner .input-group-text {
    min-width: 5.5rem;
    justify-content: center;
    font-weight: 600;
    font-size: 0.84rem;
    background: #f8fafc;
    border-color: var(--border-color);
}

.workout-runner .set-input {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.workout-runner .set-input.active-rep-input {
    border-color: #93c5fd;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.workout-runner .workout-status { margin-bottom: 0.85rem; }

.workout-runner .plate-config {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    padding: 0.75rem;
}

.workout-runner .plate-config p:last-child,
.workout-runner .plate-config .small > div:last-child {
    margin-bottom: 0;
}

.workout-actions {
    position: sticky;
    bottom: 0.75rem;
    z-index: 1020;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem 0.9rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

.workout-runner .workout-form { padding-bottom: 7rem; }
.workout-actions__prompt { flex: 1 1 270px; min-width: 210px; }
.workout-actions__prompt .fw-semibold { line-height: 1.3; }

.workout-actions__progress {
    width: 100%;
    height: 0.375rem;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.workout-actions__progress-fill {
    height: 100%;
    width: 0%;
    background: var(--color-primary);
    transition: width 0.22s ease;
}

.workout-actions__rep-controls,
.workout-actions__submit {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.workout-actions__rep-controls .btn { min-width: 7rem; }

.workout-actions__session {
    flex: 0 1 13.5rem;
    min-width: 12rem;
    margin-left: auto;
}

.workout-actions__session summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid var(--border-color);
    border-radius: 999px;
    background: #f8fafc;
    color: var(--text-label);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.13s, border-color 0.13s, color 0.13s;
}

.workout-actions__session summary::-webkit-details-marker { display: none; }

.workout-actions__session[open] summary {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1e40af;
}

.workout-actions__session .workout-actions__submit { justify-content: flex-end; }
.workout-actions form { margin: 0; }
.workout-runner-v2 { max-width: 940px; margin: 0 auto; }

/* --- Coach Cards --- */
.coach-workout-form { margin-bottom: 1rem; }

.coach-header {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 0.875rem 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--card-shadow);
}
.coach-header__timer-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}
.coach-header__timer {
    font-size: 0.95rem;
    font-family: monospace;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.coach-exercise-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.coach-exercise-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 0.875rem 1rem;
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.coach-exercise-card:hover { box-shadow: var(--card-shadow-hover); }
.coach-exercise-card.is-active {
    border: 2px solid var(--color-primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
    cursor: default;
}
.coach-exercise-card.is-completed { border-color: var(--color-success); }
.coach-exercise-card.is-skipped { opacity: 0.5; order: 999; }
.coach-exercise-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.coach-exercise-card__name { font-weight: 700; font-size: 0.9rem; color: var(--text-base); }
.coach-exercise-card__subtitle { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
.coach-exercise-card__badge { font-size: 0.65rem; font-weight: 600; padding: 0.2rem 0.5rem; border-radius: 999px; }
.coach-exercise-card__check {
    background: var(--color-success);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.coach-exercise-card__body { margin-top: 0.75rem; }

.coach-weight-row {
    background: var(--color-primary-light);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
    margin-bottom: 0.75rem;
}
.coach-weight-row__label { font-size: 0.65rem; text-transform: uppercase; color: var(--text-muted); font-weight: 500; }
.coach-weight-row__value { font-size: 1.1rem; font-weight: 700; color: var(--color-primary); }

.coach-card-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}
.coach-card-pills .coach-log-pill {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.coach-rest-banner {
    background: var(--color-primary-light);
    border-bottom: 1px solid #bfdbfe;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 0.625rem 0.875rem;
    margin: -0.875rem -1rem 0.75rem -1rem;
}
.coach-rest-banner__time {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--color-primary);
    font-family: monospace;
    font-variant-numeric: tabular-nums;
}
.coach-rest-banner__label { font-size: 0.7rem; color: var(--text-muted); }
.coach-exercise-card.is-resting .coach-exercise-card__body > *:not(.coach-rest-banner) { opacity: 0.6; }

.coach-reps-input {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    margin: 0.75rem 0;
}
.coach-reps-stepper {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: #f8fafc;
    color: var(--text-label);
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    -webkit-tap-highlight-color: transparent;
}
.coach-reps-stepper:active {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
}
.coach-reps-value {
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    width: 80px;
    border: none;
    background: transparent;
    color: var(--text-base);
    -moz-appearance: textfield;
}
.coach-reps-value::-webkit-inner-spin-button,
.coach-reps-value::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.coach-log-set-btn { min-height: 48px; font-size: 0.95rem; font-weight: 700; flex: 1; }
.coach-log-zero-btn { min-height: 48px; min-width: 48px; font-weight: 600; }

.coach-skip-link {
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0;
    min-height: 44px;
}
.coach-skip-link:hover { color: var(--color-warning); }
.coach-skip-confirm {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

.coach-inline-alert { margin-bottom: 0; }

.coach-weight-increase-callout {
    background: linear-gradient(135deg, #dcfce7, #d1fae5);
    border: 2px solid #86efac;
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 14px;
}
.coach-weight-increase-callout .callout-title {
    font-weight: 700;
    font-size: 15px;
    color: #166534;
}
.coach-weight-increase-callout .callout-detail {
    font-size: 0.8125rem;
    color: #15803d;
    line-height: 1.5;
}
.coach-weight-input-highlight {
    border-color: #86efac !important;
    background-color: #f0fdf4 !important;
}

.coach-stage {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    padding: 0.875rem;
}

.coach-stage__actions { display: flex; align-items: center; gap: 0.5rem; }
.coach-stage__actions .btn { width: 100%; }
.coach-stage__quick { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.coach-set-label {
    font-weight: 700;
    color: var(--text-label);
    margin-bottom: 0.42rem;
}

.coach-plate-preview {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.625rem 0.75rem;
    background: var(--color-primary-light);
}

.coach-log-pill {
    border: 1.5px solid var(--border-color);
    border-radius: 999px;
    background: #f8fafc;
    color: var(--text-label);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.coach-log-pill.is-pending { opacity: 0.8; }
.coach-log-pill.is-hit    { border-color: #198754; background: #198754; color: #fff; }
.coach-log-pill.is-above  { border-color: #0d6efd; background: #0d6efd; color: #fff; }
.coach-log-pill.is-below  { border-color: #dc3545; background: transparent; color: #dc3545; }
.coach-log-pill.is-active { border-color: #93c5fd; background: #dbeafe; color: #1e3a8a; }

.coach-cancel-form { margin-bottom: 0.35rem; }

/* --- Filter groups --- */
.filter-group .btn { font-size: 0.8125rem; }

/* --- Code --- */
pre, code { border-radius: var(--radius-sm); }

/* --- Focus skip link --- */
.visually-hidden-focusable:focus {
    z-index: 1081;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* ======================
   Responsive
   ====================== */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
    }

    .app-sidebar.is-open {
        transform: translateX(0);
    }

    .app-content.has-sidebar {
        margin-left: 0;
    }

    .app-main {
        padding-top: 1.25rem;
        padding-bottom: 2rem;
    }
}

@media (max-width: 767.98px) {
    .page-header { align-items: stretch; }
    .page-header > div:first-child { flex-basis: 100%; }

    .page-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
    }

    .page-actions > .btn,
    .page-actions > a.btn,
    .page-actions > button.btn,
    .page-actions > form,
    .page-actions > .btn-group { width: 100%; }

    .page-actions > form .btn { width: 100%; }

    .page-actions > .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.45rem;
    }

    .page-actions > .btn-group .btn { width: 100%; }

    .filter-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
        width: 100%;
    }

    .filter-group .btn {
        flex: 1 1 calc(50% - 0.35rem);
        min-width: 100px;
    }

    .filter-group.btn-group > .btn,
    .filter-group.btn-group > .btn-group {
        margin-left: 0;
        border-radius: 999px !important;
    }

    .filter-group.filter-group-compact .btn {
        flex: 1 1 calc(33.333% - 0.35rem);
        min-width: 88px;
    }

    .workout-runner-v2 { max-width: 100%; }
    .coach-header { padding: 0.75rem; }
    .coach-exercise-card { padding: 0.75rem; }
    .coach-exercise-card.is-active { padding: 0.75rem; }
    .coach-reps-stepper { width: 52px; height: 52px; }
    .coach-reps-value { font-size: 2.2rem; }
    .coach-rest-banner { margin: -0.75rem -0.75rem 0.625rem; padding: 0.5rem 0.75rem; }
    .coach-rest-banner__time { font-size: 1.1rem; }

    .coach-stage { padding: 0.75rem; }

    .coach-stage__quick {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.45rem;
    }

    .coach-stage__quick .btn { width: 100%; }
    #coachLogZeroBtn { grid-column: 1 / -1; }

    .coach-stage__actions .btn,
    .coach-cancel-form .btn { min-height: 2.8rem; }

    .coach-card-pills .coach-log-pill {
        flex: 1 1 calc(50% - 0.35rem);
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .workout-runner .workout-exercise-card .card-body { padding: 0.85rem 0.9rem 0.8rem; }

    .workout-runner .input-group-text {
        min-width: 4.5rem;
        font-size: 0.78rem;
        padding-left: 0.45rem;
        padding-right: 0.45rem;
    }

    .workout-runner .set-input,
    .workout-runner input[type="number"] {
        min-height: 2.72rem;
        font-size: 1rem;
    }

    .workout-runner .workout-form { padding-bottom: 16rem; }

    .workout-actions {
        bottom: max(0.55rem, env(safe-area-inset-bottom));
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
    }

    .workout-actions__prompt,
    .workout-actions__rep-controls,
    .workout-actions__submit,
    .workout-actions__session { width: 100%; }

    .workout-actions__rep-controls,
    .workout-actions__submit {
        flex-direction: column;
        align-items: stretch;
    }

    .workout-actions__rep-controls .btn,
    .workout-actions__submit .btn,
    .workout-actions__submit form,
    .workout-actions__submit form .btn { width: 100%; }

    .workout-actions__session { min-width: 0; margin-left: 0; }
    .workout-actions__session summary { min-height: 2.6rem; }
    .workout-actions.is-editing .workout-actions__session { display: none; }
    .workout-actions .btn { min-height: 2.85rem; }

    .card:hover,
    .btn:hover { transform: none; }

    .table > :not(caption) > * > * { padding: 0.625rem 0.75rem; }

    /* Touch targets — ensure small buttons are at least 44px tall */
    .btn-sm { min-height: 2.75rem; }

    /* Tighter icon-only buttons inside tables */
    .table .btn-sm, .table .btn-group-sm > .btn { min-height: 2.5rem; padding-left: 0.5rem; padding-right: 0.5rem; }

    /* Tighter card padding on mobile */
    .card-body { padding: 0.875rem; }
    .card-header { padding: 0.75rem 0.875rem; }

    /* Page header: reduce h1 size */
    .page-header h1 { font-size: 1.25rem; }
}

/* Reps stepper buttons (+/−) in the set stage */
.coach-reps-stepper {
    min-width: 3.5rem;
    font-size: 1.1rem;
}
@media (max-width: 767px) {
    /* On mobile fingers need a big tap target — make them square and chunky */
    .coach-reps-stepper {
        min-width: 4.5rem;
        min-height: 3.75rem;
        font-size: 1.4rem;
    }
}

/* Rest timer done — pulse animation on coach card */
@keyframes rest-done-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5); }
    40%  { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0.2); }
    70%  { box-shadow: 0 0 0 20px rgba(37, 99, 235, 0.05); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
.rest-done-pulse {
    animation: rest-done-pulse 0.6s ease-out;
}

/* ======================
   Stat Cards with Accent Icons
   ====================== */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    border-radius: 3px 0 0 3px;
    background: var(--stat-accent, var(--border-color));
}

.stat-card .stat-card__icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
    background: var(--stat-icon-bg, #f1f5f9);
    color: var(--stat-icon-color, var(--text-muted));
}

.stat-card .stat-card__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-card .stat-card__value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: "Space Grotesk", system-ui, sans-serif;
    line-height: 1.2;
    color: var(--text-base);
}

.stat-card .stat-card__value small {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.stat-card .stat-card__sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* Stat card color variants */
.stat-card--streak    { --stat-accent: #f59e0b; --stat-icon-bg: #fffbeb; --stat-icon-color: #d97706; }
.stat-card--sessions  { --stat-accent: var(--color-primary); --stat-icon-bg: #eff6ff; --stat-icon-color: var(--color-primary); }
.stat-card--increases { --stat-accent: var(--color-success); --stat-icon-bg: #f0fdf4; --stat-icon-color: #059669; }
.stat-card--prs       { --stat-accent: #8b5cf6; --stat-icon-bg: #f5f3ff; --stat-icon-color: #7c3aed; }
.stat-card--count     { --stat-accent: var(--color-info); --stat-icon-bg: #eff6ff; --stat-icon-color: var(--color-info); }
.stat-card--rate      { --stat-accent: #10b981; --stat-icon-bg: #ecfdf5; --stat-icon-color: #059669; }
.stat-card--schedule  { --stat-accent: #f97316; --stat-icon-bg: #fff7ed; --stat-icon-color: #ea580c; }
.stat-card--entries   { --stat-accent: #06b6d4; --stat-icon-bg: #ecfeff; --stat-icon-color: #0891b2; }

/* ======================
   Progression Badges
   ====================== */
.badge-progression {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25em 0.55em;
    border-radius: 999px;
    white-space: nowrap;
}

.badge-weight-increase { background: #dcfce7; color: #166534; }
.badge-ramping         { background: #dbeafe; color: #1e40af; }
.badge-plateau         { background: #fef3c7; color: #92400e; }
.badge-deload          { background: #fef2f2; color: #dc2626; }

/* Progression inline status text (exercise lists) */
.progression-status { font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
.progression-status--increase { color: #166534; }
.progression-status--ramping  { color: #1e40af; }
.progression-status--plateau  { color: #92400e; }
.progression-status--deload   { color: #dc2626; }

/* ======================
   Card Hierarchy
   ====================== */
/* Non-interactive cards should NOT lift on hover */
.card--static:hover {
    box-shadow: var(--card-shadow);
    transform: none;
}

/* Action/CTA card — the main call-to-action (e.g., upcoming workout) */
.card--cta {
    border-color: var(--color-primary);
    border-width: 1.5px;
}

.card--cta .card-body {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.03) 0%, transparent 60%);
}

/* Section card — wraps content sections like exercise progress, recent activity */
.card--section {
    border: 1px solid var(--card-border);
}

.card--section:hover {
    box-shadow: var(--card-shadow);
}

/* ======================
   Chart Containers
   ====================== */
.chart-container--sm  { height: 160px; }
.chart-container--md  { height: 200px; }
.chart-container--lg  { height: 220px; }

/* ======================
   Achievement Badges
   ====================== */
.achievement-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.375rem 0.625rem;
    font-size: 0.8rem;
    background: #fff;
    transition: box-shadow 0.15s ease;
}

.achievement-badge:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.achievement-badge__icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.achievement-badge__name {
    font-weight: 600;
    line-height: 1.2;
}

.achievement-badge__desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.2;
}

/* ======================
   Login & Auth Pages
   ====================== */
.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.auth-hero-bg {
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e293b 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.auth-hero-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(37, 99, 235, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.auth-brand {
    font-family: "Space Grotesk", system-ui, sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-brand i { color: #60a5fa; font-size: 1.25rem; }

.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--text-base);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.oauth-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    color: var(--text-base);
}

/* ======================
   Landing / Home Page
   ====================== */
.hero-section {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    padding: 4rem 0 3rem;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 50%, rgba(37, 99, 235, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 20%, rgba(96, 165, 250, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.hero-section h1 {
    font-size: 2.5rem;
    letter-spacing: -0.03em;
}

.hero-section .lead {
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.125rem;
}

.feature-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    background: #fff;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.feature-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.feature-card__icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    margin-bottom: 0.875rem;
}

/* ======================
   Empty States
   ====================== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state__icon {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 1.5rem;
    background: #f1f5f9;
    color: var(--text-muted);
}

.empty-state__title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.empty-state__desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 28rem;
    margin: 0 auto 1.25rem;
}

/* ======================
   Misc Polish
   ====================== */

/* Section headers with consistent styling */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2,
.section-header h5,
.section-header h6 { margin-bottom: 0; }

/* Subtle row hover for tables */
.table-hover-subtle tbody tr:hover {
    background: rgba(37, 99, 235, 0.03);
}

/* Progress indicator for exercise goals */
.goal-progress {
    margin-top: 0.375rem;
}

.goal-progress__bar {
    height: 4px;
    border-radius: 2px;
    background: #e2e8f0;
    overflow: hidden;
}

.goal-progress__fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Nav tabs override for settings */
.nav-tabs .nav-link {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 0.6rem 1rem;
}

.nav-tabs .nav-link:hover {
    color: var(--text-base);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--color-primary);
    border-color: var(--border-color) var(--border-color) #fff;
    font-weight: 700;
}
