/*
 * PlayOnGym member app design system
 * Material 3 foundations with the original white / charcoal color palette.
 * This stylesheet is loaded by default.ejs only, keeping business/admin UIs isolated.
 */

:root {
    color-scheme: light;

    /* Material 3 color roles */
    --md-sys-color-primary: #3f464a;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #e2e4e5;
    --md-sys-color-on-primary-container: #202527;
    --md-sys-color-secondary: #62686b;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #e5e7e8;
    --md-sys-color-on-secondary-container: #24292b;
    --md-sys-color-tertiary: #706963;
    --md-sys-color-on-tertiary: #ffffff;
    --md-sys-color-surface: #ffffff;
    --md-sys-color-surface-dim: #d9dadb;
    --md-sys-color-surface-bright: #fbfbfb;
    --md-sys-color-surface-container-lowest: #ffffff;
    --md-sys-color-surface-container-low: #f7f7f7;
    --md-sys-color-surface-container: #f1f1f1;
    --md-sys-color-surface-container-high: #ebeced;
    --md-sys-color-surface-container-highest: #e4e6e7;
    --md-sys-color-on-surface: #202426;
    --md-sys-color-on-surface-variant: #555b5e;
    --md-sys-color-outline: #777d80;
    --md-sys-color-outline-variant: #c8ccce;
    --md-sys-color-inverse-surface: #303537;
    --md-sys-color-inverse-on-surface: #f3f4f4;
    --md-sys-color-error: #ba1a1a;
    --md-sys-color-on-error: #ffffff;
    --md-sys-color-error-container: #ffdad6;
    --md-sys-color-on-error-container: #410002;
    --md-sys-color-scrim: #000000;

    /* Material 3 shape and elevation roles */
    --md-sys-shape-corner-extra-small: 4px;
    --md-sys-shape-corner-small: 8px;
    --md-sys-shape-corner-medium: 12px;
    --md-sys-shape-corner-large: 16px;
    --md-sys-shape-corner-extra-large: 28px;
    --md-sys-elevation-level-1: 0 1px 2px rgba(15, 35, 55, 0.12),
        0 1px 3px 1px rgba(15, 35, 55, 0.06);
    --md-sys-elevation-level-2: 0 2px 6px 2px rgba(15, 35, 55, 0.1),
        0 1px 2px rgba(15, 35, 55, 0.08);
    --md-sys-elevation-level-3: 0 6px 16px 4px rgba(15, 35, 55, 0.12),
        0 2px 4px rgba(15, 35, 55, 0.08);
    --md-sys-elevation-level-5: 0 16px 36px 8px rgba(7, 28, 49, 0.2),
        0 4px 12px rgba(7, 28, 49, 0.12);

    /* Material 3 type roles */
    --md-sys-typescale-display-small-size: 36px;
    --md-sys-typescale-display-small-line-height: 44px;
    --md-sys-typescale-headline-large-size: 30px;
    --md-sys-typescale-headline-large-line-height: 38px;
    --md-sys-typescale-headline-medium-size: 26px;
    --md-sys-typescale-headline-medium-line-height: 34px;
    --md-sys-typescale-headline-small-size: 22px;
    --md-sys-typescale-headline-small-line-height: 30px;
    --md-sys-typescale-title-large-size: 20px;
    --md-sys-typescale-title-large-line-height: 28px;
    --md-sys-typescale-title-medium-size: 16px;
    --md-sys-typescale-title-medium-line-height: 24px;
    --md-sys-typescale-title-small-size: 14px;
    --md-sys-typescale-title-small-line-height: 20px;
    --md-sys-typescale-body-large-size: 16px;
    --md-sys-typescale-body-large-line-height: 25px;
    --md-sys-typescale-body-medium-size: 14px;
    --md-sys-typescale-body-medium-line-height: 22px;
    --md-sys-typescale-label-large-size: 14px;
    --md-sys-typescale-label-large-line-height: 20px;

    /* Existing app aliases */
    --app-brand-ink: var(--md-sys-color-primary);
    --app-brand-lime: var(--md-sys-color-on-primary);
    --app-surface: var(--md-sys-color-surface);
    --app-canvas: var(--md-sys-color-surface-container-low);
    --app-border: var(--md-sys-color-outline-variant);
    --app-muted: var(--md-sys-color-on-surface-variant);
    --app-shadow: var(--md-sys-elevation-level-3);
    --primary-color: var(--md-sys-color-primary);
    --form-control-height: 48px;
    --form-control-padding-x: 16px;
}

