:root {
    --bg-primary: #0A0A0A;
    --bg-secondary: #141414;
    --bg-card: #1A1A1A;
    --bg-input: #1E1E1E;
    --border: #2A2A2A;
    --border-light: #333;
    --green: #2E7D32;
    --green-light: #4CAF50;
    --green-dark: #1B5E20;
    --green-glow: rgba(46, 125, 50, 0.3);
    --text: #FFFFFF;
    --text-secondary: #A0A0A0;
    --text-muted: #666;
    --danger: #ef4444;
    --warning: #ff9800;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--green-light);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== App Container ===== */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
}

/* ===== Client page transitions ===== */
.page-top-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    z-index: 100001;
    background: var(--green, #22c55e);
    box-shadow: 0 0 10px var(--tf-green-glow, rgba(34, 197, 94, 0.35));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.page-top-progress.is-active {
    opacity: 1;
}
.page-top-progress.is-done {
    transition: width 0.22s ease, opacity 0.28s ease 0.08s;
}
body.client-app .app-main,
body.client-app.settings-page .page {
    opacity: 1;
    transition: opacity 0.18s ease;
}
body.client-app.page-leaving .app-main,
body.client-app.page-leaving.settings-page .page {
    opacity: 0;
}

:root {
    --tg-top: 0px;
}
.tg-webapp .app-header {
    padding-top: var(--tg-top);
}
.tg-webapp .app-main {
    padding-top: 8px;
}

/* ===== Header ===== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-primary);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-logo svg {
    display: block;
    flex-shrink: 0;
}
.header-brand {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.header-menu {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
}

.header-menu span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

/* ===== Sidebar ===== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    backdrop-filter: blur(4px);
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100%;
    background: var(--bg-secondary);
    z-index: 999;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
}

.sidebar.open {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 24px);
    border-bottom: 1px solid var(--border);
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 600;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.sidebar-email {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.sidebar-nav a {
    display: block;
    padding: 14px 24px;
    color: var(--text);
    font-size: 0.95rem;
    transition: var(--transition);
}

.sidebar-nav a:hover {
    background: var(--bg-card);
    text-decoration: none;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
}

.sidebar-logout {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ===== Main Content ===== */
.app-main {
    padding: 0 20px 40px;
}

/* ===== Typography ===== */
.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
}

.page-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 24px 0 12px;
}

/* ===== Auth Pages ===== */
.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 40px 20px;
}

