/* Operana.Trainer — the whole look of the trainer app, on top of plain Bootstrap 5.
   Phones: navy top bar, bottom tabs, "More" sheet. Desktop (992px and up): navy sidebar.
   Starting point for the design work; colours and type live in the tokens below. */

:root {
    --tr-bg: #F2F5F8;
    --tr-card: #FFFFFF;
    --tr-ink: #0F304A;
    --tr-sub: #5E7083;
    --tr-line: #E1E7ED;
    --tr-blue: #006EB3;          /* Operana brand blue */
    --tr-blue-soft: #E2EFF8;
    --tr-navy: #0F304A;          /* Operana logo navy */
    --tr-navy-2: #1A4263;
    --tr-heat: #F2602B;          /* what needs the trainer's attention: next session, ending packages */
    --tr-heat-soft: #FFEDE4;
    --tr-heat-ink: #B4410F;
    --tr-ok: #178A50;
    --tr-ok-soft: #E3F4EA;
    --tr-error: #B42318;
    --tr-error-soft: #FEECEB;
    --tr-on-dark: #FFFFFF;
    --tr-on-dark-sub: #A8C1D5;
    --tr-shadow: rgba(15, 48, 74, .18);
    --tr-display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
    --tr-text: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --tr-side-w: 248px;
}

body.tr {
    margin: 0;
    background: var(--tr-bg);
    color: var(--tr-ink);
    font-family: var(--tr-text);
    font-size: 15px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

.tr a { color: inherit; text-decoration: none; }

.tr a:focus-visible,
.tr button:focus-visible,
.tr input:focus-visible {
    outline: 2px solid var(--tr-blue);
    outline-offset: 2px;
}

.tr-ico { width: 20px; height: 20px; flex: none; }

/* ── brand lockup (sidebar, top bar, sign-in) ── */
/* .tr prefix: must outrank ".tr a { color: inherit }" when the lockup is a link */
.tr .tr-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--tr-on-dark);
    font-family: var(--tr-display);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.tr-brand em {
    font-style: normal;
    font-family: var(--tr-text);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--tr-navy-2);
    color: var(--tr-on-dark-sub);
}

.tr-avatar {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    background: var(--tr-blue);
    color: var(--tr-on-dark);
    font-weight: 700;
    font-size: 13px;
}

/* ── phone shell (default) ── */
.tr-side { display: none; }

.tr-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
    background: var(--tr-navy);
}

.tr-main { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }

/* bottom padding leaves room to scroll the last row clear of the floating Book button */
.tr-page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px 14px 76px;
}

.tr-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--tr-card);
    border-top: 1px solid var(--tr-line);
}

.tr-tabs a,
.tr-tabs button {
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--tr-sub);
    font: 600 11.5px var(--tr-text);
}

.tr-tabs .tr-ico { width: 22px; height: 22px; }
.tr-tabs .on { color: var(--tr-blue); }

.tr-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(15, 48, 74, .4);
}

.tr-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 51;
    display: grid;
    gap: 2px;
    padding: 14px 12px calc(16px + env(safe-area-inset-bottom, 0px));
    background: var(--tr-card);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -16px 40px -12px var(--tr-shadow);
}

.tr-sheet-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--tr-line);
}

.tr-sheet a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 10px;
    border-radius: 10px;
    font-weight: 600;
}

.tr-sheet a.on { color: var(--tr-blue); background: var(--tr-blue-soft); }

/* ── desktop shell ── */
@media (min-width: 992px) {
    .tr-side {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 30;
        width: var(--tr-side-w);
        display: flex;
        flex-direction: column;
        gap: 28px;
        padding: 24px 16px 18px;
        background: var(--tr-navy);
        color: var(--tr-on-dark);
    }

    .tr-side-nav { display: grid; gap: 4px; }

    .tr-side-nav a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 11px 12px;
        border-radius: 10px;
        color: var(--tr-on-dark-sub);
        font-weight: 600;
        font-size: 15px;
    }

    .tr-side-nav a:hover { background: rgba(255, 255, 255, .06); color: var(--tr-on-dark); }
    .tr-side-nav a.on { background: var(--tr-navy-2); color: var(--tr-on-dark); }

    .tr-side-user {
        margin-top: auto;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 8px 0;
        border-top: 1px solid var(--tr-navy-2);
    }

    .tr-side-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tr-signout { color: var(--tr-on-dark-sub); display: inline-flex; padding: 6px; border-radius: 8px; }
    .tr-signout:hover { color: var(--tr-on-dark); background: rgba(255, 255, 255, .06); }

    .tr-topbar, .tr-tabs, .tr-sheet, .tr-sheet-backdrop, .tr-fab { display: none !important; }

    .tr-main { margin-left: var(--tr-side-w); padding-bottom: 0; }
    .tr-page { padding: 32px 40px 56px; }
}

/* ── page header ── */
.tr-pagehead {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 20px;
}

