html, body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: #1a1a1a;
    background: #fafafa;
    line-height: 1.5;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.content {
    padding: 1.5rem 2rem 4rem;
    max-width: 64rem;
    margin: 0 auto;
}

h1 { font-size: 1.75rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.3rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 0.25rem 0; }

a { color: #0d6efd; text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: #6c757d; }
.meta { color: #6c757d; font-size: 0.9rem; margin: 0.25rem 0; }

.primary-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #0d6efd;
    color: white;
    border-radius: 0.25rem;
    margin-top: 0.5rem;
}
.primary-link:hover { background: #0b5ed7; text-decoration: none; }

.breadcrumb {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 1rem;
}
.breadcrumb a { color: #6c757d; }
.breadcrumb a:hover { color: #0d6efd; }

.card-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
    gap: 0.75rem;
}
.card {
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.5rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.08);
}
.card a {
    display: block;
    padding: 1rem 1.25rem;
    color: inherit;
}
.card a:hover { text-decoration: none; }
.card h2, .card h3 { margin: 0 0 0.5rem; color: #0d6efd; }
.card p { margin: 0.25rem 0; }

.exercise {
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}
.exercise-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.exercise-header h3 { margin: 0; }
.thumb {
    width: 64px;
    height: 36px;
    object-fit: cover;
    border-radius: 0.25rem;
    background: #eee;
}

.history {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}
.history th, .history td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #e1e4e8;
    text-align: left;
    white-space: nowrap;
}
.history th {
    background: #f6f8fa;
    font-weight: 600;
    color: #444;
}
.history td:first-child {
    font-weight: 500;
    color: #6c757d;
    width: 4rem;
}

.instructions {
    margin: 0.75rem 0 1rem;
    padding: 0.5rem 0.75rem;
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 0.25rem;
}
.instructions summary { cursor: pointer; color: #444; }
.instructions pre {
    margin: 0.5rem 0 0;
    white-space: pre-wrap;
    font-family: inherit;
    color: #444;
    font-size: 0.95rem;
}

/* Workout-logging form */
.day-actions { margin: 1rem 0 1.5rem; }

.session-meta {
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}
.session-meta label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: #444;
    font-size: 0.95rem;
}
.session-meta input {
    padding: 0.4rem 0.5rem;
    border: 1px solid #d0d4d9;
    border-radius: 0.25rem;
    font: inherit;
    width: max-content;
}

.log-form {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}
.log-form th, .log-form td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #e1e4e8;
    text-align: left;
}
.log-form th {
    background: #f6f8fa;
    font-weight: 600;
    color: #444;
}
.log-form td:first-child {
    font-weight: 500;
    color: #6c757d;
    width: 4rem;
}
.log-form input[type="number"] {
    width: 6rem;
    padding: 0.3rem 0.4rem;
    border: 1px solid #d0d4d9;
    border-radius: 0.25rem;
    font: inherit;
    text-align: right;
}
.log-form input[type="number"]:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
}

.set-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.set-button {
    padding: 0.35rem 0.75rem;
    background: white;
    border: 1px solid #d0d4d9;
    border-radius: 0.25rem;
    color: #444;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}
.set-button:hover { background: #f6f8fa; border-color: #0d6efd; color: #0d6efd; }

.session-notes {
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}
.session-notes label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    color: #444;
    font-size: 0.95rem;
}
.session-notes textarea {
    padding: 0.5rem 0.6rem;
    border: 1px solid #d0d4d9;
    border-radius: 0.25rem;
    font: inherit;
    resize: vertical;
}

.session-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0 3rem;
}
.session-actions button {
    border: none;
    cursor: pointer;
    font: inherit;
}
.session-actions button:disabled {
    opacity: 0.6;
    cursor: progress;
}
.cancel-link { color: #6c757d; }
.cancel-link:hover { color: #0d6efd; }

.error {
    background: #fdecea;
    border: 1px solid #f5c2c0;
    color: #842029;
    padding: 0.6rem 0.85rem;
    border-radius: 0.25rem;
    margin: 1rem 0;
}

/* Session-meta is the row with date picker + auto-fill toggle */
.session-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}
.session-meta .toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-direction: row;
}
.session-meta .toggle input[type="checkbox"] {
    transform: scale(1.2);
    cursor: pointer;
}