.auth-logo {
    margin-bottom: 32px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.auth-tab {
    padding: 10px 28px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.auth-tab.active {
    background: var(--green);
    color: var(--text);
}

.auth-mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.auth-mode-tab {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.auth-mode-tab.active {
    background: var(--green);
    color: var(--text);
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.auth-subtitle-email {
    display: block;
    margin-top: 6px;
    font-size: 0.9rem;
    color: var(--text);
}

.auth-form {
    width: 100%;
    max-width: 360px;
}

.auth-link {
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-label-sm {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-glow);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-section-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 600;
}

.form-section-label-sm {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-section-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.radio-group {
    display: flex;
    gap: 12px;
}

.radio-card {
    flex: 1;
    cursor: pointer;
}

.radio-card input {
    display: none;
}

.radio-card-label {
    display: block;
    text-align: center;
    padding: 14px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-weight: 500;
    transition: var(--transition);
}

.radio-card input:checked + .radio-card-label {
    border-color: var(--green);
    background: rgba(46, 125, 50, 0.1);
    color: var(--green-light);
}

.form-group-media {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.file-upload-btn {
    cursor: pointer;
}

.file-upload-btn input[type="file"] {
    display: none;
}

.file-name {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 8px;
}

.media-preview-wrap {
    position: relative;
    display: inline-flex;
    margin-bottom: 8px;
}

.media-remove-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.media-remove-btn:hover {
    background: rgba(231, 76, 60, 0.95);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--green);
    color: white;
}

.btn-primary:hover {
    background: var(--green-light);
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--green);
    color: var(--green-light);
}

.btn-outline:hover {
    background: rgba(46, 125, 50, 0.1);
    text-decoration: none;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn-bottom {
    margin-top: 16px;
}

/* ===== Fixed Bottom Bar ===== */
.fixed-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, var(--bg) 30%);
    z-index: 50;
}

.fixed-bottom-bar .btn {
    max-width: 480px;
    margin: 0 auto;
    display: block;
}

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 16px;
    text-align: center;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-success {
    background: rgba(46, 125, 50, 0.15);
    color: var(--green-light);
    border: 1px solid var(--green-glow);
}

/* Срочное продление подписки (осталось ≤3 дн.) */
.alert-billing-urgent,
.trainer-billing-banner--urgent {
    background: rgba(220, 38, 38, 0.2);
    color: #fecaca;
    border: 1px solid rgba(248, 113, 113, 0.55);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.alert-billing-urgent strong,
.trainer-billing-banner--urgent strong {
    color: #fff;
}
.alert-billing-urgent a,
.trainer-billing-banner--urgent a {
    color: #fecaca;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.alert-billing-urgent a:hover,
.trainer-billing-banner--urgent a:hover {
    color: #fff;
}

/* Баннер продления: на всю ширину каркаса (компенсация padding .app-main) */
.alert-billing-urgent.alert-billing-stretch {
    margin-left: -20px;
    margin-right: -20px;
    width: calc(100% + 40px);
    max-width: none;
    box-sizing: border-box;
    border-radius: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
}
.client-billing-banner-text {
    line-height: 1.45;
    width: 100%;
}
.client-billing-extend-link {
    align-self: flex-start;
    color: #fecaca !important;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.client-billing-extend-link:hover {
    color: #fff !important;
}

/* Модалка выбора срока (клиент) */
.client-billing-modal[hidden] {
    display: none !important;
}
.client-billing-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
}
.client-billing-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}
.client-billing-modal__panel {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: #141414;
    border: 1px solid #2a2a2a;
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    padding: 20px 20px 28px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 1;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
}
.client-billing-modal__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 6px;
    color: #fff;
    padding-right: 36px;
}
.client-billing-modal__sub {
    font-size: 0.9rem;
    color: #9ca3af;
    margin: 0 0 16px;
    line-height: 1.4;
}
.client-billing-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border: none;
    background: #2a2a2a;
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    border-radius: 10px;
    cursor: pointer;
}
.client-billing-modal__close:hover {
    background: #3a3a3a;
}
.client-plan-pick {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.client-plan-pick__row {
    display: block;
    width: 100%;
    text-align: left;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 12px 14px;
    color: #e5e5e5;
    font: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.client-plan-pick__row:hover {
    border-color: #4a4;
    background: #1c221c;
}
.client-plan-pick__row--focus {
    border-color: #3d5c3d;
    background: #152015;
    box-shadow: 0 0 0 1px rgba(74, 120, 74, 0.45);
}
.client-plan-pick__row:disabled {
    opacity: 0.6;
    pointer-events: none;
}
.client-plan-pick__line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-weight: 600;
}
.client-plan-pick__label {
    color: #f3f3f3;
}
.client-plan-pick__price {
    color: #8bc34a;
    font-weight: 700;
    white-space: nowrap;
}
.client-plan-pick__hint {
    display: block;
    font-size: 0.85rem;
    color: #9ca3af;
    margin-top: 2px;
    font-weight: 400;
}

/* ===== Onboarding ===== */
.onboarding-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 40px 20px 100px;
}

.onboarding-step {
    font-size: 1.75rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
}

.onboarding-question {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 32px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    align-self: center;
}

.choice-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}
.choice-list-inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}
.choice-list-inline .choice-item {
    flex: 1;
    min-width: 80px;
}
.choice-list-inline .choice-label {
    border: 1px solid var(--border);
    border-radius: 10px;
}
.choice-list-inline .choice-item input:checked + .choice-label {
    border-color: var(--green);
}

.choice-item {
    cursor: pointer;
    display: block;
    width: 100%;
}

.choice-item input {
    display: none;
}

.choice-label {
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    border-top: 1px solid var(--border);
    transition: var(--transition);
}

.choice-item:last-child .choice-label {
    border-bottom: 1px solid var(--border);
}

.choice-item input:checked + .choice-label {
    background: rgba(46, 125, 50, 0.12);
    color: var(--green-light);
}

.choice-selected .choice-label {
    background: rgba(46, 125, 50, 0.12);
    color: var(--green-light);
}

/* ===== Gender Cards ===== */
.gender-cards {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding: 0 10px;
}

