:root {
    color-scheme: light;
    --bg: #f4f6f1;
    --ink: #11243a;
    --muted: #617086;
    --line: #dce3dc;
    --surface: #ffffff;
    --side: #557c64;
    --side-dark: #416a52;
    --accent: #2f7d5a;
    --accent-soft: #eaf2ec;
    --accent-2: #b9cdbc;
    --hero-a: #d8e7d6;
    --hero-b: #f7e7d5;
    --button: #2f7d5a;
    --photo: url("/assets/workout-placeholder.jpg");
    --shadow: 0 18px 40px rgba(17, 36, 58, 0.12);
    --shadow-soft: 0 10px 26px rgba(17, 36, 58, 0.08);
}

.theme-blush {
    --bg: #fbf4f5;
    --line: #eed8dc;
    --side: #bd6070;
    --side-dark: #a6495c;
    --accent: #bd6070;
    --accent-soft: #fbe8eb;
    --accent-2: #f1b9bf;
    --hero-a: #f8d7df;
    --hero-b: #ffe9df;
    --button: #bd6070;
}

.theme-navy {
    --bg: #f2f7fb;
    --line: #d7e7f2;
    --side: #07517f;
    --side-dark: #073b5c;
    --accent: #075f9a;
    --accent-soft: #e5f3fb;
    --accent-2: #9fd2ef;
    --hero-a: #b9dcf3;
    --hero-b: #e5f3fb;
    --button: #075f9a;
}

.theme-lavender {
    --bg: #f8f5fb;
    --line: #e3dcf4;
    --side: #7764b8;
    --side-dark: #6151a1;
    --accent: #7764b8;
    --accent-soft: #eee9fb;
    --accent-2: #c9bef1;
    --hero-a: #ded5fa;
    --hero-b: #f3dfe9;
    --button: #7764b8;
}

.theme-charcoal {
    --bg: #f7f5f3;
    --line: #e5ddda;
    --side: #20313a;
    --side-dark: #15242b;
    --accent: #ff5d55;
    --accent-soft: #ffe8e5;
    --accent-2: #ffc3bd;
    --hero-a: #e5d8cf;
    --hero-b: #ffd3c9;
    --button: #ff5d55;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.92), transparent 34vw),
        var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
}

.topbar {
    min-height: 70px;
    display: flex;
    align-items: center;
    padding: 0 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.brand,
.side-brand {
    text-decoration: none;
    font-weight: 800;
    line-height: 1;
}

.brand span,
.side-brand span {
    display: block;
    margin-top: 4px;
    font-size: 0.78rem;
    font-weight: 700;
}

.app-frame {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 172px minmax(0, 1fr);
    padding: 14px;
    gap: 14px;
}

.sidebar {
    min-height: calc(100vh - 28px);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    border-radius: 8px;
    background: linear-gradient(180deg, var(--side), var(--side-dark));
    color: #fff;
    box-shadow: var(--shadow);
}

.side-brand {
    margin-bottom: 30px;
    color: #fff;
    font-size: 1.72rem;
}

.side-nav,
.side-bottom {
    display: grid;
    gap: 10px;
}

.side-nav a,
.side-bottom a {
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 750;
}

.side-nav a.active {
    background: rgba(255, 255, 255, 0.24);
}

.side-nav span {
    width: 22px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    font-size: 0.68rem;
}

.side-bottom {
    margin-top: auto;
}

.theme-picker {
    margin-top: 26px;
}

.theme-picker label {
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.theme-picker div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.theme-picker button {
    width: 27px;
    height: 27px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.42);
    border-radius: 50%;
    background: var(--swatch);
    cursor: pointer;
}

.theme-picker button.selected {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22);
}

.theme-picker button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

main {
    width: min(1160px, 100%);
    margin: 0 auto;
}

body:not([class*="theme-"]) main {
    width: min(980px, calc(100vw - 32px));
    padding: 36px 0;
}

.programme-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 214px;
    gap: 14px;
}