html {
    background: var(--md-sys-color-surface-container-low);
}

body.member-app {
    min-width: 320px;
    background: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface);
    font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
        'Noto Sans KR', 'Malgun Gothic', Arial, sans-serif;
    font-size: var(--md-sys-typescale-body-medium-size);
    line-height: var(--md-sys-typescale-body-medium-line-height);
    letter-spacing: -0.01em;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body.member-app :where(h1, h2, h3, h4, h5, h6, p) {
    overflow-wrap: break-word;
}

body.member-app h1 {
    margin: 0 0 20px;
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-headline-medium-size);
    font-weight: 760;
    line-height: var(--md-sys-typescale-headline-medium-line-height);
    letter-spacing: -0.025em;
}

body.member-app h2 {
    margin: 0 0 16px;
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-headline-small-size);
    font-weight: 740;
    line-height: var(--md-sys-typescale-headline-small-line-height);
    letter-spacing: -0.02em;
}

body.member-app h3 {
    margin: 0 0 12px;
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-title-large-size);
    font-weight: 700;
    line-height: var(--md-sys-typescale-title-large-line-height);
}

body.member-app :where(.subtitle1, .subtitle, .popup-title) {
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-title-medium-size);
    font-weight: 700;
    line-height: var(--md-sys-typescale-title-medium-line-height);
    letter-spacing: -0.01em;
}

body.member-app .subtitle1 {
    margin: 8px 0 16px;
}

body.member-app top-notice[area='reservations'] + .subtitle1 {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 12px;
    margin: 8px 0 24px;
}

body.member-app
    top-notice[area='reservations']
    + .subtitle1
    > .reservation-cta-button {
    float: none;
    margin-left: auto;
}

body.member-app
    :where(.sub-description, .card-description, .empty-state, .profile-empty) {
    color: var(--md-sys-color-on-surface-variant);
}

body.member-app :where(a, a:visited) {
    color: var(--md-sys-color-primary);
    text-decoration-color: color-mix(
        in srgb,
        var(--md-sys-color-primary) 44%,
        transparent
    );
    text-underline-offset: 3px;
}

body.member-app
    :where(a, button, input, select, textarea, [role='button']):focus-visible {
    outline: 3px solid
        color-mix(in srgb, var(--md-sys-color-primary) 32%, transparent);
    outline-offset: 2px;
}

/* App shell: compact Material top app bar and primary navigation */
body.member-app .header,
body.member-app .app-boot-header {
    height: 64px;
    background: #212c32;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08),
        0 4px 14px rgba(3, 21, 38, 0.18);
}

body.member-app .logo {
    height: 42px;
    max-width: 140px;
    margin-left: 18px;
}

body.member-app .header-right-box {
    min-width: 0;
    align-items: center;
    gap: 4px;
    padding-right: 14px;
    color: #ffffff;
}

body.member-app
    :where(.header-message-link, .header-icon, manual-help-button button) {
    border-radius: 999px;
}

body.member-app .header-message-link,
body.member-app .header-message-link:visited,
body.member-app .header-message-link:hover,
body.member-app .header-message-link:focus-visible {
    color: #ffffff;
}

body.member-app .header-message-icon {
    color: #ffffff;
    fill: #ffffff;
}

body.member-app .header-coin-box .header-gymcash-charge-button,
body.member-app .header-coin-box .header-gymcash-charge-button:visited {
    min-height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
    color: #ffffff;
}

body.member-app .header-message-badge {
    border-color: #212c32;
    background: var(--md-sys-color-error);
}

body.member-app main-navigation,
body.member-app .main-navigation-shell,
body.member-app .main-navigation {
    height: 48px;
}

body.member-app .main-navigation-shell,
body.member-app .main-navigation {
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 2px 8px rgba(15, 35, 55, 0.05);
    backdrop-filter: blur(18px);
}

body.member-app .main-navigation > .main-navigation-item {
    height: 48px;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 48px;
}

body.member-app .main-navigation-link,
body.member-app .main-navigation-link:visited {
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 650;
}

body.member-app .main-navigation-link.main-menu-selected,
body.member-app .main-navigation-link.main-menu-selected:visited {
    color: var(--md-sys-color-primary);
    font-weight: 760;
}

body.member-app .main-navigation-link::after {
    right: 16%;
    bottom: 0;
    left: 16%;
    height: 3px;
    background: var(--md-sys-color-primary);
}

body.member-app default-layout main-content,
body.member-app .app-boot-content {
    top: 112px;
    background: var(--md-sys-color-surface-container-low);
}