.gender-card {
    cursor: pointer;
    flex: 1;
    max-width: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 32px 16px 24px;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: var(--bg-card);
    transition: all 0.2s ease;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.gender-card span {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    transition: color 0.2s;
}

.gender-card:active {
    transform: scale(0.96);
}

.gender-card.active {
    border-color: var(--green);
    background: rgba(46, 125, 50, 0.12);
}

.gender-card.active span {
    color: var(--green-light);
}

/* ===== Level Cards ===== */
.level-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.level-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.level-card:active {
    transform: scale(0.98);
}

.level-card.active {
    border-color: var(--green);
    background: rgba(46, 125, 50, 0.12);
}

.level-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all 0.2s;
}

.level-card.active .level-icon {
    background: var(--green);
    border-color: var(--green);
    color: white;
}

.level-info {
    flex: 1;
}

.level-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
}

.level-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.level-card.active .level-name {
    color: var(--green-light);
}

/* ===== Create Workout ===== */
.create-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 12px;
    margin-bottom: 4px;
}

.create-title {
    font-size: 1.2rem;
    font-weight: 800;
    flex: 1;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.back-btn-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-title {
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    margin: 0 0 4px;
}

.step-question {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.create-workout-form .form-group {
    margin-bottom: 12px;
}

/* ===== Dashboard Filters ===== */
.dashboard-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}
.filter-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.filter-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-right: 4px;
    flex-shrink: 0;
}
.filter-select {
    width: 100%;
    max-width: 200px;
    padding: 10px 14px;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.filter-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.dashboard-filters-desktop { display: none; }
.dashboard-filters-mobile { display: flex; }
/* Десктоп: чипы видны, селекты скрыты */
@media (min-width: 600px) {
    .dashboard-filters-desktop {
        display: flex !important;
        margin-bottom: 32px;
    }
    .dashboard-filters-mobile {
        display: none !important;
    }
    .trainer-main .workout-list {
        padding-top: 8px;
    }
}
/* Мобилка: селекты видны, чипы скрыты. Список тренировок — отдельно */
@media (max-width: 599px) {
    .dashboard-filters-desktop {
        display: none !important;
    }
    .dashboard-filters-mobile {
        display: flex !important;
        flex-direction: column;
        gap: 12px;
        padding: 12px;
        margin-bottom: 24px;
    }
    .dashboard-filters-mobile .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    .dashboard-filters-mobile .filter-label {
        margin-right: 0;
    }
    .dashboard-filters-mobile .filter-select {
        max-width: none;
        width: 100%;
    }
}
.filter-chip {
    display: inline-block;
    padding: 6px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.2s;
}
.filter-chip:hover {
    color: var(--green-light);
    border-color: var(--green);
}
.filter-chip.active {
    color: var(--green-light);
    background: rgba(76,175,80,0.15);
    border-color: var(--green);
}

/* ===== Workout List ===== */
.workout-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
@media (max-width: 599px) {
    .trainer-main .workout-list {
        padding-bottom: 80px;
        display: flex !important;
        gap: 8px;
    }
    .trainer-main .workout-card {
        background: var(--bg-card);
        border-radius: var(--radius-sm);
        border: 1px solid var(--border);
        padding: 16px !important;
    }
}

.workout-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.workout-card.is-clickable {
    cursor: pointer;
}

.workout-card.is-clickable:hover {
    background: rgba(255, 255, 255, 0.02);
}

.workout-card:first-child {
    border-top: 1px solid var(--border);
}

.workout-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 28px;
    text-align: center;
}

.workout-thumb {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.workout-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.workout-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.workout-info {
    flex: 1;
    min-width: 0;
}

.workout-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.workout-meta {
    font-size: 0.8rem;
    color: #f1f1f1;
    margin-bottom: 4px;
}
.client-workout-list .workout-desc {
    font-size: 0.8rem;
    color: #999;
    line-height: 1.3;
    margin-top: 2px;
}

.workout-description {
    font-size: 0.8rem;
    color: #cfcfcf;
    margin-bottom: 6px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workout-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.action-btn:hover {
    color: var(--text);
}

.action-delete:hover {
    color: var(--danger);
}

.workout-status-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
    align-items: center;
}

.status-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: var(--transition);
}

