﻿html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* ===== v3.5 brand (v3.8: Torvin Fitness): black and volt =====
   Volt (#C5F02C) is the accent: solid buttons (with black text), highlights, the selected tab, progress.
   Volt is far too faint as text on white, so in light mode links and text accents use a dark olive
   (--ft-accent-text) instead; in dark mode volt is used for those too. */
:root, [data-bs-theme=light] {
    --ft-volt: #C5F02C; --ft-volt-hover: #B6E21E; --ft-volt-active: #A8D313; --ft-ink: #16181D;
    --ft-accent-text: #3F6212;     /* links, text accents (7:1 on white) */
    --ft-accent-line: #6B8E10;     /* borders and outlines around selected things (3.6:1 on white) */
    --ft-done: #16181D;            /* the week's done days */
    --bs-primary: #C5F02C; --bs-primary-rgb: 197, 240, 44;
    --bs-primary-text-emphasis: #3F6212; --bs-primary-bg-subtle: #F3FBD5; --bs-primary-border-subtle: #DCF28E;
    --bs-link-color: #3F6212; --bs-link-color-rgb: 63, 98, 18;
    --bs-link-hover-color: #2E4A0C; --bs-link-hover-color-rgb: 46, 74, 12;
    --bs-focus-ring-color: rgba(107, 142, 16, .45);
}
[data-bs-theme=dark] {
    --ft-accent-text: #C5F02C; --ft-accent-line: #C5F02C; --ft-done: #C5F02C;
    --bs-primary-text-emphasis: #D9F77A; --bs-primary-bg-subtle: #2A3311; --bs-primary-border-subtle: #556B14;
    --bs-link-color: #C5F02C; --bs-link-color-rgb: 197, 240, 44;
    --bs-link-hover-color: #D9F77A; --bs-link-hover-color-rgb: 217, 247, 122;
    --bs-focus-ring-color: rgba(197, 240, 44, .4);
}

a, .btn-link {
    color: var(--bs-link-color);
}

.btn-primary {
    --bs-btn-color: #16181D; --bs-btn-bg: #C5F02C; --bs-btn-border-color: #C5F02C;
    --bs-btn-hover-color: #16181D; --bs-btn-hover-bg: #B6E21E; --bs-btn-hover-border-color: #B6E21E;
    --bs-btn-active-color: #16181D; --bs-btn-active-bg: #A8D313; --bs-btn-active-border-color: #A8D313;
    --bs-btn-disabled-color: #16181D; --bs-btn-disabled-bg: #C5F02C; --bs-btn-disabled-border-color: #C5F02C;
    --bs-btn-focus-shadow-rgb: 107, 142, 16;
}
.btn-outline-primary {
    --bs-btn-color: var(--ft-accent-text); --bs-btn-border-color: var(--ft-accent-line);
    --bs-btn-hover-color: #16181D; --bs-btn-hover-bg: #C5F02C; --bs-btn-hover-border-color: #C5F02C;
    --bs-btn-active-color: #16181D; --bs-btn-active-bg: #A8D313; --bs-btn-active-border-color: #A8D313;
    --bs-btn-disabled-color: var(--ft-accent-text); --bs-btn-disabled-border-color: var(--ft-accent-line);
    --bs-btn-focus-shadow-rgb: 107, 142, 16;
}
.text-primary { color: var(--ft-accent-text) !important; }
.border-primary { border-color: var(--ft-accent-line) !important; }
.badge.bg-primary, .text-bg-primary { color: #16181D !important; }
.spinner-border.text-primary { color: var(--ft-accent-line) !important; }

.form-check-input:checked { background-color: #C5F02C; border-color: #A8D313; }
.form-check-input:checked[type=checkbox] {
    --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%2316181D' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}
.form-check-input:checked[type=radio] {
    --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%2316181D'/%3e%3c/svg%3e");
}
.form-switch .form-check-input:checked {
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2316181D'/%3e%3c/svg%3e");
}
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--ft-accent-line); }
.form-range::-webkit-slider-thumb { background-color: #C5F02C; }
.form-range::-moz-range-thumb { background-color: #C5F02C; }
.progress, .progress-stacked { --bs-progress-bar-bg: #C5F02C; --bs-progress-bar-color: #16181D; }
.nav-pills { --bs-nav-pills-link-active-bg: #C5F02C; --bs-nav-pills-link-active-color: #16181D; }
.list-group { --bs-list-group-active-bg: #C5F02C; --bs-list-group-active-border-color: #C5F02C; --bs-list-group-active-color: #16181D; }
.dropdown-menu { --bs-dropdown-link-active-bg: #C5F02C; --bs-dropdown-link-active-color: #16181D; }
.pagination { --bs-pagination-active-bg: #C5F02C; --bs-pagination-active-border-color: #C5F02C; --bs-pagination-active-color: #16181D; }

/* The logo (Components/Shared/Logo.razor): kettlebell icon + name */
.ft-logo { display: inline-flex; align-items: center; gap: .5em; font-weight: 800; letter-spacing: -.02em; }
.ft-logo-mark { width: 1.6em; height: 1.6em; flex: none; }
/* v3.8 wordmark: TORVIN over a small volt FITNESS */
.ft-logo-word { display: inline-flex; flex-direction: column; line-height: 1; }
.ft-logo-name { letter-spacing: .1em; }
.ft-logo-sub { font-size: .42em; font-weight: 600; letter-spacing: .42em; color: #C5F02C; margin-top: .3em; }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem var(--bs-body-bg), 0 0 0 0.25rem var(--bs-focus-ring-color);
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ---------- Dark mode adjustments ---------- */
[data-bs-theme=dark] a:not(.btn),
[data-bs-theme=dark] .btn-link {
    color: var(--bs-link-color);   /* v3.5: volt in dark mode */
}

[data-bs-theme=dark] .darker-border-checkbox.form-check-input {
    border-color: #6c757d;
}

/* ---------- Install page: show the steps for this device (early.js sets data-device) ---------- */
[data-os], [data-install-app], [data-installed-msg] { display: none; }
html[data-device=ios] [data-os=ios],
html[data-device=android] [data-os=android],
html[data-device=desktop] [data-os] { display: block; }
html[data-device=android][data-can-install] [data-install-app] { display: block; }
html[data-installed-now] [data-installed-msg] { display: block; }

/* ---------- Nav menu: collapsible sections that look like menu items ---------- */
.nav-group {
    padding: 0 1rem 0.5rem;
}

.nav-group > summary {
    list-style: none;
    display: flex;
    align-items: center;
    height: 3rem;
    padding: 0 1rem;
    border-radius: 4px;
    color: #d7d7d7;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}
.nav-group > summary::-webkit-details-marker { display: none; }

.nav-group > summary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-group > summary::after {
    content: "›";
    margin-left: auto;
    font-size: 1.4rem;
    line-height: 1;
    transition: transform 0.15s;
}
.nav-group[open] > summary::after { transform: rotate(90deg); }

.nav-group .nav-item {
    padding: 0.25rem 0 0 1.25rem !important;
}
/* v3.11: small headings inside a section (Setup: Training, Torvin, Settings) */
.nav-subhead {
    padding: 0.75rem 0 0.1rem 2.25rem;
    color: #d7d7d7;
    opacity: 0.6;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
/* v3.11: Report a problem and Privacy, small at the bottom of the menu */
.nav-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    padding: 1rem 2rem 1.5rem;
    font-size: 0.8rem;
}
.nav-footer a { color: #d7d7d7; opacity: 0.7; text-decoration: none; }
.nav-footer a:hover, .nav-footer a.active { opacity: 1; color: #C5F02C; }
/* ---------- Page transitions (driven by early.js) ---------- */

/* Phones: the menu slides open and closed instead of appearing and vanishing.
   !important beats the display:none in NavMenu.razor.css; visibility keeps hidden links out of reach. */
@media (max-width: 640.98px) {
    .sidebar .nav-scrollable {
        display: block !important;
        max-height: 0;
        overflow: hidden;
        visibility: hidden;
        transition: max-height 0.25s ease, visibility 0s linear 0.25s;
    }
    .sidebar .navbar-toggler:checked ~ .nav-scrollable {
        max-height: calc(100vh - 3.5rem);
        overflow-y: auto;
        visibility: visible;
        transition: max-height 0.25s ease, visibility 0s;
    }
}

/* Thin loading bar across the top, only when a page takes more than a moment */
#nav-progress {
    position: fixed;
    top: env(safe-area-inset-top, 0);
    left: 0;
    height: 3px;
    width: 0;
    z-index: 2000;
    background: var(--ft-accent-line);
    opacity: 0;
    pointer-events: none;
}
#nav-progress.running {
    opacity: 1;
    animation: ft-progress 10s cubic-bezier(0.08, 0.6, 0.2, 1) forwards;
}
#nav-progress.done {
    width: 100%;
    opacity: 0;
    transition: opacity 0.3s ease 0.1s;
}
@keyframes ft-progress {
    from { width: 0; }
    to   { width: 92%; }
}

/* The old page dims while waiting; the new one fades up */
.ft-leaving {
    opacity: 0.55;
    transition: opacity 0.15s ease;
}
.ft-enter {
    animation: ft-enter 0.22s ease-out both;
}
@keyframes ft-enter {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

/* Reduce Motion on: everything switches instantly, the bar just appears */
@media (prefers-reduced-motion: reduce) {
    .sidebar .nav-scrollable,
    .sidebar .navbar-toggler:checked ~ .nav-scrollable,
    .nav-group > summary::after,
    .ft-leaving,
    #nav-progress.done {
        transition: none !important;
    }
    .ft-enter { animation: none; }
    #nav-progress.running { animation: none; width: 100%; }
}

/* Safari button drawings on the install page */
.ft-icon svg { vertical-align: -4px; color: var(--ft-accent-text); }

/* ---------- Blazor's error bar: hidden until something actually goes wrong (all layouts) ---------- */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    color: #212529;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    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;
}

/* Staging (test site) marker - only shown when ASPNETCORE_ENVIRONMENT=Staging */
/* v3.17: Screenshot mode (test site, Setup) hides the strip on this device; its two buttons show one at a time */
html[data-no-banner] .staging-strip { display: none !important; }
html[data-no-banner] .ft-shots-off, html:not([data-no-banner]) .ft-shots-on { display: none !important; }
.staging-strip {
    background: #ea580c;
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    text-align: center;
    padding: .2rem .5rem;
    letter-spacing: .03em;
}

/* Rest timer (workout page): sits inside the exercise card, above the next set */
.rest-box {
    background: #1e40af;   /* deep blue: stands out from the card in light and dark mode */
    color: #fff;
    border-radius: .5rem;
    padding: .6rem .75rem .5rem;
    margin-top: .75rem;
}
.rest-box.rest-done { background: #15803d; padding-bottom: .6rem; }
.rest-time { font-size: 2.25rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.rest-btn { min-width: 3.25rem; padding: .5rem .6rem; }
.rest-track { height: 5px; background: rgba(255, 255, 255, .2); border-radius: 3px; margin-top: .5rem; overflow: hidden; }
.rest-fill { height: 100%; width: 100%; background: #60a5fa; transition: width .25s linear; }

/* ---------- Phones: menu bar stays at the top, clear of the clock/battery ---------- */
/* (viewport-fit=cover lets the page draw behind the iPhone status bar; these paddings keep things out from under it) */
@media (max-width: 640.98px) {
    .page > .sidebar {
        position: sticky;
        top: 0;
        z-index: 1020;
        padding-top: env(safe-area-inset-top, 0px);
    }
    .page > .sidebar .navbar-toggler {
        top: calc(0.5rem + env(safe-area-inset-top, 0px));
    }
    .sidebar .navbar-toggler:checked ~ .nav-scrollable {
        max-height: calc(100dvh - 3.5rem - env(safe-area-inset-top, 0px));
    }
    /* v3.17: Screenshot mode (test site, Setup) hides the strip on this device; its two buttons show one at a time */
html[data-no-banner] .staging-strip { display: none !important; }
html[data-no-banner] .ft-shots-off, html:not([data-no-banner]) .ft-shots-on { display: none !important; }
.staging-strip {
        top: calc(3.5rem + env(safe-area-inset-top, 0px));   /* just under the menu bar */
    }
}
.safe-top { padding-top: calc(1rem + env(safe-area-inset-top, 0px)) !important; }

/* Stretch check-off on the workout cards: a big, tappable box */
.stretch-box {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    padding: .65rem .75rem;
    margin-bottom: .75rem;
    cursor: pointer;
}
.stretch-box.done {
    border-color: var(--bs-success-border-subtle);
    background: var(--bs-success-bg-subtle);
}
.stretch-check {
    width: 1.6rem;
    height: 1.6rem;
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
}

/* Workout page: an opened exercise card scrolls into view just below the sticky menu bar */
.ex-card { scroll-margin-top: 5rem; }


/* Native iPhone app: hide what only applies to the browser/PWA (install steps, web push) */
html[data-native] [data-web-only] { display: none !important; }
[data-native-only] { display: none; }
html[data-native] [data-native-only] { display: block; }

/* Native iPhone app: it draws its own tab bar, so no side menu or top bar.
   Leave room for the notch at the top and the floating tab bar at the bottom. */
html[data-native] main { padding-top: env(safe-area-inset-top, 0px); }
html[data-native] article.content { padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px)); }
.native-back-space { display: none; }
html[data-native] .native-back-space { display: block; height: 3.5rem; }   /* under the app's glass back button */
/* v3.15: data-old-tabs-only / data-new-tabs-only: things for only one kind of app. The older apps have no Torvin tab
   (Torvin is under Progress, its settings under Setup); the new ones (iPhone 0.6+, Android 0.6+) have it, and Setup is
   the gear at the end of each tab's page title (SetupGear.razor), opening as a sheet. */
html[data-torvin-tab] [data-old-tabs-only] { display: none !important; }
html:not([data-torvin-tab]) [data-new-tabs-only] { display: none !important; }
/* v3.18: the Plan page: buying works only in the iPhone app 1.0+ (early.js sets data-store) */
html:not([data-store]) [data-store-only] { display: none !important; }
html[data-store] [data-no-store-only] { display: none !important; }
/* v3.24: which store's app: data-only-app="apple|google" shows only in that app; data-not-app hides only there */
html:not([data-store-app="apple"]) [data-only-app="apple"],
html:not([data-store-app="google"]) [data-only-app="google"],
html[data-store-app="apple"] [data-not-app="apple"],
html[data-store-app="google"] [data-not-app="google"] { display: none !important; }
.ft-title-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.ft-title-row > :first-child { min-width: 0; }
.ft-gear {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 2.5rem; height: 2.5rem; padding: 0; border: 0; border-radius: 50%;
    background: var(--bs-secondary-bg); color: var(--bs-secondary-color);
}
.ft-gear:active { opacity: .6; }

/* v3.3.2: the Android app (data-device=android). Its tab bar sits below the page, not floating over it, so no
   extra room at the bottom; and Apple-only things (Apple Health) are hidden. */
html[data-native][data-device=android] article.content { padding-bottom: 1.5rem; }
html[data-native][data-device=android]:not([data-health-connect]) [data-apple-only] { display: none !important; }
/* v3.7: the Android app 0.3.1+ reads tracker workouts from Health Connect. Say the right name, and show the bits
   that are only true on one of them. */
.ft-hn::after { content: "Apple Health"; }
html[data-health-connect] .ft-hn::after { content: "Health Connect"; }
[data-hc-only] { display: none !important; }
html[data-health-connect] [data-hc-only] { display: revert !important; }
html[data-health-connect] [data-ios-only] { display: none !important; }
/* v3.7: iPhone app 0.3.1+ only (body measurements from Apple Health) */
[data-body-only] { display: none !important; }
html[data-body-health] [data-body-only] { display: revert !important; }

/* ---------- Home: iOS-style filled cards (v2.8) ---------- */
:root { --ft-card-bg: #f1f3f5; --ft-rule: #dee2e6; }
[data-bs-theme=dark] { --ft-card-bg: #2b3035; --ft-rule: #3a4046; }

.ft-eyebrow { font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--bs-secondary-color); }
.ft-title { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: .15rem 0 0; }
.ft-card-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.ft-section-title { font-size: 1.25rem; font-weight: 700; margin: 0; }
.ft-btn { border-radius: 16px; font-weight: 600; }
.ft-link, .ft-link:hover { text-decoration: none; }

.ft-card { background: var(--ft-card-bg); border-radius: 18px; padding: 1rem; }
.ft-rule { border: 0; border-top: 1px solid var(--ft-rule); opacity: 1; margin: 0 0 1rem; }

.ft-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.ft-day { display: flex; flex-direction: column; align-items: center; gap: .35rem; font-size: .75rem; color: var(--bs-secondary-color); }
.ft-day i { width: 28px; height: 28px; border-radius: 50%; box-sizing: border-box; background: var(--ft-rule); }
.ft-day i.done { background: var(--ft-done); }
.ft-day i.today { background: var(--ft-volt); border: 2px solid var(--ft-ink); }
[data-bs-theme=dark] .ft-day i.today { background: none; border-color: var(--ft-volt); }

.ft-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.ft-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.ft-stat { display: flex; flex-direction: column; }
.ft-stat-label { font-size: .8rem; color: var(--bs-secondary-color); }
.ft-stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.ft-stat-value small { font-size: .9rem; font-weight: 600; color: var(--bs-secondary-color); margin-left: .2em; }
.ft-stat-delta { font-size: .75rem; color: var(--bs-secondary-color); }
.ft-stat-delta.up { color: var(--bs-success-text-emphasis); }

.ft-bar { height: 6px; background: var(--ft-rule); }

.ft-list { background: var(--ft-card-bg); border-radius: 18px; overflow: hidden; }
.ft-row { display: flex; justify-content: space-between; align-items: flex-start; padding: .75rem 1rem; }
.ft-row + .ft-row { border-top: 1px solid var(--ft-rule); }

/* ---------- iPhone app only: the same look on every page (v2.8) ----------
   Restyles Bootstrap's pieces inside the app; the website and PWA keep their look. */
html[data-native] h1 { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; }
html[data-native] h2, html[data-native] h3, html[data-native] h4, html[data-native] h5 { font-weight: 700; letter-spacing: -.01em; }
html[data-native] a:not(.btn) { text-decoration: none; }

/* Cards: filled, no outline */
html[data-native] .card { --bs-card-bg: var(--ft-card-bg); --bs-card-border-width: 0; --bs-card-border-radius: 18px; --bs-card-inner-border-radius: 18px; --bs-card-cap-bg: transparent; }
html[data-native] .card-header, html[data-native] .card-footer { border-color: var(--ft-rule); }

/* Lists: one filled block with hairlines between rows (iOS "inset grouped") */
html[data-native] .list-group { --bs-list-group-bg: var(--ft-card-bg); --bs-list-group-border-color: var(--ft-rule); --bs-list-group-border-radius: 18px; }
html[data-native] .list-group-item { border-left: 0; border-right: 0; }
html[data-native] .list-group-item:first-child { border-top: 0; }
html[data-native] .list-group-item:last-child { border-bottom: 0; }

/* Buttons: rounder; outline buttons become soft tinted ones */
html[data-native] .btn { --bs-btn-border-radius: 12px; --bs-btn-font-weight: 600; }
html[data-native] .btn-lg { --bs-btn-border-radius: 16px; }
html[data-native] .btn-sm { --bs-btn-border-radius: 10px; }
html[data-native] .btn-outline-primary   { --bs-btn-color: var(--bs-primary-text-emphasis);   --bs-btn-bg: rgba(var(--bs-primary-rgb), .15);   --bs-btn-border-color: transparent; }
html[data-native] .btn-outline-secondary { --bs-btn-color: var(--bs-body-color);               --bs-btn-bg: rgba(var(--bs-secondary-rgb), .18); --bs-btn-border-color: transparent; }
html[data-native] .btn-outline-success   { --bs-btn-color: var(--bs-success-text-emphasis);   --bs-btn-bg: rgba(var(--bs-success-rgb), .15);   --bs-btn-border-color: transparent; }
html[data-native] .btn-outline-danger    { --bs-btn-color: var(--bs-danger-text-emphasis);    --bs-btn-bg: rgba(var(--bs-danger-rgb), .15);    --bs-btn-border-color: transparent; }
html[data-native] .btn-outline-warning   { --bs-btn-color: var(--bs-warning-text-emphasis);   --bs-btn-bg: rgba(var(--bs-warning-rgb), .15);   --bs-btn-border-color: transparent; }

/* Form fields: filled, no outline until focused */
html[data-native] .form-control, html[data-native] .form-select { background-color: var(--ft-card-bg); border-color: transparent; border-radius: 12px; }
html[data-native] .form-control:focus, html[data-native] .form-select:focus { border-color: var(--bs-primary); }
html[data-native] .input-group > .form-control, html[data-native] .input-group > .form-select { border-radius: 0; }
html[data-native] .input-group > :first-child { border-top-left-radius: 12px; border-bottom-left-radius: 12px; }
html[data-native] .input-group > :last-child { border-top-right-radius: 12px; border-bottom-right-radius: 12px; }

/* Messages, badges, bars, tables */
html[data-native] .alert { --bs-alert-border-radius: 16px; --bs-alert-border-color: transparent; }
html[data-native] .badge { border-radius: 999px; }
html[data-native] .progress { border-radius: 999px; background: var(--ft-rule); }
html[data-native] .table { --bs-table-bg: transparent; }
/* a field inside a card uses the page colour, so it doesn't disappear into the card */
html[data-native] .card .form-control, html[data-native] .card .form-select,
html[data-native] .ft-card .form-control, html[data-native] .ft-card .form-select,
html[data-native] .list-group .form-control, html[data-native] .list-group .form-select { background-color: var(--bs-body-bg); }

/* ---------- v2.8.1 ---------- */

/* Hub pages (Progress, Social, Setup): rows like iOS Settings, with a coloured icon tile */
.ft-hub-row { display: flex; align-items: center; gap: .85rem; padding: .7rem 1rem; color: var(--bs-body-color); text-decoration: none; }
.ft-hub-row:hover { color: var(--bs-body-color); }
.ft-hub-row + .ft-hub-row { border-top: 1px solid var(--ft-rule); }
.ft-tile { flex: none; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.ft-hub-text { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.ft-hub-title { font-weight: 600; }
.ft-hub-desc { font-size: .85rem; color: var(--bs-secondary-color); }
/* v3.11: headings over the groups on a tab's page (Setup: Training, Torvin, Settings), like iOS Settings */
.ft-hub-heading { font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
                  color: var(--bs-secondary-color); margin: 0 0 .4rem 1rem; }
.ft-chevron { flex: none; color: var(--bs-secondary-color); opacity: .7; }

/* Workout start: the routine's play mark only shows in the app */
.ft-routine-go { display: none; }

/* --- iPhone app only --- */

/* Taps feel like an app: a slight dim while pressed, no grey flash, no "Open link / Copy" menu,
   no text selection when you hold a button */
html[data-native] { -webkit-tap-highlight-color: transparent; }
html[data-native] a, html[data-native] button, html[data-native] .btn, html[data-native] .list-group-item-action,
html[data-native] label, html[data-native] .ft-hub-row {
    -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
    transition: opacity .12s ease;
}
html[data-native] a:active, html[data-native] button:not(:disabled):active, html[data-native] .btn:not(:disabled):active,
html[data-native] .list-group-item-action:active { opacity: .6; }
html[data-native] .ft-hub-row:active { opacity: 1; background: var(--ft-rule); }

/* iOS zooms in on any field with text under 16px: keep every field at 16px in the app */
html[data-native] .form-control, html[data-native] .form-select,
html[data-native] .form-control-sm, html[data-native] .form-select-sm,
html[data-native] input, html[data-native] select, html[data-native] textarea { font-size: 16px; }

/* Section labels ("Where?", "Energy today"): small grey capitals, like iOS grouped lists */
html[data-native] .ft-label { font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--bs-secondary-color); margin-bottom: .4rem; }

/* Routine buttons: neutral cards with a green play mark (green stays for "go") */
html[data-native] .ft-routine {
    --bs-btn-bg: var(--ft-card-bg); --bs-btn-hover-bg: var(--ft-card-bg); --bs-btn-active-bg: var(--ft-rule);
    --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-active-border-color: transparent;
    --bs-btn-color: var(--bs-body-color); --bs-btn-hover-color: var(--bs-body-color); --bs-btn-active-color: var(--bs-body-color);
    --bs-btn-border-radius: 18px;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1rem;
}
html[data-native] .ft-routine-text { font-weight: 600; }
html[data-native] .ft-routine small { opacity: 1 !important; color: var(--bs-secondary-color); font-weight: 400; }
html[data-native] .ft-routine-go { display: flex; flex: none; width: 34px; height: 34px; border-radius: 50%; align-items: center; justify-content: center; background: var(--ft-volt); color: var(--ft-ink); }

/* Form pages: full-width buttons, and a matching solid button where two sit side by side */
html[data-native] .ft-block { display: block; width: 100%; }
html[data-native] .ft-solid { --bs-btn-bg: var(--ft-volt); --bs-btn-color: var(--ft-ink); --bs-btn-hover-bg: var(--ft-volt); --bs-btn-hover-color: var(--ft-ink); --bs-btn-active-bg: var(--ft-volt-active); --bs-btn-active-color: var(--ft-ink); }

/* ---------- v2.9: workout card ---------- */
.ex-target { font-size: 1.35rem; font-weight: 800; color: var(--bs-success); line-height: 1.2; margin-top: .15rem; }
.ex-target-where { font-size: .95rem; font-weight: 500; color: var(--bs-secondary-color); }
.ex-chip { border: 0; border-radius: 999px; padding: .1rem .55rem; font-size: .75rem; font-weight: 600;
           color: var(--bs-success-text-emphasis); background: rgba(var(--bs-success-rgb), .16); }
.ex-more-btn { flex: none; width: 36px; height: 36px; padding: 0; border-radius: 50%; line-height: 1; font-size: 1.2rem;
               background: var(--bs-secondary-bg); color: var(--bs-body-color); border: 0; }
.ex-more { display: flex; flex-direction: column; gap: .5rem; margin: .5rem 0 .75rem; padding: .75rem;
           border-radius: 12px; background: var(--bs-tertiary-bg); }
.ex-facts { display: flex; flex-direction: column; gap: .25rem; margin: .5rem 0 .75rem; font-size: .95rem; }
.ex-facts > div { display: flex; gap: .5rem; }
.ex-fact-label { flex: none; width: 5.5rem; color: var(--bs-secondary-color); }
.ex-pr { background: #ffc107; color: #212529; }
.ex-actions { display: flex; gap: .5rem; }
.ex-actions > .btn-primary { flex: 2; }
.ex-actions > .btn-outline-success { flex: 1; }

/* ---------- v2.9: week complete ---------- */
.ft-week-done { color: var(--bs-success); font-weight: 600; font-size: .95rem; }
.ft-confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 2000; }
.ft-confetti i { position: absolute; top: -5vh; width: 8px; height: 14px; border-radius: 2px; opacity: .95;
                 animation-name: ft-fall; animation-timing-function: ease-in; animation-fill-mode: forwards; }
@keyframes ft-fall { to { top: 105vh; transform: rotate(540deg) translateX(30px); opacity: .8; } }
.ft-celebrate { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 1rem); transform: translateX(-50%);
                z-index: 2001; max-width: min(92vw, 420px); padding: .9rem 1.1rem; border-radius: 16px;
                background: var(--bs-success); color: #fff; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.3);
                transition: opacity .4s ease; }
.ft-celebrate.out { opacity: 0; }

/* ---------- v3.0: AI coach test ---------- */
.ex-ai { background: #7c3aed; color: #fff; font-size: .65rem; vertical-align: middle; }
.coach-row { display: flex; gap: .75rem; align-items: flex-start; justify-content: space-between; padding: .4rem 0; border-top: 1px solid var(--ft-rule); }
.coach-actions { flex: none; display: flex; gap: .35rem; align-items: center; }

/* v2.13 live coaching: Claude's answer slides in while you rest */
.ex-live { animation: ex-live-in .35s ease-out; }
@keyframes ex-live-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ex-live { animation: none; } }

/* v3.0.1 iPhone app: a blurred strip behind the status bar, so pages don't scroll under the time and battery */
html[data-native] body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0;
    height: env(safe-area-inset-top, 0px);
    background: color-mix(in srgb, var(--bs-body-bg) 75%, transparent);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    z-index: 1040;          /* above page content and sticky banners */
    pointer-events: none;   /* taps still reach the page */
}

/* iPhone app (1.1+): the test-site switch on Setup only shows where the app can actually switch */
.ft-server { display: none; }
html[data-server-switch] .ft-server { display: block; }

/* v3.3.1: pull down at the top of a page to refresh (installed app and iPhone app) */
.ft-ptr { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) - 1.75rem); z-index: 1050;
          width: 2.25rem; height: 2.25rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
          background: var(--ft-card-bg, var(--bs-body-bg)); color: var(--bs-secondary-color); font-weight: 700;
          box-shadow: 0 4px 14px rgba(0,0,0,.2); opacity: 0; transition: opacity .2s; pointer-events: none; }
.ft-ptr span { display: block; line-height: 1; }
.ft-ptr.ready { color: var(--ft-accent-text); }
.ft-ptr.spin span { animation: ft-ptr-spin .8s linear infinite; }
@keyframes ft-ptr-spin { to { transform: rotate(360deg); } }

/* v3.3: the tracker question and switch only in iPhone app 0.2.1+ (older ones can't add workouts automatically) */
[data-tracker-only] { display: none; }
html[data-health-ids] [data-tracker-only] { display: block; }
/* v3.11 Setup -> Health: what an app too old for these switches sees instead of an empty page */
[data-health-old] { display: none; }
html[data-native]:not([data-health-ids]) [data-health-old] { display: block; }

/* v3.3: "Saved set 4 of Leg Press · Undo" at the bottom of the workout page for a few seconds */
.ft-undo { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem); transform: translateX(-50%);
           z-index: 1045; display: flex; align-items: center; gap: .5rem; width: max-content; max-width: min(92vw, 440px);
           padding: .45rem .5rem .45rem 1rem; border-radius: 14px; font-size: .9rem;
           background: var(--bs-emphasis-color); color: var(--bs-body-bg); box-shadow: 0 8px 24px rgba(0,0,0,.25);
           animation: ft-undo-in .25s ease-out; }
@keyframes ft-undo-in { from { opacity: 0; } to { opacity: 1; } }
.ft-undo .btn-link { color: inherit; font-weight: 700; text-decoration: none; flex: none; }
@media (prefers-reduced-motion: reduce) { .ft-undo { animation: none; } }

/* v3.6 routine builder: small number boxes for sets / reps / minutes in the coach's draft */
.ft-builder .ft-num { width: 4.5rem; display: inline-block; }

/* v3.9: Torvin's "Why?" link and the reason it opens */
.ft-why { font-size: .9em; text-decoration: underline; vertical-align: baseline; }
.ft-why-text { margin-top: .25rem; }

/* v3.9 Admin pages: stat tiles (from Admin.razor.css), the page links at the top, the AI request log */
.adm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: .5rem; }
.adm-stat { border: 1px solid var(--bs-border-color); border-radius: 12px; padding: .5rem .75rem; text-align: center; }
.adm-stat-value { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.adm-stat-label { font-size: .75rem; color: var(--bs-secondary-color); }
.adm-nav { display: flex; flex-wrap: wrap; gap: .35rem; }
.adm-chart { position: relative; height: 220px; }
.adm-call { border-bottom: 1px solid var(--bs-border-color); padding: .5rem 0; }
.adm-call:last-child { border-bottom: 0; }

/* v3.11 Torvin page: the routine tabs over "Next session weights" (scroll sideways when there are many) */
.ft-plan-tabs { gap: .35rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ft-plan-tabs::-webkit-scrollbar { display: none; }
.ft-plan-tabs .nav-link { padding: .3rem .75rem; font-size: .9rem; border-radius: 999px; background: var(--ft-rule); color: var(--bs-body-color); }
.ft-plan-tabs .nav-link.active { background: #C5F02C; color: #16181D; }
.ft-plan-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #FB7A2E; margin-left: .35rem; vertical-align: middle; }

/* v3.13.2: the app's "Stay in the loop" card, shown once after the first sign-in on a phone (NotifyPrompt Auto) */
.ft-notify-sheet { position: fixed; inset: 0; z-index: 1080; display: flex; align-items: center; justify-content: center;
                   padding: 24px; background: rgba(0, 0, 0, .55); }
.ft-notify-card { width: 100%; max-width: 380px; text-align: center; padding: 28px 22px 16px; border-radius: 24px;
                  background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); box-shadow: 0 24px 60px rgba(0, 0, 0, .45); }
.ft-notify-bell { font-size: 2.6rem; line-height: 1; margin-bottom: .6rem; }

/* v3.14: Chat with Torvin (TorvinChat.razor) */
.tc-messages { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; max-height: 60vh; overflow-y: auto; }
.tc-msg { max-width: 88%; padding: .5rem .75rem; border-radius: 14px; font-size: .95rem; }
.tc-me { align-self: flex-end; background: var(--bs-primary-bg-subtle); color: var(--bs-body-color); border-bottom-right-radius: 4px; }
.tc-torvin { align-self: flex-start; background: var(--ft-card-bg); border: 1px solid var(--ft-rule); border-bottom-left-radius: 4px; }
.tc-who { font-size: .75rem; font-weight: 700; margin-bottom: .15rem; }
.tc-text { white-space: pre-line; }
.tc-card { margin-top: .5rem; padding: .5rem .6rem; border-radius: 10px; border: 1px solid var(--bs-success-border-subtle);
           background: var(--bs-success-bg-subtle); font-size: .9rem; }
.tc textarea { resize: none; }
.ex-chat { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--ft-rule); }

/* v3.22: up / level / down markers (LiftTrend): Torvin's plans, the workout cards' Torvin line, Insights */
.ft-trend { display: inline-block; font-size: .75rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; white-space: nowrap; vertical-align: .05em; }
.ft-trend-up { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.ft-trend-down { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.ft-trend-same { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }
.ft-trend-stalled { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.ft-lift-row { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem 0; border: 0; border-bottom: 1px solid var(--bs-border-color);
               background: none; color: inherit; text-align: left; }
.ft-lift-row:last-child { border-bottom: 0; }
.ft-lift-name { flex: 1 1 auto; min-width: 0; }
.ft-spark { flex: 0 0 auto; color: var(--bs-secondary-color); }
.ft-spark-up { color: var(--bs-success); }
.ft-spark-down { color: var(--bs-warning); }