body.member-app default-layout main-content {
    box-sizing: border-box;
    padding: 24px clamp(16px, 3vw, 32px) 40px;
}

body.member-app default-layout main-content.user-class-detail-page,
body.member-app default-layout main-content.user-reservation-page,
body.member-app default-layout main-content.user-notice-detail-page {
    background: var(--md-sys-color-surface);
    letter-spacing: 0;
}

body.member-app .class-detail-header,
body.member-app .class-detail-form,
body.member-app .user-reservation-page > top-notice,
body.member-app .user-reservation-form {
    width: 100%;
    max-width: 920px;
    margin-right: auto;
    margin-left: auto;
}

body.member-app .class-detail-header {
    display: flex;
    min-height: 64px;
    box-sizing: border-box;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

body.member-app .class-detail-header h1 {
    min-width: 0;
    margin: 0;
}

body.member-app .class-detail-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
}

body.member-app .attendance-check-in-card {
    display: grid;
    width: 100%;
    max-width: 920px;
    box-sizing: border-box;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    margin: 20px auto 4px;
    padding: 20px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface-container-low);
}

body.member-app .attendance-check-in-icon {
    display: grid;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    place-items: center;
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-primary);
    font-size: 24px;
    font-weight: 800;
}

body.member-app .attendance-check-in-eyebrow,
body.member-app .attendance-check-in-copy h2,
body.member-app .attendance-check-in-copy > p {
    margin: 0;
}

body.member-app .attendance-check-in-eyebrow {
    color: var(--md-sys-color-primary);
    font-size: 12px;
    font-weight: 750;
}

body.member-app .attendance-check-in-copy h2 {
    margin-top: 3px;
    font-size: 20px;
    line-height: 1.35;
}

body.member-app .attendance-check-in-copy #attendanceCheckInDescription {
    margin-top: 5px;
    color: var(--md-sys-color-on-surface-variant);
}

body.member-app .attendance-check-in-meta {
    margin-top: 7px !important;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 13px;
}

body.member-app .attendance-check-in-actions button {
    margin: 0;
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

body.member-app .attendance-check-in-guide {
    display: flex;
    grid-column: 2 / -1;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 13px;
}

body.member-app .attendance-check-in-guide[hidden] {
    display: none;
}

body.member-app .attendance-check-in-guide strong {
    flex: 0 0 auto;
    color: var(--md-sys-color-on-surface);
}

body.member-app .attendance-check-in-guide button {
    min-height: 32px;
    margin: 0 0 0 auto;
    padding: 0 14px;
}

body.member-app .attendance-check-in-card--success {
    border-color: #9ad8b2;
    background: #eefbf3;
}

body.member-app .attendance-check-in-card--success .attendance-check-in-icon {
    background: #177a42;
    color: #ffffff;
}

body.member-app .attendance-check-in-card--error {
    border-color: #efb0aa;
    background: #fff5f4;
}

body.member-app .attendance-check-in-card--pending .attendance-check-in-icon {
    animation: attendance-check-in-pulse 1.2s ease-in-out infinite;
}

@keyframes attendance-check-in-pulse {
    50% {
        opacity: 0.45;
        transform: scale(0.92);
    }
}

body.member-app .class-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(24px, 5vw, 64px);
}

body.member-app .class-detail-field {
    display: grid;
    min-width: 0;
    min-height: 60px;
    box-sizing: border-box;
    grid-template-columns: minmax(92px, 116px) minmax(0, 1fr);
    align-items: start;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

body.member-app .class-detail-field-wide {
    grid-column: 1 / -1;
}

body.member-app .class-detail-label {
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 650;
    line-height: var(--md-sys-typescale-body-large-line-height);
}

body.member-app .class-detail-value {
    min-width: 0;
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-body-large-size);
    line-height: var(--md-sys-typescale-body-large-line-height);
    overflow-wrap: anywhere;
}

body.member-app .class-detail-field-name .class-detail-value {
    font-weight: 720;
}

body.member-app .class-detail-field #coachList {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
}

body.member-app .class-detail-description {
    white-space: pre-line;
}

body.member-app .class-detail-badge-requirements {
    width: 100%;
}

body.member-app .class-detail-training {
    padding-top: 28px;
}

body.member-app .class-detail-section-title {
    margin: 0 0 16px;
    font-size: var(--md-sys-typescale-title-large-size);
    line-height: var(--md-sys-typescale-title-large-line-height);
}

body.member-app .user-reservation-form {
    background: var(--md-sys-color-surface);
}

body.member-app default-layout main-content > :first-child {
    margin-top: 0;
}