.tr-eyebrow {
    margin: 0 0 2px;
    color: var(--tr-sub);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.tr-title {
    margin: 0;
    font-family: var(--tr-display);
    font-weight: 700;
    font-size: 34px;
    line-height: 1.05;
}

/* ── buttons ── */
.tr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: 0;
    border-radius: 10px;
    background: var(--tr-blue);
    color: var(--tr-on-dark) !important;
    font: 700 15px var(--tr-text);
    cursor: pointer;
}

.tr-btn .tr-ico { width: 18px; height: 18px; }
.tr-btn-block { width: 100%; padding: 13px 16px; }
.tr-desktop-only { display: none; }

@media (min-width: 992px) {
    .tr-desktop-only { display: inline-flex; }
}

/* ── Today: hero ── */
.tr-hero {
    margin: -16px -14px 18px;
    padding: 6px 16px 18px;
    display: grid;
    gap: 14px;
    background: var(--tr-navy);
    color: var(--tr-on-dark);
}

.tr-date { margin: 0; color: var(--tr-on-dark-sub); font-size: 13px; }

.tr-hello {
    margin: 2px 0 0;
    font-family: var(--tr-display);
    font-weight: 600;
    font-size: 30px;
    line-height: 1.05;
}

.tr-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tr-stats div { background: var(--tr-navy-2); border-radius: 12px; padding: 10px; }

.tr-stats b {
    display: block;
    font-family: var(--tr-display);
    font-weight: 700;
    font-size: 30px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.tr-stats span { font-size: 12px; color: var(--tr-on-dark-sub); }
.tr-stats .hot b { color: var(--tr-heat); }

@media (min-width: 992px) {
    .tr-hero {
        margin: 0 0 28px;
        padding: 26px 28px;
        border-radius: 20px;
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        gap: 24px;
    }

    .tr-hello { font-size: 38px; }
    .tr-stats { grid-template-columns: repeat(3, 150px); gap: 10px; }
    .tr-stats div { padding: 14px; }
    .tr-stats b { font-size: 36px; }
}

/* ── Today: lists ── */
.tr-today-grid { display: grid; gap: 20px; }
.tr-today-grid section { display: grid; gap: 8px; align-content: start; }

@media (min-width: 992px) {
    .tr-today-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 28px; align-items: start; }
}

.tr-sechead { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 36px; }

.tr-h {
    margin: 0 4px;
    font-family: var(--tr-display);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--tr-sub);
}

.tr-list { display: grid; gap: 8px; }

.tr-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 62px;
    padding: 12px;
    background: var(--tr-card);
    border: 1px solid var(--tr-line);
    border-radius: 14px;
}

.tr-row:hover { border-color: var(--tr-blue); }
.tr-row.two { grid-template-columns: minmax(0, 1fr) auto; }

.tr-row time {
    font-family: var(--tr-display);
    font-weight: 700;
    font-size: 19px;
    font-variant-numeric: tabular-nums;
}

.tr-row-main { min-width: 0; display: grid; gap: 2px; }

.tr-row-main b,
.tr-row-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tr-row-main b { font-weight: 600; font-size: 15px; }
.tr-row-main span { color: var(--tr-sub); font-size: 13px; }

.tr-row.is-done { opacity: .62; }
.tr-row.is-now, .tr-row.is-next { border-color: var(--tr-heat); }
.tr-row.is-cancelled { opacity: .55; }
.tr-row.is-cancelled .tr-row-main b { text-decoration: line-through; }

.tr-pill {
    font-style: normal;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 999px;
    white-space: nowrap;
    background: var(--tr-bg);
    color: var(--tr-sub);
}

.tr-pill.ok { background: var(--tr-ok-soft); color: var(--tr-ok); }
.tr-pill.heat { background: var(--tr-heat); color: var(--tr-on-dark); }
.tr-pill.last { background: var(--tr-heat-soft); color: var(--tr-heat-ink); }

.tr-left { display: grid; justify-items: end; gap: 2px; line-height: 1; }

.tr-left b {
    font-family: var(--tr-display);
    font-size: 26px;
    font-weight: 700;
    color: var(--tr-heat-ink);
    font-variant-numeric: tabular-nums;
}

.tr-left span { font-size: 11px; color: var(--tr-sub); }

.tr-empty,
.tr-loading {
    margin: 0;
    padding: 16px;
    background: var(--tr-card);
    border: 1px dashed var(--tr-line);
    border-radius: 14px;
    color: var(--tr-sub);
    text-align: center;
}

.tr-empty a { color: var(--tr-blue); font-weight: 700; }

.tr-retry {
    margin-left: 6px;
    padding: 6px 12px;
    border: 1px solid var(--tr-blue);
    border-radius: 999px;
    background: transparent;
    color: var(--tr-blue);
    font: 600 13px var(--tr-text);
    cursor: pointer;
}