/* The little × button on an exercise card to remove it from the session */
.exercise-header { position: relative; }
.exercise-remove {
    margin-left: auto;
    background: none;
    border: 1px solid transparent;
    color: #6c757d;
    font-size: 1.25rem;
    line-height: 1;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.25rem;
    cursor: pointer;
}
.exercise-remove:hover {
    color: #842029;
    border-color: #f5c2c0;
    background: #fdecea;
}

/* Add-exercise modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 5rem 1rem 1rem;
    z-index: 1000;
}
.modal {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    max-width: 36rem;
    width: 100%;
    padding: 1.25rem 1.5rem 1.5rem;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.modal-header h2 { margin: 0; font-size: 1.2rem; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #6c757d;
    padding: 0 0.25rem;
}
.modal-close:hover { color: #842029; }
.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d0d4d9;
    border-radius: 0.25rem;
    font: inherit;
    box-sizing: border-box;
}
.search-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
}
.search-results {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.search-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e1e4e8;
    border-radius: 0.25rem;
    cursor: pointer;
}
.search-result:hover {
    border-color: #0d6efd;
    background: #f6f8fa;
}
.search-result.disabled {
    cursor: not-allowed;
    opacity: 0.55;
    background: #f6f8fa;
}
.search-result.disabled:hover {
    border-color: #e1e4e8;
    background: #f6f8fa;
}
.search-result img {
    width: 48px;
    height: 28px;
    object-fit: cover;
    border-radius: 0.25rem;
}
.search-result .small { font-size: 0.85rem; }

#blazor-error-ui {
    background: #ffd6d6;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Site header — hosts the wordmark logo. Centred on narrow screens,
   left-aligned at desktop widths so it sits above the same column as
   the page content. The logo image (logo.webp, 536x106) is height-
   capped to keep it from dominating the viewport on mobile. */
.site-header {
    background: white;
    border-bottom: 1px solid #e1e4e8;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
}

.site-logo {
    display: inline-flex;
    align-items: center;
    line-height: 0; /* prevent extra space below the inline image */
}

.site-logo img {
    height: 2.25rem; /* ~36px — comfortable for a wordmark in the header */
    width: auto;
    display: block;
}

@media (max-width: 480px) {
    .site-header {
        padding: 0.5rem 1rem;
        justify-content: center;
    }
    .site-logo img {
        height: 1.75rem;
    }
}

/* Horizontally-scrollable wrapper for wide tables (.history, .log-form).
   On desktop the table fits within the card; on mobile the wrapper lets
   the user swipe sideways instead of seeing content clipped off-screen.
   The negative margin + matching padding makes the scroll area extend to
   the full edge of the parent card so swipe gestures feel natural. */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Subtle hint that there's more to the right when scrollable. */
    background:
        linear-gradient(to right, white 30%, transparent),
        linear-gradient(to right, transparent, white 70%) right,
        radial-gradient(farthest-side at 0 50%, rgba(0,0,0,0.08), transparent),
        radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,0.08), transparent) right;
    background-repeat: no-repeat;
    background-size: 30px 100%, 30px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
}

/* Mobile-specific tightening — kicks in below the typical "tablet" width
   so phones get a more compact layout while desktop stays as designed. */