body.member-app .app-boot-brand-mark {
    border: 0;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-primary);
    box-shadow: var(--md-sys-elevation-level-2);
    color: var(--md-sys-color-on-primary);
}

body.member-app .app-load-retry {
    border-radius: 999px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

/* Material buttons */
body.member-app
    :where(button, .btn, [role='button']):not(post-card
        button):not(.profile-menu-trigger) {
    min-height: 40px;
    padding: 0 20px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 999px;
    background: var(--md-sys-color-surface);
    box-shadow: none;
    color: var(--md-sys-color-primary);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 700;
    line-height: var(--md-sys-typescale-label-large-line-height);
    letter-spacing: 0;
}

body.member-app
    :where(button, .btn, [role='button']):not(post-card
        button):not(.profile-menu-trigger):hover {
    background: color-mix(
        in srgb,
        var(--md-sys-color-primary) 8%,
        var(--md-sys-color-surface)
    );
}

body.member-app
    :where(button, .btn, [role='button']):not(post-card
        button):not(.profile-menu-trigger):active {
    background: color-mix(
        in srgb,
        var(--md-sys-color-primary) 12%,
        var(--md-sys-color-surface)
    );
}

body.member-app
    :is(button[type='submit'], .btn-primary, .reservation-cta-button, .action-highlight-button, .btn-add-post, .family-button, .gym-select-button, .settings-save-button, .communication-reply
        button, .form-actions button:last-child, .owner-signup-submit-row
        button, .gym-onboarding-submit-row button) {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

body.member-app
    :is(button[type='submit'], .btn-primary, .reservation-cta-button, .action-highlight-button, .btn-add-post, .family-button, .gym-select-button, .settings-save-button, .communication-reply
        button, .form-actions button:last-child, .owner-signup-submit-row
        button, .gym-onboarding-submit-row button):hover {
    background: #30373b;
    box-shadow: var(--md-sys-elevation-level-1);
    color: var(--md-sys-color-on-primary);
}

body.member-app
    :where(.btn-secondary, .secondary-button, .history-more-button) {
    border-color: transparent;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

body.member-app
    :where(.card-menu-btn, .close-btn, .profile-menu-trigger, .profile-icon-button) {
    min-width: 40px;
    width: 40px;
    min-height: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
}

body.member-app :is(.action-btn, .tab-btn, .family-tab):not(post-card button) {
    min-height: 36px;
    padding: 0 16px;
}

body.member-app :where(.action-btn.view, .action-btn.join) {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

body.member-app .action-btn.edit {
    border-color: transparent;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

/* Feed controls keep their original compact, borderless treatment. */
body.member-app .feed-container button,
body.member-app .feed-container button.btn-add-post,
body.member-app .posts-feed-section button,
body.member-app #createPostBtn.fab-add-post,
body.member-app button.card-menu-btn {
    border: 0;
}

body.member-app .weekly-report-shortcut a {
    min-height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

body.member-app
    :where(button, .btn, [role='button']):not(post-card
        button):not(.profile-menu-trigger)[disabled],
body.member-app
    :where(button, .btn, [role='button']):not(post-card
        button):not(.profile-menu-trigger)[aria-disabled='true'] {
    border-color: transparent;
    background: color-mix(
        in srgb,
        var(--md-sys-color-on-surface) 12%,
        transparent
    );
    box-shadow: none;
    color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);
    opacity: 1;
}

/* Material outlined fields */
body.member-app
    :where(input[type='text'], input[type='email'], input[type='number'], input[type='tel'], input[type='password'], input[type='date'], input[type='time'], input[type='search'], input[is='auto-complete-input'], input[is='auto-complete-multi-input'], select, textarea) {
    min-height: 48px;
    box-sizing: border-box;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-body-large-size);
    line-height: var(--md-sys-typescale-body-large-line-height);
    padding: 10px 16px;
    transition: border-color 150ms ease, box-shadow 150ms ease,
        background-color 150ms ease;
}

body.member-app textarea {
    min-height: 112px;
    resize: vertical;
}

body.member-app
    :where(input[type='text'], input[type='email'], input[type='number'], input[type='tel'], input[type='password'], input[type='date'], input[type='time'], input[type='search'], input[is='auto-complete-input'], input[is='auto-complete-multi-input'], select, textarea):focus {
    border-color: var(--md-sys-color-primary);
    outline: 0;
    box-shadow: inset 0 0 0 1px var(--md-sys-color-primary);
}

body.member-app :where(input, textarea)::placeholder {
    color: color-mix(
        in srgb,
        var(--md-sys-color-on-surface-variant) 72%,
        transparent
    );
    opacity: 1;
}

body.member-app :where(input[type='checkbox'], input[type='radio']) {
    width: 20px;
    height: 20px;
    accent-color: var(--md-sys-color-primary);
}

body.member-app
    :where(label, legend, .info-label, .info-label-narrow, .info-label-vertical) {
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 620;
}

body.member-app .form-group {
    gap: 8px;
}

body.member-app :where(.info-row, .info-function-container) {
    min-height: 52px;
    border-color: var(--md-sys-color-outline-variant);
}

/* Cards, lists, tabs, chips and empty states */
body.member-app
    :where(.section-card, .challenge-card, .mission-item-card, .comment-card, .filter-container, .form-guide, .signup-form-container, .family-card, .family-row, .communication-list, .communication-empty, .bc-card, .chart-section, .xp-gauge, .log-item, .rank-item) {
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface);
    box-shadow: var(--md-sys-elevation-level-1);
    color: var(--md-sys-color-on-surface);
}

body.member-app
    :where(.section-card, .challenge-card, .filter-container, .form-guide) {
    padding: 20px;
}

body.member-app .challenge-card:hover {
    border-color: color-mix(
        in srgb,
        var(--md-sys-color-primary) 42%,
        var(--md-sys-color-outline-variant)
    );
    box-shadow: var(--md-sys-elevation-level-2);
    transform: translateY(-1px);
}

body.member-app :where(.list, .communication-list) {
    overflow: hidden;
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-surface);
}

body.member-app .list table {
    color: var(--md-sys-color-on-surface);
}

body.member-app .list table :where(th, td) {
    min-height: 52px;
    border-color: var(--md-sys-color-outline-variant);
    padding: 12px 14px;
}

body.member-app .list table th {
    background: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-title-small-size);
    font-weight: 700;
}

body.member-app .list table tbody tr:hover,
body.member-app .list-row.app-pressed {
    background: var(--md-sys-color-primary-container) !important;
}

body.member-app :where(.challenge-tabs, .button-group) {
    gap: 8px;
}

body.member-app .challenge-tabs {
    overflow-x: auto;
    border: 0;
    padding: 4px 0;
}

body.member-app .tab-btn {
    border: 0;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
}

body.member-app .tab-btn.active {
    border: 0;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

body.member-app .toggle-switch {
    width: 52px;
    height: 32px;
    box-sizing: border-box;
    border: 2px solid var(--md-sys-color-outline);
    border-radius: 999px;
    background: var(--md-sys-color-surface-container-highest);
}

body.member-app .toggle-switch::after {
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: var(--md-sys-color-outline);
    box-shadow: none;
}

body.member-app .toggle-switch.on {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary);
}

body.member-app .toggle-switch.on::after {
    left: 22px;
    background: var(--md-sys-color-on-primary);
}

body.member-app
    :where(.challenge-status, .challenge-scope-badge, .status-active, .status-pending, .status-participating, .status-completed, .family-tab, .communication-participant-chip, .level-chip) {
    border-radius: 999px;
}

body.member-app :where(.empty-state, .profile-private-state, .family-empty) {
    padding: 40px 24px;
    border: 1px dashed var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface-variant);
}