.tr-fab {
    position: fixed;
    right: 16px;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 13px 18px;
    border-radius: 999px;
    background: var(--tr-blue);
    color: var(--tr-on-dark) !important;
    font-weight: 700;
    box-shadow: 0 10px 22px -10px var(--tr-shadow);
}

.tr-fab .tr-ico { width: 18px; height: 18px; }

/* ── placeholder screens ── */
.tr-empty-card {
    display: grid;
    justify-items: center;
    gap: 8px;
    max-width: 520px;
    margin: 24px auto 0;
    padding: 36px 24px;
    background: var(--tr-card);
    border: 1px dashed var(--tr-line);
    border-radius: 18px;
    text-align: center;
}

.tr-empty-card b { font-size: 17px; }
.tr-empty-card p { margin: 0; color: var(--tr-sub); max-width: 36ch; }

.tr-empty-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--tr-blue-soft);
    color: var(--tr-blue);
}

.tr-empty-icon .tr-ico { width: 28px; height: 28px; }

/* ── sign-in ── */
body.tr-auth { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }

/* The brand side is a photo of a trainer (images/trainer-signin.jpg; more in design/photos) under a navy
   fade. Phone: a tall strip so her face shows, with the headline at its foot over the darkest part. */
.tr-auth-brand {
    position: relative;
    isolation: isolate;
    display: grid;
    align-content: space-between;
    gap: 10px;
    min-height: 430px;
    padding: calc(20px + env(safe-area-inset-top, 0px)) 20px 28px;
    background: var(--tr-navy) url("../images/trainer-signin.jpg") center 18% / cover no-repeat;
    color: var(--tr-on-dark);
}

.tr-auth-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(15, 48, 74, .75) 0%, rgba(15, 48, 74, 0) 30%, rgba(15, 48, 74, 0) 48%, rgba(15, 48, 74, .92) 88%);
}

.tr-auth-brand h1 {
    margin: auto 0 0;
    font-family: var(--tr-display);
    font-weight: 700;
    font-size: 30px;
    line-height: 1.08;
    text-shadow: 0 2px 18px rgba(0, 0, 0, .35);
}

.tr-auth-brand p { display: none; margin: 0; color: var(--tr-on-dark-sub); }

.tr-auth-form { display: flex; justify-content: center; padding: 28px 20px 40px; }

.tr-auth-form form {
    width: 100%;
    max-width: 380px;
    display: grid;
    gap: 8px;
    align-content: start;
}

.tr-auth-form h2 {
    margin: 0 0 8px;
    font-family: var(--tr-display);
    font-weight: 700;
    font-size: 30px;
}

.tr-auth-form label { font-weight: 600; font-size: 14px; margin-top: 6px; }

.tr-auth-form input[type=text],
.tr-auth-form input[type=email],
.tr-auth-form input[type=password] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--tr-line);
    border-radius: 10px;
    background: var(--tr-card);
    color: var(--tr-ink);
    font: 16px var(--tr-text);
}

.tr-auth-form input:focus { border-color: var(--tr-blue); outline: none; }

.tr-check { display: flex; align-items: center; gap: 8px; font-weight: 500 !important; margin: 6px 0 10px !important; }

.tr-alert {
    margin: 0 0 6px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--tr-blue-soft);
    color: var(--tr-ink);
    font-size: 14px;
}

.tr-alert-error { background: var(--tr-error-soft); color: var(--tr-error); }

/* Sign up, the emailed code and password reset share the sign-in page (Shared/_AuthLayout). */
.tr-auth-panel { width: 100%; max-width: 380px; }
.tr-auth-form .tr-hint { margin: -2px 0 0; }
.tr-auth-lead { margin: 0 0 8px; color: var(--tr-sub); }
.tr-auth-lead b { color: var(--tr-ink); }
.tr-optional { font-weight: 500; color: var(--tr-sub); }

.tr-label-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; }
.tr-label-row label { margin-top: 0; }

.tr-label-row a,
.tr-auth-switch a,
.tr-linkbtn { color: var(--tr-blue); font-weight: 600; font-size: 14px; }

.tr-linkbtn { padding: 0; border: 0; background: none; font-family: inherit; cursor: pointer; }
.tr-linkbtn:hover, .tr-auth-switch a:hover, .tr-label-row a:hover { text-decoration: underline; }

.tr-auth-switch { margin: 18px 0 0; text-align: center; color: var(--tr-sub); font-size: 14px; }
.tr-auth-form form.tr-auth-switch { display: block; max-width: none; }
.tr-auth-switch + .tr-auth-switch { margin-top: 8px; }
.tr-auth-note { text-align: center; }

/* The 6-digit code: big and spaced; the left padding balances the spacing after the last digit. */
.tr-auth-form input.tr-code-input {
    padding-left: calc(14px + .4em);
    text-align: center;
    font: 700 28px var(--tr-display);
    letter-spacing: .4em;
}