@media (max-width: 600px) {
    .content {
        padding: 1rem 0.75rem 4rem;
    }
    .exercise {
        padding: 0.75rem 0.75rem;
    }
    .history th, .history td,
    .log-form th, .log-form td {
        padding: 0.4rem 0.5rem;
        font-size: 0.875rem;
    }
    /* Make the "Previous" column compact and tightly nowrap'd so the
       weight string doesn't wrap into a 3-line column. */
    .log-form td:nth-child(2) {
        white-space: nowrap;
        font-size: 0.8rem;
        color: #6c757d;
    }
    /* Slimmer reps/weight inputs so the form fits without horizontal
       scroll on a typical phone width. */
    .log-form input[type="number"] {
        width: 4rem;
        padding: 0.35rem 0.4rem;
    }
    /* Compact session-meta row (date + auto-fill toggle). Stack on
       narrow screens so the date picker doesn't compete with the toggle. */
    .session-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* ============================================================ */
/* Admin portal styles                                          */
/* ============================================================ */

/* Site-header: stretch the spacer between logo and the right-hand
   admin link so they push to the edges. */
.site-header { display: flex; }
.site-header-spacer { flex: 1; }

.site-admin-link {
    padding: 0.35rem 0.85rem;
    border: 1px solid #d0d4d9;
    border-radius: 0.25rem;
    color: #444;
    font-size: 0.9rem;
}
.site-admin-link:hover {
    border-color: #0d6efd;
    color: #0d6efd;
    background: #f6f8fa;
    text-decoration: none;
}

/* The admin-only header variant adds the "Admin" badge */
.admin-site-header { display: flex; align-items: center; gap: 1rem; }
.admin-header-spacer { flex: 1; }
.admin-badge {
    background: #0d6efd;
    color: white;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
}
.admin-user { font-size: 0.9rem; }

/* Two-column admin shell: sidebar + content. Collapses to single
   column under ~720px so the sidebar drops above the content
   rather than competing for horizontal space. */
.admin-shell {
    display: grid;
    grid-template-columns: 14rem 1fr;
    min-height: calc(100vh - 4rem);
}
.admin-sidebar {
    background: #f6f8fa;
    border-right: 1px solid #e1e4e8;
    padding: 1.5rem 1rem;
}
.admin-sidebar nav { display: flex; flex-direction: column; gap: 0.25rem; }
.admin-sidebar hr { border: 0; border-top: 1px solid #e1e4e8; margin: 1rem 0; }

.admin-nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #444;
    border-radius: 0.25rem;
    font-size: 0.95rem;
}
.admin-nav-link:hover { background: white; color: #0d6efd; text-decoration: none; }
.admin-nav-link.active {
    background: white;
    color: #0d6efd;
    font-weight: 600;
    border-left: 3px solid #0d6efd;
    padding-left: calc(0.75rem - 3px);
}
.admin-nav-link-secondary { color: #6c757d; font-size: 0.9rem; }

@media (max-width: 720px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar { border-right: none; border-bottom: 1px solid #e1e4e8; }
    .admin-sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 0.5rem; }
}

/* Toolbar above admin list views (search + actions in one row). */
.admin-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1rem 0 1.5rem;
}
.admin-toolbar .search-input { flex: 1; min-width: 14rem; max-width: 28rem; }
.admin-toolbar .toggle { display: inline-flex; align-items: center; gap: 0.5rem; }

/* Page heading with a trailing button */
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* Admin tables (exercises list, item lists) */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.5rem;
    overflow: hidden;
}
.admin-table th, .admin-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e1e4e8;
    text-align: left;
    vertical-align: middle;
}
.admin-table thead th { background: #f6f8fa; font-weight: 600; color: #444; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table .thumb { width: 48px; height: 28px; object-fit: cover; border-radius: 0.25rem; }
.admin-table.compact th, .admin-table.compact td { padding: 0.35rem 0.55rem; font-size: 0.9rem; }
.thumb-inline { width: 32px; height: 20px; object-fit: cover; border-radius: 0.2rem; vertical-align: middle; margin-right: 0.5rem; }

/* Two-column edit grid: form on the left, YouTube panel on the right */
.admin-edit-grid {
    display: grid;
    grid-template-columns: minmax(20rem, 1fr) minmax(18rem, 22rem);
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 960px) {
    .admin-edit-grid { grid-template-columns: 1fr; }
}

.admin-edit-form {
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.5rem;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.admin-edit-form label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: #444;
    font-size: 0.95rem;
}
.admin-edit-form input[type="text"],
.admin-edit-form input[type="url"],
.admin-edit-form input[type="number"],
.admin-edit-form input[type="date"],
.admin-edit-form select,
.admin-edit-form textarea {
    padding: 0.4rem 0.55rem;
    border: 1px solid #d0d4d9;
    border-radius: 0.25rem;
    font: inherit;
}
.admin-edit-form textarea { resize: vertical; }
.thumb-preview {
    max-width: 14rem;
    margin-top: 0.5rem;
    border: 1px solid #e1e4e8;
    border-radius: 0.25rem;
}
.equipment-fieldset {
    border: 1px solid #e1e4e8;
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem;
}
.equipment-fieldset legend { color: #444; font-size: 0.95rem; padding: 0 0.25rem; }
.equipment-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0.15rem 0.75rem 0.15rem 0;
    color: #444;
    font-size: 0.9rem;
}

/* Inline quick-form used inline inside the programme tree */
.admin-quick-form {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin: 0.75rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.admin-quick-form.inline {
    margin: 0.5rem 0 0.75rem 1.25rem;
    border-left: 3px solid #0d6efd;
}
.admin-quick-form h3, .admin-quick-form h4 { margin: 0; }
.admin-quick-form label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: #444;
    font-size: 0.95rem;
}
.admin-quick-form input,
.admin-quick-form textarea,
.admin-quick-form select {
    padding: 0.35rem 0.55rem;
    border: 1px solid #d0d4d9;
    border-radius: 0.25rem;
    font: inherit;
}
.admin-quick-form textarea { resize: vertical; }
.admin-quick-form .session-actions { margin: 0.5rem 0 0; }

.set-button.danger {
    color: #842029;
    border-color: #f5c2c0;
}
.set-button.danger:hover {
    background: #fdecea;
    border-color: #842029;
    color: #842029;
}
.set-button.small { padding: 0.2rem 0.45rem; font-size: 0.85rem; }

/* Programme tree --------------------------------------------------- */
.tree { margin: 1rem 0; }
.tree-node {
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem 0.75rem;
    margin: 0.5rem 0;
}
.tree-node > summary {
    cursor: pointer;
    list-style: none;
    padding: 0.25rem 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 0.75rem;
}
.tree-node > summary::-webkit-details-marker { display: none; }
.tree-node > summary::before {
    content: '▸';
    display: inline-block;
    width: 1rem;
    color: #6c757d;
    transition: transform 0.15s ease;
}
.tree-node[open] > summary::before { transform: rotate(90deg); }
.tree-node .small { font-size: 0.85rem; }

.phase-node { background: #fafbfc; }
.day-node { margin-left: 1rem; }
.block-node { margin-left: 2rem; background: #fcfdfe; }
.tree-actions {
    margin: 0.5rem 0 0.5rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.add-phase { margin: 1.5rem 0 3rem; }

/* YouTube search panel --------------------------------------------- */
.yt-panel {
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.5rem;
    padding: 1.25rem 1.5rem;
}
.yt-panel h3 { margin: 0 0 0.75rem; font-size: 1.05rem; }
.yt-search { display: flex; align-items: center; gap: 0.5rem; }
.yt-search .search-input { flex: 1; }
.yt-results {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 32rem;
    overflow-y: auto;
}
.yt-result {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem;
    border: 1px solid #e1e4e8;
    border-radius: 0.25rem;
}
.yt-result:hover { border-color: #0d6efd; }
.yt-thumb-link { line-height: 0; flex-shrink: 0; }
.yt-thumb {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 0.25rem;
}
.yt-meta { flex: 1; min-width: 0; }
.yt-title {
    display: block;
    font-weight: 500;
    color: #222;
    margin-bottom: 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.yt-title:hover { color: #0d6efd; }
.yt-meta .meta { margin: 0.1rem 0 0.4rem; }

/* ============================================================ */
/* Progress page                                                */
/* ============================================================ */

.progress-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 0.5rem 0 1.5rem;
}
.progress-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1 1 18rem;
    min-width: 0;
}
.progress-title h1 { margin: 0 0 0.15rem; }
.progress-title .thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 0.5rem;
    background: #eee;
    flex-shrink: 0;
}

/* Wrapper for the two adjacent chip groups (date range + chart style)
   in the progress header. Lets them sit together when there's room and
   wrap as a pair when the header is narrow. */
.progress-header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Range filter chips */
.range-chips {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.5rem;
    padding: 0.2rem;
    flex-wrap: wrap;
}
.range-chip {
    padding: 0.3rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 0.35rem;
    color: #6c757d;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}
.range-chip:hover { color: #0d6efd; background: #f6f8fa; }
.range-chip.active {
    background: #0d6efd;
    color: white;
}
.range-chip.active:hover { background: #0b5ed7; }

/* Stat grid (re-uses admin's metric-card style but tightened) */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.75rem;
    margin: 0 0 1.5rem;
}
.stat-card {
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.5rem;
    padding: 0.9rem 1rem;
}
.stat-card .stat-label {
    margin: 0;
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.stat-card .stat-value {
    margin: 0.35rem 0 0.2rem;
    font-size: 1.5rem;
    font-weight: 500;
    color: #1a1a1a;
}
.stat-card .stat-value.positive { color: #16794c; }
.stat-card .stat-value.negative { color: #842029; }
.stat-card .stat-meta {
    margin: 0;
    font-size: 0.8rem;
    color: #6c757d;
}

/* SfChart wrapper — give it a card frame and a fixed height so
   Syncfusion's responsive sizing has something to measure. */
.chart-wrapper {
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 0 0 2rem;
    min-height: 400px;
}
.chart-wrapper > .e-chart { width: 100% !important; }

/* Rich tooltip rendered by ChartTooltipSettings.Template. Syncfusion
   wraps our template in its own .e-tooltip-text container, so we
   target our own .chart-tooltip wrapper rather than fighting the
   library defaults. */
.chart-tooltip {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 11rem;
    font-size: 0.85rem;
    line-height: 1.35;
}
.chart-tooltip-date {
    font-weight: 600;
    font-size: 0.8rem;
    color: #1a1a1a;
    margin-bottom: 0.15rem;
}
.chart-tooltip-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #1a1a1a;
}
.chart-tooltip-row.muted,
.chart-tooltip-row .muted { color: #6c757d; }
.chart-tooltip-swatch {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.chart-tooltip-swatch.weight { background: #185fa5; }
.chart-tooltip-swatch.reps   { background: #ba7517; }

/* "Progress →" link in the corner of an exercise card */
.exercise-progress-link {
    margin-left: auto;
    padding: 0.2rem 0.6rem;
    color: #6c757d;
    font-size: 0.85rem;
    border-radius: 0.25rem;
}
.exercise-progress-link:hover {
    color: #0d6efd;
    background: #f6f8fa;
    text-decoration: none;
}

/* ============================================================ */
/* Home page — greeting, week strip, session cards              */
/* ============================================================ */

.home-greeting {
    margin: 1rem 0 1.5rem;
    text-align: center;
}
.home-greeting .meta { margin: 0; color: #6c757d; font-size: 1rem; }
.home-greeting h1 { margin: 0; font-size: 2.25rem; }

.home-admin-link { margin: 0 0 1rem; text-align: right; }
.home-footer-link { margin: 2rem 0 4rem; text-align: center; }
.home-footer-link .sep { color: #d0d4d9; margin: 0 0.5rem; }

/* ---- Week strip --------------------------------------------- */

.day-strip-section {
    margin: 0 0 1.5rem;
}
.day-strip-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 0 0.75rem;
}
.day-strip-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1a1a1a;
}
.today-link {
    background: transparent;
    border: none;
    color: #0d6efd;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}
.today-link:hover { background: #eef4fd; }

.day-strip {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
}
.day-strip-nav {
    background: transparent;
    border: 1px solid transparent;
    color: #6c757d;
    font-size: 1.5rem;
    line-height: 1;
    width: 2rem;
    border-radius: 0.5rem;
    cursor: pointer;
    flex-shrink: 0;
}
.day-strip-nav:hover { background: #f6f8fa; color: #0d6efd; border-color: #e1e4e8; }

.day-pills {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
    flex: 1;
    overflow-x: auto;
}
.day-pill {
    flex: 1 1 0;
    min-width: 3rem;
    padding: 0.6rem 0.25rem 0.75rem;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.65rem;
    color: #1a1a1a;
    font: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    position: relative;
}
.day-pill:hover { border-color: #0d6efd; }
.day-pill-num {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.1;
}
.day-pill-abbr {
    font-size: 0.75rem;
    color: #6c757d;
}
.day-pill.today { border-color: #0d6efd; }
.day-pill.selected {
    background: #fff3cd;
    border-color: #ffc107;
}
.day-pill.selected .day-pill-num,
.day-pill.selected .day-pill-abbr { color: #806100; }
.day-pill-dot {
    position: absolute;
    bottom: 0.35rem;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #0d6efd;
}
.day-pill.selected .day-pill-dot { background: #806100; }

@media (max-width: 480px) {
    .day-pill { padding: 0.5rem 0.15rem 0.6rem; min-width: 2.4rem; }
    .day-pill-num { font-size: 1rem; }
    .day-pill-abbr { font-size: 0.7rem; }
    .day-strip-nav { width: 1.5rem; font-size: 1.25rem; }
}

/* ---- Session cards for the selected day --------------------- */

.day-sessions { margin: 0 0 1.5rem; }
.day-sessions-actions { margin: 0.75rem 0 0; text-align: right; }

.session-card {
    background: white;
    border: 1px solid #e1e4e8;
    border-left: 4px solid #d0d4d9;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin: 0 0 0.75rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}
.session-card:hover {
    border-color: #0d6efd;
    border-left-color: #0d6efd;
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.08);
}
.session-card.empty {
    cursor: default;
    text-align: center;
    border-left-color: #e1e4e8;
}
.session-card.empty:hover {
    border-color: #e1e4e8;
    border-left-color: #e1e4e8;
    box-shadow: none;
}
.session-card.scheduled { border-left-color: #ffc107; }
.session-card.inprogress { border-left-color: #0d6efd; }
.session-card.completed { border-left-color: #16794c; }

.session-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0 0 0.25rem;
}
.session-card-head h3 { margin: 0; color: #1a1a1a; font-size: 1.05rem; }
.session-card .meta { margin: 0.1rem 0; }

/* ============================================================ */
/* Session detail page                                          */
/* ============================================================ */

.session-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0 0 1.5rem;
}
.session-detail-header h1 { margin: 0 0 0.25rem; }
.session-detail-header .meta { display: inline-flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.session-detail-header .meta .sep { color: #d0d4d9; }

.session-detail-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.status-pill {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #eef2f6;
    color: #444;
}
.status-pill.status-scheduled { background: #fff3cd; color: #806100; }
.status-pill.status-inprogress { background: #cfe2ff; color: #084298; }
.status-pill.status-completed { background: #d1e7dd; color: #0f5132; }

/* ============================================================ */
/* Syncfusion SfChart — clipPath rect visibility workaround     */
/* ============================================================ */
/*
 * Syncfusion's SfChart wraps each series and its markers in <g> elements
 * with a clip-path that references a <clipPath><rect/></clipPath>. The
 * rect has stroke="transparent" fill="transparent" (so it doesn't render
 * visually) AND visibility="hidden" (presumably to keep it out of the
 * accessibility tree).
 *
 * Some Chromium versions (Edge 148+, observed 2026-05-16) treat
 * `visibility="hidden"` on <clipPath> children as "this child does NOT
 * contribute to the clip region" — making the clip region empty, which
 * clips every painted line/marker to nothing. The chart frame, axes,
 * legend, gridlines all render fine (they aren't inside the clipped
 * group); only the series series themselves disappear.
 *
 * Forcing visibility:visible via CSS overrides the SVG attribute. The
 * rect stays non-visual (fill+stroke are transparent), but its geometry
 * now correctly contributes to the clipPath. Line and markers appear.
 */
.e-chart clipPath rect {
    visibility: visible !important;
}

/* ============================================================ */
/* Progress index — highlights row + card grid                  */
/* ============================================================ */

.progress-highlights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 0.75rem;
    margin: 0 0 1.5rem;
}
.highlight-card {
    display: block;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.highlight-card:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.08);
    text-decoration: none;
}
.highlight-label {
    margin: 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
}
.highlight-value {
    margin: 0.35rem 0 0.2rem;
    font-size: 1.5rem;
    font-weight: 500;
    color: #1a1a1a;
}
.highlight-value.positive { color: #16794c; }
.highlight-value.negative { color: #842029; }
.highlight-meta {
    margin: 0;
    font-size: 0.85rem;
    color: #6c757d;
}

.progress-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0 0 1rem;
}
.progress-toolbar .search-input { flex: 1 1 14rem; max-width: 22rem; }
.sort-select {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #6c757d;
    font-size: 0.9rem;
}
.sort-select select {
    padding: 0.35rem 0.5rem;
    border: 1px solid #d0d4d9;
    border-radius: 0.25rem;
    font: inherit;
    color: #1a1a1a;
}

.progress-card a {
    padding: 0.85rem 1rem;
    display: block;
}
.progress-card.improved { border-left: 3px solid #16794c; }
.progress-card.regressed { border-left: 3px solid #842029; }
.progress-card-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.5rem;
}
.progress-card-head h3 { margin: 0; color: #0d6efd; font-size: 1rem; }
.progress-card-current { margin: 0.2rem 0; font-size: 0.95rem; }
.progress-current-weight { font-weight: 600; font-size: 1.15rem; color: #1a1a1a; }
.progress-card .positive { color: #16794c; font-weight: 500; }
.progress-card .negative { color: #842029; font-weight: 500; }

/* ============================================================ */
/* Achievements — banner, feed rows, kind badges                */
/* ============================================================ */

/* Post-session PR banner on Detail.razor */
.pr-banner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    margin: 0 0 1.5rem;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.65rem;
    flex-wrap: wrap;
}
.pr-banner.has-prs { border-color: #ffc107; background: #fffceb; }
.pr-banner.no-prs  { border-color: #d0e3ff; background: #f3f7ff; }

.pr-badge {
    flex-shrink: 0;
    width: 4.5rem;
    height: 5rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Hexagon-ish via clip-path so it echoes Trainerize's shape without
       needing an SVG. Falls back to rounded rect on browsers without
       clip-path support (most don't lack it any more). */
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
    background: #ffc107;
    color: #1a1a1a;
}
.pr-banner.no-prs .pr-badge {
    background: #cfe2ff;
    color: #084298;
}
.pr-badge-count {
    font-size: 1.85rem;
    font-weight: 600;
    line-height: 1;
}
.pr-badge-icon {
    font-size: 1.5rem;
}
.pr-badge-count + .pr-badge-icon {
    position: absolute;
    bottom: 0.6rem;
    font-size: 0.85rem;
}

.pr-banner-body { flex: 1 1 18rem; min-width: 0; }
.pr-banner-title { margin: 0 0 0.15rem; font-size: 1.2rem; font-weight: 600; color: #1a1a1a; }
.pr-banner-sub { margin: 0 0 0.5rem; color: #6c757d; font-size: 0.9rem; }

.pr-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.pr-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-top: 1px solid rgba(0,0,0,0.06);
}
.pr-row:first-child { border-top: none; }
.pr-row-main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.pr-row-exercise { font-weight: 500; color: #1a1a1a; }
.pr-row-main .small { font-size: 0.8rem; }
.pr-row-value { display: flex; align-items: baseline; gap: 0.5rem; white-space: nowrap; }
.pr-row-headline { font-weight: 600; }
.pr-row-delta { font-size: 0.9rem; }
.pr-row-delta.positive { color: #16794c; }

/* Achievement feed rows (used on /user/progress recent section and /user/achievements gallery) */
.recent-achievements { margin: 2rem 0 1rem; }
.recent-achievements-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 0 0 0.75rem;
}
.recent-achievements-head h2 { margin: 0; }

.achievement-feed {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.achievement-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.85rem;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 0.5rem;
}
.achievement-body { flex: 1; min-width: 0; }
.achievement-title { margin: 0 0 0.15rem; font-weight: 500; color: #1a1a1a; }
.achievement-title a { color: #0d6efd; }
.achievement-body .meta { margin: 0; }
.achievement-body .meta .sep { color: #d0d4d9; margin: 0 0.35rem; }

.achievement-kind {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.5rem;
    padding: 0.35rem 0.6rem;
    border-radius: 0.4rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #eef2f6;
    color: #444;
}
.achievement-kind.kind-maxweight        { background: #cfe2ff; color: #084298; }
.achievement-kind.kind-maxreps          { background: #ffe2c4; color: #6a3d00; }
.achievement-kind.kind-maxvolume        { background: #d1e7dd; color: #0f5132; }
.achievement-kind.kind-workoutmilestone { background: #fff3cd; color: #806100; }

/* Achievements gallery page summary stats */
.achievement-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 0.75rem;
    margin: 0 0 1.5rem;
}
.achievement-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0 0 1rem;
}