body.member-app .card-menu-dropdown,
body.member-app profile-menu .profile-menu-panel {
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-surface-container);
    box-shadow: var(--md-sys-elevation-level-2);
}

body.member-app .card-menu-dropdown button,
body.member-app profile-menu .profile-menu-item {
    min-height: 48px;
    border: 0;
    border-radius: var(--md-sys-shape-corner-extra-small);
    color: var(--md-sys-color-on-surface);
    font-weight: 600;
}

body.member-app profile-menu .profile-menu-item:hover,
body.member-app profile-menu .profile-menu-item:focus-visible,
body.member-app .card-menu-dropdown button:hover {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

/* Home cards share one elevation and spacing rhythm */
body.member-app default-layout main-content.user-home-main {
    width: min(100%, 980px);
    padding-top: 24px;
}

body.member-app
    .user-home-main
    > :where(top-notice, my-reservation, my-badge, hall-of-fame-scroll, my-attendance, my-courses) {
    padding: 20px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-large);
    margin-bottom: 16px;
    background: var(--md-sys-color-surface);
    box-shadow: var(--md-sys-elevation-level-1);
}

body.member-app .user-home-main > my-experience .xp-card {
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-large);
    box-shadow: var(--md-sys-elevation-level-1);
}

body.member-app
    :where(.record-report-banner, .workout-report-hero, .workout-report-panel, .workout-report-optional-card) {
    border-color: var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface);
    box-shadow: var(--md-sys-elevation-level-1);
    color: var(--md-sys-color-on-surface);
}