@media (min-width: 992px) {
    body.tr-auth { grid-template-rows: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

    /* Desktop: the photo fills the left half; the headline sits in the dark ceiling above her and the
       tagline at the foot. */
    .tr-auth-brand {
        grid-template-rows: auto auto 1fr auto;
        align-content: stretch;
        padding: 48px 56px;
        background-position: center top;
    }

    .tr-auth-brand::before {
        background: linear-gradient(180deg, rgba(15, 48, 74, .55) 0%, rgba(15, 48, 74, 0) 26%, rgba(15, 48, 74, 0) 72%, rgba(15, 48, 74, .9) 100%);
    }

    .tr-auth-brand h1 { margin-top: 28px; font-size: 40px; max-width: 560px; }
    .tr-auth-brand p { display: block; grid-row: 4; }
    .tr-auth-form { align-items: center; padding: 48px; }
}

/* ── page pieces shared by the inner screens (Customers, Calendar, Session, Programs, Invoices, Settings) ── */
.tr-pagehead { flex-wrap: wrap; }

.tr .tr-back {
    display: inline-block;
    margin: 0 0 8px;
    color: var(--tr-blue);
    font-weight: 600;
    font-size: 14px;
}

.tr-title a:hover { color: var(--tr-blue); }
.tr-sub { margin: 4px 0 0; color: var(--tr-sub); }
.tr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tr-muted { margin: 0; color: var(--tr-sub); font-size: 14px; }
.tr-hint { margin: 6px 0 0; color: var(--tr-sub); font-size: 13px; }

.tr-btn:disabled { opacity: .55; cursor: default; }

.tr-btn.tr-btn-ghost {
    padding: 9px 15px;
    border: 1px solid var(--tr-line);
    background: var(--tr-card);
    color: var(--tr-ink) !important;
}

.tr-btn-ghost.tr-btn-block { padding: 12px 15px; }
.tr-btn-ghost:hover:not(:disabled) { border-color: var(--tr-blue); }
.tr-btn.tr-btn-danger { color: var(--tr-error) !important; }
.tr-btn-ghost.tr-btn-danger:hover:not(:disabled) { border-color: var(--tr-error); background: var(--tr-error-soft); }

.tr-link-btn {
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--tr-blue);
    font: 600 14px var(--tr-text);
    cursor: pointer;
}

.tr-link-btn:hover { text-decoration: underline; }
.tr-link-btn.danger { color: var(--tr-error); }

/* segmented buttons: week arrows, All / Unpaid */
.tr-seg {
    display: inline-flex;
    border: 1px solid var(--tr-line);
    border-radius: 10px;
    background: var(--tr-card);
    overflow: hidden;
}

.tr-seg button {
    padding: 9px 14px;
    border: 0;
    border-left: 1px solid var(--tr-line);
    background: none;
    color: var(--tr-ink);
    font: 600 14px var(--tr-text);
    cursor: pointer;
}

.tr-seg button:first-child { border-left: 0; }
.tr-seg button:hover { background: var(--tr-bg); }
.tr-seg button.on { background: var(--tr-blue-soft); color: var(--tr-blue); }

/* lists with search */
.tr-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.tr-search { flex: 1 1 240px; max-width: 440px; }
.tr-count { color: var(--tr-sub); font-size: 13px; white-space: nowrap; }
.tr-more-wrap { display: flex; justify-content: center; margin-top: 14px; }

/* cards */
.tr-card {
    display: grid;
    gap: 12px;
    align-content: start;
    min-width: 0;
    padding: 16px;
    background: var(--tr-card);
    border: 1px solid var(--tr-line);
    border-radius: 16px;
}

.tr-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }

.tr-card-title {
    margin: 0;
    font-family: var(--tr-display);
    font-weight: 700;
    font-size: 21px;
    letter-spacing: .01em;
}

.tr-stack { display: grid; gap: 10px; }
.tr-metric-pick { width: auto; max-width: 170px; }

.tr-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.tr-chips button {
    padding: 6px 12px;
    border: 1px solid var(--tr-line);
    border-radius: 999px;
    background: var(--tr-card);
    color: var(--tr-ink);
    font: 600 13px var(--tr-text);
    cursor: pointer;
}

.tr-chips button:hover { border-color: var(--tr-blue); }
.tr-chips button.on { border-color: var(--tr-blue); background: var(--tr-blue-soft); color: var(--tr-blue); }

.tr-profile-grid, .tr-col { display: grid; gap: 16px; align-content: start; }

@media (min-width: 992px) {
    .tr-profile-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
    .tr-col { gap: 20px; }
}

/* forms (cards and modals), on top of Bootstrap's .form-control / .form-select */
.tr-form { display: grid; gap: 14px; align-content: start; }   /* start: full-screen phone modals mustn't spread the rows */
.tr-form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tr-form-row-3 > :first-child { grid-column: 1 / -1; }

@media (min-width: 576px) {
    .tr-form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tr-form-row-3 > :first-child { grid-column: auto; }
}