.status-btn small {
    font-size: 0.6rem;
    font-weight: 500;
}

.status-skip.active {
    color: var(--warning);
}

.status-done.active {
    color: var(--green-light);
}

.workout-completed {
    opacity: 0.6;
}

.workout-skipped {
    opacity: 0.5;
}

/* ===== FAB ===== */
.fab {
    position: fixed;
    bottom: 24px;
    right: 50%;
    transform: translateX(calc(240px - 32px));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 20px var(--green-glow);
    transition: var(--transition);
    z-index: 50;
}

.fab:hover {
    background: var(--green-light);
    transform: translateX(calc(240px - 32px)) scale(1.08);
    text-decoration: none;
}

@media (max-width: 520px) {
    .fab {
        right: 24px;
        transform: none;
    }
    .fab:hover {
        transform: scale(1.08);
    }
}

/* ===== Workout Detail ===== */
.workout-detail {
    margin-top: 16px;
}

.workout-detail-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.workout-detail-meta {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
}
.workout-detail-desc {
    color: #888;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-top: 12px;
    text-align: center;
}

.workout-detail-photo {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

/* ===== Exercise Table ===== */
.exercise-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.exercise-table th {
    text-align: left;
    padding: 8px 6px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border);
}

.exercise-table td {
    padding: 10px 6px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.exercise-table td:nth-child(2) {
    text-align: left;
}

.exercise-thumb {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.exercise-thumb-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.exercise-thumb-placeholder.exercise-thumb-video {
    background: #4CAF50;
    border: none;
}

.exercise-name-cell {
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-input {
    width: 48px;
    padding: 6px 4px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
    text-align: center;
    outline: none;
}

.table-input:focus {
    border-color: var(--green);
}

.exercise-check {
    cursor: pointer;
    display: flex;
}

.exercise-check input {
    display: none;
}

.exercise-check svg {
    color: var(--text-muted);
    transition: var(--transition);
}

.exercise-check input:checked + svg {
    color: var(--green-light);
}

/* ===== Workout Bottom Actions ===== */
.workout-actions-bottom {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== Exercise Edit Card ===== */
.exercise-edit-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.exercise-edit-num {
    font-weight: 700;
    color: var(--green-light);
    margin-bottom: 8px;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state p:first-child {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ===== Success Page ===== */
.success-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 40px 20px;
    text-align: center;
}

.success-icon {
    margin-bottom: 24px;
}

.success-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 32px;
}

/* ===== Progress ===== */
.progress-overview {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
    padding: 24px 0;
}

.progress-ring-container {
    position: relative;
    margin-bottom: 24px;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--green-light);
}

.progress-stats {
    display: flex;
    gap: 32px;
}

.progress-stat {
    text-align: center;
}

.progress-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.progress-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.progress-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.progress-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.progress-item:first-child {
    border-top: 1px solid var(--border);
}

.progress-item-num {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-secondary);
    min-width: 28px;
    text-align: center;
}

.progress-item-info {
    flex: 1;
}

.progress-item-name {
    font-weight: 500;
}

.progress-completed .progress-item-num {
    color: var(--green-light);
}

.progress-skipped {
    opacity: 0.6;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

/* ===== Workout Hint ===== */
.workout-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(46, 125, 50, 0.1);
    border: 1px solid rgba(46, 125, 50, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--green-light);
    margin-bottom: 16px;
}

.workout-hint svg {
    flex-shrink: 0;
}

.custom-badge {
    display: inline-block;
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(46, 125, 50, 0.2);
    color: var(--green-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
    margin-left: 4px;
}

.btn-lg {
    padding: 18px 24px;
    font-size: 1.05rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 8px;
    text-decoration: underline;
    font-family: inherit;
}

.btn-link:hover {
    color: var(--text-secondary);
}

/* ===== Search ===== */
.search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
}

.search-btn {
    flex-shrink: 0;
    width: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Client List ===== */
.client-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.client-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
}

.client-card:first-child {
    border-top: 1px solid var(--border);
}

.client-card:hover {
    text-decoration: none;
    opacity: 0.8;
}

.client-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.client-info {
    flex: 1;
    min-width: 0;
}

.client-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.client-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.tg-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 4px;
    background: #2AABEE;
    color: white;
    font-weight: 700;
}

.client-stats {
    text-align: center;
    flex-shrink: 0;
}

.client-stat-num {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--green-light);
}