body.member-app :where(.workout-timeline-report, .workout-timeline-stat) {
    border-color: var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface);
}

body.member-app .workout-report-detail {
    border-left-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

body.member-app
    :where(.workout-timeline-source, .workout-report-action-number) {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

body.member-app .level-chip.current {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    box-shadow: 0 0 0 2px
        color-mix(in srgb, var(--md-sys-color-primary) 16%, transparent);
    color: var(--md-sys-color-on-primary-container);
}

body.member-app .my-rank-card {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

/* Member list and dashboard components use consistent white card surfaces. */
body.member-app top-notice[area='reservations'] ~ data-table.list,
body.member-app top-notice[area='records'] ~ data-table.list,
body.member-app attendance-ranking-board,
body.member-app my-attendance,
body.member-app my-calorie,
body.member-app my-record {
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding: 20px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-large);
    margin-bottom: 16px;
    background: var(--md-sys-color-surface);
    box-shadow: var(--md-sys-elevation-level-1);
    color: var(--md-sys-color-on-surface);
}

body.member-app .xp-more-btn {
    border-color: var(--md-sys-color-outline);
    color: var(--md-sys-color-primary);
}

/* Material dialog on wide screens, modal bottom sheet on phones */
body.member-app :where(.popup-background, .confirm-popup-background) {
    background: rgba(4, 24, 44, 0.58);
    opacity: 1;
    backdrop-filter: blur(2px);
}

body.member-app .popup-container {
    top: 50%;
    left: 50%;
    width: min(720px, calc(100vw - 48px));
    height: auto;
    max-height: min(86vh, 880px);
    padding: 8px 24px 24px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-surface-container-high);
    box-shadow: var(--md-sys-elevation-level-5);
    transform: translate(-50%, -50%);
}

body.member-app .confirm-popup-container {
    width: min(560px, calc(100vw - 48px));
    min-height: 0;
    max-height: min(80vh, 680px);
    padding: 8px 24px 24px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-surface-container-high);
    box-shadow: var(--md-sys-elevation-level-5);
}

body.member-app :where(.popup-title-container, .confirm-popup-title-container) {
    min-height: 64px;
    border-color: var(--md-sys-color-outline-variant);
    padding: 8px 0;
}

body.member-app :where(.popup-title, .confirm-popup-title) {
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-headline-small-size);
    font-weight: 740;
    line-height: var(--md-sys-typescale-headline-small-line-height);
}

body.member-app
    :where(.popup-content-container, .confirm-popup-content-container) {
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-large-size);
    line-height: var(--md-sys-typescale-body-large-line-height);
}

body.member-app .confirm-popup-content-container {
    min-height: 80px;
    padding: 24px 0;
}

body.member-app
    :where(.popup-function-button-container, .confirm-popup-function-button-container) {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

body.member-app .confirm-popup #yesButton {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

body.member-app
    :where(.profile-settings-backdrop, .challenge-detail-modal.show) {
    background: rgba(4, 24, 44, 0.58);
    backdrop-filter: blur(2px);
}

body.member-app .profile-settings-modal {
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-surface-container-high);
    box-shadow: var(--md-sys-elevation-level-5);
}

body.member-app .settings-modal-header {
    min-height: 64px;
    border-color: var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container-high);
}

body.member-app .challenge-detail-modal .modal-content {
    border-radius: var(--md-sys-shape-corner-extra-large)
        var(--md-sys-shape-corner-extra-large) 0 0;
    background: var(--md-sys-color-surface-container-high);
    box-shadow: var(--md-sys-elevation-level-5);
}

body.member-app .challenge-detail-modal .modal-content::before,
body.member-app .profile-settings-modal::before {
    display: block;
    width: 32px;
    height: 4px;
    flex: 0 0 auto;
    border-radius: 999px;
    margin: 12px auto 0;
    background: var(--md-sys-color-outline);
    content: '';
}

/* Feedback and transient messages */
body.member-app .app-toast {
    min-height: 48px;
    border: 0;
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-inverse-surface);
    box-shadow: var(--md-sys-elevation-level-3);
    color: var(--md-sys-color-inverse-on-surface);
    font-weight: 600;
}

body.member-app .app-toast-action {
    border: 0;
    background: transparent;
    color: #e2e4e5;
}