.tr .form-label { margin-bottom: 4px; font-weight: 600; font-size: 14px; }
.tr .form-label small { color: var(--tr-sub); font-weight: 500; }

.tr .form-control,
.tr .form-select {
    border-color: var(--tr-line);
    border-radius: 10px;
    padding-top: 9px;
    padding-bottom: 9px;
    color: var(--tr-ink);
    font-size: 16px;          /* 16px keeps iOS from zooming into the field */
}

.tr .form-select-sm { padding-top: 5px; padding-bottom: 5px; font-size: 14px; }

.tr .form-control:focus,
.tr .form-select:focus { border-color: var(--tr-blue); box-shadow: 0 0 0 3px var(--tr-blue-soft); }

@media (min-width: 992px) {
    .tr .form-control, .tr .form-select { font-size: 15px; }
    .tr .form-select-sm { font-size: 14px; }
}

/* modals */
.tr .modal { --bs-modal-border-radius: 18px; --bs-modal-inner-border-radius: 17px; --bs-modal-border-color: transparent; }
.tr .modal-header, .tr .modal-footer { border-color: var(--tr-line); }
.tr .modal-footer { gap: 8px; }
.tr .modal-footer > * { margin: 0; }

.tr-modal-title {
    margin: 0;
    font-family: var(--tr-display);
    font-weight: 700;
    font-size: 24px;
}

/* customer picker (booking, new invoice) */
.tr-picker { position: relative; }

.tr-picker-list {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 10;
    margin-top: 4px;
    max-height: 264px;
    overflow: auto;
    padding: 4px;
    background: var(--tr-card);
    border: 1px solid var(--tr-line);
    border-radius: 12px;
    box-shadow: 0 14px 30px -14px var(--tr-shadow);
}

.tr-picker-list button {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--tr-ink);
    text-align: left;
    font: 15px var(--tr-text);
}

.tr-picker-list button:hover { background: var(--tr-bg); }
.tr-picker-list button b { font-weight: 600; }
.tr-picker-list button span { color: var(--tr-sub); font-size: 13px; }

.tr-picker-new {
    margin: 4px 0 0;
    padding: 8px 10px 6px;
    border-top: 1px solid var(--tr-line);
    color: var(--tr-sub);
    font-size: 12.5px;
}

/* phone: Save kept in reach above the bottom tabs */
.tr-savebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(63px + env(safe-area-inset-bottom, 0px));
    z-index: 35;
    padding: 10px 14px;
    background: var(--tr-bg);
    border-top: 1px solid var(--tr-line);
}

@media (min-width: 992px) {
    .tr-savebar { display: none !important; }
}

/* ── Session ── */
.tr-session-grid { display: grid; gap: 16px; }
#ss-cancelled { margin-bottom: 14px; }

@media (min-width: 992px) {
    .tr-session-grid {
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
        grid-template-rows: auto 1fr;
        grid-template-areas: "workout details" "workout body";
        gap: 20px;
        align-items: start;
    }

    .tr-area-workout { grid-area: workout; }
    .tr-area-details { grid-area: details; }
    .tr-area-body { grid-area: body; }
}

/* the details card sits in a narrow column on desktop, so the day keeps its own line there too */
.tr-area-details .tr-form-row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tr-area-details .tr-form-row-3 > :first-child { grid-column: 1 / -1; }

.tr-workout-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tr-workout-tools .form-select { flex: 1 1 200px; width: auto; }

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

@media (min-width: 576px) and (max-width: 991.98px) {
    .tr-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* exercise rows (exercise-rows.js): small cards on phones, a table from 576px */
.tr-exercises { display: grid; gap: 8px; }
.tr-ex-head { display: none; }

.tr-ex {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) 36px;
    gap: 8px;
    padding: 10px;
    background: var(--tr-bg);
    border-radius: 12px;
}

.tr-ex-f { display: grid; gap: 2px; margin: 0; min-width: 0; }
.tr-ex-f span { color: var(--tr-sub); font-size: 12px; font-weight: 600; }
.tr-ex-name { grid-column: 1 / 4; }
.tr-ex-load { grid-column: 3 / 5; }

.tr-ex-remove {
    grid-column: 4;
    grid-row: 1;
    align-self: end;
    height: 42px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--tr-sub);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.tr-ex-remove:hover { color: var(--tr-error); background: var(--tr-error-soft); }

.tr-ex-empty {
    margin: 0;
    padding: 14px;
    border: 1px dashed var(--tr-line);
    border-radius: 12px;
    color: var(--tr-sub);
    text-align: center;
    font-size: 14px;
}