.photo-hero {
    min-height: 270px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.96) 0 38%, rgba(255, 255, 255, 0.68) 53%, rgba(255, 255, 255, 0.08) 72%),
        linear-gradient(0deg, rgba(17, 36, 58, 0.12), rgba(17, 36, 58, 0.02)),
        var(--photo) center / cover,
        linear-gradient(135deg, var(--hero-a), var(--hero-b));
    box-shadow: var(--shadow);
}

.photo-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(150deg, transparent 0 51%, color-mix(in srgb, var(--accent) 34%, transparent) 51% 52%, transparent 52%),
        linear-gradient(160deg, transparent 0 58%, rgba(255, 255, 255, 0.34) 58% 59%, transparent 59%);
    opacity: 0.45;
}

.photo-hero::after {
    content: "Online Fitness";
    position: absolute;
    top: 22px;
    right: 210px;
    color: rgba(255, 255, 255, 0.76);
    font-family: "Comic Sans MS", "Bradley Hand", cursive;
    font-size: 1.55rem;
    line-height: 1;
    transform: rotate(-4deg);
    text-shadow: 0 2px 12px rgba(17, 36, 58, 0.28);
}

.hero-copy {
    position: relative;
    z-index: 1;
    padding: 34px 34px 28px;
}

.hero-copy h1 {
    margin: 0 0 8px;
    font-size: clamp(2.15rem, 4vw, 3.25rem);
    line-height: 1;
}

.hero-copy strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.hero-copy p {
    max-width: 360px;
    margin: 0;
    color: var(--ink);
    font-weight: 720;
}

.hand-note {
    position: absolute;
    z-index: 1;
    top: 74px;
    right: 105px;
    width: 132px;
    margin: 0;
    transform: rotate(-8deg);
    font-family: "Comic Sans MS", "Bradley Hand", cursive;
    font-size: 1.34rem;
    line-height: 1.1;
}

.progress-card {
    position: absolute;
    z-index: 2;
    right: 20px;
    bottom: 18px;
    width: 170px;
    padding: 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 16px 34px rgba(17, 36, 58, 0.18);
    backdrop-filter: blur(10px);
}

.mini-ring {
    width: 74px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: conic-gradient(var(--accent) var(--progress, 0%), rgba(17, 36, 58, 0.08) 0);
}

.mini-ring span {
    width: 52px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    font-weight: 900;
}

.progress-card p {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 750;
}

.progress-card a,
.text-link {
    color: var(--accent);
    font-weight: 850;
    text-decoration: none;
}

.quick-stats,
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 12px 0 10px;
}

.quick-stats div,
.stats div,
.panel,
.table-card,
.workout-card,
.journey-panel,
.quote-card,
.login-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.quick-stats div,
.stats div {
    padding: 12px 14px;
}

.quick-stats strong,
.stats strong {
    display: block;
    font-size: 1.35rem;
}

.quick-stats span,
.stats span,
td span,
.hint {
    color: var(--muted);
    font-size: 0.88rem;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0 0 16px;
}

.badge {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 850;
}

.badge.earned {
    border-color: var(--accent-2);
    background: var(--accent-soft);
    color: var(--accent);
}

.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin: 16px 0 10px;
}

.section-head h1,
.section-head h2,
.panel h2 {
    margin: 0;
}

.section-head h1 {
    font-size: clamp(2rem, 4vw, 3rem);
}

.section-head h2,
.panel h2 {
    font-size: 1.18rem;
}

.workout-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.workout-card {
    padding: 8px;
    overflow: hidden;
}

.workout-card.complete {
    background: var(--accent-soft);
    border-color: var(--accent-2);
}

.thumb {
    height: 100px;
    border-radius: 6px;
    margin-bottom: 10px;
    background:
        linear-gradient(180deg, rgba(17, 36, 58, 0.04), rgba(17, 36, 58, 0.38)),
        var(--photo) center / cover;
    position: relative;
    overflow: hidden;
}

.thumb::before {
    content: attr(data-label);
    position: absolute;
    left: 8px;
    bottom: 8px;
    min-height: 22px;
    display: none;
    align-items: center;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--ink);
    font-size: 0.68rem;
    font-weight: 900;
}

.thumb::after {
    content: "LMF";
    position: absolute;
    top: 8px;
    right: 8px;
    min-width: 34px;
    min-height: 22px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.84);
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 950;
}