body.member-app .app-toast--error {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

/* Authentication and onboarding use the same charcoal roles over photography. */
body.member-app.owner-signup-background-page .owner-signup-title,
body.member-app.gym-add-background-page .gym-add-title {
    color: #ffffff;
}

body.member-app.login-background-page .login-form-container,
body.member-app.owner-signup-background-page
    :where(.owner-signup-form-container, .owner-signup-consent-card),
body.member-app.gym-add-background-page
    :where(.gym-add-form-container, .gym-onboarding-card) {
    border-color: rgba(226, 228, 229, 0.28);
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: rgba(28, 32, 34, 0.88);
    box-shadow: var(--md-sys-elevation-level-5);
    backdrop-filter: blur(20px) saturate(120%);
}

body.member-app.gym-add-background-page
    .gym-add-form-container
    :where(input:not([type='file']):not([type='checkbox']):not([type='radio']), select, textarea) {
    border-color: rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.94);
    caret-color: #ffffff;
}

body.member-app.gym-add-background-page
    .gym-add-form-container
    :where(input[type='time'], select) {
    color-scheme: dark;
}

body.member-app.gym-add-background-page
    .gym-add-form-container
    :where(input:not([type='file']):not([type='checkbox']):not([type='radio']), select, textarea):focus {
    border-color: rgba(255, 255, 255, 0.58);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

body.member-app.gym-add-background-page
    .gym-add-form-container
    :where(input, textarea)::placeholder {
    color: rgba(255, 255, 255, 0.42);
}

body.member-app.gym-add-background-page
    .gym-add-form-container
    .time-select-input-panel {
    border-color: rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.08);
}

body.member-app.gym-add-background-page
    .gym-add-form-container
    .time-select-time-container {
    border-color: rgba(255, 255, 255, 0.24);
}

body.member-app.gym-add-background-page
    .gym-add-form-container
    .time-select-time-container
    > div {
    border-color: rgba(255, 255, 255, 0.16);
}