@media (min-width: 576px) {
    .tr-ex-head,
    .tr-ex {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 68px 68px minmax(90px, 120px) 34px;
        gap: 8px;
        align-items: center;
    }

    .tr-ex-head span { color: var(--tr-sub); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
    .tr-ex { padding: 0; background: none; border-radius: 0; }
    .tr-ex-f span { display: none; }
    .tr-ex-name, .tr-ex-load, .tr-ex-remove { grid-column: auto; grid-row: auto; }
    .tr-ex-remove { height: 38px; align-self: center; }
}

/* ── list rows that open a modal (Programs, Invoices) and rows with no link (profile invoices) ── */
.tr .tr-row-btn { width: 100%; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tr-row.static:hover { border-color: var(--tr-line); }
.tr-row-side { display: grid; justify-items: end; gap: 4px; }
.tr-row-meta { color: var(--tr-sub); font-size: 12.5px; text-align: right; line-height: 1.3; }
.tr-pill.due { background: var(--tr-error-soft); color: var(--tr-error); }

.tr-amount { display: grid; justify-items: end; gap: 4px; }
.tr-amount b { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Customers ── */
.tr-avatar-soft { width: 40px; height: 40px; background: var(--tr-blue-soft); color: var(--tr-blue); }
.tr-row.person { grid-template-columns: 40px minmax(0, 1fr) auto; }

/* ── Customer profile: packages ── */
.tr-pkg { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--tr-line); border-radius: 12px; }
.tr-pkg.closed { background: var(--tr-bg); }
.tr-pkg.closed .tr-pkg-top b { color: var(--tr-sub); }
.tr-pkg-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tr-pkg-top > b { font-weight: 600; }
.tr-pkg-left { color: var(--tr-sub); font-size: 13px; white-space: nowrap; }
.tr-pkg-left b { font-family: var(--tr-display); font-size: 22px; color: var(--tr-ink); font-variant-numeric: tabular-nums; }
.tr-pkg-left.hot b { color: var(--tr-heat-ink); }
.tr-pkg-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--tr-sub); font-size: 13px; }

/* used / booked, with a 2px gap between the two fills */
.tr-bar { display: flex; gap: 2px; height: 8px; border-radius: 999px; background: var(--tr-bg); overflow: hidden; }
.tr-bar span { height: 100%; border-radius: 999px; }
.tr-bar .used { background: var(--tr-blue); }
.tr-bar .booked { background: var(--tr-on-dark-sub); }

/* ── Customer profile: progress chart ── */
.tr-pr-now { margin: 0; color: var(--tr-sub); font-size: 14px; }
.tr-pr-now b { font-family: var(--tr-display); font-size: 30px; font-weight: 700; color: var(--tr-ink); font-variant-numeric: tabular-nums; }
.tr-pr-now span { display: block; }
.tr-chart-wrap { position: relative; }
.tr-chart { display: block; overflow: visible; touch-action: pan-y; }
.tr-chart .grid { stroke: var(--tr-line); stroke-width: 1; }
.tr-chart .tick { fill: var(--tr-sub); font: 12px var(--tr-text); }
.tr-chart .end { fill: var(--tr-ink); font: 700 13px var(--tr-text); }
.tr-chart .line { fill: none; stroke: var(--tr-blue); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tr-chart .dot { fill: var(--tr-blue); stroke: var(--tr-card); stroke-width: 2; }
.tr-chart .cross { stroke: var(--tr-sub); stroke-width: 1; }

.tr-tip {
    position: absolute;
    z-index: 2;
    display: grid;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--tr-navy);
    color: var(--tr-on-dark);
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
}

.tr-tip b { font-size: 14px; }
.tr-tip span { color: var(--tr-on-dark-sub); }

.tr-pr-table summary { color: var(--tr-blue); font-size: 13px; font-weight: 600; cursor: pointer; }
.tr-pr-table table { width: 100%; margin-top: 8px; font-size: 14px; }
.tr-pr-table th { color: var(--tr-sub); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tr-pr-table th, .tr-pr-table td { padding: 5px 0; border-bottom: 1px solid var(--tr-line); }
.tr-pr-table th:last-child, .tr-pr-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Calendar: phone day strip + one day; desktop seven columns ── */
.tr-daystrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 12px; }

.tr-daystrip button {
    display: grid;
    justify-items: center;
    gap: 1px;
    padding: 7px 0 5px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: none;
    color: var(--tr-ink);
    font-family: var(--tr-text);
    cursor: pointer;
}