.thumb-cardio::before {
    display: none;
}

.thumb-choice::before {
    display: none;
}

.slot {
    display: block;
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.workout-card h3 {
    min-height: 38px;
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.15;
}

.workout-card p {
    margin: 7px 0 11px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    background: var(--button);
    color: #fff;
    text-decoration: none;
    font-weight: 850;
    cursor: pointer;
}

.button.secondary {
    margin-top: 7px;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent-2);
}

.button.inline,
.button.small {
    width: auto;
}

.button.small {
    min-height: 34px;
    padding-inline: 12px;
    font-size: 0.9rem;
}

.done {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    color: var(--accent);
    font-weight: 900;
}

.journey-panel {
    padding: 16px;
}

.journey-panel h2 {
    margin: 0 0 14px;
    font-size: 1rem;
}

.week-list {
    display: grid;
    gap: 7px;
}

.week-row {
    min-height: 29px;
    display: grid;
    grid-template-columns: 18px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    border-radius: 6px;
    color: var(--ink);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 800;
}

.week-row span {
    width: 13px;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid #b8c2cf;
}

.week-row em {
    color: var(--muted);
    font-style: normal;
    font-size: 0.76rem;
}

.week-row.current {
    background: var(--accent-soft);
}

.week-row.current span,
.week-row.complete span {
    border-color: var(--accent);
    background: var(--accent);
}

.week-row.complete span::after {
    content: "";
    display: block;
    width: 5px;
    height: 8px;
    margin: 0 auto;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.quote-card {
    margin-top: 20px;
    min-height: 128px;
    display: grid;
    place-items: center;
    padding: 18px;
    background: var(--accent-soft);
}

.quote-card p {
    margin: 0;
    color: var(--side-dark);
    font-family: "Comic Sans MS", "Bradley Hand", cursive;
    font-size: 1.25rem;
    line-height: 1.18;
    transform: rotate(-4deg);
}

.challenge-hero {
    min-height: 246px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    align-items: end;
    gap: 24px;
    padding: 30px;
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.94) 0 42%, rgba(255, 255, 255, 0.58) 62%, rgba(255, 255, 255, 0.08)),
        linear-gradient(0deg, rgba(17, 36, 58, 0.16), rgba(17, 36, 58, 0.02)),
        var(--photo) center / cover;
    box-shadow: var(--shadow);
}

.challenge-hero .eyebrow {
    color: var(--accent);
}

.challenge-hero h1 {
    max-width: 610px;
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1;
}

.challenge-hero p:not(.eyebrow) {
    max-width: 520px;
    margin: 14px 0 0;
    color: var(--ink);
    font-weight: 750;
}

.challenge-ring {
    display: grid;
    justify-items: center;
    gap: 7px;
    padding: 18px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 16px 34px rgba(17, 36, 58, 0.18);
    backdrop-filter: blur(10px);
}

.challenge-ring .mini-ring {
    margin-bottom: 0;
}

.challenge-ring strong {
    font-size: 1.2rem;
}

.challenge-ring span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 850;
    text-align: center;
}

.challenge-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 12px 0;
}

.challenge-stats div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.challenge-stats strong {
    display: block;
    font-size: 1.42rem;
}

.challenge-stats span {
    color: var(--muted);
    font-size: 0.88rem;
}