.client-stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.client-count {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 16px;
}

/* ===== Client Profile ===== */
.client-profile {
    text-align: center;
    padding: 20px 0;
    margin-bottom: 8px;
}

.client-avatar-lg {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0 auto 12px;
}

.client-profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.client-profile-meta {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.client-profile-tg {
    font-size: 0.8rem;
    color: #2AABEE;
    margin-bottom: 2px;
}

.client-profile-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== History List ===== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
}

.history-item:first-child {
    border-top: 1px solid var(--border);
}

.history-item:hover {
    text-decoration: none;
    opacity: 0.8;
}

.history-active {
    background: rgba(46, 125, 50, 0.08);
    margin: 0 -20px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    border: none;
}

.history-info {
    flex: 1;
}

.history-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.exercise-name-cell-wide {
    max-width: 140px;
    font-weight: 500;
}

/* ===== Spinner ===== */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Trainer Profile ===== */
.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 20px 0;
}

.profile-avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-card);
    border: 3px solid var(--green);
}

.profile-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--green-light);
    background: var(--bg-card);
}

/* ===== Group Titles ===== */
.group-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--green-light);
    margin: 24px 0 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--green);
}

.group-subtitle {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 16px 0 8px;
}

.group-count {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ===== Workout Card V2 ===== */
.workout-list-sortable,
.exercise-list-sortable {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.workout-card-v2,
.exercise-card-v2 {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    transition: opacity 0.2s, background 0.2s;
}

.workout-card-v2:first-child,
.exercise-card-v2:first-child {
    border-top: 1px solid var(--border);
}

.drag-handle {
    cursor: grab;
    padding: 8px 4px;
    color: var(--text-muted);
    flex-shrink: 0;
    touch-action: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.dragging {
    opacity: 0.3;
}

.drag-placeholder {
    border: 2px dashed var(--green);
    border-radius: var(--radius-sm);
    background: rgba(46, 125, 50, 0.05);
}

.drag-clone {
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--green);
    padding: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

.workout-thumb-sm {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.workout-thumb-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.workout-thumb-placeholder-sm {
    width: 100%;
    height: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.workout-card-info,
.exercise-card-info {
    flex: 1;
    min-width: 0;
    color: var(--text);
    text-decoration: none;
}

.workout-card-info:hover,
.exercise-card-info:hover {
    text-decoration: none;
}

.workout-card-actions {
    flex-shrink: 0;
}

.exercise-card-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.exercise-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.exercise-card-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.exercise-card-params {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== Workout Cover ===== */
.workout-cover-section {
    text-align: center;
    margin-bottom: 20px;
}

.workout-cover-img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 10px;
}

.workout-cover-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 20px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.cover-upload-btn {
    display: inline-block;
    cursor: pointer;
}

.cover-upload-btn input[type="file"] {
    display: none;
}

/* ===== Tags ===== */
.workout-tags {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tag-gender {
    background: rgba(46, 125, 50, 0.15);
    color: var(--green-light);
}

.tag-level {
    background: rgba(255, 152, 0, 0.15);
    color: var(--warning);
}

/* ===== Form Row 2 ===== */
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ===== Select ===== */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ===== Exercises Section ===== */
.exercises-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.exercises-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.exercises-header .section-title {
    margin: 0;
}

/* ===== Media Grid ===== */
.media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.media-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: var(--transition);
}

.file-upload-area:hover {
    border-color: var(--green);
    color: var(--green-light);
}

.file-upload-area input[type="file"] {
    display: none;
}

/* ===== Client Top Bar ===== */
.client-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}
.client-top-bar .page-title {
    margin-bottom: 4px;
}
.client-top-bar .page-subtitle {
    margin-bottom: 0;
}
.settings-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: var(--transition);
    flex-shrink: 0;
}
.settings-icon-btn:hover {
    color: var(--green-light);
    border-color: var(--green);
}

/* ===== Settings Radio Row ===== */
.settings-radio-row {
    display: flex;
    gap: 12px;
}
.settings-radio {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}
.settings-radio input { display: none }
.settings-radio.active {
    border-color: var(--green);
    background: rgba(46,125,50,0.12);
    color: var(--green-light);
}

/* ===== Trainer Select ===== */
.trainer-select-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.trainer-select-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}
.trainer-select-item input { display: none }
.trainer-select-item.active {
    border-color: var(--green);
    background: rgba(46,125,50,0.12);
}
.trainer-select-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
    overflow: hidden;
}
.trainer-select-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.trainer-select-info {
    flex: 1;
    min-width: 0;
}
.trainer-select-name {
    font-weight: 600;
    font-size: 0.95rem;
}
.trainer-select-item.active .trainer-select-name {
    color: var(--green-light);
}
.trainer-select-bio {
    font-size: 0.8rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Client Workout Card Link ===== */
.workout-card-link,
.workout-card-link:hover,
.workout-card-link:active,
.workout-card-link:focus {
    text-decoration: none !important;
    color: inherit;
    display: block;
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
    box-shadow: none !important;
}
.client-workout-list {
    width: calc(100% + 40px);
    margin: 0 -20px;
    padding: 0;
    box-sizing: border-box;
}
.client-workout-list .workout-card-link {
    width: 100% !important;
    min-width: 100% !important;
    box-sizing: border-box;
}
.client-workout-list .workout-card {
    width: 100% !important;
    min-width: 100% !important;
    box-sizing: border-box;
}
.workout-done-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: auto;
}

/* ===== Client Workout Detail Page ===== */
.cw-page {
    padding-bottom: 100px;
}
.cw-cover {
    width: calc(100% + 40px);
    margin: 0 -20px 16px -20px;
    height: 200px;
    overflow: hidden;
    background: #1a1a1a;
}
.cw-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cw-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-top: 8px;
}
.cw-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.cw-title {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.2;
}
.cw-meta {
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.4;
    margin: -14px 0 12px 52px;
}
.cw-desc {
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 16px 52px;
}
.cw-exercises {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.cw-exercise-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.cw-ex-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.cw-ex-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.cw-ex-name {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Description: collapsed 2 lines */
.cw-ex-desc-wrap {
    max-height: 2.8em;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-bottom: 4px;
}
.cw-ex-desc-wrap.expanded {
    max-height: 600px;
}
.cw-ex-desc-text {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.cw-ex-more {
    background: none;
    border: none;
    color: var(--green-light);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    margin-bottom: 12px;
}

/* Media images */
.cw-ex-media {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}
.cw-ex-media img {
    width: 100px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

/* Big params: 3 rows */
.cw-ex-params {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cw-param {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.cw-param-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.cw-param-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.cw-param-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: var(--transition);
}
.cw-param-btn:active {
    background: var(--green);
    border-color: var(--green);
}
.cw-param-value {
    width: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    -moz-appearance: textfield;
}
.cw-param-value::-webkit-inner-spin-button,
.cw-param-value::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Bottom spacer & fixed button */
.cw-bottom-spacer {
    height: 20px;
}
.cw-fixed-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(transparent, var(--bg-primary) 30%);
    z-index: 100;
}
.cw-fixed-bottom .btn {
    max-width: 480px;
    margin: 0 auto;
    display: block;
}

/* ===== Exercise List (workout page - compact) ===== */
.cw-progress-bar {
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    margin: 0 0 8px;
    overflow: hidden;
}
.cw-progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 2px;
    transition: width 0.3s ease;
}
.cw-progress-text {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 16px;
}
.cw-exercise-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 100px;
}
.cw-exlist-card,
.cw-exlist-card:hover,
.cw-exlist-card:active {
    text-decoration: none !important;
}
.cw-exlist-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 14px 12px;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
    transition: var(--transition);
}
.cw-exlist-card:active {
    transform: scale(0.98);
}
.cw-exlist-completed {
    opacity: 0.7;
}
.cw-exlist-skipped {
    opacity: 0.5;
}
.cw-exlist-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #888;
    flex-shrink: 0;
}
.cw-exlist-info {
    flex: 1;
    min-width: 0;
}
.cw-exlist-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}
.cw-exlist-desc {
    font-size: 0.8rem;
    color: #888;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}
.cw-exlist-status {
    flex-shrink: 0;
}

/* ===== Exercise Detail Page ===== */
.cw-ex-counter {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 2px;
}
.ex-detail-form {
    padding-bottom: 160px;
}
.ex-desc-wrap {
    max-height: 3.2em;
    overflow: hidden;
    line-height: 1.6;
    font-size: 0.9rem;
    color: #ccc;
    margin-bottom: 4px;
    transition: max-height 0.3s ease;
}
.ex-desc-wrap.expanded {
    max-height: 2000px;
}
.ex-desc-toggle {
    background: none;
    border: none;
    color: var(--green);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    margin-bottom: 16px;
    display: block;
}
.ex-video-wrap {
    width: calc(100% + 40px);
    margin: 0 -20px 20px;
    background: #000;
    -webkit-touch-callout: none;
    user-select: none;
    position: relative;
    overflow: hidden;
}
.pv-player .ex-video,
.pv-player .pv-video {
    display: block;
    width: 100%;
    min-height: 220px;
    max-height: 55vh;
    border-radius: 0;
    background: #000;
    object-fit: contain;
}
.pv-watermark {
    position: absolute;
    right: 10px;
    bottom: 52px;
    z-index: 3;
    pointer-events: none;
    color: rgba(255, 255, 255, 0.42);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
    max-width: 70%;
    text-align: right;
    line-height: 1.25;
}
.pv-loader {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    pointer-events: none;
}
.pv-player.is-loading .pv-loader {
    display: flex;
}
.pv-player.is-loading .pv-center-play,
.pv-player.is-loading .pv-bar {
    opacity: 0;
    pointer-events: none;
}
.pv-player.is-error .pv-loader {
    display: flex;
    background: rgba(0, 0, 0, 0.82);
}
.pv-player.is-error .pv-loader-text {
    color: #fca5a5;
}
.pv-loader-spin {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(255, 255, 255, 0.22);
    border-top-color: var(--green, #22c55e);
    border-radius: 50%;
    animation: pv-spin 0.8s linear infinite;
}
.pv-loader-text {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.9;
}
@keyframes pv-spin {
    to { transform: rotate(360deg); }
}
.pv-center-play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 72px;
    height: 72px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    z-index: 2;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.pv-player.is-playing .pv-center-play {
    opacity: 0;
    pointer-events: none;
}
.pv-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
}
.pv-play-toggle {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.pv-seek {
    flex: 1;
    min-width: 0;
    accent-color: var(--green, #22c55e);
}
.pv-time {
    color: #f3f3f3;
    font-size: 12px;
    white-space: nowrap;
    min-width: 84px;
    text-align: right;
}
.pv-fullscreen {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.pv-fullscreen svg {
    width: 18px;
    height: 18px;
    display: block;
}
.pv-fullscreen svg[hidden] {
    display: none !important;
}
.pv-player:fullscreen,
.pv-player:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    background: #000;
}
.pv-player:fullscreen .pv-video,
.pv-player:-webkit-full-screen .pv-video {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    object-fit: contain;
}
.pv-player:fullscreen .pv-bar,
.pv-player:-webkit-full-screen .pv-bar {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.ex-video {
    display: block;
    width: 100%;
    min-height: 220px;
    max-height: 55vh;
    border-radius: 0;
}
.ex-media-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}
.ex-media-scroll img {
    height: 180px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}
.ex-params-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ex-param-row {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ex-param-label {
    font-size: 1rem;
    font-weight: 600;
    color: #ccc;
}
.ex-param-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ex-param-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: transparent;
    color: #fff;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.ex-param-btn:active {
    background: var(--green);
    border-color: var(--green);
}
.ex-param-value {
    width: 60px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    -moz-appearance: textfield;
}
.ex-param-value::-webkit-inner-spin-button,
.ex-param-value::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.ex-bottom-spacer {
    height: 20px;
}
.ex-fixed-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(transparent, var(--bg-primary) 30%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ex-fixed-bottom .btn {
    max-width: 480px;
    margin: 0 auto;
    display: block;
    width: 100%;
}
.btn-secondary {
    background: var(--bg-secondary);
    color: #ccc;
    border: 1px solid var(--border);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}
.btn-secondary:active {
    background: var(--border);
}

/* ===== Dashboard badges ===== */
.workout-last-badge {
    display: inline-block;
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    margin-top: 2px;
}
.workout-today-badge {
    display: inline-block;
    background: rgba(33, 150, 243, 0.15);
    color: #2196F3;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    margin-top: 2px;
    margin-left: 4px;
}

/* ===== Trainer Clients ===== */
.tc-search-form {
    margin-bottom: 20px;
}
.tc-search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border);
}
.tc-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
}
.tc-search-input::placeholder {
    color: #666;
}
.tc-filters-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 10px;
}
@media (min-width: 560px) {
    .tc-filters-grid {
        grid-template-columns: 1fr 1fr;
    }
}
.tc-filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tc-filter-label {
    font-size: 0.8rem;
    color: #888;
}
.tc-filter-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: #fff;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
.tc-filter-select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-glow);
}
.tc-filters-reset {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.85rem;
    color: #9aa0a6;
}
.tc-filters-reset:hover {
    color: var(--green-light);
}
.tc-active-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: -8px;
    margin-bottom: 14px;
}
.tc-active-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(76, 175, 80, 0.35);
    background: rgba(76, 175, 80, 0.12);
    color: #b9e7bc;
    font-size: 0.78rem;
    text-decoration: none;
}
.tc-active-chip:hover {
    border-color: rgba(76, 175, 80, 0.55);
    color: #d2f3d4;
    text-decoration: none;
}
.tc-active-chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.25);
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1;
}
.tc-section {
    margin-bottom: 24px;
}
.tc-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tc-section-count {
    background: var(--bg-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    color: #888;
}
.tc-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.tc-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 14px 12px;
}
.tc-card-link {
    text-decoration: none;
    color: inherit;
    border: 1px solid transparent;
}
.tc-card-link:hover,
.tc-card-link:focus,
.tc-card-link:active,
.tc-card-link:visited {
    text-decoration: none;
    color: inherit;
}
.tc-card-link:active {
    transform: scale(0.995);
}
.tc-card-link:hover {
    border-color: var(--border);
}
.tc-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    font-weight: 700;
    color: var(--green);
    font-size: 1.1rem;
}
.tc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tc-info {
    flex: 1;
    min-width: 0;
}
.tc-name {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.tc-badge-assigned {
    display: inline-block;
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
}
.tc-badge-blocked {
    display: inline-block;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
}
.tc-badge-trainer {
    display: inline-block;
    background: rgba(136, 136, 136, 0.2);
    color: #999;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 4px;
}
.tc-email {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 2px;
}
.tc-client-meta {
    font-size: 0.78rem;
    color: #9eb0a4;
    margin-top: 4px;
    margin-bottom: 2px;
    line-height: 1.35;
}
/* Админка /admin/clients.php — колонка «Профиль» */
.admin-client-profile-cell {
    font-size: 0.82rem;
    color: #9eb0a4;
    line-height: 1.4;
    vertical-align: top;
    max-width: 340px;
    white-space: normal;
}
.tc-request-date {
    font-size: 0.73rem;
    color: #ffb3b3;
    margin-top: 2px;
}
.tc-last {
    font-size: 0.75rem;
    color: #999;
    margin-top: 2px;
}
.tc-last.tc-last-stale {
    color: #ff7b7b;
}
.tc-date {
    color: #666;
    margin-left: 4px;
}
.tc-last.tc-last-stale .tc-date {
    color: #ff9a9a;
}
.tc-stale-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    background: rgba(231, 76, 60, 0.85);
}
.tc-stats {
    text-align: center;
    flex-shrink: 0;
}
.tc-stat-num {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--green);
}
.tc-stat-label {
    font-size: 0.65rem;
    color: #888;
}

/* ===== Trainer Client History ===== */
.client-history-wrap {
    overflow-x: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.client-history-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.client-history-table th,
.client-history-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}
.client-history-table th {
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}
.client-history-table tbody tr:last-child td {
    border-bottom: none;
}
.ch-session-row {
    cursor: pointer;
}
.ch-session-row:hover td {
    background: rgba(255, 255, 255, 0.03);
}
.ch-details-row td {
    background: rgba(255, 255, 255, 0.02);
    padding: 0;
}
.client-history-inner-table {
    width: 100%;
    border-collapse: collapse;
}
.client-history-inner-table th,
.client-history-inner-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}
.client-history-inner-table th {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.02);
}
.client-history-inner-table tbody tr:last-child td {
    border-bottom: none;
}
.ch-empty {
    padding: 12px 10px;
    color: #888;
    font-size: 0.85rem;
}

/* ===== Utilities ===== */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