.tr-daystrip span { color: var(--tr-sub); font-size: 11.5px; font-weight: 600; }
.tr-daystrip b { font-family: var(--tr-display); font-size: 21px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tr-daystrip i { min-height: 15px; color: var(--tr-blue); font-style: normal; font-size: 11px; font-weight: 700; }
.tr-daystrip .today b { color: var(--tr-blue); }
.tr-daystrip .sel { background: var(--tr-card); border-color: var(--tr-line); box-shadow: 0 6px 14px -10px var(--tr-shadow); }

.tr-week { display: grid; gap: 8px; }
.tr-day { display: none; gap: 8px; align-content: start; }
.tr-day.sel { display: grid; }

.tr-day header { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.tr-day header span, .tr-day header b { display: none; }
.tr-day header em { flex: 1; font-style: normal; font-family: var(--tr-display); font-size: 14px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--tr-sub); }

.tr-day-add {
    width: 32px;
    height: 32px;
    border: 1px solid var(--tr-line);
    border-radius: 9px;
    background: var(--tr-card);
    color: var(--tr-blue);
    font: 600 20px/1 var(--tr-text);
    cursor: pointer;
}

.tr-day-add:hover { border-color: var(--tr-blue); }

.tr-slot {
    display: grid;
    gap: 1px;
    padding: 10px 12px;
    background: var(--tr-card);
    border: 1px solid var(--tr-line);
    border-left: 4px solid var(--tr-blue);
    border-radius: 10px;
    min-width: 0;
}

.tr-slot:hover { border-color: var(--tr-blue); }
.tr-slot time { font-family: var(--tr-display); font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.tr-slot b, .tr-slot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-slot b { font-weight: 600; font-size: 14.5px; }
.tr-slot span { color: var(--tr-sub); font-size: 12.5px; }
.tr-slot.is-done { border-left-color: var(--tr-ok); }
.tr-slot.is-now { border-left-color: var(--tr-heat); }
.tr-slot.is-cancelled { border-left-color: var(--tr-line); opacity: .6; }
.tr-slot.is-cancelled b { text-decoration: line-through; }

.tr-day-empty {
    margin: 0;
    padding: 16px;
    border: 1px dashed var(--tr-line);
    border-radius: 12px;
    color: var(--tr-sub);
    text-align: center;
    font-size: 14px;
}

@media (min-width: 992px) {
    .tr-daystrip { display: none; }
    .tr-week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: start; }
    .tr-week > .tr-loading, .tr-week > .tr-empty { grid-column: 1 / -1; }
    .tr-day, .tr-day.sel { display: grid; min-height: 320px; padding: 8px; border-radius: 14px; background: rgba(255, 255, 255, .55); }
    .tr-day.today { background: var(--tr-blue-soft); }
    .tr-day header { padding: 0 2px 4px; }
    .tr-day header span { display: inline; color: var(--tr-sub); font-size: 13px; font-weight: 600; }
    .tr-day header b { display: inline; flex: 1; font-family: var(--tr-display); font-size: 22px; font-variant-numeric: tabular-nums; }
    .tr-day.today header b { color: var(--tr-blue); }
    .tr-day header em { display: none; }
    .tr-day-add { width: 26px; height: 26px; font-size: 17px; }
    .tr-slot { padding: 8px 9px; }
    .tr-slot time { font-size: 14px; }
    .tr-slot b { font-size: 13.5px; }
    .tr-day-empty { padding: 10px 4px; border: 0; font-size: 12.5px; }
}

/* ── Invoices: detail ── */
.tr-inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.tr-inv-head div { display: grid; }
.tr-inv-head b { font-size: 17px; font-weight: 600; }
.tr-inv-head b a { color: var(--tr-blue); }
.tr-inv-head span { color: var(--tr-sub); font-size: 13px; }

.tr-lines { width: 100%; font-size: 14px; }
.tr-lines th { color: var(--tr-sub); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tr-lines th, .tr-lines td { padding: 8px 6px; border-bottom: 1px solid var(--tr-line); vertical-align: top; }
.tr-lines th:first-child, .tr-lines td:first-child { padding-left: 0; }
.tr-lines th:last-child, .tr-lines td:last-child { padding-right: 0; }
.tr-lines th:not(:first-child), .tr-lines td:not(:first-child) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.tr-totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 12px 0 0; font-size: 14px; }
.tr-totals dt { color: var(--tr-sub); font-weight: 500; text-align: right; }
.tr-totals dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.tr-totals dd.due { color: var(--tr-error); }
.tr-inv-notes { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--tr-bg); color: var(--tr-sub); font-size: 14px; white-space: pre-line; }

/* ── Invoices: new-invoice lines (same field look as the exercise rows) ── */
.tr-line-head { display: none; }
.tr-lines-edit { display: grid; gap: 8px; }

.tr-line {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) 36px;
    gap: 8px;
    padding: 10px;
    background: var(--tr-bg);
    border-radius: 12px;
}

.tr-line-desc { grid-column: 1 / 4; }
.tr-line-price { grid-column: 2 / 4; }
.tr-lines-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; color: var(--tr-sub); }
.tr-lines-foot b { color: var(--tr-ink); font-size: 17px; font-variant-numeric: tabular-nums; }