body.member-app.login-background-page .login-form-container button {
    border-color: rgba(255, 255, 255, 0.3);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

body.member-app.login-background-page
    .login-form-container
    .login-field
    + .login-field {
    margin-top: 12px;
}

body.member-app.login-background-page .login-form-container .login-field-label {
    display: block;
    margin-bottom: 6px;
    color: #f7fbff;
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 700;
    line-height: var(--md-sys-typescale-label-large-line-height);
    letter-spacing: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

body.member-app.login-background-page default-layout .header {
    position: relative;
    z-index: 10;
    background: linear-gradient(
        180deg,
        rgba(33, 44, 50, 0.86),
        rgba(33, 44, 50, 0.54)
    );
    box-shadow: none;
    backdrop-filter: blur(8px);
}

body.member-app.login-background-page default-layout main-content {
    top: 0;
    bottom: 0;
    padding: 0;
    background: transparent;
}

body.member-app.login-background-page .login-page-container {
    min-height: 100vh;
    min-height: 100dvh;
    background: transparent;
}

body.member-app.login-background-page .login-visual-area {
    padding-top: calc(64px + 32px);
}

body.member-app.login-background-page .login-background-rotator {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #212c32;
}

body.member-app.login-background-page .login-background-slide {
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}

body.member-app.owner-signup-background-page default-layout main-content,
body.member-app.gym-add-background-page default-layout main-content {
    top: 64px;
}

@media (max-width: 760px) {
    :root {
        --md-sys-typescale-headline-medium-size: 24px;
        --md-sys-typescale-headline-medium-line-height: 32px;
        --md-sys-typescale-headline-small-size: 20px;
        --md-sys-typescale-headline-small-line-height: 28px;
    }

    body.member-app .header,
    body.member-app .app-boot-header {
        height: 64px;
    }

    body.member-app default-layout main-content,
    body.member-app .app-boot-content {
        top: 112px;
    }

    body.member-app default-layout main-content {
        padding: 16px 12px calc(32px + env(safe-area-inset-bottom));
    }

    body.member-app .class-detail-header {
        min-height: 56px;
        gap: 12px;
        padding-bottom: 12px;
    }

    body.member-app .class-detail-header .reservation-detail-cta-button {
        min-width: 0;
        min-height: 44px;
        padding: 0 16px;
        font-size: var(--md-sys-typescale-label-large-size);
    }

    body.member-app .attendance-check-in-card {
        grid-template-columns: 40px minmax(0, 1fr);
        gap: 12px;
        padding: 16px;
    }

    body.member-app .attendance-check-in-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    body.member-app .attendance-check-in-actions,
    body.member-app .attendance-check-in-guide {
        grid-column: 1 / -1;
    }

    body.member-app .attendance-check-in-actions button {
        width: 100%;
        justify-content: center;
    }

    body.member-app .class-detail-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    body.member-app .class-detail-field-wide {
        grid-column: auto;
    }

    body.member-app .class-detail-field {
        grid-template-columns: minmax(76px, 92px) minmax(0, 1fr);
        gap: 12px;
        padding: 15px 0;
    }

    body.member-app .class-detail-description-field,
    body.member-app .badge-conditions {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
    }

    body.member-app .class-detail-training {
        padding-top: 24px;
    }

    body.member-app default-layout main-content.user-home-main {
        width: 100%;
        padding: 16px 12px calc(32px + env(safe-area-inset-bottom));
        background: var(--md-sys-color-surface-container-low);
    }

    body.member-app
        .user-home-main
        > :where(top-notice, my-reservation, my-badge, hall-of-fame-scroll, my-attendance, my-courses) {
        padding: 16px;
        border-radius: var(--md-sys-shape-corner-large);
    }

    body.member-app
        :where(button, .btn, [role='button']):not(post-card
            button):not(.profile-menu-trigger) {
        min-height: 44px;
    }

    body.member-app top-notice[area='reservations'] ~ data-table.list,
    body.member-app top-notice[area='records'] ~ data-table.list,
    body.member-app attendance-ranking-board,
    body.member-app my-attendance,
    body.member-app my-calorie,
    body.member-app my-record {
        padding: 16px;
    }

    body.member-app .popup,
    body.member-app .confirm-popup {
        padding: 0;
    }

    body.member-app .popup-container,
    body.member-app .confirm-popup-container {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: min(90dvh, 860px);
        padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: var(--md-sys-shape-corner-extra-large)
            var(--md-sys-shape-corner-extra-large) 0 0;
        transform: none;
    }

    body.member-app .popup-container::before,
    body.member-app .confirm-popup-container::before {
        width: 32px;
        height: 4px;
        margin: 8px auto 4px;
        background: var(--md-sys-color-outline);
    }

    body.member-app .confirm-popup-function-button-container {
        display: flex;
        gap: 8px;
    }

    body.member-app .confirm-popup-function-button-container button {
        min-width: 0;
        min-height: 48px;
        flex: 1;
    }

    body.member-app
        repeat-reservation-popup
        #popupForm
        > .info-row:first-child {
        display: grid;
        grid-template-columns: 58px minmax(0, 1fr) auto minmax(0, 1fr);
        column-gap: 5px;
    }

    body.member-app
        repeat-reservation-popup
        #popupForm
        > .info-row:first-child
        input[type='date'] {
        width: 100%;
        min-width: 0;
        padding-right: 8px;
        padding-left: 8px;
        font-size: 14px;
    }

    body.member-app repeat-reservation-popup #popupForm > .info-row.flex-row {
        flex-wrap: wrap;
        gap: 8px 4px;
    }

    body.member-app repeat-reservation-popup #popupForm input.margin-left-10 {
        margin-left: 6px;
    }

    body.member-app .profile-settings-backdrop {
        padding: 0;
    }

    body.member-app .profile-settings-modal {
        max-height: 92dvh;
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: var(--md-sys-shape-corner-extra-large)
            var(--md-sys-shape-corner-extra-large) 0 0;
    }

    body.member-app.login-background-page default-layout main-content {
        top: 0;
        padding: 0;
    }

    body.member-app.owner-signup-background-page default-layout main-content,
    body.member-app.gym-add-background-page default-layout main-content {
        top: 64px;
        padding: 0;
    }
}

@media (display-mode: standalone) and (max-width: 760px) {
    body.member-app .header,
    body.member-app .app-boot-header {
        height: calc(64px + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
    }

    body.member-app default-layout main-content,
    body.member-app .app-boot-content {
        top: calc(112px + env(safe-area-inset-top));
    }

    body.member-app.login-background-page default-layout main-content {
        top: 0;
    }

    body.member-app.login-background-page .login-visual-area {
        padding-top: calc(64px + env(safe-area-inset-top) + 24px);
    }

    body.member-app.owner-signup-background-page default-layout main-content,
    body.member-app.gym-add-background-page default-layout main-content {
        top: calc(64px + env(safe-area-inset-top));
    }
}

@media (prefers-reduced-motion: reduce) {
    body.member-app *,
    body.member-app *::before,
    body.member-app *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