.challenge-path {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.challenge-level {
    min-height: 184px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.challenge-level.active {
    border-color: var(--accent-2);
    background: linear-gradient(180deg, #fff, var(--accent-soft));
}

.challenge-level.complete {
    border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
}

.challenge-level.locked {
    filter: grayscale(0.9);
    opacity: 0.56;
}

.challenge-level.level-bronze {
    --level: #b87333;
    --level-soft: #f7e6d6;
}

.challenge-level.level-silver {
    --level: #9aa6b2;
    --level-soft: #eef1f4;
}

.challenge-level.level-gold {
    --level: #d5a11e;
    --level-soft: #fff1c7;
}

.challenge-level.active,
.challenge-level.complete {
    border-color: color-mix(in srgb, var(--level) 42%, var(--line));
    background: linear-gradient(180deg, #fff 0%, var(--level-soft) 100%);
}

.level-medal {
    width: 42px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.72), transparent 24%),
        linear-gradient(145deg, color-mix(in srgb, var(--level) 72%, #fff), var(--level));
    color: #fff;
    font-weight: 950;
    text-shadow: 0 1px 3px rgba(17, 36, 58, 0.28);
    box-shadow: 0 9px 18px color-mix(in srgb, var(--level) 28%, transparent);
}

.challenge-level span {
    color: var(--level);
    font-size: 0.76rem;
    font-weight: 950;
    text-transform: uppercase;
}

.challenge-level h2 {
    margin: 5px 0 8px;
    font-size: 1.1rem;
}

.challenge-level p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.challenge-level > strong {
    color: var(--ink);
}

.challenge-bar {
    height: 12px;
    margin: 16px 0;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(17, 36, 58, 0.09);
}

.challenge-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.challenge-detail {
    align-items: start;
}

.activity-row {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.activity-row:last-child {
    border-bottom: 0;
}

.activity-row > span {
    min-height: 32px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 950;
}

.activity-row strong,
.activity-row p {
    margin: 0;
}

.activity-row p {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 720;
}

.login-shell {
    min-height: calc(100vh - 150px);
    display: grid;
    grid-template-columns: 1fr minmax(320px, 420px);
    gap: 44px;
    align-items: center;
}

.login-copy {
    padding: clamp(28px, 5vw, 58px);
    border-radius: 8px;
    background: linear-gradient(135deg, var(--side), var(--side-dark));
    color: #fff;
}

.login-copy h1 {
    margin: 0;
    font-size: clamp(2.2rem, 5vw, 4.2rem);
    line-height: 1;
}

.login-copy p {
    max-width: 600px;
    line-height: 1.6;
}

.eyebrow {
    margin: 0 0 12px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
}

.login-panel,
.panel {
    padding: 24px;
}

.add-panel,
.toolbar {
    margin-bottom: 18px;
}

summary {
    cursor: pointer;
    font-weight: 850;
}

.admin-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.admin-form label:nth-of-type(5),
.admin-form button {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 8px;
    margin: 0 0 16px;
    color: var(--muted);
    font-weight: 750;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    color: var(--ink);
    background: #fff;
    font: inherit;
}

textarea {
    resize: vertical;
}

.error {
    padding: 12px;
    border-radius: 6px;
    background: #ffe8e2;
    color: #8f331f;
    font-weight: 750;
}

.two-col {
    display: grid;
    grid-template-columns: 1.35fr 0.9fr;
    gap: 18px;
}

.table-card {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.note {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.note:last-child {
    border-bottom: 0;
}

.note span {
    color: var(--muted);
    font-weight: 800;
}

@media (max-width: 980px) {
    .app-frame,
    .programme-layout,
    .challenge-hero,
    .login-shell,
    .two-col {
        grid-template-columns: 1fr;
    }

    .sidebar {
        min-height: 0;
    }

    .side-brand {
        margin-bottom: 18px;
    }
}

@media (max-width: 720px) {
    .app-frame {
        padding: 10px;
    }

    .photo-hero {
        min-height: 410px;
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0 42%, rgba(255, 255, 255, 0.42) 68%, rgba(255, 255, 255, 0.04)),
            linear-gradient(0deg, rgba(17, 36, 58, 0.18), rgba(17, 36, 58, 0.02)),
            var(--photo) center bottom / cover,
            linear-gradient(135deg, var(--hero-a), var(--hero-b));
    }

    .photo-hero::after {
        top: 170px;
        right: 22px;
        width: auto;
        font-size: 1.22rem;
    }

    .hand-note {
        right: 20px;
        top: 216px;
        color: #fff;
        text-shadow: 0 2px 12px rgba(17, 36, 58, 0.44);
    }

    .progress-card {
        left: 20px;
        right: auto;
        bottom: 20px;
    }

    .quick-stats,
    .stats,
    .challenge-stats,
    .challenge-path,
    .workout-grid,
    .admin-form {
        grid-template-columns: 1fr;
    }
}