@media (min-width: 576px) {
    .tr-line-head,
    .tr-line {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 76px 120px 34px;
        gap: 8px;
        align-items: center;
    }

    .tr-line-head { margin-bottom: 4px; }
    .tr-line-head span { color: var(--tr-sub); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
    .tr-line { padding: 0; background: none; border-radius: 0; }
    .tr-line .tr-ex-f span { display: none; }
    .tr-line-desc, .tr-line-price, .tr-line .tr-ex-remove { grid-column: auto; grid-row: auto; }
    .tr-line .tr-ex-remove { height: 38px; align-self: center; }
}

/* ── SweetAlert2 in the app's type (Tr.done / error / confirm, record payment) ── */
.tr .swal2-popup { border-radius: 18px; }
.tr .swal2-title { font-family: var(--tr-display); font-weight: 700; color: var(--tr-ink); }
.tr .swal2-html-container { color: var(--tr-sub); }

.tr-swal-sub { margin: 0 0 12px; color: var(--tr-sub); font-size: 15px; }
.tr-swal-form { display: grid; gap: 4px; text-align: left; }
.tr-swal-form .form-label { margin: 8px 0 2px; }

/* ── Settings ── */
.tr-days button { min-width: 52px; padding: 8px 12px; font-size: 14px; }
.tr .form-control[readonly] { background: var(--tr-bg); color: var(--tr-sub); }

/* ── Gym photos (images/today-dumbbells, side-gym, card-kettlebells, empty-barbell; originals in design/photos) ── */

/* Today banner: dumbbells on the right, fading into the navy behind the greeting; the tiles let them show through */
.tr-hero { position: relative; isolation: isolate; overflow: hidden; }

/* the layer covers the whole banner (no seam); its left part stays solid navy behind the greeting */
.tr-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(90deg, var(--tr-navy) 0%, var(--tr-navy) 28%, rgba(15, 48, 74, .6) 55%, rgba(15, 48, 74, .2) 100%),
        url("../images/today-dumbbells.jpg") center 55% / cover no-repeat;
}

.tr-stats div { background: rgba(15, 48, 74, .62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

/* Sidebar (desktop): an empty gym at dusk in the space between the menu and the user, fading into the navy */
@media (min-width: 992px) {
    .tr-side { isolation: isolate; }

    /* covers the whole sidebar (no seam): solid navy behind the menu, the photo below it */
    .tr-side::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        pointer-events: none;
        background:
            linear-gradient(180deg, var(--tr-navy) 0%, var(--tr-navy) 40%, rgba(15, 48, 74, .25) 60%, rgba(15, 48, 74, .35) 88%, var(--tr-navy) 100%),
            url("../images/side-gym.jpg") center bottom / auto 62% no-repeat;   /* its top edge sits under the solid navy */
    }
}

/* Today, under "Packages running out" (desktop; on phones the lists already fill the screen) */
.tr-photo-card { display: none; }

@media (min-width: 992px) {
    .tr-photo-card {
        display: grid;
        margin-top: 12px;
        overflow: hidden;
        background: var(--tr-card);
        border: 1px solid var(--tr-line);
        border-radius: 14px;
    }

    .tr-photo-card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
    .tr-photo-card-body { display: grid; justify-items: center; gap: 10px; padding: 14px 16px 18px; text-align: center; }
    .tr-photo-card-body b { font-weight: 600; font-size: 16px; }
}

/* Empty lists with nothing in them yet (Invoices, Programs, Customers): a barbell photo, message and button */
.tr-empty-hero {
    display: flex;
    align-items: flex-end;
    min-height: 360px;
    padding: 24px;
    overflow: hidden;
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(12, 12, 12, 0) 30%, rgba(12, 12, 12, .88) 100%),
        url("../images/empty-barbell.jpg") 22% center / cover no-repeat,
        #111;
    color: #fff;
}

.tr-empty-hero-text { display: grid; justify-items: start; gap: 8px; max-width: 380px; }
.tr-empty-hero-text b { font-family: var(--tr-display); font-weight: 700; font-size: 30px; line-height: 1.1; }
.tr-empty-hero-text span { color: rgba(255, 255, 255, .78); font-size: 15px; }
.tr-empty-hero-text .tr-btn { margin-top: 6px; }

@media (min-width: 768px) {
    .tr-empty-hero {
        align-items: center;
        justify-content: flex-end;
        min-height: 330px;
        padding: 32px 56px;
        background: url("../images/empty-barbell.jpg") center 60% / cover no-repeat, #111;
    }

    .tr-empty-hero-text b { font-size: 34px; }
}

/* Intake & waiver: the liability text block and PAR-Q checklist spacing */
.tr-waiver {
    font-size: .85rem;
    line-height: 1.5;
    color: #5A6B7B;
    background: var(--tr-bg);
    border: 1px solid var(--tr-line);
    border-radius: 10px;
    padding: .65rem .8rem;
    margin: .25rem 0 .6rem;
}
#in-parq .form-check { margin-bottom: .4rem; }

/* Bookings: accept/decline action pair on a request row */
.tr-book-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-shrink: 0;
}
.tr-book-actions .tr-btn {
    padding: .45rem .95rem;
    font-size: .9rem;
}
@media (max-width: 575px) {
    .tr-book-actions { width: 100%; }
    .tr-book-actions .tr-btn { flex: 1; }
}
